Display message and disable add share button if there are no mountable array disks.

This commit is contained in:
dlandon
2024-05-08 09:59:41 -05:00
parent dac9d237ee
commit 9a76f69f5d
3 changed files with 15 additions and 3 deletions
+6 -1
View File
@@ -15,6 +15,11 @@ Cond="_var($var,'fsState')!='Stopped' && _var($var,'shareUser')=='e'"
* all copies or substantial portions of the Software.
*/
?>
<?
/* Are there any array disks? */
$nodisks = empty(parse_ini_file('state/disks.ini',true)) ? "disabled" : "";
?>
<table class="unraid share_status">
<thead><tr><td>_(Name)_</td><td>_(Comment)_</td><td>_(SMB)_</td><td>_(NFS)_</td><td>_(Storage)_</td><td>_(Size)_</td><td>_(Free)_</td></tr></thead>
<tbody id="shareslist"></tbody>
@@ -22,7 +27,7 @@ Cond="_var($var,'fsState')!='Stopped' && _var($var,'shareUser')=='e'"
<form name="share_form" method="POST" action="<?=htmlspecialchars($path)?>/Share?name=">
<input type="button" id="compute-shares" value="_(Compute All)_" onclick="$(this).prop('disabled',true);shareList('',-1)">
<input type="submit" value="_(Add Share)_">
<input type="submit" value="_(Add Share)_" <?echo $nodisks;?>>
<input type="button" value="_(Clean Up)_" onclick="cleanup()" id="cleanup-button" disabled>
</form>
+5 -2
View File
@@ -28,10 +28,13 @@ $var = parse_ini_file('state/var.ini');
$sec = parse_ini_file('state/sec.ini',true);
$sec_nfs = parse_ini_file('state/sec_nfs.ini',true);
// exit when no disks
$nodisks = "<tr><td class='empty' colspan='7'><i class='fa fa-folder-open-o icon'></i>"._('There are no exportable disk shares')."</td></tr>";
// exit when no mountable array disks
$nodisks = "<tr><td class='empty' colspan='7'><strong>"._('There are no mountable array or pool disks - cannot add shares').".</strong></td></tr>";
if (!$disks) die($nodisks);
// No shared disks
$nodisks = "<tr><td class='empty' colspan='7'><i class='fa fa-folder-open-o icon'></i>"._('There are no exportable disk shares')."</td></tr>";
// GUI settings
extract(parse_plugin_cfg('dynamix',true));
@@ -46,6 +46,10 @@ $var = parse_ini_file('state/var.ini');
$sec = parse_ini_file('state/sec.ini',true);
$sec_nfs = parse_ini_file('state/sec_nfs.ini',true);
// exit when no mountable array disks
$nodisks = "<tr><td class='empty' colspan='7'><strong>"._('There are no mountable array or pool disks - cannot add shares').".</strong></td></tr>";
if (!$disks) die($nodisks);
// exit when no shares
$noshares = "<tr><td class='empty' colspan='7'><i class='fa fa-folder-open-o icon'></i>"._('There are no exportable user shares')."</td></tr>";
if (!$shares) die($noshares);