From fabb8fb860eb4ca917264173369c309e0648630d Mon Sep 17 00:00:00 2001 From: Johan Kwarnmark Date: Mon, 30 Nov 2020 12:14:09 +0100 Subject: [PATCH] sda-2700 show 1.5/SFE 2.0/SFE-lite --- package.json | 3 ++- spec/__snapshots__/aboutApp.spec.ts.snap | 3 ++- spec/aboutApp.spec.ts | 1 + spectron/about-app.spec.ts | 1 + src/app/version-handler.ts | 24 +++++++++++++++++++++--- src/renderer/components/about-app.tsx | 11 +++++++++-- 6 files changed, 36 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index b8d173a0..4d78517d 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "buildNumber": "0", "searchAPIVersion": "1.55.3", "sfeVersion": "0", + "sfeClientType": "1.5", "description": "Symphony desktop app (Foundation ODP)", "author": "Symphony OSS ", "main": "lib/src/app/init.js", @@ -182,4 +183,4 @@ "!lib/src/**/*.js" ] } -} +} \ No newline at end of file diff --git a/spec/__snapshots__/aboutApp.spec.ts.snap b/spec/__snapshots__/aboutApp.spec.ts.snap index cd69763d..6d3363d9 100644 --- a/spec/__snapshots__/aboutApp.spec.ts.snap +++ b/spec/__snapshots__/aboutApp.spec.ts.snap @@ -62,7 +62,8 @@ exports[`about app should render correctly 1`] = `
  • - SFE: + SFE-Lite + : N/A diff --git a/spec/aboutApp.spec.ts b/spec/aboutApp.spec.ts index 3fa79bd8..ef40a143 100644 --- a/spec/aboutApp.spec.ts +++ b/spec/aboutApp.spec.ts @@ -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', diff --git a/spectron/about-app.spec.ts b/spectron/about-app.spec.ts index 36deb3e0..b40458b9 100644 --- a/spectron/about-app.spec.ts +++ b/spectron/about-app.spec.ts @@ -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(); diff --git a/src/app/version-handler.ts b/src/app/version-handler.ts index 26e5aa26..8aea35d8 100644 --- a/src/app/version-handler.ts +++ b/src/app/version-handler.ts @@ -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, @@ -140,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); @@ -159,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}`); diff --git a/src/renderer/components/about-app.tsx b/src/renderer/components/about-app.tsx index 6bb2dd67..0df13d51 100644 --- a/src/renderer/components/about-app.tsx +++ b/src/renderer/components/about-app.tsx @@ -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 (
    @@ -103,7 +110,7 @@ export default class AboutApp extends React.Component<{}, IState> {
  • POD: {hostname || 'N/A'}
  • SBE: {podVersion}
  • SDA: {sdaVersionBuild}
  • -
  • SFE: {sfeVersion} {client}
  • +
  • {sfeClientTypeName}: {sfeVersion} {client}