mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Device Maintenance configurable duration (#11821)
* Device Maintenance configurable duration * increase hour range * positionize button * remove wrench icon
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
use App\Models\Device;
|
||||
use App\Models\Location;
|
||||
|
||||
require_once 'includes/html/modal/device_maintenance.inc.php';
|
||||
|
||||
$device_model = Device::find($device['device_id']);
|
||||
|
||||
if ($_POST['editing']) {
|
||||
@@ -269,7 +271,7 @@ if (\LibreNMS\Config::get('distributed_poller') === true) {
|
||||
<div class="form-group">
|
||||
<label for="maintenance" class="col-sm-2 control-label"></label>
|
||||
<div class="col-sm-6">
|
||||
<button type="submit" id="maintenance" data-device_id="<?php echo($device['device_id']); ?>" <?php echo(\LibreNMS\Alert\AlertUtil::isMaintenance($device['device_id']) ? 'disabled class="btn btn-warning"' : 'class="btn btn-success"')?> name="maintenance"><i class="fa fa-wrench"></i> Maintenance Mode (1 hour)</button>
|
||||
<button type="button" id="maintenance" data-device_id="<?php echo($device['device_id']); ?>" <?php echo(\LibreNMS\Alert\AlertUtil::isMaintenance($device['device_id']) ? 'disabled class="btn btn-warning"' : 'class="btn btn-success"')?> name="maintenance"><i class="fa fa-wrench"></i> Maintenance Mode</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -307,38 +309,8 @@ If `devices.ignore = 0` or `macros.device = 1` condition is is set and ignore al
|
||||
<script>
|
||||
$('[type="checkbox"]').bootstrapSwitch('offColor', 'danger');
|
||||
|
||||
$("#maintenance").click(function(event) {
|
||||
event.preventDefault();
|
||||
var device_id = $(this).data("device_id");
|
||||
var title = '<?=display($device['hostname']);?>';
|
||||
var notes = '';
|
||||
var recurring = 0;
|
||||
var start = '<?=date("Y-m-d H:i:00");?>';
|
||||
var duration = 1;
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax_form.php',
|
||||
data: { type: "schedule-maintenance",
|
||||
sub_type: 'new-maintenance',
|
||||
title: title,
|
||||
notes: notes,
|
||||
recurring: recurring,
|
||||
start: start,
|
||||
duration: duration,
|
||||
maps: [device_id]
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data){
|
||||
if(data['status'] == 'ok') {
|
||||
toastr.success(data['message']);
|
||||
} else {
|
||||
toastr.error(data['message']);
|
||||
}
|
||||
},
|
||||
error:function(){
|
||||
toastr.error('An error occured setting this device into maintenance mode');
|
||||
}
|
||||
});
|
||||
$("#maintenance").click(function() {
|
||||
$("#device_maintenance_modal").modal('show');
|
||||
});
|
||||
$("#rediscover").click(function() {
|
||||
var device_id = $(this).data("device_id");
|
||||
|
Reference in New Issue
Block a user