ui: backup info: avoid clunky switch for simple mapping

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2023-01-19 16:16:49 +01:00
parent 4c1fe169b4
commit 3d5b3eb6b6

View File

@ -228,19 +228,12 @@ Ext.define('PVE.dc.BackupInfo', {
name: 'mode', name: 'mode',
fieldLabel: gettext('Mode'), fieldLabel: gettext('Mode'),
renderer: function(value) { renderer: function(value) {
let msg; const modeToDisplay = {
switch (value) { snapshot: gettext('Snapshot'),
case 'snapshot': stop: gettext('Stop'),
msg = gettext('Snapshot'); suspend: gettext('Snapshot'),
break; };
case 'suspend': return modeToDisplay[value] ?? gettext('Unknown');
msg = gettext('Suspend');
break;
case 'stop':
msg = gettext('Stop');
break;
}
return msg;
}, },
}, },
{ {