mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
MQTT Dashboard UI code refactor
This commit is contained in:
parent
022e1eefe3
commit
8d38f6490c
@ -28,24 +28,6 @@ function InitiateViewOption(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.
|
||||||
*/
|
*/
|
||||||
@ -68,13 +50,10 @@ $(document).ready(function () {
|
|||||||
return permissionSet[permission];
|
return permissionSet[permission];
|
||||||
};
|
};
|
||||||
|
|
||||||
deviceListing = $("#device-listing");
|
|
||||||
currentUser = deviceListing.data("current-user");
|
|
||||||
|
|
||||||
name = getParameterByName("name");
|
name = getParameterByName("name");
|
||||||
|
|
||||||
|
|
||||||
/* Adding selected class for selected devices */
|
/* Adding selected class for selected topics */
|
||||||
$(deviceCheckbox).each(function () {
|
$(deviceCheckbox).each(function () {
|
||||||
addDeviceSelectedClass(this);
|
addDeviceSelectedClass(this);
|
||||||
});
|
});
|
||||||
@ -103,16 +82,6 @@ function addDeviceSelectedClass(checkbox) {
|
|||||||
|
|
||||||
function loadTopics(searchType, searchParam) {
|
function loadTopics(searchType, searchParam) {
|
||||||
|
|
||||||
function getDeviceTypeThumb(type) {
|
|
||||||
var deviceTypes = deviceListing.data("deviceTypes");
|
|
||||||
for (var i = 0; i < deviceTypes.length; i++) {
|
|
||||||
if (deviceTypes[i].type == type) {
|
|
||||||
return deviceTypes[i].thumb;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
var serviceURL;
|
var serviceURL;
|
||||||
if ($.hasPermission("VIEW_TOPICS")) {
|
if ($.hasPermission("VIEW_TOPICS")) {
|
||||||
serviceURL = "/api/mqtt-topics/v1.0/admin/topics";
|
serviceURL = "/api/mqtt-topics/v1.0/admin/topics";
|
||||||
@ -284,7 +253,7 @@ $(document).ready(function () {
|
|||||||
loadTopics();
|
loadTopics();
|
||||||
$(".dataTables_toolbar").css("display", "none");
|
$(".dataTables_toolbar").css("display", "none");
|
||||||
|
|
||||||
/* for device list sorting drop down */
|
/* for topic list sorting drop down */
|
||||||
$(".ctrl-filter-type-switcher").popover({
|
$(".ctrl-filter-type-switcher").popover({
|
||||||
html: true,
|
html: true,
|
||||||
content: function () {
|
content: function () {
|
||||||
@ -310,13 +279,6 @@ $(document).ready(function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var table = $('#example').DataTable();
|
|
||||||
|
|
||||||
// #myInput is a <input type="text"> element
|
|
||||||
$('#myInput').on( 'keyup', function () {
|
|
||||||
table.search( this.value ).draw();
|
|
||||||
} );
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var modalPopup = ".modal";
|
var modalPopup = ".modal";
|
||||||
@ -356,8 +318,3 @@ function getParameterByName(name) {
|
|||||||
results = regex.exec(location.search);
|
results = regex.exec(location.search);
|
||||||
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
|
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
|
||||||
}
|
}
|
||||||
|
|
||||||
function disableSelectButtons() {
|
|
||||||
var x = document.getElementById('toggle-selectable');
|
|
||||||
x.display = 'none';
|
|
||||||
}
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<!--suppress HtmlUnknownTarget -->
|
<!--suppress HtmlUnknownTarget -->
|
||||||
<a href="{{@app.context}}/policies">
|
<a href="{{@app.context}}/topics">
|
||||||
Dashboard
|
Dashboard
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user