X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/d53f2e8a10937bff1bb16a4e37e060daddbf3fa5..a94a57d2dfd24d43c5e927dadf3f5ab35b2899d5:/src/views-components/side-panel-button/side-panel-button.tsx

diff --git a/src/views-components/side-panel-button/side-panel-button.tsx b/src/views-components/side-panel-button/side-panel-button.tsx
index 9ba23267..0f797590 100644
--- a/src/views-components/side-panel-button/side-panel-button.tsx
+++ b/src/views-components/side-panel-button/side-panel-button.tsx
@@ -13,7 +13,6 @@ import { StyleRulesCallback, WithStyles, withStyles, Toolbar, Grid, Button, Menu
 import { AddIcon, CollectionIcon, ProcessIcon, ProjectIcon } from '~/components/icon/icon';
 import { openProjectCreateDialog } from '~/store/projects/project-create-actions';
 import { openCollectionCreateDialog } from '~/store/collections/collection-create-actions';
-import { matchProjectRoute } from '~/routes/routes';
 import { navigateToRunProcess } from '~/store/navigation/navigation-action';
 import { runProcessPanelActions } from '~/store/run-process-panel/run-process-panel-actions';
 
@@ -35,8 +34,8 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
 });
 
 interface SidePanelDataProps {
+    location: any;
     currentItemId: string;
-    buttonVisible: boolean;
 }
 
 interface SidePanelState {
@@ -50,16 +49,10 @@ const transformOrigin: PopoverOrigin = {
     horizontal: 0
 };
 
-const isButtonVisible = ({ router }: RootState) => {
-    const pathname = router.location ? router.location.pathname : '';
-    const match = matchProjectRoute(pathname);
-    return !!match;
-};
-
 export const SidePanelButton = withStyles(styles)(
     connect((state: RootState) => ({
         currentItemId: getProperty(PROJECT_PANEL_CURRENT_UUID)(state.properties),
-        buttonVisible: isButtonVisible(state)
+        location: state.router.location
     }))(
         class extends React.Component<SidePanelProps> {
 
@@ -68,10 +61,10 @@ export const SidePanelButton = withStyles(styles)(
             };
 
             render() {
-                const { classes, buttonVisible } = this.props;
+                const { classes } = this.props;
                 const { anchorEl } = this.state;
                 return <Toolbar>
-                    {buttonVisible && <Grid container>
+                    <Grid container>
                         <Grid container item xs alignItems="center" justify="flex-start">
                             <Button variant="contained" color="primary" size="small" className={classes.button}
                                 aria-owns={anchorEl ? 'aside-menu-list' : undefined}
@@ -98,7 +91,7 @@ export const SidePanelButton = withStyles(styles)(
                                 </MenuItem>
                             </Menu>
                         </Grid>
-                    </Grid>}
+                    </Grid>
                 </Toolbar>;
             }
 
@@ -107,7 +100,11 @@ export const SidePanelButton = withStyles(styles)(
             }
 
             handleRunProcessClick = () => {
+                const location = this.props.location;
+                this.props.dispatch(runProcessPanelActions.RESET_RUN_PROCESS_PANEL());
+                this.props.dispatch(runProcessPanelActions.SET_PROCESS_PATHNAME(location.pathname));
                 this.props.dispatch(runProcessPanelActions.SET_PROCESS_OWNER_UUID(this.props.currentItemId));
+                
                 this.props.dispatch<any>(navigateToRunProcess);
             }
 
