diff --git a/html/css/styles.css b/html/css/styles.css index 455bf51a10..80d53766ec 100644 --- a/html/css/styles.css +++ b/html/css/styles.css @@ -1759,3 +1759,7 @@ tr.search:nth-child(odd) { #leaflet-map { height: 600px; } + +.edit-storage-input { + width: 100px; +} diff --git a/html/forms/storage-update.inc.php b/html/forms/storage-update.inc.php new file mode 100644 index 0000000000..200a8f3d68 --- /dev/null +++ b/html/forms/storage-update.inc.php @@ -0,0 +1,46 @@ + + * + * 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. + */ + +$status = 'error'; +$message = 'Error updating storage information'; + +$device_id = mres($_POST['device_id']); +$storage_id = mres($_POST['storage_id']); +$data = mres($_POST['data']); + +if (!is_numeric($device_id)) { + $message = 'Missing device id'; +} +elseif (!is_numeric($storage_id)) { + $message = 'Missing storage id'; +} +elseif (!is_numeric($data)) { + $message = 'Missing value'; +} +else { + if (dbUpdate(array('storage_perc_warn'=>$data), 'storage', '`storage_id`=? AND `device_id`=?',array($storage_id,$device_id))) { + $message = 'Storage information updated'; + $status = 'ok'; + } + else { + $message = 'Could not update storage information'; + } +} + +$response = array( + 'status' => $status, + 'message' => $message, + 'extra' => $extra, +); +echo _json_encode($response); diff --git a/html/includes/table/storage-edit.inc.php b/html/includes/table/storage-edit.inc.php new file mode 100644 index 0000000000..97d9ecc7e7 --- /dev/null +++ b/html/includes/table/storage-edit.inc.php @@ -0,0 +1,51 @@ + $sql); +foreach (dbFetchRows($sql,$param) as $drive) { + + $perc = round($drive['storage_perc'], 0); + $perc_warn = round($drive['storage_perc_warn'], 0); + $response[] = array( + 'storage_id' => $drive['storage_id'], + 'hostname' => generate_device_link($drive), + 'storage_descr' => $drive['storage_descr'], + 'storage_perc' => $perc . "%", + 'storage_perc_warn' => $perc_warn); + +} + +$output = array('current'=>$current,'rowCount'=>$rowCount,'rows'=>$response,'total'=>$total); +echo _json_encode($output); \ No newline at end of file diff --git a/html/pages/device/edit.inc.php b/html/pages/device/edit.inc.php index 7448b20218..0448ac01df 100644 --- a/html/pages/device/edit.inc.php +++ b/html/pages/device/edit.inc.php @@ -34,6 +34,8 @@ else { $panes['health'] = 'Health'; } + $panes['storage'] = 'Storage'; + print_optionbar_start(); unset($sep); diff --git a/html/pages/device/edit/storage.inc.php b/html/pages/device/edit/storage.inc.php new file mode 100644 index 0000000000..e32dd06840 --- /dev/null +++ b/html/pages/device/edit/storage.inc.php @@ -0,0 +1,86 @@ + + * + * 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. + */ + +?> + +

Storage settings

+ +
+ + + + + + + + + +
DeviceStorage%% Warn
+
+ +