[ARVADOS-WORKBENCH2] updated: 1.1.4-297-g0d71d49

Git user git at public.curoverse.com
Mon Jul 16 02:46:15 EDT 2018


Summary of changes:
 .../context-menu/action-sets/empty-action-set.ts   |  8 +++++++
 .../context-menu/action-sets/project-action-set.ts | 19 ++++++++++++++++
 .../action-sets/root-project-action-set.ts         | 15 +++++++++++++
 .../context-menu/context-menu-action-set.ts        | 13 +++++++++++
 .../context-menu/context-menu-item-set.ts          | 12 -----------
 src/views-components/context-menu/context-menu.tsx | 18 ++++++++--------
 .../context-menu/item-sets/empty-item-set.ts       | 13 -----------
 .../context-menu/item-sets/project-item-set.ts     | 25 ----------------------
 .../item-sets/root-project-item-set.ts             | 22 -------------------
 9 files changed, 64 insertions(+), 81 deletions(-)
 create mode 100644 src/views-components/context-menu/action-sets/empty-action-set.ts
 create mode 100644 src/views-components/context-menu/action-sets/project-action-set.ts
 create mode 100644 src/views-components/context-menu/action-sets/root-project-action-set.ts
 create mode 100644 src/views-components/context-menu/context-menu-action-set.ts
 delete mode 100644 src/views-components/context-menu/context-menu-item-set.ts
 delete mode 100644 src/views-components/context-menu/item-sets/empty-item-set.ts
 delete mode 100644 src/views-components/context-menu/item-sets/project-item-set.ts
 delete mode 100644 src/views-components/context-menu/item-sets/root-project-item-set.ts

       via  0d71d490e24d2f1dae33360f194259bb597f2799 (commit)
      from  913eba4873631814daafa27d2474bb51e2378221 (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 0d71d490e24d2f1dae33360f194259bb597f2799
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Mon Jul 16 08:45:53 2018 +0200

    Add execute function to context menu actions
    
    Feature #13805
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/views-components/context-menu/action-sets/empty-action-set.ts b/src/views-components/context-menu/action-sets/empty-action-set.ts
new file mode 100644
index 0000000..9793484
--- /dev/null
+++ b/src/views-components/context-menu/action-sets/empty-action-set.ts
@@ -0,0 +1,8 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { ContextMenuActionSet } from "../context-menu-action-set";
+
+export const emptyActionSet: ContextMenuActionSet  = [];
+
diff --git a/src/views-components/context-menu/action-sets/project-action-set.ts b/src/views-components/context-menu/action-sets/project-action-set.ts
new file mode 100644
index 0000000..9a1b1d5
--- /dev/null
+++ b/src/views-components/context-menu/action-sets/project-action-set.ts
@@ -0,0 +1,19 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { ContextMenuActionSet } from "../context-menu-action-set";
+import actions from "../../../store/project/project-action";
+import { IconTypes } from "../../../components/icon/icon";
+
+export const projectActionSet: ContextMenuActionSet = [[{
+    icon: IconTypes.FOLDER,
+    name: "New project",
+    execute: (dispatch, resource) => {
+        dispatch(actions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid }));
+    }
+}, {
+    icon: IconTypes.ANNOUNCEMENT,
+    name: "Share",
+    execute: () => { return; }
+}]];
\ No newline at end of file
diff --git a/src/views-components/context-menu/action-sets/root-project-action-set.ts b/src/views-components/context-menu/action-sets/root-project-action-set.ts
new file mode 100644
index 0000000..53642d0
--- /dev/null
+++ b/src/views-components/context-menu/action-sets/root-project-action-set.ts
@@ -0,0 +1,15 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { ContextMenuActionSet } from "../context-menu-action-set";
+import actions from "../../../store/project/project-action";
+import { IconTypes } from "../../../components/icon/icon";
+
+export const rootProjectActionSet: ContextMenuActionSet =  [[{
+    icon: IconTypes.FOLDER,
+    name: "New project",
+    execute: (dispatch, resource) => {
+        dispatch(actions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid }));
+    }
+}]];
\ No newline at end of file
diff --git a/src/views-components/context-menu/context-menu-action-set.ts b/src/views-components/context-menu/context-menu-action-set.ts
new file mode 100644
index 0000000..089580c
--- /dev/null
+++ b/src/views-components/context-menu/context-menu-action-set.ts
@@ -0,0 +1,13 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from "redux";
+import { ContextMenuItem } from "../../components/context-menu/context-menu";
+import { ContextMenuResource } from "../../store/context-menu/context-menu-reducer";
+
+export interface ContextMenuAction extends ContextMenuItem {
+    execute(dispatch: Dispatch, resource: ContextMenuResource): void;
+}
+
+export type ContextMenuActionSet = Array<Array<ContextMenuAction>>;
diff --git a/src/views-components/context-menu/context-menu-item-set.ts b/src/views-components/context-menu/context-menu-item-set.ts
deleted file mode 100644
index 0b207ad..0000000
--- a/src/views-components/context-menu/context-menu-item-set.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import { Dispatch } from "redux";
-import { ContextMenuItemGroup, ContextMenuItem } from "../../components/context-menu/context-menu";
-import { ContextMenuResource } from "../../store/context-menu/context-menu-reducer";
-
-export interface ContextMenuItemSet {
-    handleItem (dispatch: Dispatch, action: ContextMenuItem, resource: ContextMenuResource): void;
-    getItems (): ContextMenuItemGroup[];
-}
diff --git a/src/views-components/context-menu/context-menu.tsx b/src/views-components/context-menu/context-menu.tsx
index b7654f8..eb96504 100644
--- a/src/views-components/context-menu/context-menu.tsx
+++ b/src/views-components/context-menu/context-menu.tsx
@@ -8,15 +8,15 @@ import actions from "../../store/context-menu/context-menu-actions";
 import ContextMenu, { ContextMenuProps, ContextMenuItem } from "../../components/context-menu/context-menu";
 import { createAnchorAt } from "../../components/popover/helpers";
 import { ContextMenuResource } from "../../store/context-menu/context-menu-reducer";
-import { ContextMenuItemSet } from "./context-menu-item-set";
-import { emptyItemSet } from "./item-sets/empty-item-set";
+import { ContextMenuActionSet, ContextMenuAction } from "./context-menu-action-set";
+import { emptyActionSet } from "./action-sets/empty-action-set";
 
 type DataProps = Pick<ContextMenuProps, "anchorEl" | "items"> & { resource?: ContextMenuResource };
 const mapStateToProps = (state: RootState): DataProps => {
     const { position, resource } = state.contextMenu;
     return {
         anchorEl: resource ? createAnchorAt(position) : undefined,
-        items: getMenuItemSet(resource).getItems(),
+        items: getMenuItemSet(resource),
         resource
     };
 };
@@ -26,10 +26,10 @@ const mapDispatchToProps = (dispatch: Dispatch): ActionProps => ({
     onClose: () => {
         dispatch(actions.CLOSE_CONTEXT_MENU());
     },
-    onItemClick: (item: ContextMenuItem, resource?: ContextMenuResource) => {
+    onItemClick: (action: ContextMenuAction, resource?: ContextMenuResource) => {
         dispatch(actions.CLOSE_CONTEXT_MENU());
         if (resource) {
-            getMenuItemSet(resource).handleItem(dispatch, item, resource);
+            action.execute(dispatch, resource);
         }
     }
 });
@@ -44,13 +44,13 @@ const mergeProps = ({ resource, ...dataProps }: DataProps, actionProps: ActionPr
 
 export const ContextMenuHOC = connect(mapStateToProps, mapDispatchToProps, mergeProps)(ContextMenu);
 
-const menuItemSets = new Map<string, ContextMenuItemSet>();
+const menuItemSets = new Map<string, ContextMenuActionSet>();
 
-export const addMenuItemsSet = (name: string, itemSet: ContextMenuItemSet) => {
+export const addMenuItemsSet = (name: string, itemSet: ContextMenuActionSet) => {
     menuItemSets.set(name, itemSet);
 };
 
-const getMenuItemSet = (resource?: ContextMenuResource): ContextMenuItemSet => {
-    return resource ? menuItemSets.get(resource.kind) || emptyItemSet : emptyItemSet;
+const getMenuItemSet = (resource?: ContextMenuResource): ContextMenuActionSet => {
+    return resource ? menuItemSets.get(resource.kind) || emptyActionSet : emptyActionSet;
 };
 
diff --git a/src/views-components/context-menu/item-sets/empty-item-set.ts b/src/views-components/context-menu/item-sets/empty-item-set.ts
deleted file mode 100644
index 9ebf065..0000000
--- a/src/views-components/context-menu/item-sets/empty-item-set.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import { ContextMenuItemGroup } from "../../../components/context-menu/context-menu";
-import { ContextMenuItemSet } from "../context-menu-item-set";
-
-export const emptyItemSet: ContextMenuItemSet = {
-    getItems: () => items,
-    handleItem: () => { return; }
-};
-
-const items: ContextMenuItemGroup[] = [];
\ No newline at end of file
diff --git a/src/views-components/context-menu/item-sets/project-item-set.ts b/src/views-components/context-menu/item-sets/project-item-set.ts
deleted file mode 100644
index 9cda327..0000000
--- a/src/views-components/context-menu/item-sets/project-item-set.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import { ContextMenuItemGroup } from "../../../components/context-menu/context-menu";
-import { ContextMenuItemSet } from "../context-menu-item-set";
-import actions from "../../../store/project/project-action";
-import { IconTypes } from "../../../components/icon/icon";
-
-export const projectItemSet: ContextMenuItemSet = {
-    getItems: () => items,
-    handleItem: (dispatch, item, resource) => {
-        if (item.name === "New project") {
-            dispatch(actions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid }));
-        }
-    }
-};
-
-const items: ContextMenuItemGroup[] = [[{
-    icon: IconTypes.FOLDER,
-    name: "New project"
-}, {
-    icon: IconTypes.ANNOUNCEMENT,
-    name: "Share"
-}]];
\ No newline at end of file
diff --git a/src/views-components/context-menu/item-sets/root-project-item-set.ts b/src/views-components/context-menu/item-sets/root-project-item-set.ts
deleted file mode 100644
index 906424a..0000000
--- a/src/views-components/context-menu/item-sets/root-project-item-set.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import { ContextMenuItemGroup } from "../../../components/context-menu/context-menu";
-import { ContextMenuItemSet } from "../context-menu-item-set";
-import actions from "../../../store/project/project-action";
-import { IconTypes } from "../../../components/icon/icon";
-
-export const rootProjectItemSet: ContextMenuItemSet = {
-    getItems: () => items,
-    handleItem: (dispatch, item, resource) => {
-        if (item.name === "New project") {
-            dispatch(actions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid }));
-        }
-    }
-};
-
-const items: ContextMenuItemGroup[] = [[{
-    icon: IconTypes.FOLDER,
-    name: "New project"
-}]];
\ No newline at end of file

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list