[arvados-workbench2] updated: 2.7.0-203-g953fa9de
git repository hosting
git at public.arvados.org
Wed Nov 15 16:30:30 UTC 2023
Summary of changes:
.../multiselect-toolbar/MultiselectToolbar.tsx | 29 +++++++++++-----------
.../ms-toolbar-action-filters.ts | 2 +-
.../ms-collection-action-set.ts | 12 ++++-----
.../multiselect-toolbar/ms-menu-action-set.ts | 21 ++++++++++------
.../multiselect-toolbar/ms-process-action-set.ts | 8 +++---
.../multiselect-toolbar/ms-project-action-set.ts | 6 ++---
6 files changed, 41 insertions(+), 37 deletions(-)
via 953fa9de6f70c1de6e875d86b47d5bf3ac40830c (commit)
via d1b1dea7d72c0654dcbd50a70100d364e44ffbf5 (commit)
from 1e9f0183c391aa5c33a827a0429da60bc97b0905 (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 953fa9de6f70c1de6e875d86b47d5bf3ac40830c
Author: Lisa Knox <lisaknox83 at gmail.com>
Date: Wed Nov 15 11:30:26 2023 -0500
21128: created proper ms action menu type 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 81127465..1256c541 100644
--- a/src/components/multiselect-toolbar/MultiselectToolbar.tsx
+++ b/src/components/multiselect-toolbar/MultiselectToolbar.tsx
@@ -20,6 +20,7 @@ import { kindToActionSet, findActionByName } from "./ms-kind-action-differentiat
import { msToggleTrashAction } from "views-components/multiselect-toolbar/ms-project-action-set";
import { copyToClipboardAction } from "store/open-in-new-tab/open-in-new-tab.actions";
import { ContainerRequestResource } from "models/container-request";
+import { FavoritesState } from "store/favorites/favorites-reducer";
type CssRules = "root" | "button";
@@ -44,7 +45,7 @@ export type MultiselectToolbarProps = {
selectedUuid: string | null
resources: ResourcesState;
executeMulti: (action: ContextMenuAction, checkedList: TCheckedList, resources: ResourcesState) => void;
- favorites: any
+ favorites: FavoritesState
};
export const MultiselectToolbar = connect(
@@ -78,7 +79,7 @@ export const MultiselectToolbar = connect(
disableFocusListener
>
<IconButton onClick={() => props.executeMulti(action, checkedList, resources)}>
- {action.isDefault(selectedUuid, resources, favorites) ? action.icon && action.icon({}) : action.altIcon && action.altIcon({})}
+ {action.isDefault(selectedUuid, resources, favorites) ? action.icon({}) : action.altIcon && action.altIcon({})}
</IconButton>
</Tooltip>
) : (
@@ -88,7 +89,7 @@ export const MultiselectToolbar = connect(
key={i}
disableFocusListener
>
- <IconButton onClick={() => props.executeMulti(action, checkedList, resources)}>{action.icon ? action.icon({}) : <></>}</IconButton>
+ <IconButton onClick={() => props.executeMulti(action, checkedList, resources)}>{action.icon({})}</IconButton>
</Tooltip>
)
)
diff --git a/src/views-components/multiselect-toolbar/ms-collection-action-set.ts b/src/views-components/multiselect-toolbar/ms-collection-action-set.ts
index b17a17e7..338c18ef 100644
--- a/src/views-components/multiselect-toolbar/ms-collection-action-set.ts
+++ b/src/views-components/multiselect-toolbar/ms-collection-action-set.ts
@@ -5,10 +5,10 @@
import { MoveToIcon, CopyIcon } from "components/icon/icon";
import { openMoveCollectionDialog } from "store/collections/collection-move-actions";
import { openCollectionCopyDialog, openMultiCollectionCopyDialog } from "store/collections/collection-copy-actions";
-import { ToggleTrashAction } from "views-components/context-menu/actions/trash-action";
import { toggleCollectionTrashed } from "store/trash/trash-actions";
import { ContextMenuResource } from "store/context-menu/context-menu-actions";
import { MultiSelectMenuActionSet, MultiSelectMenuActionNames } from "./ms-menu-action-set";
+import { TrashIcon } from "components/icon/icon";
export const msCollectionActionSet: MultiSelectMenuActionSet = [
[
@@ -28,8 +28,8 @@ export const msCollectionActionSet: MultiSelectMenuActionSet = [
execute: (dispatch, resources) => dispatch<any>(openMoveCollectionDialog(resources[0])),
},
{
- component: ToggleTrashAction,
name: MultiSelectMenuActionNames.ADD_TO_TRASH,
+ icon: TrashIcon,
isForMulti: true,
execute: (dispatch, resources: ContextMenuResource[]) => {
for (const resource of [...resources]) {
diff --git a/src/views-components/multiselect-toolbar/ms-menu-action-set.ts b/src/views-components/multiselect-toolbar/ms-menu-action-set.ts
index b31bea40..44a5e51f 100644
--- a/src/views-components/multiselect-toolbar/ms-menu-action-set.ts
+++ b/src/views-components/multiselect-toolbar/ms-menu-action-set.ts
@@ -2,9 +2,11 @@
//
// SPDX-License-Identifier: AGPL-3.0
+import { Dispatch } from "redux";
import { IconType } from "components/icon/icon";
-import { ContextMenuAction } from "../context-menu/context-menu-action-set";
import { ResourcesState } from "store/resources/resources";
+import { FavoritesState } from "store/favorites/favorites-reducer";
+import { ContextMenuResource } from "store/context-menu/context-menu-actions";
export const MultiSelectMenuActionNames = {
MAKE_A_COPY: "Make a copy",
@@ -16,12 +18,15 @@ export const MultiSelectMenuActionNames = {
REMOVE: "Remove",
};
-export interface MultiSelectMenuAction extends ContextMenuAction {
- defaultText?: string;
+export type MultiSelectMenuAction = {
+ name: string;
+ icon: IconType;
altText?: string;
altIcon?: IconType;
- isDefault?: (uuid: string | null, resources: ResourcesState, favorites) => boolean;
isForMulti: boolean;
-}
+ isDefault?: (uuid: string | null, resources: ResourcesState, favorites: FavoritesState) => boolean;
+ execute(dispatch: Dispatch, resources: ContextMenuResource[], state?: any): void;
+ adminOnly?: boolean;
+};
export type MultiSelectMenuActionSet = MultiSelectMenuAction[][];
commit d1b1dea7d72c0654dcbd50a70100d364e44ffbf5
Author: Lisa Knox <lisaknox83 at gmail.com>
Date: Wed Nov 15 10:27:18 2023 -0500
21128: adjusted action menu types 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 73454689..81127465 100644
--- a/src/components/multiselect-toolbar/MultiselectToolbar.tsx
+++ b/src/components/multiselect-toolbar/MultiselectToolbar.tsx
@@ -57,7 +57,7 @@ export const MultiselectToolbar = connect(
const currentPathIsTrash = window.location.pathname === "/trash";
- const buttons =
+ const actions =
currentPathIsTrash && selectedToKindSet(checkedList).size
? [msToggleTrashAction]
: selectActionsByKind(currentResourceKinds, multiselectActionsFilters);
@@ -66,29 +66,29 @@ export const MultiselectToolbar = connect(
<React.Fragment>
<Toolbar
className={classes.root}
- style={{ width: `${buttons.length * 2.5}rem` }}
+ style={{ width: `${actions.length * 2.5}rem` }}
>
- {buttons.length ? (
- buttons.map((btn, i) =>
- btn.isDefault ? (
+ {actions.length ? (
+ actions.map((action, i) =>
+ action.isDefault ? (
<Tooltip
className={classes.button}
- title={btn.isDefault(selectedUuid, resources, favorites) ? btn.defaultText : btn.altText}
+ title={action.isDefault(selectedUuid, resources, favorites) ? action.name : action.altText}
key={i}
disableFocusListener
>
- <IconButton onClick={() => props.executeMulti(btn, checkedList, resources)}>
- {btn.isDefault(selectedUuid, resources, favorites) ? btn.icon && btn.icon({}) : btn.altIcon && btn.altIcon({})}
+ <IconButton onClick={() => props.executeMulti(action, checkedList, resources)}>
+ {action.isDefault(selectedUuid, resources, favorites) ? action.icon && action.icon({}) : action.altIcon && action.altIcon({})}
</IconButton>
</Tooltip>
) : (
<Tooltip
className={classes.button}
- title={btn.name}
+ title={action.name}
key={i}
disableFocusListener
>
- <IconButton onClick={() => props.executeMulti(btn, checkedList, resources)}>{btn.icon ? btn.icon({}) : <></>}</IconButton>
+ <IconButton onClick={() => props.executeMulti(action, checkedList, resources)}>{action.icon ? action.icon({}) : <></>}</IconButton>
</Tooltip>
)
)
@@ -153,14 +153,14 @@ function selectActionsByKind(currentResourceKinds: Array<string>, filterSet: TMu
});
const filteredNameSet = allFiltersArray.map(filterArray => {
- const resultSet = new Set();
- filterArray.forEach(action => resultSet.add(action.name || ""));
+ const resultSet = new Set<string>();
+ filterArray.forEach(action => resultSet.add(action.name as string || ""));
return resultSet;
});
const filteredResult = Array.from(rawResult).filter(action => {
for (let i = 0; i < filteredNameSet.length; i++) {
- if (!filteredNameSet[i].has(action.name)) return false;
+ if (!filteredNameSet[i].has(action.name as string)) return false;
}
return true;
});
diff --git a/src/components/multiselect-toolbar/ms-toolbar-action-filters.ts b/src/components/multiselect-toolbar/ms-toolbar-action-filters.ts
index 0ec5690e..8d8b6f0f 100644
--- a/src/components/multiselect-toolbar/ms-toolbar-action-filters.ts
+++ b/src/components/multiselect-toolbar/ms-toolbar-action-filters.ts
@@ -10,7 +10,7 @@ import { msProcessActionSet } from "views-components/multiselect-toolbar/ms-proc
export type TMultiselectActionsFilters = Record<string, [MultiSelectMenuActionSet, Set<string>]>;
-const { MOVE_TO, TOGGLE_TRASH_ACTION, TOGGLE_FAVORITE_ACTION, REMOVE, MAKE_A_COPY } = MultiSelectMenuActionNames;
+const { MOVE_TO, ADD_TO_TRASH: TOGGLE_TRASH_ACTION, ADD_TO_FAVORITES: 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/multiselect-toolbar/ms-collection-action-set.ts b/src/views-components/multiselect-toolbar/ms-collection-action-set.ts
index 51e21592..b17a17e7 100644
--- a/src/views-components/multiselect-toolbar/ms-collection-action-set.ts
+++ b/src/views-components/multiselect-toolbar/ms-collection-action-set.ts
@@ -8,13 +8,13 @@ import { openCollectionCopyDialog, openMultiCollectionCopyDialog } from "store/c
import { ToggleTrashAction } from "views-components/context-menu/actions/trash-action";
import { toggleCollectionTrashed } from "store/trash/trash-actions";
import { ContextMenuResource } from "store/context-menu/context-menu-actions";
-import { MultiSelectMenuActionSet } from "./ms-menu-action-set";
+import { MultiSelectMenuActionSet, MultiSelectMenuActionNames } from "./ms-menu-action-set";
export const msCollectionActionSet: MultiSelectMenuActionSet = [
[
{
icon: CopyIcon,
- name: "Make a copy",
+ name: MultiSelectMenuActionNames.MAKE_A_COPY,
isForMulti: true,
execute: (dispatch, [...resources]) => {
if (resources[0].fromContextMenu || resources.length === 1) dispatch<any>(openCollectionCopyDialog(resources[0]));
@@ -23,13 +23,13 @@ export const msCollectionActionSet: MultiSelectMenuActionSet = [
},
{
icon: MoveToIcon,
- name: "Move to",
+ name: MultiSelectMenuActionNames.MOVE_TO,
isForMulti: true,
execute: (dispatch, resources) => dispatch<any>(openMoveCollectionDialog(resources[0])),
},
{
component: ToggleTrashAction,
- name: "ToggleTrashAction",
+ name: MultiSelectMenuActionNames.ADD_TO_TRASH,
isForMulti: true,
execute: (dispatch, resources: ContextMenuResource[]) => {
for (const resource of [...resources]) {
diff --git a/src/views-components/multiselect-toolbar/ms-menu-action-set.ts b/src/views-components/multiselect-toolbar/ms-menu-action-set.ts
index db184d26..b31bea40 100644
--- a/src/views-components/multiselect-toolbar/ms-menu-action-set.ts
+++ b/src/views-components/multiselect-toolbar/ms-menu-action-set.ts
@@ -9,8 +9,8 @@ import { ResourcesState } from "store/resources/resources";
export const MultiSelectMenuActionNames = {
MAKE_A_COPY: "Make a copy",
MOVE_TO: "Move to",
- TOGGLE_TRASH_ACTION: "ToggleTrashAction",
- TOGGLE_FAVORITE_ACTION: "ToggleFavoriteAction",
+ ADD_TO_TRASH: "Add to Trash",
+ ADD_TO_FAVORITES: "Add to Favorites",
COPY_TO_CLIPBOARD: "Copy to clipboard",
COPY_AND_RERUN_PROCESS: "Copy and re-run process",
REMOVE: "Remove",
@@ -24,4 +24,4 @@ export interface MultiSelectMenuAction extends ContextMenuAction {
isForMulti: boolean;
}
-export type MultiSelectMenuActionSet = Array<Array<MultiSelectMenuAction>>;
+export type MultiSelectMenuActionSet = MultiSelectMenuAction[][];
diff --git a/src/views-components/multiselect-toolbar/ms-process-action-set.ts b/src/views-components/multiselect-toolbar/ms-process-action-set.ts
index 28f97c42..57c8e577 100644
--- a/src/views-components/multiselect-toolbar/ms-process-action-set.ts
+++ b/src/views-components/multiselect-toolbar/ms-process-action-set.ts
@@ -6,13 +6,13 @@ import { MoveToIcon, RemoveIcon, ReRunProcessIcon } from "components/icon/icon";
import { openMoveProcessDialog } from "store/processes/process-move-actions";
import { openCopyProcessDialog } from "store/processes/process-copy-actions";
import { openRemoveProcessDialog } from "store/processes/processes-actions";
-import { MultiSelectMenuActionSet } from "./ms-menu-action-set";
+import { MultiSelectMenuActionSet, MultiSelectMenuActionNames } from "./ms-menu-action-set";
export const msProcessActionSet: MultiSelectMenuActionSet = [
[
{
icon: ReRunProcessIcon,
- name: "Copy and re-run process",
+ name: MultiSelectMenuActionNames.COPY_AND_RERUN_PROCESS,
isForMulti: true,
execute: (dispatch, resources) => {
for (const resource of [...resources]) {
@@ -22,14 +22,14 @@ export const msProcessActionSet: MultiSelectMenuActionSet = [
},
{
icon: MoveToIcon,
- name: "Move to",
+ name: MultiSelectMenuActionNames.MOVE_TO,
isForMulti: true,
execute: (dispatch, resources) => {
dispatch<any>(openMoveProcessDialog(resources[0]));
},
},
{
- name: "Remove",
+ name: MultiSelectMenuActionNames.REMOVE,
icon: RemoveIcon,
isForMulti: true,
execute: (dispatch, resources) => {
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 d3579e55..d31fdddd 100644
--- a/src/views-components/multiselect-toolbar/ms-project-action-set.ts
+++ b/src/views-components/multiselect-toolbar/ms-project-action-set.ts
@@ -15,8 +15,7 @@ import { getResource } from "store/resources/resources";
import { checkFavorite } from "store/favorites/favorites-reducer";
export const msToggleFavoriteAction = {
- name: MultiSelectMenuActionNames.TOGGLE_FAVORITE_ACTION,
- defaultText: 'Add to Favorites',
+ name: MultiSelectMenuActionNames.ADD_TO_FAVORITES,
altText: 'Remove from Favorites',
icon: AddFavoriteIcon,
altIcon: RemoveFavoriteIcon,
@@ -50,8 +49,7 @@ export const msMoveToAction = {
};
export const msToggleTrashAction = {
- name: MultiSelectMenuActionNames.TOGGLE_TRASH_ACTION,
- defaultText: 'Add to Trash',
+ name: MultiSelectMenuActionNames.ADD_TO_TRASH,
altText: 'Restore from Trash',
icon: TrashIcon,
altIcon: RestoreFromTrashIcon,
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list