-
Notifications
You must be signed in to change notification settings - Fork 21
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
base: dev
Are you sure you want to change the base?
Changes from 13 commits
f068ade
7d2648f
3ee8261
df47b02
245b33c
fff2d1f
b0a87bb
2f6cc48
bb2920a
3218428
5b6e01a
6c01892
69e231d
7373ed9
00d34ca
98f4bb8
47afaff
52d1106
694f54b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ import { TabBar } from 'src/components/tabBars'; | |
import { TopBar } from 'src/components/TopBar'; | ||
import { Ajax } from 'src/libs/ajax'; | ||
import { Snapshot } from 'src/libs/ajax/methods/methods-models'; | ||
import { postMethodProvider } from 'src/libs/ajax/methods/providers/PostMethodProvider'; | ||
import { makeExportWorkflowFromMethodsRepoProvider } from 'src/libs/ajax/workspaces/providers/ExportWorkflowToWorkspaceProvider'; | ||
import { ErrorCallback, withErrorReporting } from 'src/libs/error'; | ||
import * as Nav from 'src/libs/nav'; | ||
|
@@ -19,6 +20,7 @@ import * as Utils from 'src/libs/utils'; | |
import { withBusyState } from 'src/libs/utils'; | ||
import DeleteSnapshotModal from 'src/workflows/methods/modals/DeleteSnapshotModal'; | ||
import { PermissionsModal } from 'src/workflows/methods/modals/PermissionsModal'; | ||
import { WorkflowModal } from 'src/workflows/methods/modals/WorkflowModal'; | ||
import SnapshotActionMenu from 'src/workflows/methods/SnapshotActionMenu'; | ||
import ExportWorkflowModal from 'src/workflows/modals/ExportWorkflowModal'; | ||
import { isGoogleWorkspace, WorkspaceInfo, WorkspaceWrapper } from 'src/workspaces/utils'; | ||
|
@@ -122,6 +124,7 @@ export const WorkflowsContainer = (props: WorkflowContainerProps) => { | |
const [snapshotNotFound, setSnapshotNotFound] = useState<boolean>(false); | ||
const [exportingWorkflow, setExportingWorkflow] = useState<boolean>(false); | ||
const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false); | ||
const [showCloneModal, setShowCloneModal] = useState<boolean>(false); | ||
const [busy, setBusy] = useState<boolean>(false); | ||
const [permissionsModalOpen, setPermissionsModalOpen] = useState<boolean>(false); | ||
|
||
|
@@ -239,6 +242,7 @@ export const WorkflowsContainer = (props: WorkflowContainerProps) => { | |
isSnapshotOwner, | ||
onEditPermissions: () => setPermissionsModalOpen(true), | ||
onDelete: () => setShowDeleteModal(true), | ||
onClone: () => setShowCloneModal(true), | ||
}), | ||
]), | ||
] | ||
|
@@ -289,6 +293,31 @@ export const WorkflowsContainer = (props: WorkflowContainerProps) => { | |
setPermissionsModalOpen, | ||
refresh: loadSnapshot, | ||
}), | ||
showCloneModal && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
h(WorkflowModal, { | ||
title: 'Clone snapshot', | ||
defaultName: name.concat('_copy'), | ||
defaultWdl: snapshot?.payload, | ||
salonishah11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
defaultDocumentation: snapshot?.documentation, | ||
defaultSynopsis: snapshot?.synopsis, | ||
defaultSnapshotComment: snapshot?.snapshotComment, | ||
salonishah11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
buttonActionName: 'Clone snapshot', | ||
salonishah11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
postMethodProvider, | ||
onSuccess: (namespace: string, name: string, snapshotId: number) => { | ||
// when the user has owner permissions on the original method, there is an interesting situation where | ||
// if the user types in the same namespace and name for the cloned method as the original method, | ||
// instead of creating a new method Agora will create a new snapshot of the original method. | ||
// Hence, to ensure the data is correct in the UI we reset the cached snapshot list store and then load the page. | ||
// (Note: this behaviour is same as in Firecloud UI) | ||
snapshotsListStore.reset(); | ||
Nav.goToPath('workflow-dashboard', { | ||
namespace, | ||
name, | ||
snapshotId, | ||
}); | ||
}, | ||
onDismiss: () => setShowCloneModal(false), | ||
}), | ||
busy && spinnerOverlay, | ||
snapshotNotFound && h(NotFoundMessage, { subject: 'snapshot' }), | ||
snapshot && div({ style: { flex: 1, display: 'flex', flexDirection: 'column' } }, [children]), | ||
|
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.
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 thepostMethodProvider
andonSuccess
props of the clone modal?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.
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.
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.
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 foronSuccess
will be called, and the tests for WorkflowList check that specificallyNav.goToPath
is called by the actual modal used on the workflow list page.)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.
This test should probably cover
postMethodProvider
andonSuccess
, but SonarCloud shows that the realonSuccess
code is never being run in tests.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.
I have added the suggested test.