Просмотр исходного кода

attempt to refersh clusters on provisioning end

jusrhee 5 лет назад
Родитель
Сommit
a416f241f9

+ 1 - 0
dashboard/src/main/home/Home.tsx

@@ -164,6 +164,7 @@ export default class Home extends Component<PropsType, StateType> {
         <Provisioner 
           setCurrentView={(x: string) => this.setState({ currentView: x })}
           viewData={this.state.viewData}
+          setRefreshClusters={(x: boolean) => this.setState({ forceRefreshClusters: x })}
         />
       );
     }

+ 5 - 1
dashboard/src/main/home/cluster-dashboard/expanded-chart/status/Logs.tsx

@@ -33,7 +33,7 @@ export default class Logs extends Component<PropsType, StateType> {
       return <Message>No logs to display from this pod.</Message>
     }
     return this.state.logs.map((log, i) => {
-        return <div key={i}>{log}</div>
+        return <Log key={i}>{log}</Log>
     })
   }
 
@@ -106,4 +106,8 @@ const Message = styled.div`
   justify-content: center;
   color: #ffffff44;
   font-size: 13px;
+`;
+
+const Log = styled.div`
+  font-family: monospace;
 `;

+ 8 - 2
dashboard/src/main/home/new-project/Provisioner.tsx

@@ -15,7 +15,8 @@ import { inflateRaw, inflateRawSync } from 'zlib';
 type PropsType = {
   viewData: any,
   setCurrentView: (x: string) => void,
-};
+  setRefreshClusters: (x: boolean) => void,
+}
 
 type StateType = {
   error: boolean,
@@ -148,7 +149,7 @@ export default class Provisioner extends Component<PropsType, StateType> {
 
   renderLogs = () => {
     return this.state.logs.map((log, i) => {
-      return <div key={i}>{log}</div>
+      return <Log key={i}>{log}</Log>
     });
   }
 
@@ -200,6 +201,7 @@ export default class Provisioner extends Component<PropsType, StateType> {
     if (maxStep !== 0 && currentStep === maxStep) {
       console.log('Thinks provisioning complete.')
       console.log(currentStep, maxStep);
+      this.props.setRefreshClusters(true);
       this.props.setCurrentView('dashboard');
     }
 
@@ -246,6 +248,10 @@ const Wrapper = styled.div`
   padding: 20px 25px;
 `;
 
+const Log = styled.div`
+  font-family: monospace;
+`;
+
 const LogStream = styled.div`
   height: 300px;
   margin-top: 30px;

+ 3 - 0
dashboard/src/main/home/sidebar/ClusterSection.tsx

@@ -53,6 +53,7 @@ export default class ClusterSection extends Component<PropsType, StateType> {
         // TODO: handle uninitialized kubeconfig
         if (res.data) {
           let clusters = res.data;
+          console.log('found clusters:', res.data);
           if (clusters.length > 0) {
             this.setState({ clusters });
             setCurrentCluster(clusters[0]);
@@ -69,6 +70,7 @@ export default class ClusterSection extends Component<PropsType, StateType> {
 
   componentDidMount() {
     this.updateClusters();
+    console.log('mounted clustersection');
   }
 
   // Need to override showDrawer when the sidebar is closed
@@ -82,6 +84,7 @@ export default class ClusterSection extends Component<PropsType, StateType> {
       } else if (this.props.forceRefreshClusters === true) {
         this.updateClusters();
         this.props.setRefreshClusters(false);
+        console.log('hard refereshed clusters');
       }
 
       if (this.props.forceCloseDrawer && this.state.showDrawer) {