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',
fieldLabel: gettext('Mode'),
renderer: function(value) {
let msg;
switch (value) {
case 'snapshot':
msg = gettext('Snapshot');
break;
case 'suspend':
msg = gettext('Suspend');
break;
case 'stop':
msg = gettext('Stop');
break;
}
return msg;
const modeToDisplay = {
snapshot: gettext('Snapshot'),
stop: gettext('Stop'),
suspend: gettext('Snapshot'),
};
return modeToDisplay[value] ?? gettext('Unknown');
},
},
{