21224: merge stable Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox@curii.com>
[arvados.git] / services / workbench2 / src / views / project-panel / project-panel.tsx
index 9e42513e064ef3f202f009aa239e6717e96ae65d..433cb112094057253552284ff57d30b4869ac2f3 100644 (file)
@@ -51,14 +51,16 @@ import { GroupClass, GroupResource } from 'models/group';
 import { CollectionResource } from 'models/collection';
 import { resourceIsFrozen } from 'common/frozen-resources';
 import { ProjectResource } from 'models/project';
-import { NotFoundView } from 'views/not-found-panel/not-found-panel';
 import { deselectAllOthers, toggleOne } from 'store/multiselect/multiselect-actions';
+import { ProjectDetailsCard } from 'views-components/project-details-card/project-details-card';
 
-type CssRules = 'root' | 'button';
+type CssRules = 'root' | 'button' ;
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     root: {
         width: '100%',
+        display: 'flex',
+        flexDirection: 'column',
     },
     button: {
         marginLeft: theme.spacing.unit,
@@ -252,9 +254,7 @@ type ProjectPanelProps = ProjectPanelDataProps & DispatchProp & WithStyles<CssRu
 const mapStateToProps = (state: RootState) => {
     const currentItemId = getProperty<string>(PROJECT_PANEL_CURRENT_UUID)(state.properties);
     const project = getResource<GroupResource>(currentItemId || "")(state.resources);
-    const working = !!state.progressIndicator.some(p => p.id === PROJECT_PANEL_ID && p.working);
     return {
-        working,
         currentItemId,
         project,
         resources: state.resources,
@@ -262,49 +262,24 @@ const mapStateToProps = (state: RootState) => {
     };
 }
 
-type ProjectPanelState = {
-    isLoaded: boolean;
-};
-
 export const ProjectPanel = withStyles(styles)(
     connect(mapStateToProps)(
         class extends React.Component<ProjectPanelProps> {
 
-            state: ProjectPanelState ={
-                isLoaded: false,
-            }
-
-            componentDidMount(): void {
-                this.setState({ isLoaded: false });
-            }
-
-            componentDidUpdate( prevProps: Readonly<ProjectPanelProps>, prevState: Readonly<{}>, snapshot?: any ): void {
-                if(prevProps.working === true && this.props.working === false) {
-                    this.setState({ isLoaded: true });
-                }
-            }
-
             render() {
                 const { classes } = this.props;
-
-                return this.props.project ?
-                    <div data-cy='project-panel' className={classes.root}>
-                        <DataExplorer
-                            id={PROJECT_PANEL_ID}
-                            onRowClick={this.handleRowClick}
-                            onRowDoubleClick={this.handleRowDoubleClick}
-                            onContextMenu={this.handleContextMenu}
-                            contextMenuColumn={true}
-                            defaultViewIcon={ProjectIcon}
-                            defaultViewMessages={DEFAULT_VIEW_MESSAGES}
-                        />
-                    </div>
-                    : this.state.isLoaded ?
-                    <NotFoundView
-                        icon={ProjectIcon}
-                        messages={["Project not found"]}
+                return <div data-cy='project-panel' className={classes.root}>
+                    <ProjectDetailsCard />
+                    <DataExplorer
+                        id={PROJECT_PANEL_ID}
+                        onRowClick={this.handleRowClick}
+                        onRowDoubleClick={this.handleRowDoubleClick}
+                        onContextMenu={this.handleContextMenu}
+                        contextMenuColumn={true}
+                        defaultViewIcon={ProjectIcon}
+                        defaultViewMessages={DEFAULT_VIEW_MESSAGES}
                     />
-                    : null
+                </div>
             }
 
             isCurrentItemChild = (resource: Resource) => {