2
0
Alexander Belanger 5 жил өмнө
parent
commit
c4226925a4

+ 4 - 4
dashboard/src/main/home/dashboard/ClusterList.tsx

@@ -27,12 +27,12 @@ class Templates extends Component<PropsType, StateType> {
   };
 
   componentDidMount() {
-    this.updateClusterList()
+    this.updateClusterList();
   }
 
-  componentDidUpdate(prevProps : PropsType) {
+  componentDidUpdate(prevProps: PropsType) {
     if (prevProps.currentCluster?.name != this.props.currentCluster?.name) {
-      this.updateClusterList()
+      this.updateClusterList();
     }
   }
 
@@ -47,7 +47,7 @@ class Templates extends Component<PropsType, StateType> {
         }
       })
       .catch(err => this.setState(err));
-  }
+  };
 
   renderIcon = () => {
     return (

+ 1 - 1
dashboard/src/main/home/dashboard/ClusterPlaceholder.tsx

@@ -61,7 +61,7 @@ export default class ClusterPlaceholder extends Component<
         </>
       );
     } else {
-      return <ClusterList currentCluster={this.props.currentCluster}/>;
+      return <ClusterList currentCluster={this.props.currentCluster} />;
     }
   }
 }

+ 1 - 1
dashboard/src/main/home/provisioner/DOFormSection.tsx

@@ -134,7 +134,7 @@ export default class DOFormSection extends Component<PropsType, StateType> {
     selectedInfras.forEach((option: { value: string; label: string }) => {
       redirectUrl += `&infras=${option.value}`;
     });
-    redirectUrl += "&tab=provisioner"
+    redirectUrl += "&tab=provisioner";
     window.location.href = redirectUrl;
   };
 

+ 27 - 24
dashboard/src/main/home/provisioner/Provisioner.tsx

@@ -46,40 +46,44 @@ class Provisioner extends Component<PropsType, StateType> {
   };
 
   componentDidMount() {
-    this.updateInfras()
+    this.updateInfras();
   }
 
-  componentDidUpdate(prevProps : PropsType, prevState : StateType) {
-    // Check that an infra that was previously in a non-created state, and 
+  componentDidUpdate(prevProps: PropsType, prevState: StateType) {
+    // Check that an infra that was previously in a non-created state, and
     // which was a cluster, is now in a created state. If so, propagate update
-    // so that cluster can be refreshed. 
-    let prevInfraStates : Record<number, string> = {}
+    // so that cluster can be refreshed.
+    let prevInfraStates: Record<number, string> = {};
 
     prevState.infras.forEach((infra, i) => {
-      prevInfraStates[infra.id] = infra.status
-    })
+      prevInfraStates[infra.id] = infra.status;
+    });
 
     this.state.infras.forEach((infra, i) => {
-      if (prevInfraStates[infra.id] && infra.status == "created" && prevInfraStates[infra.id] != "created") {
+      if (
+        prevInfraStates[infra.id] &&
+        infra.status == "created" &&
+        prevInfraStates[infra.id] != "created"
+      ) {
         api
-        .getClusters("<token>", {}, { id: this.context.currentProject.id })
-        .then(res => {
-          this.context.setCurrentCluster(res.data[0])
-        })
-        .catch(err => {
-          this.context.setCurrentError(err)
-        });
+          .getClusters("<token>", {}, { id: this.context.currentProject.id })
+          .then(res => {
+            this.context.setCurrentCluster(res.data[0]);
+          })
+          .catch(err => {
+            this.context.setCurrentError(err);
+          });
       }
-    })
+    });
   }
 
   refresh = () => {
-    this.updateInfras()
-  }
+    this.updateInfras();
+  };
 
   updateInfras = () => {
     this.setState({
-      loading: true,
+      loading: true
     });
 
     let { currentProject } = this.state;
@@ -105,7 +109,7 @@ class Provisioner extends Component<PropsType, StateType> {
         });
       })
       .catch();
-  }
+  };
 
   render() {
     if (this.state.loading) {
@@ -138,9 +142,8 @@ class Provisioner extends Component<PropsType, StateType> {
 
     return (
       <StyledProvisioner>
-        You have not provisioned any resources for this project through Porter. <RefreshText
-          onClick={this.refresh}
-        >Refresh</RefreshText>
+        You have not provisioned any resources for this project through Porter.{" "}
+        <RefreshText onClick={this.refresh}>Refresh</RefreshText>
       </StyledProvisioner>
     );
   }
@@ -175,4 +178,4 @@ const RefreshText = styled.div`
   margin-left: 4px;
   color: #8590ff;
   cursor: pointer;
-`
+`;

+ 5 - 2
dashboard/src/main/home/provisioner/ProvisionerLogs.tsx

@@ -172,8 +172,11 @@ class ProvisionerLogs extends Component<PropsType, StateType> {
         }
       );
 
-      if (validEvents.length >= parseInt(validEvents[validEvents.length - 1]["total_resources"])) {
-        this.props.updateInfras()
+      if (
+        validEvents.length >=
+        parseInt(validEvents[validEvents.length - 1]["total_resources"])
+      ) {
+        this.props.updateInfras();
       }
     };