Merge remote-tracking branch 'origin/main' into 18169-cancel-button-not-working
[arvados.git] / src / components / refresh-button / refresh-button.tsx
index b62add72882f97a908c3e1a5068579784cbd784f..9971547bf092a5462b90f4db0e9ee66bb32f43a7 100644 (file)
@@ -3,8 +3,8 @@
 //
 // 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';
@@ -22,13 +22,20 @@ const styles: StyleRulesCallback<CssRules> = theme => ({
     },
 });
 
-export const RefreshButton = ({ history, classes }: RouteComponentProps & WithStyles<CssRules>) =>
+interface RefreshButtonProps {
+    onClick?: () => void;
+}
+
+export const RefreshButton = ({ history, classes, onClick }: RouteComponentProps & WithStyles<CssRules> & RefreshButtonProps) =>
     <Button
         color="primary"
         size="small"
         variant="contained"
         onClick={() => {
             history.replace(window.location.pathname);
+            if (onClick) {
+                onClick();
+            }
         }}
         className={classNames(classes.buttonRight, classes.button)}>
         <ReRunProcessIcon />