fix(webui): render App-Updater tasks as standard tasks in the panel

updater_check/apply/apply_all/rollback tasks fell through every per-type
branch of the Tasks panel, so they showed the generic custom gear icon, a
raw/truncated command title, and (for the app:'updater' sentinel) a broken
hidden app icon. Wired them in like every other task type:

- tasks-format.js formatCommandForUser PATTERNS: added the 'libreportal updater'
  command rows (Apps - Check for Updates / Update All / <App> - Update /
  <App> - Roll Back) — only the *self*-update 'libreportal update' was mapped.
- tasks-format.js formatActionTitle: added the updater_* short labels.
- tasks-list-render.js getTaskTypeIcon: updater_check 🔍 / apply ⬆️ /
  apply_all ⬆️ / rollback ↩️ (reusing existing verify/update/restore classes).
- tasks-list-render.js renderTaskIcons: treat app:'updater' as a sentinel like
  app:'system' so updater_check/apply_all fall back to the LibrePortal logo
  instead of a 404'd /core/icons/apps/updater.svg (apply/rollback keep their
  real app icon).

node --check clean.

Signed-off-by: librelad <librelad@digitalangels.vip>
This commit is contained in:
librelad 2026-05-31 02:53:57 +01:00
parent babedd08b3
commit 4e18a6ff42
2 changed files with 18 additions and 4 deletions

View File

@ -24,6 +24,12 @@ Object.assign(TasksManager.prototype, {
{ match: /^libreportal update (apply|now)\b/, title: 'LibrePortal - Update' },
{ match: /^libreportal update check\b/, title: 'LibrePortal - Check for Updates' },
// -- App updater (per-app updates + CVE scan; snapshots before applying)
{ match: /^libreportal updater check\b/, title: 'Apps - Check for Updates' },
{ match: /^libreportal updater apply-all\b/, title: 'Apps - Update All' },
{ match: /^libreportal updater apply (\S+)/, title: (m) => `${displayName(m[1])} - Update` },
{ match: /^libreportal updater rollback (\S+)/, title: (m) => `${displayName(m[1])} - Roll Back` },
// -- Peers -------------------------------------------------------------
{ match: /^libreportal peer add\b/, title: 'LibrePortal - Add Peer' },
{ match: /^libreportal peer remove\b/, title: 'LibrePortal - Remove Peer' },
@ -130,6 +136,8 @@ Object.assign(TasksManager.prototype, {
'config_update': 'Update Config', 'update_config': 'Update Config',
'system_update': 'Update System', 'system_reclaim': 'Reclaim Space',
'system_image_rm': 'Remove Images', 'verify': 'Verify System',
'updater_check': 'Check for Updates', 'updater_apply': 'Update',
'updater_apply_all': 'Update All', 'updater_rollback': 'Roll Back',
'setup-config': 'Apply Configuration',
'setup-finalize': 'Finalize Setup'
};

View File

@ -256,10 +256,12 @@ Object.assign(TasksManager.prototype, {
},
renderTaskIcons(task) {
const typeIcon = `<span class="task-type-icon">${this.getTaskTypeIcon(task).icon}</span>`;
// `app: 'system'` is a category sentinel (config_update, system_update, …),
// not a real app slug, so it has no /core/icons/apps/system.svg — fall through
// to the LibrePortal-system branch so those tasks still get a logo.
const isSystemSentinel = task.app === 'system';
// `app: 'system'` and `app: 'updater'` are category sentinels (config_update,
// system_update, updater_check/apply_all, …), not real app slugs, so they have
// no /core/icons/apps/<x>.svg — fall through to the LibrePortal-system branch
// so those tasks still get a logo. (updater_apply/rollback carry a real app
// slug and keep their own app icon.)
const isSystemSentinel = task.app === 'system' || task.app === 'updater';
if (task.app && !isSystemSentinel) {
const appIconPath = this.getAppIconPath(task);
return `${typeIcon}<img src="${appIconPath}" alt="${task.app}" class="task-app-icon" onerror="this.style.display='none'">`;
@ -307,6 +309,10 @@ Object.assign(TasksManager.prototype, {
'verify': { icon: '🛡️', class: 'verify' },
'setup-config': { icon: '🛠️', class: 'setup' },
'setup-finalize': { icon: '🎉', class: 'setup' },
'updater_check': { icon: '🔍', class: 'verify' },
'updater_apply': { icon: '⬆️', class: 'update' },
'updater_apply_all': { icon: '⬆️', class: 'update' },
'updater_rollback': { icon: '↩️', class: 'restore' },
'custom': { icon: '⚙️', class: 'custom' }
};