From fb4b25f6827accf6f975f9ca9a7aaee08d335c2f Mon Sep 17 00:00:00 2001 From: xuegao Date: Wed, 11 Mar 2020 11:22:15 +0100 Subject: Add remove op policy option Update the UI and backend code to be able to remove op policy for loop instances. Issue-ID: CLAMP-648 Change-Id: Ib3eab4977fe4f1b85e11f2373263197009bbc3e1 Signed-off-by: xuegao --- ui-react/src/api/LoopService.js | 67 +++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 22 deletions(-) (limited to 'ui-react/src/api') diff --git a/ui-react/src/api/LoopService.js b/ui-react/src/api/LoopService.js index d665f814..2750763d 100644 --- a/ui-react/src/api/LoopService.js +++ b/ui-react/src/api/LoopService.js @@ -194,26 +194,49 @@ export default class LoopService { }); } - static addOperationalPolicyType(loopName, policyType, policyVersion) { - return fetch('/restservices/clds/v2/loop/addOperationaPolicy/' + loopName + '/policyModel/' + policyType +'/' + policyVersion , { - method: 'PUT', - headers: { - "Content-Type": "application/json" - }, - credentials: 'same-origin' - }) - .then(function (response) { - console.debug("Add Operational Policy response received: ", response.status); - if (response.ok) { - return response.json(); - } else { - console.error("Add Operational Policy query failed"); - return {}; - } - }) - .catch(function (error) { - console.error("Add Operational Policy error received", error); - return {}; - }); - } + static addOperationalPolicyType(loopName, policyType, policyVersion) { + return fetch('/restservices/clds/v2/loop/addOperationaPolicy/' + loopName + '/policyModel/' + policyType +'/' + policyVersion , { + method: 'PUT', + headers: { + "Content-Type": "application/json" + }, + credentials: 'same-origin' + }) + .then(function (response) { + console.debug("Add Operational Policy response received: ", response.status); + if (response.ok) { + return response.json(); + } else { + console.error("Add Operational Policy query failed"); + return {}; + } + }) + .catch(function (error) { + console.error("Add Operational Policy error received", error); + return {}; + }); + } + + static removeOperationalPolicyType(loopName, policyType, policyVersion) { + return fetch('/restservices/clds/v2/loop/removeOperationaPolicy/' + loopName + '/policyModel/' + policyType +'/' + policyVersion , { + method: 'PUT', + headers: { + "Content-Type": "application/json" + }, + credentials: 'same-origin' + }) + .then(function (response) { + console.debug("Remove Operational Policy response received: ", response.status); + if (response.ok) { + return response.json(); + } else { + console.error("Remove Operational Policy query failed"); + return {}; + } + }) + .catch(function (error) { + console.error("Remove Operational Policy error received", error); + return {}; + }); + } } -- cgit 1.2.3-korg