public inbox for pbs-devel@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 2/3] ui: tape/TapeInventory: add erase button
Date: Tue, 16 Feb 2021 09:35:25 +0100	[thread overview]
Message-ID: <20210216083526.16785-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20210216083526.16785-1-d.csapak@proxmox.com>

to erase the selected tape

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
i'll put that feature also on the changer library screen, and limit
the drive selection here to standalone drives in the future
for now this should be good enough

 www/tape/TapeInventory.js | 56 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/www/tape/TapeInventory.js b/www/tape/TapeInventory.js
index 25dea1ba..ec10f5c9 100644
--- a/www/tape/TapeInventory.js
+++ b/www/tape/TapeInventory.js
@@ -33,6 +33,56 @@ Ext.define('PBS.TapeManagement.TapeInventory', {
 	    Ext.create('PBS.TapeManagement.LabelMediaWindow').show();
 	},
 
+	erase: function() {
+	    let me = this;
+	    let view = me.getView();
+	    let selection = view.getSelection();
+	    if (!selection || selection.length < 1) {
+		return;
+	    }
+	    let label = selection[0].data['label-text'];
+	    Ext.create('Proxmox.window.Edit', {
+		title: gettext('Erase'),
+		url: `/api2/extjs/tape/drive`,
+		showProgress: true,
+		submitUrl: function(url, values) {
+		    let drive = values.drive;
+		    delete values.drive;
+		    return `${url}/${drive}/erase-media`;
+		},
+		method: 'POST',
+		items: [
+		    {
+			xtype: 'displayfield',
+			cls: 'pmx-hint',
+			value: gettext('Make sure to insert the tape into the selected drive.'),
+		    },
+		    {
+			xtype: 'pbsDriveSelector',
+			fieldLabel: gettext('Drive'),
+			name: 'drive',
+		    },
+		    {
+			xtype: 'displayfield',
+			name: 'label-text',
+			value: label,
+			submitValue: true,
+			fieldLabel: gettext('Media'),
+		    },
+		    {
+			xtype: 'proxmoxcheckbox',
+			fieldLabel: gettext('Fast Erase'),
+			name: 'fast',
+		    },
+		],
+		listeners: {
+		    destroy: function() {
+			me.reload();
+		    },
+		},
+	    }).show();
+	},
+
 	moveToVault: function() {
 	    let me = this;
 	    let view = me.getView();
@@ -107,6 +157,12 @@ Ext.define('PBS.TapeManagement.TapeInventory', {
 	    handler: 'moveToVault',
 	    enableFn: (rec) => !rec.data.location.startsWith('online-'),
 	},
+	{
+	    xtype: 'proxmoxButton',
+	    text: gettext('Erase'),
+	    disabled: true,
+	    handler: 'erase',
+	},
     ],
 
     columns: [
-- 
2.20.1





  reply	other threads:[~2021-02-16  8:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16  8:35 [pbs-devel] [PATCH proxmox-backup 1/3] api2/tape/drive: add optional label-text to erase Dominik Csapak
2021-02-16  8:35 ` Dominik Csapak [this message]
2021-02-16  8:35 ` [pbs-devel] [PATCH proxmox-backup 3/3] ui: tape/BackupOverview: show mediaset loading error in msg box instead Dominik Csapak
2021-02-16  9:18 ` [pbs-devel] applied: [PATCH proxmox-backup 1/3] api2/tape/drive: add optional label-text to erase 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=20210216083526.16785-2-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal