Explorar o código

fix duplicate error handling

Alexander Belanger %!s(int64=4) %!d(string=hai) anos
pai
achega
348edfe8a5

+ 10 - 1
dashboard/src/components/ProvisionerStatus.tsx

@@ -98,11 +98,20 @@ const ProvisionerStatus: React.FC<Props> = ({ modules }) => {
 
       if (val.global_errors) {
         for (let globalErr of val.global_errors) {
-          errors.push("Global error: " + globalErr.error_context);
+          errors.push(globalErr.error_context);
           hasError = true;
         }
       }
 
+      // remove duplicate errors
+      errors = errors.filter(
+        (error, index, self) =>
+          index ===
+          self.findIndex(
+            (e) => e === error || e.includes(error) || error.includes(e)
+          )
+      );
+
       const width =
         val.status == "created"
           ? 100

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

@@ -82,12 +82,6 @@ export const SharedStatus: React.FC<{
       ...globalErrors,
     ];
 
-    // remove duplicate global errors
-    tfModules[index].global_errors = tfModules[index].global_errors.filter(
-      (error, index, self) =>
-        index === self.findIndex((e) => e.error_context === error.error_context)
-    );
-
     setTFModules([...tfModules]);
   };
 
@@ -111,6 +105,7 @@ export const SharedStatus: React.FC<{
       ) {
         setInfraStatus({
           hasError: true,
+          description: "Encountered error while provisioning",
         });
         return;
       }