Fix wrong PDP operations send by UI 69/120769/1
authorsebdet <sebastien.determe@intl.att.com>
Wed, 21 Apr 2021 12:57:57 +0000 (14:57 +0200)
committersebdet <sebastien.determe@intl.att.com>
Wed, 21 Apr 2021 12:57:57 +0000 (14:57 +0200)
The code that was computing the operations to execute was wrong. THe command POST was missing

Issue-ID: POLICY-3225
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: I0de307e782bf99ed3cb4274c587c9c71955bab74

ui-react/src/components/dialogs/Policy/PolicyDeploymentEditor.js

index a2422e2..48d02e3 100644 (file)
@@ -77,8 +77,12 @@ export default class PolicyDeploymentEditor extends React.Component {
             let newStateFound = newStates.find(newElement => newElement.name === initElem.name);
             if (initElem.value !== newStateFound.value) {
                 let newPdpGroupsArray = newStateFound.name.split("/");
-                commandsArray.push("DELETE/"+newPdpGroupsArray[0] + "/"+newPdpGroupsArray[1] + "/"+this.state.policyData.name
-                + "/" + this.state.policyData.version);
+                let operation = "POST/";
+                if (initElem.value) {
+                    operation = "DELETE/";
+                }
+                commandsArray.push(operation + newPdpGroupsArray[0] + "/"+newPdpGroupsArray[1] + "/"
+                    +this.state.policyData.name + "/" + this.state.policyData.version);
             }
         });
         return commandsArray.length > 0 ? {"PdpActions":commandsArray} : undefined;