2 // Copyright (C) The Arvados Authors. All rights reserved.
4 // SPDX-License-Identifier: AGPL-3.0
6 import React from 'react';
7 import classNames from 'classnames';
8 import { withRouter, RouteComponentProps } from 'react-router';
9 import { StyleRulesCallback, Button, WithStyles, withStyles } from "@material-ui/core";
10 import { ReRunProcessIcon } from 'components/icon/icon';
12 type CssRules = 'button' | 'buttonRight';
14 const styles: StyleRulesCallback<CssRules> = theme => ({
17 padding: '2px 10px 2px 5px',
25 interface RefreshButtonProps {
29 export const LAST_REFRESH_TIMESTAMP = 'lastRefreshTimestamp';
31 export const RefreshButton = ({ history, classes, onClick }: RouteComponentProps & WithStyles<CssRules> & RefreshButtonProps) =>
37 // Notify interested parties that the refresh button was clicked.
38 const now = (new Date()).getTime();
39 localStorage.setItem(LAST_REFRESH_TIMESTAMP, now.toString());
40 history.replace(window.location.pathname);
45 className={classNames(classes.buttonRight, classes.button)}>
50 export default withStyles(styles)(withRouter(RefreshButton));