['vmm-running', gettext('Running')],
'stopped' => ['vmm-stopped', gettext('Stopped')],
'suspended' => ['vmm-suspended', gettext('Suspended')],
'starting' => ['vmm-starting', gettext('Starting')],
'locked' => ['vmm-locked', gettext('Locked')],
];
[$cls, $label] = $map[$state] ?? ['vmm-unknown', ucfirst($state)];
return sprintf('%s', $cls, htmlspecialchars($label));
}
function vmm_h(string $s): string
{
return htmlspecialchars($s, ENT_QUOTES, 'UTF-8');
}
function vmm_source_label(array $p): string
{
$icon = match ($p['source']) {
'system' => '🖥',
'bundle' => '📦',
default => 'âš ',
};
return sprintf('%s %s', $icon, $p['source']);
}
}
if (!function_exists('vmm_css')) {
/**
* Theme-aware styles: no hardcoded dark panels — colours derive from the
* XigmaNAS theme variables, so light and dark themes both stay readable.
*/
function vmm_css(): void
{
?>