[pbs-devel] [PATCH proxmox-backup 2/3] ui: tape/TapeInventory: add erase button
Dominik Csapak
d.csapak at proxmox.com
Tue Feb 16 09:35:25 CET 2021
to erase the selected tape
Signed-off-by: Dominik Csapak <d.csapak at 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
More information about the pbs-devel
mailing list