X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/9ec32d73b78aeb92b842aa8cf08bc859e084dcb1..e868a45a2a187dca9812c5e6e201503f3e427e08:/src/views-components/main-content-bar/main-content-bar.tsx?ds=sidebyside diff --git a/src/views-components/main-content-bar/main-content-bar.tsx b/src/views-components/main-content-bar/main-content-bar.tsx index 480150cb..271d77c1 100644 --- a/src/views-components/main-content-bar/main-content-bar.tsx +++ b/src/views-components/main-content-bar/main-content-bar.tsx @@ -12,8 +12,8 @@ import { RootState } from 'store/store'; import * as Routes from 'routes/routes'; import { toggleDetailsPanel } from 'store/details-panel/details-panel-action'; import RefreshButton from "components/refresh-button/refresh-button"; -import { reloadProjectMatchingUuid } from "store/workbench/workbench-actions"; import { loadSidePanelTreeProjects } from "store/side-panel-tree/side-panel-tree-actions"; +import { Dispatch } from "redux"; type CssRules = "infoTooltip"; @@ -45,47 +45,40 @@ const isButtonVisible = ({ router }: RootState) => { Routes.matchAllProcessesRoute(pathname) || Routes.matchTrashRoute(pathname) || Routes.matchFavoritesRoute(pathname); - - /* return !Routes.matchWorkflowRoute(pathname) && !Routes.matchUserVirtualMachineRoute(pathname) && - * !Routes.matchAdminVirtualMachineRoute(pathname) && !Routes.matchRepositoriesRoute(pathname) && - * !Routes.matchSshKeysAdminRoute(pathname) && !Routes.matchSshKeysUserRoute(pathname) && - * !Routes.matchSiteManagerRoute(pathname) && - * !Routes.matchKeepServicesRoute(pathname) && !Routes.matchComputeNodesRoute(pathname) && - * !Routes.matchApiClientAuthorizationsRoute(pathname) && !Routes.matchUsersRoute(pathname) && - * !Routes.matchMyAccountRoute(pathname) && !Routes.matchLinksRoute(pathname); */ }; -export const MainContentBar = - connect((state: RootState) => ({ - buttonVisible: isButtonVisible(state), - projectUuid: state.detailsPanel.resourceUuid, - }), (dispatch) => ({ - onDetailsPanelToggle: () => dispatch(toggleDetailsPanel()), - onRefreshButtonClick: (id) => { - dispatch(loadSidePanelTreeProjects(id)); - dispatch(reloadProjectMatchingUuid([id])); - } - }))( - withStyles(styles)( - (props: MainContentBarProps & WithStyles & any) => - - - - - - - { - props.onRefreshButtonClick(props.projectUuid); - }} /> - - - {props.buttonVisible && - - - - } - - - - ) - ); +const mapStateToProps = (state: RootState) => ({ + buttonVisible: isButtonVisible(state), + projectUuid: state.detailsPanel.resourceUuid, +}); + +const mapDispatchToProps = () => (dispatch: Dispatch) => ({ + onDetailsPanelToggle: () => dispatch(toggleDetailsPanel()), + onRefreshButtonClick: (id) => { + dispatch(loadSidePanelTreeProjects(id)); + } +}); + +export const MainContentBar = connect(mapStateToProps, mapDispatchToProps)(withStyles(styles)( + (props: MainContentBarProps & WithStyles & any) => + + + + + + { + props.onRefreshButtonClick(props.projectUuid); + }} /> + + + {props.buttonVisible && + + + + } + + +));