mirror of
https://github.com/unraid/webgui.git
synced 2026-02-18 15:08:53 -06:00
Refactor: Simplify footer structure and encapsulate array status logic in a new function for improved readability and maintainability.
This commit is contained in:
@@ -861,25 +861,52 @@ unset($pages,$page,$pgs,$pg,$icon,$nchan,$running,$start,$stop,$row,$script,$opt
|
||||
<?
|
||||
// Build footer
|
||||
annotate('Footer');
|
||||
echo '<div id="footer"><span id="statusraid"><span id="statusbar">';
|
||||
$progress = (_var($var,'fsProgress')!='') ? "•<span class='blue strong tour'>{$var['fsProgress']}</span>" : "";
|
||||
switch (_var($var,'fsState')) {
|
||||
case 'Stopped':
|
||||
echo "<span class='red strong'><i class='fa fa-stop-circle'></i> ",_('Array Stopped'),"</span>$progress"; break;
|
||||
case 'Starting':
|
||||
echo "<span class='orange strong'><i class='fa fa-pause-circle'></i> ",_('Array Starting'),"</span>$progress"; break;
|
||||
case 'Stopping':
|
||||
echo "<span class='orange strong'><i class='fa fa-pause-circle'></i> ",_('Array Stopping'),"</span>$progress"; break;
|
||||
default:
|
||||
echo "<span class='green strong'><i class='fa fa-play-circle'></i> ",_('Array Started'),"</span>$progress"; break;
|
||||
|
||||
function getArrayStatus($var) {
|
||||
$progress = (_var($var,'fsProgress')!='') ? "•<span class='blue strong tour'>{$var['fsProgress']}</span>" : "";
|
||||
|
||||
$statusMap = [
|
||||
'Stopped' => ['class' => 'red', 'icon' => 'stop-circle', 'text' => _('Array Stopped')],
|
||||
'Starting' => ['class' => 'orange', 'icon' => 'pause-circle', 'text' => _('Array Starting')],
|
||||
'Stopping' => ['class' => 'orange', 'icon' => 'pause-circle', 'text' => _('Array Stopping')],
|
||||
'default' => ['class' => 'green', 'icon' => 'play-circle', 'text' => _('Array Started')]
|
||||
];
|
||||
|
||||
$state = _var($var,'fsState');
|
||||
$status = $statusMap[$state] ?? $statusMap['default'];
|
||||
|
||||
return sprintf(
|
||||
"<span class='%s strong'><i class='fa fa-%s'></i> %s</span>%s",
|
||||
$status['class'],
|
||||
$status['icon'],
|
||||
$status['text'],
|
||||
$progress
|
||||
);
|
||||
}
|
||||
echo "</span></span><span id='countdown'></span><span id='user-notice' class='red-text'></span>";
|
||||
if ($wlan0) echo "<span id='wlan0' class='grey-text' onclick='wlanSettings()'><i class='fa fa-wifi fa-fw'></i></span>";
|
||||
echo "<span id='copyright'>Unraid® webGui ©2024, Lime Technology, Inc.";
|
||||
echo " <a href='https://docs.unraid.net/go/manual/' target='_blank' title=\""._('Online manual')."\"><i class='fa fa-book'></i> "._('manual')."</a>";
|
||||
echo "<unraid-theme-switcher current='$theme' themes='".htmlspecialchars(json_encode(['azure', 'gray', 'black', 'white']), ENT_QUOTES, 'UTF-8')."'></unraid-theme-switcher>";
|
||||
echo "</span></div>";
|
||||
|
||||
?>
|
||||
<footer id="footer">
|
||||
<span id="statusraid">
|
||||
<span id="statusbar"><?= getArrayStatus($var) ?></span>
|
||||
</span>
|
||||
<span id="user-notice" class="red-text"></span>
|
||||
<?php if ($wlan0): ?>
|
||||
<span id="wlan0" class="grey-text" onclick="wlanSettings()">
|
||||
<i class="fa fa-wifi fa-fw"></i>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<span id="copyright">
|
||||
Unraid® webGui ©2024, Lime Technology, Inc.
|
||||
<a href="https://docs.unraid.net/go/manual/" target="_blank" title="<?=_('Online manual')?>">
|
||||
<i class="fa fa-book"></i> <?=_('manual')?>
|
||||
</a>
|
||||
<unraid-theme-switcher
|
||||
current="<?=$theme?>"
|
||||
themes='<?=htmlspecialchars(json_encode(['azure', 'gray', 'black', 'white']), ENT_QUOTES, 'UTF-8')?>'>
|
||||
</unraid-theme-switcher>
|
||||
</span>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
// Firefox specific workaround, not needed anymore in firefox version 100 and higher
|
||||
//if (typeof InstallTrigger!=='undefined') $('#nav-block').addClass('mozilla');
|
||||
|
||||
Reference in New Issue
Block a user