mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 17:31:36 -06:00
fix: SDA-2762: load correct page on network issues (#1145)
* SDA-2762: load correct page on network issues * SDA-2762: refactor code
This commit is contained in:
parent
263467cbcd
commit
eb5c00688f
@ -1,18 +1,25 @@
|
|||||||
# Intro
|
# Intro
|
||||||
The SDA displays a network error page when there is some network related issue Including the error code. which makes it easier for users to understand what's the actual problem is.
|
The SDA displays a network error page when there are network failures.
|
||||||
|
|
||||||
# Platforms Supported
|
# Platforms Supported
|
||||||
macOS, Windows 10, Windows 7
|
macOS, Windows 10
|
||||||
|
|
||||||
# Purpose
|
# Purpose
|
||||||
To let the users know the exact error the page stopped loading, instead of just displaying a blank screen.
|
To create awareness for users to try and reload Symphony and also to understand the network error in case they need to engage the support team.
|
||||||
|
|
||||||
# Details
|
# Details
|
||||||
This error info page will be displayed in the main electron app and can be any of the following reasons (Network offline, Proxy connection failed, Endpoint not access able, etc..)
|
This error info page will be displayed in the SDA and can be any of the following reasons
|
||||||
|
|
||||||
The error info page will be included with retry button which on clicking the SDA will be reloaded with the global config POD URL ex: "https://my.symphony.com"
|
- Network offline
|
||||||
|
- Proxy connection failed,
|
||||||
|
- Endpoint not access able
|
||||||
|
- Etc..
|
||||||
|
|
||||||
The list of all the error codes can be found [here](https://cs.chromium.org/chromium/src/net/base/net_error_list.h)
|
The list of all the error codes can be found [here](https://cs.chromium.org/chromium/src/net/base/net_error_list.h)
|
||||||
|
|
||||||
|
We also show a **Retry** button which upon a user clicking, Symphony is reloaded with two scenarios handled:
|
||||||
|
- If a user has already logged in, Symphony is reloaded and a user doesn't need to login
|
||||||
|
- If a user hasn't logged in yet or is on the verge of it, Symphony is reloaded and user is taken back to the login page
|
||||||
|
|
||||||
# Example
|
# Example
|
||||||
N/A
|
N/A
|
||||||
|
@ -61,6 +61,7 @@ ipcMain.on(apiName.symphonyApi, async (event: Electron.IpcMainEvent, arg: IApiAr
|
|||||||
// Set this to false once the SFE is completely loaded
|
// Set this to false once the SFE is completely loaded
|
||||||
// so, we can prevent from showing error banners
|
// so, we can prevent from showing error banners
|
||||||
windowHandler.isWebPageLoading = false;
|
windowHandler.isWebPageLoading = false;
|
||||||
|
windowHandler.isLoggedIn = true;
|
||||||
break;
|
break;
|
||||||
case apiCmds.registerLogRetriever:
|
case apiCmds.registerLogRetriever:
|
||||||
registerLogRetriever(event.sender, arg.logName);
|
registerLogRetriever(event.sender, arg.logName);
|
||||||
@ -105,7 +106,7 @@ ipcMain.on(apiName.symphonyApi, async (event: Electron.IpcMainEvent, arg: IApiAr
|
|||||||
case apiCmds.bringToFront:
|
case apiCmds.bringToFront:
|
||||||
// validates the user bring to front config and activates the wrapper
|
// validates the user bring to front config and activates the wrapper
|
||||||
if (typeof arg.reason === 'string' && arg.reason === 'notification') {
|
if (typeof arg.reason === 'string' && arg.reason === 'notification') {
|
||||||
const { bringToFront } = config.getConfigFields([ 'bringToFront' ]);
|
const { bringToFront } = config.getConfigFields(['bringToFront']);
|
||||||
if (bringToFront === CloudConfigDataTypes.ENABLED) {
|
if (bringToFront === CloudConfigDataTypes.ENABLED) {
|
||||||
activate(arg.windowName, false);
|
activate(arg.windowName, false);
|
||||||
}
|
}
|
||||||
@ -185,7 +186,7 @@ ipcMain.on(apiName.symphonyApi, async (event: Electron.IpcMainEvent, arg: IApiAr
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case apiCmds.getConfigUrl:
|
case apiCmds.getConfigUrl:
|
||||||
const { url } = config.getGlobalConfigFields([ 'url' ]);
|
const { url } = config.getGlobalConfigFields(['url']);
|
||||||
event.returnValue = url;
|
event.returnValue = url;
|
||||||
break;
|
break;
|
||||||
case apiCmds.registerAnalyticsHandler:
|
case apiCmds.registerAnalyticsHandler:
|
||||||
|
@ -114,6 +114,7 @@ export class WindowHandler {
|
|||||||
public spellchecker: SpellChecker | undefined;
|
public spellchecker: SpellChecker | undefined;
|
||||||
public isCustomTitleBar: boolean;
|
public isCustomTitleBar: boolean;
|
||||||
public isWebPageLoading: boolean = true;
|
public isWebPageLoading: boolean = true;
|
||||||
|
public isLoggedIn: boolean = false;
|
||||||
public screenShareIndicatorFrameUtil: string;
|
public screenShareIndicatorFrameUtil: string;
|
||||||
public shouldShowWelcomeScreen: boolean = false;
|
public shouldShowWelcomeScreen: boolean = false;
|
||||||
|
|
||||||
@ -611,9 +612,7 @@ export class WindowHandler {
|
|||||||
|
|
||||||
// Reloads the Symphony
|
// Reloads the Symphony
|
||||||
ipcMain.on('reload-symphony', () => {
|
ipcMain.on('reload-symphony', () => {
|
||||||
if (this.mainWindow && windowExists(this.mainWindow)) {
|
this.reloadSymphony();
|
||||||
this.mainWindow.loadURL(this.url || this.globalConfig.url);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Certificate verification proxy
|
// Certificate verification proxy
|
||||||
@ -1639,6 +1638,23 @@ export class WindowHandler {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reloads symphony in case of network failures
|
||||||
|
*/
|
||||||
|
public reloadSymphony() {
|
||||||
|
if (this.mainWindow && windowExists(this.mainWindow)) {
|
||||||
|
// If the client is fully loaded, upon network interruption, load that
|
||||||
|
if (this.isLoggedIn) {
|
||||||
|
logger.info(`window-utils: user has logged in, getting back to Symphony app`);
|
||||||
|
this.mainWindow.loadURL(this.url || this.userConfig.url || this.globalConfig.url);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// If not, revert to loading the starting pod url
|
||||||
|
logger.info(`window-utils: user hasn't logged in yet, loading login page again`);
|
||||||
|
this.mainWindow.loadURL(this.userConfig.url || this.globalConfig.url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listens for app load timeouts and reloads if required
|
* Listens for app load timeouts and reloads if required
|
||||||
*/
|
*/
|
||||||
@ -1917,6 +1933,7 @@ export class WindowHandler {
|
|||||||
|
|
||||||
return { ...defaultWindowOpts, ...windowOpts };
|
return { ...defaultWindowOpts, ...windowOpts };
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const windowHandler = new WindowHandler();
|
const windowHandler = new WindowHandler();
|
||||||
|
@ -539,7 +539,7 @@ export const isSymphonyReachable = (window: ICustomBrowserWindow | null, url: st
|
|||||||
fetch(podUrl, { method: 'GET' }).then((rsp) => {
|
fetch(podUrl, { method: 'GET' }).then((rsp) => {
|
||||||
if (rsp.status === 200 && windowHandler.isOnline) {
|
if (rsp.status === 200 && windowHandler.isOnline) {
|
||||||
logger.info(`window-utils: pod ${podUrl} is reachable, loading main window!`);
|
logger.info(`window-utils: pod ${podUrl} is reachable, loading main window!`);
|
||||||
window.loadURL(url);
|
windowHandler.reloadSymphony();
|
||||||
if (networkStatusCheckIntervalId) {
|
if (networkStatusCheckIntervalId) {
|
||||||
clearInterval(networkStatusCheckIntervalId);
|
clearInterval(networkStatusCheckIntervalId);
|
||||||
networkStatusCheckIntervalId = null;
|
networkStatusCheckIntervalId = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user