Added native menu support in desktop mode. #5503

This commit is contained in:
Nikhil Mohite
2022-12-06 18:16:36 +05:30
committed by GitHub
parent cddb24bc50
commit 2480d08e0f
78 changed files with 1126 additions and 523 deletions

View File

@@ -98,6 +98,7 @@ window.onload = function(e){
<div class="row"><div class="col-12 pg-sp-text">{{ _('Loading {0} v{1}...').format(config.APP_NAME, config.APP_VERSION) }}</div></div>
</div>
</div>
{% if current_app.PGADMIN_RUNTIME | string() == 'False' %}
<nav class="navbar fixed-top navbar-expand-lg navbar-dark pg-navbar">
<a class="navbar-brand pgadmin_header_logo" onClick="return false;" href="{{ '#' }}"
title="{{ config.APP_NAME }} {{ _('logo') }}" aria-label="{ config.APP_NAME }} {{ _('logo') }}">
@@ -173,6 +174,9 @@ window.onload = function(e){
</nav>
<div id="dockerContainer" class="pg-docker"></div>
{% else %}
<div id="dockerContainer" class="pg-docker pg-docker-native"></div>
{% endif %}
{% include 'browser/messages.html' %}

View File

@@ -44,6 +44,8 @@ define('pgadmin.browser.utils',
/* Add hooked-in panels by extensions */
pgBrowser['panels_items'] = '{{ current_app.panels|tojson }}';
pgBrowser['MainMenus'] = [];
pgAdmin['csrf_token_header'] = '{{ current_app.config.get('WTF_CSRF_HEADERS')[0] }}';
pgAdmin['csrf_token'] = '{{ csrf_token() }}';
pgAdmin['server_mode'] = '{{ current_app.config.get('SERVER_MODE') }}';
@@ -104,7 +106,9 @@ define('pgadmin.browser.utils',
{% for key in ('File', 'Edit', 'Object' 'Tools', 'Management', 'Help') %}
obj.add_menus({{ MENU_ITEMS(key, current_app.menu_items['%s_items' % key.lower()])}});
{% endfor %}
obj.create_menus();
if('{{current_app.PGADMIN_RUNTIME}}' == 'False') {
obj.create_menus();
}
} else {
//recall after some time
setTimeout(function(){ self.addMenus(obj); }, 3000);