From 3672013ddc2369970883cfa3c2a7f9e16461c39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yogesh=20Mahajan=C2=A0?= Date: Fri, 7 Aug 2020 17:17:51 +0530 Subject: [PATCH] Fixed an issue where the error message does not have a close button on utility dialogs. Fixes #5670 --- docs/en_US/release_notes_4_25.rst | 1 + web/pgadmin/browser/static/js/browser.js | 49 +++++++++++-------- .../file_manager/static/js/file_manager.js | 4 +- .../preferences/static/js/preferences.js | 2 +- web/pgadmin/tools/backup/static/js/backup.js | 6 +-- .../backup/static/js/backup_dialog_wrapper.js | 7 +++ .../import_export/static/js/import_export.js | 7 +++ .../tools/restore/static/js/restore.js | 2 +- .../static/js/restore_dialog_wrapper.js | 7 +++ .../static/js/search_objects.js | 2 +- .../file_manager/file_manager_specs.js | 45 +++++++++++------ 11 files changed, 88 insertions(+), 44 deletions(-) diff --git a/docs/en_US/release_notes_4_25.rst b/docs/en_US/release_notes_4_25.rst index b40b9ba1e..f1ce7815e 100644 --- a/docs/en_US/release_notes_4_25.rst +++ b/docs/en_US/release_notes_4_25.rst @@ -31,6 +31,7 @@ Bug fixes | `Issue #5490 `_ - Make the runtime configuration dialog non-modal. | `Issue #5632 `_ - Ensure that the user will be able to modify the start value of the Identity column. | `Issue #5646 `_ - Ensure that RLS Policy node should be searchable using search object. +| `Issue #5670 `_ - Fixed an issue where the error message does not have a close button on utility dialogs. | `Issue #5689 `_ - Added the 'ORDER BY' clause for the privileges type to fix schema diff issue. | `Issue #5708 `_ - Correct TLS certificate filename in the container deployment docs. | `Issue #5710 `_ - Fixed an issue when comparing the table with a trigger throwing error in schema diff. diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js index e010458cc..e8a85f95c 100644 --- a/web/pgadmin/browser/static/js/browser.js +++ b/web/pgadmin/browser/static/js/browser.js @@ -172,18 +172,23 @@ define('pgadmin.browser', [ default: 500, // If you change above values then make sure to update // calc method logic - calc: () => { + calc: (passed_width) => { let iw = window.innerWidth; - if (iw > pgAdmin.Browser.stdW.lg) - return pgAdmin.Browser.stdW.lg; - else if (iw > pgAdmin.Browser.stdW.md) - return pgAdmin.Browser.stdW.md; - else if (iw > pgAdmin.Browser.stdW.sm) - return pgAdmin.Browser.stdW.sm; - else - // if avilable screen resolution is still - // less then return the width value as it - return iw; + if(iw > passed_width){ + return passed_width; + }else{ + if (iw > pgAdmin.Browser.stdW.lg) + return pgAdmin.Browser.stdW.lg; + else if (iw > pgAdmin.Browser.stdW.md) + return pgAdmin.Browser.stdW.md; + else if (iw > pgAdmin.Browser.stdW.sm) + return pgAdmin.Browser.stdW.sm; + else + // if avilable screen resolution is still + // less then return the width value as it + return iw; + } + }, }, stdH: { @@ -193,17 +198,21 @@ define('pgadmin.browser', [ default: 550, // If you change above values then make sure to update // calc method logic - calc: () => { + calc: (passed_height) => { // We are excluding sm as it is too small for dialog let ih = window.innerHeight; - if (ih > pgAdmin.Browser.stdH.lg) - return pgAdmin.Browser.stdH.lg; - else if (ih > pgAdmin.Browser.stdH.md) - return pgAdmin.Browser.stdH.md; - else - // if avilable screen resolution is still - // less then return the height value as it - return ih; + if (ih > passed_height){ + return passed_height; + }else{ + if (ih > pgAdmin.Browser.stdH.lg) + return pgAdmin.Browser.stdH.lg; + else if (ih > pgAdmin.Browser.stdH.md) + return pgAdmin.Browser.stdH.md; + else + // if avilable screen resolution is still + // less then return the height value as it + return ih; + } }, }, // Default panels diff --git a/web/pgadmin/misc/file_manager/static/js/file_manager.js b/web/pgadmin/misc/file_manager/static/js/file_manager.js index f02c827d2..1da868896 100644 --- a/web/pgadmin/misc/file_manager/static/js/file_manager.js +++ b/web/pgadmin/misc/file_manager/static/js/file_manager.js @@ -37,8 +37,8 @@ define('misc.file_manager', [ }, // Call dialogs subject to dialog_type param show_dialog: function(params) { - let dialogWidth = pgAdmin.Browser.stdW.calc(); - let dialogHeight = pgAdmin.Browser.stdH.calc(); + let dialogWidth = pgAdmin.Browser.stdW.calc(pgAdmin.Browser.stdW.md); + let dialogHeight = pgAdmin.Browser.stdH.calc(pgAdmin.Browser.stdH.lg); if (params.dialog_type == 'create_file') { Alertify.createModeDlg(params).resizeTo(dialogWidth, dialogHeight); } else { diff --git a/web/pgadmin/preferences/static/js/preferences.js b/web/pgadmin/preferences/static/js/preferences.js index 1364b931b..62eda7aa6 100644 --- a/web/pgadmin/preferences/static/js/preferences.js +++ b/web/pgadmin/preferences/static/js/preferences.js @@ -512,7 +512,7 @@ define('pgadmin.preferences', [ }, show: function() { - Alertify.preferencesDlg(true).resizeTo(pgAdmin.Browser.stdW.calc(),pgAdmin.Browser.stdH.calc()); + Alertify.preferencesDlg(true).resizeTo(pgAdmin.Browser.stdW.calc(pgAdmin.Browser.stdW.lg),pgAdmin.Browser.stdH.calc(pgAdmin.Browser.stdH.lg)); }, }; diff --git a/web/pgadmin/tools/backup/static/js/backup.js b/web/pgadmin/tools/backup/static/js/backup.js index 4d98a7bd6..922660b88 100644 --- a/web/pgadmin/tools/backup/static/js/backup.js +++ b/web/pgadmin/tools/backup/static/js/backup.js @@ -650,7 +650,7 @@ define([ alertify, BackupModel ); - dialog.draw(action, item, {'globals': true}, pgBrowser.stdW.calc(), pgBrowser.stdH.calc()); + dialog.draw(action, item, {'globals': true}, pgBrowser.stdW.calc(pgBrowser.stdW.md), pgBrowser.stdH.calc(pgBrowser.stdH.md)); }, start_backup_server: function(action, item) { let dialog = new globalBackupDialog.BackupDialog( @@ -659,7 +659,7 @@ define([ alertify, BackupObjectModel ); - dialog.draw(action, item, {'server': true}, pgBrowser.stdW.calc(), pgBrowser.stdH.calc()); + dialog.draw(action, item, {'server': true}, pgBrowser.stdW.calc(pgBrowser.stdW.md), pgBrowser.stdH.calc(pgBrowser.stdH.md)); }, // Callback to draw Backup Dialog for objects backup_objects: function(action, treeItem) { @@ -669,7 +669,7 @@ define([ alertify, BackupObjectModel ); - dialog.draw(action, treeItem, null, pgBrowser.stdW.calc(), pgBrowser.stdH.calc()); + dialog.draw(action, treeItem, null, pgBrowser.stdW.calc(pgBrowser.stdW.md), pgBrowser.stdH.calc(pgBrowser.stdH.md)); }, }; return pgBrowser.Backup; diff --git a/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js b/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js index c3610cf59..05be8aa44 100644 --- a/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js +++ b/web/pgadmin/tools/backup/static/js/backup_dialog_wrapper.js @@ -114,6 +114,9 @@ export class BackupDialogWrapper extends DialogWrapper { ' ' + ' ' + ' ' + + '
' + + ' ' + + '
' + ' ' + ' ' + '').appendTo($container); @@ -253,6 +256,10 @@ export class BackupDialogWrapper extends DialogWrapper { ctx.errorModel.set(errorField, errormsg); statusBar.removeClass('d-none'); statusBar.find('.alert-text').html(errormsg); + self.elements.dialog.querySelector('.close-error').addEventListener('click', ()=>{ + statusBar.addClass('d-none'); + ctx.errorModel.set(errorField, errormsg); + }); }; if (!_.isUndefined(this.get('file')) && this.get('file') !== '') { diff --git a/web/pgadmin/tools/import_export/static/js/import_export.js b/web/pgadmin/tools/import_export/static/js/import_export.js index 1475023de..fcb8bf8ca 100644 --- a/web/pgadmin/tools/import_export/static/js/import_export.js +++ b/web/pgadmin/tools/import_export/static/js/import_export.js @@ -631,6 +631,9 @@ define([ ' ' + ' ' + ' ' + + '
' + + ' ' + + '
' + ' ' + ' ' + '').appendTo($container); @@ -645,6 +648,10 @@ define([ ctx.errorModel.set(errorField, errormsg); statusBar.removeClass('d-none'); statusBar.find('.alert-text').html(errormsg); + self.elements.dialog.querySelector('.close-error').addEventListener('click', ()=>{ + statusBar.addClass('d-none'); + ctx.errorModel.set(errorField, errormsg); + }); }; if (!_.isUndefined(this.get('filename')) && this.get('filename') !== '') { this.errorModel.clear(); diff --git a/web/pgadmin/tools/restore/static/js/restore.js b/web/pgadmin/tools/restore/static/js/restore.js index c308e2433..7f1eee675 100644 --- a/web/pgadmin/tools/restore/static/js/restore.js +++ b/web/pgadmin/tools/restore/static/js/restore.js @@ -424,7 +424,7 @@ define('tools.restore', [ let dialog = new restoreDialog.RestoreDialog( pgBrowser, $, alertify, RestoreObjectModel ); - dialog.draw(action, treeItem, pgBrowser.stdW.calc(), pgBrowser.stdH.calc()); + dialog.draw(action, treeItem, pgBrowser.stdW.calc(pgBrowser.stdW.md), pgBrowser.stdH.calc(pgBrowser.stdH.md)); }, }; return pgBrowser.Restore; diff --git a/web/pgadmin/tools/restore/static/js/restore_dialog_wrapper.js b/web/pgadmin/tools/restore/static/js/restore_dialog_wrapper.js index 5bc506869..5c261570b 100644 --- a/web/pgadmin/tools/restore/static/js/restore_dialog_wrapper.js +++ b/web/pgadmin/tools/restore/static/js/restore_dialog_wrapper.js @@ -106,6 +106,9 @@ export class RestoreDialogWrapper extends DialogWrapper { ' ' + ' ' + ' ' + + '
' + + ' ' + + '
' + ' ' + ' ' + '').appendTo($container); @@ -240,6 +243,10 @@ export class RestoreDialogWrapper extends DialogWrapper { ctx.errorModel.set(errorField, errormsg); statusBar.removeClass('d-none'); statusBar.find('.alert-text').html(errormsg); + self.elements.dialog.querySelector('.close-error').addEventListener('click', ()=>{ + statusBar.addClass('d-none'); + ctx.errorModel.set(errorField, errormsg); + }); }; if (!_.isUndefined(this.get('file')) && this.get('file') !== '') { diff --git a/web/pgadmin/tools/search_objects/static/js/search_objects.js b/web/pgadmin/tools/search_objects/static/js/search_objects.js index 749e9d4d3..1f86dc4fd 100644 --- a/web/pgadmin/tools/search_objects/static/js/search_objects.js +++ b/web/pgadmin/tools/search_objects/static/js/search_objects.js @@ -82,7 +82,7 @@ define([ alertify, {}, ); - dialog.draw(action, item, {}, pgBrowser.stdW.calc(), pgBrowser.stdH.calc()); + dialog.draw(action, item, {}, pgBrowser.stdW.calc(pgBrowser.stdW.md), pgBrowser.stdH.calc(pgBrowser.stdW.lg)); }, }; diff --git a/web/regression/javascript/file_manager/file_manager_specs.js b/web/regression/javascript/file_manager/file_manager_specs.js index d74bd567c..0485ee2cb 100644 --- a/web/regression/javascript/file_manager/file_manager_specs.js +++ b/web/regression/javascript/file_manager/file_manager_specs.js @@ -23,16 +23,22 @@ describe('fileSelectDialog', function () { md: 700, lg: 900, default: 500, - calc: () => { + calc: (passed_width) => { let iw = window.innerWidth; - if (iw > pgAdmin.Browser.stdW.lg) - return pgAdmin.Browser.stdW.lg; - else if (iw > pgAdmin.Browser.stdW.md) - return pgAdmin.Browser.stdW.md; - else if (iw > pgAdmin.Browser.stdW.sm) - return pgAdmin.Browser.stdW.sm; - else - return iw; + if(iw > passed_width){ + return passed_width; + }else{ + if (iw > pgAdmin.Browser.stdW.lg) + return pgAdmin.Browser.stdW.lg; + else if (iw > pgAdmin.Browser.stdW.md) + return pgAdmin.Browser.stdW.md; + else if (iw > pgAdmin.Browser.stdW.sm) + return pgAdmin.Browser.stdW.sm; + else + // if avilable screen resolution is still + // less then return the width value as it + return iw; + } }, }, stdH: { @@ -40,14 +46,21 @@ describe('fileSelectDialog', function () { md: 400, lg: 550, default: 550, - calc: () => { + calc: (passed_height) => { + // We are excluding sm as it is too small for dialog let ih = window.innerHeight; - if (ih > pgAdmin.Browser.stdH.lg) - return pgAdmin.Browser.stdH.lg; - else if (ih > pgAdmin.Browser.stdH.md) - return pgAdmin.Browser.stdH.md; - else - return ih; + if (ih > passed_height){ + return passed_height; + }else{ + if (ih > pgAdmin.Browser.stdH.lg) + return pgAdmin.Browser.stdH.lg; + else if (ih > pgAdmin.Browser.stdH.md) + return pgAdmin.Browser.stdH.md; + else + // if avilable screen resolution is still + // less then return the height value as it + return ih; + } }, }, };