فهرست منبع

(wip) testing do status page

Alexander Belanger 4 سال پیش
والد
کامیت
9dd4d076ef

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

@@ -24,6 +24,8 @@ export interface TFResource {
 const nameMap : { [key: string]: string } = {
 const nameMap : { [key: string]: string } = {
   "eks": "Elastic Kubernetes Service (EKS)",
   "eks": "Elastic Kubernetes Service (EKS)",
   "ecr": "Elastic Container Registry (ECR)",
   "ecr": "Elastic Container Registry (ECR)",
+  "doks": "DigitalOcean Kubernetes Service (DOKS)",
+  "docr": "DigitalOcean Container Registry (DOCR)",
 }
 }
 
 
 const ProvisionerStatus: React.FC<Props> = (props) => {
 const ProvisionerStatus: React.FC<Props> = (props) => {

+ 1 - 1
dashboard/src/main/home/onboarding/steps/ProvisionResources/ProvisionResourcesWrapper.tsx

@@ -4,7 +4,7 @@ import { OFState } from "../../state";
 import ProvisionResources from "./ProvisionResources";
 import ProvisionResources from "./ProvisionResources";
 
 
 const ProvisionResourcesWrapper = () => {
 const ProvisionResourcesWrapper = () => {
-  const snap = useSnapshot(OFState);
+  const snap = useSnapshot(OFState);  
   return (
   return (
     <ProvisionResources
     <ProvisionResources
       shouldProvisionRegistry={snap.StateHandler.connected_registry?.skip}
       shouldProvisionRegistry={snap.StateHandler.connected_registry?.skip}

+ 10 - 6
dashboard/src/main/home/onboarding/steps/ProvisionResources/forms/_DOProvisionerForm.tsx

@@ -248,23 +248,25 @@ export const Status: React.FC<{
     const filter : string[] = ["doks", "docr"]
     const filter : string[] = ["doks", "docr"]
 
 
     api.getInfra("<token>", {}, { project_id: project?.id }).then((res) => {
     api.getInfra("<token>", {}, { project_id: project?.id }).then((res) => {
-      var matchedInfras : Map<string, any>
+      var matchedInfras : Map<string, any> = new Map()
 
 
       res.data.forEach((infra : any) => {
       res.data.forEach((infra : any) => {
-        if (filter.includes(infra.kind) && matchedInfras.get(infra.Kind)?.id < infra.id) {
-          matchedInfras.set(infra.Kind, infra)
+        if (filter.includes(infra.kind) && matchedInfras.get(infra.Kind)?.id || 0 < infra.id) {
+          matchedInfras.set(infra.kind, infra)
         }
         }
       })
       })
 
 
+      var modules : TFModule[] = []
+
       // query for desired and current state, and convert to tf module
       // query for desired and current state, and convert to tf module
-      matchedInfras.forEach((kind, infra : any) => {
+      matchedInfras.forEach((infra : any) => {
         api.getInfraDesired("<token>", {}, { project_id: project?.id, infra_id: infra?.id }).then((resDesired) => {
         api.getInfraDesired("<token>", {}, { project_id: project?.id, infra_id: infra?.id }).then((resDesired) => {
           api.getInfraCurrent("<token>", {}, { project_id: project?.id, infra_id: infra?.id }).then((resCurrent) => {
           api.getInfraCurrent("<token>", {}, { project_id: project?.id, infra_id: infra?.id }).then((resCurrent) => {
             var desired = resDesired.data
             var desired = resDesired.data
             var current = resCurrent.data
             var current = resCurrent.data
 
 
             // convert current state to a lookup table
             // convert current state to a lookup table
-            var currentMap : Map<string, string>
+            var currentMap : Map<string, string> = new Map()
 
 
             current?.resources?.forEach((val : any) => {
             current?.resources?.forEach((val : any) => {
               currentMap.set(val?.type + "." + val?.name, "")
               currentMap.set(val?.type + "." + val?.name, "")
@@ -286,10 +288,12 @@ export const Status: React.FC<{
               resources: resources,
               resources: resources,
             }
             }
 
 
-            setTFModules([...tfModules, module])
+            modules.push(module)
           })
           })
         })
         })
       });
       });
+
+      setTFModules(modules)
     })
     })
   }, [])
   }, [])