Browse Source

status error handling for destroyed and created

Alexander Belanger 4 years ago
parent
commit
3667c4591a

+ 4 - 2
dashboard/src/components/ProvisionerStatus.tsx

@@ -77,7 +77,7 @@ const ProvisionerStatus: React.FC<Props> = (props) => {
         return resource.errored?.errored_out
       }).length > 0
 
-      const width = 100 * (provisionedResources / (totalResources * 1.0))
+      const width = 100 * (provisionedResources / (totalResources * 1.0)) || 100
 
       var error = null
 
@@ -85,12 +85,14 @@ const ProvisionerStatus: React.FC<Props> = (props) => {
         error = errors.map((error) => {
           return <ExpandedError>{error}</ExpandedError>
         })
+      } else if (val.status == "destroyed") {
+        error = <ExpandedError>This infrastructure was destroyed.</ExpandedError>
       }
 
       var loadingFill 
       var status 
 
-      if (hasError) {
+      if (hasError || val.status == "destroyed") {
         loadingFill = <LoadingFill status="error" width={width + "%"} />
         status = renderStatus("error")
       } else if (width == 100) {

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

@@ -107,7 +107,7 @@ class Dashboard extends Component<PropsType, StateType> {
   renderTabContents = () => {
     if (this.currentTab() === "provisioner") {
       return <SharedStatus 
-        filter={["doks", "docr", "eks", "ecr", "gke", "gcr"]} 
+        filter={[]} 
         project_id={this.props.projectId} 
         nextFormStep={() => null} 
       />

+ 4 - 1
dashboard/src/main/home/onboarding/steps/ProvisionResources/forms/SharedStatus.tsx

@@ -50,7 +50,10 @@ export const SharedStatus: React.FC<{
         var matchedInfras : Map<string, any> = new Map()
   
         res.data.forEach((infra : any) => {
-          if (filter.includes(infra.kind) && matchedInfras.get(infra.Kind)?.id || 0 < infra.id) {
+          // if filter list is empty, add infra automatically
+          if (filter.length == 0) {
+            matchedInfras.set(infra.kind, infra)
+          } else if (filter.includes(infra.kind) && matchedInfras.get(infra.Kind)?.id || 0 < infra.id) {
             matchedInfras.set(infra.kind, infra)
           }
         })