Fixed an issue where the top menu disappears when entering into the full screen for minimum screen resolution. Fixes #6322

This commit is contained in:
Akshay Joshi 2021-03-17 18:47:25 +05:30
parent ff06a18155
commit 4bb71c56ad
4 changed files with 38 additions and 11 deletions

View File

@ -52,3 +52,4 @@ Bug fixes
| `Issue #6307 <https://redmine.postgresql.org/issues/6307>`_ - Fixed an issue where the incorrect values visible in the dependents tab for publication.
| `Issue #6312 <https://redmine.postgresql.org/issues/6312>`_ - Fixed an issue where copy/paste rows in view data paste the wrong value for boolean type.
| `Issue #6316 <https://redmine.postgresql.org/issues/6316>`_ - Ensure that the primary key should be visible properly in the table dialog.
| `Issue #6322 <https://redmine.postgresql.org/issues/6322>`_ - Fixed an issue where the top menu disappears when entering into the full screen for minimum screen resolution.

View File

@ -147,7 +147,7 @@ const getAvailablePort = (fixedPort) => {
const currentTime = (new Date()).getTime();
const serverLogFile = path.join(getLocalAppDataPath(), 'pgadmin4.' + currentTime.toString() + '.log');
const configFileName = path.join(getAppDataPath(), 'runtime_config.json');
const DEFAULT_CONFIG_DATA = {'fixedPort': false, 'portNo': 5050, 'connectionTimeout': 90, 'windowWidth': 1300, 'windowHeight': 900, 'zoomLevel': 0};
const DEFAULT_CONFIG_DATA = {'fixedPort': false, 'portNo': 5050, 'connectionTimeout': 90, 'zoomLevel': 0};
// This function is used to read the file and return the content
const readServerLog = () => {
@ -322,7 +322,16 @@ const actualSize = () => {
const toggleFullScreen = () => {
if (pgAdminWindowObject != null) {
// Toggle full screen
pgAdminWindowObject.toggleFullscreen();
// Change the menu label.
var menu_label = pgAdminWindowObject.window.document.querySelector('#mnu_toggle_fullscreen_runtime span').innerHTML;
if (menu_label.indexOf('Enter Full Screen') > 0) {
pgAdminWindowObject.window.document.querySelector('#mnu_toggle_fullscreen_runtime span').innerHTML = menu_label.replace('Enter', 'Exit');
} else if (menu_label.indexOf('Exit Full Screen') > 0) {
pgAdminWindowObject.window.document.querySelector('#mnu_toggle_fullscreen_runtime span').innerHTML = menu_label.replace('Exit', 'Enter');
}
}
};
@ -347,9 +356,34 @@ let ConfigureStore = {
jsonData: {},
init: function() {
// Initialize the Screen.
let screen_obj = nw.Screen.Init();
// Minimum resolution support
let screen_height = 480;
let screen_width = 640;
// if screen_obj is not null and have at least one element then get the
// height and width of the work area.
if (screen_obj !== null && screen_obj !== undefined &&
screen_obj.screens.length > 0) {
screen_height = screen_obj.screens[0]['work_area']['height'] - 100;
screen_width = screen_obj.screens[0]['work_area']['width'] - 100;
}
if (!this.readConfig()){
this.jsonData = DEFAULT_CONFIG_DATA;
this.jsonData['windowHeight'] = screen_height;
this.jsonData['windowWidth'] = screen_width;
this.saveConfig();
} else {
// Check if stored window height and width is greater then the
// actual screen height and width, set the screen height and width.
if (ConfigureStore.get('windowHeight') > screen_height ||
ConfigureStore.get('windowWidth') > screen_width) {
this.set('windowHeight', screen_height);
this.set('windowWidth', screen_width);
this.saveConfig();
}
}
},

View File

@ -199,8 +199,8 @@ function startDesktopMode() {
function launchPgAdminWindow() {
// Create and launch new window and open pgAdmin url
misc.writeServerLog('Application Server URL: ' + startPageUrl);
let winWidth = misc.ConfigureStore.get('windowWidth', 1300);
let winHeight = misc.ConfigureStore.get('windowHeight', 900);
let winWidth = misc.ConfigureStore.get('windowWidth');
let winHeight = misc.ConfigureStore.get('windowHeight');
nw.Window.open(startPageUrl, {
'icon': '../../assets/pgAdmin4.png',

View File

@ -42,14 +42,6 @@ _.extend(pgBrowser, {
// This function is callback function when 'Enter Full Screen' menu is clicked.
mnu_toggle_fullscreen_runtime: function() {
var menu_label = document.querySelector('#mnu_toggle_fullscreen_runtime span').innerHTML;
if (menu_label.indexOf('Enter Full Screen') > 0) {
document.querySelector('#mnu_toggle_fullscreen_runtime span').innerHTML = menu_label.replace('Enter', 'Exit');
} else if (menu_label.indexOf('Exit Full Screen') > 0) {
document.querySelector('#mnu_toggle_fullscreen_runtime span').innerHTML = menu_label.replace('Exit', 'Enter');
}
this.send_signal_to_runtime('Runtime Toggle Full Screen');
},