return data;
},
+ theme_map: {
+ auto: 'auto',
+ "proxmox-dark": 'Proxmox Dark',
+ },
+
+ render_theme: function(value) {
+ if (!value || value === '__default__') {
+ return Proxmox.Utils.defaultText + ' (Light theme)';
+ }
+ let text = Proxmox.Utils.theme_map[value];
+ if (text) {
+ return text;
+ }
+ return value;
+ },
+
+ theme_array: function() {
+ let data = [['__default__', Proxmox.Utils.render_theme('')]];
+ Ext.Object.each(Proxmox.Utils.theme_map, function(key, value) {
+ data.push([key, Proxmox.Utils.render_theme(value)]);
+ });
+
+ return data;
+ },
+
bond_mode_gettext_map: {
'802.3ad': 'LACP (802.3ad)',
'lacp-balance-slb': 'LACP (balance-slb)',
--- /dev/null
+Ext.define('Proxmox.form.ThemeSelector', {
+ extend: 'Proxmox.form.KVComboBox',
+ xtype: 'proxmoxThemeSelector',
+
+ comboItems: Proxmox.Utils.theme_array(),
+});
--- /dev/null
+Ext.define('Proxmox.window.ThemeEditWindow', {
+ extend: 'Ext.window.Window',
+ alias: 'widget.pmxThemeEditWindow',
+
+ viewModel: {
+ parent: null,
+ data: {
+ language: '__default__',
+ },
+ },
+ controller: {
+ xclass: 'Ext.app.ViewController',
+ init: function(view) {
+ let theme = Ext.util.Cookies.get(view.cookieName) || '__default__';
+ this.getViewModel().set('theme', theme);
+ },
+ applyTheme: function(button) {
+ let view = this.getView();
+ let vm = this.getViewModel();
+
+ let expire = Ext.Date.add(new Date(), Ext.Date.YEAR, 10);
+ Ext.util.Cookies.set(view.cookieName, vm.get('theme'), expire);
+ view.mask(gettext('Please wait...'), 'x-mask-loading');
+ window.location.reload();
+ },
+ },
+
+ cookieName: 'PVEThemeCookie',
+
+ title: gettext('Theme'),
+ modal: true,
+ bodyPadding: 10,
+ resizable: false,
+ items: [
+ {
+ xtype: 'proxmoxThemeSelector',
+ fieldLabel: gettext('Theme'),
+ bind: {
+ value: '{theme}',
+ },
+ },
+ ],
+ buttons: [
+ {
+ text: gettext('Apply'),
+ handler: 'applyTheme',
+ },
+ ],
+});