mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
More work on maintenance
This commit is contained in:
15
html/forms/schedule-maintenance.inc.php
Normal file
15
html/forms/schedule-maintenance.inc.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* LibreNMS
|
||||||
|
*
|
||||||
|
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version. Please see LICENSE.txt at the top level of
|
||||||
|
* the source code distribution for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$pagetitle[] = "Alert Schedule";
|
$pagetitle[] = "Alert Schedule";
|
||||||
|
$no_refresh = TRUE;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -34,19 +35,35 @@ $pagetitle[] = "Alert Schedule";
|
|||||||
<label for='device' class='col-sm-4 control-label'>Maintenance for? </label>
|
<label for='device' class='col-sm-4 control-label'>Maintenance for? </label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<select id='device' name='device' class='form-control'>
|
<select id='device' name='device' class='form-control'>
|
||||||
|
<option disabled>Devices</option>
|
||||||
|
<option disabled>-------</option>
|
||||||
<option value="-1">All devices</option>
|
<option value="-1">All devices</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` WHERE `ignore`=0 AND `disabled`=0") as $device_row) {
|
||||||
|
echo '<option value="'.$device_row['device_id'].'">'.$device_row['hostname'].'</option>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<option disabled>Groups</option>";
|
||||||
|
echo "<option disabled>------</option>";
|
||||||
|
|
||||||
|
foreach (dbFetchRows("SELECT `id`,`name` FROM `device_groups`") as $device_group) {
|
||||||
|
echo '<option value="'.$device_group['id'].'">'.$device_group['name'].'</option>';
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="start" class="col-sm-6 control-label">Start: </label>
|
<label for="start" class="col-sm-4 control-label">Start: </label>
|
||||||
<label for="end" class="col-sm-6 control-label">End: </label>
|
<div class="col-sm-8">
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<input type="text" class="form-control date" id="start" name="start" value="<?php echo date('Y-m-d H:i'); ?>" data-date-format="YYYY-MM-DD HH:mm">
|
<input type="text" class="form-control date" id="start" name="start" value="<?php echo date('Y-m-d H:i'); ?>" data-date-format="YYYY-MM-DD HH:mm">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="end" class="col-sm-4 control-label">End: </label>
|
||||||
|
<div class="col-sm-8">
|
||||||
<input type="text" class="form-control date" id="end" name="end" value="<?php echo date('Y-m-d H:i',strtotime('+1 hour')); ?>" data-date-format="YYYY-MM-DD HH:mm">
|
<input type="text" class="form-control date" id="end" name="end" value="<?php echo date('Y-m-d H:i',strtotime('+1 hour')); ?>" data-date-format="YYYY-MM-DD HH:mm">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -61,6 +78,11 @@ $pagetitle[] = "Alert Schedule";
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<span id="message"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="panel panel-default panel-condensed">
|
<div class="panel panel-default panel-condensed">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
@@ -98,7 +120,27 @@ var grid = $("#alert-schedule").bootgrid({
|
|||||||
|
|
||||||
$('#sched-submit').click('', function(e) {
|
$('#sched-submit').click('', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
alert($('form.schedule-maintenance-form').serialize());
|
var device = $("#device").val();
|
||||||
|
var start = $("#start").val();
|
||||||
|
var end = $("#end").val();
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/ajax_form.php",
|
||||||
|
data: { type: "schedule-maintenance", subtype: "add", device: device, start: start, end: end },
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data){
|
||||||
|
if(data.status == 'ok') {
|
||||||
|
$("#message").html('<div class="alert alert-info">'+data.message+'</div>');
|
||||||
|
$("#schedule-maintenance").modal('hide');
|
||||||
|
} else {
|
||||||
|
$("#response").html('<div class="alert alert-info">'+data.message+'</div>');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(){
|
||||||
|
$("#response").html('<div class="alert alert-info">An error occurred.</div>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|||||||
@@ -156,8 +156,8 @@ if (!$auth)
|
|||||||
</form>
|
</form>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
$("#dtpickerfrom").datetimepicker({useSeconds: false, useCurrent: true, sideBySide: true, useStrict: false, showToday: true});
|
$("#dtpickerfrom").datetimepicker({useCurrent: true, sideBySide: true, useStrict: false});
|
||||||
$("#dtpickerto").datetimepicker({useSeconds: false, useCurrent: true, sideBySide: true, useStrict: false, showToday: true});
|
$("#dtpickerto").datetimepicker({useCurrent: true, sideBySide: true, useStrict: false});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user