Added resetClientStatusList button to Dashboard #129

This commit is contained in:
Ben Gräf 2018-06-12 21:13:09 +02:00
parent f4bd7c1ca3
commit 3e57539e91
3 changed files with 42 additions and 0 deletions

View file

@ -314,6 +314,23 @@
}
});
new $.fn.dataTable.Buttons(table, {
buttons: [
{ text: '<i class="fa fa-trash-o"> Reset ClientStatusList</i>',
className: 'btn-danger',
enabled: true,
action: function () {
resetClientStatusList();
}
}
]
});
table.buttons(1, null ).container().appendTo(
table.table().container()
);
table.on('xhr.dt', function ( e, settings, json, xhr ) {
// check version
if (latestRelease === "" && json !== undefined) {
@ -488,6 +505,21 @@
});
}
function resetClientStatusList() {
$.ajax({
type: "POST",
url: "/admin/resetClientStatusList",
dataType:"text",
data: '',
success: function(data){
setSuccess('<strong>Successfully send the reset client status list request to the Server.</strong> - Now just wait for the next refresh.');
},
error: function (data) {
setError('<strong>Failed to send the reset client status list request to the Server.</strong> \nError: ' + JSON.stringify(data,undefined, 2));
}
});
}
function uptime( data, type, row ) {
if (type !== 'sort') {
var lastStatus = row.client_status.last_status_update * 1000;