Add policy type and corrective action UI for view policy

merge-requests/328/head
Saad Sahibjan 5 years ago
parent fc916d4e4c
commit e3905e793d

@ -28,6 +28,7 @@ var displayPolicy = function (policyPayloadObj) {
$("#policy-assignment").text(policyPayloadObj.deviceGroups);
$("#policy-action").text(policyPayloadObj.compliance.toUpperCase());
$("#policy-description").text(policyPayloadObj["description"]);
$("#policy-type").text(policyPayloadObj.policyType);
var policyStatus = "Active";
if (policyPayloadObj["active"] === true && policyPayloadObj["updated"] === true) {
policyStatus = '<i class="fw fw-warning icon-success"></i> Active/Updated</span>';
@ -68,6 +69,20 @@ var displayPolicy = function (policyPayloadObj) {
$("#policy-roles").text(policyPayloadObj.roles.toString().split(",").join(", "));
}
if ("GENERAL" === policyPayloadObj.policyType &&
policyPayloadObj.correctiveActions && policyPayloadObj.correctiveActions.length > 0) {
policyPayloadObj.correctiveActions.forEach(function (correctiveAction) {
if ("POLICY" === correctiveAction.actionType) {
$("#corrective-action-type-policy-id").html(correctiveAction.policyId);
return true;
}
});
$("#policy-corrective-actions-list").removeClass("hidden");
} else {
$("#policy-corrective-actions-list").addClass("hidden");
}
var policyId = policyPayloadObj["id"];
var deviceType = policy["platform"];
var policyOperations = $("#policy-operations");

@ -34,7 +34,7 @@
<td class="sorting_1" style="padding:10px 15px;">Action upon non-compliance</td>
<td id="policy-action" style="padding:10px 15px;"></td>
</tr>
<tr role="row" class="even">
<tr role="row" class="odd">
<td class="sorting_1" style="padding:10px 15px;">Status</td>
<td id="policy-status" style="padding:10px 15px;"></td>
</tr>
@ -46,9 +46,32 @@
<td class="sorting_1" style="padding:10px 15px;">Assigned Roles</td>
<td id="policy-roles" style="padding:10px 15px;"></td>
</tr>
<tr role="row" id="roles-row" class="even">
<td class="sorting_1" style="padding:10px 15px;">Policy Type</td>
<td id="policy-type" style="padding:10px 15px;"></td>
</tr>
</tbody>
</table>
{{/defineZone}}
<div id="policy-corrective-actions-list" class="hidden">
<div style="background: #008cc4; color: #fff; padding: 10px; margin-bottom: 5px">
Corrective Actions
</div>
<div class="add-margin-top-4x">
<div id="policy-corrective-actions">
<table class="table table-responsive table-striped">
<tbody>
<tr role="row">
<td class="sorting_1" style="padding:10px 15px; width: 14%;">Action Type</td>
<td style="padding:10px 15px;">POLICY</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>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div style="background: #008cc4; color: #fff; padding: 10px; margin-bottom: 5px">Description
</div>
<div class="add-margin-top-4x">

Loading…
Cancel
Save