-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add clone operation for draft artifacts #95
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're making some README updates, currently the docker compose example listed in the README is out of date. I would recommend just getting rid of the copied docker example text and just linking to the docker example file instead so they don't both need to be changed for a given update.
changes to the READMEs look great ✅ |
57b1526
to
a286dc2
Compare
Summary
This PR implements the
$clone
operation as described by the Quality Measure IG here. There is currently no OperationDefinition for $clone like there is for $draft and $release in the CRMI IG, so the functionality for this operation is subject to change. For now, this PR implements functionality to clone a draft artifact in the draft-repository (authoring measure repository).New behavior
There is now a "Clone" button amongst the "Review", "Edit", and "Delete" buttons for draft artifacts in the draft-repository frontend. When the user clicks on the "Clone" button, a confirmation modal appears notifying the user that the action will clone that artifact and any of its children. The act of cloning (for now) means that a draft artifact and its children are given a new ID and their versions are incremented (tried 10 times and errors out if it does not have a unique URL and version combination), but the URL and status: "draft" remains the same. Again, this is subject to change as the definition of clone adapts and is potentially discussed at the Connectathon.
Code changes
app/src/components/DeletionConfirmationModal.tsx
->app/src/components/ConfirmationModal.tsx
- made theDeletionConfirmationModal
reusable for clone confirmation as well.app/src/components/ResourceInfoCard.tsx
- made success and error notifications reusable for delete and clone, added trpccloneMutation
,ConfirmationModal
for clone, and "clone" button.app/src/pages/authoring/index.tsx
-trpc.useContext()
is now deprecated so it has to be replaced withuseUtils()
.app/src/server/db/dbOperations.ts
- addbatchCloneDraft
function.app/src/server/trpc/routers/draft.ts
- consolidate code into helper functiongetParentDraftArtifactAndChildren
and addcloneParent
procedure.app/src/server/trpc/routers/service.ts
- reusablemodifyResource
for draft and clone.app/src/util/draftHelper.ts
- move reused code for getting a parent artifact and its children fromrouters/draft.ts
.app/src/util/modifyResourceFields.ts
- makemodifyResourceToDraft
reusable for both modifying to draft and modifying for clone.Testing guidance
npm run check:all
cd service
npm run db:loadBundle <path to bundle>
(recommended to use the one I edited for recursive delete testing.cd ..
npm run start:all
Question for Reviewer
setIsCloneConfirmationModalOpen(false)
andsetIsDeleteConfirmationModalOpen(false)
, but if you comment out both of those lines, you will see that the behavior is unchanged for delete but does not work for clone. I am very curious why this behavior is happening if anyone has any ideas!