all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 1/4] ui: tape: add EncryptionPanel to add/remove encryption keys
Date: Thu,  4 Feb 2021 13:56:29 +0100	[thread overview]
Message-ID: <20210204125632.16787-1-d.csapak@proxmox.com> (raw)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/Makefile                      |  2 +
 www/tape/EncryptionKeys.js        | 96 +++++++++++++++++++++++++++++++
 www/tape/TapeManagement.js        |  5 ++
 www/tape/window/EncryptionEdit.js | 52 +++++++++++++++++
 4 files changed, 155 insertions(+)
 create mode 100644 www/tape/EncryptionKeys.js
 create mode 100644 www/tape/window/EncryptionEdit.js

diff --git a/www/Makefile b/www/Makefile
index b24783ca..7ee79f8a 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -17,6 +17,7 @@ TAPE_UI_FILES=						\
 	tape/form/TapeDevicePathSelector.js		\
 	tape/window/ChangerEdit.js			\
 	tape/window/DriveEdit.js			\
+	tape/window/EncryptionEdit.js			\
 	tape/window/LabelMedia.js			\
 	tape/window/PoolEdit.js				\
 	tape/window/TapeBackup.js			\
@@ -25,6 +26,7 @@ TAPE_UI_FILES=						\
 	tape/ChangerConfig.js				\
 	tape/ChangerStatus.js				\
 	tape/DriveConfig.js				\
+	tape/EncryptionKeys.js				\
 	tape/PoolConfig.js				\
 	tape/TapeInventory.js				\
 	tape/TapeManagement.js				\
diff --git a/www/tape/EncryptionKeys.js b/www/tape/EncryptionKeys.js
new file mode 100644
index 00000000..6f2644d2
--- /dev/null
+++ b/www/tape/EncryptionKeys.js
@@ -0,0 +1,96 @@
+Ext.define('pbs-tape-encryption-keys', {
+    extend: 'Ext.data.Model',
+    fields: [
+	'fingerprint', 'hint', 'kdf', 'modified',
+	{
+	    name: 'created',
+	    type: 'date',
+	    dateFormat: 'timestamp',
+	},
+    ],
+    idProperty: 'fingerprint',
+});
+
+Ext.define('PBS.TapeManagement.EncryptionPanel', {
+    extend: 'Ext.grid.Panel',
+    alias: 'widget.pbsEncryptionKeys',
+
+    controller: {
+	xclass: 'Ext.app.ViewController',
+
+	onAdd: function() {
+	    let me = this;
+	    Ext.create('PBS.TapeManagement.EncryptionEditWindow', {
+		listeners: {
+		    destroy: function() {
+			me.reload();
+		    },
+		},
+	    }).show();
+	},
+
+	reload: function() {
+	    this.getView().getStore().rstore.load();
+	},
+
+	stopStore: function() {
+	    this.getView().getStore().rstore.stopUpdate();
+	},
+
+	startStore: function() {
+	    this.getView().getStore().rstore.startUpdate();
+	},
+    },
+
+    listeners: {
+	beforedestroy: 'stopStore',
+	deactivate: 'stopStore',
+	activate: 'startStore',
+    },
+
+    store: {
+	type: 'diff',
+	rstore: {
+	    type: 'update',
+	    storeid: 'proxmox-tape-encryption-keys',
+	    model: 'pbs-tape-encryption-keys',
+	    proxy: {
+		type: 'proxmox',
+		url: "/api2/json/config/tape-encryption-keys",
+	    },
+	},
+	sorters: 'hint',
+    },
+
+    tbar: [
+	{
+	    text: gettext('Add'),
+	    xtype: 'proxmoxButton',
+	    handler: 'onAdd',
+	    selModel: false,
+	},
+	'-',
+	{
+	    xtype: 'proxmoxStdRemoveButton',
+	    baseurl: '/api2/extjs/config/tape-encryption-keys',
+	    callback: 'reload',
+	},
+    ],
+    columns: [
+	{
+	    text: gettext('Hint'),
+	    dataIndex: 'hint',
+	    flex: 1,
+	},
+	{
+	    text: gettext('Fingerprint'),
+	    dataIndex: 'fingerprint',
+	    flex: 4,
+	},
+	{
+	    text: gettext('Created'),
+	    dataIndex: 'created',
+	    flex: 2,
+	},
+    ],
+});
diff --git a/www/tape/TapeManagement.js b/www/tape/TapeManagement.js
index e558620a..127c431b 100644
--- a/www/tape/TapeManagement.js
+++ b/www/tape/TapeManagement.js
@@ -41,5 +41,10 @@ Ext.define('PBS.TapeManagement', {
 	    itemId: 'pools',
 	    xtype: 'pbsMediaPoolPanel',
 	},
+	{
+	    title: gettext('Encryption Keys'),
+	    itemId: 'encryption-keys',
+	    xtype: 'pbsEncryptionKeys',
+	},
     ],
 });
diff --git a/www/tape/window/EncryptionEdit.js b/www/tape/window/EncryptionEdit.js
new file mode 100644
index 00000000..06d5ddc7
--- /dev/null
+++ b/www/tape/window/EncryptionEdit.js
@@ -0,0 +1,52 @@
+Ext.define('PBS.TapeManagement.EncryptionEditWindow', {
+    extend: 'Proxmox.window.Edit',
+    alias: 'widget.pbsEncryptionEditWindow',
+    mixins: ['Proxmox.Mixin.CBind'],
+
+    isCreate: true,
+    isAdd: true,
+    subject: gettext('Encryption Key'),
+    cbindData: function(initialConfig) {
+	let me = this;
+
+	let fingerprint = initialConfig.fingerprint;
+	let baseurl = '/api2/extjs/config/tape-encryption-keys';
+
+	me.isCreate = !fingerprint;
+	me.url = fingerprint ? `${baseurl}/${encodeURIComponent(fingerprint)}` : baseurl;
+	me.method = fingerprint ? 'PUT' : 'POST';
+
+	return { };
+    },
+
+    items: [
+	{
+	    fieldLabel: gettext('Hint'),
+	    name: 'hint',
+	    xtype: 'pmxDisplayEditField',
+	    renderer: Ext.htmlEncode,
+	    allowBlank: false,
+	    cbind: {
+		editable: '{isCreate}',
+	    },
+	},
+	{
+	    xtype: 'textfield',
+	    inputType: 'password',
+	    fieldLabel: gettext('Password'),
+	    name: 'password',
+	    minLength: 5,
+	    allowBlank: false,
+	},
+	{
+	    xtype: 'textfield',
+	    inputType: 'password',
+	    submitValue: false,
+	    fieldLabel: gettext('Confirm Password'),
+	    minLength: 5,
+	    vtype: 'password',
+	    initialPassField: 'password',
+	    allowBlank: false,
+	},
+    ],
+});
-- 
2.20.1





             reply	other threads:[~2021-02-04 12:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04 12:56 Dominik Csapak [this message]
2021-02-04 12:56 ` [pbs-devel] [PATCH proxmox-backup 2/4] ui: tape/PoolEdit: add selector for " Dominik Csapak
2021-02-04 12:56 ` [pbs-devel] [PATCH proxmox-backup 3/4] ui: tape/PoolConfig: add flex to columns Dominik Csapak
2021-02-04 12:56 ` [pbs-devel] [PATCH proxmox-backup 4/4] ui: tape/ChangerStatus: add 'is labeled' column for tapes Dominik Csapak
2021-02-04 16:43 ` [pbs-devel] applied: [PATCH proxmox-backup 1/4] ui: tape: add EncryptionPanel to add/remove encryption keys Dietmar Maurer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210204125632.16787-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal