ui: datastore: rework verify layout, make job ID optional

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-10-28 21:25:07 +01:00
parent 0cbdeed96b
commit f26080fab1
2 changed files with 84 additions and 52 deletions

View File

@ -204,7 +204,7 @@ Ext.define('PBS.config.VerifyJobView', {
'-', '-',
{ {
xtype: 'proxmoxButton', xtype: 'proxmoxButton',
text: gettext('Log'), text: gettext('Show Log'),
handler: 'openTaskLog', handler: 'openTaskLog',
enableFn: (rec) => !!rec.data['last-run-upid'], enableFn: (rec) => !!rec.data['last-run-upid'],
disabled: true, disabled: true,
@ -223,62 +223,65 @@ Ext.define('PBS.config.VerifyJobView', {
columns: [ columns: [
{ {
header: gettext('Verify Job'), header: gettext('Job ID'),
width: 100,
sortable: true,
renderer: Ext.String.htmlEncode,
dataIndex: 'id', dataIndex: 'id',
renderer: Ext.String.htmlEncode,
flex: 2,
sortable: true,
hidden: true,
}, },
{ {
header: gettext('Days valid'), header: gettext('Skip Verified'),
width: 125,
sortable: true,
dataIndex: 'outdated-after',
},
{
header: gettext('Ignore verified'),
width: 125,
sortable: true,
renderer: Proxmox.Utils.format_boolean,
dataIndex: 'ignore-verified', dataIndex: 'ignore-verified',
renderer: Proxmox.Utils.format_boolean,
flex: 2,
sortable: true,
},
{
header: gettext('Re-Verfiy Age'),
dataIndex: 'outdated-after',
renderer: v => v ? v +' '+ gettext('Days') : gettext('Never'),
flex: 2,
sortable: true,
}, },
{ {
header: gettext('Schedule'), header: gettext('Schedule'),
sortable: true,
dataIndex: 'schedule', dataIndex: 'schedule',
sortable: true,
flex: 2,
}, },
{ {
header: gettext('Status'), header: gettext('Status'),
dataIndex: 'last-run-state', dataIndex: 'last-run-state',
flex: 1,
renderer: 'render_verify_status', renderer: 'render_verify_status',
flex: 4,
}, },
{ {
header: gettext('Last Verification'), header: gettext('Last Verification'),
sortable: true,
minWidth: 200,
renderer: 'render_optional_timestamp',
dataIndex: 'last-run-endtime', dataIndex: 'last-run-endtime',
renderer: 'render_optional_timestamp',
flex: 3,
sortable: true,
}, },
{ {
text: gettext('Duration'), text: gettext('Duration'),
dataIndex: 'duration', dataIndex: 'duration',
width: 60,
renderer: Proxmox.Utils.render_duration, renderer: Proxmox.Utils.render_duration,
flex: 2,
}, },
{ {
header: gettext('Next Run'), header: gettext('Next Run'),
sortable: true,
minWidth: 200,
renderer: 'render_next_run',
dataIndex: 'next-run', dataIndex: 'next-run',
renderer: 'render_next_run',
flex: 3,
sortable: true,
}, },
{ {
header: gettext('Comment'), header: gettext('Comment'),
hidden: true,
sortable: true,
renderer: Ext.String.htmlEncode,
dataIndex: 'comment', dataIndex: 'comment',
renderer: Ext.String.htmlEncode,
flex: 4,
sortable: true,
}, },
], ],
}); });

View File

@ -12,6 +12,7 @@ Ext.define('PBS.window.VerifyJobEdit', {
subject: gettext('VerifyJob'), subject: gettext('VerifyJob'),
fieldDefaults: { labelWidth: 120 }, fieldDefaults: { labelWidth: 120 },
defaultFocus: 'field[name="ignore-verified"]',
cbindData: function(initialConfig) { cbindData: function(initialConfig) {
let me = this; let me = this;
@ -26,55 +27,83 @@ Ext.define('PBS.window.VerifyJobEdit', {
return { }; return { };
}, },
viewModel: {
data: {
'ignore-verified': true,
},
},
items: { items: {
xtype: 'inputpanel', xtype: 'inputpanel',
onGetValues: function(values) {
let me = this;
if (!values.id && me.up('pbsVerifyJobEdit').isCreate) {
values.id = 'auto-' + Ext.data.identifier.Uuid.Global.generate().slice(0, 23);
}
return values;
},
column1: [ column1: [
{ {
fieldLabel: gettext('Verify Job ID'), xtype: 'displayfield',
xtype: 'pmxDisplayEditField',
name: 'id',
renderer: Ext.htmlEncode,
allowBlank: false,
minLength: 4,
cbind: {
editable: '{isCreate}',
},
},
{
xtype: 'hiddenfield',
allowBlank: false,
name: 'store', name: 'store',
fieldLabel: gettext('Datastore'),
allowBlank: false,
submitValue: true,
cbind: { cbind: {
value: '{datastore}', value: '{datastore}',
}, },
}, },
{ {
xtype: 'proxmoxintegerfield', xtype: 'pbsCalendarEvent',
fieldLabel: gettext('Days valid'), name: 'schedule',
minValue: 1, fieldLabel: gettext('Schedule'),
value: '', emptyText: gettext('none (disabled)'),
allowBlank: true, value: 'daily',
name: 'outdated-after',
emptyText: gettext('no expiration'),
cbind: { cbind: {
deleteEmpty: '{!isCreate}', deleteEmpty: '{!isCreate}',
}, },
}, },
], ],
advancedColumn1: [
{
xtype: 'pmxDisplayEditField',
name: 'id',
fieldLabel: gettext('Verify Job ID'),
emptyText: gettext('Automatic'),
renderer: Ext.htmlEncode,
allowBlank: true,
minLength: 4,
cbind: {
editable: '{isCreate}',
},
},
],
column2: [ column2: [
{ {
fieldLabel: gettext('Ignore verified'),
xtype: 'proxmoxcheckbox', xtype: 'proxmoxcheckbox',
name: 'ignore-verified', name: 'ignore-verified',
fieldLabel: gettext('Skip verified snapshots'),
labelWidth: 150,
uncheckedValue: false, uncheckedValue: false,
value: true, value: true,
bind: {
value: '{ignore-verified}',
},
}, },
{ {
fieldLabel: gettext('Schedule'), xtype: 'proxmoxintegerfield',
xtype: 'pbsCalendarEvent', name: 'outdated-after',
name: 'schedule', fieldLabel: gettext('Re-Verify After (days)'),
emptyText: gettext('none'), labelWidth: 150,
minValue: 1,
value: 30,
allowBlank: true,
emptyText: gettext('Never'),
bind: {
disabled: '{!ignore-verified}',
},
cbind: { cbind: {
deleteEmpty: '{!isCreate}', deleteEmpty: '{!isCreate}',
}, },