[arvados-workbench2] updated: 2.7.0-198-g87c6fcfb
git repository hosting
git at public.arvados.org
Tue Nov 14 17:22:27 UTC 2023
Summary of changes:
.../multiselect-toolbar/MultiselectToolbar.tsx | 13 +++++------
.../ms-kind-action-differentiator.ts | 2 +-
.../ms-toolbar-action-filters.ts | 14 ++----------
.../context-menu/context-menu-action-set.ts | 9 --------
.../multiselect-toolbar/ms-menu-action-set.ts | 25 ++++++++++++++++++++++
.../multiselect-toolbar/ms-project-action-set.ts | 15 +++++++------
6 files changed, 43 insertions(+), 35 deletions(-)
create mode 100644 src/views-components/multiselect-toolbar/ms-menu-action-set.ts
via 87c6fcfb9a3b4fc7db82549c51c81393e9737b4a (commit)
from e5a42b5917f815fa09b8e271ebc04c0c42b2d891 (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 87c6fcfb9a3b4fc7db82549c51c81393e9737b4a
Author: Lisa Knox <lisaknox83 at gmail.com>
Date: Tue Nov 14 12:22:21 2023 -0500
21128: created ms-menu-action-set and moved name consts into it Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>
diff --git a/src/components/multiselect-toolbar/MultiselectToolbar.tsx b/src/components/multiselect-toolbar/MultiselectToolbar.tsx
index 4ba9e25d..185f8e0f 100644
--- a/src/components/multiselect-toolbar/MultiselectToolbar.tsx
+++ b/src/components/multiselect-toolbar/MultiselectToolbar.tsx
@@ -13,8 +13,9 @@ import { ContextMenuResource } from "store/context-menu/context-menu-actions";
import { Resource, extractUuidKind } from "models/resource";
import { getResource } from "store/resources/resources";
import { ResourcesState } from "store/resources/resources";
-import { ContextMenuAction, ContextMenuActionSet, MultiSelectMenuAction } from "views-components/context-menu/context-menu-action-set";
-import { multiselectActionsFilters, TMultiselectActionsFilters, contextMenuActionConsts } from "./ms-toolbar-action-filters";
+import { MultiSelectMenuAction, MultiSelectMenuActionNames } from "views-components/multiselect-toolbar/ms-menu-action-set";
+import { ContextMenuAction, ContextMenuActionSet } from "views-components/context-menu/context-menu-action-set";
+import { multiselectActionsFilters, TMultiselectActionsFilters } from "./ms-toolbar-action-filters";
import { kindToActionSet, findActionByName } from "./ms-kind-action-differentiator";
import { msToggleTrashAction } from "views-components/multiselect-toolbar/ms-project-action-set";
import { copyToClipboardAction } from "store/open-in-new-tab/open-in-new-tab.actions";
@@ -74,7 +75,7 @@ export const MultiselectToolbar = connect(
disableFocusListener
>
<IconButton onClick={() => props.executeMulti(btn, checkedList, props.resources)}>
- {!currentPathIsTrash ? btn.defaultIcon && btn.defaultIcon({}) : btn.altIcon && btn.altIcon({})}
+ {!currentPathIsTrash ? btn.icon({}) : btn.altIcon({})}
</IconButton>
</Tooltip>
) : (
@@ -188,13 +189,13 @@ function mapDispatchToProps(dispatch: Dispatch) {
executeMulti: (selectedAction: ContextMenuAction, checkedList: TCheckedList, resources: ResourcesState): void => {
const kindGroups = groupByKind(checkedList, resources);
switch (selectedAction.name) {
- case contextMenuActionConsts.MOVE_TO:
- case contextMenuActionConsts.REMOVE:
+ case MultiSelectMenuActionNames.MOVE_TO:
+ case MultiSelectMenuActionNames.REMOVE:
const firstResource = getResource(selectedToArray(checkedList)[0])(resources) as ContainerRequestResource | Resource;
const action = findActionByName(selectedAction.name as string, kindToActionSet[firstResource.kind]);
if (action) action.execute(dispatch, kindGroups[firstResource.kind]);
break;
- case contextMenuActionConsts.COPY_TO_CLIPBOARD:
+ case MultiSelectMenuActionNames.COPY_TO_CLIPBOARD:
const selectedResources = selectedToArray(checkedList).map(uuid => getResource(uuid)(resources));
dispatch<any>(copyToClipboardAction(selectedResources));
break;
diff --git a/src/components/multiselect-toolbar/ms-kind-action-differentiator.ts b/src/components/multiselect-toolbar/ms-kind-action-differentiator.ts
index 2c617fdb..f514a078 100644
--- a/src/components/multiselect-toolbar/ms-kind-action-differentiator.ts
+++ b/src/components/multiselect-toolbar/ms-kind-action-differentiator.ts
@@ -3,7 +3,7 @@
// SPDX-License-Identifier: AGPL-3.0
import { ResourceKind } from "models/resource";
-import { MultiSelectMenuActionSet } from "views-components/context-menu/context-menu-action-set";
+import { MultiSelectMenuAction , MultiSelectMenuActionSet} from "views-components/multiselect-toolbar/ms-menu-action-set";
import { msCollectionActionSet } from "views-components/multiselect-toolbar/ms-collection-action-set";
import { msProjectActionSet } from "views-components/multiselect-toolbar/ms-project-action-set";
import { msProcessActionSet } from "views-components/multiselect-toolbar/ms-process-action-set";
diff --git a/src/components/multiselect-toolbar/ms-toolbar-action-filters.ts b/src/components/multiselect-toolbar/ms-toolbar-action-filters.ts
index eb968e0f..0ec5690e 100644
--- a/src/components/multiselect-toolbar/ms-toolbar-action-filters.ts
+++ b/src/components/multiselect-toolbar/ms-toolbar-action-filters.ts
@@ -3,24 +3,14 @@
// SPDX-License-Identifier: AGPL-3.0
import { ResourceKind } from "models/resource";
-import { MultiSelectMenuActionSet } from "views-components/context-menu/context-menu-action-set";
+import { MultiSelectMenuActionSet, MultiSelectMenuActionNames } from "views-components/multiselect-toolbar/ms-menu-action-set";
import { msCollectionActionSet } from "views-components/multiselect-toolbar/ms-collection-action-set";
import { msProjectActionSet } from "views-components/multiselect-toolbar/ms-project-action-set";
import { msProcessActionSet } from "views-components/multiselect-toolbar/ms-process-action-set";
export type TMultiselectActionsFilters = Record<string, [MultiSelectMenuActionSet, Set<string>]>;
-export const contextMenuActionConsts = {
- MAKE_A_COPY: "Make a copy",
- MOVE_TO: "Move to",
- TOGGLE_TRASH_ACTION: "ToggleTrashAction",
- TOGGLE_FAVORITE_ACTION: "ToggleFavoriteAction",
- COPY_TO_CLIPBOARD: "Copy to clipboard",
- COPY_AND_RERUN_PROCESS: "Copy and re-run process",
- REMOVE: "Remove",
-};
-
-const { MOVE_TO, TOGGLE_TRASH_ACTION, TOGGLE_FAVORITE_ACTION, REMOVE, MAKE_A_COPY } = contextMenuActionConsts;
+const { MOVE_TO, TOGGLE_TRASH_ACTION, TOGGLE_FAVORITE_ACTION, REMOVE, MAKE_A_COPY } = MultiSelectMenuActionNames;
//these sets govern what actions are on the ms toolbar for each resource kind
const projectMSActionsFilter = new Set([MOVE_TO, TOGGLE_TRASH_ACTION, TOGGLE_FAVORITE_ACTION]);
diff --git a/src/views-components/context-menu/context-menu-action-set.ts b/src/views-components/context-menu/context-menu-action-set.ts
index ba3eac1b..a953500b 100644
--- a/src/views-components/context-menu/context-menu-action-set.ts
+++ b/src/views-components/context-menu/context-menu-action-set.ts
@@ -5,18 +5,9 @@
import { Dispatch } from "redux";
import { ContextMenuItem } from "components/context-menu/context-menu";
import { ContextMenuResource } from "store/context-menu/context-menu-actions";
-import { IconType } from "components/icon/icon";
export interface ContextMenuAction extends ContextMenuItem {
execute(dispatch: Dispatch, resources: ContextMenuResource[], state?: any): void;
}
-export interface MultiSelectMenuAction extends ContextMenuAction {
- defaultText?: string
- defaultIcon?: IconType
- altText?: string
- altIcon?: IconType
-}
-
export type ContextMenuActionSet = Array<Array<ContextMenuAction>>;
-export type MultiSelectMenuActionSet = Array<Array<MultiSelectMenuAction>>;
diff --git a/src/views-components/multiselect-toolbar/ms-menu-action-set.ts b/src/views-components/multiselect-toolbar/ms-menu-action-set.ts
new file mode 100644
index 00000000..c34df023
--- /dev/null
+++ b/src/views-components/multiselect-toolbar/ms-menu-action-set.ts
@@ -0,0 +1,25 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { IconType } from "components/icon/icon";
+import { ContextMenuAction } from "../context-menu/context-menu-action-set";
+
+export const MultiSelectMenuActionNames = {
+ MAKE_A_COPY: "Make a copy",
+ MOVE_TO: "Move to",
+ TOGGLE_TRASH_ACTION: "ToggleTrashAction",
+ TOGGLE_FAVORITE_ACTION: "ToggleFavoriteAction",
+ COPY_TO_CLIPBOARD: "Copy to clipboard",
+ COPY_AND_RERUN_PROCESS: "Copy and re-run process",
+ REMOVE: "Remove",
+};
+
+export interface MultiSelectMenuAction extends ContextMenuAction {
+ defaultText?: string;
+ altText?: string;
+ altIcon?: IconType;
+ isDefault?: () => boolean;
+}
+
+export type MultiSelectMenuActionSet = Array<Array<MultiSelectMenuAction>>;
diff --git a/src/views-components/multiselect-toolbar/ms-project-action-set.ts b/src/views-components/multiselect-toolbar/ms-project-action-set.ts
index 4e8c6f14..61e89b1c 100644
--- a/src/views-components/multiselect-toolbar/ms-project-action-set.ts
+++ b/src/views-components/multiselect-toolbar/ms-project-action-set.ts
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import { MultiSelectMenuAction } from "views-components/context-menu/context-menu-action-set";
+import { MultiSelectMenuAction, MultiSelectMenuActionNames } from "views-components/multiselect-toolbar/ms-menu-action-set";
import { MoveToIcon, Link } from "components/icon/icon";
import { openMoveProjectDialog } from "store/projects/project-move-actions";
import { toggleProjectTrashed } from "store/trash/trash-actions";
@@ -13,11 +13,12 @@ import { AddFavoriteIcon, RemoveFavoriteIcon } from "components/icon/icon";
import { RestoreFromTrashIcon, TrashIcon } from "components/icon/icon";
+
export const msToggleFavoriteAction = {
- name: "ToggleFavoriteAction",
+ name: MultiSelectMenuActionNames.TOGGLE_FAVORITE_ACTION,
defaultText: 'Add to Favorites',
altText: 'Remove from Favorites',
- defaultIcon: AddFavoriteIcon,
+ icon: AddFavoriteIcon,
altIcon: RemoveFavoriteIcon,
execute: (dispatch, resources) => {
dispatch(toggleFavorite(resources[0])).then(() => {
@@ -28,7 +29,7 @@ export const msToggleFavoriteAction = {
export const msCopyToClipboardMenuAction = {
icon: Link,
- name: "Copy to clipboard",
+ name: MultiSelectMenuActionNames.COPY_TO_CLIPBOARD,
execute: (dispatch, resources) => {
dispatch(copyToClipboardAction(resources));
},
@@ -36,17 +37,17 @@ export const msCopyToClipboardMenuAction = {
export const msMoveToAction = {
icon: MoveToIcon,
- name: "Move to",
+ name: MultiSelectMenuActionNames.MOVE_TO,
execute: (dispatch, resource) => {
dispatch(openMoveProjectDialog(resource[0]));
},
};
export const msToggleTrashAction = {
- name: "ToggleTrashAction",
+ name: MultiSelectMenuActionNames.TOGGLE_TRASH_ACTION,
defaultText: 'Add to Trash',
altText: 'Restore from Trash',
- defaultIcon: TrashIcon,
+ icon: TrashIcon,
altIcon: RestoreFromTrashIcon,
execute: (dispatch, resources) => {
for (const resource of [...resources]) {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list