[arvados-workbench2] updated: 2.6.0-59-g507ae159
git repository hosting
git at public.arvados.org
Thu Jul 27 16:04:32 UTC 2023
Summary of changes:
.../multiselectToolbar/MultiselectToolbar.tsx | 26 ++++----
src/store/processes/process-copy-actions.ts | 53 +++++----------
src/store/processes/processes-actions.ts | 78 +++++++++-------------
.../dialog-copy/dialog-process-rerun.tsx | 11 ---
.../dialog-forms/copy-process-dialog.ts | 17 +----
.../process-remove-many-dialog.tsx | 20 ------
src/views/workbench/workbench.tsx | 11 +--
7 files changed, 67 insertions(+), 149 deletions(-)
delete mode 100644 src/views-components/process-remove-many-dialog/process-remove-many-dialog.tsx
via 507ae159f9c1eb0dd6a406a3987243aab7f05866 (commit)
from 2309d8a0970d603fa1bd6b23f1fae7f97bb2f7e1 (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 507ae159f9c1eb0dd6a406a3987243aab7f05866
Author: Lisa Knox <lisaknox83 at gmail.com>
Date: Thu Jul 27 12:04:25 2023 -0400
15768: fixed restore-from-trash icon, minor cleanup Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>
diff --git a/src/components/multiselectToolbar/MultiselectToolbar.tsx b/src/components/multiselectToolbar/MultiselectToolbar.tsx
index 04174223..309d3293 100644
--- a/src/components/multiselectToolbar/MultiselectToolbar.tsx
+++ b/src/components/multiselectToolbar/MultiselectToolbar.tsx
@@ -9,21 +9,15 @@ import { ArvadosTheme } from 'common/custom-theme';
import { RootState } from 'store/store';
import { Dispatch } from 'redux';
import { TCheckedList } from 'components/data-table/data-table';
-import { openRemoveProcessDialog, openRemoveManyProcessesDialog } from 'store/processes/processes-actions';
-import { processResourceActionSet } from '../../views-components/context-menu/action-sets/process-resource-action-set';
import { ContextMenuResource } from 'store/context-menu/context-menu-actions';
import { Resource, extractUuidKind } from 'models/resource';
-import { openMoveProcessDialog } from 'store/processes/process-move-actions';
-import { openCopyProcessDialog, openCopyManyProcessesDialog } from 'store/processes/process-copy-actions';
import { getResource } from 'store/resources/resources';
import { ResourcesState } from 'store/resources/resources';
-import { getProcess } from 'store/processes/process';
-import { CopyProcessDialog, CopyManyProcessesDialog } from 'views-components/dialog-forms/copy-process-dialog';
-import { collectionActionSet } from 'views-components/context-menu/action-sets/collection-action-set';
import { ContextMenuAction, ContextMenuActionSet } from 'views-components/context-menu/context-menu-action-set';
-import { TrashIcon } from 'components/icon/icon';
-import { multiselectActionsFilters, TMultiselectActionsFilters, contextMenuActionConsts } from './ms-toolbar-action-filters';
+import { RestoreFromTrashIcon, TrashIcon } from 'components/icon/icon';
+import { multiselectActionsFilters, TMultiselectActionsFilters } from './ms-toolbar-action-filters';
import { kindToActionSet, findActionByName } from './ms-kind-action-differentiator';
+import { toggleTrashAction } from 'views-components/context-menu/action-sets/project-action-set';
type CssRules = 'root' | 'button';
@@ -36,7 +30,7 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
margin: '1rem auto auto 0.5rem',
overflow: 'hidden',
transition: 'width 150ms',
- borderBottom: '1px solid gray',
+ // borderBottom: '1px solid gray',
},
button: {
width: '1rem',
@@ -59,16 +53,20 @@ export const MultiselectToolbar = connect(
const { classes, checkedList } = props;
const currentResourceKinds = Array.from(selectedToKindSet(checkedList));
- const buttons = selectActionsByKind(currentResourceKinds, multiselectActionsFilters);
+ const currentPathIsTrash = window.location.pathname === '/trash';
+ const buttons =
+ currentPathIsTrash && selectedToKindSet(checkedList).size
+ ? [toggleTrashAction]
+ : selectActionsByKind(currentResourceKinds, multiselectActionsFilters);
return (
<Toolbar className={classes.root} style={{ width: `${buttons.length * 2.12}rem` }}>
{buttons.length ? (
buttons.map((btn, i) =>
btn.name === 'ToggleTrashAction' ? (
- <Tooltip className={classes.button} title={'Move to trash'} key={i} disableFocusListener>
+ <Tooltip className={classes.button} title={currentPathIsTrash ? 'Restore' : 'Move to trash'} key={i} disableFocusListener>
<IconButton onClick={() => props.executeMulti(btn, checkedList, props.resources)}>
- <TrashIcon />
+ {currentPathIsTrash ? <RestoreFromTrashIcon /> : <TrashIcon />}
</IconButton>
</Tooltip>
) : (
@@ -167,7 +165,7 @@ function mapStateToProps(state: RootState) {
function mapDispatchToProps(dispatch: Dispatch) {
return {
- executeMulti: (selectedAction: ContextMenuAction, checkedList: TCheckedList, resources: ResourcesState) => {
+ executeMulti: (selectedAction: ContextMenuAction, checkedList: TCheckedList, resources: ResourcesState): void => {
const kindGroups = groupByKind(checkedList, resources);
for (const kind in kindGroups) {
const actionSet = kindToActionSet[kind];
diff --git a/src/store/processes/process-copy-actions.ts b/src/store/processes/process-copy-actions.ts
index d3c36b3f..36d73940 100644
--- a/src/store/processes/process-copy-actions.ts
+++ b/src/store/processes/process-copy-actions.ts
@@ -9,50 +9,27 @@ import { resetPickerProjectTree } from 'store/project-tree-picker/project-tree-p
import { RootState } from 'store/store';
import { ServiceRepository } from 'services/services';
import { CopyFormDialogData } from 'store/copy-dialog/copy-dialog';
-import { Process, getProcess } from 'store/processes/process';
+import { getProcess } from 'store/processes/process';
import { snackbarActions, SnackbarKind } from 'store/snackbar/snackbar-actions';
import { initProjectsTreePicker } from 'store/tree-picker/tree-picker-actions';
-import { ContainerRequestResource, ContainerRequestState } from 'models/container-request';
+import { ContainerRequestState } from 'models/container-request';
export const PROCESS_COPY_FORM_NAME = 'processCopyFormName';
export const MULTI_PROCESS_COPY_FORM_NAME = 'multiProcessCopyFormName';
-export const openCopyProcessDialog = (resource: { name: string; uuid: string }) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const process = getProcess(resource.uuid)(getState().resources);
- if (process) {
- dispatch<any>(resetPickerProjectTree());
- dispatch<any>(initProjectsTreePicker(PROCESS_COPY_FORM_NAME));
- const initialData: CopyFormDialogData = { name: `Copy of: ${resource.name}`, uuid: resource.uuid, ownerUuid: '' };
- dispatch<any>(initialize(PROCESS_COPY_FORM_NAME, initialData));
- dispatch(dialogActions.OPEN_DIALOG({ id: PROCESS_COPY_FORM_NAME, data: {} }));
- } else {
- dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process not found', hideDuration: 2000, kind: SnackbarKind.ERROR }));
- }
-};
-
-export const openCopyManyProcessesDialog = (list: Array<string>) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- //need to test with undefined process array
- const testList = ['tordo-xvhdp-f8ps1vs3s3c2u3v', 'foo'];
- const processes = list.map((uuid) => {
- // const processes = testList.map((uuid) => {
- const process = getProcess(uuid)(getState().resources);
- if (!process) {
- dispatch(snackbarActions.OPEN_SNACKBAR({ message: `Process ${uuid} not found`, hideDuration: 2000, kind: SnackbarKind.ERROR }));
- return undefined;
- } else return process;
- });
- console.log(processes);
-
- let initialData: CopyFormDialogData;
- if (processes.every((process) => !!process)) {
- const { name, uuid } = (processes[0] as Process).containerRequest;
- dispatch<any>(resetPickerProjectTree());
- dispatch<any>(initProjectsTreePicker(MULTI_PROCESS_COPY_FORM_NAME));
- initialData = { name: `Copy of: ${name}`, uuid: uuid, ownerUuid: '' };
- dispatch<any>(initialize(MULTI_PROCESS_COPY_FORM_NAME, initialData));
- dispatch(dialogActions.OPEN_DIALOG({ id: MULTI_PROCESS_COPY_FORM_NAME, data: {} }));
- }
-};
+export const openCopyProcessDialog =
+ (resource: { name: string; uuid: string }) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ const process = getProcess(resource.uuid)(getState().resources);
+ if (process) {
+ dispatch<any>(resetPickerProjectTree());
+ dispatch<any>(initProjectsTreePicker(PROCESS_COPY_FORM_NAME));
+ const initialData: CopyFormDialogData = { name: `Copy of: ${resource.name}`, uuid: resource.uuid, ownerUuid: '' };
+ dispatch<any>(initialize(PROCESS_COPY_FORM_NAME, initialData));
+ dispatch(dialogActions.OPEN_DIALOG({ id: PROCESS_COPY_FORM_NAME, data: {} }));
+ } else {
+ dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process not found', hideDuration: 2000, kind: SnackbarKind.ERROR }));
+ }
+ };
export const copyProcess = (resource: CopyFormDialogData) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
dispatch(startSubmit(PROCESS_COPY_FORM_NAME));
diff --git a/src/store/processes/processes-actions.ts b/src/store/processes/processes-actions.ts
index 1d3be435..6d46efd0 100644
--- a/src/store/processes/processes-actions.ts
+++ b/src/store/processes/processes-actions.ts
@@ -158,40 +158,41 @@ export const startWorkflow = (uuid: string) => async (dispatch: Dispatch, getSta
}
};
-export const reRunProcess = (processUuid: string, workflowUuid: string) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const process = getResource<any>(processUuid)(getState().resources);
- const workflows = getState().runProcessPanel.searchWorkflows;
- const workflow = workflows.find((workflow) => workflow.uuid === workflowUuid);
- if (workflow && process) {
- const mainWf = getWorkflow(process.mounts[MOUNT_PATH_CWL_WORKFLOW]);
- if (mainWf) {
- mainWf.inputs = getInputs(process);
- }
- const stringifiedDefinition = JSON.stringify(process.mounts[MOUNT_PATH_CWL_WORKFLOW].content);
- const newWorkflow = { ...workflow, definition: stringifiedDefinition };
+export const reRunProcess =
+ (processUuid: string, workflowUuid: string) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ const process = getResource<any>(processUuid)(getState().resources);
+ const workflows = getState().runProcessPanel.searchWorkflows;
+ const workflow = workflows.find((workflow) => workflow.uuid === workflowUuid);
+ if (workflow && process) {
+ const mainWf = getWorkflow(process.mounts[MOUNT_PATH_CWL_WORKFLOW]);
+ if (mainWf) {
+ mainWf.inputs = getInputs(process);
+ }
+ const stringifiedDefinition = JSON.stringify(process.mounts[MOUNT_PATH_CWL_WORKFLOW].content);
+ const newWorkflow = { ...workflow, definition: stringifiedDefinition };
- const owner = getResource<ProjectResource | UserResource>(workflow.ownerUuid)(getState().resources);
- const basicInitialData: RunProcessBasicFormData = { name: `Copy of: ${process.name}`, description: process.description, owner };
- dispatch<any>(initialize(RUN_PROCESS_BASIC_FORM, basicInitialData));
+ const owner = getResource<ProjectResource | UserResource>(workflow.ownerUuid)(getState().resources);
+ const basicInitialData: RunProcessBasicFormData = { name: `Copy of: ${process.name}`, description: process.description, owner };
+ dispatch<any>(initialize(RUN_PROCESS_BASIC_FORM, basicInitialData));
- const advancedInitialData: RunProcessAdvancedFormData = {
- output: process.outputName,
- runtime: process.schedulingParameters.max_run_time,
- ram: process.runtimeConstraints.ram,
- vcpus: process.runtimeConstraints.vcpus,
- keep_cache_ram: process.runtimeConstraints.keep_cache_ram,
- acr_container_image: process.containerImage,
- };
- dispatch<any>(initialize(RUN_PROCESS_ADVANCED_FORM, advancedInitialData));
+ const advancedInitialData: RunProcessAdvancedFormData = {
+ output: process.outputName,
+ runtime: process.schedulingParameters.max_run_time,
+ ram: process.runtimeConstraints.ram,
+ vcpus: process.runtimeConstraints.vcpus,
+ keep_cache_ram: process.runtimeConstraints.keep_cache_ram,
+ acr_container_image: process.containerImage,
+ };
+ dispatch<any>(initialize(RUN_PROCESS_ADVANCED_FORM, advancedInitialData));
- dispatch<any>(navigateToRunProcess);
- dispatch<any>(goToStep(1));
- dispatch(runProcessPanelActions.SET_STEP_CHANGED(true));
- dispatch(runProcessPanelActions.SET_SELECTED_WORKFLOW(newWorkflow));
- } else {
- dispatch<any>(snackbarActions.OPEN_SNACKBAR({ message: `You can't re-run this process`, kind: SnackbarKind.ERROR }));
- }
-};
+ dispatch<any>(navigateToRunProcess);
+ dispatch<any>(goToStep(1));
+ dispatch(runProcessPanelActions.SET_STEP_CHANGED(true));
+ dispatch(runProcessPanelActions.SET_SELECTED_WORKFLOW(newWorkflow));
+ } else {
+ dispatch<any>(snackbarActions.OPEN_SNACKBAR({ message: `You can't re-run this process`, kind: SnackbarKind.ERROR }));
+ }
+ };
/*
* Fetches raw inputs from containerRequest mounts with fallback to properties
@@ -296,22 +297,7 @@ export const openRemoveProcessDialog = (uuid: string) => (dispatch: Dispatch, ge
);
};
-export const openRemoveManyProcessesDialog = (list: Array<string>) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- dispatch(
- dialogActions.OPEN_DIALOG({
- id: REMOVE_MANY_PROCESSES_DIALOG,
- data: {
- title: 'Remove processes permanently',
- text: `Are you sure you want to remove these ${list.length} processes?`,
- confirmButtonLabel: 'Remove',
- list,
- },
- })
- );
-};
-
export const REMOVE_PROCESS_DIALOG = 'removeProcessDialog';
-export const REMOVE_MANY_PROCESSES_DIALOG = 'removeManyProcessesDialog';
export const removeProcessPermanently = (uuid: string) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...', kind: SnackbarKind.INFO }));
diff --git a/src/views-components/dialog-copy/dialog-process-rerun.tsx b/src/views-components/dialog-copy/dialog-process-rerun.tsx
index 2d34baf9..a5d8f3a0 100644
--- a/src/views-components/dialog-copy/dialog-process-rerun.tsx
+++ b/src/views-components/dialog-copy/dialog-process-rerun.tsx
@@ -25,14 +25,3 @@ const CopyDialogFields = memoize((pickerId: string) => () => (
<Field name='ownerUuid' component={ProjectTreePickerField} validate={COPY_FILE_VALIDATION} pickerId={pickerId} />
</>
));
-
-export const DialogManyProcessesRerun = (props: ProcessRerunFormDialogProps & PickerIdProp) => (
- <FormDialog dialogTitle='Choose location for re-runs' formFields={CopyManyDialogFields(props.pickerId)} submitLabel='Copy' {...props} />
-);
-
-const CopyManyDialogFields = memoize((pickerId: string) => () => (
- <>
- {/* <Field name='name' component={TextField as any} validate={COPY_NAME_VALIDATION} label='Enter a new name for the copy' /> */}
- <Field name='ownerUuid' component={ProjectTreePickerField} validate={COPY_FILE_VALIDATION} pickerId={pickerId} />
- </>
-));
diff --git a/src/views-components/dialog-forms/copy-process-dialog.ts b/src/views-components/dialog-forms/copy-process-dialog.ts
index 95db53a2..8afa58dd 100644
--- a/src/views-components/dialog-forms/copy-process-dialog.ts
+++ b/src/views-components/dialog-forms/copy-process-dialog.ts
@@ -5,8 +5,8 @@
import { compose } from 'redux';
import { withDialog } from 'store/dialog/with-dialog';
import { reduxForm } from 'redux-form';
-import { PROCESS_COPY_FORM_NAME, MULTI_PROCESS_COPY_FORM_NAME } from 'store/processes/process-copy-actions';
-import { DialogProcessRerun, DialogManyProcessesRerun } from 'views-components/dialog-copy/dialog-process-rerun';
+import { PROCESS_COPY_FORM_NAME } from 'store/processes/process-copy-actions';
+import { DialogProcessRerun } from 'views-components/dialog-copy/dialog-process-rerun';
import { copyProcess } from 'store/workbench/workbench-actions';
import { CopyFormDialogData } from 'store/copy-dialog/copy-dialog';
import { pickerId } from 'store/tree-picker/picker-id';
@@ -16,21 +16,8 @@ export const CopyProcessDialog = compose(
reduxForm<CopyFormDialogData>({
form: PROCESS_COPY_FORM_NAME,
onSubmit: (data, dispatch) => {
- console.log('In CopyProcessDialog');
dispatch(copyProcess(data));
},
}),
pickerId(PROCESS_COPY_FORM_NAME)
)(DialogProcessRerun);
-
-export const CopyManyProcessesDialog = compose(
- withDialog(MULTI_PROCESS_COPY_FORM_NAME),
- reduxForm<CopyFormDialogData>({
- form: MULTI_PROCESS_COPY_FORM_NAME,
- onSubmit: (data, dispatch) => {
- console.log('COPYMANY', data);
- dispatch(copyProcess(data));
- },
- }),
- pickerId(MULTI_PROCESS_COPY_FORM_NAME)
-)(DialogManyProcessesRerun);
diff --git a/src/views-components/process-remove-many-dialog/process-remove-many-dialog.tsx b/src/views-components/process-remove-many-dialog/process-remove-many-dialog.tsx
deleted file mode 100644
index 4889418c..00000000
--- a/src/views-components/process-remove-many-dialog/process-remove-many-dialog.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-//this file can probably be removed - lk
-
-import { Dispatch, compose } from 'redux';
-import { connect } from 'react-redux';
-import { ConfirmationDialog } from 'components/confirmation-dialog/confirmation-dialog';
-import { withDialog, WithDialogProps } from 'store/dialog/with-dialog';
-import { removeProcessPermanently, REMOVE_MANY_PROCESSES_DIALOG } from 'store/processes/processes-actions';
-
-const mapDispatchToProps = (dispatch: Dispatch, props: WithDialogProps<any>) => ({
- onConfirm: () => {
- props.closeDialog();
- props.data.list.forEach((uuid: string) => dispatch<any>(removeProcessPermanently(uuid)));
- },
-});
-
-export const RemoveManyProcessesDialog = compose(withDialog(REMOVE_MANY_PROCESSES_DIALOG), connect(null, mapDispatchToProps))(ConfirmationDialog);
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 74bccd0f..445e86de 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -24,7 +24,7 @@ import { ChangeWorkflowDialog } from 'views-components/run-process-dialog/change
import { CreateProjectDialog } from 'views-components/dialog-forms/create-project-dialog';
import { CreateCollectionDialog } from 'views-components/dialog-forms/create-collection-dialog';
import { CopyCollectionDialog } from 'views-components/dialog-forms/copy-collection-dialog';
-import { CopyProcessDialog, CopyManyProcessesDialog } from 'views-components/dialog-forms/copy-process-dialog';
+import { CopyProcessDialog } from 'views-components/dialog-forms/copy-process-dialog';
import { UpdateCollectionDialog } from 'views-components/dialog-forms/update-collection-dialog';
import { UpdateProcessDialog } from 'views-components/dialog-forms/update-process-dialog';
import { UpdateProjectDialog } from 'views-components/dialog-forms/update-project-dialog';
@@ -34,7 +34,6 @@ import { MoveCollectionDialog } from 'views-components/dialog-forms/move-collect
import { FilesUploadCollectionDialog } from 'views-components/dialog-forms/files-upload-collection-dialog';
import { PartialCopyCollectionDialog } from 'views-components/dialog-forms/partial-copy-collection-dialog';
import { RemoveProcessDialog } from 'views-components/process-remove-dialog/process-remove-dialog';
-import { RemoveManyProcessesDialog } from 'views-components/process-remove-many-dialog/process-remove-many-dialog';
import { MainContentBar } from 'views-components/main-content-bar/main-content-bar';
import { Grid } from '@material-ui/core';
import { TrashPanel } from 'views/trash-panel/trash-panel';
@@ -194,7 +193,11 @@ let routes = (
const reduceRoutesFn: (a: React.ReactElement[], b: ElementListReducer) => React.ReactElement[] = (a, b) => b(a);
-routes = React.createElement(React.Fragment, null, pluginConfig.centerPanelList.reduce(reduceRoutesFn, React.Children.toArray(routes.props.children)));
+routes = React.createElement(
+ React.Fragment,
+ null,
+ pluginConfig.centerPanelList.reduce(reduceRoutesFn, React.Children.toArray(routes.props.children))
+);
const applyCollapsedState = (isCollapsed) => {
const rightPanel: Element = document.getElementsByClassName('layout-pane')[1];
@@ -255,7 +258,6 @@ export const WorkbenchPanel = withStyles(styles)((props: WorkbenchPanelProps) =>
<ContextMenu />
<CopyCollectionDialog />
<CopyProcessDialog />
- <CopyManyProcessesDialog />
<CreateCollectionDialog />
<CreateProjectDialog />
<CreateRepositoryDialog />
@@ -282,7 +284,6 @@ export const WorkbenchPanel = withStyles(styles)((props: WorkbenchPanelProps) =>
<RemoveKeepServiceDialog />
<RemoveLinkDialog />
<RemoveProcessDialog />
- <RemoveManyProcessesDialog />
<RemoveRepositoryDialog />
<RemoveSshKeyDialog />
<RemoveVirtualMachineDialog />
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list