Fixed an issue where the error message does not have a close button on utility dialogs. Fixes #5670

This commit is contained in:
Yogesh Mahajan  2020-08-07 17:17:51 +05:30 committed by Akshay Joshi
parent 9ad7476a34
commit 3672013ddc
11 changed files with 88 additions and 44 deletions

View File

@ -31,6 +31,7 @@ Bug fixes
| `Issue #5490 <https://redmine.postgresql.org/issues/5490>`_ - Make the runtime configuration dialog non-modal. | `Issue #5490 <https://redmine.postgresql.org/issues/5490>`_ - Make the runtime configuration dialog non-modal.
| `Issue #5632 <https://redmine.postgresql.org/issues/5632>`_ - Ensure that the user will be able to modify the start value of the Identity column. | `Issue #5632 <https://redmine.postgresql.org/issues/5632>`_ - Ensure that the user will be able to modify the start value of the Identity column.
| `Issue #5646 <https://redmine.postgresql.org/issues/5646>`_ - Ensure that RLS Policy node should be searchable using search object. | `Issue #5646 <https://redmine.postgresql.org/issues/5646>`_ - Ensure that RLS Policy node should be searchable using search object.
| `Issue #5670 <https://redmine.postgresql.org/issues/5670>`_ - Fixed an issue where the error message does not have a close button on utility dialogs.
| `Issue #5689 <https://redmine.postgresql.org/issues/5689>`_ - Added the 'ORDER BY' clause for the privileges type to fix schema diff issue. | `Issue #5689 <https://redmine.postgresql.org/issues/5689>`_ - Added the 'ORDER BY' clause for the privileges type to fix schema diff issue.
| `Issue #5708 <https://redmine.postgresql.org/issues/5708>`_ - Correct TLS certificate filename in the container deployment docs. | `Issue #5708 <https://redmine.postgresql.org/issues/5708>`_ - Correct TLS certificate filename in the container deployment docs.
| `Issue #5710 <https://redmine.postgresql.org/issues/5710>`_ - Fixed an issue when comparing the table with a trigger throwing error in schema diff. | `Issue #5710 <https://redmine.postgresql.org/issues/5710>`_ - Fixed an issue when comparing the table with a trigger throwing error in schema diff.

View File

@ -172,18 +172,23 @@ define('pgadmin.browser', [
default: 500, default: 500,
// If you change above values then make sure to update // If you change above values then make sure to update
// calc method logic // calc method logic
calc: () => { calc: (passed_width) => {
let iw = window.innerWidth; let iw = window.innerWidth;
if (iw > pgAdmin.Browser.stdW.lg) if(iw > passed_width){
return pgAdmin.Browser.stdW.lg; return passed_width;
else if (iw > pgAdmin.Browser.stdW.md) }else{
return pgAdmin.Browser.stdW.md; if (iw > pgAdmin.Browser.stdW.lg)
else if (iw > pgAdmin.Browser.stdW.sm) return pgAdmin.Browser.stdW.lg;
return pgAdmin.Browser.stdW.sm; else if (iw > pgAdmin.Browser.stdW.md)
else return pgAdmin.Browser.stdW.md;
// if avilable screen resolution is still else if (iw > pgAdmin.Browser.stdW.sm)
// less then return the width value as it return pgAdmin.Browser.stdW.sm;
return iw; else
// if avilable screen resolution is still
// less then return the width value as it
return iw;
}
}, },
}, },
stdH: { stdH: {
@ -193,17 +198,21 @@ define('pgadmin.browser', [
default: 550, default: 550,
// If you change above values then make sure to update // If you change above values then make sure to update
// calc method logic // calc method logic
calc: () => { calc: (passed_height) => {
// We are excluding sm as it is too small for dialog // We are excluding sm as it is too small for dialog
let ih = window.innerHeight; let ih = window.innerHeight;
if (ih > pgAdmin.Browser.stdH.lg) if (ih > passed_height){
return pgAdmin.Browser.stdH.lg; return passed_height;
else if (ih > pgAdmin.Browser.stdH.md) }else{
return pgAdmin.Browser.stdH.md; if (ih > pgAdmin.Browser.stdH.lg)
else return pgAdmin.Browser.stdH.lg;
// if avilable screen resolution is still else if (ih > pgAdmin.Browser.stdH.md)
// less then return the height value as it return pgAdmin.Browser.stdH.md;
return ih; else
// if avilable screen resolution is still
// less then return the height value as it
return ih;
}
}, },
}, },
// Default panels // Default panels

View File

@ -37,8 +37,8 @@ define('misc.file_manager', [
}, },
// Call dialogs subject to dialog_type param // Call dialogs subject to dialog_type param
show_dialog: function(params) { show_dialog: function(params) {
let dialogWidth = pgAdmin.Browser.stdW.calc(); let dialogWidth = pgAdmin.Browser.stdW.calc(pgAdmin.Browser.stdW.md);
let dialogHeight = pgAdmin.Browser.stdH.calc(); let dialogHeight = pgAdmin.Browser.stdH.calc(pgAdmin.Browser.stdH.lg);
if (params.dialog_type == 'create_file') { if (params.dialog_type == 'create_file') {
Alertify.createModeDlg(params).resizeTo(dialogWidth, dialogHeight); Alertify.createModeDlg(params).resizeTo(dialogWidth, dialogHeight);
} else { } else {

View File

@ -512,7 +512,7 @@ define('pgadmin.preferences', [
}, },
show: function() { 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));
}, },
}; };

View File

@ -650,7 +650,7 @@ define([
alertify, alertify,
BackupModel 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) { start_backup_server: function(action, item) {
let dialog = new globalBackupDialog.BackupDialog( let dialog = new globalBackupDialog.BackupDialog(
@ -659,7 +659,7 @@ define([
alertify, alertify,
BackupObjectModel 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 // Callback to draw Backup Dialog for objects
backup_objects: function(action, treeItem) { backup_objects: function(action, treeItem) {
@ -669,7 +669,7 @@ define([
alertify, alertify,
BackupObjectModel 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; return pgBrowser.Backup;

View File

@ -114,6 +114,9 @@ export class BackupDialogWrapper extends DialogWrapper {
' <i class="fa fa-exclamation-triangle text-danger" aria-hidden="true"></i> ' + ' <i class="fa fa-exclamation-triangle text-danger" aria-hidden="true"></i> ' +
' </div> ' + ' </div> ' +
' <div class="alert-text" role="alert"></div> ' + ' <div class="alert-text" role="alert"></div> ' +
' <div class="ml-auto close-error-bar"> ' +
' <a aria-label="' + gettext('Close error bar') + '" class="close-error fa fa-times text-danger"></a> ' +
' </div> ' +
' </div> ' + ' </div> ' +
' </div> ' + ' </div> ' +
'</div>').appendTo($container); '</div>').appendTo($container);
@ -253,6 +256,10 @@ export class BackupDialogWrapper extends DialogWrapper {
ctx.errorModel.set(errorField, errormsg); ctx.errorModel.set(errorField, errormsg);
statusBar.removeClass('d-none'); statusBar.removeClass('d-none');
statusBar.find('.alert-text').html(errormsg); 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') !== '') { if (!_.isUndefined(this.get('file')) && this.get('file') !== '') {

View File

@ -631,6 +631,9 @@ define([
' <i class="fa fa-exclamation-triangle text-danger" aria-hidden="true"></i> ' + ' <i class="fa fa-exclamation-triangle text-danger" aria-hidden="true"></i> ' +
' </div> ' + ' </div> ' +
' <div class="alert-text" role="alert"></div> ' + ' <div class="alert-text" role="alert"></div> ' +
' <div class="ml-auto close-error-bar"> ' +
' <a aria-label="' + gettext('Close error bar') + '" class="close-error fa fa-times text-danger"></a> ' +
' </div> ' +
' </div> ' + ' </div> ' +
' </div> ' + ' </div> ' +
'</div>').appendTo($container); '</div>').appendTo($container);
@ -645,6 +648,10 @@ define([
ctx.errorModel.set(errorField, errormsg); ctx.errorModel.set(errorField, errormsg);
statusBar.removeClass('d-none'); statusBar.removeClass('d-none');
statusBar.find('.alert-text').html(errormsg); 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') !== '') { if (!_.isUndefined(this.get('filename')) && this.get('filename') !== '') {
this.errorModel.clear(); this.errorModel.clear();

View File

@ -424,7 +424,7 @@ define('tools.restore', [
let dialog = new restoreDialog.RestoreDialog( let dialog = new restoreDialog.RestoreDialog(
pgBrowser, $, alertify, RestoreObjectModel 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; return pgBrowser.Restore;

View File

@ -106,6 +106,9 @@ export class RestoreDialogWrapper extends DialogWrapper {
' <i class="fa fa-exclamation-triangle text-danger" aria-hidden="true"></i> ' + ' <i class="fa fa-exclamation-triangle text-danger" aria-hidden="true"></i> ' +
' </div> ' + ' </div> ' +
' <div class="alert-text" role="alert"></div> ' + ' <div class="alert-text" role="alert"></div> ' +
' <div class="ml-auto close-error-bar"> ' +
' <a aria-label="' + gettext('Close error bar') + '" class="close-error fa fa-times text-danger"></a> ' +
' </div> ' +
' </div> ' + ' </div> ' +
' </div> ' + ' </div> ' +
'</div>').appendTo($container); '</div>').appendTo($container);
@ -240,6 +243,10 @@ export class RestoreDialogWrapper extends DialogWrapper {
ctx.errorModel.set(errorField, errormsg); ctx.errorModel.set(errorField, errormsg);
statusBar.removeClass('d-none'); statusBar.removeClass('d-none');
statusBar.find('.alert-text').html(errormsg); 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') !== '') { if (!_.isUndefined(this.get('file')) && this.get('file') !== '') {

View File

@ -82,7 +82,7 @@ define([
alertify, 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));
}, },
}; };

View File

@ -23,16 +23,22 @@ describe('fileSelectDialog', function () {
md: 700, md: 700,
lg: 900, lg: 900,
default: 500, default: 500,
calc: () => { calc: (passed_width) => {
let iw = window.innerWidth; let iw = window.innerWidth;
if (iw > pgAdmin.Browser.stdW.lg) if(iw > passed_width){
return pgAdmin.Browser.stdW.lg; return passed_width;
else if (iw > pgAdmin.Browser.stdW.md) }else{
return pgAdmin.Browser.stdW.md; if (iw > pgAdmin.Browser.stdW.lg)
else if (iw > pgAdmin.Browser.stdW.sm) return pgAdmin.Browser.stdW.lg;
return pgAdmin.Browser.stdW.sm; else if (iw > pgAdmin.Browser.stdW.md)
else return pgAdmin.Browser.stdW.md;
return iw; 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: { stdH: {
@ -40,14 +46,21 @@ describe('fileSelectDialog', function () {
md: 400, md: 400,
lg: 550, lg: 550,
default: 550, default: 550,
calc: () => { calc: (passed_height) => {
// We are excluding sm as it is too small for dialog
let ih = window.innerHeight; let ih = window.innerHeight;
if (ih > pgAdmin.Browser.stdH.lg) if (ih > passed_height){
return pgAdmin.Browser.stdH.lg; return passed_height;
else if (ih > pgAdmin.Browser.stdH.md) }else{
return pgAdmin.Browser.stdH.md; if (ih > pgAdmin.Browser.stdH.lg)
else return pgAdmin.Browser.stdH.lg;
return ih; 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;
}
}, },
}, },
}; };