Merge branch 'master' into 13905-restoring-correct-tree-state-and-panel-item-highligh...
authorPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Fri, 3 Aug 2018 12:41:57 +0000 (14:41 +0200)
committerPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Fri, 3 Aug 2018 12:41:57 +0000 (14:41 +0200)
refs #13905

Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>

1  2 
src/views/workbench/workbench.tsx

index cd8d1edc95c809ddafd161cab3c93b588200ec51,3611d7b10fb12210f9573f9ebf2df41476d62693..e78c3e7cddcd1d9f58c29772ab171a3e7bd6378f
@@@ -18,7 -18,7 +18,7 @@@ import { TreeItem } from "../../compone
  import { getTreePath } from '../../store/project/project-reducer';
  import { sidePanelActions } from '../../store/side-panel/side-panel-action';
  import { SidePanel, SidePanelItem } from '../../components/side-panel/side-panel';
 -import { ItemMode, setProjectItem } from "../../store/navigation/navigation-action";
 +import { ItemMode, setProjectItem, restoreBranch } from "../../store/navigation/navigation-action";
  import { projectActions } from "../../store/project/project-action";
  import { collectionCreateActions } from '../../store/collections/creator/collection-creator-action';
  import { ProjectPanel } from "../project-panel/project-panel";
@@@ -41,6 -41,8 +41,8 @@@ import { CreateCollectionDialog } from 
  import { CollectionPanel } from '../collection-panel/collection-panel';
  import { loadCollection } from '../../store/collection-panel/collection-panel-action';
  import { getCollectionUrl } from '../../models/collection';
+ import { RemoveDialog } from '../../views-components/remove-dialog/remove-dialog';
+ import { RenameDialog } from '../../views-components/rename-dialog/rename-dialog';
  import { UpdateCollectionDialog } from '../../views-components/update-collection-dialog/update-collection-dialog.';
  import { AuthService } from "../../services/auth-service/auth-service";
  
@@@ -91,7 -93,6 +93,7 @@@ interface WorkbenchDataProps 
      user?: User;
      currentToken?: string;
      sidePanelItems: SidePanelItem[];
 +    router?: any;
  }
  
  interface WorkbenchServiceProps {
@@@ -129,8 -130,7 +131,8 @@@ export const Workbench = withStyles(sty
              currentProjectId: state.projects.currentItemId,
              user: state.auth.user,
              currentToken: state.auth.apiToken,
 -            sidePanelItems: state.sidePanel
 +            sidePanelItems: state.sidePanel,
 +            router: state.router.location
          })
      )(
          class extends React.Component<WorkbenchProps, WorkbenchState> {
                  }
              };
  
 +            componentDidMount() {
 +                const PROJECT_URL_REGEX = /\/projects\/(.*)/;
 +                const getProjectIdFromUrl = (url: string) => {
 +                    const match = PROJECT_URL_REGEX.exec(url);
 +                    return match ? match[1] : match;
 +                };
 +
 +                const id = getProjectIdFromUrl(this.props.router.pathname);
 +                if (id) {
 +                    this.props.dispatch<any>(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_ACTIVE(SidePanelIdentifiers.PROJECTS));
 +                    this.props.dispatch<any>(restoreBranch(id));
 +                }
 +            }
 +
              render() {
                  const path = getTreePath(this.props.projects, this.props.currentProjectId);
                  const breadcrumbs = path.map(item => ({
                          <Snackbar />
                          <CreateProjectDialog />
                          <CreateCollectionDialog />
+                         <RemoveDialog />
+                         <RenameDialog />
                          <UpdateCollectionDialog />
                          <CurrentTokenDialog
                              currentToken={this.props.currentToken}
                          case ResourceKind.COLLECTION:
                              this.props.dispatch(loadCollection(item.uuid, item.kind as ResourceKind));
                              this.props.dispatch(push(getCollectionUrl(item.uuid)));
 -                        default: 
 +                        default:
                              this.props.dispatch(setProjectItem(item.uuid, ItemMode.ACTIVE));
                              this.props.dispatch(loadDetails(item.uuid, item.kind as ResourceKind));
                      }