mirror of
https://github.com/unraid/webgui.git
synced 2026-04-27 05:19:44 -05:00
Merge pull request #641 from bergware/mutli-language
Multi cache pool support
This commit is contained in:
@@ -28,7 +28,7 @@ table.divider{margin-top:20px}
|
||||
</style>
|
||||
<script>
|
||||
function validate(poolname) {
|
||||
var valid = /^[a-z_][a-z0-9_-]*[a-z_]$/;
|
||||
var valid = /^[a-z_]([a-z0-9_-]*[a-z_])*$/;
|
||||
var reserved = ['disk','disks','diskp','diskq','diskr','flash','parity','parity2'];
|
||||
var shares = [<?=implode(',',array_map('escapeshellarg',array_filter(array_map('sharename',scandir('boot/config/shares')))))?>];
|
||||
var pools = [<?=implode(',',array_map('escapeshellarg',$pools))?>];
|
||||
@@ -43,7 +43,7 @@ function validate(poolname) {
|
||||
swal({title:'_(Invalid pool name)_',text:'_(Pool name already exists)_',type:'error',confirmButtonText:'_(Ok)_'});
|
||||
return false;
|
||||
} else if (!valid.test(poolname)) {
|
||||
swal({title:'_(Invalid pool name)_',text:'_(Use lowercase characters only and no ending digits)_',type:'error',confirmButtonText:'_(Ok)_'});
|
||||
swal({title:'_(Invalid pool name)_',text:'_(Use lowercase characters with no trailing digits)_',type:'error',confirmButtonText:'_(Ok)_'});
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
||||
@@ -66,6 +66,10 @@ span.helptext{display:none;font-style:italic}
|
||||
span.code{display:inline-block;width:186px}
|
||||
</style>
|
||||
<script>
|
||||
if ($.cookie('deletepool')!=null) {
|
||||
$.removeCookie('deletepool');
|
||||
done();
|
||||
}
|
||||
function doDispatch(form) {
|
||||
var fields = {};
|
||||
<?if ($display['unit']=='F'):?>
|
||||
@@ -222,7 +226,7 @@ function updateMode(form,mode) {
|
||||
$(form).find('input[name="#arg[3]"]').val(mode);
|
||||
}
|
||||
function validate(poolname) {
|
||||
var valid = /^[a-z_][a-z0-9_-]*[a-z_]$/;
|
||||
var valid = /^[a-z_]([a-z0-9_-]*[a-z_])*$/;
|
||||
var reserved = ['disk','disks','diskp','diskq','diskr','flash','parity','parity2'];
|
||||
var shares = [<?=implode(',',array_map('escapeshellarg',array_filter(array_map('sharename',scandir('boot/config/shares')))))?>];
|
||||
var pools = [<?=implode(',',array_map('escapeshellarg',$pools))?>];
|
||||
@@ -237,7 +241,7 @@ function validate(poolname) {
|
||||
swal({title:'_(Invalid pool name)_',text:'_(Pool name already exists)_',type:'error',confirmButtonText:'_(Ok)_'});
|
||||
return false;
|
||||
} else if (!valid.test(poolname)) {
|
||||
swal({title:'_(Invalid pool name)_',text:'_(Use lowercase characters only and no ending digits)_',type:'error',confirmButtonText:'_(Ok)_'});
|
||||
swal({title:'_(Invalid pool name)_',text:'_(Use lowercase characters with no trailing digits)_',type:'error',confirmButtonText:'_(Ok)_'});
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@@ -273,6 +277,10 @@ function renamePoolPopup() {
|
||||
$(".ui-widget-content").css({'background':'<?=$bgcolor?>'});
|
||||
$(".ui-button-text").css({'padding':'0px 5px'});
|
||||
}
|
||||
function deletePool() {
|
||||
$.cookie('deletepool','deletepool');
|
||||
document.deletepool.submit();
|
||||
}
|
||||
$(function() {
|
||||
<?if (count($sheets)>1):?>
|
||||
var ctrl = "<span class='status <?=$tabbed?'vhshift':'vshift'?>'><span class='waitmsg fa fa-circle-o-notch fa-span fa-fw' style='display:none;margin-right:8px'></span><a href='/Main/<?=$type?>?name=<?=$prev?>' title='previous device'>";
|
||||
@@ -444,6 +452,10 @@ _(Critical disk utilization threshold)_ (%):
|
||||
<?endif;?>
|
||||
|
||||
: <input type="submit" name="changeDisk" value="_(Apply)_" disabled><input type="button" value="_(Done)_" onclick="done()">
|
||||
<?if ($var['fsState']=="Stopped" && in_array($name,$pools)):?>
|
||||
<?$empty = $disks[$name]['devices']==0?>
|
||||
<input type="button" value="_(Delete Pool)_" onclick="deletePool()"<?=$empty?'':' disabled'?>><?if (!$empty):?>_(Unassign **ALL** devices to delete this pool)_<?endif;?>
|
||||
<?endif;?>
|
||||
</form>
|
||||
|
||||
<?if (strpos($disk['fsType'],"btrfs")!==false):?>
|
||||
@@ -819,6 +831,7 @@ _(SMART attribute notifications)_:
|
||||
</form>
|
||||
|
||||
<div id="dialogRenamePool" style="display:none"></div>
|
||||
|
||||
<div id="templatePopupPool" style="display:none">
|
||||
<form markdown="1" method="POST" action="/update.htm" target="progressFrame" onsubmit="return validate(this.poolName.value)">
|
||||
<input type="hidden" name="poolNameOrig" value="<?=$name?>">
|
||||
@@ -828,3 +841,10 @@ _(Name)_:
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<form name="deletepool" method="POST" action="/update.htm" target="progressFrame" style="display:none">
|
||||
<input type="hidden" name="changeSlots" value="apply">
|
||||
<input type="hidden" name="poolName" value="<?=$name?>">
|
||||
<input type="hidden" name="poolSlots" value="0">
|
||||
</form>
|
||||
|
||||
|
||||
@@ -204,6 +204,12 @@ _(Listing height)_:
|
||||
<?=mk_option($display['resize'], "1",_('Fixed'))?>
|
||||
</select>
|
||||
|
||||
_(Display device name)_:
|
||||
: <select name="raw">
|
||||
<?=mk_option($display['raw'], "",_('Normalized'))?>
|
||||
<?=mk_option($display['raw'], "1",_('Raw'))?>
|
||||
</select>
|
||||
|
||||
_(Display world-wide-name in device ID)_:
|
||||
: <select name="wwn">
|
||||
<?=mk_option($display['wwn'], "0",_('Disabled'))?>
|
||||
|
||||
@@ -25,6 +25,7 @@ hot="45"
|
||||
max="55"
|
||||
theme="white"
|
||||
locale=""
|
||||
raw=""
|
||||
[parity]
|
||||
mode="0"
|
||||
hour="0 0"
|
||||
|
||||
@@ -346,8 +346,7 @@ function cache_slots($off,$pool,$min,$slots) {
|
||||
return $out;
|
||||
}
|
||||
$crypto = false;
|
||||
$cache = cache_filter($disks);
|
||||
$pools = pools_filter($cache);
|
||||
$pools = pools_filter($disks);
|
||||
switch ($_POST['device']) {
|
||||
case 'array':
|
||||
$parity = parity_filter($disks);
|
||||
@@ -382,6 +381,7 @@ case 'flash':
|
||||
echo "</tr>";
|
||||
break;
|
||||
case 'cache':
|
||||
$cache = cache_filter($disks);
|
||||
foreach ($pools as $pool) {
|
||||
$tmp = "/var/tmp/$pool.log.tmp";
|
||||
foreach ($cache as $disk) if (prefix($disk['name'])==$pool) $crypto |= $disk['luksState']!=0 || vfs_luks($disk['fsType']);
|
||||
|
||||
@@ -53,7 +53,8 @@ function my_temp($value) {
|
||||
return is_numeric($value) ? (($unit=='F' ? round(9/5*$value+32) : str_replace('.', $number[0], $value))." $unit") : $value;
|
||||
}
|
||||
function my_disk($name) {
|
||||
return ucfirst(preg_replace('/(\d+)$/',' $1',$name));
|
||||
global $display;
|
||||
return $display['raw'] ? $name : ucfirst(preg_replace('/(\d+)$/',' $1',$name));
|
||||
}
|
||||
function my_disks($disk) {
|
||||
return strpos($disk['status'],'_NP')===false;
|
||||
|
||||
@@ -52,8 +52,8 @@ function my_lang($text,$do=0) {
|
||||
foreach ($keys as $key) if (isset($language[$key])) $text = preg_replace("/\b$key\b/",$language[$key],$text);
|
||||
break;
|
||||
case 3: // device translation
|
||||
[$p1,$p2] = explode(' ',$text);
|
||||
$text = rtrim(_($p1)." $p2");
|
||||
[$p1,$p2] = preg_split('/(?<=[a-z])(?= ?[0-9]+)/i',$text);
|
||||
$text = _($p1).$p2;
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user