1 Ext
.define('pbs-tape-backup-job-status', {
2 extend
: 'Ext.data.Model',
4 'id', 'store', 'pool', 'drive', 'store', 'schedule', 'comment',
5 { name
: 'eject-media', type
: 'boolean' },
6 { name
: 'export-media-set', type
: 'boolean' },
7 { name
: 'latest-only', type
: 'boolean' },
8 'next-run', 'last-run-upid', 'last-run-state', 'last-run-endtime',
11 calculate: function(data
) {
12 let endtime
= data
['last-run-endtime'];
13 if (!endtime
) return undefined;
14 let task
= Proxmox
.Utils
.parse_task_upid(data
['last-run-upid']);
15 return endtime
- task
.starttime
;
22 url
: '/api2/json/tape/backup',
26 Ext
.define('PBS.config.TapeBackupJobView', {
27 extend
: 'Ext.grid.GridPanel',
28 alias
: 'widget.pbsTapeBackupJobView',
31 stateId
: 'grid-tape-backup-jobs-v1',
33 title
: gettext('Tape Backup Jobs'),
36 xclass
: 'Ext.app.ViewController',
40 Ext
.create('PBS.TapeManagement.BackupJobEdit', {
52 let view
= me
.getView();
53 let selection
= view
.getSelection();
54 if (!selection
|| selection
.length
< 1) {
58 Ext
.create('PBS.TapeManagement.BackupJobEdit', {
59 id
: selection
[0].data
.id
,
69 openTaskLog: function() {
71 let view
= me
.getView();
72 let selection
= view
.getSelection();
73 if (selection
.length
< 1) return;
75 let upid
= selection
[0].data
['last-run-upid'];
78 Ext
.create('Proxmox.window.TaskViewer', {
85 let view
= me
.getView();
86 let selection
= view
.getSelection();
87 if (selection
.length
< 1) return;
89 let id
= selection
[0].data
.id
;
90 Proxmox
.Utils
.API2Request({
92 url
: `/tape/backup/${id}`,
93 success: function(response
, opt
) {
94 Ext
.create('Proxmox.window.TaskViewer', {
95 upid
: response
.result
.data
,
96 taskDone: function(success
) {
101 failure: function(response
, opt
) {
102 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
107 startStore: function() { this.getView().getStore().rstore
.startUpdate(); },
109 stopStore: function() { this.getView().getStore().rstore
.stopUpdate(); },
111 reload: function() { this.getView().getStore().rstore
.load(); },
113 init: function(view
) {
114 Proxmox
.Utils
.monStoreErrors(view
, view
.getStore().rstore
);
119 activate
: 'startStore',
120 deactivate
: 'stopStore',
121 itemdblclick
: 'editJob',
127 autoDestroyRstore
: true,
131 storeid
: 'pbs-tape-backup-job-status',
132 model
: 'pbs-tape-backup-job-status',
143 xtype
: 'proxmoxButton',
144 text
: gettext('Add'),
149 xtype
: 'proxmoxButton',
150 text
: gettext('Edit'),
155 xtype
: 'proxmoxStdRemoveButton',
156 baseurl
: '/config/tape-backup-job/',
157 confirmMsg
: gettext('Remove entry?'),
162 xtype
: 'proxmoxButton',
163 text
: gettext('Show Log'),
164 handler
: 'openTaskLog',
165 enableFn
: (rec
) => !!rec
.data
['last-run-upid'],
169 xtype
: 'proxmoxButton',
170 text
: gettext('Run now'),
178 header
: gettext('Job ID'),
180 renderer
: Ext
.String
.htmlEncode
,
187 header
: gettext('Datastore'),
193 header
: gettext('Media Pool'),
199 header
: gettext('Drive'),
205 header
: gettext('Eject'),
206 dataIndex
: 'eject-media',
207 renderer
: Proxmox
.Utils
.format_boolean
,
212 header
: gettext('Export'),
213 dataIndex
: 'export-media-set',
214 renderer
: Proxmox
.Utils
.format_boolean
,
219 header
: gettext('Latest Only'),
220 dataIndex
: 'latest-only',
221 renderer
: Proxmox
.Utils
.format_boolean
,
225 header
: gettext('Schedule'),
226 dataIndex
: 'schedule',
233 header
: gettext('Last Backup'),
234 dataIndex
: 'last-run-endtime',
235 renderer
: PBS
.Utils
.render_optional_timestamp
,
240 text
: gettext('Duration'),
241 dataIndex
: 'duration',
242 renderer
: Proxmox
.Utils
.render_duration
,
246 header
: gettext('Status'),
247 dataIndex
: 'last-run-state',
248 renderer
: PBS
.Utils
.render_task_status
,
252 header
: gettext('Next Run'),
253 dataIndex
: 'next-run',
254 renderer
: PBS
.Utils
.render_next_task_run
,
259 header
: gettext('Comment'),
260 dataIndex
: 'comment',
261 renderer
: Ext
.String
.htmlEncode
,
267 initComponent: function() {