Przeglądaj źródła

Get tags on view change to keep the latest version

jnfrati 4 lat temu
rodzic
commit
717597959b

+ 15 - 7
dashboard/src/main/home/cluster-dashboard/ClusterDashboard.tsx

@@ -79,6 +79,18 @@ class ClusterDashboard extends Component<PropsType, StateType> {
     selectedTag: "none",
   };
 
+  getTags() {
+    const { currentProject } = this.context;
+
+    api
+      .getTagsByProjectId("<token>", {}, { project_id: currentProject.id })
+      .then((res) => {
+        const tags = res.data;
+
+        this.setState({ tags });
+      });
+  }
+
   componentDidMount() {
     let { currentCluster, currentProject } = this.context;
     let params = this.props.match.params as any;
@@ -103,13 +115,7 @@ class ClusterDashboard extends Component<PropsType, StateType> {
         this.setState({ isMetricsInstalled: false });
       });
 
-    api
-      .getTagsByProjectId("<token>", {}, { project_id: currentProject.id })
-      .then((res) => {
-        const tags = res.data;
-
-        this.setState({ tags });
-      });
+    this.getTags();
   }
 
   componentDidUpdate(prevProps: PropsType) {
@@ -144,6 +150,8 @@ class ClusterDashboard extends Component<PropsType, StateType> {
               this.state.namespace === null ? "default" : this.state.namespace,
           })
       );
+
+      this.getTags();
     }
   }