Show SFE version in about-window

This commit is contained in:
Johan Kwarnmark 2019-11-06 14:49:23 +01:00
parent d58d4b0a5b
commit d2e825601f
5 changed files with 70 additions and 3 deletions

View File

@ -5,6 +5,7 @@
"clientVersion": "2.0.1", "clientVersion": "2.0.1",
"buildNumber": "0", "buildNumber": "0",
"searchAPIVersion": "1.55.3", "searchAPIVersion": "1.55.3",
"sfeVersion": "0",
"description": "Symphony desktop app (Foundation ODP)", "description": "Symphony desktop app (Foundation ODP)",
"author": "Symphony OSS <help@finos.org>", "author": "Symphony OSS <help@finos.org>",
"main": "lib/src/app/init.js", "main": "lib/src/app/init.js",

View File

@ -50,6 +50,13 @@ exports[`about app should render correctly 1`] = `
N/A (N/A) N/A (N/A)
</li> </li>
<li>
<b>
SFE:
</b>
N/A
</li>
<li> <li>
<b> <b>
SDA: SDA:

View File

@ -1,12 +1,13 @@
import { net } from 'electron'; import { net } from 'electron';
import * as nodeURL from 'url'; import * as nodeURL from 'url';
import { buildNumber, clientVersion, optionalDependencies, searchAPIVersion, version } from '../../package.json'; import { buildNumber, clientVersion, optionalDependencies, searchAPIVersion, sfeVersion, version } from '../../package.json';
import { logger } from '../common/logger'; import { logger } from '../common/logger';
import { config, IConfig } from './config-handler'; import { config, IConfig } from './config-handler';
interface IVersionInfo { interface IVersionInfo {
clientVersion: string; clientVersion: string;
buildNumber: string; buildNumber: string;
sfeVersion: string;
sdaVersion: string; sdaVersion: string;
sdaBuildNumber: string; sdaBuildNumber: string;
electronVersion: string; electronVersion: string;
@ -27,11 +28,13 @@ class VersionHandler {
public versionInfo: IVersionInfo; public versionInfo: IVersionInfo;
private serverVersionInfo: any; private serverVersionInfo: any;
private mainUrl; private mainUrl;
private sfeVersionInfo: any;
constructor() { constructor() {
this.versionInfo = { this.versionInfo = {
clientVersion, clientVersion,
buildNumber, buildNumber,
sfeVersion,
sdaVersion: version, sdaVersion: version,
sdaBuildNumber: buildNumber, sdaBuildNumber: buildNumber,
electronVersion: process.versions.electron, electronVersion: process.versions.electron,
@ -130,6 +133,58 @@ class VersionHandler {
}); });
request.end(); request.end();
/* Get SFE version */
const urlSfeVersion = `${protocol}//${hostname}/client/version.json`;
logger.info(`version-handler: Trying to get SFE version info for the URL: ${urlSfeVersion}`);
const requestSfeVersion = net.request(urlSfeVersion);
requestSfeVersion.on('response', (res) => {
let body: string = '';
res.on('data', (d: Buffer) => {
body += d;
});
res.on('end', () => {
try {
this.sfeVersionInfo = JSON.parse(body);
const key = 'version';
this.versionInfo.sfeVersion = this.sfeVersionInfo[key];
logger.info(`version-handler: Updated SFE version info from server! ${JSON.stringify(this.versionInfo)}`);
resolve(this.versionInfo);
} catch (error) {
logger.error(`version-handler: Error getting SFE version data from the server! ${error}`);
resolve(this.versionInfo);
return;
}
});
res.on('error', (error: Error) => {
logger.error(`version-handler: Error getting SFE version data from the server! ${error}`);
resolve(this.versionInfo);
return;
});
});
requestSfeVersion.on('error', (error: Error) => {
logger.error(`version-handler: Error getting SFE version data from the server! ${error}`);
resolve(this.versionInfo);
return;
});
requestSfeVersion.on('close', () => {
logger.info(`version-handler: Request closed!!`);
});
requestSfeVersion.on('finish', () => {
logger.info(`version-handler: Request finished!!`);
});
requestSfeVersion.end();
}); });
} }

View File

@ -437,7 +437,7 @@ export class WindowHandler {
const opts: BrowserWindowConstructorOptions = this.getWindowOpts({ const opts: BrowserWindowConstructorOptions = this.getWindowOpts({
width: 420, width: 420,
height: isWindowsOS ? 725 : 685, height: isWindowsOS ? 745 : 705,
modal: false, modal: false,
alwaysOnTop: isMac, alwaysOnTop: isMac,
resizable: true, resizable: true,
@ -461,6 +461,7 @@ export class WindowHandler {
const aboutInfo = { const aboutInfo = {
buildNumber: versionHandler.versionInfo.buildNumber, buildNumber: versionHandler.versionInfo.buildNumber,
clientVersion: versionHandler.versionInfo.clientVersion, clientVersion: versionHandler.versionInfo.clientVersion,
sfeVersion: versionHandler.versionInfo.sfeVersion,
versionLocalised, versionLocalised,
...versionHandler.versionInfo, ...versionHandler.versionInfo,
}; };

View File

@ -7,6 +7,7 @@ interface IState {
copyWrite?: string; copyWrite?: string;
clientVersion: string; clientVersion: string;
buildNumber: string; buildNumber: string;
sfeVersion: string;
versionLocalised?: string; versionLocalised?: string;
sdaVersion?: string; sdaVersion?: string;
sdaBuildNumber?: string; sdaBuildNumber?: string;
@ -41,6 +42,7 @@ export default class AboutApp extends React.Component<{}, IState> {
versionLocalised: 'Version', versionLocalised: 'Version',
clientVersion: 'N/A', clientVersion: 'N/A',
buildNumber: 'N/A', buildNumber: 'N/A',
sfeVersion: 'N/A',
sdaVersion: 'N/A', sdaVersion: 'N/A',
sdaBuildNumber: 'N/A', sdaBuildNumber: 'N/A',
electronVersion: 'N/A', electronVersion: 'N/A',
@ -62,7 +64,7 @@ export default class AboutApp extends React.Component<{}, IState> {
* main render function * main render function
*/ */
public render(): JSX.Element { public render(): JSX.Element {
const { clientVersion, buildNumber, const { clientVersion, buildNumber, sfeVersion,
sdaVersion, sdaBuildNumber, sdaVersion, sdaBuildNumber,
electronVersion, chromeVersion, v8Version, electronVersion, chromeVersion, v8Version,
nodeVersion, openSslVersion, zlibVersion, nodeVersion, openSslVersion, zlibVersion,
@ -95,6 +97,7 @@ export default class AboutApp extends React.Component<{}, IState> {
<h4>Symphony</h4> <h4>Symphony</h4>
<ul className='AboutApp-symphony-section'> <ul className='AboutApp-symphony-section'>
<li><b>SBE:</b> {podVersion}</li> <li><b>SBE:</b> {podVersion}</li>
<li><b>SFE:</b> {sfeVersion}</li>
<li><b>SDA:</b> {sdaVersionBuild}</li> <li><b>SDA:</b> {sdaVersionBuild}</li>
</ul> </ul>
</section> </section>