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 5/5] ui: tape: add remove media button
Date: Thu, 11 Jan 2024 11:40:36 +0100	[thread overview]
Message-ID: <20240111104036.3341854-6-d.csapak@proxmox.com> (raw)
In-Reply-To: <20240111104036.3341854-1-d.csapak@proxmox.com>

this only removes media from the inventory, it does not touch the data

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
not super sure about the modal dialog, if we should expose 'force' at
all, and if we maybe should word it differently and/or add a hint
with a deeper explanation...

 www/Makefile                         |  1 +
 www/tape/TapeInventory.js            | 27 ++++++++++++
 www/tape/window/MediaRemoveWindow.js | 66 ++++++++++++++++++++++++++++
 3 files changed, 94 insertions(+)
 create mode 100644 www/tape/window/MediaRemoveWindow.js

diff --git a/www/Makefile b/www/Makefile
index be7e27ab..c2755ac8 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -21,6 +21,7 @@ TAPE_UI_FILES=						\
 	tape/window/Erase.js				\
 	tape/window/EncryptionEdit.js			\
 	tape/window/LabelMedia.js			\
+	tape/window/MediaRemoveWindow.js		\
 	tape/window/PoolEdit.js				\
 	tape/window/TapeBackup.js			\
 	tape/window/TapeBackupJob.js			\
diff --git a/www/tape/TapeInventory.js b/www/tape/TapeInventory.js
index dba36dac..3039a95a 100644
--- a/www/tape/TapeInventory.js
+++ b/www/tape/TapeInventory.js
@@ -60,6 +60,27 @@ Ext.define('PBS.TapeManagement.TapeInventory', {
 	    }).show();
 	},
 
+	remove: function() {
+	    let me = this;
+	    let view = me.getView();
+	    let selection = view.getSelection();
+	    if (!selection || selection.length < 1) {
+		return;
+	    }
+	    let uuid = selection[0].data.uuid;
+	    let label = selection[0].data['label-text'];
+	    Ext.create('PBS.TapeManagement.MediaRemoveWindow', {
+		uuid,
+		label,
+		autoShow: true,
+		listeners: {
+		    destroy: function() {
+			me.reload();
+		    },
+		},
+	    });
+	},
+
 	moveToVault: function() {
 	    let me = this;
 	    let view = me.getView();
@@ -206,6 +227,12 @@ Ext.define('PBS.TapeManagement.TapeInventory', {
 	    disabled: true,
 	    handler: 'format',
 	},
+	{
+	    xtype: 'proxmoxButton',
+	    text: gettext('Remove'),
+	    disabled: true,
+	    handler: 'remove',
+	},
     ],
 
     features: [
diff --git a/www/tape/window/MediaRemoveWindow.js b/www/tape/window/MediaRemoveWindow.js
new file mode 100644
index 00000000..0eb3d6be
--- /dev/null
+++ b/www/tape/window/MediaRemoveWindow.js
@@ -0,0 +1,66 @@
+Ext.define('PBS.TapeManagement.MediaRemoveWindow', {
+    extend: 'Proxmox.window.Edit',
+    mixins: ['Proxmox.Mixin.CBind'],
+
+    uuid: undefined,
+    label: undefined,
+
+    cbindData: function(config) {
+	let me = this;
+	return {
+	    uuid: me.uuid,
+	    warning: Ext.String.format(gettext("Are you sure you want to remove tape '{0}' ?"), me.label),
+	};
+    },
+
+    title: gettext('Remove Media'),
+    url: `/api2/extjs/tape/media/destroy`,
+
+    layout: 'hbox',
+    width: 400,
+    method: 'GET',
+    isCreate: true,
+    submitText: gettext('Ok'),
+    items: [
+	{
+	    xtype: 'container',
+	    padding: 0,
+	    layout: {
+		type: 'hbox',
+		align: 'stretch',
+	    },
+	    items: [
+		{
+		    xtype: 'component',
+		    cls: [Ext.baseCSSPrefix + 'message-box-icon',
+			Ext.baseCSSPrefix + 'message-box-warning',
+			Ext.baseCSSPrefix + 'dlg-icon'],
+		},
+		{
+		    xtype: 'container',
+		    flex: 1,
+		    items: [
+			{
+			    xtype: 'displayfield',
+			    cbind: {
+				value: '{warning}',
+			    },
+			},
+			{
+			    xtype: 'hidden',
+			    name: 'uuid',
+			    cbind: {
+				value: '{uuid}',
+			    },
+			},
+			{
+			    xtype: 'proxmoxcheckbox',
+			    fieldLabel: gettext('Force'),
+			    name: 'force',
+			},
+		    ],
+		},
+	    ],
+	},
+    ],
+});
-- 
2.30.2





  parent reply	other threads:[~2024-01-11 10:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11 10:40 [pbs-devel] [PATCH proxmox-backup 0/5] improve duplicate label-text handling Dominik Csapak
2024-01-11 10:40 ` [pbs-devel] [PATCH proxmox-backup 1/5] tape: handle duplicate label-texts in inventory Dominik Csapak
2024-01-12  7:29   ` Dietmar Maurer
2024-01-12  7:35     ` Dominik Csapak
2024-01-12  8:01       ` Dietmar Maurer
2024-01-12  8:09         ` Dominik Csapak
2024-01-11 10:40 ` [pbs-devel] [PATCH proxmox-backup 2/5] api: tape: optinally accept uuid for destroy/move media Dominik Csapak
2024-01-11 10:40 ` [pbs-devel] [PATCH proxmox-backup 3/5] api: tape: don't allow duplicate media label-texts Dominik Csapak
2024-01-11 10:40 ` [pbs-devel] [PATCH proxmox-backup 4/5] ui: tape inventory: use uuid as id Dominik Csapak
2024-01-11 10:40 ` Dominik Csapak [this message]
2024-01-11 10:43 ` [pbs-devel] [PATCH proxmox-backup 0/5] improve duplicate label-text handling Dominik Csapak
2024-01-12  9:27 ` [pbs-devel] applied: " 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=20240111104036.3341854-6-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