Browse Source

Use build env attribute instead of normal

jnfrati 4 years ago
parent
commit
f975fd0746

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

@@ -31,7 +31,7 @@ const KeyValueArray: React.FC<Props> = (props) => {
       initState: () => {
         let values = props.value[0];
         const normalValues = Object.entries(values?.normal || {});
-        values = omit(values, ["normal", "synced"]);
+        values = omit(values, ["normal", "synced", "build"]);
         return {
           values: hasSetValue(props)
             ? ([...Object.entries(values), ...normalValues]?.map(([k, v]) => {

+ 2 - 3
dashboard/src/main/home/cluster-dashboard/expanded-chart/BuildSettingsTab.tsx

@@ -61,7 +61,7 @@ const BuildSettingsTab: React.FC<Props> = ({ chart }) => {
 
   const [buildConfig, setBuildConfig] = useState<BuildConfig>(null);
   const [envVariables, setEnvVariables] = useState(
-    chart.config?.container?.env?.normal || null
+    chart.config?.container?.env?.build || null
   );
   const [buttonStatus, setButtonStatus] = useState<
     "loading" | "successful" | string
@@ -98,7 +98,7 @@ const BuildSettingsTab: React.FC<Props> = ({ chart }) => {
       return;
     }
 
-    values.container.env.normal = envs;
+    values.container.env.build = { ...envs };
     const valuesYaml = yaml.dump({ ...values });
     try {
       await api.upgradeChartValues(
@@ -184,7 +184,6 @@ const BuildSettingsTab: React.FC<Props> = ({ chart }) => {
             clusterId: currentCluster.id,
           }}
           setValues={(values) => {
-            console.log(values);
             setEnvVariables(values);
           }}
         ></KeyValueArray>

+ 3 - 0
dashboard/src/shared/types.tsx

@@ -73,6 +73,9 @@ export interface ChartTypeWithExtendedConfig extends ChartType {
         normal: {
           [key: string]: string;
         };
+        build: {
+          [key: string]: string;
+        };
         synced: any;
       };
       lifecycle: { postStart: string; preStop: string };