X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/55e9d0bcceeb7c88f7bd8d0b20408c6b87846ff2..b5b75b89e923864389f814af97974a55b69a343f:/src/components/refresh-button/refresh-button.tsx?ds=sidebyside

diff --git a/src/components/refresh-button/refresh-button.tsx b/src/components/refresh-button/refresh-button.tsx
index 66bda99e..e2fe5484 100644
--- a/src/components/refresh-button/refresh-button.tsx
+++ b/src/components/refresh-button/refresh-button.tsx
@@ -3,11 +3,11 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
-import * as classNames from 'classnames';
+import React from 'react';
+import classNames from 'classnames';
 import { withRouter, RouteComponentProps } from 'react-router';
 import { StyleRulesCallback, Button, WithStyles, withStyles } from "@material-ui/core";
-import { ReRunProcessIcon } from '~/components/icon/icon';
+import { ReRunProcessIcon } from 'components/icon/icon';
 
 type CssRules = 'button' | 'buttonRight';
 
@@ -22,13 +22,25 @@ const styles: StyleRulesCallback<CssRules> = theme => ({
     },
 });
 
-export const RefreshButton = ({ history, classes }: RouteComponentProps & WithStyles<CssRules>) =>
+interface RefreshButtonProps {
+    onClick?: () => void;
+}
+
+export const LAST_REFRESH_TIMESTAMP = 'lastRefreshTimestamp';
+
+export const RefreshButton = ({ history, classes, onClick }: RouteComponentProps & WithStyles<CssRules> & RefreshButtonProps) =>
     <Button
         color="primary"
         size="small"
         variant="contained"
         onClick={() => {
+            // Notify interested parties that the refresh button was clicked.
+            const now = (new Date()).getTime();
+            localStorage.setItem(LAST_REFRESH_TIMESTAMP, now.toString());
             history.replace(window.location.pathname);
+            if (onClick) {
+                onClick();
+            }
         }}
         className={classNames(classes.buttonRight, classes.button)}>
         <ReRunProcessIcon />
