Bug 341 - input-parameter-xpath complains errors
authorLaurence Maultsby <laurence.maultsby@riftio.com>
Thu, 14 Sep 2017 16:50:58 +0000 (12:50 -0400)
committerkashalkar <kiran.kashalkar@riftio.com>
Thu, 14 Sep 2017 17:17:55 +0000 (19:17 +0200)
Signed-off-by: Laurence Maultsby <laurence.maultsby@riftio.com>
(cherry picked from commit ab68734c52fb6d413e8241466c4517bd7af2477f)

Change-Id: Ie6cdb6a976ad94f3512f3b3f57c0f8e2086ad74d

skyquake/plugins/launchpad/src/instantiate/instantiateInputParams.jsx
skyquake/plugins/launchpad/src/instantiate/instantiateStore.js

index 6273d8c..9d7b7eb 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 0d9e1b6..59fb003 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;
@@ -716,12 +720,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;