Prevent same policy ID bieng avaialble in selecting a corrective policy

feature/appm-store/pbac
Saad Sahibjan 5 years ago
parent 0c06863559
commit ec3f5afcb7

@ -276,7 +276,7 @@ stepForwardFrom["policy-type"] = function () {
var correctiveActionList = []; var correctiveActionList = [];
if (policy.type === "GENERAL") { if (policy.type === "GENERAL") {
var selectedCorrectivePolicyId = $("#corrective-policy-input").val(); var selectedCorrectivePolicyId = $("#corrective-policy-input").val();
if (selectedCorrectivePolicyId !== "none") { if (selectedCorrectivePolicyId && selectedCorrectivePolicyId !== "none") {
var correctiveAction = { var correctiveAction = {
"actionType": "POLICY", "actionType": "POLICY",
"policyId": selectedCorrectivePolicyId "policyId": selectedCorrectivePolicyId

@ -35,6 +35,7 @@
function onRequest(context) { function onRequest(context) {
var deviceType = request.getParameter("deviceType"); var deviceType = request.getParameter("deviceType");
var policyId = request.getParameter("id");
var utility = require("/app/modules/utility.js").utility; var utility = require("/app/modules/utility.js").utility;
var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"]; var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"];
@ -84,7 +85,18 @@ function onRequest(context) {
var enrollmentApps = policyModule.getStoreAppsForPolicy(); var enrollmentApps = policyModule.getStoreAppsForPolicy();
context["storeApps"] = JSON.stringify(enrollmentApps["content"]); context["storeApps"] = JSON.stringify(enrollmentApps["content"]);
context["correctivePolicies"] = JSON.stringify(policyModule.getAllPoliciesByType("CORRECTIVE")["content"]); var correctivePolicies = policyModule.getAllPoliciesByType("CORRECTIVE")["content"];
if (correctivePolicies) {
var i;
for (i = 0; i < correctivePolicies.length; i++) {
if (correctivePolicies[i].id.toString() === policyId) {
correctivePolicies.splice(i, 1);
break;
}
}
}
context["correctivePolicies"] = JSON.stringify(correctivePolicies);
return context; return context;
} }

@ -282,7 +282,7 @@ stepForwardFrom["policy-profile"] = function () {
} }
var policyType = currentlyEffected.policyType; var policyType = currentlyEffected.policyType;
$("input[name=policy-type-radio-btn][value=" + policyType + "]").prop("checked", true); $("input[name=policy-type-radio-btn][value=" + policyType + "]").prop("checked", true).trigger('change');
// add policy correction action page // add policy correction action page
if (!isCorrectiveActionProfileAdded) { if (!isCorrectiveActionProfileAdded) {
@ -336,7 +336,7 @@ stepForwardFrom["policy-type"] = function () {
var correctiveActionList = []; var correctiveActionList = [];
if (policy.type === "GENERAL") { if (policy.type === "GENERAL") {
var selectedCorrectivePolicyId = $("#corrective-policy-input").val(); var selectedCorrectivePolicyId = $("#corrective-policy-input").val();
if (selectedCorrectivePolicyId !== "none") { if (selectedCorrectivePolicyId && selectedCorrectivePolicyId !== "none") {
var correctiveAction = { var correctiveAction = {
"actionType": "POLICY", "actionType": "POLICY",
"policyId": selectedCorrectivePolicyId "policyId": selectedCorrectivePolicyId

Loading…
Cancel
Save