ui: tape/ChangerStatus: shortcut 'load-media' for single drive
if a changer only has a single drive, there is no point in showing a window with a DriveSelector, just do want the user wanted. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
88e1f7997c
commit
dff8ea92aa
|
@ -163,7 +163,28 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
|
|||
let label = record.data['label-text'];
|
||||
|
||||
let changer = encodeURIComponent(view.changer);
|
||||
let singleDrive = me.drives.length === 1 ? me.drives[0] : undefined;
|
||||
|
||||
if (singleDrive !== undefined) {
|
||||
Proxmox.Utils.API2Request({
|
||||
method: 'POST',
|
||||
params: {
|
||||
'label-text': label,
|
||||
},
|
||||
url: `/api2/extjs/tape/drive/${singleDrive}/load-media`,
|
||||
success: function(response, opt) {
|
||||
Ext.create('Proxmox.window.TaskProgress', {
|
||||
upid: response.result.data,
|
||||
taskDone: function(success) {
|
||||
me.reload();
|
||||
},
|
||||
}).show();
|
||||
},
|
||||
failure: function(response, opt) {
|
||||
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
||||
},
|
||||
});
|
||||
} else {
|
||||
Ext.create('Proxmox.window.Edit', {
|
||||
isCreate: true,
|
||||
autoShow: true,
|
||||
|
@ -197,6 +218,7 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
|
|||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
unload: async function(v, rI, cI, button, el, record) {
|
||||
|
|
Loading…
Reference in New Issue