ui: tape/ChangerStatus: add inventory button

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-02-05 15:26:18 +01:00 committed by Dietmar Maurer
parent 99dd709f3e
commit e2225aa882

View File

@ -341,6 +341,36 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
}).show();
},
inventory: function() {
let me = this;
let vm = me.getViewModel();
let changer = vm.get('changer');
if (changer === '') {
return;
}
Ext.create('Proxmox.window.Edit', {
title: gettext('Inventory'),
showTaskViewer: true,
method: 'PUT',
url: '/api2/extjs/tape/drive',
submitUrl: function(url, values) {
let drive = values.drive;
delete values.drive;
return `${url}/${encodeURIComponent(drive)}/inventory`;
},
items: [
{
xtype: 'pbsDriveSelector',
fieldLabel: gettext('Drive'),
name: 'drive',
changer: changer,
},
],
}).show();
},
reload: async function() {
let me = this;
let view = me.getView();
@ -440,6 +470,15 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
disabled: '{!changerSelected}',
},
},
{
text: gettext('Inventory'),
xtype: 'proxmoxButton',
handler: 'inventory',
iconCls: 'fa fa-book',
bind: {
disabled: '{!changerSelected}',
},
},
],
layout: 'auto',