1 Ext
.define('pbs-model-drives', {
2 extend
: 'Ext.data.Model',
4 'path', 'model', 'name', 'serial', 'vendor',
5 { name
: 'changer', defaultValue
: '' },
7 name
: 'changer-drivenum',
15 Ext
.define('PBS.TapeManagement.DrivePanel', {
16 extend
: 'Ext.grid.Panel',
17 alias
: 'widget.pbsTapeDrivePanel',
20 xclass
: 'Ext.app.ViewController',
24 Ext
.create('PBS.TapeManagement.DriveEditWindow', {
35 let view
= me
.getView();
36 let selection
= view
.getSelection();
37 if (!selection
|| selection
.length
< 1) {
40 Ext
.create('PBS.TapeManagement.DriveEditWindow', {
41 driveid
: selection
[0].data
.name
,
44 destroy
: () => me
.reload(),
49 status: function(view
, rI
, cI
, button
, el
, record
) {
51 let drive
= record
.data
.name
;
52 PBS
.Utils
.driveCommand(drive
, 'status', {
53 waitMsgTarget
: me
.getView(),
54 success
: PBS
.Utils
.showDriveStatusWindow
,
58 readLabel: function(view
, rI
, cI
, button
, el
, record
) {
60 let drive
= record
.data
.name
;
62 PBS
.Utils
.driveCommand(drive
, 'read-label', {
63 waitMsgTarget
: me
.getView(),
64 success
: PBS
.Utils
.showMediaLabelWindow
,
68 volumeStatistics: function(view
, rI
, cI
, button
, el
, record
) {
70 let drive
= record
.data
.name
;
71 PBS
.Utils
.driveCommand(drive
, 'volume-statistics', {
72 waitMsgTarget
: me
.getView(),
73 success
: PBS
.Utils
.showVolumeStatisticsWindow
,
77 cartridgeMemory: function(view
, rI
, cI
, button
, el
, record
) {
79 let drive
= record
.data
.name
;
80 PBS
.Utils
.driveCommand(drive
, 'cartridge-memory', {
81 waitMsgTarget
: me
.getView(),
82 success
: PBS
.Utils
.showCartridgeMemoryWindow
,
87 this.getView().getStore().rstore
.load();
90 stopStore: function() {
91 this.getView().getStore().rstore
.stopUpdate();
94 startStore: function() {
95 this.getView().getStore().rstore
.startUpdate();
100 beforedestroy
: 'stopStore',
101 deactivate
: 'stopStore',
102 activate
: 'startStore',
103 itemdblclick
: 'onEdit',
110 storeid
: 'proxmox-tape-drives',
111 model
: 'pbs-model-drives',
114 url
: "/api2/json/tape/drive",
118 groupField
: 'changer',
125 '{name:this.formatName} ({rows.length} Item{[values.rows.length > 1 ? "s" : ""]})',
127 formatName: function(changer
) {
128 if (changer
=== "") {
129 return "Standalone Drives";
131 return `Changer ${changer}`;
141 text
: gettext('Add'),
142 xtype
: 'proxmoxButton',
148 text
: gettext('Edit'),
149 xtype
: 'proxmoxButton',
154 xtype
: 'proxmoxStdRemoveButton',
155 baseurl
: '/api2/extjs/config/drive',
161 text
: gettext('Name'),
166 text
: gettext('Path'),
171 text
: gettext('Vendor'),
176 text
: gettext('Model'),
181 text
: gettext('Serial'),
186 text
: gettext('Drive Number'),
187 dataIndex
: 'changer-drivenum',
188 renderer: function(value
, mD
, record
) {
189 return record
.data
.changer
? value
: '';
193 text
: gettext('Actions'),
195 xtype
: 'actioncolumn',
198 iconCls
: 'fa fa-hdd-o',
199 handler
: 'cartridgeMemory',
200 tooltip
: gettext('Cartridge Memory'),
203 iconCls
: 'fa fa-line-chart',
204 handler
: 'volumeStatistics',
205 tooltip
: gettext('Volume Statistics'),
208 iconCls
: 'fa fa-tag',
209 handler
: 'readLabel',
210 tooltip
: gettext('Read Label'),
213 iconCls
: 'fa fa-info-circle',
215 tooltip
: gettext('Status'),