From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 27DF21FF38E for ; Tue, 14 May 2024 12:55:53 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 654365805; Tue, 14 May 2024 12:55:27 +0200 (CEST) From: Markus Frank To: pve-devel@lists.proxmox.com Date: Tue, 14 May 2024 12:54:41 +0200 Message-Id: <20240514105442.1187746-11-m.frank@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240514105442.1187746-1-m.frank@proxmox.com> References: <20240514105442.1187746-1-m.frank@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.028 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy 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 v10 10/11] ui: form: add DIRMapSelector 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: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Signed-off-by: Markus Frank --- www/manager6/Makefile | 1 + www/manager6/form/DirMapSelector.js | 63 +++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 www/manager6/form/DirMapSelector.js diff --git a/www/manager6/Makefile b/www/manager6/Makefile index 5a3541e0..cac8cd02 100644 --- a/www/manager6/Makefile +++ b/www/manager6/Makefile @@ -35,6 +35,7 @@ JSSRC= \ form/ContentTypeSelector.js \ form/ControllerSelector.js \ form/DayOfWeekSelector.js \ + form/DirMapSelector.js \ form/DiskFormatSelector.js \ form/DiskStorageSelector.js \ form/FileSelector.js \ diff --git a/www/manager6/form/DirMapSelector.js b/www/manager6/form/DirMapSelector.js new file mode 100644 index 00000000..473a2ffe --- /dev/null +++ b/www/manager6/form/DirMapSelector.js @@ -0,0 +1,63 @@ +Ext.define('PVE.form.DirMapSelector', { + extend: 'Proxmox.form.ComboGrid', + alias: 'widget.pveDirMapSelector', + + store: { + fields: ['name', 'path'], + filterOnLoad: true, + sorters: [ + { + property: 'id', + direction: 'ASC', + }, + ], + }, + + allowBlank: false, + autoSelect: false, + displayField: 'id', + valueField: 'id', + + listConfig: { + columns: [ + { + header: gettext('Directory ID'), + dataIndex: 'id', + flex: 1, + }, + { + header: gettext('Comment'), + dataIndex: 'description', + flex: 1, + }, + ], + }, + + setNodename: function(nodename) { + var me = this; + + if (!nodename || me.nodename === nodename) { + return; + } + + me.nodename = nodename; + + me.store.setProxy({ + type: 'proxmox', + url: `/api2/json/cluster/mapping/dir?check-node=${nodename}`, + }); + + me.store.load(); + }, + + initComponent: function() { + var me = this; + + var nodename = me.nodename; + me.nodename = undefined; + + me.callParent(); + + me.setNodename(nodename); + }, +}); -- 2.39.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel