MQTT Dashboard UI code refactor

revert-70aa11f8
Supun94 8 years ago
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.
*/
@ -68,13 +50,10 @@ $(document).ready(function () {
return permissionSet[permission];
};
deviceListing = $("#device-listing");
currentUser = deviceListing.data("current-user");
name = getParameterByName("name");
/* Adding selected class for selected devices */
/* Adding selected class for selected topics */
$(deviceCheckbox).each(function () {
addDeviceSelectedClass(this);
});
@ -103,16 +82,6 @@ function addDeviceSelectedClass(checkbox) {
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;
if ($.hasPermission("VIEW_TOPICS")) {
serviceURL = "/api/mqtt-topics/v1.0/admin/topics";
@ -284,7 +253,7 @@ $(document).ready(function () {
loadTopics();
$(".dataTables_toolbar").css("display", "none");
/* for device list sorting drop down */
/* for topic list sorting drop down */
$(".ctrl-filter-type-switcher").popover({
html: true,
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";
@ -356,8 +318,3 @@ function getParameterByName(name) {
results = regex.exec(location.search);
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>
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/policies">
<a href="{{@app.context}}/topics">
Dashboard
</a>
</li>

Loading…
Cancel
Save