mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Ensure the pgAgent job start/end time grid fields synchronise with the subnode control and validate correctly. Fixes #3073
This commit is contained in:
committed by
Dave Page
parent
a4124c2496
commit
78e2ff4f56
@@ -279,7 +279,7 @@ define('pgadmin.node.pga_schedule', [
|
||||
control: 'datetimepicker', cell: DatetimeCell,
|
||||
disabled: function() { return false; }, displayInUTC: false,
|
||||
displayFormat: 'YYYY-MM-DD HH:mm:ss Z', options: {
|
||||
format: 'YYYY-MM-DD HH:mm:ss Z', useCurrent: false,
|
||||
format: 'YYYY-MM-DD HH:mm:ss Z',
|
||||
minDate: moment().add(0, 'm'),
|
||||
}, cellHeaderClasses: 'width_percent_25',
|
||||
modelFormat: 'YYYY-MM-DD HH:mm:ss Z',
|
||||
@@ -458,6 +458,9 @@ define('pgadmin.node.pga_schedule', [
|
||||
if (_.isUndefined(val) || _.isNull(val) ||
|
||||
String(val).replace(/^\s+|\s+$/g, '') == '') {
|
||||
msg = gettext('Please enter the start time.');
|
||||
if (val == '') {
|
||||
this.set('jscstart', undefined);
|
||||
}
|
||||
this.errorModel.set('jscstart', msg);
|
||||
errMsg = errMsg || msg;
|
||||
} else {
|
||||
@@ -471,6 +474,9 @@ define('pgadmin.node.pga_schedule', [
|
||||
// the user
|
||||
if (_.isUndefined(val) || _.isNull(val) ||
|
||||
String(val).replace(/^\s+|\s+$/g, '') == '') {
|
||||
if (val == '') {
|
||||
this.set('jscend', undefined);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -133,6 +133,7 @@ define('pgadmin.node.pga_job', [
|
||||
type: 'collection', mode: ['edit', 'create'],
|
||||
model: pgBrowser.Nodes['pga_jobstep'].model, canEdit: true,
|
||||
control: 'sub-node-collection', canAdd: true, canDelete: true,
|
||||
showError: false,
|
||||
columns: [
|
||||
'jstname', 'jstenabled', 'jstkind', 'jstconntype', 'jstonerror',
|
||||
],
|
||||
@@ -141,6 +142,7 @@ define('pgadmin.node.pga_job', [
|
||||
type: 'collection', mode: ['edit', 'create'],
|
||||
control: 'sub-node-collection', canAdd: true, canDelete: true,
|
||||
canEdit: true, model: pgBrowser.Nodes['pga_schedule'].model,
|
||||
showError: false,
|
||||
columns: ['jscname', 'jscenabled', 'jscstart', 'jscend'],
|
||||
}],
|
||||
validate: function() {
|
||||
|
||||
@@ -300,6 +300,17 @@ define('pgadmin.node.pga_jobstep', [
|
||||
this.errorModel.unset('jstcode');
|
||||
}
|
||||
|
||||
val = this.get('jstonerror');
|
||||
if (
|
||||
!_.isUndefined(val) && !_.isNull(val) &&
|
||||
String(val).replace(/^\s+|\s+$/g, '') == ''
|
||||
) {
|
||||
msg = gettext('Please select valid on error option .');
|
||||
this.errorModel.set('jstonerror', msg);
|
||||
} else {
|
||||
this.errorModel.unset('jstonerror');
|
||||
}
|
||||
|
||||
return errMsg;
|
||||
},
|
||||
}),
|
||||
|
||||
@@ -1196,6 +1196,7 @@ define([
|
||||
canAddRow: data.canAddRow,
|
||||
canEdit: evalF(data.canEdit, data, this.model),
|
||||
canDelete: evalF(data.canDelete, data, this.model),
|
||||
showError: data.showError || true,
|
||||
});
|
||||
// Show Backgrid Control
|
||||
var grid = (data.subnode == undefined) ? '' : this.showGridControl(data);
|
||||
@@ -1224,9 +1225,11 @@ define([
|
||||
|
||||
if (_.isEmpty(error)) return;
|
||||
|
||||
if (self.field.get('showError')) {
|
||||
self.$el.addClass('subnode-error').append(
|
||||
$('<div></div>').addClass('pgadmin-control-error-message pg-el-xs-offset-4 pg-el-xs-8 help-block').text(error)
|
||||
);
|
||||
}
|
||||
},
|
||||
cleanup: function() {
|
||||
// Clean up existing grid if any (in case of re-render)
|
||||
@@ -1238,8 +1241,10 @@ define([
|
||||
}
|
||||
},
|
||||
clearInvalid: function() {
|
||||
if (this.field.get('showError')) {
|
||||
this.$el.removeClass('subnode-error');
|
||||
this.$el.find('.pgadmin-control-error-message').remove();
|
||||
}
|
||||
return this;
|
||||
},
|
||||
showGridControl: function(data) {
|
||||
@@ -2391,6 +2396,7 @@ define([
|
||||
},
|
||||
}, this.defaults.options, this.field.get('options'), {
|
||||
'date': data.value,
|
||||
'minDate': data.value,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user