[arvados-workbench2] updated: 2.6.0-82-g9e16e70e
git repository hosting
git at public.arvados.org
Tue Sep 5 14:23:09 UTC 2023
Summary of changes:
src/store/context-menu/context-menu-actions.ts | 382 +++++++++++----------
src/store/move-to-dialog/move-to-dialog.ts | 3 +-
src/store/workbench/workbench-actions.ts | 8 +-
src/views-components/context-menu/context-menu.tsx | 119 +++----
4 files changed, 268 insertions(+), 244 deletions(-)
via 9e16e70e7f9bc9fd0e0a52eca9a9c37a45ef3639 (commit)
from 4b15593e83bf1a6e1c84c1e18af4b11b9fa1d134 (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 9e16e70e7f9bc9fd0e0a52eca9a9c37a45ef3639
Author: Lisa Knox <lisaknox83 at gmail.com>
Date: Tue Sep 5 10:22:35 2023 -0400
15768: fixed single v multi move bug Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>
diff --git a/src/store/context-menu/context-menu-actions.ts b/src/store/context-menu/context-menu-actions.ts
index 3bc91ae0..ee973784 100644
--- a/src/store/context-menu/context-menu-actions.ts
+++ b/src/store/context-menu/context-menu-actions.ts
@@ -2,31 +2,31 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import { unionize, ofType, UnionOf } from 'common/unionize';
+import { unionize, ofType, UnionOf } from "common/unionize";
import { ContextMenuPosition } from "./context-menu-reducer";
-import { ContextMenuKind } from 'views-components/context-menu/context-menu';
-import { Dispatch } from 'redux';
-import { RootState } from 'store/store';
-import { getResource, getResourceWithEditableStatus } from '../resources/resources';
-import { UserResource } from 'models/user';
-import { isSidePanelTreeCategory } from 'store/side-panel-tree/side-panel-tree-actions';
-import { extractUuidKind, ResourceKind, EditableResource, Resource } from 'models/resource';
-import { Process } from 'store/processes/process';
-import { RepositoryResource } from 'models/repositories';
-import { SshKeyResource } from 'models/ssh-key';
-import { VirtualMachinesResource } from 'models/virtual-machines';
-import { KeepServiceResource } from 'models/keep-services';
-import { ProcessResource } from 'models/process';
-import { CollectionResource } from 'models/collection';
-import { GroupClass, GroupResource } from 'models/group';
-import { GroupContentsResource } from 'services/groups-service/groups-service';
-import { LinkResource } from 'models/link';
-import { resourceIsFrozen } from 'common/frozen-resources';
-import { ProjectResource } from 'models/project';
+import { ContextMenuKind } from "views-components/context-menu/context-menu";
+import { Dispatch } from "redux";
+import { RootState } from "store/store";
+import { getResource, getResourceWithEditableStatus } from "../resources/resources";
+import { UserResource } from "models/user";
+import { isSidePanelTreeCategory } from "store/side-panel-tree/side-panel-tree-actions";
+import { extractUuidKind, ResourceKind, EditableResource, Resource } from "models/resource";
+import { Process } from "store/processes/process";
+import { RepositoryResource } from "models/repositories";
+import { SshKeyResource } from "models/ssh-key";
+import { VirtualMachinesResource } from "models/virtual-machines";
+import { KeepServiceResource } from "models/keep-services";
+import { ProcessResource } from "models/process";
+import { CollectionResource } from "models/collection";
+import { GroupClass, GroupResource } from "models/group";
+import { GroupContentsResource } from "services/groups-service/groups-service";
+import { LinkResource } from "models/link";
+import { resourceIsFrozen } from "common/frozen-resources";
+import { ProjectResource } from "models/project";
export const contextMenuActions = unionize({
- OPEN_CONTEXT_MENU: ofType<{ position: ContextMenuPosition, resource: ContextMenuResource }>(),
- CLOSE_CONTEXT_MENU: ofType<{}>()
+ OPEN_CONTEXT_MENU: ofType<{ position: ContextMenuPosition; resource: ContextMenuResource }>(),
+ CLOSE_CONTEXT_MENU: ofType<{}>(),
});
export type ContextMenuAction = UnionOf<typeof contextMenuActions>;
@@ -36,7 +36,7 @@ export type ContextMenuResource = {
uuid: string;
ownerUuid: string;
description?: string;
- kind: ResourceKind,
+ kind: ResourceKind;
menuKind: ContextMenuKind | string;
isTrashed?: boolean;
isEditable?: boolean;
@@ -46,191 +46,207 @@ export type ContextMenuResource = {
isFrozen?: boolean;
storageClassesDesired?: string[];
properties?: { [key: string]: string | string[] };
+ isMulti?: boolean;
};
export const isKeyboardClick = (event: React.MouseEvent<HTMLElement>) => event.nativeEvent.detail === 0;
-export const openContextMenu = (event: React.MouseEvent<HTMLElement>, resource: ContextMenuResource) =>
- (dispatch: Dispatch) => {
- event.preventDefault();
- const { left, top } = event.currentTarget.getBoundingClientRect();
- dispatch(
- contextMenuActions.OPEN_CONTEXT_MENU({
- position: {
- x: event.clientX || left,
- y: event.clientY || top,
- },
- resource
- })
- );
- };
+export const openContextMenu = (event: React.MouseEvent<HTMLElement>, resource: ContextMenuResource) => (dispatch: Dispatch) => {
+ event.preventDefault();
+ const { left, top } = event.currentTarget.getBoundingClientRect();
+ dispatch(
+ contextMenuActions.OPEN_CONTEXT_MENU({
+ position: {
+ x: event.clientX || left,
+ y: event.clientY || top,
+ },
+ resource,
+ })
+ );
+};
-export const openCollectionFilesContextMenu = (event: React.MouseEvent<HTMLElement>, isWritable: boolean) =>
- (dispatch: Dispatch, getState: () => RootState) => {
+export const openCollectionFilesContextMenu =
+ (event: React.MouseEvent<HTMLElement>, isWritable: boolean) => (dispatch: Dispatch, getState: () => RootState) => {
const isCollectionFileSelected = JSON.stringify(getState().collectionPanelFiles).includes('"selected":true');
- dispatch<any>(openContextMenu(event, {
- name: '',
- uuid: '',
- ownerUuid: '',
- description: '',
- kind: ResourceKind.COLLECTION,
- menuKind: isCollectionFileSelected
- ? isWritable
- ? ContextMenuKind.COLLECTION_FILES
- : ContextMenuKind.READONLY_COLLECTION_FILES
- : ContextMenuKind.COLLECTION_FILES_NOT_SELECTED
- }));
+ dispatch<any>(
+ openContextMenu(event, {
+ name: "",
+ uuid: "",
+ ownerUuid: "",
+ description: "",
+ kind: ResourceKind.COLLECTION,
+ menuKind: isCollectionFileSelected
+ ? isWritable
+ ? ContextMenuKind.COLLECTION_FILES
+ : ContextMenuKind.READONLY_COLLECTION_FILES
+ : ContextMenuKind.COLLECTION_FILES_NOT_SELECTED,
+ })
+ );
};
-export const openRepositoryContextMenu = (event: React.MouseEvent<HTMLElement>, repository: RepositoryResource) =>
- (dispatch: Dispatch, getState: () => RootState) => {
- dispatch<any>(openContextMenu(event, {
- name: '',
- uuid: repository.uuid,
- ownerUuid: repository.ownerUuid,
- kind: ResourceKind.REPOSITORY,
- menuKind: ContextMenuKind.REPOSITORY
- }));
+export const openRepositoryContextMenu =
+ (event: React.MouseEvent<HTMLElement>, repository: RepositoryResource) => (dispatch: Dispatch, getState: () => RootState) => {
+ dispatch<any>(
+ openContextMenu(event, {
+ name: "",
+ uuid: repository.uuid,
+ ownerUuid: repository.ownerUuid,
+ kind: ResourceKind.REPOSITORY,
+ menuKind: ContextMenuKind.REPOSITORY,
+ })
+ );
};
-export const openVirtualMachinesContextMenu = (event: React.MouseEvent<HTMLElement>, repository: VirtualMachinesResource) =>
- (dispatch: Dispatch, getState: () => RootState) => {
- dispatch<any>(openContextMenu(event, {
- name: '',
- uuid: repository.uuid,
- ownerUuid: repository.ownerUuid,
- kind: ResourceKind.VIRTUAL_MACHINE,
- menuKind: ContextMenuKind.VIRTUAL_MACHINE
- }));
+export const openVirtualMachinesContextMenu =
+ (event: React.MouseEvent<HTMLElement>, repository: VirtualMachinesResource) => (dispatch: Dispatch, getState: () => RootState) => {
+ dispatch<any>(
+ openContextMenu(event, {
+ name: "",
+ uuid: repository.uuid,
+ ownerUuid: repository.ownerUuid,
+ kind: ResourceKind.VIRTUAL_MACHINE,
+ menuKind: ContextMenuKind.VIRTUAL_MACHINE,
+ })
+ );
};
-export const openSshKeyContextMenu = (event: React.MouseEvent<HTMLElement>, sshKey: SshKeyResource) =>
- (dispatch: Dispatch) => {
- dispatch<any>(openContextMenu(event, {
- name: '',
+export const openSshKeyContextMenu = (event: React.MouseEvent<HTMLElement>, sshKey: SshKeyResource) => (dispatch: Dispatch) => {
+ dispatch<any>(
+ openContextMenu(event, {
+ name: "",
uuid: sshKey.uuid,
ownerUuid: sshKey.ownerUuid,
kind: ResourceKind.SSH_KEY,
- menuKind: ContextMenuKind.SSH_KEY
- }));
- };
+ menuKind: ContextMenuKind.SSH_KEY,
+ })
+ );
+};
-export const openKeepServiceContextMenu = (event: React.MouseEvent<HTMLElement>, keepService: KeepServiceResource) =>
- (dispatch: Dispatch) => {
- dispatch<any>(openContextMenu(event, {
- name: '',
+export const openKeepServiceContextMenu = (event: React.MouseEvent<HTMLElement>, keepService: KeepServiceResource) => (dispatch: Dispatch) => {
+ dispatch<any>(
+ openContextMenu(event, {
+ name: "",
uuid: keepService.uuid,
ownerUuid: keepService.ownerUuid,
kind: ResourceKind.KEEP_SERVICE,
- menuKind: ContextMenuKind.KEEP_SERVICE
- }));
- };
+ menuKind: ContextMenuKind.KEEP_SERVICE,
+ })
+ );
+};
-export const openApiClientAuthorizationContextMenu =
- (event: React.MouseEvent<HTMLElement>, resourceUuid: string) =>
- (dispatch: Dispatch) => {
- dispatch<any>(openContextMenu(event, {
- name: '',
- uuid: resourceUuid,
- ownerUuid: '',
- kind: ResourceKind.API_CLIENT_AUTHORIZATION,
- menuKind: ContextMenuKind.API_CLIENT_AUTHORIZATION
- }));
- };
+export const openApiClientAuthorizationContextMenu = (event: React.MouseEvent<HTMLElement>, resourceUuid: string) => (dispatch: Dispatch) => {
+ dispatch<any>(
+ openContextMenu(event, {
+ name: "",
+ uuid: resourceUuid,
+ ownerUuid: "",
+ kind: ResourceKind.API_CLIENT_AUTHORIZATION,
+ menuKind: ContextMenuKind.API_CLIENT_AUTHORIZATION,
+ })
+ );
+};
-export const openRootProjectContextMenu = (event: React.MouseEvent<HTMLElement>, projectUuid: string) =>
- (dispatch: Dispatch, getState: () => RootState) => {
+export const openRootProjectContextMenu =
+ (event: React.MouseEvent<HTMLElement>, projectUuid: string) => (dispatch: Dispatch, getState: () => RootState) => {
const res = getResource<UserResource>(projectUuid)(getState().resources);
if (res) {
- dispatch<any>(openContextMenu(event, {
- name: '',
- uuid: res.uuid,
- ownerUuid: res.uuid,
- kind: res.kind,
- menuKind: ContextMenuKind.ROOT_PROJECT,
- isTrashed: false
- }));
+ dispatch<any>(
+ openContextMenu(event, {
+ name: "",
+ uuid: res.uuid,
+ ownerUuid: res.uuid,
+ kind: res.kind,
+ menuKind: ContextMenuKind.ROOT_PROJECT,
+ isTrashed: false,
+ })
+ );
}
};
-export const openProjectContextMenu = (event: React.MouseEvent<HTMLElement>, resourceUuid: string) =>
- (dispatch: Dispatch, getState: () => RootState) => {
+export const openProjectContextMenu =
+ (event: React.MouseEvent<HTMLElement>, resourceUuid: string) => (dispatch: Dispatch, getState: () => RootState) => {
const res = getResource<GroupContentsResource>(resourceUuid)(getState().resources);
const menuKind = dispatch<any>(resourceUuidToContextMenuKind(resourceUuid));
if (res && menuKind) {
- dispatch<any>(openContextMenu(event, {
- name: res.name,
- uuid: res.uuid,
- kind: res.kind,
- menuKind,
- description: res.description,
- ownerUuid: res.ownerUuid,
- isTrashed: ('isTrashed' in res) ? res.isTrashed : false,
- isFrozen: !!(res as ProjectResource).frozenByUuid,
- }));
+ dispatch<any>(
+ openContextMenu(event, {
+ name: res.name,
+ uuid: res.uuid,
+ kind: res.kind,
+ menuKind,
+ description: res.description,
+ ownerUuid: res.ownerUuid,
+ isTrashed: "isTrashed" in res ? res.isTrashed : false,
+ isFrozen: !!(res as ProjectResource).frozenByUuid,
+ })
+ );
}
};
-export const openSidePanelContextMenu = (event: React.MouseEvent<HTMLElement>, id: string) =>
- (dispatch: Dispatch, getState: () => RootState) => {
- if (!isSidePanelTreeCategory(id)) {
- const kind = extractUuidKind(id);
- if (kind === ResourceKind.USER) {
- dispatch<any>(openRootProjectContextMenu(event, id));
- } else if (kind === ResourceKind.PROJECT) {
- dispatch<any>(openProjectContextMenu(event, id));
- }
+export const openSidePanelContextMenu = (event: React.MouseEvent<HTMLElement>, id: string) => (dispatch: Dispatch, getState: () => RootState) => {
+ if (!isSidePanelTreeCategory(id)) {
+ const kind = extractUuidKind(id);
+ if (kind === ResourceKind.USER) {
+ dispatch<any>(openRootProjectContextMenu(event, id));
+ } else if (kind === ResourceKind.PROJECT) {
+ dispatch<any>(openProjectContextMenu(event, id));
}
- };
+ }
+};
-export const openProcessContextMenu = (event: React.MouseEvent<HTMLElement>, process: Process) =>
- (dispatch: Dispatch, getState: () => RootState) => {
- const res = getResource<ProcessResource>(process.containerRequest.uuid)(getState().resources);
- if (res) {
- dispatch<any>(openContextMenu(event, {
+export const openProcessContextMenu = (event: React.MouseEvent<HTMLElement>, process: Process) => (dispatch: Dispatch, getState: () => RootState) => {
+ const res = getResource<ProcessResource>(process.containerRequest.uuid)(getState().resources);
+ if (res) {
+ dispatch<any>(
+ openContextMenu(event, {
uuid: res.uuid,
ownerUuid: res.ownerUuid,
kind: ResourceKind.PROCESS,
name: res.name,
description: res.description,
- outputUuid: res.outputUuid || '',
- workflowUuid: res.properties.template_uuid || '',
- menuKind: ContextMenuKind.PROCESS_RESOURCE
- }));
- }
- };
+ outputUuid: res.outputUuid || "",
+ workflowUuid: res.properties.template_uuid || "",
+ menuKind: ContextMenuKind.PROCESS_RESOURCE,
+ })
+ );
+ }
+};
-export const openPermissionEditContextMenu = (event: React.MouseEvent<HTMLElement>, link: LinkResource) =>
- (dispatch: Dispatch, getState: () => RootState) => {
+export const openPermissionEditContextMenu =
+ (event: React.MouseEvent<HTMLElement>, link: LinkResource) => (dispatch: Dispatch, getState: () => RootState) => {
if (link) {
- dispatch<any>(openContextMenu(event, {
- name: link.name,
- uuid: link.uuid,
- kind: link.kind,
- menuKind: ContextMenuKind.PERMISSION_EDIT,
- ownerUuid: link.ownerUuid,
- }));
+ dispatch<any>(
+ openContextMenu(event, {
+ name: link.name,
+ uuid: link.uuid,
+ kind: link.kind,
+ menuKind: ContextMenuKind.PERMISSION_EDIT,
+ ownerUuid: link.ownerUuid,
+ })
+ );
}
};
-export const openUserContextMenu = (event: React.MouseEvent<HTMLElement>, user: UserResource) =>
- (dispatch: Dispatch, getState: () => RootState) => {
- dispatch<any>(openContextMenu(event, {
- name: '',
+export const openUserContextMenu = (event: React.MouseEvent<HTMLElement>, user: UserResource) => (dispatch: Dispatch, getState: () => RootState) => {
+ dispatch<any>(
+ openContextMenu(event, {
+ name: "",
uuid: user.uuid,
ownerUuid: user.ownerUuid,
kind: user.kind,
- menuKind: ContextMenuKind.USER
- }));
- };
+ menuKind: ContextMenuKind.USER,
+ })
+ );
+};
-export const resourceUuidToContextMenuKind = (uuid: string, readonly = false) =>
+export const resourceUuidToContextMenuKind =
+ (uuid: string, readonly = false) =>
(dispatch: Dispatch, getState: () => RootState) => {
const { isAdmin: isAdminUser, uuid: userUuid } = getState().auth.user!;
const kind = extractUuidKind(uuid);
const resource = getResourceWithEditableStatus<GroupResource & EditableResource>(uuid, userUuid)(getState().resources);
const isFrozen = resourceIsFrozen(resource, getState().resources);
- const isEditable = (isAdminUser || (resource || {} as EditableResource).isEditable) && !readonly && !isFrozen;
+ const isEditable = (isAdminUser || (resource || ({} as EditableResource)).isEditable) && !readonly && !isFrozen;
switch (kind) {
case ResourceKind.PROJECT:
@@ -238,35 +254,37 @@ export const resourceUuidToContextMenuKind = (uuid: string, readonly = false) =>
return isAdminUser ? ContextMenuKind.FROZEN_PROJECT_ADMIN : ContextMenuKind.FROZEN_PROJECT;
}
- return (isAdminUser && !readonly)
- ? (resource && resource.groupClass !== GroupClass.FILTER)
+ return isAdminUser && !readonly
+ ? resource && resource.groupClass !== GroupClass.FILTER
? ContextMenuKind.PROJECT_ADMIN
: ContextMenuKind.FILTER_GROUP_ADMIN
: isEditable
- ? (resource && resource.groupClass !== GroupClass.FILTER)
- ? ContextMenuKind.PROJECT
- : ContextMenuKind.FILTER_GROUP
- : ContextMenuKind.READONLY_PROJECT;
+ ? resource && resource.groupClass !== GroupClass.FILTER
+ ? ContextMenuKind.PROJECT
+ : ContextMenuKind.FILTER_GROUP
+ : ContextMenuKind.READONLY_PROJECT;
case ResourceKind.COLLECTION:
const c = getResource<CollectionResource>(uuid)(getState().resources);
- if (c === undefined) { return; }
+ if (c === undefined) {
+ return;
+ }
const isOldVersion = c.uuid !== c.currentVersionUuid;
const isTrashed = c.isTrashed;
return isOldVersion
? ContextMenuKind.OLD_VERSION_COLLECTION
- : (isTrashed && isEditable)
- ? ContextMenuKind.TRASHED_COLLECTION
- : (isAdminUser && isEditable)
- ? ContextMenuKind.COLLECTION_ADMIN
- : isEditable
- ? ContextMenuKind.COLLECTION
- : ContextMenuKind.READONLY_COLLECTION;
+ : isTrashed && isEditable
+ ? ContextMenuKind.TRASHED_COLLECTION
+ : isAdminUser && isEditable
+ ? ContextMenuKind.COLLECTION_ADMIN
+ : isEditable
+ ? ContextMenuKind.COLLECTION
+ : ContextMenuKind.READONLY_COLLECTION;
case ResourceKind.PROCESS:
- return (isAdminUser && isEditable)
+ return isAdminUser && isEditable
? ContextMenuKind.PROCESS_ADMIN
: readonly
- ? ContextMenuKind.READONLY_PROCESS_RESOURCE
- : ContextMenuKind.PROCESS_RESOURCE;
+ ? ContextMenuKind.READONLY_PROCESS_RESOURCE
+ : ContextMenuKind.PROCESS_RESOURCE;
case ResourceKind.USER:
return ContextMenuKind.ROOT_PROJECT;
case ResourceKind.LINK:
@@ -278,16 +296,18 @@ export const resourceUuidToContextMenuKind = (uuid: string, readonly = false) =>
}
};
-export const openSearchResultsContextMenu = (event: React.MouseEvent<HTMLElement>, uuid: string) =>
- (dispatch: Dispatch, getState: () => RootState) => {
+export const openSearchResultsContextMenu =
+ (event: React.MouseEvent<HTMLElement>, uuid: string) => (dispatch: Dispatch, getState: () => RootState) => {
const res = getResource<Resource>(uuid)(getState().resources);
if (res) {
- dispatch<any>(openContextMenu(event, {
- name: '',
- uuid: res.uuid,
- ownerUuid: '',
- kind: res.kind,
- menuKind: ContextMenuKind.SEARCH_RESULTS,
- }));
+ dispatch<any>(
+ openContextMenu(event, {
+ name: "",
+ uuid: res.uuid,
+ ownerUuid: "",
+ kind: res.kind,
+ menuKind: ContextMenuKind.SEARCH_RESULTS,
+ })
+ );
}
};
diff --git a/src/store/move-to-dialog/move-to-dialog.ts b/src/store/move-to-dialog/move-to-dialog.ts
index 6261a795..12f2e858 100644
--- a/src/store/move-to-dialog/move-to-dialog.ts
+++ b/src/store/move-to-dialog/move-to-dialog.ts
@@ -6,4 +6,5 @@ export interface MoveToFormDialogData {
name: string;
uuid: string;
ownerUuid: string;
-}
\ No newline at end of file
+ isSingle?: boolean;
+}
diff --git a/src/store/workbench/workbench-actions.ts b/src/store/workbench/workbench-actions.ts
index f33ddeab..0de438c5 100644
--- a/src/store/workbench/workbench-actions.ts
+++ b/src/store/workbench/workbench-actions.ts
@@ -281,9 +281,9 @@ export const createProject = (data: projectCreateActions.ProjectCreateFormDialog
export const moveProject =
(data: MoveToFormDialogData, isSecondaryMove = false) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const selectedUuid = getState().detailsPanel.resourceUuid;
+ console.log(data);
const checkedList = getState().multiselect.checkedList;
- const uuidsToMove: string[] = selectedToArray(checkedList);
+ const uuidsToMove: string[] = data.isSingle ? [data.uuid] : selectedToArray(checkedList);
//if no items in checkedlist default to normal context menu behavior
if (!isSecondaryMove && !uuidsToMove.length) uuidsToMove.push(data.uuid);
@@ -456,7 +456,7 @@ export const moveCollection =
(data: MoveToFormDialogData, isSecondaryMove = false) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
const checkedList = getState().multiselect.checkedList;
- const uuidsToMove: string[] = selectedToArray(checkedList);
+ const uuidsToMove: string[] = data.isSingle ? [data.uuid] : selectedToArray(checkedList);
//if no items in checkedlist && no items passed in, default to normal context menu behavior
if (!isSecondaryMove && !uuidsToMove.length) uuidsToMove.push(data.uuid);
@@ -578,7 +578,7 @@ export const moveProcess =
(data: MoveToFormDialogData, isSecondaryMove = false) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
const checkedList = getState().multiselect.checkedList;
- const uuidsToMove: string[] = selectedToArray(checkedList);
+ const uuidsToMove: string[] = data.isSingle ? [data.uuid] : selectedToArray(checkedList);
//if no items in checkedlist && no items passed in, default to normal context menu behavior
if (!isSecondaryMove && !uuidsToMove.length) uuidsToMove.push(data.uuid);
diff --git a/src/views-components/context-menu/context-menu.tsx b/src/views-components/context-menu/context-menu.tsx
index 76832ccf..8f8e8232 100644
--- a/src/views-components/context-menu/context-menu.tsx
+++ b/src/views-components/context-menu/context-menu.tsx
@@ -2,24 +2,26 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import { connect } from 'react-redux';
-import { RootState } from 'store/store';
-import { contextMenuActions, ContextMenuResource } from 'store/context-menu/context-menu-actions';
-import { ContextMenu as ContextMenuComponent, ContextMenuProps, ContextMenuItem } from 'components/context-menu/context-menu';
-import { createAnchorAt } from 'components/popover/helpers';
-import { ContextMenuActionSet, ContextMenuAction } from './context-menu-action-set';
-import { Dispatch } from 'redux';
-import { memoize } from 'lodash';
-import { sortByProperty } from 'common/array-utils';
-type DataProps = Pick<ContextMenuProps, 'anchorEl' | 'items' | 'open'> & { resource?: ContextMenuResource };
+import { connect } from "react-redux";
+import { RootState } from "store/store";
+import { contextMenuActions, ContextMenuResource } from "store/context-menu/context-menu-actions";
+import { ContextMenu as ContextMenuComponent, ContextMenuProps, ContextMenuItem } from "components/context-menu/context-menu";
+import { createAnchorAt } from "components/popover/helpers";
+import { ContextMenuActionSet, ContextMenuAction } from "./context-menu-action-set";
+import { Dispatch } from "redux";
+import { memoize } from "lodash";
+import { sortByProperty } from "common/array-utils";
+
+type DataProps = Pick<ContextMenuProps, "anchorEl" | "items" | "open"> & { resource?: ContextMenuResource };
+
const mapStateToProps = (state: RootState): DataProps => {
const { open, position, resource } = state.contextMenu;
- const filteredItems = getMenuActionSet(resource).map((group) =>
- group.filter((item) => {
+ const filteredItems = getMenuActionSet(resource).map(group =>
+ group.filter(item => {
if (resource && item.filters) {
// Execute all filters on this item, every returns true IFF all filters return true
- return item.filters.every((filter) => filter(state, resource));
+ return item.filters.every(filter => filter(state, resource));
} else {
return true;
}
@@ -34,7 +36,7 @@ const mapStateToProps = (state: RootState): DataProps => {
};
};
-type ActionProps = Pick<ContextMenuProps, 'onClose'> & { onItemClick: (item: ContextMenuItem, resource?: ContextMenuResource) => void };
+type ActionProps = Pick<ContextMenuProps, "onClose"> & { onItemClick: (item: ContextMenuItem, resource?: ContextMenuResource) => void };
const mapDispatchToProps = (dispatch: Dispatch): ActionProps => ({
onClose: () => {
dispatch(contextMenuActions.CLOSE_CONTEXT_MENU());
@@ -48,9 +50,10 @@ const mapDispatchToProps = (dispatch: Dispatch): ActionProps => ({
});
const handleItemClick = memoize(
- (resource: DataProps['resource'], onItemClick: ActionProps['onItemClick']): ContextMenuProps['onItemClick'] =>
- (item) => {
- onItemClick(item, resource);
+ (resource: DataProps["resource"], onItemClick: ActionProps["onItemClick"]): ContextMenuProps["onItemClick"] =>
+ item => {
+ console.log("clisky");
+ onItemClick(item, { ...resource, isSingle: true } as ContextMenuResource);
}
);
@@ -65,7 +68,7 @@ export const ContextMenu = connect(mapStateToProps, mapDispatchToProps, mergePro
const menuActionSets = new Map<string, ContextMenuActionSet>();
export const addMenuActionSet = (name: string, itemSet: ContextMenuActionSet) => {
- const sorted = itemSet.map((items) => items.sort(sortByProperty('name')));
+ const sorted = itemSet.map(items => items.sort(sortByProperty("name")));
menuActionSets.set(name, sorted);
};
@@ -74,44 +77,44 @@ const getMenuActionSet = (resource?: ContextMenuResource): ContextMenuActionSet
resource ? menuActionSets.get(resource.menuKind) || emptyActionSet : emptyActionSet;
export enum ContextMenuKind {
- API_CLIENT_AUTHORIZATION = 'ApiClientAuthorization',
- ROOT_PROJECT = 'RootProject',
- PROJECT = 'Project',
- FILTER_GROUP = 'FilterGroup',
- READONLY_PROJECT = 'ReadOnlyProject',
- FROZEN_PROJECT = 'FrozenProject',
- FROZEN_PROJECT_ADMIN = 'FrozenProjectAdmin',
- PROJECT_ADMIN = 'ProjectAdmin',
- FILTER_GROUP_ADMIN = 'FilterGroupAdmin',
- RESOURCE = 'Resource',
- FAVORITE = 'Favorite',
- TRASH = 'Trash',
- COLLECTION_FILES = 'CollectionFiles',
- READONLY_COLLECTION_FILES = 'ReadOnlyCollectionFiles',
- COLLECTION_FILE_ITEM = 'CollectionFileItem',
- COLLECTION_DIRECTORY_ITEM = 'CollectionDirectoryItem',
- READONLY_COLLECTION_FILE_ITEM = 'ReadOnlyCollectionFileItem',
- READONLY_COLLECTION_DIRECTORY_ITEM = 'ReadOnlyCollectionDirectoryItem',
- COLLECTION_FILES_NOT_SELECTED = 'CollectionFilesNotSelected',
- COLLECTION = 'Collection',
- COLLECTION_ADMIN = 'CollectionAdmin',
- READONLY_COLLECTION = 'ReadOnlyCollection',
- OLD_VERSION_COLLECTION = 'OldVersionCollection',
- TRASHED_COLLECTION = 'TrashedCollection',
- PROCESS = 'Process',
- PROCESS_ADMIN = 'ProcessAdmin',
- PROCESS_RESOURCE = 'ProcessResource',
- READONLY_PROCESS_RESOURCE = 'ReadOnlyProcessResource',
- PROCESS_LOGS = 'ProcessLogs',
- REPOSITORY = 'Repository',
- SSH_KEY = 'SshKey',
- VIRTUAL_MACHINE = 'VirtualMachine',
- KEEP_SERVICE = 'KeepService',
- USER = 'User',
- GROUPS = 'Group',
- GROUP_MEMBER = 'GroupMember',
- PERMISSION_EDIT = 'PermissionEdit',
- LINK = 'Link',
- WORKFLOW = 'Workflow',
- SEARCH_RESULTS = 'SearchResults',
+ API_CLIENT_AUTHORIZATION = "ApiClientAuthorization",
+ ROOT_PROJECT = "RootProject",
+ PROJECT = "Project",
+ FILTER_GROUP = "FilterGroup",
+ READONLY_PROJECT = "ReadOnlyProject",
+ FROZEN_PROJECT = "FrozenProject",
+ FROZEN_PROJECT_ADMIN = "FrozenProjectAdmin",
+ PROJECT_ADMIN = "ProjectAdmin",
+ FILTER_GROUP_ADMIN = "FilterGroupAdmin",
+ RESOURCE = "Resource",
+ FAVORITE = "Favorite",
+ TRASH = "Trash",
+ COLLECTION_FILES = "CollectionFiles",
+ READONLY_COLLECTION_FILES = "ReadOnlyCollectionFiles",
+ COLLECTION_FILE_ITEM = "CollectionFileItem",
+ COLLECTION_DIRECTORY_ITEM = "CollectionDirectoryItem",
+ READONLY_COLLECTION_FILE_ITEM = "ReadOnlyCollectionFileItem",
+ READONLY_COLLECTION_DIRECTORY_ITEM = "ReadOnlyCollectionDirectoryItem",
+ COLLECTION_FILES_NOT_SELECTED = "CollectionFilesNotSelected",
+ COLLECTION = "Collection",
+ COLLECTION_ADMIN = "CollectionAdmin",
+ READONLY_COLLECTION = "ReadOnlyCollection",
+ OLD_VERSION_COLLECTION = "OldVersionCollection",
+ TRASHED_COLLECTION = "TrashedCollection",
+ PROCESS = "Process",
+ PROCESS_ADMIN = "ProcessAdmin",
+ PROCESS_RESOURCE = "ProcessResource",
+ READONLY_PROCESS_RESOURCE = "ReadOnlyProcessResource",
+ PROCESS_LOGS = "ProcessLogs",
+ REPOSITORY = "Repository",
+ SSH_KEY = "SshKey",
+ VIRTUAL_MACHINE = "VirtualMachine",
+ KEEP_SERVICE = "KeepService",
+ USER = "User",
+ GROUPS = "Group",
+ GROUP_MEMBER = "GroupMember",
+ PERMISSION_EDIT = "PermissionEdit",
+ LINK = "Link",
+ WORKFLOW = "Workflow",
+ SEARCH_RESULTS = "SearchResults",
}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list