diff --git a/app-frontend/src/App.css b/app-frontend/src/App.css index 29ed0a2..5e6f91f 100644 --- a/app-frontend/src/App.css +++ b/app-frontend/src/App.css @@ -15,6 +15,10 @@ hr { user-select: none; } -.hide-on-demand{ +.hide-on-demand { display: none; +} + +.code-input { + font-family: Menlo, Monaco, "SFMono-Regular", Consolas, "Liberation Mono", Courier, monospace !important; } \ No newline at end of file diff --git a/app-frontend/src/containers/Apps/AppConfigs.tsx b/app-frontend/src/containers/Apps/AppConfigs.tsx index 2d33d07..4c499f4 100644 --- a/app-frontend/src/containers/Apps/AppConfigs.tsx +++ b/app-frontend/src/containers/Apps/AppConfigs.tsx @@ -26,24 +26,40 @@ export default class AppConfigs extends Component< forceEditableInstanceCount: false }; } + createEnvVarRows() { - /* -
-
-
- Key: - -
-
-
-
- Value: - -
-
-
- */ - return
createEnvVarRows
; + const self = this; + const envVars = this.props.apiData.appDefinition.envVars; + return Utils.map(envVars, function(value, index) { + return ( + + + { + const newApiData = Utils.copyObject(self.props.apiData); + newApiData.appDefinition.envVars[index].key = e.target.value; + }} + /> + + + { + const newApiData = Utils.copyObject(self.props.apiData); + newApiData.appDefinition.envVars[index].value = e.target.value; + }} + /> + + + ); + }); } createPortRows() { @@ -76,7 +92,7 @@ export default class AppConfigs extends Component< return
has volumes
; /* -

Persistent Directories   +

Persistent Directories   @@ -160,7 +176,6 @@ export default class AppConfigs extends Component< yet. -
{this.createEnvVarRows()} @@ -228,7 +243,7 @@ export default class AppConfigs extends Component< - + {/*
@@ -260,7 +275,15 @@ export default class AppConfigs extends Component< addPortMappingClicked() {} - addEnvVarClicked() {} + addEnvVarClicked() { + const newApiData = Utils.copyObject(this.props.apiData); + newApiData.appDefinition.envVars = newApiData.appDefinition.envVars || {}; + newApiData.appDefinition.envVars.push({ + key: "", + value: "" + }); + this.props.updateApiData(newApiData); + } reFetchData() { this.props.reFetchData(); diff --git a/app-frontend/src/utils/Utils.ts b/app-frontend/src/utils/Utils.ts index df09b87..8e42ca9 100644 --- a/app-frontend/src/utils/Utils.ts +++ b/app-frontend/src/utils/Utils.ts @@ -1,5 +1,16 @@ +import { number } from "prop-types"; + export default { copyObject(obj: T): T { return JSON.parse(JSON.stringify(obj)) as T; + }, + + map(array: T[], callback: (value: T, index: number) => any): any[] { + const rows: any[] = []; + for (let index = 0; index < array.length; index++) { + const element = array[index]; + rows.push(callback(element, index)); + } + return rows; } };