mirror of
https://github.com/unraid/webgui.git
synced 2026-04-27 21:40:20 -05:00
Add date and warranty fields to disk identity information
This commit is contained in:
@@ -3,8 +3,8 @@ Title="Identity"
|
||||
Cond="strpos($disks[$name]['status'],'_NP')===false"
|
||||
---
|
||||
<?PHP
|
||||
/* Copyright 2005-2016, Lime Technology
|
||||
* Copyright 2012-2016, Bergware International.
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
* Copyright 2012-2017, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -14,13 +14,21 @@ Cond="strpos($disks[$name]['status'],'_NP')===false"
|
||||
* all copies or substantial portions of the Software.
|
||||
*/
|
||||
?>
|
||||
<style>
|
||||
input[type=date]{border:none;margin-left:-2px;padding-left:0;background:transparent;box-shadow:none}
|
||||
select.noframe{border:none;margin-left:-5px;padding-left:0;background:transparent;box-shadow:none}
|
||||
</style>
|
||||
<script>
|
||||
function disklog(disk,key,value) {
|
||||
$.post('/webGui/include/DiskLog.php',{disk:disk,key:key,value:value});
|
||||
}
|
||||
$(function() {
|
||||
$.post("/webGui/include/SmartInfo.php",{cmd:'identify',port:'<?=addslashes(htmlspecialchars(isset($disks[$name]['device'])?$disks[$name]['device']:$name))?>',name:'<?=addslashes(htmlspecialchars($name))?>'}, function(data) {
|
||||
$('#disk_identify').html(data);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<table class='share_status small'>
|
||||
<thead><td style="width:33%">Title</td><td>Information</td></thead>
|
||||
<tbody id="disk_identify"><tr><td colspan='2' style='text-align:center;padding-top:12px'><i class='fa fa-spinner fa-spin'></i> <em>Please wait... retrieving S.M.A.R.T. information!</em></td></tr></tbody>
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2017, Lime Technology
|
||||
* Copyright 2012-2017, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$file = '/boot/config/disk.log';
|
||||
$disks = file_exists($file) ? parse_ini_file($file,true) : [];
|
||||
$disk = $_POST['disk'];
|
||||
$key = $_POST['key'];
|
||||
$value = $_POST['value'];
|
||||
$text = '';
|
||||
|
||||
$disks[$disk][$key] = $value;
|
||||
foreach ($disks as $disk => $block) {
|
||||
$text .= "[$disk]\n";
|
||||
foreach ($block as $key => $value) $text .= "$key=\"$value\"\n";
|
||||
}
|
||||
file_put_contents($file,$text);
|
||||
?>
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
|
||||
function normalize($text, $glue='_') {
|
||||
$words = explode($glue,$text);
|
||||
@@ -121,7 +121,21 @@ case "identify":
|
||||
echo "<tr>".normalize(preg_replace('/ is:$/',':',"$title:"),' ')."<td>$info</td></tr>";
|
||||
$empty = false;
|
||||
}
|
||||
if ($empty) echo "<tr><td colspan='2' style='text-align:center;padding-top:12px'>Can not read identification</td></tr>";
|
||||
if ($empty) {
|
||||
echo "<tr><td colspan='2' style='text-align:center;padding-top:12px'>Can not read identification</td></tr>";
|
||||
} else {
|
||||
$file = '/boot/config/disk.log';
|
||||
$disks = parse_ini_file('state/disks.ini',true);
|
||||
$extra = file_exists($file) ? parse_ini_file($file,true) : [];
|
||||
$disk = $disks[$name]['id'];
|
||||
$info = &$extra[$disk];
|
||||
$periods = ['6','12','18','24','36','48','60'];
|
||||
echo "<tr><td>Manufacturing date:</td><td><input type='date' class='narrow' value='{$info['date']}' onchange='disklog(\"$disk\",\"date\",this.value)'></td></tr>";
|
||||
echo "<tr><td>Date of purchase:</td><td><input type='date' class='narrow' value='{$info['purchase']}' onchange='disklog(\"$disk\",\"purchase\",this.value)'></td></tr>";
|
||||
echo "<tr><td>Warranty period:</td><td><select size='1' class='noframe' onchange='disklog(\"$disk\",\"warranty\",this.value)'><option value=''>unknown</option>";
|
||||
foreach ($periods as $period) echo "<option value='$period'".($info['warranty']==$period?" selected":"").">$period months</option>";
|
||||
echo "</select></td></tr>";
|
||||
}
|
||||
break;
|
||||
case "save":
|
||||
exec("smartctl -a $type ".escapeshellarg("/dev/$port")." >".escapeshellarg("$docroot/{$_POST['file']}"));
|
||||
|
||||
@@ -19,7 +19,7 @@ pre ul{margin:0;padding-top:0;padding-bottom:0;padding-left:28px}
|
||||
pre li{margin:0;padding-top:0;padding-bottom:0;padding-left:18px}
|
||||
big{font-size:15px;font-weight:bold;text-transform:uppercase}
|
||||
hr{border-color:#EDEAEF}
|
||||
input[type=text],input[type=password],input[type=number],input[type=url],input[type=email],textarea,.textarea{font-family:arimo;font-size:13px;background:transparent;border:1px solid #606E7F;padding:5px 10px;min-height:20px;line-height:20px;outline:none;width:304px;margin:0 20px 0 0;box-shadow:none;color:#606E7F}
|
||||
input[type=text],input[type=password],input[type=number],input[type=url],input[type=email],input[type=date],textarea,.textarea{font-family:arimo;font-size:13px;background:transparent;border:1px solid #606E7F;padding:5px 10px;min-height:20px;line-height:20px;outline:none;width:304px;margin:0 20px 0 0;box-shadow:none;color:#606E7F}
|
||||
input[type=button],input[type=reset],input[type=submit],button,a.button{font-family:arimo;font-size:13px;border:1px solid #9F9180;border-radius:5px;margin:10px 20px 10px 0;padding:8px 12px;cursor:pointer;outline:none;color:#9F9180;background:#EDEAEF}
|
||||
input[type=checkbox]{vertical-align:middle;margin-right:6px}
|
||||
input[type=number]::-webkit-outer-spin-button,input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none}
|
||||
|
||||
@@ -16,7 +16,7 @@ a.nohand{cursor:default}
|
||||
i.spacing{margin-left:-6px}
|
||||
i.icon{margin-right:4px}
|
||||
hr{border-color:rgba(255,255,255,0.25)}
|
||||
input[type=text],input[type=password],input[type=number],input[type=url],input[type=email],textarea,.textarea{font-family:arimo;font-size:12px;color:#808080;background-color:#000000;border:1px solid #404040;border-radius:4px;padding:2px 8px;min-height:20px;line-height:20px;outline:none;width:301px;margin:0 10px 0 0;box-shadow:inset 1px 1px 5px #404040}
|
||||
input[type=text],input[type=password],input[type=number],input[type=url],input[type=email],input[type=date],textarea,.textarea{font-family:arimo;font-size:12px;color:#808080;background-color:#000000;border:1px solid #404040;border-radius:4px;padding:2px 8px;min-height:20px;line-height:20px;outline:none;width:301px;margin:0 10px 0 0;box-shadow:inset 1px 1px 5px #404040}
|
||||
input[type=button],input[type=reset],input[type=submit],button,a.button{font-family:arimo;font-size:12px;border:1px solid #303030;border-radius:6px;margin:7px 14px 0 0;padding:8px 12px;text-decoration:none;white-space:nowrap;cursor:pointer;outline:none;color:#808080;background:-webkit-radial-gradient(#505050,#181818);background:linear-gradient(#505050,#181818)}
|
||||
input[type=checkbox]{vertical-align:middle;margin-right:6px}
|
||||
input[type=number]::-webkit-outer-spin-button,input[type=number]::-webkit-inner-spin-button{-webkit-appearance: none}
|
||||
|
||||
@@ -19,7 +19,7 @@ pre ul{margin:0;padding-top:0;padding-bottom:0;padding-left:28px}
|
||||
pre li{margin:0;padding-top:0;padding-bottom:0;padding-left:18px}
|
||||
big{font-size:15px;font-weight:bold;text-transform:uppercase}
|
||||
hr{border-color:#121510}
|
||||
input[type=text],input[type=password],input[type=number],input[type=url],input[type=email],textarea,.textarea{font-family:arimo;font-size:13px;background:transparent;border:1px solid #606E7F;padding:5px 10px;min-height:20px;line-height:20px;outline:none;width:304px;margin:0 20px 0 0;box-shadow:none;color:#606E7F}
|
||||
input[type=text],input[type=password],input[type=number],input[type=url],input[type=email],input[type=date],textarea,.textarea{font-family:arimo;font-size:13px;background:transparent;border:1px solid #606E7F;padding:5px 10px;min-height:20px;line-height:20px;outline:none;width:304px;margin:0 20px 0 0;box-shadow:none;color:#606E7F}
|
||||
input[type=button],input[type=reset],input[type=submit],button,a.button{font-family:arimo;font-size:13px;border:1px solid #606E7F;border-radius:5px;margin:10px 20px 10px 0;padding:8px 12px;cursor:pointer;outline:none;color:#606E7F;background:#121510}
|
||||
input[type=checkbox]{vertical-align:middle;margin-right:6px}
|
||||
input[type=number]::-webkit-outer-spin-button,input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none}
|
||||
|
||||
@@ -16,7 +16,7 @@ a.nohand{cursor:default}
|
||||
i.spacing{margin-left:-6px}
|
||||
i.icon{margin-right:4px}
|
||||
hr{border-color:rgba(255,255,255,0.25)}
|
||||
input[type=text],input[type=password],input[type=number],input[type=url],input[type=email],textarea,.textarea{font-family:arimo;font-size:12px;color:#303030;background-color:#FFFFFF;border:1px solid #E0E0E0;border-radius:4px;padding:2px 8px;min-height:20px;line-height:20px;outline:none;width:301px;margin:0 10px 0 0;box-shadow:inset 1px 1px 5px #F0F0F0}
|
||||
input[type=text],input[type=password],input[type=number],input[type=url],input[type=email],input[type=date],textarea,.textarea{font-family:arimo;font-size:12px;color:#303030;background-color:#FFFFFF;border:1px solid #E0E0E0;border-radius:4px;padding:2px 8px;min-height:20px;line-height:20px;outline:none;width:301px;margin:0 10px 0 0;box-shadow:inset 1px 1px 5px #F0F0F0}
|
||||
input[type=button],input[type=reset],input[type=submit],button,a.button{font-family:arimo;font-size:12px;border:1px solid #E8E8E8;border-radius:6px;margin:7px 14px 0 0;padding:8px 12px;text-decoration:none;white-space:nowrap;cursor:pointer;outline:none;color:#303030;background:-webkit-radial-gradient(#F0F0F0,#C8C8C8);background:linear-gradient(#F0F0F0,#C8C8C8)}
|
||||
input[type=checkbox]{vertical-align:middle;margin-right:6px}
|
||||
input[type=number]::-webkit-outer-spin-button,input[type=number]::-webkit-inner-spin-button{-webkit-appearance: none}
|
||||
|
||||
Reference in New Issue
Block a user