Bug 341 - input-parameter-xpath complains errors 71/2171/1
authorLaurence Maultsby <laurence.maultsby@riftio.com>
Thu, 14 Sep 2017 16:50:58 +0000 (12:50 -0400)
committerLaurence Maultsby <laurence.maultsby@riftio.com>
Thu, 14 Sep 2017 16:50:58 +0000 (12:50 -0400)
Signed-off-by: Laurence Maultsby <laurence.maultsby@riftio.com>
skyquake/plugins/launchpad/src/instantiate/instantiateInputParams.jsx
skyquake/plugins/launchpad/src/instantiate/instantiateStore.js

index 5ffb4bc..6561649 100644 (file)
@@ -106,16 +106,23 @@ export default class InstantiateInputParams extends Component {
   inputParametersHTML = (props) => {
     let inputParameters = props.inputParameters;
     const handleChange = (i, event) => props.updateInputParam(i, event.target.value);
-    return inputParameters && inputParameters.map(function(input, i) {
-        return (
-                <div className="configure-nsd_section" key={i}>
-                  <h3 className="launchpadCard_title">Input Parameters</h3>
-                  <div className="inputControls">
-                      <TextInput label={ input.label || input.xpath } type="text" onChange={handleChange.bind(this, i)} />
-                  </div>
-                </div>
-        )
-      })
+    let nsInputParamsHTML = [];
+    inputParameters && inputParameters.map(function(input, i) {
+        nsInputParamsHTML.push(
+          <div className="inputControls" key={i}>
+            <TextInput label={ input.label || input.xpath }  value={input.value || input['default-value']} type="text" onChange={handleChange.bind(this, i)} />
+          </div>
+        );
+     });
+    var nsinput = (
+      <div className="configure-nsd_section" >
+        <h3 className="launchpadCard_title">NS Input Parameters</h3>
+        {
+          nsInputParamsHTML
+        }
+     </div>
+    );
+    return nsinput;
   }
   nsPlacementGroupsHTML = (props) => {
     let nsPlacementGroups = props.nsPlacementGroups;
index dcf6e9e..dacf316 100644 (file)
@@ -255,9 +255,13 @@ class LaunchNetworkServiceStore {
             ipProfiles: NSD['ip-profiles']
         };
         newState.selectedNSD = data;
+        newState['input-parameters'] = [];
         if (NSD['input-parameter-xpath']) {
             newState.hasConfigureNSD = true;
-            newState['input-parameters'] = NSD['input-parameter-xpath'];
+            NSD['input-parameter-xpath'].map(function(p) {
+                newState.hasConfigureNSD = true;
+                newState['input-parameters'].push(_cloneDeep(p));
+            })
         } else {
             newState.hasConfigureNSD = false;
             newState['input-parameters'] = null;
@@ -720,12 +724,16 @@ class LaunchNetworkServiceStore {
             }
             payload["cloud-account"] = this.state.selectedCloudAccount.name;
         }
+        //Clean Input Parameters
         if (this.state.hasConfigureNSD) {
-            let ips = this.state['input-parameters'];
+            let ips = _cloneDeep(this.state['input-parameters']);
+
             let ipsToSend = ips.filter(function(ip) {
                 if (ip.value && ip.value != "") {
-                    ip.uuid = GUID();
+                    delete ip.label;
                     delete ip.name;
+                    delete ip['default-value'];
+
                     return true;
                 }
                 return false;