ui: tape: ChangerStatus: remove changerselector combobox

because we now select it directly in the left-hand tree
so we have to adapt the changer to the one set by the router
and not by the drop down field

and remove it from the TapeManagement tabpanel

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-03-01 12:22:42 +01:00 committed by Dietmar Maurer
parent 2e268e311c
commit 7eefd0c3d7
2 changed files with 26 additions and 59 deletions

View File

@ -15,34 +15,14 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
extend: 'Ext.panel.Panel', extend: 'Ext.panel.Panel',
alias: 'widget.pbsChangerStatus', alias: 'widget.pbsChangerStatus',
viewModel: {
data: {
changer: '',
},
formulas: {
changerSelected: (get) => get('changer') !== '',
},
},
controller: { controller: {
xclass: 'Ext.app.ViewController', xclass: 'Ext.app.ViewController',
changerChange: function(field, value) { importTape: function(v, rI, cI, button, el, record) {
let me = this; let me = this;
let view = me.getView(); let view = me.getView();
let vm = me.getViewModel();
vm.set('changer', value);
if (view.rendered) {
me.reload();
}
},
importTape: function(view, rI, cI, button, el, record) {
let me = this;
let vm = me.getViewModel();
let from = record.data['entry-id']; let from = record.data['entry-id'];
let changer = encodeURIComponent(vm.get('changer')); let changer = encodeURIComponent(view.changer);
Ext.create('Proxmox.window.Edit', { Ext.create('Proxmox.window.Edit', {
title: gettext('Import'), title: gettext('Import'),
isCreate: true, isCreate: true,
@ -71,11 +51,11 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
}).show(); }).show();
}, },
slotTransfer: function(view, rI, cI, button, el, record) { slotTransfer: function(v, rI, cI, button, el, record) {
let me = this; let me = this;
let vm = me.getViewModel(); let view = me.getView();
let from = record.data['entry-id']; let from = record.data['entry-id'];
let changer = encodeURIComponent(vm.get('changer')); let changer = encodeURIComponent(view.changer);
Ext.create('Proxmox.window.Edit', { Ext.create('Proxmox.window.Edit', {
title: gettext('Transfer'), title: gettext('Transfer'),
isCreate: true, isCreate: true,
@ -104,12 +84,12 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
}).show(); }).show();
}, },
erase: function(view, rI, cI, button, el, record) { erase: function(v, rI, cI, button, el, record) {
let me = this; let me = this;
let vm = me.getViewModel(); let view = me.getView();
let label = record.data['label-text']; let label = record.data['label-text'];
let changer = vm.get('changer'); let changer = encodeURIComponent(view.changer);
Ext.create('PBS.TapeManagement.EraseWindow', { Ext.create('PBS.TapeManagement.EraseWindow', {
label, label,
changer, changer,
@ -121,12 +101,12 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
}).show(); }).show();
}, },
load: function(view, rI, cI, button, el, record) { load: function(v, rI, cI, button, el, record) {
let me = this; let me = this;
let vm = me.getViewModel(); let view = me.getView();
let label = record.data['label-text']; let label = record.data['label-text'];
let changer = vm.get('changer'); let changer = encodeURIComponent(view.changer);
Ext.create('Proxmox.window.Edit', { Ext.create('Proxmox.window.Edit', {
isCreate: true, isCreate: true,
@ -163,7 +143,7 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
}); });
}, },
unload: async function(view, rI, cI, button, el, record) { unload: async function(v, rI, cI, button, el, record) {
let me = this; let me = this;
let drive = record.data.name; let drive = record.data.name;
try { try {
@ -231,8 +211,8 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
barcodeLabel: function() { barcodeLabel: function() {
let me = this; let me = this;
let vm = me.getViewModel(); let view = me.getView();
let changer = vm.get('changer'); let changer = view.changer;
if (changer === '') { if (changer === '') {
return; return;
} }
@ -268,8 +248,8 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
inventory: function() { inventory: function() {
let me = this; let me = this;
let vm = me.getViewModel(); let view = me.getView();
let changer = vm.get('changer'); let changer = view.changer;
if (changer === '') { if (changer === '') {
return; return;
} }
@ -326,8 +306,7 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
reload_full: async function(use_cache) { reload_full: async function(use_cache) {
let me = this; let me = this;
let view = me.getView(); let view = me.getView();
let vm = me.getViewModel(); let changer = view.changer;
let changer = vm.get('changer');
if (changer === '') { if (changer === '') {
return; return;
} }
@ -483,6 +462,15 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
}, },
}, },
}, },
init: function(view) {
let me = this;
if (!view.changer) {
throw "no changer given";
}
view.title = `${gettext("Changer")}: ${view.changer}`;
},
}, },
listeners: { listeners: {
@ -490,16 +478,6 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
}, },
tbar: [ tbar: [
{
fieldLabel: gettext('Changer'),
xtype: 'pbsChangerSelector',
reference: 'changerselector',
autoSelect: true,
listeners: {
change: 'changerChange',
},
},
'-',
{ {
text: gettext('Reload'), text: gettext('Reload'),
xtype: 'proxmoxButton', xtype: 'proxmoxButton',
@ -512,18 +490,12 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
xtype: 'proxmoxButton', xtype: 'proxmoxButton',
handler: 'barcodeLabel', handler: 'barcodeLabel',
iconCls: 'fa fa-barcode', iconCls: 'fa fa-barcode',
bind: {
disabled: '{!changerSelected}',
},
}, },
{ {
text: gettext('Inventory'), text: gettext('Inventory'),
xtype: 'proxmoxButton', xtype: 'proxmoxButton',
handler: 'inventory', handler: 'inventory',
iconCls: 'fa fa-book', iconCls: 'fa fa-book',
bind: {
disabled: '{!changerSelected}',
},
}, },
], ],

View File

@ -21,11 +21,6 @@ Ext.define('PBS.TapeManagement', {
itemId: 'inventory', itemId: 'inventory',
xtype: 'pbsTapeInventory', xtype: 'pbsTapeInventory',
}, },
{
title: gettext('Library'),
itemId: 'library',
xtype: 'pbsChangerStatus',
},
{ {
title: gettext('Changers'), title: gettext('Changers'),
itemId: 'changers', itemId: 'changers',