Forráskód Böngészése

loading controllers

sunguroku 5 éve
szülő
commit
4f68ffb41f

+ 11 - 1
dashboard/src/main/home/cluster-dashboard/expanded-chart/status/StatusSection.tsx

@@ -5,6 +5,7 @@ import Logs from './Logs';
 import ControllerTab from './ControllerTab';
 import ControllerTab from './ControllerTab';
 import { Context } from '../../../../../shared/Context';
 import { Context } from '../../../../../shared/Context';
 import { ChartType, StorageType } from '../../../../../shared/types';
 import { ChartType, StorageType } from '../../../../../shared/types';
+import Loading from '../../../../../components/Loading';
 
 
 type PropsType = {
 type PropsType = {
   selectors: string[],
   selectors: string[],
@@ -16,6 +17,7 @@ type StateType = {
   pods: any[],
   pods: any[],
   selectedPod: any,
   selectedPod: any,
   controllers: any[],
   controllers: any[],
+  loading: boolean,
 };
 };
 
 
 export default class StatusSection extends Component<PropsType, StateType> {
 export default class StatusSection extends Component<PropsType, StateType> {
@@ -24,6 +26,7 @@ export default class StatusSection extends Component<PropsType, StateType> {
     pods: [] as any[],
     pods: [] as any[],
     selectedPod: {} as any,
     selectedPod: {} as any,
     controllers: [] as any[],
     controllers: [] as any[],
+    loading: true,
   }
   }
 
 
   renderLogs = () => {
   renderLogs = () => {
@@ -53,6 +56,13 @@ export default class StatusSection extends Component<PropsType, StateType> {
   }
   }
 
 
   renderStatusSection = () => {
   renderStatusSection = () => {
+    if (this.state.loading) {
+      return (
+        <NoControllers> 
+          <Loading />
+        </NoControllers>
+      )
+    }
     if (this.state.controllers.length > 0) {
     if (this.state.controllers.length > 0) {
       return (
       return (
         <Wrapper>
         <Wrapper>
@@ -90,7 +100,7 @@ export default class StatusSection extends Component<PropsType, StateType> {
         setCurrentError(JSON.stringify(err));
         setCurrentError(JSON.stringify(err));
         return
         return
       }
       }
-      this.setState({ controllers: res.data })
+      this.setState({ controllers: res.data, loading: false })
     });
     });
   }
   }