[ARVADOS-WORKBENCH2] created: 1.1.4-572-g20b5587

Git user git at public.curoverse.com
Thu Aug 9 06:09:01 EDT 2018


        at  20b5587edcc69eb39f91f4fb1f2eb68e5b7827d5 (commit)


commit 20b5587edcc69eb39f91f4fb1f2eb68e5b7827d5
Author: Janicki Artur <artur.janicki at contractors.roche.com>
Date:   Thu Aug 9 12:08:41 2018 +0200

    add possibility to edit collection from data explorer
    
    Feature #13898
    
    Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki at contractors.roche.com>

diff --git a/src/index.tsx b/src/index.tsx
index aac275f..dd27223 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -26,6 +26,7 @@ import { favoriteActionSet } from "./views-components/context-menu/action-sets/f
 import { collectionFilesActionSet } from './views-components/context-menu/action-sets/collection-files-action-set';
 import { collectionFilesItemActionSet } from './views-components/context-menu/action-sets/collection-files-item-action-set';
 import { collectionActionSet } from './views-components/context-menu/action-sets/collection-action-set';
+import { collectionResourceActionSet } from './views-components/context-menu/action-sets/collection-resource-action-set';
 
 addMenuActionSet(ContextMenuKind.ROOT_PROJECT, rootProjectActionSet);
 addMenuActionSet(ContextMenuKind.PROJECT, projectActionSet);
@@ -34,6 +35,7 @@ addMenuActionSet(ContextMenuKind.FAVORITE, favoriteActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_FILES, collectionFilesActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_FILES_ITEM, collectionFilesItemActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION, collectionActionSet);
+addMenuActionSet(ContextMenuKind.COLLECTION_RESOURCE, collectionResourceActionSet);
 
 fetchConfig()
     .then(config => {
diff --git a/src/store/collections/updater/collection-updater-action.ts b/src/store/collections/updater/collection-updater-action.ts
index a7a354a..bb9f4d3 100644
--- a/src/store/collections/updater/collection-updater-action.ts
+++ b/src/store/collections/updater/collection-updater-action.ts
@@ -10,6 +10,7 @@ import { ServiceRepository } from "../../../services/services";
 import { CollectionResource } from '../../../models/collection';
 import { initialize } from 'redux-form';
 import { collectionPanelActions } from "../../collection-panel/collection-panel-action";
+import { ContextMenuResource } from "../../context-menu/context-menu-reducer";
 
 export const collectionUpdaterActions = unionize({
     OPEN_COLLECTION_UPDATER: ofType<{ uuid: string }>(),
@@ -23,11 +24,10 @@ export const collectionUpdaterActions = unionize({
 
 export const COLLECTION_FORM_NAME = 'collectionEditDialog';
 
-export const openUpdater = (uuid: string) =>
+export const openUpdater = (item: ContextMenuResource) =>
     (dispatch: Dispatch, getState: () => RootState) => {
-        dispatch(collectionUpdaterActions.OPEN_COLLECTION_UPDATER({ uuid }));
-        const item = getState().collectionPanel.item;
-        if(item) {
+        if (item) {
+            dispatch(collectionUpdaterActions.OPEN_COLLECTION_UPDATER({ uuid: item.uuid }));
             dispatch(initialize(COLLECTION_FORM_NAME, { name: item.name, description: item.description }));
         }
     };
diff --git a/src/store/collections/updater/collection-updater-reducer.ts b/src/store/collections/updater/collection-updater-reducer.ts
index 432aa27..97d010f 100644
--- a/src/store/collections/updater/collection-updater-reducer.ts
+++ b/src/store/collections/updater/collection-updater-reducer.ts
@@ -22,7 +22,7 @@ const initialState: CollectionUpdaterState = {
 export const collectionUpdaterReducer = (state: CollectionUpdaterState = initialState, action: CollectionUpdaterAction) => {
     return collectionUpdaterActions.match(action, {
         OPEN_COLLECTION_UPDATER: ({ uuid }) => updateCollection(state, { uuid, opened: true }),
-        CLOSE_COLLECTION_UPDATER: () => updateCollection(state, { opened: false }),
+        CLOSE_COLLECTION_UPDATER: () => updateCollection(state, { opened: false, uuid: "" }),
         UPDATE_COLLECTION_SUCCESS: () => updateCollection(state, { opened: false, uuid: "" }),
         default: () => state
     });
diff --git a/src/store/context-menu/context-menu-reducer.ts b/src/store/context-menu/context-menu-reducer.ts
index 8b51478..ac14c35 100644
--- a/src/store/context-menu/context-menu-reducer.ts
+++ b/src/store/context-menu/context-menu-reducer.ts
@@ -19,6 +19,7 @@ export interface ContextMenuResource {
     uuid: string;
     kind: string;
     name: string;
+    description?: string;
 }
 
 const initialState = {
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 513cb5f..10da9ef 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
@@ -14,7 +14,7 @@ export const collectionActionSet: ContextMenuActionSet = [[
         icon: RenameIcon,
         name: "Edit collection",
         execute: (dispatch, resource) => {
-            dispatch<any>(openUpdater(resource.uuid));
+            dispatch<any>(openUpdater(resource));
         }
     },
     {
diff --git a/src/views-components/context-menu/action-sets/collection-action-set.ts b/src/views-components/context-menu/action-sets/collection-resource-action-set.ts
similarity index 76%
copy from src/views-components/context-menu/action-sets/collection-action-set.ts
copy to src/views-components/context-menu/action-sets/collection-resource-action-set.ts
index 513cb5f..e6356bb 100644
--- a/src/views-components/context-menu/action-sets/collection-action-set.ts
+++ b/src/views-components/context-menu/action-sets/collection-resource-action-set.ts
@@ -5,16 +5,16 @@
 import { ContextMenuActionSet } from "../context-menu-action-set";
 import { ToggleFavoriteAction } from "../actions/favorite-action";
 import { toggleFavorite } from "../../../store/favorites/favorites-actions";
-import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, ProvenanceGraphIcon, AdvancedIcon, RemoveIcon } from "../../../components/icon/icon";
+import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, RemoveIcon } from "../../../components/icon/icon";
 import { openUpdater } from "../../../store/collections/updater/collection-updater-action";
 import { favoritePanelActions } from "../../../store/favorite-panel/favorite-panel-action";
 
-export const collectionActionSet: ContextMenuActionSet = [[
+export const collectionResourceActionSet: ContextMenuActionSet = [[
     {
         icon: RenameIcon,
         name: "Edit collection",
         execute: (dispatch, resource) => {
-            dispatch<any>(openUpdater(resource.uuid));
+            dispatch<any>(openUpdater(resource));
         }
     },
     {
@@ -54,20 +54,6 @@ export const collectionActionSet: ContextMenuActionSet = [[
         }
     },
     {
-        icon: ProvenanceGraphIcon,
-        name: "Provenance graph",
-        execute: (dispatch, resource) => {
-            // add code
-        }
-    },
-    {
-        icon: AdvancedIcon,
-        name: "Advanced",
-        execute: (dispatch, resource) => {
-            // add code
-        }
-    },
-    {
         icon: RemoveIcon,
         name: "Remove",
         execute: (dispatch, resource) => {
diff --git a/src/views-components/context-menu/context-menu.tsx b/src/views-components/context-menu/context-menu.tsx
index 8b00893..0a629b2 100644
--- a/src/views-components/context-menu/context-menu.tsx
+++ b/src/views-components/context-menu/context-menu.tsx
@@ -62,5 +62,6 @@ export enum ContextMenuKind {
     FAVORITE = "Favorite",
     COLLECTION_FILES = "CollectionFiles",
     COLLECTION_FILES_ITEM = "CollectionFilesItem",
-    COLLECTION = 'Collection'
+    COLLECTION = 'Collection',
+    COLLECTION_RESOURCE = 'CollectionResource'
 }
diff --git a/src/views-components/rename-file-dialog/rename-file-dialog.tsx b/src/views-components/rename-file-dialog/rename-file-dialog.tsx
index 6c880cc..5e2f7c4 100644
--- a/src/views-components/rename-file-dialog/rename-file-dialog.tsx
+++ b/src/views-components/rename-file-dialog/rename-file-dialog.tsx
@@ -10,7 +10,7 @@ import { RenameDialog } from "../../components/rename-dialog/rename-dialog";
 
 export const RENAME_FILE_DIALOG = 'renameFileDialog';
 
-export const openRenameFileDialog = (originalName: string, ) =>
+export const openRenameFileDialog = (originalName: string) =>
     (dispatch: Dispatch) => {
         dispatch(reset(RENAME_FILE_DIALOG));
         dispatch(dialogActions.OPEN_DIALOG({ id: RENAME_FILE_DIALOG, data: originalName }));
diff --git a/src/views/project-panel/project-panel-item.ts b/src/views/project-panel/project-panel-item.ts
index d0609d6..d81ef50 100644
--- a/src/views/project-panel/project-panel-item.ts
+++ b/src/views/project-panel/project-panel-item.ts
@@ -8,6 +8,7 @@ import { ResourceKind } from "../../models/resource";
 export interface ProjectPanelItem {
     uuid: string;
     name: string;
+    description?: string;
     kind: string;
     url: string;
     owner: string;
@@ -21,6 +22,7 @@ export function resourceToDataItem(r: GroupContentsResource): ProjectPanelItem {
     return {
         uuid: r.uuid,
         name: r.name,
+        description: r.description,
         kind: r.kind,
         url: "",
         owner: r.ownerUuid,
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index a8552ee..8377744 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -257,6 +257,7 @@ export const Workbench = withStyles(styles)(
                     this.openContextMenu(event, {
                         uuid: item.uuid,
                         name: item.name,
+                        description: item.description,
                         kind: ContextMenuKind.COLLECTION
                     });
                 }}
@@ -265,11 +266,20 @@ export const Workbench = withStyles(styles)(
             renderProjectPanel = (props: RouteComponentProps<{ id: string }>) => <ProjectPanel
                 onItemRouteChange={itemId => this.props.dispatch(setProjectItem(itemId, ItemMode.ACTIVE))}
                 onContextMenu={(event, item) => {
+                    let kind: ContextMenuKind;
 
-                    const kind = item.kind === ResourceKind.PROJECT ? ContextMenuKind.PROJECT : ContextMenuKind.RESOURCE;
+                    if (item.kind === ResourceKind.PROJECT) {
+                        kind = ContextMenuKind.PROJECT;
+                    } else if (item.kind === ResourceKind.COLLECTION) {
+                        kind = ContextMenuKind.COLLECTION_RESOURCE;
+                    } else {
+                        kind = ContextMenuKind.RESOURCE;
+                    }
+                    
                     this.openContextMenu(event, {
                         uuid: item.uuid,
                         name: item.name,
+                        description: item.description,
                         kind
                     });
                 }}
@@ -362,7 +372,7 @@ export const Workbench = withStyles(styles)(
                 this.props.dispatch(collectionCreateActions.OPEN_COLLECTION_CREATOR({ ownerUuid: itemUuid }));
             }
 
-            openContextMenu = (event: React.MouseEvent<HTMLElement>, resource: { name: string; uuid: string; kind: ContextMenuKind; }) => {
+            openContextMenu = (event: React.MouseEvent<HTMLElement>, resource: { name: string; uuid: string; description?: string; kind: ContextMenuKind; }) => {
                 event.preventDefault();
                 this.props.dispatch(
                     contextMenuActions.OPEN_CONTEXT_MENU({

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list