2021-01-28 11:59:48 +00:00
|
|
|
Ext.define('PBS.TapeManagement.ChangerStatus', {
|
|
|
|
extend: 'Ext.panel.Panel',
|
|
|
|
alias: 'widget.pbsChangerStatus',
|
|
|
|
|
|
|
|
viewModel: {
|
|
|
|
data: {
|
|
|
|
changer: '',
|
|
|
|
},
|
|
|
|
|
|
|
|
formulas: {
|
|
|
|
changerSelected: (get) => get('changer') !== '',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
controller: {
|
|
|
|
xclass: 'Ext.app.ViewController',
|
|
|
|
|
|
|
|
changerChange: function(field, value) {
|
|
|
|
let me = this;
|
|
|
|
let view = me.getView();
|
|
|
|
let vm = me.getViewModel();
|
|
|
|
vm.set('changer', value);
|
|
|
|
if (view.rendered) {
|
|
|
|
me.reload();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-01-29 13:57:50 +00:00
|
|
|
importTape: function(view, rI, cI, button, el, record) {
|
|
|
|
let me = this;
|
|
|
|
let vm = me.getViewModel();
|
|
|
|
let from = record.data['entry-id'];
|
|
|
|
let changer = encodeURIComponent(vm.get('changer'));
|
|
|
|
Ext.create('Proxmox.window.Edit', {
|
|
|
|
title: gettext('Import'),
|
|
|
|
isCreate: true,
|
|
|
|
submitText: gettext('OK'),
|
|
|
|
method: 'POST',
|
|
|
|
url: `/api2/extjs/tape/changer/${changer}/transfer`,
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
xtype: 'displayfield',
|
|
|
|
name: 'from',
|
|
|
|
value: from,
|
|
|
|
submitValue: true,
|
|
|
|
fieldLabel: gettext('From Slot'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'proxmoxintegerfield',
|
|
|
|
name: 'to',
|
|
|
|
fieldLabel: gettext('To Slot'),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
listeners: {
|
|
|
|
destroy: function() {
|
|
|
|
me.reload();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}).show();
|
|
|
|
},
|
|
|
|
|
2021-01-28 11:59:48 +00:00
|
|
|
slotTransfer: function(view, rI, cI, button, el, record) {
|
|
|
|
let me = this;
|
|
|
|
let vm = me.getViewModel();
|
|
|
|
let from = record.data['entry-id'];
|
|
|
|
let changer = encodeURIComponent(vm.get('changer'));
|
|
|
|
Ext.create('Proxmox.window.Edit', {
|
|
|
|
title: gettext('Transfer'),
|
|
|
|
isCreate: true,
|
|
|
|
submitText: gettext('OK'),
|
|
|
|
method: 'POST',
|
|
|
|
url: `/api2/extjs/tape/changer/${changer}/transfer`,
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
xtype: 'displayfield',
|
|
|
|
name: 'from',
|
|
|
|
value: from,
|
|
|
|
submitValue: true,
|
|
|
|
fieldLabel: gettext('From Slot'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'proxmoxintegerfield',
|
|
|
|
name: 'to',
|
|
|
|
fieldLabel: gettext('To Slot'),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
listeners: {
|
|
|
|
destroy: function() {
|
|
|
|
me.reload();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}).show();
|
|
|
|
},
|
|
|
|
|
2021-02-16 11:48:10 +00:00
|
|
|
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();
|
|
|
|
},
|
|
|
|
|
2021-01-28 11:59:48 +00:00
|
|
|
load: 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('Proxmox.window.Edit', {
|
|
|
|
isCreate: true,
|
2021-02-18 08:18:09 +00:00
|
|
|
autoShow: true,
|
2021-01-28 11:59:48 +00:00
|
|
|
submitText: gettext('OK'),
|
|
|
|
title: gettext('Load Media into Drive'),
|
|
|
|
url: `/api2/extjs/tape/drive`,
|
2021-02-18 08:18:09 +00:00
|
|
|
showProgress: true,
|
|
|
|
method: 'POST',
|
2021-01-28 11:59:48 +00:00
|
|
|
submitUrl: function(url, values) {
|
|
|
|
let drive = values.drive;
|
|
|
|
delete values.drive;
|
|
|
|
return `${url}/${encodeURIComponent(drive)}/load-media`;
|
|
|
|
},
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
xtype: 'displayfield',
|
|
|
|
name: 'label-text',
|
|
|
|
value: label,
|
|
|
|
submitValue: true,
|
|
|
|
fieldLabel: gettext('Media'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'pbsDriveSelector',
|
|
|
|
fieldLabel: gettext('Drive'),
|
|
|
|
changer: changer,
|
|
|
|
name: 'drive',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
listeners: {
|
|
|
|
destroy: function() {
|
|
|
|
me.reload();
|
|
|
|
},
|
|
|
|
},
|
2021-02-18 08:18:09 +00:00
|
|
|
});
|
2021-01-28 11:59:48 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
unload: async function(view, rI, cI, button, el, record) {
|
|
|
|
let me = this;
|
|
|
|
let drive = record.data.name;
|
|
|
|
try {
|
2021-02-18 08:18:09 +00:00
|
|
|
let response = await PBS.Async.api2({
|
|
|
|
method: 'POST',
|
2021-02-15 11:18:19 +00:00
|
|
|
timeout: 5*60*1000,
|
2021-01-28 11:59:48 +00:00
|
|
|
url: `/api2/extjs/tape/drive/${encodeURIComponent(drive)}/unload`,
|
|
|
|
});
|
2021-02-18 08:18:09 +00:00
|
|
|
|
|
|
|
Ext.create('Proxmox.window.TaskProgress', {
|
|
|
|
autoShow: true,
|
|
|
|
upid: response.result.data,
|
|
|
|
taskDone: () => me.reload(),
|
|
|
|
});
|
2021-01-28 11:59:48 +00:00
|
|
|
} catch (error) {
|
|
|
|
Ext.Msg.alert(gettext('Error'), error);
|
|
|
|
me.reload();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
driveCommand: function(driveid, command, callback, params, method) {
|
|
|
|
let me = this;
|
|
|
|
let view = me.getView();
|
|
|
|
params = params || {};
|
|
|
|
method = method || 'GET';
|
|
|
|
Proxmox.Utils.API2Request({
|
|
|
|
url: `/api2/extjs/tape/drive/${driveid}/${command}`,
|
2021-02-15 11:18:19 +00:00
|
|
|
timeout: 5*60*1000,
|
2021-01-28 11:59:48 +00:00
|
|
|
method,
|
|
|
|
waitMsgTarget: view,
|
|
|
|
params,
|
|
|
|
success: function(response) {
|
|
|
|
callback(response);
|
|
|
|
},
|
|
|
|
failure: function(response) {
|
|
|
|
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
cartridgeMemory: function(view, rI, cI, button, el, record) {
|
|
|
|
let me = this;
|
|
|
|
let drive = record.data.name;
|
|
|
|
me.driveCommand(drive, 'cartridge-memory', function(response) {
|
|
|
|
Ext.create('Ext.window.Window', {
|
|
|
|
title: gettext('Cartridge Memory'),
|
|
|
|
modal: true,
|
|
|
|
width: 600,
|
|
|
|
height: 450,
|
|
|
|
layout: 'fit',
|
|
|
|
scrollable: true,
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
xtype: 'grid',
|
|
|
|
store: {
|
|
|
|
data: response.result.data,
|
|
|
|
},
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
text: gettext('ID'),
|
|
|
|
dataIndex: 'id',
|
|
|
|
width: 60,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: gettext('Name'),
|
|
|
|
dataIndex: 'name',
|
|
|
|
flex: 2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: gettext('Value'),
|
|
|
|
dataIndex: 'value',
|
|
|
|
flex: 1,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}).show();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
cleanDrive: function(view, rI, cI, button, el, record) {
|
|
|
|
let me = this;
|
|
|
|
let drive = record.data.name;
|
|
|
|
me.driveCommand(drive, 'clean', function(response) {
|
|
|
|
Ext.create('Proxmox.window.TaskProgress', {
|
|
|
|
upid: response.result.data,
|
|
|
|
taskDone: function() {
|
|
|
|
me.reload();
|
|
|
|
},
|
|
|
|
}).show();
|
|
|
|
}, {}, 'PUT');
|
|
|
|
},
|
|
|
|
|
|
|
|
volumeStatistics: function(view, rI, cI, button, el, record) {
|
|
|
|
let me = this;
|
|
|
|
let drive = record.data.name;
|
|
|
|
me.driveCommand(drive, 'volume-statistics', function(response) {
|
|
|
|
Ext.create('Ext.window.Window', {
|
|
|
|
title: gettext('Volume Statistics'),
|
|
|
|
modal: true,
|
|
|
|
width: 600,
|
|
|
|
height: 450,
|
|
|
|
layout: 'fit',
|
|
|
|
scrollable: true,
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
xtype: 'grid',
|
|
|
|
store: {
|
|
|
|
data: response.result.data,
|
|
|
|
},
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
text: gettext('ID'),
|
|
|
|
dataIndex: 'id',
|
|
|
|
width: 60,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: gettext('Name'),
|
|
|
|
dataIndex: 'name',
|
|
|
|
flex: 2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: gettext('Value'),
|
|
|
|
dataIndex: 'value',
|
|
|
|
flex: 1,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}).show();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
readLabel: function(view, rI, cI, button, el, record) {
|
|
|
|
let me = this;
|
|
|
|
let drive = record.data.name;
|
|
|
|
me.driveCommand(drive, 'read-label', function(response) {
|
|
|
|
let lines = [];
|
|
|
|
for (const [key, val] of Object.entries(response.result.data)) {
|
|
|
|
lines.push(`${key}: ${val}`);
|
|
|
|
}
|
|
|
|
|
|
|
|
let txt = lines.join('<br>');
|
|
|
|
|
|
|
|
Ext.Msg.show({
|
|
|
|
title: gettext('Label Information'),
|
|
|
|
message: txt,
|
|
|
|
icon: undefined,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
status: function(view, rI, cI, button, el, record) {
|
|
|
|
let me = this;
|
|
|
|
let drive = record.data.name;
|
|
|
|
me.driveCommand(drive, 'status', function(response) {
|
|
|
|
let lines = [];
|
|
|
|
for (const [key, val] of Object.entries(response.result.data)) {
|
|
|
|
lines.push(`${key}: ${val}`);
|
|
|
|
}
|
|
|
|
|
|
|
|
let txt = lines.join('<br>');
|
|
|
|
|
|
|
|
Ext.Msg.show({
|
2021-01-29 13:57:51 +00:00
|
|
|
title: gettext('Status'),
|
2021-01-28 11:59:48 +00:00
|
|
|
message: txt,
|
|
|
|
icon: undefined,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
reloadList: function() {
|
|
|
|
let me = this;
|
|
|
|
me.lookup('changerselector').getStore().load();
|
|
|
|
},
|
|
|
|
|
|
|
|
barcodeLabel: function() {
|
|
|
|
let me = this;
|
|
|
|
let vm = me.getViewModel();
|
|
|
|
let changer = vm.get('changer');
|
|
|
|
if (changer === '') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Ext.create('Proxmox.window.Edit', {
|
|
|
|
title: gettext('Barcode Label'),
|
|
|
|
showTaskViewer: true,
|
2021-01-29 16:06:53 +00:00
|
|
|
method: 'POST',
|
2021-01-28 11:59:48 +00:00
|
|
|
url: '/api2/extjs/tape/drive',
|
|
|
|
submitUrl: function(url, values) {
|
|
|
|
let drive = values.drive;
|
|
|
|
delete values.drive;
|
|
|
|
return `${url}/${encodeURIComponent(drive)}/barcode-label-media`;
|
|
|
|
},
|
|
|
|
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
xtype: 'pbsDriveSelector',
|
|
|
|
fieldLabel: gettext('Drive'),
|
|
|
|
name: 'drive',
|
|
|
|
changer: changer,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'pbsMediaPoolSelector',
|
|
|
|
fieldLabel: gettext('Pool'),
|
|
|
|
name: 'pool',
|
|
|
|
skipEmptyText: true,
|
|
|
|
allowBlank: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}).show();
|
|
|
|
},
|
|
|
|
|
2021-02-05 14:26:18 +00:00
|
|
|
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();
|
|
|
|
},
|
|
|
|
|
2021-02-20 08:06:17 +00:00
|
|
|
reload: function() {
|
|
|
|
this.reload_full(true);
|
|
|
|
},
|
|
|
|
|
|
|
|
reload_no_cache: function() {
|
|
|
|
this.reload_full(false);
|
|
|
|
},
|
|
|
|
|
|
|
|
reload_full: async function(use_cache) {
|
2021-01-28 11:59:48 +00:00
|
|
|
let me = this;
|
|
|
|
let view = me.getView();
|
|
|
|
let vm = me.getViewModel();
|
|
|
|
let changer = vm.get('changer');
|
|
|
|
if (changer === '') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
Proxmox.Utils.setErrorMask(view, true);
|
|
|
|
Proxmox.Utils.setErrorMask(me.lookup('content'));
|
2021-02-04 12:56:32 +00:00
|
|
|
let status_fut = PBS.Async.api2({
|
2021-02-15 11:18:19 +00:00
|
|
|
timeout: 5*60*1000,
|
2021-02-20 08:06:17 +00:00
|
|
|
method: 'GET',
|
2021-01-28 11:59:48 +00:00
|
|
|
url: `/api2/extjs/tape/changer/${encodeURIComponent(changer)}/status`,
|
2021-02-20 08:06:17 +00:00
|
|
|
params: {
|
|
|
|
cache: use_cache,
|
|
|
|
},
|
2021-01-28 11:59:48 +00:00
|
|
|
});
|
2021-02-04 12:56:32 +00:00
|
|
|
let drives_fut = PBS.Async.api2({
|
2021-02-15 11:18:19 +00:00
|
|
|
timeout: 5*60*1000,
|
2021-01-28 11:59:48 +00:00
|
|
|
url: `/api2/extjs/tape/drive?changer=${encodeURIComponent(changer)}`,
|
|
|
|
});
|
|
|
|
|
2021-02-04 12:56:32 +00:00
|
|
|
let tapes_fut = PBS.Async.api2({
|
2021-02-15 11:18:19 +00:00
|
|
|
timeout: 5*60*1000,
|
2021-02-04 12:56:32 +00:00
|
|
|
url: '/api2/extjs/tape/media/list',
|
2021-02-18 10:08:13 +00:00
|
|
|
method: 'GET',
|
|
|
|
params: {
|
2021-02-18 11:06:49 +00:00
|
|
|
"update-status": false,
|
2021-02-19 14:40:23 +00:00
|
|
|
},
|
2021-02-04 12:56:32 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
let [status, drives, tapes_list] = await Promise.all([status_fut, drives_fut, tapes_fut]);
|
|
|
|
|
2021-01-28 11:59:48 +00:00
|
|
|
let data = {
|
|
|
|
slot: [],
|
|
|
|
'import-export': [],
|
|
|
|
drive: [],
|
|
|
|
};
|
|
|
|
|
2021-02-04 12:56:32 +00:00
|
|
|
let tapes = {};
|
|
|
|
|
|
|
|
for (const tape of tapes_list.result.data) {
|
2021-02-09 14:40:44 +00:00
|
|
|
tapes[tape['label-text']] = {
|
|
|
|
labeled: true,
|
|
|
|
pool: tape.pool,
|
|
|
|
status: tape.expired ? 'expired' : tape.status,
|
|
|
|
};
|
2021-02-04 12:56:32 +00:00
|
|
|
}
|
|
|
|
|
2021-01-28 11:59:48 +00:00
|
|
|
let drive_entries = {};
|
|
|
|
|
|
|
|
for (const entry of drives.result.data) {
|
|
|
|
drive_entries[entry['changer-drivenum'] || 0] = entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (let entry of status.result.data) {
|
|
|
|
let type = entry['entry-kind'];
|
|
|
|
|
|
|
|
if (type === 'drive' && drive_entries[entry['entry-id']] !== undefined) {
|
|
|
|
entry = Ext.applyIf(entry, drive_entries[entry['entry-id']]);
|
|
|
|
}
|
|
|
|
|
2021-02-09 14:40:44 +00:00
|
|
|
if (tapes[entry['label-text']] !== undefined) {
|
|
|
|
entry['is-labeled'] = true;
|
|
|
|
entry.pool = tapes[entry['label-text']].pool;
|
|
|
|
entry.status = tapes[entry['label-text']].status;
|
|
|
|
} else {
|
|
|
|
entry['is-labeled'] = false;
|
|
|
|
}
|
2021-02-04 12:56:32 +00:00
|
|
|
|
2021-01-28 11:59:48 +00:00
|
|
|
data[type].push(entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
me.lookup('slots').getStore().setData(data.slot);
|
|
|
|
me.lookup('import_export').getStore().setData(data['import-export']);
|
|
|
|
me.lookup('drives').getStore().setData(data.drive);
|
|
|
|
|
|
|
|
Proxmox.Utils.setErrorMask(view);
|
|
|
|
} catch (err) {
|
|
|
|
Proxmox.Utils.setErrorMask(view);
|
|
|
|
Proxmox.Utils.setErrorMask(me.lookup('content'), err);
|
|
|
|
}
|
|
|
|
},
|
2021-02-18 08:18:07 +00:00
|
|
|
|
|
|
|
renderIsLabeled: function(value, mD, record) {
|
|
|
|
if (!record.data['label-text']) {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (record.data['label-text'].startsWith("CLN")) {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!value) {
|
|
|
|
return gettext('Not Labeled');
|
|
|
|
}
|
|
|
|
|
|
|
|
let status = record.data.status;
|
|
|
|
if (record.data.pool) {
|
|
|
|
return `${status} (${record.data.pool})`;
|
|
|
|
}
|
|
|
|
return status;
|
|
|
|
},
|
2021-02-18 14:40:30 +00:00
|
|
|
|
|
|
|
renderState: function(value, md, record) {
|
|
|
|
if (!value) {
|
|
|
|
return gettext('Idle');
|
|
|
|
}
|
|
|
|
|
|
|
|
let icon = '<i class="fa fa-spinner fa-pulse fa-fw"></i>';
|
|
|
|
|
|
|
|
if (value.startsWith("UPID")) {
|
|
|
|
let upid = Proxmox.Utils.parse_task_upid(value);
|
|
|
|
md.tdCls = "pointer";
|
|
|
|
return `${icon} ${upid.desc}`;
|
|
|
|
}
|
|
|
|
|
|
|
|
return `${icon} ${value}`;
|
|
|
|
},
|
|
|
|
|
|
|
|
control: {
|
|
|
|
'grid[reference=drives]': {
|
|
|
|
cellclick: function(table, td, ci, rec, tr, ri, e) {
|
2021-02-19 14:40:24 +00:00
|
|
|
if (e.position.column.dataIndex !== 'state') {
|
2021-02-18 14:40:30 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
let upid = rec.data.state;
|
|
|
|
if (!upid || !upid.startsWith("UPID")) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Ext.create('Proxmox.window.TaskViewer', {
|
|
|
|
autoShow: true,
|
|
|
|
upid,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-01-28 11:59:48 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
listeners: {
|
|
|
|
activate: 'reload',
|
|
|
|
},
|
|
|
|
|
|
|
|
tbar: [
|
|
|
|
{
|
|
|
|
fieldLabel: gettext('Changer'),
|
|
|
|
xtype: 'pbsChangerSelector',
|
|
|
|
reference: 'changerselector',
|
|
|
|
autoSelect: true,
|
|
|
|
listeners: {
|
|
|
|
change: 'changerChange',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'-',
|
|
|
|
{
|
|
|
|
text: gettext('Reload'),
|
|
|
|
xtype: 'proxmoxButton',
|
2021-02-20 08:06:17 +00:00
|
|
|
handler: 'reload_no_cache',
|
2021-01-28 11:59:48 +00:00
|
|
|
selModel: false,
|
|
|
|
},
|
|
|
|
'-',
|
|
|
|
{
|
|
|
|
text: gettext('Barcode Label'),
|
|
|
|
xtype: 'proxmoxButton',
|
|
|
|
handler: 'barcodeLabel',
|
|
|
|
iconCls: 'fa fa-barcode',
|
|
|
|
bind: {
|
|
|
|
disabled: '{!changerSelected}',
|
|
|
|
},
|
|
|
|
},
|
2021-02-05 14:26:18 +00:00
|
|
|
{
|
|
|
|
text: gettext('Inventory'),
|
|
|
|
xtype: 'proxmoxButton',
|
|
|
|
handler: 'inventory',
|
|
|
|
iconCls: 'fa fa-book',
|
|
|
|
bind: {
|
|
|
|
disabled: '{!changerSelected}',
|
|
|
|
},
|
|
|
|
},
|
2021-01-28 11:59:48 +00:00
|
|
|
],
|
|
|
|
|
|
|
|
layout: 'auto',
|
|
|
|
bodyPadding: 5,
|
|
|
|
scrollable: true,
|
|
|
|
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
xtype: 'container',
|
|
|
|
reference: 'content',
|
|
|
|
layout: {
|
|
|
|
type: 'hbox',
|
|
|
|
aling: 'stretch',
|
|
|
|
},
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
xtype: 'grid',
|
|
|
|
reference: 'slots',
|
|
|
|
title: gettext('Slots'),
|
|
|
|
padding: 5,
|
|
|
|
flex: 1,
|
|
|
|
store: {
|
|
|
|
data: [],
|
|
|
|
},
|
|
|
|
columns: [
|
|
|
|
{
|
2021-02-18 08:18:08 +00:00
|
|
|
text: gettext('ID'),
|
2021-01-28 11:59:48 +00:00
|
|
|
dataIndex: 'entry-id',
|
|
|
|
width: 50,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: gettext("Content"),
|
|
|
|
dataIndex: 'label-text',
|
|
|
|
flex: 1,
|
|
|
|
renderer: (value) => value || '',
|
|
|
|
},
|
2021-02-04 12:56:32 +00:00
|
|
|
{
|
2021-02-09 14:40:44 +00:00
|
|
|
text: gettext('Inventory'),
|
2021-02-04 12:56:32 +00:00
|
|
|
dataIndex: 'is-labeled',
|
2021-02-18 08:18:07 +00:00
|
|
|
renderer: 'renderIsLabeled',
|
2021-02-09 14:40:44 +00:00
|
|
|
flex: 1,
|
2021-02-04 12:56:32 +00:00
|
|
|
},
|
2021-01-28 11:59:48 +00:00
|
|
|
{
|
|
|
|
text: gettext('Actions'),
|
|
|
|
xtype: 'actioncolumn',
|
|
|
|
width: 100,
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
iconCls: 'fa fa-rotate-90 fa-exchange',
|
|
|
|
handler: 'slotTransfer',
|
2021-01-29 13:57:52 +00:00
|
|
|
tooltip: gettext('Transfer'),
|
2021-01-28 11:59:48 +00:00
|
|
|
isDisabled: (v, r, c, i, rec) => !rec.data['label-text'],
|
|
|
|
},
|
2021-02-16 11:48:10 +00:00
|
|
|
{
|
|
|
|
iconCls: 'fa fa-trash-o',
|
|
|
|
handler: 'erase',
|
|
|
|
tooltip: gettext('Erase'),
|
|
|
|
isDisabled: (v, r, c, i, rec) => !rec.data['label-text'],
|
|
|
|
},
|
2021-01-28 11:59:48 +00:00
|
|
|
{
|
|
|
|
iconCls: 'fa fa-rotate-90 fa-upload',
|
|
|
|
handler: 'load',
|
2021-01-29 13:57:52 +00:00
|
|
|
tooltip: gettext('Load'),
|
2021-01-28 11:59:48 +00:00
|
|
|
isDisabled: (v, r, c, i, rec) => !rec.data['label-text'],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'container',
|
|
|
|
flex: 2,
|
|
|
|
defaults: {
|
|
|
|
padding: 5,
|
|
|
|
},
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
xtype: 'grid',
|
|
|
|
reference: 'drives',
|
|
|
|
title: gettext('Drives'),
|
|
|
|
store: {
|
|
|
|
fields: ['entry-id', 'label-text', 'model', 'name', 'vendor', 'serial'],
|
|
|
|
data: [],
|
|
|
|
},
|
|
|
|
columns: [
|
|
|
|
{
|
2021-02-18 08:18:08 +00:00
|
|
|
text: gettext('ID'),
|
2021-01-28 11:59:48 +00:00
|
|
|
dataIndex: 'entry-id',
|
2021-02-18 08:18:08 +00:00
|
|
|
hidden: true,
|
2021-01-28 11:59:48 +00:00
|
|
|
width: 50,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: gettext("Content"),
|
|
|
|
dataIndex: 'label-text',
|
|
|
|
flex: 1,
|
|
|
|
renderer: (value) => value || '',
|
|
|
|
},
|
2021-02-18 08:18:07 +00:00
|
|
|
{
|
|
|
|
text: gettext('Inventory'),
|
|
|
|
dataIndex: 'is-labeled',
|
|
|
|
renderer: 'renderIsLabeled',
|
2021-02-18 14:40:30 +00:00
|
|
|
flex: 1.5,
|
2021-02-18 08:18:07 +00:00
|
|
|
},
|
2021-01-28 11:59:48 +00:00
|
|
|
{
|
|
|
|
text: gettext("Name"),
|
|
|
|
sortable: true,
|
|
|
|
dataIndex: 'name',
|
|
|
|
flex: 1,
|
|
|
|
renderer: Ext.htmlEncode,
|
|
|
|
},
|
2021-02-18 14:40:30 +00:00
|
|
|
{
|
|
|
|
text: gettext('State'),
|
|
|
|
dataIndex: 'state',
|
|
|
|
flex: 3,
|
|
|
|
renderer: 'renderState',
|
|
|
|
},
|
2021-01-28 11:59:48 +00:00
|
|
|
{
|
|
|
|
text: gettext("Vendor"),
|
|
|
|
sortable: true,
|
|
|
|
dataIndex: 'vendor',
|
2021-02-18 14:40:30 +00:00
|
|
|
hidden: true,
|
2021-01-28 11:59:48 +00:00
|
|
|
flex: 1,
|
|
|
|
renderer: Ext.htmlEncode,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: gettext("Model"),
|
|
|
|
sortable: true,
|
|
|
|
dataIndex: 'model',
|
2021-02-18 14:40:30 +00:00
|
|
|
hidden: true,
|
2021-01-28 11:59:48 +00:00
|
|
|
flex: 1,
|
|
|
|
renderer: Ext.htmlEncode,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: gettext("Serial"),
|
|
|
|
sortable: true,
|
|
|
|
dataIndex: 'serial',
|
2021-02-18 14:40:30 +00:00
|
|
|
hidden: true,
|
2021-01-28 11:59:48 +00:00
|
|
|
flex: 1,
|
|
|
|
renderer: Ext.htmlEncode,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'actioncolumn',
|
|
|
|
text: gettext('Actions'),
|
|
|
|
width: 140,
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
iconCls: 'fa fa-rotate-270 fa-upload',
|
|
|
|
handler: 'unload',
|
2021-01-29 13:57:52 +00:00
|
|
|
tooltip: gettext('Unload'),
|
2021-01-28 11:59:48 +00:00
|
|
|
isDisabled: (v, r, c, i, rec) => !rec.data['label-text'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
iconCls: 'fa fa-hdd-o',
|
|
|
|
handler: 'cartridgeMemory',
|
2021-01-29 13:57:52 +00:00
|
|
|
tooltip: gettext('Cartridge Memory'),
|
2021-01-28 11:59:48 +00:00
|
|
|
isDisabled: (v, r, c, i, rec) => !rec.data['label-text'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
iconCls: 'fa fa-line-chart',
|
|
|
|
handler: 'volumeStatistics',
|
2021-01-29 13:57:52 +00:00
|
|
|
tooltip: gettext('Volume Statistics'),
|
2021-01-28 11:59:48 +00:00
|
|
|
isDisabled: (v, r, c, i, rec) => !rec.data['label-text'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
iconCls: 'fa fa-tag',
|
|
|
|
handler: 'readLabel',
|
2021-01-29 13:57:52 +00:00
|
|
|
tooltip: gettext('Read Label'),
|
2021-01-28 11:59:48 +00:00
|
|
|
isDisabled: (v, r, c, i, rec) => !rec.data['label-text'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
iconCls: 'fa fa-info-circle',
|
2021-01-29 13:57:52 +00:00
|
|
|
tooltip: gettext('Status'),
|
2021-01-28 11:59:48 +00:00
|
|
|
handler: 'status',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
iconCls: 'fa fa-shower',
|
2021-01-29 13:57:52 +00:00
|
|
|
tooltip: gettext('Clean Drive'),
|
2021-01-28 11:59:48 +00:00
|
|
|
handler: 'cleanDrive',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'grid',
|
|
|
|
reference: 'import_export',
|
|
|
|
store: {
|
|
|
|
data: [],
|
|
|
|
},
|
2021-02-18 08:18:08 +00:00
|
|
|
title: gettext('Import-Export Slots'),
|
2021-01-28 11:59:48 +00:00
|
|
|
columns: [
|
|
|
|
{
|
2021-02-18 08:18:08 +00:00
|
|
|
text: gettext('ID'),
|
2021-01-28 11:59:48 +00:00
|
|
|
dataIndex: 'entry-id',
|
|
|
|
width: 50,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: gettext("Content"),
|
|
|
|
dataIndex: 'label-text',
|
|
|
|
renderer: (value) => value || '',
|
|
|
|
flex: 1,
|
|
|
|
},
|
2021-02-18 08:18:07 +00:00
|
|
|
{
|
|
|
|
text: gettext('Inventory'),
|
|
|
|
dataIndex: 'is-labeled',
|
|
|
|
renderer: 'renderIsLabeled',
|
|
|
|
flex: 1,
|
|
|
|
},
|
2021-01-28 11:59:48 +00:00
|
|
|
{
|
|
|
|
text: gettext('Actions'),
|
2021-01-29 13:57:50 +00:00
|
|
|
xtype: 'actioncolumn',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
iconCls: 'fa fa-rotate-270 fa-upload',
|
|
|
|
handler: 'importTape',
|
|
|
|
tooltip: gettext('Import'),
|
|
|
|
isDisabled: (v, r, c, i, rec) => !rec.data['label-text'],
|
|
|
|
},
|
|
|
|
],
|
2021-01-28 11:59:48 +00:00
|
|
|
width: 80,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|