Fixed an issue where pgAdmin is not opening properly. Fixes #6809

This commit is contained in:
Nikhil Mohite 2021-10-29 16:17:36 +05:30 committed by Akshay Joshi
parent 39992a817d
commit f71e2e8040
4 changed files with 32 additions and 24 deletions

View File

@ -20,5 +20,6 @@ Bug fixes
| `Issue #5427 <https://redmine.postgresql.org/issues/5427>`_ - Fixed pgAdmin freezing issue by providing the error message for the operation that can't perform due to lock on the particular table.
| `Issue #6780 <https://redmine.postgresql.org/issues/6780>`_ - Ensure that columns should be merged if the newly added column is present in the parent table.
| `Issue #6809 <https://redmine.postgresql.org/issues/6809>`_ - Fixed an issue where pgAdmin is not opening properly.
| `Issue #6859 <https://redmine.postgresql.org/issues/6859>`_ - Fixed an issue where properties panel is not updated when any object is added from the browser tree.
| `Issue #6949 <https://redmine.postgresql.org/issues/6949>`_ - Ensure that dialog should be opened when clicking on Reassign/Drop owned menu.

View File

@ -440,14 +440,16 @@ define('pgadmin.browser', [
initializeBrowserTree(obj);
// Syntax highlight the SQL Pane
obj.editor = CodeMirror.fromTextArea(
document.getElementById('sql-textarea'), {
lineNumbers: true,
mode: 'text/x-pgsql',
readOnly: true,
extraKeys: pgAdmin.Browser.editor_shortcut_keys,
screenReaderLabel: gettext('SQL'),
});
if(document.getElementById('sql-textarea')){
obj.editor = CodeMirror.fromTextArea(
document.getElementById('sql-textarea'), {
lineNumbers: true,
mode: 'text/x-pgsql',
readOnly: true,
extraKeys: pgAdmin.Browser.editor_shortcut_keys,
screenReaderLabel: gettext('SQL'),
});
}
/* Cache may take time to load for the first time
* Reflect the changes once cache is available
*/
@ -465,8 +467,8 @@ define('pgadmin.browser', [
});
setTimeout(function() {
obj.editor.setValue('-- ' + select_object_msg);
obj.editor.refresh();
obj?.editor?.setValue('-- ' + select_object_msg);
obj?.editor?.refresh();
}, 10);
// Build the treeview context menu

View File

@ -100,7 +100,10 @@ _.extend(pgBrowser, {
},
lock_layout: function(docker, op) {
let menu_items = this.menus['file']['mnu_locklayout']['menu_items'];
let menu_items = [];
if('mnu_locklayout' in this.menus['file']) {
menu_items = this.menus['file']['mnu_locklayout']['menu_items'];
}
switch(op) {
case this.lock_layout_levels.PREVENT_DOCKING:
@ -114,13 +117,15 @@ _.extend(pgBrowser, {
break;
}
_.each(menu_items, function(menu_item) {
if(menu_item.name != ('mnu_lock_'+op)) {
menu_item.change_checked(false);
} else {
menu_item.change_checked(true);
}
});
if(menu_items) {
_.each(menu_items, function(menu_item) {
if(menu_item.name != ('mnu_lock_'+op)) {
menu_item.change_checked(false);
} else {
menu_item.change_checked(true);
}
});
}
},
save_lock_layout: function(op) {

View File

@ -124,14 +124,14 @@ _.extend(pgBrowser, {
if(module === 'sqleditor' || module === null || typeof module === 'undefined') {
let sqlEditPreferences = obj.get_preferences_for_module('sqleditor');
$(obj.editor.getWrapperElement()).css(
$(obj?.editor?.getWrapperElement()).css(
'font-size',SqlEditorUtils.calcFontSize(sqlEditPreferences.sql_font_size)
);
obj.editor.setOption('tabSize', sqlEditPreferences.tab_size);
obj.editor.setOption('lineWrapping', sqlEditPreferences.wrap_code);
obj.editor.setOption('autoCloseBrackets', sqlEditPreferences.insert_pair_brackets);
obj.editor.setOption('matchBrackets', sqlEditPreferences.brace_matching);
obj.editor.refresh();
obj?.editor?.setOption('tabSize', sqlEditPreferences.tab_size);
obj?.editor?.setOption('lineWrapping', sqlEditPreferences.wrap_code);
obj?.editor?.setOption('autoCloseBrackets', sqlEditPreferences.insert_pair_brackets);
obj?.editor?.setOption('matchBrackets', sqlEditPreferences.brace_matching);
obj?.editor?.refresh();
}
},