]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
theme edit: ensure that the saved theme is actually valid
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 24 Mar 2023 10:40:43 +0000 (11:40 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 24 Mar 2023 11:24:02 +0000 (12:24 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/window/ThemeEdit.js

index 8c5f134deb75dbe169c0fab9632db55dcf50c8a4..872f03bec21879d9c1ebb0e69b72939bee5ae21b 100644 (file)
@@ -4,14 +4,17 @@ Ext.define('Proxmox.window.ThemeEditWindow', {
 
     viewModel: {
        parent: null,
-       data: {
-           language: '__default__',
-       },
+       data: {},
     },
     controller: {
        xclass: 'Ext.app.ViewController',
        init: function(view) {
-           let theme = Ext.util.Cookies.get(view.cookieName) || '__default__';
+           let theme = '__default__';
+
+           let savedTheme = Ext.util.Cookies.get(view.cookieName);
+           if (savedTheme && savedTheme in Proxmox.Utils.theme_map) {
+               theme = savedTheme;
+           }
            this.getViewModel().set('theme', theme);
        },
        applyTheme: function(button) {