mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 17:31:36 -06:00
Merge branch 'master' into SDA-2533-Annotate-P5
This commit is contained in:
commit
170681750e
@ -6,6 +6,7 @@
|
||||
"buildNumber": "0",
|
||||
"searchAPIVersion": "1.55.3",
|
||||
"sfeVersion": "0",
|
||||
"sfeClientType": "1.5",
|
||||
"description": "Symphony desktop app (Foundation ODP)",
|
||||
"author": "Symphony OSS <help@finos.org>",
|
||||
"main": "lib/src/app/init.js",
|
||||
@ -123,7 +124,7 @@
|
||||
"browserify": "16.5.1",
|
||||
"cross-env": "5.2.0",
|
||||
"del": "3.0.0",
|
||||
"electron": "9.3.2",
|
||||
"electron": "9.3.5",
|
||||
"electron-builder": "22.7.0",
|
||||
"electron-builder-squirrel-windows": "20.38.3",
|
||||
"electron-icon-maker": "0.0.4",
|
||||
@ -183,4 +184,4 @@
|
||||
"!lib/src/**/*.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -62,7 +62,8 @@ exports[`about app should render correctly 1`] = `
|
||||
</li>
|
||||
<li>
|
||||
<b>
|
||||
SFE:
|
||||
SFE-Lite
|
||||
:
|
||||
</b>
|
||||
|
||||
N/A
|
||||
|
@ -16,6 +16,7 @@ describe('about app', () => {
|
||||
buildNumber: '4.x.x',
|
||||
hostname: 'N/A',
|
||||
sfeVersion: 'N/A',
|
||||
sfeClientType: '1.5',
|
||||
sdaVersion: '3.8.0',
|
||||
sdaBuildNumber: '0',
|
||||
electronVersion: '3.1.11',
|
||||
|
@ -41,6 +41,7 @@ test('about-app: verify copy button with few data validation', async (t) => {
|
||||
t.true(clipboard.hasOwnProperty('appName'));
|
||||
t.true(clipboard.hasOwnProperty('clientVersion'));
|
||||
t.true(clipboard.hasOwnProperty('sfeVersion'));
|
||||
t.true(clipboard.hasOwnProperty('sfeClientType'));
|
||||
t.true(clipboard.hasOwnProperty('sdaVersion'));
|
||||
t.true(clipboard.hasOwnProperty('sdaBuildNumber'));
|
||||
robotActions.closeWindow();
|
||||
|
@ -39,6 +39,7 @@ export interface IConfig {
|
||||
mainWinPos?: ICustomRectangle;
|
||||
locale?: string;
|
||||
installVariant?: string;
|
||||
bootCount?: number;
|
||||
}
|
||||
|
||||
export interface IGlobalConfig {
|
||||
@ -117,6 +118,7 @@ class Config {
|
||||
public filteredCloudConfig: ICloudConfig | {};
|
||||
private isFirstTime: boolean = true;
|
||||
private installVariant: string | undefined;
|
||||
private bootCount: number | undefined;
|
||||
private readonly configFileName: string;
|
||||
private readonly installVariantFilename: string;
|
||||
private readonly installVariantPath: string;
|
||||
@ -278,10 +280,19 @@ class Config {
|
||||
// update to the new build number
|
||||
filteredFields.buildNumber = buildNumber;
|
||||
filteredFields.installVariant = this.installVariant;
|
||||
filteredFields.bootCount = 0;
|
||||
logger.info(`config-handler: setting first time launch for build`, buildNumber);
|
||||
return await this.updateUserConfig(filteredFields);
|
||||
}
|
||||
await this.updateUserConfig({ buildNumber, installVariant: this.installVariant });
|
||||
await this.updateUserConfig({ buildNumber, installVariant: this.installVariant, bootCount: this.bootCount });
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the boot count for an SDA installation
|
||||
*/
|
||||
public getBootCount(): number | undefined {
|
||||
logger.info(`config-handler: Current boot count is ${this.bootCount}`);
|
||||
return this.bootCount;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -312,9 +323,9 @@ class Config {
|
||||
const { acpFeatureLevelEntitlements, podLevelEntitlements, pmpEntitlements } = this.cloudConfig as ICloudConfig;
|
||||
|
||||
// Filter out some values
|
||||
const filteredACP = filterOutSelectedValues(acpFeatureLevelEntitlements, [ true, 'NOT_SET', '', [] ]);
|
||||
const filteredPod = filterOutSelectedValues(podLevelEntitlements, [ true, 'NOT_SET', '', [] ]);
|
||||
const filteredPMP = filterOutSelectedValues(pmpEntitlements, [ true, 'NOT_SET', '', [] ]);
|
||||
const filteredACP = filterOutSelectedValues(acpFeatureLevelEntitlements, [true, 'NOT_SET', '', []]);
|
||||
const filteredPod = filterOutSelectedValues(podLevelEntitlements, [true, 'NOT_SET', '', []]);
|
||||
const filteredPMP = filterOutSelectedValues(pmpEntitlements, [true, 'NOT_SET', '', []]);
|
||||
|
||||
// priority is PMP > ACP > SDA
|
||||
this.filteredCloudConfig = { ...filteredACP, ...filteredPod, ...filteredPMP };
|
||||
@ -406,16 +417,25 @@ class Config {
|
||||
if (!installVariant) {
|
||||
logger.info(`config-handler: there's no install variant found, this is a first time launch`);
|
||||
this.isFirstTime = true;
|
||||
this.bootCount = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (installVariant && typeof installVariant === 'string' && installVariant !== this.installVariant) {
|
||||
logger.info(`config-handler: install variant found is of a different instance, this is a first time launch`);
|
||||
this.isFirstTime = true;
|
||||
this.bootCount = 0;
|
||||
return;
|
||||
}
|
||||
logger.info(`config-handler: install variant is the same as the existing one, not a first time launch`);
|
||||
this.isFirstTime = false;
|
||||
this.bootCount = (this.getConfigFields(['bootCount']) as IConfig).bootCount;
|
||||
if (this.bootCount !== undefined) {
|
||||
this.bootCount++;
|
||||
await this.updateUserConfig({ bootCount: this.bootCount });
|
||||
} else {
|
||||
await this.updateUserConfig({ bootCount: 0 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ import * as shellPath from 'shell-path';
|
||||
import { isDevEnv, isElectronQA, isLinux, isMac } from '../common/env';
|
||||
import { logger } from '../common/logger';
|
||||
import { getCommandLineArgs } from '../common/utils';
|
||||
import { cleanAppCacheOnInstall, cleanUpAppCache, createAppCacheFile } from './app-cache-handler';
|
||||
import { cleanUpAppCache, createAppCacheFile } from './app-cache-handler';
|
||||
import { autoLaunchInstance } from './auto-launch-controller';
|
||||
import { setChromeFlags, setSessionProperties } from './chrome-flags';
|
||||
import { config } from './config-handler';
|
||||
@ -67,10 +67,17 @@ if (!isDevEnv) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Main function that init the application
|
||||
* Main function that initialises the application
|
||||
*/
|
||||
let oneStart = false;
|
||||
const startApplication = async () => {
|
||||
if (config.isFirstTimeLaunch()) {
|
||||
logger.info(`main: This is a first time launch! will update config and handle auto launch`);
|
||||
await config.setUpFirstTimeLaunch();
|
||||
if (!isLinux) {
|
||||
await autoLaunchInstance.handleAutoLaunch();
|
||||
}
|
||||
}
|
||||
await app.whenReady();
|
||||
if (oneStart) {
|
||||
return;
|
||||
@ -79,17 +86,8 @@ const startApplication = async () => {
|
||||
logger.info('main: app is ready, performing initial checks oneStart: ' + oneStart);
|
||||
oneStart = true;
|
||||
createAppCacheFile();
|
||||
if (config.isFirstTimeLaunch()) {
|
||||
logger.info(`main: This is a first time launch! will update config and handle auto launch`);
|
||||
cleanAppCacheOnInstall();
|
||||
await config.setUpFirstTimeLaunch();
|
||||
if (!isLinux) {
|
||||
await autoLaunchInstance.handleAutoLaunch();
|
||||
}
|
||||
}
|
||||
// Picks global config values and updates them in the user config
|
||||
await config.updateUserConfigOnStart();
|
||||
// Setup session properties only after app ready
|
||||
setSessionProperties();
|
||||
await windowHandler.createApplication();
|
||||
logger.info(`main: created application`);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { net } from 'electron';
|
||||
import * as nodeURL from 'url';
|
||||
import { buildNumber, clientVersion, optionalDependencies, searchAPIVersion, sfeVersion, version } from '../../package.json';
|
||||
import { buildNumber, clientVersion, optionalDependencies, searchAPIVersion, sfeClientType, sfeVersion, version } from '../../package.json';
|
||||
import { logger } from '../common/logger';
|
||||
import { config, IGlobalConfig } from './config-handler';
|
||||
|
||||
@ -8,6 +8,7 @@ interface IVersionInfo {
|
||||
clientVersion: string;
|
||||
buildNumber: string;
|
||||
sfeVersion: string;
|
||||
sfeClientType: string;
|
||||
sdaVersion: string;
|
||||
sdaBuildNumber: string;
|
||||
electronVersion: string;
|
||||
@ -35,6 +36,7 @@ class VersionHandler {
|
||||
clientVersion,
|
||||
buildNumber,
|
||||
sfeVersion,
|
||||
sfeClientType,
|
||||
sdaVersion: version,
|
||||
sdaBuildNumber: buildNumber,
|
||||
electronVersion: process.versions.electron,
|
||||
@ -77,6 +79,7 @@ class VersionHandler {
|
||||
|
||||
if (!this.mainUrl) {
|
||||
logger.error(`version-handler: Unable to get pod url for getting version data from server! Setting defaults!`);
|
||||
logger.info(`version-handler: Setting defaults -> ${JSON.stringify(this.versionInfo)}`);
|
||||
resolve(this.versionInfo);
|
||||
return;
|
||||
}
|
||||
@ -139,8 +142,22 @@ class VersionHandler {
|
||||
|
||||
request.end();
|
||||
|
||||
logger.info('version-handler: mainUrl: ' + mainUrl);
|
||||
logger.info('version-handler: hostname: ' + hostname);
|
||||
|
||||
/* Get SFE version */
|
||||
const urlSfeVersion = `${protocol}//${hostname}/client/version.json`;
|
||||
let urlSfeVersion;
|
||||
if (mainUrl?.includes('/client-bff/')) {
|
||||
if (mainUrl?.includes('/client-bff/daily/')) {
|
||||
urlSfeVersion = `${protocol}//${hostname}/client-bff/daily/version.json`;
|
||||
} else {
|
||||
urlSfeVersion = `${protocol}//${hostname}/client-bff/version.json`;
|
||||
}
|
||||
this.versionInfo.sfeClientType = '2.0';
|
||||
} else {
|
||||
urlSfeVersion = `${protocol}//${hostname}/client/version.json`;
|
||||
this.versionInfo.sfeClientType = '1.5';
|
||||
}
|
||||
logger.info(`version-handler: Trying to get SFE version info for the URL: ${urlSfeVersion}`);
|
||||
|
||||
const requestSfeVersion = net.request(urlSfeVersion);
|
||||
@ -158,7 +175,9 @@ class VersionHandler {
|
||||
|
||||
this.versionInfo.sfeVersion = this.sfeVersionInfo[key];
|
||||
|
||||
logger.info(`version-handler: Updated SFE version info from server! ${JSON.stringify(this.versionInfo)}`);
|
||||
logger.info('version-handler: SFE-version: ' + this.sfeVersionInfo[key]);
|
||||
|
||||
logger.info(`version-handler: Updated SFE version info from server! ${JSON.stringify(this.versionInfo, null, 3)}`);
|
||||
resolve(this.versionInfo);
|
||||
} catch (error) {
|
||||
logger.error(`version-handler: Error getting SFE version data from the server! ${error}`);
|
||||
|
@ -386,6 +386,7 @@ export class WindowHandler {
|
||||
|
||||
cleanAppCacheOnCrash(this.mainWindow);
|
||||
// loads the main window with url from config/cmd line
|
||||
logger.info(`Loading main window with url ${this.url}`);
|
||||
this.mainWindow.loadURL(this.url);
|
||||
// check for build expiry in case of test builds
|
||||
this.checkExpiry(this.mainWindow);
|
||||
@ -412,6 +413,22 @@ export class WindowHandler {
|
||||
);
|
||||
});
|
||||
|
||||
const logEvents = [
|
||||
'did-fail-provisional-load', 'did-frame-finish-load',
|
||||
'did-start-loading', 'did-stop-loading', 'will-redirect',
|
||||
'did-navigate', 'did-navigate-in-page', 'preload-error',
|
||||
];
|
||||
|
||||
logEvents.forEach((windowEvent: any) => {
|
||||
this.mainWindow?.webContents.on(windowEvent, () => {
|
||||
logger.info(`window-handler: Main Window Event Occurred: ${windowEvent}`);
|
||||
});
|
||||
});
|
||||
|
||||
this.mainWindow.once('ready-to-show', (event: Electron.Event) => {
|
||||
logger.info(`window-handler: Main Window ready to show: ${event}`);
|
||||
});
|
||||
|
||||
this.mainWindow.webContents.on('did-finish-load', async () => {
|
||||
// reset to false when the client reloads
|
||||
this.isMana = false;
|
||||
|
@ -12,6 +12,7 @@ interface IState {
|
||||
buildNumber: string;
|
||||
hostname: string;
|
||||
sfeVersion: string;
|
||||
sfeClientType: string;
|
||||
versionLocalised?: string;
|
||||
sdaVersion?: string;
|
||||
sdaBuildNumber?: string;
|
||||
@ -53,6 +54,7 @@ export default class AboutApp extends React.Component<{}, IState> {
|
||||
buildNumber: 'N/A',
|
||||
hostname: 'N/A',
|
||||
sfeVersion: 'N/A',
|
||||
sfeClientType: 'N/A',
|
||||
sdaVersion: 'N/A',
|
||||
sdaBuildNumber: 'N/A',
|
||||
electronVersion: 'N/A',
|
||||
@ -75,13 +77,18 @@ export default class AboutApp extends React.Component<{}, IState> {
|
||||
*/
|
||||
public render(): JSX.Element {
|
||||
const { clientVersion, buildNumber, hostname, sfeVersion,
|
||||
sdaVersion, sdaBuildNumber, client,
|
||||
sfeClientType, sdaVersion, sdaBuildNumber, client,
|
||||
} = this.state;
|
||||
|
||||
const appName = remote.app.getName() || 'Symphony';
|
||||
const copyright = `\xA9 ${new Date().getFullYear()} ${appName}`;
|
||||
const podVersion = `${clientVersion} (${buildNumber})`;
|
||||
const sdaVersionBuild = `${sdaVersion} (${sdaBuildNumber})`;
|
||||
let sfeClientTypeName = 'SFE';
|
||||
if (sfeClientType !== '1.5') {
|
||||
sfeClientTypeName = 'SFE-Lite';
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='AboutApp' lang={i18n.getLocale()}>
|
||||
<div className='AboutApp-header-container'>
|
||||
@ -103,7 +110,7 @@ export default class AboutApp extends React.Component<{}, IState> {
|
||||
<li><b>POD:</b> {hostname || 'N/A'}</li>
|
||||
<li><b>SBE:</b> {podVersion}</li>
|
||||
<li><b>SDA:</b> {sdaVersionBuild}</li>
|
||||
<li><b>SFE:</b> {sfeVersion} {client}</li>
|
||||
<li><b>{sfeClientTypeName}:</b> {sfeVersion} {client}</li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user