diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.listing/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.listing/listing.js
index 4b31ba62ed6..13026b9c300 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.listing/listing.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.listing/listing.js
@@ -17,10 +17,11 @@
*/
function onRequest(context) {
- var page = {};
+ var page_data = {};
var groupId = request.getParameter("groupId");
var userModule = require("/app/modules/user.js").userModule;
var constants = require("/app/modules/constants.js");
+ var deviceModule = require("/app/modules/device.js").deviceModule;
var permissions = [];
var currentUser = session.get(constants.USER_SESSION_KEY);
if (currentUser) {
@@ -28,18 +29,40 @@ function onRequest(context) {
permissions.push("LIST_DEVICES");
} else if (userModule.isAuthorized("/permission/admin/device-mgt/user/devices/list")) {
permissions.push("LIST_OWN_DEVICES");
+ }else if(userModule.isAuthorized("/permission/admin/device-mgt/emm-admin/policies/list")){
+ permissions.push("LIST_POLICIES");
}
- if (userModule.isAuthorized("/permission/admin/device-mgt/admin/devices/add")) {
- permissions.push("ADD_DEVICE");
- }
- if (userModule.isAuthorized("/permission/admin/device-mgt/admin/devices/edit")) {
- permissions.push("EDIT_DEVICE");
- }
+
if (userModule.isAuthorized("/permission/admin/device-mgt/admin/devices/remove")) {
permissions.push("REMOVE_DEVICE");
}
- page.permissions = stringify(permissions);
- page.currentUser = currentUser;
+
+ page_data.permissions = stringify(permissions);
+ page_data.currentUser = currentUser;
+ var deviceCount;
+ if (groupId) {
+ var groupModule = require("/app/modules/group.js").groupModule;
+ deviceCount = groupModule.getDevices(groupId).data.length;
+ page_data.groupId = groupId;
+ } else {
+ deviceCount = deviceModule.getOwnDevicesCount();
+ }
+ if (deviceCount > 0){
+ page_data.deviceCount = deviceCount;
+ var utility = require("/app/modules/utility.js").utility;
+ var data = deviceModule.getDeviceTypes();
+ var deviceTypes = [];
+ if(data.data) {
+ for(var i = 0; i < data.data.length; i++) {
+ deviceTypes.push({
+ "type" : data.data[i].name,
+ "category" : utility.getDeviceTypeConfig(data.data[i].name).deviceType.category
+ });
+ }
+ }
+
+ page_data.deviceTypes = deviceTypes;
+ }
}
- return page;
+ return page_data;
}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.listing/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.listing/public/js/listing.js
index bc1d6f7d6a0..2711b2b29c5 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.listing/public/js/listing.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.listing/public/js/listing.js
@@ -16,6 +16,17 @@
* under the License.
*/
+/**
+ * Following function would execute
+ * when a user clicks on the list item
+ * initial mode and with out select mode.
+ */
+function InitiateViewOption(url) {
+ if ($(".select-enable-btn").text() == "Select") {
+ $(location).attr('href', url);
+ }
+}
+
(function () {
var cache = {};
var permissionSet = {};
@@ -50,6 +61,44 @@
var deviceCheckbox = "#ast-container .ctrl-wr-asset .itm-select input[type='checkbox']";
var assetContainer = "#ast-container";
+/*
+ * DOM ready functions.
+ */
+$(document).ready(function () {
+ /* Adding selected class for selected devices */
+ $(deviceCheckbox).each(function () {
+ addDeviceSelectedClass(this);
+ });
+
+ var i;
+ var permissionList = $("#permission").data("permission");
+ for (i = 0; i < permissionList.length; i++) {
+ $.setPermission(permissionList[i]);
+ }
+
+ /* for device list sorting drop down */
+ $(".ctrl-filter-type-switcher").popover({
+ html : true,
+ content : function () {
+ return $("#content-filter-types").html();
+ }
+ });
+
+ $(".ast-container").on("click", ".claim-btn", function(e){
+ e.stopPropagation();
+ var deviceId = $(this).data("deviceid");
+ var deviceListing = $("#device-listing");
+ var currentUser = deviceListing.data("current-user");
+ var serviceURL = "/temp-controller-agent/enrollment/claim?username=" + currentUser;
+ var deviceIdentifier = {id: deviceId, type: "TemperatureController"};
+ invokerUtil.put(serviceURL, deviceIdentifier, function(message){
+ console.log(message);
+ }, function(message){
+ console.log(message.content);
+ });
+ });
+});
+
/*
* On Select All Device button click function.
*
@@ -110,52 +159,149 @@ function toTitleCase(str) {
});
}
-function loadDevices() {
+function loadDevices(searchType, searchParam){
var deviceListing = $("#device-listing");
var deviceListingSrc = deviceListing.attr("src");
var imageResource = deviceListing.data("image-resource");
var currentUser = deviceListing.data("currentUser");
- $.template("device-listing", deviceListingSrc, function (template) {
- var serviceURL;
- if ($.hasPermission("LIST_OWN_DEVICES") || $.hasPermission("LIST_DEVICES")) {
- //Get authenticated users devices
- serviceURL = "/devicemgt_admin/users/devices?username=" + currentUser;
- } else {
- $("#loading-content").remove();
- $('#device-table').addClass('hidden');
- $('#device-listing-status-msg').text('Permission denied.');
- return;
- }
+ var frontEndPagination = false;
+
+ var serviceURL;
+ if ($.hasPermission("LIST_DEVICES")) {
+ serviceURL = "/devicemgt_admin/devices";
+ } else if ($.hasPermission("LIST_OWN_DEVICES")) {
+ //Get authenticated users devices
+ serviceURL = "/devicemgt_admin/users/devices?username="+currentUser;
+ } else {
+ $("#loading-content").remove();
+ $('#device-table').addClass('hidden');
+ $('#device-listing-status-msg').text('Permission denied.');
+ $("#device-listing-status").removeClass(' hidden');
+ return;
+ }
- var successCallback = function (data) {
- data = JSON.parse(data);
- var viewModel = {};
- viewModel.devices = data;
- viewModel.imageLocation = imageResource;
- if (data.length > 0) {
- $('#device-listing-container').removeClass('hidden');
- $('#empty-device-listing-container').addClass('hidden');
- var content = template(viewModel);
- $("#ast-container").html(content);
- /*
- * On device checkbox select add parent selected style class
- */
- $(deviceCheckbox).click(function () {
- addDeviceSelectedClass(this);
- });
- attachDeviceEvents();
- } else {
- $('#device-listing-container').addClass('hidden');
- $('#empty-device-listing-container').removeClass('hidden');
+ function getPropertyValue(deviceProperties, propertyName) {
+ var property;
+ for (var i =0; i < deviceProperties.length; i++) {
+ property = deviceProperties[i];
+ if (property.name == propertyName) {
+ return property.value;
}
- $("#loading-content").remove();
- $('#device-grid').datatables_extended();
+ }
+ return {};
+ }
+
+ $('#device-grid').datatables_extended ({
+ serverSide: true,
+ processing: false,
+ searching: true,
+ ordering: false,
+ filter: false,
+ pageLength : 16,
+ ajax: { url : '/devicemgt/api/devices', data : {url : serviceURL},
+ dataSrc: function ( json ) {
+ $('#device-grid').removeClass('hidden');
+ $("#loading-content").remove();
+ var $list = $("#device-table :input[type='search']");
+ $list.each(function(){
+ $(this).addClass("hidden");
+ });
+ return json.data;
+ }
+ },
+ columnDefs: [
+ { targets: 0, data: 'name', className: 'remove-padding icon-only content-fill' , render: function ( data, type, row, meta ) {
+ return '
';
+ }},
+ { targets: 1, data: 'name', className: 'fade-edge' , render: function ( name, type, row, meta ) {
+ var model = getPropertyValue(row.properties, 'DEVICE_MODEL');
+ var vendor = getPropertyValue(row.properties, 'VENDOR');
+ var html = '
Device ' + name + '
';
+ if (model) {
+ html += '
(' + vendor + '-' + model + ')
';
+ }
+ return html;
+ }},
+ { targets: 2, data: 'enrolmentInfo.owner', className: 'fade-edge remove-padding-top'},
+ { targets: 3, data: 'enrolmentInfo.status', className: 'fade-edge remove-padding-top' ,
+ render: function ( status, type, row, meta ) {
+ var html;
+ switch (status) {
+ case 'ACTIVE' :
+ html = '
Active';
+ break;
+ case 'INACTIVE' :
+ html = '
Inactive';
+ break;
+ case 'BLOCKED' :
+ html = '
Blocked';
+ break;
+ case 'REMOVED' :
+ html = '
Removed';
+ break;
+ }
+ return html;
+ }},
+ { targets: 4, data: 'type' , className: 'fade-edge remove-padding-top' },
+ { targets: 5, data: 'enrolmentInfo.ownership' , className: 'fade-edge remove-padding-top' },
+ { targets: 6, data: 'enrolmentInfo.status' , className: 'text-right content-fill text-left-on-grid-view no-wrap' ,
+ render: function ( status, type, row, meta ) {
+ var deviceType = row.type;
+ var deviceIdentifier = row.deviceIdentifier;
+ var html = '
';
+ if (status != 'REMOVED') {
+ html = '
' +
+ 'View';
+ }
+ return html;
+ }}
+ ],
+ "createdRow": function( row, data, dataIndex ) {
+ $(row).attr('data-type', 'selectable');
+ $(row).attr('data-deviceid', data.deviceIdentifier);
+ $(row).attr('data-devicetype', data.type);
+ var model = getPropertyValue(data.properties, 'DEVICE_MODEL');
+ var vendor = getPropertyValue(data.properties, 'VENDOR');
+ var owner = data.enrolmentInfo.owner;
+ var status = data.enrolmentInfo.status;
+ var ownership = data.enrolmentInfo.ownership;
+ var deviceType = data.type;
+ $.each($('td', row), function (colIndex) {
+ switch(colIndex) {
+ case 1:
+ $(this).attr('data-search', model + ',' + vendor);
+ $(this).attr('data-display', model);
+ break;
+ case 2:
+ $(this).attr('data-grid-label', "Owner");
+ $(this).attr('data-search', owner);
+ $(this).attr('data-display', owner);
+ break;
+ case 3:
+ $(this).attr('data-grid-label', "Status");
+ $(this).attr('data-search', status);
+ $(this).attr('data-display', status);
+ break;
+ case 4:
+ $(this).attr('data-grid-label', "Type");
+ $(this).attr('data-search', deviceType);
+ $(this).attr('data-display', deviceType);
+ break;
+ case 5:
+ $(this).attr('data-grid-label', "Ownership");
+ $(this).attr('data-search', ownership);
+ $(this).attr('data-display', ownership);
+ break;
+ }
+ });
+ },
+ "fnDrawCallback": function( oSettings ) {
$(".icon .text").res_text(0.2);
- };
- invokerUtil.get(serviceURL,
- successCallback, function (message) {
- console.log(message.content);
- });
+ }
+ });
+ $(deviceCheckbox).click(function () {
+ addDeviceSelectedClass(this);
});
}
@@ -218,20 +364,37 @@ function loadGroupedDevices(groupId) {
}
+function initPage() {
+ var groupId = getParameterByName('groupId');
+ invokerUtil.get(
+ "/devicemgt_admin/devices/count",
+ function (data) {
+ if (data) {
+ data = JSON.parse(data);
+ if (Number(data) > 0) {
+ if (groupId) {
+ loadGroupedDevices(groupId);
+ } else {
+ loadDevices();
+ }
+ } else {
+ $("#loading-content").remove();
+ $("#device-listing-status-msg").text("No enrolled devices found.");
+ $("#device-listing-status").removeClass(' hidden');
+ }
+ }
+ }, function (message) {
+ initPage();
+ }
+ );
+}
+
/*
* DOM ready functions.
*/
$(document).ready(function () {
- var groupId = getParameterByName('groupId');
-
- if (groupId) {
- loadGroupedDevices(groupId);
- } else {
- loadDevices();
- }
-
- //$('#device-grid').datatables_extended();
+ initPage();
/* Adding selected class for selected devices */
$(deviceCheckbox).each(function () {
@@ -246,29 +409,43 @@ $(document).ready(function () {
/* for device list sorting drop down */
$(".ctrl-filter-type-switcher").popover({
- html: true,
- content: function () {
- return $("#content-filter-types").html();
- }
- });
+ html : true,
+ content : function () {
+ return $("#content-filter-types").html();
+ }
+ });
+
+ $(".ast-container").on("click", ".claim-btn", function(e) {
+ e.stopPropagation();
+ var deviceId = $(this).data("deviceid");
+ var deviceListing = $("#device-listing");
+ var currentUser = deviceListing.data("current-user");
+ var serviceURL = "/temp-controller-agent/enrollment/claim?username=" + currentUser;
+ var deviceIdentifier = {id: deviceId, type: "TemperatureController"};
+ invokerUtil.put(serviceURL, deviceIdentifier, function(message) {
+ console.log(message);
+ }, function(message){
+ console.log(message.content);
+ });
+ });
/* for data tables*/
$('[data-toggle="tooltip"]').tooltip();
$("[data-toggle=popover]").popover();
- $(".ctrl-filter-type-switcher").popover({
- html: true,
- content: function () {
- return $('#content-filter-types').html();
- }
- });
-
- $('#nav').affix({
- offset: {
- top: $('header').height()
- }
- });
+ $(".ctrl-filter-type-switcher").popover ({
+ html : true,
+ content: function() {
+ return $('#content-filter-types').html();
+ }
+ });
+
+ $('#nav').affix ({
+ offset: {
+ top: $('header').height()
+ }
+ });
});
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.listing/public/templates/listing.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.listing/public/templates/listing.hbs
index f0d3b54d843..07965cfd667 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.listing/public/templates/listing.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.listing/public/templates/listing.hbs
@@ -28,17 +28,9 @@
{{type}} |
- {{#if enrolmentInfo.ownership}}
-
- {{enrolmentInfo.ownership}}
- |
- {{else}}
-
- |
- {{/if}}
+
{{enrolmentInfo.ownership}} |
{{#unequal enrolmentInfo.status "REMOVED"}}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js
index ca3a4ac2166..8c115f0a97f 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js
@@ -63,6 +63,7 @@ var operationModule = function () {
"AIRPLAY_OPERATION_CODE": "AIR_PLAY",
"LDAP_OPERATION_CODE": "LDAP",
"CALENDAR_OPERATION_CODE": "CALDAV",
+ "NOTIFICATION_OPERATION_CODE": "NOTIFICATION",
"CALENDAR_SUBSCRIPTION_OPERATION_CODE": "CALENDAR_SUBSCRIPTION",
"APN_OPERATION_CODE": "APN",
"CELLULAR_OPERATION_CODE": "CELLULAR"
@@ -71,8 +72,9 @@ var operationModule = function () {
publicMethods.getIOSServiceEndpoint = function (operationCode) {
var featureMap = {
"DEVICE_LOCK": "lock",
- "ALARM": "alarm",
+ "RING": "ring",
"LOCATION": "location",
+ "NOTIFICATION": "notification",
"AIR_PLAY": "airplay",
"RESTRICTION": "restriction",
"CELLULAR": "cellular",
@@ -538,6 +540,14 @@ var operationModule = function () {
}
};
break;
+ case iosOperationConstants["NOTIFICATION_OPERATION_CODE"]:
+ operationType = operationTypeConstants["PROFILE"];
+ payload = {
+ "operation": {
+ "message" : operationData["message"]
+ }
+ };
+ break;
default:
// If the operation is neither of above, it is a command operation
operationType = operationTypeConstants["COMMAND"];
@@ -683,6 +693,8 @@ var operationModule = function () {
"CLEAR_PASSWORD": "clear-password",
"APPLICATION_LIST": "get-application-list",
"DEVICE_RING": "ring-device",
+ "DEVICE_REBOOT": "reboot-device",
+ "UPGRADE_FIRMWARE": "upgrade-firmware",
"DEVICE_MUTE": "mute",
"NOTIFICATION": "notification",
"ENCRYPT_STORAGE": "encrypt",
@@ -802,13 +814,15 @@ var operationModule = function () {
publicMethods.getWindowsServiceEndpoint = function (operationCode) {
var featureMap = {
"CAMERA": "camera",
- "DEVICE_LOCK": "devicelock",
+ "DEVICE_LOCK": "lock",
"DEVICE_LOCATION": "location",
"CLEAR_PASSWORD": "clear-password",
"APPLICATION_LIST": "get-application-list",
- "DEVICE_RING": "devicering",
+ "DEVICE_RING": "ring-device",
+ "DEVICE_REBOOT": "reboot-device",
+ "UPGRADE_FIRMWARE": "upgrade-firmware",
"DEVICE_MUTE": "mute",
- "LOCK_RESET": "lockreset",
+ "LOCK_RESET": "lock-reset",
"NOTIFICATION": "notification",
"ENCRYPT_STORAGE": "encrypt",
"CHANGE_LOCK_CODE": "change-lock-code",
@@ -818,8 +832,8 @@ var operationModule = function () {
"BLACKLIST_APPLICATIONS": "blacklist-applications",
"PASSCODE_POLICY": "password-policy",
"ENTERPRISE_WIPE": "enterprise-wipe",
- "WIPE_DATA": "devicewipe",
- "DISENROLL": "devicedisenroll"
+ "WIPE_DATA": "wipe-data",
+ "DISENROLL": "disenroll"
};
return "/mdm-windows-agent/services/windows/operation/" + featureMap[operationCode];
};
@@ -836,6 +850,8 @@ var operationModule = function () {
"ENTERPRISE_WIPE": "fw-clear",
"WIPE_DATA": "fw-database",
"DEVICE_RING": "fw-dial-up",
+ "DEVICE_REBOOT": "fw-refresh",
+ "UPGRADE_FIRMWARE": "fw-up-arrow",
"DEVICE_MUTE": "fw-incoming-call",
"NOTIFICATION": "fw-message",
"CHANGE_LOCK_CODE": "fw-security"
@@ -855,6 +871,8 @@ var operationModule = function () {
"DISENROLL": "fw-delete",
"WIPE_DATA": "fw-clear",
"DEVICE_RING": "fw-dial-up",
+ "DEVICE_REBOOT": "fw-refresh",
+ "UPGRADE_FIRMWARE": "fw-up-arrow",
"DEVICE_MUTE": "fw-incoming-call",
"NOTIFICATION": "fw-message",
"LOCK_RESET": "fw-key"
@@ -872,7 +890,8 @@ var operationModule = function () {
"DEVICE_LOCK": "fw-lock",
"LOCATION": "fw-map-location",
"ENTERPRISE_WIPE": "fw-clear",
- "ALARM": "fw-dial-up"
+ "NOTIFICATION": "fw-message",
+ "RING": "fw-dial-up"
};
return featureMap[operationCode];
};
@@ -1059,7 +1078,7 @@ var operationModule = function () {
} else if (operationDataObj.is("select")) {
operationDataObj.val(value);
/* trigger a change of value, so that if slidable panes exist,
- make them slide-down or slide-up accordingly */
+ make them slide-down or slide-up accordingly */
operationDataObj.trigger("change");
} else if (operationDataObj.hasClass("grouped-array-input")) {
// then value is complex
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.service-invoker-utility/public/js/invoker-lib.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.service-invoker-utility/public/js/invoker-lib.js
index 58b71d7a5ee..00aa67e7d58 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.service-invoker-utility/public/js/invoker-lib.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.service-invoker-utility/public/js/invoker-lib.js
@@ -52,7 +52,9 @@ var invokerUtil = function () {
data.data = JSON.stringify(paramValue);
$.ajax(data).fail(function (jqXHR) {
if (jqXHR.status == "401") {
- window.location.replace("/devicemgt");
+ console.log("Unauthorized access attempt!");
+ $(modalPopupContent).html($('#error-msg').html());
+ showPopup();
} else {
errorCallback(jqXHR);
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.service-invoker-utility/service-invoker-utility.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.service-invoker-utility/service-invoker-utility.hbs
index 8168bb116d5..0c8eae0aceb 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.service-invoker-utility/service-invoker-utility.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.service-invoker-utility/service-invoker-utility.hbs
@@ -1,4 +1,20 @@
{{#zone "bottomJs"}}
{{js "js/js.cookie.js"}}
{{js "js/invoker-lib.js"}}
+
+
+
+
+
+
+
+
+
+
+ Unauthorized action!
+
+
+
+
+
{{/zone}}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/listing.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/listing.hbs
index 01c645cf9f8..257f17fae12 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/listing.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/listing.hbs
@@ -13,7 +13,16 @@
Loading policies . . .
-{{policyListingStatusMsg}}
+
{{#equal noPolicy false}}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/listing.js
index b8e06726a59..b3c27be6cd4 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/listing.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/listing.js
@@ -49,6 +49,12 @@ function onRequest(context) {
if (userModule.isAuthorized("/permission/admin/device-mgt/policies/delete")) {
context["removePermitted"] = true;
}
+ if (userModule.isAuthorized("/permission/admin/device-mgt/policies/remove")) {
+ context["removePermitted"] = true;
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/policies/update")) {
+ context["editPermitted"] = true;
+ }
return context;
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/public/js/policy-list.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/public/js/policy-list.js
index 29a03076045..2ea6a2ccfd9 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/public/js/policy-list.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.listing/public/js/policy-list.js
@@ -137,7 +137,10 @@ $(document).ready(function () {
$("#policy-users").hide();
}
- $("#policy-listing-status-msg").removeClass("hidden");
+ if ($("#policy-listing-status-msg").text()) {
+ $("#policy-listing-status").removeClass("hidden");
+ }
+
// Click functions related to Policy Listing
var isUpdated = $('#is-updated').val();
if (!isUpdated) {
@@ -218,7 +221,7 @@ $(document).ready(function () {
$(".policy-unpublish-link").click(function () {
var policyList = getSelectedPolicies();
var statusList = getSelectedPolicyStates();
- if (($.inArray('Inactive/Updated', statusList) > -1) || ($.inArray('Inactive', statusList) > -1)) {
+ if ( ($.inArray( 'Inactive/Updated', statusList ) > -1) || ($.inArray( 'Inactive', statusList ) > -1) ) {
$(modalPopupContent).html($("#errorPolicyUnPublishSelection").html());
showPopup();
} else {
@@ -262,7 +265,7 @@ $(document).ready(function () {
$(".policy-publish-link").click(function () {
var policyList = getSelectedPolicies();
var statusList = getSelectedPolicyStates();
- if (($.inArray('Active/Updated', statusList) > -1) || ($.inArray('Active', statusList) > -1)) {
+ if ( ($.inArray( 'Active/Updated', statusList ) > -1) || ($.inArray( 'Active', statusList ) > -1) ) {
$(modalPopupContent).html($("#errorPolicyPublishSelection").html());
showPopup();
} else {
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.create/create.hbs
index 00f8df9c090..db5498211f7 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.create/create.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.create/create.hbs
@@ -1,15 +1,31 @@
|