Prechádzať zdrojové kódy

hotfix for when docker template does not have custom annotations

sunguroku 5 rokov pred
rodič
commit
50f71e0c79

+ 8 - 4
dashboard/src/main/home/cluster-dashboard/expanded-chart/ExpandedChart.tsx

@@ -227,11 +227,15 @@ export default class ExpandedChart extends Component<PropsType, StateType> {
     for (let key in rawValues) {
       if (key === "ingress.annotations") {
         let annotations = {} as Record<string, any>;
-        rawValues[key].forEach((v: string) => {
-          let splits = v.split(":");
-          annotations[splits[0].trim()] = splits[1].trim();
-        });
 
+        if (Array.isArray(rawValues[key])) {
+          rawValues[key].forEach((v: string) => {
+            let splits = v.split(":");
+            annotations[splits[0].trim()] = splits[1].trim();
+          });
+        }
+
+        annotations["porter"] = "true";
         _.set(values, key, annotations);
       } else {
         _.set(values, key, rawValues[key]);

+ 8 - 6
dashboard/src/main/home/templates/expanded-template/LaunchTemplate.tsx

@@ -163,12 +163,14 @@ export default class LaunchTemplate extends Component<PropsType, StateType> {
     for (let key in rawValues) {
       if (key === "ingress.annotations") {
         let annotations = {} as Record<string, any>;
-        rawValues[key].forEach((v: string) => {
-          let splits = v.split(":");
-          annotations[splits[0].trim()] = splits[1].trim();
-        });
-
-        _.set(values, key, annotations);
+        if (Array.isArray(rawValues[key])) {
+          rawValues[key].forEach((v: string) => {
+            let splits = v.split(":");
+            annotations[splits[0].trim()] = splits[1].trim();
+          });
+        }
+        annotations["porter"] = "true";
+        _.set(values, key, annotations);  
       } else {
         _.set(values, key, rawValues[key]);
       }