mirror of
https://github.com/unraid/webgui.git
synced 2026-03-05 16:08:38 -06:00
Device info page link should be active for disabled non-present devices so that size of emulated
device can be examined, and file system check can be peformed.
This commit is contained in:
@@ -23,15 +23,6 @@ function displayTemp($temp) {
|
||||
global $display;
|
||||
return $display['unit']=='F' ? round($temp*9/5)+32 : $temp;
|
||||
}
|
||||
function luks_status($luksState) {
|
||||
switch ($luksState) {
|
||||
case 0: return 'Not encrypted'; break;
|
||||
case 1: return 'Encrypted'; break;
|
||||
case 2: return 'Missing encryption key'; break;
|
||||
case 3: return 'Wrong encryption key'; break;
|
||||
default: return 'Unknown error'; break;
|
||||
}
|
||||
}
|
||||
function maintenance_mode() {
|
||||
global $var, $disk;
|
||||
return ($var['fsState']=="Started" && $var['startMode']=="Maintenance" && $disk['luksState']<=1);
|
||||
@@ -102,7 +93,7 @@ Name:
|
||||
: <span class='big'><?=htmlspecialchars(my_disk($name))?></span>
|
||||
|
||||
Partition size:
|
||||
: <?=my_number($disk['size'])?> KB (K=1024)
|
||||
: <?=my_number($disk['sizeSb'])?> KB (K=1024)
|
||||
|
||||
Partition format:
|
||||
: <?=$disk['format']?>
|
||||
|
||||
@@ -57,7 +57,7 @@ function device_info(&$disk,$online) {
|
||||
case 'grey-off': $help = 'Device not present'; break;
|
||||
}
|
||||
$status = "$ctrl<a class='info nohand' onclick='return false'><img src='/webGui/images/{$disk['color']}.png' class='icon'><span>$help</span></a>";
|
||||
$link = (strpos($disk['status'], 'DISK_NP')===false || $disk['name']=="cache") ? "<a href=\"".htmlspecialchars("$path/$type?name=$name")."\">".$fancyname."</a>" : $fancyname;
|
||||
$link = (strcmp($disk['status'], 'DISK_NP')!=0 || $disk['name']=="cache") ? "<a href=\"".htmlspecialchars("$path/$type?name=$name")."\">".$fancyname."</a>" : $fancyname;
|
||||
switch ($disk['luksState']) {
|
||||
case 0: $luks = ""; break;
|
||||
case 1: $luks = "<i ".($online?"class='padlock fa fa-unlock-alt green-text' title='Encrypted and unlocked'":"class='padlock fa fa-lock grey-text' title='Encrypted and locked'")."></i>"; break;
|
||||
@@ -123,8 +123,25 @@ function fs_info(&$disk) {
|
||||
function my_diskio($data) {
|
||||
return my_scale($data,$unit,1)." $unit/s";
|
||||
}
|
||||
function array_offline(&$disk,$w) {
|
||||
$warning = $w ? '<span class="red-text"><em>ALL DATA ON THIS DISK WILL BE ERASED WHEN ARRAY IS STARTED</em></span>' : '';
|
||||
function array_offline(&$disk) {
|
||||
global $var, $disks;
|
||||
if (strpos($var['mdState'],"ERROR:")===false) {
|
||||
$w = '<span class="red-text"><em>All existing data on this device will be OVERWRITTEN when array is Started</em></span>';
|
||||
if ($disk['type']=="Cache") {
|
||||
if (!empty($disks['cache']['uuid']) && $disk['status']=="DISK_NEW") $warning = $w;
|
||||
}
|
||||
else {
|
||||
if ($var['mdState']=="NEW_ARRAY") {
|
||||
if ($disk['type']=="Parity") $warning = $w;
|
||||
}
|
||||
else {
|
||||
if ($disk['status']=="DISK_INVALID" ||
|
||||
$disk['status']=="DISK_DSBL_NEW" ||
|
||||
$disk['status']=="DISK_WRONG" ||
|
||||
$disk['status']=="DISK_NEW") $warning = $w;
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "<tr>";
|
||||
switch ($disk['status']) {
|
||||
case 'DISK_NP':
|
||||
@@ -133,10 +150,14 @@ function array_offline(&$disk,$w) {
|
||||
echo "<td>".assignment($disk)."</td>";
|
||||
echo "<td colspan='9'></td>";
|
||||
break;
|
||||
case 'DISK_NP_MISSING':
|
||||
echo "<td>".device_info($disk,false)."<br><span class='diskinfo'><em>Missing</em></span></td>";
|
||||
echo "<td>".assignment($disk)."<em>{$disk['idSb']} - ".my_scale($disk['sizeSb']*1024,$unit)." $unit</em></td>";
|
||||
echo "<td colspan='9'></td>";
|
||||
break;
|
||||
case 'DISK_OK':
|
||||
$warning = '';
|
||||
case 'DISK_INVALID':
|
||||
case 'DISK_DSBL':
|
||||
case 'DISK_INVALID':
|
||||
case 'DISK_DSBL_NEW':
|
||||
case 'DISK_NEW':
|
||||
echo "<td>".device_info($disk,false)."</td>";
|
||||
@@ -144,11 +165,6 @@ function array_offline(&$disk,$w) {
|
||||
echo "<td>".my_temp($disk['temp'])."</td>";
|
||||
echo "<td colspan='8'>$warning</td>";
|
||||
break;
|
||||
case 'DISK_NP_MISSING':
|
||||
echo "<td>".device_info($disk,false)."<br><span class='diskinfo'><em>Missing</em></span></td>";
|
||||
echo "<td>".assignment($disk)."<em>{$disk['idSb']} - ".my_scale($disk['sizeSb']*1024,$unit)." $unit</em></td>";
|
||||
echo "<td colspan='9'></td>";
|
||||
break;
|
||||
case 'DISK_WRONG':
|
||||
echo "<td>".device_info($disk,false)."<br><span class='diskinfo'><em>Wrong</em></span></td>";
|
||||
echo "<td>".assignment($disk)."<em>{$disk['idSb']} - ".my_scale($disk['sizeSb']*1024,$unit)." $unit</em></td>";
|
||||
@@ -288,9 +304,9 @@ function cache_slots() {
|
||||
switch ($_POST['device']) {
|
||||
case 'array':
|
||||
if ($var['fsState']=='Stopped') {
|
||||
foreach ($disks as $disk) {if ($disk['type']=='Parity') array_offline($disk,true);}
|
||||
foreach ($disks as $disk) {if ($disk['type']=='Parity') array_offline($disk);}
|
||||
echo "<tr class='tr_last'><td style='height:12px' colspan='11'></td></tr>";
|
||||
foreach ($disks as $disk) {if ($disk['type']=='Data') array_offline($disk,$var['mdResyncAction']=='clear');}
|
||||
foreach ($disks as $disk) {if ($disk['type']=='Data') array_offline($disk);}
|
||||
echo "<tr class='tr_last'><td><img src='/webGui/images/sum.png' class='icon'>Slots:</td><td colspan='9'>".array_slots()."</td><td></td></tr>";
|
||||
} else {
|
||||
foreach ($disks as $disk) {if ($disk['type']=='Parity' && $disk['status']!='DISK_NP_DSBL') array_online($disk);}
|
||||
@@ -314,7 +330,7 @@ case 'flash':
|
||||
break;
|
||||
case 'cache':
|
||||
if ($var['fsState']=='Stopped') {
|
||||
foreach ($disks as $disk) {if ($disk['type']=='Cache') array_offline($disk,false);}
|
||||
foreach ($disks as $disk) {if ($disk['type']=='Cache') array_offline($disk);}
|
||||
echo "<tr class='tr_last'><td><img src='/webGui/images/sum.png' class='icon'>Slots:</td><td colspan='9'>".cache_slots()."</td><td></td></tr>";
|
||||
} else {
|
||||
foreach ($disks as $disk) {if ($disk['type']=='Cache') array_online($disk);}
|
||||
|
||||
Reference in New Issue
Block a user