mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added ability to clear dashboard
This commit is contained in:
@@ -27,7 +27,8 @@ $dash_config = unserialize(stripslashes($data));
|
||||
|
||||
?>
|
||||
|
||||
<a class="btn btn-primary" role="button" data-toggle="collapse" href="#add_widget" aria-expanded="false" aria-controls="add_widget"">Add Widget <i class="fa fa-caret-down fa-fw"></i></a>
|
||||
<a class="btn btn-primary" role="button" data-toggle="collapse" href="#add_widget" aria-expanded="false" aria-controls="add_widget"">Add Widget <i class="fa fa-caret-down fa-fw"></i></a>
|
||||
<a class="btn btn-danger" role="button" id="clear_widgets" name="clear_widgets">Clear dashboard <i class="fa fa-times fa-fw"></i></a>
|
||||
<div class="collapse" id="add_widget">
|
||||
<div class="well">
|
||||
<?php
|
||||
@@ -122,6 +123,27 @@ foreach (dbFetchRows("SELECT * FROM `widgets` ORDER BY `widget_title`") as $widg
|
||||
);
|
||||
});
|
||||
|
||||
$(document).on('click','#clear_widgets', function() {
|
||||
var widget_id = $(this).data('widget-id');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/ajax_form.php',
|
||||
data: {type: "update-dashboard-config", sub_type: 'remove-all'},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.status == 'ok') {
|
||||
gridster.remove_all_widgets();
|
||||
}
|
||||
else {
|
||||
$("#message").html('<div class="alert alert-info">' + data.message + '</div>');
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
$("#message").html('<div class="alert alert-info">An error occurred.</div>');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('a[name="place_widget"]').on('click', function(event, state) {
|
||||
var widget_id = $(this).data('widget_id');
|
||||
$.ajax({
|
||||
|
||||
Reference in New Issue
Block a user