Explorar el Código

hide provisioner if cluster exists

jusrhee hace 5 años
padre
commit
73afb393f0

+ 2 - 2
dashboard/src/main/home/dashboard/StatusPlaceholder.tsx → dashboard/src/main/home/dashboard/ClusterPlaceholder.tsx

@@ -17,7 +17,7 @@ type StateType = {
   loading: boolean,
 };
 
-export default class StatusPlaceholder extends Component<PropsType, StateType> {
+export default class ClusterPlaceholder extends Component<PropsType, StateType> {
   state = {
     loading: true,
   }
@@ -65,7 +65,7 @@ export default class StatusPlaceholder extends Component<PropsType, StateType> {
   }
 }
 
-StatusPlaceholder.contextType = Context;
+ClusterPlaceholder.contextType = Context;
 
 const LoadingWrapper = styled.div`
   height: calc(100vh - 450px);

+ 4 - 4
dashboard/src/main/home/dashboard/StatusPlaceholderContainer.tsx → dashboard/src/main/home/dashboard/ClusterPlaceholderContainer.tsx

@@ -2,7 +2,7 @@ import React, { Component } from 'react';
 import styled from 'styled-components';
 
 import { Context } from '../../../shared/Context';
-import StatusPlaceholder from './StatusPlaceholder';
+import ClusterPlaceholder from './ClusterPlaceholder';
 
 type PropsType = {
   setCurrentView: (x: string) => void,
@@ -12,13 +12,13 @@ type StateType = {
 };
 
 // Props in context to project section to trigger update on context change
-export default class StatusPlaceholderContainer extends Component<PropsType, StateType> {
+export default class ClusterPlaceholderContainer extends Component<PropsType, StateType> {
   state = {
   }
 
   render() {
     return (
-      <StatusPlaceholder
+      <ClusterPlaceholder
         setCurrentView={this.props.setCurrentView}
         currentCluster={this.context.currentCluster}
       />
@@ -26,4 +26,4 @@ export default class StatusPlaceholderContainer extends Component<PropsType, Sta
   }
 }
 
-StatusPlaceholderContainer.contextType = Context;
+ClusterPlaceholderContainer.contextType = Context;

+ 19 - 10
dashboard/src/main/home/dashboard/Dashboard.tsx

@@ -8,6 +8,7 @@ import { InfraType } from '../../../shared/types';
 import api from '../../../shared/api';
 
 import ProvisionerSettings from '../provisioner/ProvisionerSettings';
+import ClusterPlaceholderContainer from './ClusterPlaceholderContainer';
 
 type PropsType = {
   setCurrentView: (x: string) => void,
@@ -94,16 +95,24 @@ export default class Dashboard extends Component<PropsType, StateType> {
 
             <LineBreak />
 
-            {!currentCluster && (
-              <Banner>
-                <i className="material-icons">error_outline</i>
-                This project currently has no clusters conncted.
-              </Banner>
-            )}
-            <ProvisionerSettings 
-              setCurrentView={setCurrentView} 
-              infras={infras}
-            />
+            {!currentCluster 
+              ? (
+                <>
+                  <Banner>
+                    <i className="material-icons">error_outline</i>
+                    This project currently has no clusters conncted.
+                    </Banner>
+                  <ProvisionerSettings 
+                    setCurrentView={setCurrentView} 
+                    infras={infras}
+                  />
+                </>
+              ) : (
+                <ClusterPlaceholderContainer
+                  setCurrentView={this.props.setCurrentView} 
+                />
+              )
+            }
           </DashboardWrapper>
         )}
       </>