From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <d.csapak@proxmox.com>
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 A7CB26D166
 for <pbs-devel@lists.proxmox.com>; Thu,  4 Feb 2021 13:56:34 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id A5C4D24177
 for <pbs-devel@lists.proxmox.com>; Thu,  4 Feb 2021 13:56:34 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [212.186.127.180])
 (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 9FD0C2415E
 for <pbs-devel@lists.proxmox.com>; Thu,  4 Feb 2021 13:56:33 +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 681ED461E7
 for <pbs-devel@lists.proxmox.com>; Thu,  4 Feb 2021 13:56:33 +0100 (CET)
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Date: Thu,  4 Feb 2021 13:56:30 +0100
Message-Id: <20210204125632.16787-2-d.csapak@proxmox.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20210204125632.16787-1-d.csapak@proxmox.com>
References: <20210204125632.16787-1-d.csapak@proxmox.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.236 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_DNSWL_MED        -2.3 Sender listed at https://www.dnswl.org/,
 medium trust
 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 2/4] ui: tape/PoolEdit: add
 selector for encryption keys
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 04 Feb 2021 12:56:34 -0000

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/Makefile                 |  1 +
 www/tape/form/KeySelector.js | 38 ++++++++++++++++++++++++++++++++++++
 www/tape/window/PoolEdit.js  | 11 +++++++++++
 3 files changed, 50 insertions(+)
 create mode 100644 www/tape/form/KeySelector.js

diff --git a/www/Makefile b/www/Makefile
index 7ee79f8a..8391e68f 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -15,6 +15,7 @@ TAPE_UI_FILES=						\
 	tape/form/PoolSelector.js			\
 	tape/form/RetentionSelector.js			\
 	tape/form/TapeDevicePathSelector.js		\
+	tape/form/KeySelector.js			\
 	tape/window/ChangerEdit.js			\
 	tape/window/DriveEdit.js			\
 	tape/window/EncryptionEdit.js			\
diff --git a/www/tape/form/KeySelector.js b/www/tape/form/KeySelector.js
new file mode 100644
index 00000000..8a461a7b
--- /dev/null
+++ b/www/tape/form/KeySelector.js
@@ -0,0 +1,38 @@
+Ext.define('PBS.form.TapeKeySelector', {
+    extend: 'Proxmox.form.ComboGrid',
+    alias: 'widget.pbsTapeKeySelector',
+
+    allowBlank: false,
+    displayField: 'hint',
+    valueField: 'fingerprint',
+    value: null,
+    multiSelect: false,
+
+
+    store: {
+	proxy: {
+	    type: 'proxmox',
+	    url: '/api2/json/config/tape-encryption-keys',
+	},
+	autoLoad: true,
+	sorter: 'hint',
+    },
+
+    listConfig: {
+	columns: [
+	    {
+		text: gettext('Hint'),
+		dataIndex: 'hint',
+		sortable: true,
+		flex: 1,
+		renderer: Ext.String.htmlEncode,
+	    },
+	    {
+		text: gettext('Fingerprint'),
+		sortable: true,
+		dataIndex: 'fingerprint',
+		flex: 5,
+	    },
+	],
+    },
+});
diff --git a/www/tape/window/PoolEdit.js b/www/tape/window/PoolEdit.js
index 4ab13530..6f91d25e 100644
--- a/www/tape/window/PoolEdit.js
+++ b/www/tape/window/PoolEdit.js
@@ -52,6 +52,17 @@ Ext.define('PBS.TapeManagement.PoolEditWindow', {
 		deleteEmpty: '{!isCreate}',
 	    },
 	},
+	{
+	    fieldLabel: gettext('Encryption Key'),
+	    xtype: 'pbsTapeKeySelector',
+	    name: 'encrypt',
+	    allowBlank: true,
+	    skipEmptyText: true,
+	    autoSelect: false,
+	    cbind: {
+		deleteEmpty: '{!isCreate}',
+	    },
+	},
     ],
 });
 
-- 
2.20.1