ui: tape/TapeInventory: add erase button

to erase the selected tape

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-02-16 09:35:25 +01:00 committed by Dietmar Maurer
parent be61c56c21
commit 8a73ef897a
1 changed files with 56 additions and 0 deletions

View File

@ -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: [