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",
"buildNumber": "0",
"searchAPIVersion": "1.55.3",
"sfeVersion": "0",
"description": "Symphony desktop app (Foundation ODP)",
"author": "Symphony OSS <help@finos.org>",
"main": "lib/src/app/init.js",

View File

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

View File

@ -1,12 +1,13 @@
import { net } from 'electron';
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 { config, IConfig } from './config-handler';
interface IVersionInfo {
clientVersion: string;
buildNumber: string;
sfeVersion: string;
sdaVersion: string;
sdaBuildNumber: string;
electronVersion: string;
@ -27,11 +28,13 @@ class VersionHandler {
public versionInfo: IVersionInfo;
private serverVersionInfo: any;
private mainUrl;
private sfeVersionInfo: any;
constructor() {
this.versionInfo = {
clientVersion,
buildNumber,
sfeVersion,
sdaVersion: version,
sdaBuildNumber: buildNumber,
electronVersion: process.versions.electron,
@ -130,6 +133,58 @@ class VersionHandler {
});
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({
width: 420,
height: isWindowsOS ? 725 : 685,
height: isWindowsOS ? 745 : 705,
modal: false,
alwaysOnTop: isMac,
resizable: true,
@ -461,6 +461,7 @@ export class WindowHandler {
const aboutInfo = {
buildNumber: versionHandler.versionInfo.buildNumber,
clientVersion: versionHandler.versionInfo.clientVersion,
sfeVersion: versionHandler.versionInfo.sfeVersion,
versionLocalised,
...versionHandler.versionInfo,
};

View File

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