From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 3651793ADC for ; Wed, 22 Feb 2023 08:51:56 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 16693BC5C for ; Wed, 22 Feb 2023 08:51:56 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 22 Feb 2023 08:51:54 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 17C5E480B9 for ; Wed, 22 Feb 2023 08:51:54 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Wed, 22 Feb 2023 08:51:51 +0100 Message-Id: <20230222075152.982943-6-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230222075152.982943-1-d.csapak@proxmox.com> References: <20230222075152.982943-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.062 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH manager v3 5/6] ui: add window for changing tree related options X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2023 07:51:56 -0000 such as the sorting/grouping of guests. saves them in the browser local storage under 'pve-tree-sorting' adds a button for it next to the the view selector Signed-off-by: Dominik Csapak --- www/manager6/Makefile | 1 + www/manager6/Workspace.js | 27 +++++++- www/manager6/window/TreeSettingsEdit.js | 87 +++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 www/manager6/window/TreeSettingsEdit.js diff --git a/www/manager6/Makefile b/www/manager6/Makefile index 2c487655f..b73b729ad 100644 --- a/www/manager6/Makefile +++ b/www/manager6/Makefile @@ -119,6 +119,7 @@ JSSRC= \ window/ScheduleSimulator.js \ window/Wizard.js \ window/GuestDiskReassign.js \ + window/TreeSettingsEdit.js \ ha/Fencing.js \ ha/GroupEdit.js \ ha/GroupSelector.js \ diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js index a3872b560..a2fbc0be9 100644 --- a/www/manager6/Workspace.js +++ b/www/manager6/Workspace.js @@ -223,7 +223,10 @@ Ext.define('PVE.StdWorkspace', { let appState = Ext.create('PVE.StateProvider'); Ext.state.Manager.setProvider(appState); - let selview = Ext.create('PVE.form.ViewSelector'); + let selview = Ext.create('PVE.form.ViewSelector', { + flex: 1, + padding: '0 5 0 0', + }); let rtree = Ext.createWidget('pveResourceTree', { viewFilter: selview.getViewFilter(), @@ -449,7 +452,27 @@ Ext.define('PVE.StdWorkspace', { margin: '0 0 0 5', split: true, width: 300, - items: [selview, rtree], + items: [ + { + xtype: 'container', + layout: 'hbox', + padding: '0 0 5 0', + items: [ + selview, + { + xtype: 'button', + iconCls: 'fa fa-fw fa-gear', + handler: () => { + Ext.create('PVE.window.TreeSettingsEdit', { + autoShow: true, + apiCallDone: () => PVE.UIOptions.fireUIConfigChanged(), + }); + }, + }, + ], + }, + rtree, + ], listeners: { resize: function(panel, width, height) { var viewWidth = me.getSize().width; diff --git a/www/manager6/window/TreeSettingsEdit.js b/www/manager6/window/TreeSettingsEdit.js new file mode 100644 index 000000000..8f9b10b17 --- /dev/null +++ b/www/manager6/window/TreeSettingsEdit.js @@ -0,0 +1,87 @@ +Ext.define('PVE.window.TreeSettingsEdit', { + extend: 'Proxmox.window.Edit', + alias: 'widget.pveTreeSettingsEdit', + + title: gettext('Tree Settings'), + + isCreate: false, + + // we don't want an url, we override submit(), but it is needed by the parent class + url: 'bogus', + + fieldDefaults: { + labelWidth: 120, + }, + + items: [ + { + xtype: 'inputpanel', + items: [ + { + xtype: 'proxmoxKVComboBox', + name: 'sort-field', + fieldLabel: gettext('Sort Field'), + comboItems: [ + ['__default__', `${Proxmox.Utils.defaultText} (VMID)`], + ['vmid', 'VMID'], + ['name', gettext('Name')], + ], + defaultValue: '__default__', + value: '__default__', + deleteEmpty: false, + }, + { + xtype: 'proxmoxKVComboBox', + name: 'group-templates', + fieldLabel: gettext('Group Templates'), + comboItems: [ + ['__default__', `${Proxmox.Utils.defaultText} (${gettext("Yes")})`], + [1, gettext('Yes')], + [0, gettext('No')], + ], + defaultValue: '__default__', + value: '__default__', + deleteEmpty: false, + }, + { + xtype: 'proxmoxKVComboBox', + name: 'group-guest-types', + fieldLabel: gettext('Group Types'), + comboItems: [ + ['__default__', `${Proxmox.Utils.defaultText} (${gettext("Yes")})`], + [1, gettext('Yes')], + [0, gettext('No')], + ], + defaultValue: '__default__', + value: '__default__', + deleteEmpty: false, + }, + { + xtype: 'displayfield', + userCls: 'pmx-hint', + value: gettext('Settings are saved in the local storage of the browser'), + }, + ], + }, + ], + + submit: function() { + let me = this; + + let localStorage = Ext.state.Manager.getProvider(); + localStorage.set('pve-tree-sorting', me.down('inputpanel').getValues() || null); + + me.apiCallDone(); + me.close(); + }, + + initComponent: function() { + let me = this; + + me.callParent(); + + let localStorage = Ext.state.Manager.getProvider(); + me.down('inputpanel').setValues(localStorage.get('pve-tree-sorting')); + }, + +}); -- 2.30.2