Add configurable display of WWN in device ID

This commit is contained in:
bergware
2016-09-03 14:35:14 +02:00
parent f7d8ebca4d
commit cc97a81002
5 changed files with 27 additions and 13 deletions

View File

@@ -118,7 +118,7 @@ $('.tabs').append("<span class='status vhshift'><input type='button' value='Refr
<? if ($var['fsNumUnmountable']>0):?>
<tr>
<td><strong>Unmountable disk<?=$var['fsNumUnmountable']==1?'':'s'?> present:</strong><br>
<? foreach ($disks as $disk) if ($disk['fsStatus']=='Unmountable') echo "<br><font color='#3B5998'>".my_disk($disk['name'])."</font> &bullet; {$disk['id']} ({$disk['device']})";?></td>
<? foreach ($disks as $disk) if ($disk['fsStatus']=='Unmountable') echo "<br><font color='#3B5998'>".my_disk($disk['name'])."</font> &bullet; ".my_id($disk['id'])." (".$disk['device'].")";?></td>
<td><input type="submit" id="cmdFormat" name="cmdFormat" value="Format" disabled><input type="hidden" name="unmountable_mask" value="<?=$var['fsUnmountableMask']?>"></td>
<td><strong>Format</strong> will create a file system in all <strong>Unmountable</strong> disks, discarding all data currently on those disks.<br>
<input type="checkbox" name="confirmFormat" value="OFF" onClick="arrayOps.cmdFormat.disabled=!arrayOps.confirmFormat.checked"><small>Yes I want to do this</small>
@@ -364,7 +364,7 @@ $('.tabs').append("<span class='status vhshift'><input type='button' value='Refr
case "UNPROTECTED_EXPANSION":?>
<tr>
<td><?=status_indicator()?><strong>Stopped</strong>. Found <?=my_word($var['mdNumNew'])?> new disk<?=$var['mdNumNew']==1?'':'s'?>.<br>
<? foreach ($disks as $disk) if ($disk['status']=='DISK_NEW') echo "<br><font color='#3B5998'>".my_disk($disk['name'])."</font> &bullet; {$disk['id']} ({$disk['device']})";?></td>
<? foreach ($disks as $disk) if ($disk['status']=='DISK_NEW') echo "<br><font color='#3B5998'>".my_disk($disk['name'])."</font> &bullet; ".my_id($disk['id'])." (".$disk['device'].")";?></td>
<td><input type="submit" name="cmdStart" value="Start"></td>
<td><strong>Start</strong> will record the new disk<?=$var['mdNumNew']==1?'':'s'?> information and bring the expanded array on-line.</td>
</tr>
@@ -374,7 +374,7 @@ $('.tabs').append("<span class='status vhshift'><input type='button' value='Refr
if ($var['mdNumErased']==$var['mdNumNew']):?>
<tr>
<td><?=status_indicator()?><strong>Stopped</strong>. Found <?=my_word($var['mdNumNew'])?> new erased disk<?=$var['mdNumNew']==1?'':'s'?>.<br>
<? foreach ($disks as $disk) if ($disk['status']=='DISK_NEW') echo "<br><font color='#3B5998'>".my_disk($disk['name'])."</font> &bullet; {$disk['id']} ({$disk['device']})";?></td>
<? foreach ($disks as $disk) if ($disk['status']=='DISK_NEW') echo "<br><font color='#3B5998'>".my_disk($disk['name'])."</font> &bullet; ".my_id($disk['id'])." (".$disk['device'].")";?></td>
<td><input type="submit" name="cmdStart" value="Start" disabled></td>
<td><strong>Start</strong> will record the new disk<?=$var['mdNumNew']==1?'':'s'?> information and bring the expanded array on-line.
<br><input type="checkbox" name="confirmStart" value="OFF" onClick="arrayOps.cmdStart.disabled=!arrayOps.confirmStart.checked"><small>Yes I want to do this</small></td>
@@ -383,7 +383,7 @@ $('.tabs').append("<span class='status vhshift'><input type='button' value='Refr
else:?>
<tr>
<td><?=status_indicator()?><strong>Stopped</strong>. Found <?=my_word($var['mdNumNew'])?> new disk<?=$var['mdNumNew']==1?'':'s'?>.<br>
<? foreach ($disks as $disk) if ($disk['status']=='DISK_NEW') echo "<br><font color='#3B5998'>".my_disk($disk['name'])."</font> &bullet; {$disk['id']} ({$disk['device']})";?></td>
<? foreach ($disks as $disk) if ($disk['status']=='DISK_NEW') echo "<br><font color='#3B5998'>".my_disk($disk['name'])."</font> &bullet; ".my_id($disk['id'])." (".$disk['device'].")";?></td>
<td><input type="submit" name="cmdClear" value="Clear" disabled></td>
<td><strong>Clear</strong> will completely clear (set to zero) the new disk<?=$var['mdNumNew']==1?'':'s'?>.
<br>Once clear completes, the array may be Started, expanding the array to include the new disk<?=$var['mdNumNew']==1?'':'s'?>.
@@ -434,7 +434,7 @@ $('.tabs').append("<span class='status vhshift'><input type='button' value='Refr
case "RECORD_DISKS":?>
<tr>
<td><?=status_indicator()?><strong>Stopped</strong>. Two or more disks are wrong.<br>
<? foreach ($disks as $disk) if ($disk['status']=='DISK_WRONG') echo "<br><font color='#3B5998'>".my_disk($disk['name'])."</font> &bullet; {$disk['id']} ({$disk['device']})";?></td>
<? foreach ($disks as $disk) if ($disk['status']=='DISK_WRONG') echo "<br><font color='#3B5998'>".my_disk($disk['name'])."</font> &bullet; ".my_id($disk['id'])." (".$disk['device'].")";?></td>
<td><input type="submit" name="cmdStart" value="Start" disabled></td>
<td><strong>Start</strong> will just record the new disk positions and bring the array on-line.
<br>We recommend you start a Parity-Check afterwards just to be safe.

View File

@@ -190,6 +190,18 @@ Table view spacing:
<?=mk_option($display['view'], "wide", "Wide")?>
</select>
Display world-wide-name in device ID:
: <select name="wwn" size="1">
<?=mk_option($display['wwn'], "0", "Disabled")?>
<?=mk_option($display['wwn'], "1", "Automatic")?>
</select>
> World Wide Name (WWN) is a unique identifier used for SAS attached devices.
>
> Select *Disabled* to suppress the appending of WWN to the device identification
>
> Select "Automatic" to append WWN to the device identification in case of SAS devices
Display array totals:
: <select name="total" size="1">
<?=mk_option($display['total'], "0", "No")?>

View File

@@ -10,6 +10,7 @@ scale="-1"
align="right"
view=""
resize="0"
wwn="0"
total="1"
banner="image"
dashapps="icons"

View File

@@ -65,16 +65,11 @@ function device_browse(&$disk) {
return "<a href='$path/Browse?dir=$dir'><img src='/webGui/images/explore.png' title='Browse $dir'></a>";
}
}
function device_id($id) {
$len = strlen($id);
$wwn = substr($id,-18);
return (substr($wwn,0,2)!='_3' || preg_match('/.[_-]/',$wwn)) ? $id : substr($id,0,$len-18);
}
function device_desc(&$disk) {
global $var;
$size = my_scale($disk['size']*1024,$unit);
$log = $var['fsState']=='Started' ? "<a href=\"#\" title=\"Disk Log Information\" onclick=\"openBox('/webGui/scripts/disk_log&arg1={$disk['device']}','Disk Log Information',600,900,false);return false\"><i class=\"fa fa-hdd-o icon\"></i></a>" : "";
return $log.device_id($disk['id'])." - $size $unit ({$disk['device']})";
return $log.my_id($disk['id'])." - $size $unit ({$disk['device']})";
}
function assignment(&$disk) {
global $var, $devs;
@@ -82,11 +77,11 @@ function assignment(&$disk) {
$out .= "<select class=\"slot\" name=\"slotId.{$disk['idx']}\" onChange=\"{$disk['name']}Form.submit()\">";
$empty = ($disk['idSb']!='' ? 'no device' : 'unassigned');
if ($disk['id']!='') {
$out .= "<option value=\"".device_id($disk['id'])."\" selected>".device_desc($disk)."</option>";
$out .= "<option value=\"".my_id($disk['id'])."\" selected>".device_desc($disk)."</option>";
$out .= "<option value=''>$empty</option>";
} else
$out .= "<option value='' selected>$empty</option>";
foreach ($devs as $dev) {$out .= "<option value=\"".device_id($dev['id'])."\">".device_desc($dev)."</option>";}
foreach ($devs as $dev) {$out .= "<option value=\"".my_id($dev['id'])."\">".device_desc($dev)."</option>";}
return "$out</select></form>";
}
function fs_info(&$disk) {

View File

@@ -54,6 +54,12 @@ function my_disk($name) {
function my_disks($disk) {
return strpos($disk['status'],'_NP')===false;
}
function my_id($id) {
global $display;
$len = strlen($id);
$wwn = substr($id,-18);
return ($display['wwn'] || substr($wwn,0,2)!='_3' || preg_match('/.[_-]/',$wwn)) ? $id : substr($id,0,$len-18);
}
function my_word($num) {
$words = array('zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty');
return $num<count($words) ? $words[$num] : $num;