]> git.proxmox.com Git - pve-manager-legacy.git/commitdiff
ui: backup info: avoid clunky switch for simple mapping
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 19 Jan 2023 15:16:49 +0000 (16:16 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 19 Jan 2023 15:16:49 +0000 (16:16 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/manager6/dc/BackupJobDetail.js

index f1b7a0890bc782d5f0242ce01f4a25525f9819e0..0141151cc27e2906f80299d0c84ca48fdf9c7316 100644 (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');
            },
        },
        {