|
|
@ -112,7 +112,7 @@ function toTitleCase(str) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function htmlspecialchars(text){
|
|
|
|
function htmlspecialchars(text) {
|
|
|
|
return jQuery('<div/>').text(text).html();
|
|
|
|
return jQuery('<div/>').text(text).html();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -138,11 +138,11 @@ function loadGroups() {
|
|
|
|
var objects = [];
|
|
|
|
var objects = [];
|
|
|
|
$(data.deviceGroups).each(function (index) {
|
|
|
|
$(data.deviceGroups).each(function (index) {
|
|
|
|
objects.push({
|
|
|
|
objects.push({
|
|
|
|
groupId: htmlspecialchars(data.deviceGroups[index].id),
|
|
|
|
groupId: htmlspecialchars(data.deviceGroups[index].id),
|
|
|
|
name: htmlspecialchars(data.deviceGroups[index].name),
|
|
|
|
name: htmlspecialchars(data.deviceGroups[index].name),
|
|
|
|
description: htmlspecialchars(data.deviceGroups[index].description),
|
|
|
|
description: htmlspecialchars(data.deviceGroups[index].description),
|
|
|
|
owner: htmlspecialchars(data.deviceGroups[index].owner)
|
|
|
|
owner: htmlspecialchars(data.deviceGroups[index].owner)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
});
|
|
|
|
});
|
|
|
|
var json = {
|
|
|
|
var json = {
|
|
|
|
"recordsTotal": data.count,
|
|
|
|
"recordsTotal": data.count,
|
|
|
@ -159,7 +159,7 @@ function loadGroups() {
|
|
|
|
class: 'remove-padding icon-only content-fill viewEnabledIcon',
|
|
|
|
class: 'remove-padding icon-only content-fill viewEnabledIcon',
|
|
|
|
render: function (data, type, row, meta) {
|
|
|
|
render: function (data, type, row, meta) {
|
|
|
|
return '<div class="thumbnail icon"><img class="square-element text fw " ' +
|
|
|
|
return '<div class="thumbnail icon"><img class="square-element text fw " ' +
|
|
|
|
'src="public/cdmf.page.groups/images/group-icon.png"/></div>';
|
|
|
|
'src="public/cdmf.page.groups/images/group-icon.png"/></div>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -185,38 +185,38 @@ function loadGroups() {
|
|
|
|
var html = '';
|
|
|
|
var html = '';
|
|
|
|
if ($.hasPermission("VIEW_GROUP_DEVICES")) {
|
|
|
|
if ($.hasPermission("VIEW_GROUP_DEVICES")) {
|
|
|
|
/*html += '<a href="group/' + row.groupId
|
|
|
|
/*html += '<a href="group/' + row.groupId
|
|
|
|
+ '/analytics" data-click-event="remove-form" class="btn padding-reduce-on-grid-view">' +
|
|
|
|
+ '/analytics" data-click-event="remove-form" class="btn padding-reduce-on-grid-view">' +
|
|
|
|
'<span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-statistics fw-stack-1x"></i></span>'
|
|
|
|
'<span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-statistics fw-stack-1x"></i></span>'
|
|
|
|
+
|
|
|
|
+
|
|
|
|
'<span class="hidden-xs hidden-on-grid-view">Analytics</span></a>';*/
|
|
|
|
'<span class="hidden-xs hidden-on-grid-view">Analytics</span></a>';*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (row.owner != "wso2.system.user") {
|
|
|
|
if (row.owner != "wso2.system.user") {
|
|
|
|
if ($.hasPermission("SHARE_GROUP")) {
|
|
|
|
if ($.hasPermission("SHARE_GROUP")) {
|
|
|
|
html +=
|
|
|
|
html +=
|
|
|
|
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view share-group-link" data-group-id="'
|
|
|
|
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view share-group-link" data-group-id="'
|
|
|
|
+ row.groupId + '" ' +
|
|
|
|
+ row.groupId + '" ' +
|
|
|
|
'data-group-owner="' + row.owner
|
|
|
|
'data-group-owner="' + row.owner
|
|
|
|
+ '" data-placement="top" data-toggle="tooltip" data-original-title="Share"><span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-share fw-stack-1x"></i></span>'
|
|
|
|
+ '" data-placement="top" data-toggle="tooltip" data-original-title="Share"><span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-share fw-stack-1x"></i></span>'
|
|
|
|
+
|
|
|
|
+
|
|
|
|
'<span class="hidden-xs hidden-on-grid-view">Share</span></a>';
|
|
|
|
'<span class="hidden-xs hidden-on-grid-view">Share</span></a>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($.hasPermission("UPDATE_GROUP")) {
|
|
|
|
if ($.hasPermission("UPDATE_GROUP")) {
|
|
|
|
html +=
|
|
|
|
html +=
|
|
|
|
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view edit-group-link" data-group-name="'
|
|
|
|
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view edit-group-link" data-group-name="'
|
|
|
|
+ row.name + '" ' +
|
|
|
|
+ row.name + '" ' +
|
|
|
|
'data-group-owner="' + row.owner + '" data-group-description="' + row.description
|
|
|
|
'data-group-owner="' + row.owner + '" data-group-description="' + row.description
|
|
|
|
+ '" data-group-id="' + row.groupId
|
|
|
|
+ '" data-group-id="' + row.groupId
|
|
|
|
+ '" data-placement="top" data-toggle="tooltip" data-original-title="Edit"><span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i>' +
|
|
|
|
+ '" data-placement="top" data-toggle="tooltip" data-original-title="Edit"><span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i>' +
|
|
|
|
'<i class="fw fw-edit fw-stack-1x"></i></span><span class="hidden-xs hidden-on-grid-view">Edit</span></a>';
|
|
|
|
'<i class="fw fw-edit fw-stack-1x"></i></span><span class="hidden-xs hidden-on-grid-view">Edit</span></a>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($.hasPermission("REMOVE_GROUP")) {
|
|
|
|
if ($.hasPermission("REMOVE_GROUP")) {
|
|
|
|
html +=
|
|
|
|
html +=
|
|
|
|
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view remove-group-link" data-group-id="'
|
|
|
|
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view remove-group-link" data-group-id="'
|
|
|
|
+ row.groupId + '" ' +
|
|
|
|
+ row.groupId + '" ' +
|
|
|
|
'data-group-owner="' + row.owner
|
|
|
|
'data-group-owner="' + row.owner
|
|
|
|
+ '" data-placement="top" data-toggle="tooltip" data-original-title="Delete"><span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-delete fw-stack-1x"></i>'
|
|
|
|
+ '" data-placement="top" data-toggle="tooltip" data-original-title="Delete"><span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-delete fw-stack-1x"></i>'
|
|
|
|
+
|
|
|
|
+
|
|
|
|
'</span><span class="hidden-xs hidden-on-grid-view">Delete</span></a>';
|
|
|
|
'</span><span class="hidden-xs hidden-on-grid-view">Delete</span></a>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return html;
|
|
|
|
return html;
|
|
|
@ -251,21 +251,21 @@ function loadGroups() {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$('#group-grid').datatables_extended_serverside_paging(
|
|
|
|
$('#group-grid').datatables_extended_serverside_paging(
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
serviceURL,
|
|
|
|
serviceURL,
|
|
|
|
dataFilter,
|
|
|
|
dataFilter,
|
|
|
|
columns,
|
|
|
|
columns,
|
|
|
|
fnCreatedRow,
|
|
|
|
fnCreatedRow,
|
|
|
|
function (oSettings) {
|
|
|
|
function (oSettings) {
|
|
|
|
$(".icon .text").res_text(0.2);
|
|
|
|
$(".icon .text").res_text(0.2);
|
|
|
|
attachEvents();
|
|
|
|
attachEvents();
|
|
|
|
var thisTable = $(this).closest('.dataTables_wrapper').find('.dataTable').dataTable();
|
|
|
|
var thisTable = $(this).closest('.dataTables_wrapper').find('.dataTable').dataTable();
|
|
|
|
thisTable.removeClass("table-selectable");
|
|
|
|
thisTable.removeClass("table-selectable");
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"placeholder": "Search By Group Name",
|
|
|
|
"placeholder": "Search By Group Name",
|
|
|
|
"searchKey": "name"
|
|
|
|
"searchKey": "name"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
$(groupCheckbox).click(function () {
|
|
|
|
$(groupCheckbox).click(function () {
|
|
|
|
addGroupSelectedClass(this);
|
|
|
|
addGroupSelectedClass(this);
|
|
|
@ -402,17 +402,16 @@ function attachEvents() {
|
|
|
|
|
|
|
|
|
|
|
|
var shareGroupNewRoleFromSelectionLink = $("a#share-group-new-role-from-selection");
|
|
|
|
var shareGroupNewRoleFromSelectionLink = $("a#share-group-new-role-from-selection");
|
|
|
|
shareGroupNewRoleFromSelectionLink.click(function () {
|
|
|
|
shareGroupNewRoleFromSelectionLink.click(function () {
|
|
|
|
var roles = [];
|
|
|
|
var roles = $("#roles").val();
|
|
|
|
$('.modal .roleCheckBoxes').each(
|
|
|
|
if (roles && roles.length >= 2) {
|
|
|
|
function () {
|
|
|
|
addNewRole(roles);
|
|
|
|
if ($(this).is(':checked')) {
|
|
|
|
} else {
|
|
|
|
roles.push($(this).data('role-name'));
|
|
|
|
var errorMsgWrapper = "#notification-error-msg";
|
|
|
|
}
|
|
|
|
var errorMsg = "#notification-error-msg span";
|
|
|
|
}
|
|
|
|
$(errorMsg).text("To create a new role with the combination of roles, at least two roles should be" +
|
|
|
|
);
|
|
|
|
" selected.");
|
|
|
|
addNewRole(roles);
|
|
|
|
$(errorMsgWrapper).removeClass("hidden");
|
|
|
|
// $(modalPopupContent).html($('#share-group-w3-modal-content').html());
|
|
|
|
}
|
|
|
|
// createNewRole(roles);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -442,7 +441,7 @@ function attachEvents() {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
invokerUtil.delete("/api/device-mgt/v1.0/groups/id/" + groupId,
|
|
|
|
invokerUtil.delete("/api/device-mgt/v1.0/groups/id/" + groupId,
|
|
|
|
successCallback, function (message) {
|
|
|
|
successCallback, function (message) {
|
|
|
|
displayErrors(message);
|
|
|
|
displayErrors(message);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -487,7 +486,7 @@ function attachEvents() {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
invokerUtil.put("/api/device-mgt/v1.0/groups/id/" + groupId, group,
|
|
|
|
invokerUtil.put("/api/device-mgt/v1.0/groups/id/" + groupId, group,
|
|
|
|
successCallback, function (message) {
|
|
|
|
successCallback, function (message) {
|
|
|
|
displayErrors(message);
|
|
|
|
displayErrors(message);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -517,7 +516,7 @@ function markAlreadySavedUsersRoles(groupId) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
invokerUtil.get("/api/device-mgt/v1.0/groups/id/" + groupId + "/roles",
|
|
|
|
invokerUtil.get("/api/device-mgt/v1.0/groups/id/" + groupId + "/roles",
|
|
|
|
successCallback, function (message) {
|
|
|
|
successCallback, function (message) {
|
|
|
|
displayErrors(message);
|
|
|
|
displayErrors(message);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -534,9 +533,9 @@ function listAllRoles(groupId) {
|
|
|
|
html += '</select>';
|
|
|
|
html += '</select>';
|
|
|
|
$("#rolesListing").html(html);
|
|
|
|
$("#rolesListing").html(html);
|
|
|
|
markAlreadySavedUsersRoles(groupId);
|
|
|
|
markAlreadySavedUsersRoles(groupId);
|
|
|
|
$("select.select2[multiple=multiple]").select2({
|
|
|
|
$("select.select2[multiple=multiple]").select2({tags: false}).on("select2:select", function () {
|
|
|
|
tags: false
|
|
|
|
$("#notification-error-msg").addClass("hidden");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$("#rolesListing").html("No roles available");
|
|
|
|
$("#rolesListing").html("No roles available");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -546,7 +545,7 @@ function listAllRoles(groupId) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
invokerUtil.get("/api/device-mgt/v1.0/roles?offset=0&limit=100&user-store=all",
|
|
|
|
invokerUtil.get("/api/device-mgt/v1.0/roles?offset=0&limit=100&user-store=all",
|
|
|
|
successCallback, function (message) {
|
|
|
|
successCallback, function (message) {
|
|
|
|
displayErrors(message);
|
|
|
|
displayErrors(message);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -589,7 +588,7 @@ function updateGroupShare(groupId, roles) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
invokerUtil.post("/api/device-mgt/v1.0/groups/id/" + groupId + "/share",
|
|
|
|
invokerUtil.post("/api/device-mgt/v1.0/groups/id/" + groupId + "/share",
|
|
|
|
roles, successCallback, function (message) {
|
|
|
|
roles, successCallback, function (message) {
|
|
|
|
displayErrors(message);
|
|
|
|
displayErrors(message);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -600,7 +599,7 @@ function createNewCombinedRole(roleName, roleList) {
|
|
|
|
showPopup();
|
|
|
|
showPopup();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
invokerUtil.post("/api/device-mgt/v1.0/roles/create-combined-role/" + roleName, roleList,
|
|
|
|
invokerUtil.post("/api/device-mgt/v1.0/roles/create-combined-role/" + roleName, roleList,
|
|
|
|
successCallback, function (message) {
|
|
|
|
successCallback, function (message) {
|
|
|
|
displayErrors(message);
|
|
|
|
displayErrors(message);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -633,6 +632,9 @@ function displayErrors(jqXHR) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$(modalPopupContent).html($('#group-unexpected-error-content').html());
|
|
|
|
$(modalPopupContent).html($('#group-unexpected-error-content').html());
|
|
|
|
|
|
|
|
if (jqXHR.responseText) {
|
|
|
|
|
|
|
|
$('#unexp-error-msg').html(jqXHR.responseText.replace(new RegExp("\"", 'g'), ""));
|
|
|
|
|
|
|
|
}
|
|
|
|
$("a#group-unexpected-error-link").click(function () {
|
|
|
|
$("a#group-unexpected-error-link").click(function () {
|
|
|
|
hidePopup();
|
|
|
|
hidePopup();
|
|
|
|
});
|
|
|
|
});
|
|
|
|