From c709629abdc91c06748a60c9ef27469df7aa9f16 Mon Sep 17 00:00:00 2001 From: Kasra Bigdeli Date: Sat, 22 Dec 2018 09:57:19 -0800 Subject: [PATCH] volume rows done --- app-frontend/src/App.css | 2 +- .../src/containers/Apps/AppConfigs.tsx | 175 +++++++++++++----- 2 files changed, 134 insertions(+), 43 deletions(-) diff --git a/app-frontend/src/App.css b/app-frontend/src/App.css index 5e6f91f..1a6b736 100644 --- a/app-frontend/src/App.css +++ b/app-frontend/src/App.css @@ -16,7 +16,7 @@ hr { } .hide-on-demand { - display: none; + display: none !important; } .code-input { diff --git a/app-frontend/src/containers/Apps/AppConfigs.tsx b/app-frontend/src/containers/Apps/AppConfigs.tsx index 1e8af37..2c06e90 100644 --- a/app-frontend/src/containers/Apps/AppConfigs.tsx +++ b/app-frontend/src/containers/Apps/AppConfigs.tsx @@ -32,16 +32,17 @@ export default class AppConfigs extends Component< 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; + self.props.updateApiData(newApiData); }} /> @@ -50,10 +51,11 @@ export default class AppConfigs extends Component< className="code-input" placeholder="value" rows={1} - defaultValue={value.value} + value={value.value} onChange={e => { const newApiData = Utils.copyObject(self.props.apiData); newApiData.appDefinition.envVars[index].value = e.target.value; + self.props.updateApiData(newApiData); }} /> @@ -67,19 +69,20 @@ export default class AppConfigs extends Component< const ports = this.props.apiData.appDefinition.ports; return Utils.map(ports, function(value, index) { return ( - + { const newApiData = Utils.copyObject(self.props.apiData); const p = Number(e.target.value.trim()); newApiData.appDefinition.ports[index].hostPort = p > 0 ? p : 0; // to avoid NaN + self.props.updateApiData(newApiData); }} /> @@ -88,12 +91,13 @@ export default class AppConfigs extends Component< { const newApiData = Utils.copyObject(self.props.apiData); const p = Number(e.target.value.trim()); newApiData.appDefinition.ports[index].containerPort = p > 0 ? p : 0; // to avoid NaN + self.props.updateApiData(newApiData); }} /> @@ -102,49 +106,126 @@ export default class AppConfigs extends Component< }); } + createVolRows() { + const self = this; + const volumes = this.props.apiData.appDefinition.volumes; + return Utils.map(volumes, function(value, index) { + return ( + + + { + const newApiData = Utils.copyObject(self.props.apiData); + newApiData.appDefinition.volumes[index].containerPath = + e.target.value; + self.props.updateApiData(newApiData); + }} + /> + + + { + const newApiData = Utils.copyObject(self.props.apiData); + newApiData.appDefinition.volumes[index].volumeName = + e.target.value; + self.props.updateApiData(newApiData); + }} + /> + + + + + { + const newApiData = Utils.copyObject(self.props.apiData); + newApiData.appDefinition.volumes[index].hostPath = + e.target.value; + self.props.updateApiData(newApiData); + }} + /> + + + + + + + ); + }); + } + createVolSection() { const app = this.props.apiData!.appDefinition; if (!app.hasPersistentData) return
; - return
has volumes
; + return ( +
+

+ Persistent Directories   + + + +

+
+ Currently, this app does not have any persistent directories. +
+ + {this.createVolRows()} +
+ +
+
+
+
+
+ ); /* -

Persistent Directories   - - - - - -

-
- Currently, this app does not have any persistent directories. -
-
-
-
-
- Path in App: - -
-
-
-
- Path on Host: - -
-
-
-
- Label: - -
-
-
- - -
-
@@ -314,6 +395,16 @@ export default class AppConfigs extends Component< this.props.updateApiData(newApiData); } + addVolumeClicked() { + const newApiData = Utils.copyObject(this.props.apiData); + newApiData.appDefinition.volumes = newApiData.appDefinition.volumes || {}; + newApiData.appDefinition.volumes.push({ + containerPath: "", + volumeName: "" + }); + this.props.updateApiData(newApiData); + } + reFetchData() { this.props.reFetchData(); }