X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7888c50a75bdadd042548828ba7da7f2d94e6f6c..3612a36e473bf1599180a9b3b90b03ca0aaafb45:/src/components/multiselect-toolbar/MultiselectToolbar.tsx diff --git a/src/components/multiselect-toolbar/MultiselectToolbar.tsx b/src/components/multiselect-toolbar/MultiselectToolbar.tsx index a6f037caae..3d8ae0c3d3 100644 --- a/src/components/multiselect-toolbar/MultiselectToolbar.tsx +++ b/src/components/multiselect-toolbar/MultiselectToolbar.tsx @@ -17,8 +17,9 @@ import { ContextMenuAction, ContextMenuActionSet } from "views-components/contex import { RestoreFromTrashIcon, TrashIcon } from "components/icon/icon"; import { multiselectActionsFilters, TMultiselectActionsFilters, contextMenuActionConsts } 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"; +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"; type CssRules = "root" | "button"; @@ -33,8 +34,8 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ transition: "width 150ms", }, button: { - width: "1rem", - margin: "auto 5px", + width: "2.5rem", + height: "2.5rem ", }, }); @@ -55,41 +56,46 @@ export const MultiselectToolbar = connect( const currentPathIsTrash = window.location.pathname === "/trash"; const buttons = currentPathIsTrash && selectedToKindSet(checkedList).size - ? [toggleTrashAction] + ? [msToggleTrashAction] : selectActionsByKind(currentResourceKinds, multiselectActionsFilters); return ( - - {buttons.length ? ( - buttons.map((btn, i) => - btn.name === "ToggleTrashAction" ? ( - - props.executeMulti(btn, checkedList, props.resources)}> - {currentPathIsTrash ? : } - - - ) : ( - - props.executeMulti(btn, checkedList, props.resources)}> - {btn.icon ? btn.icon({}) : <>} - - + + + {buttons.length ? ( + buttons.map((btn, i) => + btn.name === "ToggleTrashAction" ? ( + + props.executeMulti(btn, checkedList, props.resources)}> + {currentPathIsTrash ? : } + + + ) : ( + + props.executeMulti(btn, checkedList, props.resources)}> + {btn.icon ? btn.icon({}) : <>} + + + ) ) - ) - ) : ( - <> - )} - + ) : ( + <> + )} + + ); }) ); @@ -117,7 +123,7 @@ export function selectedToKindSet(checkedList: TCheckedList): Set { function groupByKind(checkedList: TCheckedList, resources: ResourcesState): Record { const result = {}; selectedToArray(checkedList).forEach(uuid => { - const resource = getResource(uuid)(resources) as Resource; + const resource = getResource(uuid)(resources) as ContainerRequestResource | Resource; if (!result[resource.kind]) result[resource.kind] = []; result[resource.kind].push(resource); }); @@ -187,7 +193,7 @@ function mapDispatchToProps(dispatch: Dispatch) { switch (selectedAction.name) { case contextMenuActionConsts.MOVE_TO: case contextMenuActionConsts.REMOVE: - const firstResource = getResource(selectedToArray(checkedList)[0])(resources) as Resource; + 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;