ui: tape: improve tape-erase and add it to library view
refactor erase window, limit drives to changer if given Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
3cdd1a3424
commit
85205bc253
@ -18,6 +18,7 @@ TAPE_UI_FILES= \
|
||||
tape/form/KeySelector.js \
|
||||
tape/window/ChangerEdit.js \
|
||||
tape/window/DriveEdit.js \
|
||||
tape/window/Erase.js \
|
||||
tape/window/EncryptionEdit.js \
|
||||
tape/window/LabelMedia.js \
|
||||
tape/window/PoolEdit.js \
|
||||
|
@ -91,6 +91,23 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
|
||||
}).show();
|
||||
},
|
||||
|
||||
erase: function(view, rI, cI, button, el, record) {
|
||||
let me = this;
|
||||
let vm = me.getViewModel();
|
||||
let label = record.data['label-text'];
|
||||
|
||||
let changer = vm.get('changer');
|
||||
Ext.create('PBS.TapeManagement.EraseWindow', {
|
||||
label,
|
||||
changer,
|
||||
listeners: {
|
||||
destroy: function() {
|
||||
me.reload();
|
||||
},
|
||||
},
|
||||
}).show();
|
||||
},
|
||||
|
||||
load: function(view, rI, cI, button, el, record) {
|
||||
let me = this;
|
||||
let vm = me.getViewModel();
|
||||
@ -566,6 +583,12 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
|
||||
tooltip: gettext('Transfer'),
|
||||
isDisabled: (v, r, c, i, rec) => !rec.data['label-text'],
|
||||
},
|
||||
{
|
||||
iconCls: 'fa fa-trash-o',
|
||||
handler: 'erase',
|
||||
tooltip: gettext('Erase'),
|
||||
isDisabled: (v, r, c, i, rec) => !rec.data['label-text'],
|
||||
},
|
||||
{
|
||||
iconCls: 'fa fa-rotate-90 fa-upload',
|
||||
handler: 'load',
|
||||
|
@ -41,40 +41,14 @@ Ext.define('PBS.TapeManagement.TapeInventory', {
|
||||
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',
|
||||
},
|
||||
],
|
||||
let inChanger = selection[0].data.location.startsWith('online-');
|
||||
let changer;
|
||||
if (inChanger) {
|
||||
changer = selection[0].data.location.slice("online-".length);
|
||||
}
|
||||
Ext.create('PBS.TapeManagement.EraseWindow', {
|
||||
label,
|
||||
changer,
|
||||
listeners: {
|
||||
destroy: function() {
|
||||
me.reload();
|
||||
|
51
www/tape/window/Erase.js
Normal file
51
www/tape/window/Erase.js
Normal file
@ -0,0 +1,51 @@
|
||||
Ext.define('PBS.TapeManagement.EraseWindow', {
|
||||
extend: 'Proxmox.window.Edit',
|
||||
mixins: ['Proxmox.Mixin.CBind'],
|
||||
|
||||
|
||||
changer: undefined,
|
||||
label: undefined,
|
||||
|
||||
cbindData: function(config) {
|
||||
let me = this;
|
||||
return {};
|
||||
},
|
||||
|
||||
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.'),
|
||||
cbind: {
|
||||
hidden: '{changer}',
|
||||
},
|
||||
},
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
name: 'label-text',
|
||||
submitValue: true,
|
||||
fieldLabel: gettext('Media'),
|
||||
cbind: {
|
||||
value: '{label}',
|
||||
},
|
||||
},
|
||||
{
|
||||
xtype: 'pbsDriveSelector',
|
||||
fieldLabel: gettext('Drive'),
|
||||
name: 'drive',
|
||||
cbind: {
|
||||
changer: '{changer}',
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
Loading…
Reference in New Issue
Block a user