Bladeren bron

Concatenate the api calls to avoid flashing of information

jnfrati 4 jaren geleden
bovenliggende
commit
6ace259c81
1 gewijzigde bestanden met toevoegingen van 8 en 6 verwijderingen
  1. 8 6
      dashboard/src/main/home/cluster-dashboard/expanded-chart/ExpandedJobChart.tsx

+ 8 - 6
dashboard/src/main/home/cluster-dashboard/expanded-chart/ExpandedJobChart.tsx

@@ -104,12 +104,12 @@ class ExpandedJobChart extends Component<PropsType, StateType> {
   };
   };
 
 
   // Retrieve full chart data (includes form and values)
   // Retrieve full chart data (includes form and values)
-  getChartData = (chart: ChartType, revision: number) => {
+  getChartData = async (chart: ChartType, revision: number) => {
     let { currentProject } = this.context;
     let { currentProject } = this.context;
     let { currentCluster, currentChart } = this.props;
     let { currentCluster, currentChart } = this.props;
 
 
     this.setState({ loading: true });
     this.setState({ loading: true });
-    api
+    return api
       .getChart(
       .getChart(
         "<token>",
         "<token>",
         {},
         {},
@@ -675,10 +675,12 @@ class ExpandedJobChart extends Component<PropsType, StateType> {
       chart: currentChart.name,
       chart: currentChart.name,
     });
     });
 
 
-    this.getChartData(currentChart, currentChart.version);
-    this.getJobs(currentChart);
-    this.setupJobWebsocket(currentChart);
-    this.setupCronJobWebsocket(currentChart);
+    this.getChartData(currentChart, currentChart.version).then(() => {
+      this.getJobs(currentChart).then(() => {
+        this.setupJobWebsocket(currentChart);
+        this.setupCronJobWebsocket(currentChart);
+      });
+    });
   }
   }
 
 
   componentDidUpdate(
   componentDidUpdate(