Merge pull request #1901 from arjitc/master

Various UI fixes/cleanup under device edit
This commit is contained in:
Daniel Preussker
2015-09-16 13:39:40 +00:00
5 changed files with 88 additions and 79 deletions
+11 -2
View File
@@ -92,10 +92,19 @@ if ($disable_notify) {
/>
</div>
</div>
<button class="btn btn-default btn-sm" type="submit" name="Submit">Save</button>
<div class="row">
<div class="col-md-1 col-md-offset-3">
<button type="submit" name="Submit" class="btn btn-default"><i class="fa fa-check"></i> Save</button>
</div>
</div>
</form>
<?php
require_once 'includes/modal/new_alert_rule.inc.php';
?>
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#create-alert" data-device_id="<?php echo $device['device_id']; ?>">Create new alert rule</button>
<br>
<div class="row">
<div class="col-md-1 col-md-offset-3">
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#create-alert" data-device_id="<?php echo $device['device_id']; ?>"><i class="fa fa-plus"></i> Create new alert rule</button>
</div>
</div>
+7 -8
View File
@@ -62,7 +62,7 @@ echo "<div class='row'>
<div class='col-md-4'>
<form id='appedit' name='appedit' method='post' action='' role='form' class='form-horizontal'>
<input type=hidden name=device value='".$device['device_id']."'>
<table class='table table-condensed table-striped table-responsive'>
<table class='table table-hover table-condensed table-responsive'>
<tr align=center>
<th>Enable</th>
<th>Application</th>
@@ -90,14 +90,13 @@ foreach ($applications as $app) {
$row++;
}
echo '<tr>
<td>
<button type="submit" class="btn btn-default" value="Save">Save</button>
</td>
<td>
</td>
</tr>';
echo '</table>';
echo '<div class="row">
<div class="col-md-1">
<button type="submit" name="Submit" class="btn btn-default"><i class="fa fa-check"></i> Save</button>
</div>
</div>
';
echo '</form>';
echo '</div>';
echo '</div>';
+55 -60
View File
@@ -1,5 +1,4 @@
<?php
if ($_POST['editing']) {
if ($_SESSION['userlevel'] > "7") {
$updated = 0;
@@ -65,83 +64,84 @@ elseif ($update_message) {
?>
<div class="row">
<div class="col-sm-1">
<div class="col-md-1 col-md-offset-2">
<form id="delete_host" name="delete_host" method="post" action="delhost/" role="form">
<input type="hidden" name="id" value="<?php echo($device['device_id']); ?>">
<button type="submit" class="btn btn-danger" name="Submit">Delete device</button>
<button type="submit" class="btn btn-danger" name="Submit"><i class="fa fa-trash"></i> Delete device</button>
</form>
</div>
<div class="col-sm-1">
<div class="col-md-1 col-md-offset-2">
<?php
if($config['enable_clear_discovery'] == 1) {
?>
<button type="submit" id="rediscover" data-device_id="<?php echo($device['device_id']); ?>" class="btn btn-primary" name="rediscover"><i class="fa fa-retweet"></i> Rediscover device</button>
<?php
}
?>
</div>
<?php
if($config['enable_clear_discovery'] == 1) {
?>
<div class="col-sm-1">
<button type="submit" id="rediscover" data-device_id="<?php echo($device['device_id']); ?>" class="btn btn-primary" name="rediscover">Rediscover device</button>
</div>
<?php
}
?>
</div>
<br />
<br>
<form id="edit" name="edit" method="post" action="" role="form" class="form-horizontal">
<input type=hidden name="editing" value="yes">
<div class="form-group">
<label for="descr" class="col-sm-2 control-label">Description:</label>
<div class="col-sm-6">
<input id="descr" name="descr" value="<?php echo($device['purpose']); ?>" class="form-control">
<div class="form-group">
<label for="descr" class="col-sm-2 control-label">Description:</label>
<div class="col-sm-6">
<input id="descr" name="descr" value="<?php echo($device['purpose']); ?>" class="form-control">
</div>
</div>
</div>
<div class="form-group">
<label for="type" class="col-sm-2 control-label">Type:</label>
<div class="col-sm-6">
<select id="type" name="type" class="form-control">
<?php
$unknown = 1;
<div class="form-group">
<label for="type" class="col-sm-2 control-label">Type:</label>
<div class="col-sm-6">
<select id="type" name="type" class="form-control">
<?php
$unknown = 1;
foreach ($config['device_types'] as $type) {
echo(' <option value="'.$type['type'].'"');
if ($device['type'] == $type['type']) {
echo(' selected="1"');
$unknown = 0;
}
echo(' >' . ucfirst($type['type']) . '</option>');
}
if ($unknown) {
echo(' <option value="other">Other</option>');
}
?>
</select>
</div>
</div>
<div class="form-group">
foreach ($config['device_types'] as $type) {
echo(' <option value="'.$type['type'].'"');
if ($device['type'] == $type['type']) {
echo(' selected="1"');
$unknown = 0;
}
echo(' >' . ucfirst($type['type']) . '</option>');
}
if ($unknown) {
echo(' <option value="other">Other</option>');
}
?>
</select>
</div>
</div>
<div class="form-group">
<label for="sysLocation" class="col-sm-2 control-label">Override sysLocation:</label>
<div class="col-sm-6">
<div class="checkbox">
<input onclick="edit.sysLocation.disabled=!edit.override_sysLocation.checked" type="checkbox" name="override_sysLocation"<?php if ($override_sysLocation) echo(' checked="1"'); ?> />
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-2">
<div class="checkbox">
<input onclick="edit.sysLocation.disabled=!edit.override_sysLocation.checked" type="checkbox" name="override_sysLocation"<?php if ($override_sysLocation) echo(' checked="1"'); ?> />
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-2"></div>
<div class="col-sm-6">
<input id="sysLocation" name="sysLocation" class="form-control" <?php if (!$override_sysLocation) echo(' disabled="1"'); ?> value="<?php echo($override_sysLocation_string); ?>" />
</div>
</div>
<div class="form-group">
</div>
<div class="form-group">
<label for="disabled" class="col-sm-2 control-label">Disable:</label>
<div class="col-sm-6">
<input name="disabled" type="checkbox" id="disabled" value="1" <?php if ($device["disabled"]) echo("checked=checked"); ?> />
</div>
</div>
<div class="form-group">
</div>
<div class="form-group">
<label for="ignore" class="col-sm-2 control-label">Ignore</label>
<div class="col-sm-6">
<input name="ignore" type="checkbox" id="ignore" value="1" <?php if ($device['ignore']) echo("checked=checked"); ?> />
<input name="ignore" type="checkbox" id="ignore" value="1" <?php if ($device['ignore']) echo("checked=checked"); ?> />
</div>
</div>
<button type="submit" name="Submit" class="btn btn-default">Save</button>
</div>
<div class="row">
<div class="col-md-1 col-md-offset-2">
<button type="submit" name="Submit" class="btn btn-default"><i class="fa fa-check"></i> Save</button>
</div>
</div>
</form>
<br />
<script>
@@ -166,13 +166,8 @@ if ($unknown) {
});
</script>
<?php
print_optionbar_start();
list($sizeondisk, $numrrds) = foldersize($config['rrd_dir']."/".$device['hostname']);
echo("Size on Disk: <b>" . formatStorage($sizeondisk) . "</b> in <b>" . $numrrds . " RRD files</b>.");
print_optionbar_end();
?>
+9 -2
View File
@@ -66,6 +66,13 @@ else if ($update_message) {
<input id="ipmi_password" name="ipmi_password" type="password" class="form-control" value="<?php echo get_dev_attrib($device, 'ipmi_password'); ?>" />
</div>
</div>
<button class="btn btn-default btn-sm" type="submit" name="Submit">Save</button>
<div class="row">
<div class="col-md-1 col-md-offset-2">
<button type="submit" name="Submit" class="btn btn-default"><i class="fa fa-check"></i> Save</button>
</div>
</div>
<br><br>
<div class="alert alert-info" role="alert">
<p>To disable IPMI polling, please clear the setting fields and click <b>Save</b>.</p>
</div>
</form>
<p>To disable IPMI polling, please clear the setting fields and click <b>Save</b>.</p>
+6 -7
View File
@@ -70,8 +70,6 @@ if ($_POST['editing']) {
$device = dbFetchRow('SELECT * FROM `devices` WHERE `device_id` = ?', array($device['device_id']));
$descr = $device['purpose'];
echo '<div class="row">
<div class="col-sm-6">';
if ($updated && $update_message) {
print_message($update_message);
}
@@ -79,9 +77,6 @@ else if ($update_message) {
print_error($update_message);
}
echo ' </div>
</div>';
echo "
<form id='edit' name='edit' method='post' action='' role='form' class='form-horizontal'>
<input type=hidden name='editing' value='yes'>
@@ -128,7 +123,7 @@ echo " </select>
<div class='form-group'>
<label for='community' class='col-sm-2 control-label'>SNMP Community</label>
<div class='col-sm-4'>
<input id='community' class='form-control' name='community' value='".$device['community']."' />
<input id='community' class='form-control' name='community' value='".$device['community']."' required/>
</div>
</div>
</div>
@@ -211,7 +206,11 @@ if ($config['distributed_poller'] === true) {
echo '
<button type="submit" name="Submit" class="btn btn-default">Save</button>
<div class="row">
<div class="col-md-1 col-md-offset-2">
<button type="submit" name="Submit" class="btn btn-default"><i class="fa fa-check"></i> Save</button>
</div>
</div>
</form>
';