Hi,
PFA patch to fix given issues,
1) User was allowed to enter start date ahead of end date while scheduling
the job.
RM#2921
2) Datetime picker was not displaying in the grid (sub-node collection
control).
RM#1749
3) Fixed UI issue where validation error was not displaying properly for
Datetime control (Screenshot attached).
--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git
a/web/pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule.js
b/web/pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule.js
index 8497bf5..5894302 100644
---
a/web/pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule.js
+++
b/web/pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule.js
@@ -77,6 +77,9 @@ define('pgadmin.node.pga_schedule', [
return this;
}
}),
+ DatetimeCell = Backgrid.Extension.MomentCell.extend({
+ editor: Backgrid.Extension.DatetimePickerEditor
+ }),
BooleanArrayFormatter = function(selector, indexes) {
var self = this;
@@ -263,18 +266,20 @@ define('pgadmin.node.pga_schedule', [
cellHeaderClasses: 'width_percent_5'
},{
id: 'jscstart', label: gettext('Start'), type: 'text',
- control: 'datetimepicker', cell: 'moment',
+ control: 'datetimepicker', cell: DatetimeCell,
disabled: function() { return false; }, displayInUTC: false,
displayFormat: 'YYYY-MM-DD HH:mm:ss Z',
modelFormat: 'YYYY-MM-DD HH:mm:ss Z', options: {
format: 'YYYY-MM-DD HH:mm:ss Z',
+ minDate: moment().add(0, 'm')
}, cellHeaderClasses: 'width_percent_25'
},{
id: 'jscend', label: gettext('End'), type: 'text',
- control: 'datetimepicker', cell: 'moment',
+ 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', useCurrent: false,
+ minDate: moment().add(0, 'm')
}, cellHeaderClasses: 'width_percent_25',
modelFormat: 'YYYY-MM-DD HH:mm:ss Z'
},{
@@ -468,6 +473,21 @@ define('pgadmin.node.pga_schedule', [
this.errorModel.unset('jscend');
}
+ // End time must be greater than Start time
+ if(!errMsg) {
+ var start_time = this.get('jscstart'),
+ end_time = this.get('jscend'), elapsed_time,
+ start_time_js = start_time.split(' '),
+ end_time_js = end_time.split(' ');
+ start_time_js = moment(start_time_js[0] + ' ' +
start_time_js[1]);
+ end_time_js = moment(end_time_js[0] + ' ' + end_time_js[1]);
+
+ if(end_time_js.isBefore(start_time_js)) {
+ errMsg = gettext('Start time must be less than end time');
+ this.errorModel.set('jscstart', errMsg);
+ }
+ }
+
return errMsg;
}
})
diff --git a/web/pgadmin/static/js/backform.pgadmin.js
b/web/pgadmin/static/js/backform.pgadmin.js
index bfc58ef..432cdd7 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -2361,6 +2361,16 @@
return this;
},
+ clearInvalid: function() {
+ Backform.InputControl.prototype.clearInvalid.apply(this, arguments);
+ this.$el.removeClass("pgadmin-datepicker-has-error");
+ return this;
+ },
+ updateInvalid: function() {
+ Backform.InputControl.prototype.updateInvalid.apply(this, arguments);
+ // Introduce a new class to fix the error icon placement on the control
+ this.$el.addClass("pgadmin-datepicker-has-error");
+ },
cleanup: function() {
if (this.has_datepicker)
this.$el.find("input").datetimepicker('destroy');
diff --git a/web/pgadmin/static/scss/_backform.overrides.scss
b/web/pgadmin/static/scss/_backform.overrides.scss
index 9c2f41c..2aa9460 100644
--- a/web/pgadmin/static/scss/_backform.overrides.scss
+++ b/web/pgadmin/static/scss/_backform.overrides.scss
@@ -25,3 +25,10 @@
right: 40px !important;
}
}
+
+.pgadmin-datepicker-has-error {
+ .pgadmin-controls:before {
+ right: 50px !important;
+ z-index: 3;
+ }
+}