jusrhee пре 4 година
родитељ
комит
af27120a28
1 измењених фајлова са 4 додато и 9 уклоњено
  1. 4 9
      dashboard/src/components/porter-form/field-components/KeyValueArray.tsx

+ 4 - 9
dashboard/src/components/porter-form/field-components/KeyValueArray.tsx

@@ -132,9 +132,9 @@ const KeyValueArray: React.FC<Props> = (props) => {
     }
     }
   };
   };
 
 
-  const getProcessedValues = (): any => {
+  const getProcessedValues = (objectArray: { key: string, value: string }[]): any => {
     let obj = {} as any;
     let obj = {} as any;
-    state.values?.forEach(({ key, value }) => {
+    objectArray?.forEach(({ key, value }) => {
       obj[key] = value;
       obj[key] = value;
     });
     });
     return obj;
     return obj;
@@ -153,7 +153,7 @@ const KeyValueArray: React.FC<Props> = (props) => {
           height="542px"
           height="542px"
         >
         >
           <LoadEnvGroupModal
           <LoadEnvGroupModal
-            existingValues={getProcessedValues()}
+            existingValues={getProcessedValues(state.values)}
             namespace={variables.namespace}
             namespace={variables.namespace}
             clusterId={variables.clusterId}
             clusterId={variables.clusterId}
             closeModal={() =>
             closeModal={() =>
@@ -350,12 +350,7 @@ export const getFinalVariablesForKeyValueArray: GetFinalVariablesFunction = (
 ) => {
 ) => {
   if (!state) {
   if (!state) {
     return {
     return {
-      [props.variable]:
-        props.value && props.value[0]
-          ? (Object.entries(props.value[0])?.map(([k, v]) => {
-              return { key: k, value: v };
-            }) as any[])
-          : [],
+      [props.variable]: props.value ? props.value[0] : [],
     };
     };
   }
   }