diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.effective-policy.view/public/js/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.effective-policy.view/public/js/view.js
index bb11a38d267..c28deb2db5e 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.effective-policy.view/public/js/view.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.effective-policy.view/public/js/view.js
@@ -27,19 +27,19 @@ var displayPolicy = function (policyPayloadObj) {
$("#policy-action").text(policyPayloadObj.compliance.toUpperCase());
$("#policy-description").text(policyPayloadObj["description"]);
var policyStatus = "Active";
- if (policyPayloadObj["active"] == true && policyPayloadObj["updated"] == true) {
+ if (policyPayloadObj["active"] === true && policyPayloadObj["updated"] === true) {
policyStatus = ' Active/Updated';
- } else if (policyPayloadObj["active"] == true && policyPayloadObj["updated"] == false) {
+ } else if (policyPayloadObj["active"] === true && policyPayloadObj["updated"] === false) {
policyStatus = ' Active';
- } else if (policyPayloadObj["active"] == false && policyPayloadObj["updated"] == true) {
+ } else if (policyPayloadObj["active"] === false && policyPayloadObj["updated"] === true) {
policyStatus = ' Inactive/Updated';
- } else if (policyPayloadObj["active"] == false && policyPayloadObj["updated"] == false) {
+ } else if (policyPayloadObj["active"] === false && policyPayloadObj["updated"] === false) {
policyStatus = ' Inactive';
}
$("#policy-status").html(policyStatus);
- if (policyPayloadObj.users == null) {
+ if (!policyPayloadObj.users) {
$("#policy-users").text("NONE");
}
else if (policyPayloadObj.users.length > 0) {
@@ -48,10 +48,9 @@ var displayPolicy = function (policyPayloadObj) {
$("#users-row").addClass("hidden");
}
- if (policyPayloadObj.deviceGroups == null) {
+ if (!policyPayloadObj.deviceGroups) {
$("#policy-groups").text("NONE");
} else if (policyPayloadObj.deviceGroups.length > 0) {
- debugger;
var deviceGroups = policyPayloadObj.deviceGroups;
var assignedGroups = [];
for (var index in deviceGroups) {
@@ -64,7 +63,7 @@ var displayPolicy = function (policyPayloadObj) {
$("#policy-groups").text("NONE");
}
- if (policyPayloadObj.roles == null) {
+ if (!policyPayloadObj.roles) {
$("#policy-roles").text("NONE");
}
else if (policyPayloadObj.roles.length > 0) {
@@ -131,7 +130,7 @@ $(document).ready(function () {
"/api/device-mgt/v1.0" + "/policies/effective-policy/" + getParameterByName("type") + "/" + getParameterByName("id"),
// on success
function (data, textStatus, jqXHR) {
- if (jqXHR.status == 200 && data) {
+ if (jqXHR.status === 200 && data) {
policyPayloadObj = JSON.parse(data);
displayPolicy(policyPayloadObj);
}
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 6242ec3a555..8f664adf530 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
@@ -283,7 +283,7 @@ stepForwardFrom["policy-criteria"] = function () {
*/
var inputIsValidAgainstLength = function (input, minLength, maxLength) {
var length = input.length;
- return (length == minLength || (length > minLength && length < maxLength) || length == maxLength);
+ return (length === minLength || (length > minLength && length < maxLength) || length === maxLength);
};
/**
@@ -298,10 +298,10 @@ validateStep["policy-criteria"] = function () {
$("input[type='radio'].select-users-radio").each(function () {
if ($(this).is(":checked")) {
- if ($(this).attr("id") == "users-radio-btn") {
+ if ($(this).attr("id") === "users-radio-btn") {
selectedAssignees = $("#users-input").val();
selectedField = "User(s)";
- } else if ($(this).attr("id") == "user-roles-radio-btn") {
+ } else if ($(this).attr("id") === "user-roles-radio-btn") {
selectedAssignees = $("#user-roles-input").val();
}
return false;
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/js/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/js/view.js
index 2f035e80c37..9a5eef0ee32 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/js/view.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/js/view.js
@@ -29,13 +29,13 @@ var displayPolicy = function (policyPayloadObj) {
$("#policy-action").text(policyPayloadObj.compliance.toUpperCase());
$("#policy-description").text(policyPayloadObj["description"]);
var policyStatus = "Active";
- if (policyPayloadObj["active"] == true && policyPayloadObj["updated"] == true) {
+ if (policyPayloadObj["active"] === true && policyPayloadObj["updated"] === true) {
policyStatus = ' Active/Updated';
- } else if (policyPayloadObj["active"] == true && policyPayloadObj["updated"] == false) {
+ } else if (policyPayloadObj["active"] === true && policyPayloadObj["updated"] === false) {
policyStatus = ' Active';
- } else if (policyPayloadObj["active"] == false && policyPayloadObj["updated"] == true) {
+ } else if (policyPayloadObj["active"] === false && policyPayloadObj["updated"] === true) {
policyStatus = ' Inactive/Updated';
- } else if (policyPayloadObj["active"] == false && policyPayloadObj["updated"] == false) {
+ } else if (policyPayloadObj["active"] === false && policyPayloadObj["updated"] === false) {
policyStatus = ' Inactive';
}
@@ -47,7 +47,6 @@ var displayPolicy = function (policyPayloadObj) {
$("#users-row").addClass("hidden");
}
if (policyPayloadObj.deviceGroups.length > 0) {
- debugger;
var deviceGroups = policyPayloadObj.deviceGroups;
var assignedGroups = [];
for (var index in deviceGroups) {