X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/2309d8a0970d603fa1bd6b23f1fae7f97bb2f7e1..507ae159f9c1eb0dd6a406a3987243aab7f05866:/src/components/multiselectToolbar/MultiselectToolbar.tsx

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];
