[ARVADOS-WORKBENCH2] updated: 2.1.0-116-gb115fc74

Git user git at public.arvados.org
Mon Nov 30 23:13:48 UTC 2020


Summary of changes:
 cypress/integration/collection-panel.spec.js             |  2 ++
 src/store/collections/collection-version-actions.ts      | 16 ++++++++++++++++
 .../recover-version-dialog.ts}                           |  8 ++++----
 .../context-menu/action-sets/collection-action-set.ts    |  4 ++--
 src/views/workbench/workbench.tsx                        |  2 ++
 5 files changed, 26 insertions(+), 6 deletions(-)
 copy src/views-components/{groups-dialog/remove-dialog.ts => collections-dialog/recover-version-dialog.ts} (63%)

       via  b115fc744de44c3b4493de9ca3f80fe7ca326d0d (commit)
      from  adc0008ee9319b6201a6d7bac5bc76757d59c0b8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit b115fc744de44c3b4493de9ca3f80fe7ca326d0d
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Mon Nov 30 20:13:10 2020 -0300

    17098: Adds confirmation dialog on 'Recover version' action.
    
    Also updates integeration test.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/cypress/integration/collection-panel.spec.js b/cypress/integration/collection-panel.spec.js
index 9c5c656a..183a3636 100644
--- a/cypress/integration/collection-panel.spec.js
+++ b/cypress/integration/collection-panel.spec.js
@@ -415,6 +415,8 @@ describe('Collection panel tests', function() {
             });
             cy.get('[data-cy=collection-panel-options-btn]').click()
             cy.get('[data-cy=context-menu]').contains('Recover version').click();
+            cy.get('[data-cy=confirmation-dialog]').should('contain', 'Recover version');
+            cy.get('[data-cy=confirmation-dialog-ok-btn]').click();
             cy.get('[data-cy=collection-info-panel]')
                 .should('not.contain', 'This is an old version');
             cy.get('[data-cy=collection-version-number]').should('contain', '4');
diff --git a/src/store/collections/collection-version-actions.ts b/src/store/collections/collection-version-actions.ts
index 007dedcd..7e50b07a 100644
--- a/src/store/collections/collection-version-actions.ts
+++ b/src/store/collections/collection-version-actions.ts
@@ -8,6 +8,22 @@ import { ServiceRepository } from '~/services/services';
 import { snackbarActions, SnackbarKind } from "../snackbar/snackbar-actions";
 import { resourcesActions } from "../resources/resources-actions";
 import { navigateTo } from "../navigation/navigation-action";
+import { dialogActions } from "../dialog/dialog-actions";
+
+export const COLLECTION_RECOVER_VERSION_DIALOG = 'collectionRecoverVersionDialog';
+
+export const openRecoverCollectionVersionDialog = (uuid: string) =>
+    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        dispatch(dialogActions.OPEN_DIALOG({
+            id: COLLECTION_RECOVER_VERSION_DIALOG,
+            data: {
+                title: 'Recover version',
+                text: "Do you want to copy this as the new collection's head version? If you don't want to modify the current head version, you can just make a copy.",
+                confirmButtonLabel: 'Recover',
+                uuid
+            }
+        }));
+    };
 
 export const recoverVersion = (resourceUuid: string) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
diff --git a/src/views-components/collections-dialog/recover-version-dialog.ts b/src/views-components/collections-dialog/recover-version-dialog.ts
new file mode 100644
index 00000000..0da9ed17
--- /dev/null
+++ b/src/views-components/collections-dialog/recover-version-dialog.ts
@@ -0,0 +1,21 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch, compose } from 'redux';
+import { connect } from "react-redux";
+import { ConfirmationDialog } from "~/components/confirmation-dialog/confirmation-dialog";
+import { withDialog, WithDialogProps } from "~/store/dialog/with-dialog";
+import { COLLECTION_RECOVER_VERSION_DIALOG, recoverVersion } from '~/store/collections/collection-version-actions';
+
+const mapDispatchToProps = (dispatch: Dispatch, props: WithDialogProps<any>) => ({
+    onConfirm: () => {
+        props.closeDialog();
+        dispatch<any>(recoverVersion(props.data.uuid));
+    }
+});
+
+export const RecoverCollectionVersionDialog = compose(
+    withDialog(COLLECTION_RECOVER_VERSION_DIALOG),
+    connect(null, mapDispatchToProps)
+)(ConfirmationDialog);
\ No newline at end of file
diff --git a/src/views-components/context-menu/action-sets/collection-action-set.ts b/src/views-components/context-menu/action-sets/collection-action-set.ts
index a870a813..d32eaa3f 100644
--- a/src/views-components/context-menu/action-sets/collection-action-set.ts
+++ b/src/views-components/context-menu/action-sets/collection-action-set.ts
@@ -29,7 +29,7 @@ import { openSharingDialog } from '~/store/sharing-dialog/sharing-dialog-actions
 import { openAdvancedTabDialog } from "~/store/advanced-tab/advanced-tab";
 import { toggleDetailsPanel } from '~/store/details-panel/details-panel-action';
 import { copyToClipboardAction, openInNewTabAction } from "~/store/open-in-new-tab/open-in-new-tab.actions";
-import { recoverVersion } from "~/store/collections/collection-version-actions";
+import { openRecoverCollectionVersionDialog } from "~/store/collections/collection-version-actions";
 import { TogglePublicFavoriteAction } from "../actions/public-favorite-action";
 import { togglePublicFavorite } from "~/store/public-favorites/public-favorites-actions";
 import { publicFavoritePanelActions } from "~/store/public-favorites-panel/public-favorites-action";
@@ -142,7 +142,7 @@ export const oldCollectionVersionActionSet: ContextMenuActionSet = [
             icon: RecoverVersionIcon,
             name: 'Recover version',
             execute: (dispatch, { uuid }) => {
-                dispatch<any>(recoverVersion(uuid));
+                dispatch<any>(openRecoverCollectionVersionDialog(uuid));
             }
         },
     ]
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index b0f90894..8e47a739 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -99,6 +99,7 @@ import { CollectionsContentAddressPanel } from '~/views/collection-content-addre
 import { AllProcessesPanel } from '../all-processes-panel/all-processes-panel';
 import { NotFoundPanel } from '../not-found-panel/not-found-panel';
 import { AutoLogout } from '~/views-components/auto-logout/auto-logout';
+import { RecoverCollectionVersionDialog } from '~/views-components/collections-dialog/recover-version-dialog';
 
 type CssRules = 'root' | 'container' | 'splitter' | 'asidePanel' | 'contentWrapper' | 'content';
 
@@ -235,6 +236,7 @@ export const WorkbenchPanel =
             <ProcessCommandDialog />
             <ProcessInputDialog />
             <ProjectPropertiesDialog />
+            <RecoverCollectionVersionDialog />
             <RemoveApiClientAuthorizationDialog />
             <RemoveComputeNodeDialog />
             <RemoveGroupDialog />

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list