Skip to content
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

[AN-150] FC UI migration - Adds Clone method snapshot functionality #5162

Open
wants to merge 19 commits into
base: dev
Choose a base branch
from

Conversation

salonishah11
Copy link
Contributor

@salonishah11 salonishah11 commented Nov 7, 2024

Jira Ticket: https://broadworkbench.atlassian.net/browse/AN-150

Summary of changes:

What

  • adds clone method functionality
  • I have renamed CreateMethodProvider and its functions to PostMethodProvider so that it can be used for both create new method and clone method - both use the same POST /method API call

Why

  • FC UI migration

Testing strategy

  • manual testing
  • unit tests

Visual Aids

Snapshot menu
Screenshot 2024-11-15 at 4 32 49 PM

Clone snapshot is available even when user is not snapshot owner
Screenshot 2024-11-15 at 4 33 39 PM

Clone snapshot modal

@@ -289,6 +293,24 @@ export const WorkflowsContainer = (props: WorkflowContainerProps) => {
setPermissionsModalOpen,
refresh: loadSnapshot,
}),
showCloneModal &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

One thing to maybe discuss during the UX review today, is that the button shows clone snapshot, but then it opens a clone method modal 🤔
It does not seem like there is a difference between a snapshot or a method, is there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is a good point. It is actually cloning the snapshot (of that method) that is selected from the dropdown. I think it might make more sense to call everything Clone snapshot instead. I am going to change that and based on the outcome of UX discussion it can be changed again later.

@salonishah11
Copy link
Contributor Author

@LizBaldo @sam-schu any objections if I replace the new code added in this PR to refer to version instead of snapshot? Or would it make sense to do it all together as part of https://broadworkbench.atlassian.net/browse/AN-240?

@salonishah11 salonishah11 changed the title [AN-150] FC UI migration - Adds Clone method functionality [AN-150] FC UI migration - Adds Clone method snapshot functionality Nov 7, 2024
@sam-schu
Copy link
Contributor

sam-schu commented Nov 7, 2024

@salonishah11 Given that we are completing AN-240 before the official feature preview release, I am fine either way, but if we updated the language for this PR now, we would need to decide now whether we want to update all internal naming referring to "snapshot" or just user-facing language.

@LizBaldo
Copy link
Collaborator

LizBaldo commented Nov 7, 2024

My two cents is to do the nam change in a different PR, just in case we need to revert 😬

@salonishah11
Copy link
Contributor Author

Based on above comments, snapshots to versions can be done in later PR 👍

Copy link
Contributor

@sam-schu sam-schu left a comment

Choose a reason for hiding this comment

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

Looks good overall! All suggestions are minor. One more thing to think about that is completely up to you: maybe we should move Clone to the top of the menu now that all the menu options are always displayed, since Clone is the only option enabled for non-owners?

);
expect(within(dialog).getByTestId('wdl editor')).toHaveDisplayValue(mockSnapshot.payload.toString());
});

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add a test similar to WorkflowList.test.tsx > create workflow modal > uploads a new workflow and navigates to its workflow details page to check that the right values were given for the postMethodProvider and onSuccess props of the clone modal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you think that test case would be covered by this test? This test checks that the postMethodProvider has been called with correct values on submit.

Copy link
Contributor

Choose a reason for hiding this comment

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

That test is for the modal component itself, and as far as I can tell doesn't really test anything not already tested by the existing tests in that file (which makes sense since the only changes to the modal component were naming changes). The test I am suggesting would be for the WorkflowWrapper, to make sure that the right functions are called by the clone modal specifically as used in the workflow wrapper. (For onSuccess, for example: for the create workflow modal, the tests for WorkflowModal check that whatever function was given for onSuccess will be called, and the tests for WorkflowList check that specifically Nav.goToPath is called by the actual modal used on the workflow list page.)

Copy link
Contributor

Choose a reason for hiding this comment

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

This test should probably cover postMethodProvider and onSuccess, but SonarCloud shows that the real onSuccess code is never being run in tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added the suggested test.

src/pages/methods/workflow-details/WorkflowWrapper.ts Outdated Show resolved Hide resolved
src/pages/methods/workflow-details/WorkflowWrapper.ts Outdated Show resolved Hide resolved
src/pages/methods/workflow-details/WorkflowWrapper.ts Outdated Show resolved Hide resolved
src/workflows/methods/SnapshotActionMenu.test.tsx Outdated Show resolved Hide resolved
src/workflows/methods/modals/WorkflowModal.tsx Outdated Show resolved Hide resolved
@salonishah11
Copy link
Contributor Author

salonishah11 commented Nov 14, 2024

maybe we should move Clone to the top of the menu now that all the menu options are always displayed, since Clone is the only option enabled for non-owners?

@sam-schu regarding this I see your point. But putting Clone Snapshot at top kind of makes the flow weird with ".. snapshot", ".. snapshot permissions" in between followed by ".. snapshot".
Screenshot 2024-11-14 at 2 43 39 PM

How about we move it to the bottom?
Screenshot 2024-11-14 at 2 43 59 PM

Another option is to order them like this? 🤔
Screenshot 2024-11-14 at 3 31 16 PM

Copy link

sonarcloud bot commented Nov 15, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants