]>
git.proxmox.com Git - proxmox-backup.git/blob - www/tape/TapeInventory.js
25dea1ba030168af7a96f4a11f9d1e6b6e8a3cc3
1 Ext
.define('pbs-model-tapes', {
2 extend
: 'Ext.data.Model',
17 idProperty
: 'label-text',
20 url
: '/api2/json/tape/media/list',
25 Ext
.define('PBS.TapeManagement.TapeInventory', {
26 extend
: 'Ext.grid.Panel',
27 alias
: 'widget.pbsTapeInventory',
30 xclass
: 'Ext.app.ViewController',
33 Ext
.create('PBS.TapeManagement.LabelMediaWindow').show();
36 moveToVault: function() {
38 let view
= me
.getView();
39 let selection
= view
.getSelection();
40 if (!selection
|| selection
.length
< 1) {
43 let label
= selection
[0].data
['label-text'];
44 let inVault
= selection
[0].data
.location
.startsWith('vault-');
47 vault
= selection
[0].data
.location
.slice("vault-".length
);
49 Ext
.create('Proxmox.window.Edit', {
50 title
: gettext('Set Tape Location'),
51 url
: `/api2/extjs/tape/media/move`,
55 xtype
: 'displayfield',
59 fieldLabel
: gettext('Media'),
62 xtype
: 'proxmoxtextfield',
63 fieldLabel
: gettext('Vault'),
66 emptyText
: gettext('On-site'),
79 this.getView().getStore().load();
88 storeid
: 'proxmox-tape-tapes',
89 model
: 'pbs-model-tapes',
90 sorters
: 'label-text',
95 text
: gettext('Reload'),
100 text
: gettext('Add Tape'),
104 xtype
: 'proxmoxButton',
105 text
: gettext('Set Tape Location'),
107 handler
: 'moveToVault',
108 enableFn
: (rec
) => !rec
.data
.location
.startsWith('online-'),
114 text
: gettext('Label'),
115 dataIndex
: 'label-text',
119 text
: gettext('Pool'),
121 sorter
: (a
, b
) => (a
.data
.pool
|| "").localeCompare(b
.data
.pool
|| ""),
125 text
: gettext('Media Set'),
126 dataIndex
: 'media-set-name',
128 sorter: function(a
, b
) {
129 return (a
.data
['media-set-ctime'] || 0) - (b
.data
['media-set-ctime'] || 0);
133 text
: gettext('Location'),
134 dataIndex
: 'location',
136 renderer: function(value
) {
137 if (value
=== 'offline') {
138 return `<i class="fa fa-circle-o"></i> ${gettext("Offline")} (${gettext('On-site')})`;
139 } else if (value
.startsWith('online-')) {
140 let location
= value
.substring(value
.indexOf('-') + 1);
141 return `<i class="fa fa-dot-circle-o"></i> ${gettext("Online")} - ${location}`;
142 } else if (value
.startsWith('vault-')) {
143 let location
= value
.substring(value
.indexOf('-') + 1);
144 return `<i class="fa fa-archive"></i> ${gettext("Vault")} - ${location}`;
151 text
: gettext('Status'),
153 renderer: function(value
, mD
, record
) {
154 return record
.data
.expired
? 'expired' : value
;