1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from "react";
7 import { Toolbar, StyleRulesCallback, IconButton, Tooltip, Grid, WithStyles, withStyles } from "@material-ui/core";
8 import { DetailsIcon } from "~/components/icon/icon";
9 import { Breadcrumbs } from "~/views-components/breadcrumbs/breadcrumbs";
10 import { connect } from 'react-redux';
11 import { RootState } from '~/store/store';
12 import * as Routes from '~/routes/routes';
13 import { toggleDetailsPanel } from '~/store/details-panel/details-panel-action';
14 import RefreshButton from "~/components/refresh-button/refresh-button";
16 type CssRules = "infoTooltip";
18 const styles: StyleRulesCallback<CssRules> = theme => ({
25 interface MainContentBarProps {
26 onRefreshPage: () => void;
27 onDetailsPanelToggle: () => void;
28 buttonVisible: boolean;
31 const isButtonVisible = ({ router }: RootState) => {
32 const pathname = router.location ? router.location.pathname : '';
33 return Routes.matchCollectionsContentAddressRoute(pathname) ||
34 Routes.matchPublicFavoritesRoute(pathname) ||
35 Routes.matchGroupDetailsRoute(pathname) ||
36 Routes.matchGroupsRoute(pathname) ||
37 Routes.matchUsersRoute(pathname) ||
38 Routes.matchSearchResultsRoute(pathname) ||
39 Routes.matchSharedWithMeRoute(pathname) ||
40 Routes.matchProcessRoute(pathname) ||
41 Routes.matchCollectionRoute(pathname) ||
42 Routes.matchProjectRoute(pathname) ||
43 Routes.matchAllProcessesRoute(pathname) ||
44 Routes.matchTrashRoute(pathname) ||
45 Routes.matchFavoritesRoute(pathname);
47 /* return !Routes.matchWorkflowRoute(pathname) && !Routes.matchUserVirtualMachineRoute(pathname) &&
48 * !Routes.matchAdminVirtualMachineRoute(pathname) && !Routes.matchRepositoriesRoute(pathname) &&
49 * !Routes.matchSshKeysAdminRoute(pathname) && !Routes.matchSshKeysUserRoute(pathname) &&
50 * !Routes.matchSiteManagerRoute(pathname) &&
51 * !Routes.matchKeepServicesRoute(pathname) && !Routes.matchComputeNodesRoute(pathname) &&
52 * !Routes.matchApiClientAuthorizationsRoute(pathname) && !Routes.matchUsersRoute(pathname) &&
53 * !Routes.matchMyAccountRoute(pathname) && !Routes.matchLinksRoute(pathname); */
56 export const MainContentBar =
57 connect((state: RootState) => ({
58 buttonVisible: isButtonVisible(state)
60 onDetailsPanelToggle: toggleDetailsPanel,
63 (props: MainContentBarProps & WithStyles<CssRules> & any) =>
66 <Grid container item xs alignItems="center">
73 {props.buttonVisible && <Tooltip title="Additional Info">
74 <IconButton color="inherit" className={props.classes.infoTooltip} onClick={props.onDetailsPanelToggle}>