2020-10-20 11:10:08 +02:00
Ext . define ( 'pbs-verify-jobs-status' , {
extend : 'Ext.data.Model' ,
fields : [
'id' , 'store' , 'outdated-after' , 'ignore-verified' , 'schedule' ,
'next-run' , 'last-run-upid' , 'last-run-state' , 'last-run-endtime' ,
{
name : 'duration' ,
calculate : function ( data ) {
let endtime = data [ 'last-run-endtime' ] ;
if ( ! endtime ) return undefined ;
let task = Proxmox . Utils . parse _task _upid ( data [ 'last-run-upid' ] ) ;
return endtime - task . starttime ;
} ,
} ,
2020-10-27 16:20:08 +01:00
'comment' ,
2020-10-20 11:10:08 +02:00
] ,
idProperty : 'id' ,
proxy : {
type : 'proxmox' ,
url : '/api2/json/admin/verify' ,
} ,
} ) ;
Ext . define ( 'PBS.config.VerifyJobView' , {
extend : 'Ext.grid.GridPanel' ,
alias : 'widget.pbsVerifyJobView' ,
stateful : true ,
2020-10-31 10:58:42 +01:00
stateId : 'grid-verify-jobs-v1' ,
2020-10-20 11:10:08 +02:00
title : gettext ( 'Verify Jobs' ) ,
controller : {
xclass : 'Ext.app.ViewController' ,
addVerifyJob : function ( ) {
let me = this ;
2020-10-27 16:20:08 +01:00
let view = me . getView ( ) ;
2020-10-20 11:10:08 +02:00
Ext . create ( 'PBS.window.VerifyJobEdit' , {
2020-10-27 16:20:08 +01:00
datastore : view . datastore ,
2020-10-20 11:10:08 +02:00
listeners : {
destroy : function ( ) {
me . reload ( ) ;
} ,
} ,
} ) . show ( ) ;
} ,
editVerifyJob : function ( ) {
let me = this ;
let view = me . getView ( ) ;
let selection = view . getSelection ( ) ;
if ( selection . length < 1 ) return ;
Ext . create ( 'PBS.window.VerifyJobEdit' , {
2020-10-27 16:20:08 +01:00
datastore : view . datastore ,
2020-10-20 11:10:08 +02:00
id : selection [ 0 ] . data . id ,
listeners : {
destroy : function ( ) {
me . reload ( ) ;
} ,
} ,
} ) . show ( ) ;
} ,
openTaskLog : function ( ) {
let me = this ;
let view = me . getView ( ) ;
let selection = view . getSelection ( ) ;
if ( selection . length < 1 ) return ;
let upid = selection [ 0 ] . data [ 'last-run-upid' ] ;
if ( ! upid ) return ;
Ext . create ( 'Proxmox.window.TaskViewer' , {
2020-10-21 15:53:54 +02:00
upid ,
2020-10-20 11:10:08 +02:00
} ) . show ( ) ;
} ,
runVerifyJob : function ( ) {
let me = this ;
let view = me . getView ( ) ;
let selection = view . getSelection ( ) ;
if ( selection . length < 1 ) return ;
let id = selection [ 0 ] . data . id ;
Proxmox . Utils . API2Request ( {
method : 'POST' ,
url : ` /admin/verify/ ${ id } /run ` ,
success : function ( response , opt ) {
Ext . create ( 'Proxmox.window.TaskViewer' , {
upid : response . result . data ,
taskDone : function ( success ) {
me . reload ( ) ;
} ,
} ) . show ( ) ;
} ,
failure : function ( response , opt ) {
Ext . Msg . alert ( gettext ( 'Error' ) , response . htmlStatus ) ;
} ,
} ) ;
} ,
2020-10-27 16:20:08 +01:00
startStore : function ( ) { this . getView ( ) . getStore ( ) . rstore . startUpdate ( ) ; } ,
stopStore : function ( ) { this . getView ( ) . getStore ( ) . rstore . stopUpdate ( ) ; } ,
2020-10-20 11:10:08 +02:00
reload : function ( ) { this . getView ( ) . getStore ( ) . rstore . load ( ) ; } ,
init : function ( view ) {
2020-11-09 16:01:25 +01:00
let params = { } ;
if ( view . datastore !== undefined ) {
params . store = view . datastore ;
}
view . getStore ( ) . rstore . getProxy ( ) . setExtraParams ( params ) ;
2020-10-20 11:10:08 +02:00
Proxmox . Utils . monStoreErrors ( view , view . getStore ( ) . rstore ) ;
} ,
} ,
listeners : {
2020-10-27 16:20:08 +01:00
activate : 'startStore' ,
deactivate : 'stopStore' ,
2020-10-20 11:10:08 +02:00
itemdblclick : 'editVerifyJob' ,
} ,
store : {
type : 'diff' ,
autoDestroy : true ,
autoDestroyRstore : true ,
sorters : 'id' ,
rstore : {
type : 'update' ,
storeid : 'pbs-verify-jobs-status' ,
model : 'pbs-verify-jobs-status' ,
interval : 5000 ,
} ,
} ,
tbar : [
{
xtype : 'proxmoxButton' ,
text : gettext ( 'Add' ) ,
handler : 'addVerifyJob' ,
selModel : false ,
} ,
{
xtype : 'proxmoxButton' ,
text : gettext ( 'Edit' ) ,
handler : 'editVerifyJob' ,
disabled : true ,
} ,
{
xtype : 'proxmoxStdRemoveButton' ,
baseurl : '/config/verify/' ,
2020-10-29 14:34:31 +01:00
confirmMsg : gettext ( 'Remove entry?' ) ,
2020-10-20 11:10:08 +02:00
callback : 'reload' ,
} ,
'-' ,
{
xtype : 'proxmoxButton' ,
2020-10-28 21:25:07 +01:00
text : gettext ( 'Show Log' ) ,
2020-10-20 11:10:08 +02:00
handler : 'openTaskLog' ,
enableFn : ( rec ) => ! ! rec . data [ 'last-run-upid' ] ,
disabled : true ,
} ,
{
xtype : 'proxmoxButton' ,
text : gettext ( 'Run now' ) ,
handler : 'runVerifyJob' ,
disabled : true ,
} ,
] ,
viewConfig : {
trackOver : false ,
} ,
columns : [
{
2020-10-28 21:25:07 +01:00
header : gettext ( 'Job ID' ) ,
2020-10-20 11:10:08 +02:00
dataIndex : 'id' ,
2020-10-28 21:25:07 +01:00
renderer : Ext . String . htmlEncode ,
ui: improve verify job view layout, show job-id
Avoid overuse of flex, that is as bad as having all to fixed widths.
* Set date-time fields to 150 px as they are fixed width text.
* Duration is maximal 3 units, so it can be made fixed too.
* Schedule is flex with lower and upper limits, this is useful as
it's a field which can be both, quite short (daily) or long
(mon..fri *-10..12-1..7 02:00/30:30)
* Status and comment is flex, this way we always get a filled grid
Move status after last verify date and duration field, increases
information density at the left of the grid - reducing need for eye
movement, also, it groups together the "information about last job"
nicer.
Show job-id by default even if they are auto generated when adding
over the gui, as it can help finding the respective job faster when
getting a mail with an error.
Reported-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-31 10:30:23 +01:00
maxWidth : 220 ,
minWidth : 75 ,
flex : 1 ,
2020-10-28 21:25:07 +01:00
sortable : true ,
2020-10-20 11:10:08 +02:00
} ,
2020-11-10 12:58:00 +01:00
{
header : gettext ( 'Datastore' ) ,
dataIndex : 'store' ,
flex : 1 ,
} ,
2020-10-20 11:10:08 +02:00
{
2020-10-28 21:25:07 +01:00
header : gettext ( 'Skip Verified' ) ,
dataIndex : 'ignore-verified' ,
renderer : Proxmox . Utils . format _boolean ,
ui: improve verify job view layout, show job-id
Avoid overuse of flex, that is as bad as having all to fixed widths.
* Set date-time fields to 150 px as they are fixed width text.
* Duration is maximal 3 units, so it can be made fixed too.
* Schedule is flex with lower and upper limits, this is useful as
it's a field which can be both, quite short (daily) or long
(mon..fri *-10..12-1..7 02:00/30:30)
* Status and comment is flex, this way we always get a filled grid
Move status after last verify date and duration field, increases
information density at the left of the grid - reducing need for eye
movement, also, it groups together the "information about last job"
nicer.
Show job-id by default even if they are auto generated when adding
over the gui, as it can help finding the respective job faster when
getting a mail with an error.
Reported-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-31 10:30:23 +01:00
width : 100 ,
2020-10-20 11:10:08 +02:00
sortable : true ,
} ,
{
ui: improve verify job view layout, show job-id
Avoid overuse of flex, that is as bad as having all to fixed widths.
* Set date-time fields to 150 px as they are fixed width text.
* Duration is maximal 3 units, so it can be made fixed too.
* Schedule is flex with lower and upper limits, this is useful as
it's a field which can be both, quite short (daily) or long
(mon..fri *-10..12-1..7 02:00/30:30)
* Status and comment is flex, this way we always get a filled grid
Move status after last verify date and duration field, increases
information density at the left of the grid - reducing need for eye
movement, also, it groups together the "information about last job"
nicer.
Show job-id by default even if they are auto generated when adding
over the gui, as it can help finding the respective job faster when
getting a mail with an error.
Reported-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-31 10:30:23 +01:00
header : gettext ( 'Re-Verify After' ) ,
2020-10-28 21:25:07 +01:00
dataIndex : 'outdated-after' ,
renderer : v => v ? v + ' ' + gettext ( 'Days' ) : gettext ( 'Never' ) ,
ui: improve verify job view layout, show job-id
Avoid overuse of flex, that is as bad as having all to fixed widths.
* Set date-time fields to 150 px as they are fixed width text.
* Duration is maximal 3 units, so it can be made fixed too.
* Schedule is flex with lower and upper limits, this is useful as
it's a field which can be both, quite short (daily) or long
(mon..fri *-10..12-1..7 02:00/30:30)
* Status and comment is flex, this way we always get a filled grid
Move status after last verify date and duration field, increases
information density at the left of the grid - reducing need for eye
movement, also, it groups together the "information about last job"
nicer.
Show job-id by default even if they are auto generated when adding
over the gui, as it can help finding the respective job faster when
getting a mail with an error.
Reported-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-31 10:30:23 +01:00
width : 125 ,
2020-10-20 11:10:08 +02:00
sortable : true ,
} ,
{
header : gettext ( 'Schedule' ) ,
dataIndex : 'schedule' ,
2020-10-28 21:25:07 +01:00
sortable : true ,
ui: improve verify job view layout, show job-id
Avoid overuse of flex, that is as bad as having all to fixed widths.
* Set date-time fields to 150 px as they are fixed width text.
* Duration is maximal 3 units, so it can be made fixed too.
* Schedule is flex with lower and upper limits, this is useful as
it's a field which can be both, quite short (daily) or long
(mon..fri *-10..12-1..7 02:00/30:30)
* Status and comment is flex, this way we always get a filled grid
Move status after last verify date and duration field, increases
information density at the left of the grid - reducing need for eye
movement, also, it groups together the "information about last job"
nicer.
Show job-id by default even if they are auto generated when adding
over the gui, as it can help finding the respective job faster when
getting a mail with an error.
Reported-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-31 10:30:23 +01:00
maxWidth : 220 ,
minWidth : 80 ,
flex : 1 ,
2020-10-20 11:10:08 +02:00
} ,
{
header : gettext ( 'Last Verification' ) ,
dataIndex : 'last-run-endtime' ,
2021-02-19 09:14:31 +01:00
renderer : PBS . Utils . render _optional _timestamp ,
ui: improve verify job view layout, show job-id
Avoid overuse of flex, that is as bad as having all to fixed widths.
* Set date-time fields to 150 px as they are fixed width text.
* Duration is maximal 3 units, so it can be made fixed too.
* Schedule is flex with lower and upper limits, this is useful as
it's a field which can be both, quite short (daily) or long
(mon..fri *-10..12-1..7 02:00/30:30)
* Status and comment is flex, this way we always get a filled grid
Move status after last verify date and duration field, increases
information density at the left of the grid - reducing need for eye
movement, also, it groups together the "information about last job"
nicer.
Show job-id by default even if they are auto generated when adding
over the gui, as it can help finding the respective job faster when
getting a mail with an error.
Reported-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-31 10:30:23 +01:00
width : 150 ,
2020-10-28 21:25:07 +01:00
sortable : true ,
2020-10-20 11:10:08 +02:00
} ,
{
text : gettext ( 'Duration' ) ,
dataIndex : 'duration' ,
renderer : Proxmox . Utils . render _duration ,
ui: improve verify job view layout, show job-id
Avoid overuse of flex, that is as bad as having all to fixed widths.
* Set date-time fields to 150 px as they are fixed width text.
* Duration is maximal 3 units, so it can be made fixed too.
* Schedule is flex with lower and upper limits, this is useful as
it's a field which can be both, quite short (daily) or long
(mon..fri *-10..12-1..7 02:00/30:30)
* Status and comment is flex, this way we always get a filled grid
Move status after last verify date and duration field, increases
information density at the left of the grid - reducing need for eye
movement, also, it groups together the "information about last job"
nicer.
Show job-id by default even if they are auto generated when adding
over the gui, as it can help finding the respective job faster when
getting a mail with an error.
Reported-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-31 10:30:23 +01:00
width : 80 ,
} ,
{
header : gettext ( 'Status' ) ,
dataIndex : 'last-run-state' ,
2021-02-19 09:14:31 +01:00
renderer : PBS . Utils . render _task _status ,
ui: improve verify job view layout, show job-id
Avoid overuse of flex, that is as bad as having all to fixed widths.
* Set date-time fields to 150 px as they are fixed width text.
* Duration is maximal 3 units, so it can be made fixed too.
* Schedule is flex with lower and upper limits, this is useful as
it's a field which can be both, quite short (daily) or long
(mon..fri *-10..12-1..7 02:00/30:30)
* Status and comment is flex, this way we always get a filled grid
Move status after last verify date and duration field, increases
information density at the left of the grid - reducing need for eye
movement, also, it groups together the "information about last job"
nicer.
Show job-id by default even if they are auto generated when adding
over the gui, as it can help finding the respective job faster when
getting a mail with an error.
Reported-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-31 10:30:23 +01:00
flex : 3 ,
2020-10-20 11:10:08 +02:00
} ,
{
header : gettext ( 'Next Run' ) ,
dataIndex : 'next-run' ,
2021-02-19 09:14:31 +01:00
renderer : PBS . Utils . render _next _task _run ,
ui: improve verify job view layout, show job-id
Avoid overuse of flex, that is as bad as having all to fixed widths.
* Set date-time fields to 150 px as they are fixed width text.
* Duration is maximal 3 units, so it can be made fixed too.
* Schedule is flex with lower and upper limits, this is useful as
it's a field which can be both, quite short (daily) or long
(mon..fri *-10..12-1..7 02:00/30:30)
* Status and comment is flex, this way we always get a filled grid
Move status after last verify date and duration field, increases
information density at the left of the grid - reducing need for eye
movement, also, it groups together the "information about last job"
nicer.
Show job-id by default even if they are auto generated when adding
over the gui, as it can help finding the respective job faster when
getting a mail with an error.
Reported-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-31 10:30:23 +01:00
width : 150 ,
2020-10-28 21:25:07 +01:00
sortable : true ,
2020-10-20 11:10:08 +02:00
} ,
{
header : gettext ( 'Comment' ) ,
dataIndex : 'comment' ,
2020-10-28 21:25:07 +01:00
renderer : Ext . String . htmlEncode ,
ui: improve verify job view layout, show job-id
Avoid overuse of flex, that is as bad as having all to fixed widths.
* Set date-time fields to 150 px as they are fixed width text.
* Duration is maximal 3 units, so it can be made fixed too.
* Schedule is flex with lower and upper limits, this is useful as
it's a field which can be both, quite short (daily) or long
(mon..fri *-10..12-1..7 02:00/30:30)
* Status and comment is flex, this way we always get a filled grid
Move status after last verify date and duration field, increases
information density at the left of the grid - reducing need for eye
movement, also, it groups together the "information about last job"
nicer.
Show job-id by default even if they are auto generated when adding
over the gui, as it can help finding the respective job faster when
getting a mail with an error.
Reported-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-31 10:30:23 +01:00
flex : 2 ,
2020-10-28 21:25:07 +01:00
sortable : true ,
2020-10-20 11:10:08 +02:00
} ,
] ,
2020-11-10 12:58:00 +01:00
initComponent : function ( ) {
let me = this ;
let hideDatastore = ! ! me . datastore ;
2020-11-10 13:18:01 +01:00
for ( let column of me . columns ) {
if ( column . dataIndex === 'store' ) {
column . hidden = hideDatastore ;
break ;
}
}
2020-11-10 12:58:00 +01:00
me . callParent ( ) ;
2020-11-10 13:18:01 +01:00
} ,
2020-10-20 11:10:08 +02:00
} ) ;