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 = [];
if (policy.type === "GENERAL") {
var selectedCorrectivePolicyId = $("#corrective-policy-input").val();
if (selectedCorrectivePolicyId !== "none") {
if (selectedCorrectivePolicyId && selectedCorrectivePolicyId !== "none") {
var correctiveAction = {
"actionType": "POLICY",
"policyId": selectedCorrectivePolicyId

@ -35,6 +35,7 @@
function onRequest(context) {
var deviceType = request.getParameter("deviceType");
var policyId = request.getParameter("id");
var utility = require("/app/modules/utility.js").utility;
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"];
@ -84,7 +85,18 @@ function onRequest(context) {
var enrollmentApps = policyModule.getStoreAppsForPolicy();
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;
}

@ -282,7 +282,7 @@ stepForwardFrom["policy-profile"] = function () {
}
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
if (!isCorrectiveActionProfileAdded) {
@ -336,7 +336,7 @@ stepForwardFrom["policy-type"] = function () {
var correctiveActionList = [];
if (policy.type === "GENERAL") {
var selectedCorrectivePolicyId = $("#corrective-policy-input").val();
if (selectedCorrectivePolicyId !== "none") {
if (selectedCorrectivePolicyId && selectedCorrectivePolicyId !== "none") {
var correctiveAction = {
"actionType": "POLICY",
"policyId": selectedCorrectivePolicyId

Loading…
Cancel
Save