Merge branch 'corrective-policy' into 'application-mgt-new'

Message to display in view when a selected corrective policy is changed to general or deleted

See merge request entgra/carbon-device-mgt!338
feature/appm-store/pbac
Dharmakeerthi Lasantha 5 years ago
commit 3c11838c14

@ -73,7 +73,17 @@ var displayPolicy = function (policyPayloadObj) {
policyPayloadObj.correctiveActions && policyPayloadObj.correctiveActions.length > 0) { policyPayloadObj.correctiveActions && policyPayloadObj.correctiveActions.length > 0) {
policyPayloadObj.correctiveActions.forEach(function (correctiveAction) { policyPayloadObj.correctiveActions.forEach(function (correctiveAction) {
if ("POLICY" === correctiveAction.actionType) { if ("POLICY" === correctiveAction.actionType) {
$("#corrective-action-type-policy-id").html(correctiveAction.policyId); $("#corrective-action-type-policy-id").html(correctiveAction.policyId);
var correctivePolicies = $("#logged-in-user").data("corrective-policies");
if (correctivePolicies) {
var i;
for (i = 0; i < correctivePolicies.length; i++) {
if (correctiveAction.policyId === correctivePolicies[i].id) {
$("#corrective-action-policy-id-missing-msg").addClass("hidden");
break;
}
}
}
return true; return true;
} }
}); });

@ -1,7 +1,8 @@
{{#zone "content"}} {{#zone "content"}}
{{#if isAuthorized}} {{#if isAuthorized}}
<span id="logged-in-user" class="hidden" data-username="{{@user.username}}" data-domain="{{@user.domain}}" <span id="logged-in-user" class="hidden" data-username="{{@user.username}}" data-domain="{{@user.domain}}"
data-tenant-id="{{@user.tenantId}}" data-iscloud="{{isCloud}}"></span> data-tenant-id="{{@user.tenantId}}" data-iscloud="{{isCloud}}"
data-corrective-policies="{{correctivePolicies}}"></span>
{{#defineZone "policy-profile-top"}} {{#defineZone "policy-profile-top"}}
<div class="row wr-device-board"> <div class="row wr-device-board">
<div class="col-lg-12 wr-secondary-bar"> <div class="col-lg-12 wr-secondary-bar">
@ -67,6 +68,16 @@
<td class="sorting_1" style="padding:10px 15px; width: 14%;">Policy ID</td> <td class="sorting_1" style="padding:10px 15px; width: 14%;">Policy ID</td>
<td id="corrective-action-type-policy-id" style="padding:10px 15px;"></td> <td id="corrective-action-type-policy-id" style="padding:10px 15px;"></td>
</tr> </tr>
<tr id="corrective-action-policy-id-missing-msg">
<td class="alert alert-danger" colspan="4" style="padding:10px 15px;">
<strong>
<i class="icon fw fw-error"></i>
Corrective policy having the above Policy ID has been updated to
a GENERAL policy or it has been deleted. Hence this policy will
not be applied till modified correctly.
</strong>
</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>

@ -18,6 +18,8 @@
function onRequest(context) { function onRequest(context) {
var utility = require("/app/modules/utility.js").utility; var utility = require("/app/modules/utility.js").utility;
var policyModule = require("/app/modules/business-controllers/policy.js")["policyModule"];
var page = {}; var page = {};
var deviceType = request.getParameter("deviceType"); var deviceType = request.getParameter("deviceType");
var policyViewSrc = "/app/units/" + utility.getTenantedDeviceUnitName(deviceType, "policy-view"); var policyViewSrc = "/app/units/" + utility.getTenantedDeviceUnitName(deviceType, "policy-view");
@ -43,5 +45,7 @@ function onRequest(context) {
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
page["isCloud"] = devicemgtProps.isCloud; page["isCloud"] = devicemgtProps.isCloud;
page["correctivePolicies"] = JSON.stringify(policyModule.getAllPoliciesByType("CORRECTIVE")["content"]);
return page; return page;
} }
Loading…
Cancel
Save