mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-29 02:11:28 -06:00
fix: SDA-2151: fix network request url reload (#1024)
* SDA-2151: fix network request url reload * SDA-2151: add documentation for new parameter
This commit is contained in:
parent
b1bcbef11a
commit
9e50ffa472
@ -306,7 +306,7 @@ export class WindowHandler {
|
||||
}
|
||||
// monitors network connection and
|
||||
// displays error banner on failure
|
||||
monitorNetworkInterception();
|
||||
monitorNetworkInterception(this.url || this.userConfig.url || this.globalConfig.url);
|
||||
});
|
||||
|
||||
this.mainWindow.webContents.on('did-finish-load', async () => {
|
||||
@ -358,7 +358,7 @@ export class WindowHandler {
|
||||
if (this.mainWindow && windowExists(this.mainWindow)) {
|
||||
this.mainWindow.webContents.insertCSS(fs.readFileSync(path.join(__dirname, '..', '/renderer/styles/network-error.css'), 'utf8').toString());
|
||||
this.mainWindow.webContents.send('network-error', {error: this.loadFailError});
|
||||
isSymphonyReachable(this.mainWindow);
|
||||
isSymphonyReachable(this.mainWindow, this.url || this.userConfig.url || this.globalConfig.url);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
|
@ -32,7 +32,6 @@ enum styleNames {
|
||||
}
|
||||
|
||||
const checkValidWindow = true;
|
||||
const { url: configUrl } = config.getGlobalConfigFields([ 'url' ]);
|
||||
const { ctWhitelist } = config.getConfigFields([ 'ctWhitelist' ]);
|
||||
|
||||
// Network status check variables
|
||||
@ -518,8 +517,9 @@ export const handleCertificateProxyVerification = (
|
||||
* every 10sec, on active reloads the given window
|
||||
*
|
||||
* @param window {ICustomBrowserWindow}
|
||||
* @param url Pod URL to load
|
||||
*/
|
||||
export const isSymphonyReachable = (window: ICustomBrowserWindow | null) => {
|
||||
export const isSymphonyReachable = (window: ICustomBrowserWindow | null, url: string) => {
|
||||
if (networkStatusCheckIntervalId) {
|
||||
return;
|
||||
}
|
||||
@ -527,7 +527,7 @@ export const isSymphonyReachable = (window: ICustomBrowserWindow | null) => {
|
||||
return;
|
||||
}
|
||||
networkStatusCheckIntervalId = setInterval(() => {
|
||||
const { hostname, protocol } = parse(configUrl);
|
||||
const { hostname, protocol } = parse(url);
|
||||
if (!hostname || !protocol) {
|
||||
return;
|
||||
}
|
||||
@ -536,7 +536,7 @@ export const isSymphonyReachable = (window: ICustomBrowserWindow | null) => {
|
||||
fetch(podUrl, { method: 'GET' }).then((rsp) => {
|
||||
if (rsp.status === 200 && windowHandler.isOnline) {
|
||||
logger.info(`window-utils: pod ${podUrl} is reachable, loading main window!`);
|
||||
window.loadURL(configUrl);
|
||||
window.loadURL(url);
|
||||
if (networkStatusCheckIntervalId) {
|
||||
clearInterval(networkStatusCheckIntervalId);
|
||||
networkStatusCheckIntervalId = null;
|
||||
@ -639,12 +639,12 @@ export const updateFeaturesForCloudConfig = async (): Promise<void> => {
|
||||
|
||||
/**
|
||||
* Monitors network requests and displays red banner on failure
|
||||
* @param url: Pod URL to be loaded after network is active again
|
||||
*/
|
||||
export const monitorNetworkInterception = () => {
|
||||
export const monitorNetworkInterception = (url: string) => {
|
||||
if (isNetworkMonitorInitialized) {
|
||||
return;
|
||||
}
|
||||
const { url } = config.getGlobalConfigFields( [ 'url' ] );
|
||||
const { hostname, protocol } = parse(url);
|
||||
|
||||
if (!hostname || !protocol) {
|
||||
|
Loading…
Reference in New Issue
Block a user