X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/31e84a9315728c2f58a26bf0e9e1d2b38326fb86..c952afae1af2fb31b68be04f70bd7ae6f9d52aba:/src/views/project-panel/project-panel.tsx

diff --git a/src/views/project-panel/project-panel.tsx b/src/views/project-panel/project-panel.tsx
index 35a7f9c1..892d2819 100644
--- a/src/views/project-panel/project-panel.tsx
+++ b/src/views/project-panel/project-panel.tsx
@@ -2,57 +2,56 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
+import React from 'react';
 import withStyles from "@material-ui/core/styles/withStyles";
 import { DispatchProp, connect } from 'react-redux';
 import { RouteComponentProps } from 'react-router';
 import { StyleRulesCallback, WithStyles } from "@material-ui/core";
 
-import { DataExplorer } from "~/views-components/data-explorer/data-explorer";
-import { DataColumns } from '~/components/data-table/data-table';
-import { RootState } from '~/store/store';
-import { DataTableFilterItem } from '~/components/data-table-filters/data-table-filters';
-import { ContainerRequestState } from '~/models/container-request';
-import { SortDirection } from '~/components/data-table/data-column';
-import { ResourceKind, Resource } from '~/models/resource';
+import { DataExplorer } from "views-components/data-explorer/data-explorer";
+import { DataColumns } from 'components/data-table/data-table';
+import { RootState } from 'store/store';
+import { DataTableFilterItem } from 'components/data-table-filters/data-table-filters';
+import { ContainerRequestState } from 'models/container-request';
+import { SortDirection } from 'components/data-table/data-column';
+import { ResourceKind, Resource } from 'models/resource';
 import {
     ResourceFileSize,
     ResourceLastModifiedDate,
     ProcessStatus,
     ResourceType,
     ResourceOwner
-} from '~/views-components/data-explorer/renderers';
-import { ProjectIcon } from '~/components/icon/icon';
-import { ResourceName } from '~/views-components/data-explorer/renderers';
+} from 'views-components/data-explorer/renderers';
+import { ProjectIcon } from 'components/icon/icon';
+import { ResourceName } from 'views-components/data-explorer/renderers';
 import {
     ResourcesState,
     getResource
-} from '~/store/resources/resources';
-import { loadDetailsPanel } from '~/store/details-panel/details-panel-action';
+} from 'store/resources/resources';
+import { loadDetailsPanel } from 'store/details-panel/details-panel-action';
 import {
     openContextMenu,
     resourceUuidToContextMenuKind
-} from '~/store/context-menu/context-menu-actions';
-import { navigateTo } from '~/store/navigation/navigation-action';
-import { getProperty } from '~/store/properties/properties';
-import { PROJECT_PANEL_CURRENT_UUID } from '~/store/project-panel/project-panel-action';
-import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
-import { ArvadosTheme } from "~/common/custom-theme";
-import { createTree } from '~/models/tree';
+} from 'store/context-menu/context-menu-actions';
+import { navigateTo } from 'store/navigation/navigation-action';
+import { getProperty } from 'store/properties/properties';
+import { PROJECT_PANEL_CURRENT_UUID } from 'store/project-panel/project-panel-action';
+import { DataTableDefaultView } from 'components/data-table-default-view/data-table-default-view';
+import { ArvadosTheme } from "common/custom-theme";
+import { createTree } from 'models/tree';
 import {
     getInitialResourceTypeFilters,
     getInitialProcessStatusFilters
-} from '~/store/resource-type-filters/resource-type-filters';
-import { GroupContentsResource } from '~/services/groups-service/groups-service';
-import { GroupClass, GroupResource } from '~/models/group';
+} from 'store/resource-type-filters/resource-type-filters';
+import { GroupContentsResource } from 'services/groups-service/groups-service';
+import { GroupClass, GroupResource } from 'models/group';
+import { CollectionResource } from 'models/collection';
 
 type CssRules = 'root' | "button";
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     root: {
-        position: 'relative',
         width: '100%',
-        height: '100%'
     },
     button: {
         marginLeft: theme.spacing.unit
@@ -132,22 +131,37 @@ interface ProjectPanelDataProps {
     resources: ResourcesState;
     isAdmin: boolean;
     userUuid: string;
+    dataExplorerItems: any;
 }
 
 type ProjectPanelProps = ProjectPanelDataProps & DispatchProp
     & WithStyles<CssRules> & RouteComponentProps<{ id: string }>;
 
+let data: any[] = [];
+let href: string = '';
+
 export const ProjectPanel = withStyles(styles)(
     connect((state: RootState) => ({
         currentItemId: getProperty(PROJECT_PANEL_CURRENT_UUID)(state.properties),
         resources: state.resources,
         userUuid: state.auth.user!.uuid,
+        dataExplorerItems: state.dataExplorer?.projectPanel.items,
     }))(
         class extends React.Component<ProjectPanelProps> {
             render() {
-                const { classes } = this.props;
-                return <div className={classes.root}>
+                const { classes, dataExplorerItems } = this.props;
+                let loading = false;
+
+                if (dataExplorerItems.length > 0 && data === dataExplorerItems && href !== window.location.href) {
+                    loading = true
+                } else {
+                    href = window.location.href;
+                    data = dataExplorerItems;
+                }
+
+                return <div data-cy='project-panel' className={classes.root}>
                     <DataExplorer
+                        working={loading}
                         id={PROJECT_PANEL_ID}
                         onRowClick={this.handleRowClick}
                         onRowDoubleClick={this.handleRowDoubleClick}
@@ -183,7 +197,10 @@ export const ProjectPanel = withStyles(styles)(
                         ownerUuid: resource.ownerUuid,
                         isTrashed: ('isTrashed' in resource) ? resource.isTrashed: false,
                         kind: resource.kind,
-                        menuKind
+                        menuKind,
+                        description: resource.description,
+                        storageClassesDesired: (resource as CollectionResource).storageClassesDesired,
+                        properties: ('properties' in resource) ? resource.properties : {},
                     }));
                 }
                 this.props.dispatch<any>(loadDetailsPanel(resourceUuid));
