ui: tape: add remove media button

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

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2024-01-11 11:40:36 +01:00 committed by Dietmar Maurer
parent ee347f69ae
commit 3657fa1ff3
3 changed files with 94 additions and 0 deletions

View File

@ -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 \

View File

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

View File

@ -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',
},
],
},
],
},
],
});