Skip to content

feat: clone proposal workflows#1574

Open
ChongJiaChua wants to merge 3 commits into
developfrom
1530_Clone_Proposal_Workflows
Open

feat: clone proposal workflows#1574
ChongJiaChua wants to merge 3 commits into
developfrom
1530_Clone_Proposal_Workflows

Conversation

@ChongJiaChua

@ChongJiaChua ChongJiaChua commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Closes UserOfficeProject/issue-tracker/issues/1530

Description

This PR introduces a clone button to each workflow entry. Cloning a workflow creates a direct copy of it that can be opened and customised independently.

Motivation and Context

It is complicated and time consuming to create a workflow from scratch. This change allows users to duplicate an existing workflow as a starting point and make the necessary changes in a shorter time frame.

How Has This Been Tested

Added unit and e2e tests.

Fixes

Changes

  1. Added a method that copies a workflow and all related records in a database transaction.
  2. Added cloneWorkflow mutation with role-based access control and input validation.
  3. Added a new GraphQL resolver and validation schema to support the cloneWorkflow mutation.
  4. Added a clone action button to the workflows table with a confirmation dialog.
  5. Added a cloneWorkflow GraphQL mutation query on the frontend.

Depends on

Tests included/Docs Updated?

  • I have added tests to cover my changes.
  • All relevant doc has been updated

@ChongJiaChua ChongJiaChua marked this pull request as ready for review June 15, 2026 11:11
@ChongJiaChua ChongJiaChua requested a review from a team as a code owner June 15, 2026 11:11
@ChongJiaChua ChongJiaChua requested review from Bhaswati1148 and removed request for a team June 15, 2026 11:11
@ChongJiaChua ChongJiaChua self-assigned this Jun 15, 2026

@TCMeldrum TCMeldrum left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm tho we might want to wait for #1391 to go in first before we merge

);

if (newPrevStatusId === undefined || newNextStatusId === undefined) {
continue;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: can we throw here? This should never happen, but if happens is an indication of an issue somewher upstream and would be nice to know about it so we can fix it. Othwerise the clonde will appear as successful but in fact will have missing connections.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeap good point. I've changed it to throw a GraphQLError so no incomplete clone gets saved.

Comment thread apps/e2e/cypress/e2e/settings.cy.ts Outdated

cy.contains('Yes').click();

cy.contains(`Copy of ${workflowName}`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: would it be possble to inspect also the contents of the cloned workflow? The real work in this PR is done in the database layer so changes cant effectivelly be targegeted by Unit Tests. So adding some checks here in e2e could effectivelly check if the DB operations went though fine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the test to set up a status and connection before cloning, then open the cloned workflow and verify the metadata, statuses and connection edge are all present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clone proposal workflows

3 participants