From 03c550d11b8fa573564d28c4b3a312c738318acd Mon Sep 17 00:00:00 2001 From: Madawa Soysa Date: Wed, 9 Oct 2019 16:41:51 +1100 Subject: [PATCH] Fix issue with reconfiguring policy The cause of the issue is not passing the newly introduced parameter 'policyType' in the policy edit payload. This parameter is marked @NotNull. Hence throwing an error. This fix sets the policyType parameter from the existing payload (Doesn't allow to edit as there is no UI interface to edit this parameter ATM Fixes: entgra/product-iots#175 --- .../app/units/cdmf.unit.policy.edit/public/js/policy-edit.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js index fd34ccc5a60..4f4fa7c88ed 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js @@ -148,6 +148,7 @@ $("#policy-name-input").focus(function () { skipStep["policy-platform"] = function (policyPayloadObj) { policy["name"] = policyPayloadObj["policyName"]; policy["platform"] = policyPayloadObj["profile"]["deviceType"]; + policy["policyType"] = policyPayloadObj["policyType"]; var userRoleInput = $("#user-roles-input"); var ownershipInput = $("#ownership-input"); @@ -488,6 +489,7 @@ var updatePolicy = function (policy, state) { var payload = { "policyName": policy["policyName"], "description": policy["description"], + "policyType": policy["policyType"], "compliance": policy["selectedNonCompliantAction"], "ownershipType": null, "profile": {