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.matchWorkflowRoute(pathname) && !Routes.matchUserVirtualMachineRoute(pathname) &&
34 !Routes.matchAdminVirtualMachineRoute(pathname) && !Routes.matchRepositoriesRoute(pathname) &&
35 !Routes.matchSshKeysAdminRoute(pathname) && !Routes.matchSshKeysUserRoute(pathname) &&
36 !Routes.matchSiteManagerRoute(pathname) &&
37 !Routes.matchKeepServicesRoute(pathname) && !Routes.matchComputeNodesRoute(pathname) &&
38 !Routes.matchApiClientAuthorizationsRoute(pathname) && !Routes.matchUsersRoute(pathname) &&
39 !Routes.matchMyAccountRoute(pathname) && !Routes.matchLinksRoute(pathname);
42 export const MainContentBar =
43 connect((state: RootState) => ({
44 buttonVisible: isButtonVisible(state)
46 onDetailsPanelToggle: toggleDetailsPanel,
49 (props: MainContentBarProps & WithStyles<CssRules> & any) =>
52 <Grid container item xs alignItems="center">
59 {props.buttonVisible && <Tooltip title="Additional Info">
60 <IconButton color="inherit" className={props.classes.infoTooltip} onClick={props.onDetailsPanelToggle}>