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 628491FF16F for ; Fri, 15 Nov 2024 15:02:18 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BED8A15AAE; Fri, 15 Nov 2024 15:01:35 +0100 (CET) From: Markus Frank To: pve-devel@lists.proxmox.com Date: Fri, 15 Nov 2024 15:00:36 +0100 Message-Id: <20241115140037.191682-12-m.frank@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241115140037.191682-1-m.frank@proxmox.com> References: <20241115140037.191682-1-m.frank@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.023 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 v12 11/12] ui: form: add selector for directory mappings 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 281c206a..72f1381c 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.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel