Explorar o código

fix service validation error (#4335)

Feroze Mohideen %!s(int64=2) %!d(string=hai) anos
pai
achega
0f5f5a332c

+ 3 - 1
dashboard/src/main/home/app-dashboard/create-app/CreateApp.tsx

@@ -409,6 +409,8 @@ const CreateApp: React.FC<CreateAppProps> = ({ history }) => {
     // TODO: create a more unified way of parsing form/apply errors, unified with the logic in AppDataContainer
     const errorKeys = Object.keys(errors);
     if (errorKeys.length > 0) {
+      const stringifiedJson = JSON.stringify(errors);
+
       let errorMessage = "App could not be deployed as defined.";
       if (errorKeys.includes("app")) {
         const appErrors = Object.keys(errors.app ?? {});
@@ -431,7 +433,7 @@ const CreateApp: React.FC<CreateAppProps> = ({ history }) => {
 
       void updateAppStep({
         step: "stack-launch-failure",
-        errorMessage: `Form validation error: ${errorMessage}`,
+        errorMessage: `Form validation error (visible to user): ${errorMessage}. Stringified JSON errors (invisible to user): ${stringifiedJson}`,
         appName: name.value,
       });
 

+ 5 - 12
dashboard/src/shared/ClusterResourcesContext.tsx

@@ -41,7 +41,7 @@ const ClusterResourcesProvider = ({
 }): JSX.Element => {
   const { currentCluster, currentProject } = useContext(Context);
 
-  var {
+  const {
     maxCPU,
     maxRAM,
     defaultCPU,
@@ -56,21 +56,14 @@ const ClusterResourcesProvider = ({
     clusterStatus: currentCluster?.status,
   });
 
-  if (currentProject?.sandbox_enabled) {
-    defaultCPU = 0.1
-    defaultRAM = 120
-    maxRAM = 250
-    maxCPU = 0.2
-  }
-
   return (
     <ClusterResourcesContext.Provider
       value={{
         currentClusterResources: {
-          maxCPU,
-          maxRAM,
-          defaultCPU,
-          defaultRAM,
+          maxCPU: currentProject?.sandbox_enabled ? 0.2 : maxCPU,
+          maxRAM: currentProject?.sandbox_enabled ? 250 : maxRAM,
+          defaultCPU: currentProject?.sandbox_enabled ? 0.1 : defaultCPU,
+          defaultRAM: currentProject?.sandbox_enabled ? 120 : defaultRAM,
           maxGPU,
           clusterContainsGPUNodes,
           clusterIngressIp,