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 C3850825A7 for ; Mon, 29 Nov 2021 15:40:14 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A4FFDB7FB for ; Mon, 29 Nov 2021 15:39:44 +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 id 170E3B7E8 for ; Mon, 29 Nov 2021 15:39:44 +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 E574C447CF for ; Mon, 29 Nov 2021 15:39:43 +0100 (CET) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Mon, 29 Nov 2021 15:39:40 +0100 Message-Id: <20211129143943.1598243-2-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211129143943.1598243-1-d.csapak@proxmox.com> References: <20211129143943.1598243-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.186 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: [pbs-devel] [PATCH proxmox-backup v2 1/4] ui: add GroupSelector X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Nov 2021 14:40:14 -0000 to select either a group from a datastore for now it is expected to set the data in the store manually Signed-off-by: Dominik Csapak --- www/Makefile | 1 + www/form/GroupSelector.js | 54 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 www/form/GroupSelector.js diff --git a/www/Makefile b/www/Makefile index 616c3e12..c975387c 100644 --- a/www/Makefile +++ b/www/Makefile @@ -42,6 +42,7 @@ JSSRC= \ form/DataStoreSelector.js \ form/CalendarEvent.js \ form/PermissionPathSelector.js \ + form/GroupSelector.js \ data/RunningTasksStore.js \ button/TaskButton.js \ config/UserView.js \ diff --git a/www/form/GroupSelector.js b/www/form/GroupSelector.js new file mode 100644 index 00000000..4bf51104 --- /dev/null +++ b/www/form/GroupSelector.js @@ -0,0 +1,54 @@ +Ext.define('pbs-groups', { + extend: 'Ext.data.Model', + fields: [ + 'backup-type', + 'backup-id', + { + name: 'group', + type: 'string', + convert: function(value, record) { + if (record.data['backup-type'] && record.data['backup-id']) { + return `${record.data['backup-type']}/${record.data['backup-id']}`; + } + return value; + }, + }, + ], + proxy: { + type: 'proxmox', + }, +}); + +Ext.define('PBS.form.GroupSelector', { + extend: 'Proxmox.form.ComboGrid', + alias: 'widget.pbsGroupSelector', + + allowBlank: false, + autoSelect: false, + notFoundIsValid: true, + editable: true, + valueField: 'group', + displayField: 'group', + + store: { + sorters: 'group', + model: 'pbs-groups', + }, + + listConfig: { + minHeight: 80, + emptyText: gettext('No Groups'), + viewConfig: { + deferEmptyText: false, + }, + columns: [ + { + header: gettext('Group'), + sortable: true, + dataIndex: 'group', + renderer: Ext.String.htmlEncode, + flex: 1, + }, + ], + }, +}); -- 2.30.2