ui: datastore: rework sync 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:30 +01:00
parent f26080fab1
commit 319fe45261
2 changed files with 49 additions and 33 deletions

View File

@ -204,7 +204,7 @@ Ext.define('PBS.config.SyncJobView', {
'-', '-',
{ {
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,
@ -224,66 +224,68 @@ Ext.define('PBS.config.SyncJobView', {
columns: [ columns: [
{ {
header: gettext('Sync Job'), header: gettext('Sync Job'),
width: 100,
sortable: true,
renderer: Ext.String.htmlEncode,
dataIndex: 'id', dataIndex: 'id',
renderer: Ext.String.htmlEncode,
flex: 2,
sortable: true,
hidden: true,
}, },
{ {
header: gettext('Remote'), header: gettext('Remote'),
width: 100,
sortable: true,
dataIndex: 'remote', dataIndex: 'remote',
flex: 2,
sortable: true,
}, },
{ {
header: gettext('Remote Store'), header: gettext('Remote Store'),
width: 100,
sortable: true,
dataIndex: 'remote-store', dataIndex: 'remote-store',
flex: 2,
sortable: true,
}, },
{ {
header: gettext('Local Store'), header: gettext('Local Store'),
width: 100,
sortable: true,
dataIndex: 'store', dataIndex: 'store',
flex: 2,
sortable: true,
}, },
{ {
header: gettext('Schedule'), header: gettext('Schedule'),
sortable: true,
dataIndex: 'schedule', dataIndex: 'schedule',
flex: 2,
sortable: true,
}, },
{ {
header: gettext('Status'), header: gettext('Status'),
dataIndex: 'last-run-state', dataIndex: 'last-run-state',
flex: 1,
renderer: 'render_sync_status', renderer: 'render_sync_status',
flex: 4,
}, },
{ {
header: gettext('Last Sync'), header: gettext('Last Sync'),
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

@ -28,16 +28,23 @@ Ext.define('PBS.window.SyncJobEdit', {
items: { items: {
xtype: 'inputpanel', xtype: 'inputpanel',
onGetValues: function(values) {
let me = this;
if (!values.id && me.up('pbsSyncJobEdit').isCreate) {
values.id = 'auto-' + Ext.data.identifier.Uuid.Global.generate().slice(0, 23);
}
return values;
},
column1: [ column1: [
{ {
fieldLabel: gettext('Sync Job ID'), xtype: 'displayfield',
xtype: 'pmxDisplayEditField', name: 'store',
name: 'id', fieldLabel: gettext('Local Datastore'),
renderer: Ext.htmlEncode,
allowBlank: false, allowBlank: false,
minLength: 4, submitValue: true,
cbind: { cbind: {
editable: '{isCreate}', value: '{datastore}',
}, },
}, },
{ {
@ -52,12 +59,18 @@ Ext.define('PBS.window.SyncJobEdit', {
allowBlank: false, allowBlank: false,
name: 'remote-store', name: 'remote-store',
}, },
],
advancedColumn1: [
{ {
xtype: 'hiddenfield', xtype: 'pmxDisplayEditField',
allowBlank: false, name: 'id',
name: 'store', fieldLabel: gettext('Sync Job ID'),
emptyText: gettext('Automatic'),
renderer: Ext.htmlEncode,
allowBlank: true,
minLength: 4,
cbind: { cbind: {
value: '{datastore}', editable: '{isCreate}',
}, },
}, },
], ],
@ -74,7 +87,8 @@ Ext.define('PBS.window.SyncJobEdit', {
fieldLabel: gettext('Schedule'), fieldLabel: gettext('Schedule'),
xtype: 'pbsCalendarEvent', xtype: 'pbsCalendarEvent',
name: 'schedule', name: 'schedule',
emptyText: gettext('none'), value: 'hourly',
emptyText: gettext('none (disabled)'),
cbind: { cbind: {
deleteEmpty: '{!isCreate}', deleteEmpty: '{!isCreate}',
}, },