mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed an issue where lock layout menu was not in sync with preferences. #5758
This commit is contained in:
parent
713ddb5f62
commit
ff6f0825b8
@ -565,6 +565,8 @@ def utils():
|
||||
# This will be opposite of use_space option
|
||||
editor_indent_with_tabs = False if editor_use_spaces else True
|
||||
|
||||
prefs = Preferences.module('browser')
|
||||
current_ui_lock = prefs.preference('lock_layout').get()
|
||||
# Try to fetch current libpq version from the driver
|
||||
try:
|
||||
from config import PG_DEFAULT_DRIVER
|
||||
@ -627,7 +629,8 @@ def utils():
|
||||
username=current_user.username,
|
||||
auth_source=auth_source,
|
||||
heartbeat_timeout=config.SERVER_HEARTBEAT_TIMEOUT,
|
||||
password_length_min=config.PASSWORD_LENGTH_MIN
|
||||
password_length_min=config.PASSWORD_LENGTH_MIN,
|
||||
current_ui_lock=current_ui_lock
|
||||
),
|
||||
200, {'Content-Type': MIMETYPE_APP_JS})
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
{% endif %}label: "{{ item.label }}", applies: ["{{ key.lower() }}"],
|
||||
priority: {{ item.priority }},
|
||||
enable: "{{ item.enable }}",
|
||||
{% if item.checked is defined %}checked: {% if item.checked %}true{% else %}false{% endif %},
|
||||
{% if item.checked is defined %}checked: {% if (item.checked || item.name == 'mnu_lock_'+current_ui_lock) %}true{% else %}false{% endif %},
|
||||
{% endif %}
|
||||
{% if item.below is defined %}below: {% if item.below %}true{% else %}false{% endif %},
|
||||
{% endif %}
|
||||
|
@ -574,6 +574,19 @@ export default function PreferencesComponent({ ...props }) {
|
||||
gettext('Later')
|
||||
);
|
||||
}
|
||||
// Sync the lock layout menu with preferences
|
||||
if (pref.name == 'lock_layout') {
|
||||
let fileMenu = pgAdmin.Browser.MainMenus.find((menu) => menu.name == 'file');
|
||||
let layoutSubMenu = fileMenu['menuItems'].find(menu => menu.name == 'mnu_locklayout');
|
||||
layoutSubMenu['menu_items'].forEach(item => {
|
||||
if (item.name === 'mnu_lock_'+save_data[0]['value']) {
|
||||
item.checked = true;
|
||||
} else {
|
||||
item.checked = false;
|
||||
}
|
||||
});
|
||||
pgAdmin.Browser.Events.trigger('pgadmin:nw-refresh-menu-item', 'lock_layout');
|
||||
}
|
||||
}
|
||||
|
||||
if (requires_refresh) {
|
||||
|
Loading…
Reference in New Issue
Block a user