|
|
@ -16,18 +16,41 @@
|
|
|
|
* under the License.
|
|
|
|
* 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 validateAndReturn = function (value) {
|
|
|
|
|
|
|
|
return (value == undefined || value == null) ? "Unspecified" : value;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
Handlebars.registerHelper("deviceMap", function (device) {
|
|
|
|
|
|
|
|
device.owner = validateAndReturn(device.owner);
|
|
|
|
|
|
|
|
device.ownership = validateAndReturn(device.ownership);
|
|
|
|
|
|
|
|
var arr = device.properties;
|
|
|
|
|
|
|
|
if (arr) {
|
|
|
|
|
|
|
|
device.properties = arr.reduce(function (total, current) {
|
|
|
|
|
|
|
|
total[current.name] = validateAndReturn(current.value);
|
|
|
|
|
|
|
|
return total;
|
|
|
|
|
|
|
|
}, {});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Setting-up global variables.
|
|
|
|
* Setting-up global variables.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
var groupCheckbox = "#ast-container .ctrl-wr-asset .itm-select input[type='checkbox']";
|
|
|
|
var groupCheckbox = "#ast-container .ctrl-wr-asset .itm-select input[type='checkbox']";
|
|
|
|
var assetContainer = "#ast-container";
|
|
|
|
var assetContainer = "#ast-container";
|
|
|
|
|
|
|
|
|
|
|
|
function InitiateViewOption() {
|
|
|
|
|
|
|
|
if ($(".select-enable-btn").text() == "Select") {
|
|
|
|
|
|
|
|
$(location).attr('href', $(this).data("url"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* On Select All Groups button click function.
|
|
|
|
* On Select All Groups button click function.
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -118,9 +141,9 @@ function loadGroups() {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
var json = {
|
|
|
|
var json = {
|
|
|
|
"recordsTotal": data.count,
|
|
|
|
"recordsTotal": data.count,
|
|
|
|
|
|
|
|
"recordsFiltered": data.count,
|
|
|
|
"data": objects
|
|
|
|
"data": objects
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return JSON.stringify(json);
|
|
|
|
return JSON.stringify(json);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -129,7 +152,14 @@ function loadGroups() {
|
|
|
|
data: 'id',
|
|
|
|
data: 'id',
|
|
|
|
class: 'remove-padding icon-only content-fill',
|
|
|
|
class: 'remove-padding icon-only content-fill',
|
|
|
|
render: function (data, type, row, meta) {
|
|
|
|
render: function (data, type, row, meta) {
|
|
|
|
return '<div class="thumbnail icon"><img class="square-element text fw " src="public/cdmf.page.groups/images/group-icon.png"/></div>';
|
|
|
|
if ($.hasPermission("VIEW_GROUP_DEVICES")) {
|
|
|
|
|
|
|
|
return '<a href="devices?groupId=' + row.groupId + '&groupName=' + row.name
|
|
|
|
|
|
|
|
+ '"><div class="thumbnail icon"><img class="square-element text fw " '
|
|
|
|
|
|
|
|
+ 'src="public/cdmf.page.groups/images/group-icon.png"/></div></a>';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return '<div class="thumbnail icon"><img class="square-element text fw " ' +
|
|
|
|
|
|
|
|
'src="public/cdmf.page.groups/images/group-icon.png"/></div>';
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -154,13 +184,7 @@ function loadGroups() {
|
|
|
|
render: function (id, type, row, meta) {
|
|
|
|
render: function (id, type, row, meta) {
|
|
|
|
var html = '';
|
|
|
|
var html = '';
|
|
|
|
if ($.hasPermission("VIEW_GROUP_DEVICES")) {
|
|
|
|
if ($.hasPermission("VIEW_GROUP_DEVICES")) {
|
|
|
|
html = '<a href="devices?groupId=' + row.groupId + '&groupName=' + row.name
|
|
|
|
html += '<a href="group/' + row.groupId
|
|
|
|
+ '" data-click-event="remove-form" class="btn padding-reduce-on-grid-view">' +
|
|
|
|
|
|
|
|
'<span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i><i class="fw fw-view fw-stack-1x"></i></span>'
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
'<span class="hidden-xs hidden-on-grid-view">View Devices</span></a>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
html += '<a href="group/' + row.name + '/' + 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-ring fw-stack-2x"></i><i class="fw fw-statistics fw-stack-1x"></i></span>'
|
|
|
|
'<span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i><i class="fw fw-statistics fw-stack-1x"></i></span>'
|
|
|
|
+
|
|
|
|
+
|
|
|
@ -224,7 +248,6 @@ function loadGroups() {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#group-grid').datatables_extended_serverside_paging(
|
|
|
|
$('#group-grid').datatables_extended_serverside_paging(
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
serviceURL,
|
|
|
|
serviceURL,
|
|
|
@ -234,11 +257,14 @@ function loadGroups() {
|
|
|
|
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();
|
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -257,6 +283,11 @@ function openCollapsedNav() {
|
|
|
|
* DOM ready functions.
|
|
|
|
* DOM ready functions.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
$(document).ready(function () {
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
|
|
|
/* Adding selected class for selected devices */
|
|
|
|
|
|
|
|
$(groupCheckbox).each(function () {
|
|
|
|
|
|
|
|
addGroupSelectedClass(this);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
var permissionSet = {};
|
|
|
|
var permissionSet = {};
|
|
|
|
|
|
|
|
|
|
|
|
//This method is used to setup permission for device listing
|
|
|
|
//This method is used to setup permission for device listing
|
|
|
@ -278,11 +309,6 @@ $(document).ready(function () {
|
|
|
|
loadGroups();
|
|
|
|
loadGroups();
|
|
|
|
//$('#device-grid').datatables_extended();
|
|
|
|
//$('#device-grid').datatables_extended();
|
|
|
|
|
|
|
|
|
|
|
|
/* Adding selected class for selected devices */
|
|
|
|
|
|
|
|
$(groupCheckbox).each(function () {
|
|
|
|
|
|
|
|
addGroupSelectedClass(this);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* for device list sorting drop down */
|
|
|
|
/* for device list sorting drop down */
|
|
|
|
$(".ctrl-filter-type-switcher").popover(
|
|
|
|
$(".ctrl-filter-type-switcher").popover(
|
|
|
|
{
|
|
|
|
{
|
|
|
|