[pgAdmin4][Patch]: To fix issues in pgAgent module
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: '-MM-DD HH:mm:ss Z', modelFormat: '-MM-DD HH:mm:ss Z', options: { format: '-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: '-MM-DD HH:mm:ss Z', options: { -format: '-MM-DD HH:mm:ss Z', useCurrent: false +format: '-MM-DD HH:mm:ss Z', useCurrent: false, +minDate: moment().add(0, 'm') }, cellHeaderClasses: 'width_percent_25', modelFormat: '-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; + } +}
[pgAdmin4][Patch]: To fix the issue in File manager
Hi, PFA patch to fix referenced before assignment bug in file manager. RM#2934 -- Regards, Murtuza Zabuawala EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company diff --git a/web/pgadmin/misc/file_manager/__init__.py b/web/pgadmin/misc/file_manager/__init__.py index e51ac2a..1a8b59b 100644 --- a/web/pgadmin/misc/file_manager/__init__.py +++ b/web/pgadmin/misc/file_manager/__init__.py @@ -20,7 +20,8 @@ import config import codecs import simplejson as json -from flask import render_template, Response, session, request as req, url_for +from flask import render_template, Response, session, request as req, \ +url_for, current_app from flask_babel import gettext from flask_security import login_required from pgadmin.utils import PgAdminModule @@ -1054,6 +1055,7 @@ class Filemanager(object): status = True err_msg = None is_startswith_bom = False +is_binary = False # check if file type is text or binary text_chars = bytearray([7, 8, 9, 10, 12, 13, 27]) \ @@ -1097,6 +1099,11 @@ class Filemanager(object): status = False err_msg = u"Error: {0}".format(str(ex)) +# Remove root storage path from error message +# when running in Server mode +if not status and not current_app.PGADMIN_RUNTIME: +err_msg = err_msg.replace(get_storage_directory(), '') + return status, err_msg, is_binary, is_startswith_bom, enc def addfolder(self, path, name):
pgAdmin 4 commit: Update EXPLAIN icons. Fixes #2936
Update EXPLAIN icons. Fixes #2936 Branch -- master Details --- https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=c74b348bacc32ae7b5a3f1c75067121f29e2ca84 Author: Chethana Kumar Modified Files -- .../misc/static/explain/img/ex_aggregate.png | Bin 574 -> 0 bytes .../misc/static/explain/img/ex_aggregate.svg | 1 + web/pgadmin/misc/static/explain/img/ex_append.png | Bin 1162 -> 0 bytes web/pgadmin/misc/static/explain/img/ex_append.svg | 1 + web/pgadmin/misc/static/explain/img/ex_bmp_and.png | Bin 1006 -> 0 bytes web/pgadmin/misc/static/explain/img/ex_bmp_and.svg | 1 + .../misc/static/explain/img/ex_bmp_heap.png| Bin 1106 -> 0 bytes .../misc/static/explain/img/ex_bmp_heap.svg| 1 + .../misc/static/explain/img/ex_bmp_index.png | Bin 1172 -> 0 bytes .../misc/static/explain/img/ex_bmp_index.svg | 1 + web/pgadmin/misc/static/explain/img/ex_bmp_or.png | Bin 685 -> 0 bytes web/pgadmin/misc/static/explain/img/ex_bmp_or.svg | 1 + .../static/explain/img/ex_broadcast_motion.png | Bin 334 -> 0 bytes .../static/explain/img/ex_broadcast_motion.svg | 1 + .../misc/static/explain/img/ex_cte_scan.png| Bin 1955 -> 0 bytes .../misc/static/explain/img/ex_cte_scan.svg| 1 + web/pgadmin/misc/static/explain/img/ex_delete.png | Bin 1129 -> 0 bytes web/pgadmin/misc/static/explain/img/ex_delete.svg | 1 + .../misc/static/explain/img/ex_foreign_scan.png| Bin 1607 -> 0 bytes .../misc/static/explain/img/ex_foreign_scan.svg| 1 + .../misc/static/explain/img/ex_gather_motion.png | Bin 218 -> 0 bytes .../misc/static/explain/img/ex_gather_motion.svg | 1 + web/pgadmin/misc/static/explain/img/ex_group.png | Bin 1228 -> 0 bytes web/pgadmin/misc/static/explain/img/ex_group.svg | 1 + web/pgadmin/misc/static/explain/img/ex_hash.png| Bin 1169 -> 0 bytes web/pgadmin/misc/static/explain/img/ex_hash.svg| 1 + .../misc/static/explain/img/ex_hash_anti_join.png | Bin 1571 -> 0 bytes .../misc/static/explain/img/ex_hash_anti_join.svg | 1 + .../misc/static/explain/img/ex_hash_semi_join.png | Bin 1452 -> 0 bytes .../misc/static/explain/img/ex_hash_semi_join.svg | 1 + .../static/explain/img/ex_hash_setop_except.png| Bin 1377 -> 0 bytes .../static/explain/img/ex_hash_setop_except.svg| 1 + .../explain/img/ex_hash_setop_except_all.png | Bin 1402 -> 0 bytes .../explain/img/ex_hash_setop_except_all.svg | 1 + .../static/explain/img/ex_hash_setop_intersect.png | Bin 1389 -> 0 bytes .../static/explain/img/ex_hash_setop_intersect.svg | 1 + .../explain/img/ex_hash_setop_intersect_all.png| Bin 1417 -> 0 bytes .../explain/img/ex_hash_setop_intersect_all.svg| 1 + .../static/explain/img/ex_hash_setop_unknown.png | Bin 1490 -> 0 bytes .../static/explain/img/ex_hash_setop_unknown.svg | 1 + .../misc/static/explain/img/ex_index_only_scan.png | Bin 498 -> 0 bytes .../misc/static/explain/img/ex_index_only_scan.svg | 1 + .../misc/static/explain/img/ex_index_scan.png | Bin 1298 -> 0 bytes .../misc/static/explain/img/ex_index_scan.svg | 1 + web/pgadmin/misc/static/explain/img/ex_insert.png | Bin 1065 -> 0 bytes web/pgadmin/misc/static/explain/img/ex_insert.svg | 1 + web/pgadmin/misc/static/explain/img/ex_join.png| Bin 1090 -> 0 bytes web/pgadmin/misc/static/explain/img/ex_join.svg| 1 + web/pgadmin/misc/static/explain/img/ex_limit.png | Bin 1237 -> 0 bytes web/pgadmin/misc/static/explain/img/ex_limit.svg | 1 + .../misc/static/explain/img/ex_lock_rows.png | Bin 1520 -> 0 bytes .../misc/static/explain/img/ex_lock_rows.svg | 1 + .../misc/static/explain/img/ex_materialize.png | Bin 1221 -> 0 bytes .../misc/static/explain/img/ex_materialize.svg | 1 + web/pgadmin/misc/static/explain/img/ex_merge.png | Bin 1127 -> 0 bytes web/pgadmin/misc/static/explain/img/ex_merge.svg | 1 + .../misc/static/explain/img/ex_merge_anti_join.png | Bin 1599 -> 0 bytes .../misc/static/explain/img/ex_merge_anti_join.svg | 1 + .../misc/static/explain/img/ex_merge_append.png| Bin 980 -> 0 bytes .../misc/static/explain/img/ex_merge_append.svg| 1 + .../misc/static/explain/img/ex_merge_semi_join.png | Bin 1344 -> 0 bytes .../misc/static/explain/img/ex_merge_semi_join.svg | 1 + web/pgadmin/misc/static/explain/img/ex_nested.png | Bin 1108 -> 0 bytes web/pgadmin/misc/static/explain/img/ex_nested.svg | 1 + .../explain/img/ex_nested_loop_anti_join.png | Bin 1741 -> 0 bytes .../explain/img/ex_nested_loop_anti_join.svg | 1 + .../explain/img/ex_nested_loop_semi_join.png | Bin 1679 -> 0 bytes .../explain/img/ex_nested_loop_semi_join.svg | 1 + .../misc/static/explain/img/ex_recursive_union.png | Bin 1224 -> 0 bytes .../misc/static/explain/img/ex_recursive_union.svg | 1 + .../static/explain/img/ex_redistribute_motion.png | Bin 218 -> 0 bytes .../static/explain/img/ex_redistribute_motion.svg | 1 + web/pgadmin/misc/stat
pgAdmin 4 commit: Misc fixes for the pgAgent module:
Misc fixes for the pgAgent module: 1) User was allowed to enter start date ahead of end date while scheduling a job. Fixes #2921 2) Datetime picker was not displaying in the grid (sub-node collection control). Fixes #1749 3) Fixed UI issue where validation error was not displaying properly for Datetime control. Branch -- master Details --- https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=f5718b9d56dee55398a3ae766215399e5915649e Author: Murtuza Zabuawala Modified Files -- .../pgagent/schedules/static/js/pga_schedule.js| 26 +++--- web/pgadmin/static/js/backform.pgadmin.js | 10 + web/pgadmin/static/scss/_backform.overrides.scss | 7 ++ 3 files changed, 40 insertions(+), 3 deletions(-)
Re: [pgAdmin4][Patch]: To fix issues in pgAgent module
Thanks, applied. On Tue, Dec 5, 2017 at 8:53 PM, Murtuza Zabuawala < murtuza.zabuaw...@enterprisedb.com> wrote: > 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 > > -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
pgAdmin 4 commit: Fix a reference before assignment error in the file d
Fix a reference before assignment error in the file dialogue. Fixes #2934 Branch -- master Details --- https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=22c38e4562dc23b2669b3fb9f97e8c0a1309cd31 Author: Murtuza Zabuawala Modified Files -- web/pgadmin/misc/file_manager/__init__.py | 9 - 1 file changed, 8 insertions(+), 1 deletion(-)
Re: [pgAdmin4][Patch]: To fix the issue in File manager
Hi Thanks, applied. I noticed whilst testing that the Select button on the file dialogue can become enabled again following navigation to another directory. That then allows you to click it when no files are selected, which of course fails horribly. Can you take a look at that please? https://redmine.postgresql.org/issues/2937 On Tue, Dec 5, 2017 at 10:20 PM, Murtuza Zabuawala < murtuza.zabuaw...@enterprisedb.com> wrote: > Hi, > > PFA patch to fix referenced before assignment bug in file manager. > RM#2934 > > -- > Regards, > Murtuza Zabuawala > EnterpriseDB: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > > -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Re: [pgAdmin4][Patch]: To fix the issue in File manager
Hi Dave, I'm not able to re-produce the issue, I've updated the RM with my steps, please check and let me know If I missed anything. https://redmine.postgresql.org/issues/2937 -- Murtuza On Wed, Dec 6, 2017 at 10:17 AM, Dave Page wrote: > Hi > > Thanks, applied. I noticed whilst testing that the Select button on the > file dialogue can become enabled again following navigation to another > directory. That then allows you to click it when no files are selected, > which of course fails horribly. > > Can you take a look at that please? https://redmine. > postgresql.org/issues/2937 > > On Tue, Dec 5, 2017 at 10:20 PM, Murtuza Zabuawala enterprisedb.com> wrote: > >> Hi, >> >> PFA patch to fix referenced before assignment bug in file manager. >> RM#2934 >> >> -- >> Regards, >> Murtuza Zabuawala >> EnterpriseDB: http://www.enterprisedb.com >> The Enterprise PostgreSQL Company >> >> > > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company >
[pgAdmin4][Patch]: Fixed RM #2779 - Lost field size
Hi, Please find the attached patch to fix RM #2779: Lost field size. While editing the table column, if we change collate then, the length and the precision are lost. Also, while changing column type, it does not honour the length and precision. Thanks, Khushboo diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/static/js/column.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/static/js/column.js index 90c3f8f..a239a6b 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/static/js/column.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/static/js/column.js @@ -416,7 +416,7 @@ define('pgadmin.node.column', [ _.each(m.datatypes, function(o) { if ( of_type == o.value ) { if(o.precision) { -m.set('min_val', o.min_val, {silent: true}); +m.set('min_val', 0, {silent: true}); m.set('max_val', o.max_val, {silent: true}); flag = false; } @@ -446,7 +446,7 @@ define('pgadmin.node.column', [ _.each(m.datatypes, function(o) { if ( of_type == o.value ) { if(o.precision) { -m.set('min_val', o.min_val, {silent: true}); +m.set('min_val', 0, {silent: true}); m.set('max_val', o.max_val, {silent: true}); flag = true; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/column/sql/9.2_plus/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/column/sql/9.2_plus/update.sql index 385e40e..569cab5 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/column/sql/9.2_plus/update.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/column/sql/9.2_plus/update.sql @@ -9,7 +9,7 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.table)}} {% endif %} {### Alter column type and collation ###} -{% if (data.cltype and data.cltype != o_data.cltype) or (data.attlen is defined and data.attlen != o_data.attlen) or (data.attprecision is defined and data.attprecision != o_data.attprecision) %} +{% if (data.cltype and data.cltype != o_data.cltype) or (data.attlen is defined and data.attlen != o_data.attlen) or (data.attprecision is defined and data.attprecision != o_data.attprecision) or (data.collspcname and data.collspcname != o_data.collspcname)%} ALTER TABLE {{conn|qtIdent(data.schema, data.table)}} ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} TYPE {{ GET_TYPE.UPDATE_TYPE_SQL(conn, data, o_data) }}{% if data.collspcname and data.collspcname != o_data.collspcname %} COLLATE {{data.collspcname}}{% endif %}; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/column/sql/default/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/column/sql/default/update.sql index 6b17481..bb283f8 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/column/sql/default/update.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/column/sql/default/update.sql @@ -9,7 +9,7 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.table)}} {% endif %} {### Alter column type and collation ###} -{% if (data.cltype and data.cltype != o_data.cltype) or (data.attlen is defined and data.attlen != o_data.attlen) or (data.attprecision is defined and data.attprecision != o_data.attprecision) %} +{% if (data.cltype and data.cltype != o_data.cltype) or (data.attlen is defined and data.attlen != o_data.attlen) or (data.attprecision is defined and data.attprecision != o_data.attprecision) or (data.collspcname and data.collspcname != o_data.collspcname) %} ALTER TABLE {{conn|qtIdent(data.schema, data.table)}} ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} TYPE {{ GET_TYPE.UPDATE_TYPE_SQL(conn, data, o_data) }}{% if data.collspcname and data.collspcname != o_data.collspcname %} COLLATE {{data.collspcname}}{% endif %}; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/utils.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/utils.py index d9b69ec..c7127e6 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/utils.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/utils.py @@ -1691,32 +1691,37 @@ class BaseTableView(PGChildNodeView): length = False precision = False -if 'elemoid' in c: + +# If the column data type