Hi, Please find the attached updated patch.
On Thu, May 3, 2018 at 9:02 PM, Dave Page <dp...@pgadmin.org> wrote: > Hi > > On Thu, May 3, 2018 at 10:19 AM, Khushboo Vashi < > khushboo.va...@enterprisedb.com> wrote: > >> >> >> On Wed, May 2, 2018 at 5:56 PM, Akshay Joshi < >> akshay.jo...@enterprisedb.com> wrote: >> >>> Hi Khushboo >>> >>> I have reviewed your code and looks good to me. Can we change the >>> message from "The database name is inappropriate" to some meaningful >>> message, so that user should know why it is inappropriate. If user will be >>> able to create database with "=" in name then why Backup, Maintenance and >>> Restore fails. >>> >> > I changed the messages to read more like this: "Maintenance job creation > failed. Databases with = symbols in the name cannot be maintained using > this utility.". > > Changed. > However; I think that throwing the error when the user tries to execute > the process is quite unhelpful, as the user may have spent some time > choosing options etc. Can we do it when they open the dialogue (show the > error instead of the tool's dialogue)? > > Done. > Thanks. > > >> >>> Thanks, Khushboo > Done. Please find the attached updated patch. >> >>> On Wed, May 2, 2018 at 3:44 PM, Khushboo Vashi < >>> khushboo.va...@enterprisedb.com> wrote: >>> >>>> Hi, >>>> >>>> Please find the attached patch which will fix RMs # 1220 and #1221. >>>> >>>> If the database name contains = then the backup, maintenance and >>>> restore jobs are failing. >>>> To fix these, we will display the error message regarding inappropriate >>>> database name. >>>> >>>> Thanks, >>>> Khushboo >>>> >>> >>> >>> >>> -- >>> *Akshay Joshi* >>> >>> *Sr. Software Architect * >>> >>> >>> >>> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246* >>> >> >> > > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company >
diff --git a/web/pgadmin/tools/backup/static/js/backup.js b/web/pgadmin/tools/backup/static/js/backup.js index ddbfaee..1b0b362 100644 --- a/web/pgadmin/tools/backup/static/js/backup.js +++ b/web/pgadmin/tools/backup/static/js/backup.js @@ -835,6 +835,17 @@ commonUtils if (!node) return; + var treeInfo = node.getTreeNodeHierarchy.apply(node, [item]); + + if (treeInfo.database._label.indexOf('=') >= 0) { + alertify.alert( + gettext('Backup error'), + gettext('Backup job creation failed. '+ + 'Databases with = symbols in the name cannot be backed up using this utility.') + ); + return; + } + title = title.sprintf(node.label, data.label).value(); if (!alertify.backup_objects) { diff --git a/web/pgadmin/tools/maintenance/static/js/maintenance.js b/web/pgadmin/tools/maintenance/static/js/maintenance.js index 81e4594..f210260 100644 --- a/web/pgadmin/tools/maintenance/static/js/maintenance.js +++ b/web/pgadmin/tools/maintenance/static/js/maintenance.js @@ -284,6 +284,18 @@ define([ if (!d) return; + var node = d && pgBrowser.Nodes[d._type], + treeInfo = node.getTreeNodeHierarchy.apply(node, [i]); + + if (treeInfo.database._label.indexOf('=') >= 0) { + Alertify.alert( + gettext('Maintenance error'), + gettext('Maintenance job creation failed. '+ + 'Databases with = symbols in the name cannot be maintained using this utility.') + ); + return; + } + if (!Alertify.MaintenanceDialog) { Alertify.dialog('MaintenanceDialog', function factory() { diff --git a/web/pgadmin/tools/restore/static/js/restore.js b/web/pgadmin/tools/restore/static/js/restore.js index 5c082a9..585b972 100644 --- a/web/pgadmin/tools/restore/static/js/restore.js +++ b/web/pgadmin/tools/restore/static/js/restore.js @@ -451,6 +451,17 @@ commonUtils if (!node) return; + var treeInfo = node.getTreeNodeHierarchy.apply(node, [item]); + + if (treeInfo.database._label.indexOf('=') >= 0) { + alertify.alert( + gettext('Restore error'), + gettext('Restore job creation failed. '+ + 'Databases with = symbols in the name cannot be restored using this utility.') + ); + return; + } + title = title.sprintf(node.label, data.label).value(); if (!alertify.pg_restore) {