refactor: shares, docker, and vm pages - move away from echoing full HTML

This commit is contained in:
Zack Spear
2025-05-07 15:54:43 -07:00
parent ad342e68b6
commit 091675054e
3 changed files with 40 additions and 16 deletions

View File

@@ -18,9 +18,14 @@ Cond="exec(\"grep -o '^DOCKER_ENABLED=.yes' /boot/config/docker.cfg 2>/dev/null\
*/
?>
<?
if ($var['fsState'] != 'Started') {
echo "<div class='notice shift'>_(Array must be **Started** to view Docker containers)_.</div>";
} elseif (!is_file('/var/run/dockerd.pid') || (!is_dir('/proc/'.@file_get_contents('/var/run/dockerd.pid')))) {
echo "<div class='notice shift'>_(Docker Service failed to start)_.</div>";
}
$noticeMessage = null;
if ($var['fsState'] != 'Started') {
$noticeMessage = _('Array must be **Started** to view Docker containers');
} elseif (!is_file('/var/run/dockerd.pid') || (!is_dir('/proc/'.@file_get_contents('/var/run/dockerd.pid')))) {
$noticeMessage = _('Docker Service failed to start');
}
?>
<? if ($noticeMessage): ?>
<p class="notice"><?= $noticeMessage ?></p>
<? endif; ?>

View File

@@ -18,10 +18,19 @@ Cond="exec(\"grep -o '^SERVICE=.enable' /boot/config/domain.cfg 2>/dev/null\")"
*/
?>
<?
if ($var['fsState'] != "Started") {
echo "<div class='notice shift'>"._('Array must be **started** to view Virtual Machines').".</div>";
} elseif (!is_file('/var/run/libvirt/libvirtd.pid') || (!is_dir('/proc/'.@file_get_contents('/var/run/libvirt/libvirtd.pid')))) {
echo "<div class='notice shift'>"._('Libvirt Service failed to start').".</div>";
$noticeMessage = null;
if ($var['fsState'] != "Started") {
$noticeMessage = _('Array must be **started** to view Virtual Machines');
} elseif (!is_file('/var/run/libvirt/libvirtd.pid') || (!is_dir('/proc/'.@file_get_contents('/var/run/libvirt/libvirtd.pid')))) {
$noticeMessage = _('Libvirt Service failed to start');
}
?>
<? if ($noticeMessage): ?>
<p class="notice"><?= $noticeMessage ?></p>
<? endif; ?>
<?
if (count($pages) == 2) {
$tabbed = false;
}
if (count($pages)==2) $tabbed = false;
?>

View File

@@ -2,10 +2,20 @@ Menu="Tasks:2"
Type="xmenu"
Code="e92a"
---
<?PHP
if ($var['fsState']=="Stopped") {
echo "<p class='notice shift'>"._('Array must be **Started** to view Shares').".</p>";
return;
}
if (count($pages)==2) $tabbed = false;
<?
$noticeMessage = null;
if ($var['fsState'] == "Stopped") {
$noticeMessage = _('Array must be **Started** to view Shares');
}
?>
<? if ($noticeMessage): ?>
<p class="notice"><?= $noticeMessage ?></p>
<? return; ?>
<? endif; ?>
<?
if (count($pages) == 2) {
$tabbed = false;
}
?>