diff --git a/frontend/src/component/menu/Footer/ApiDetails/ApiDetails.tsx b/frontend/src/component/menu/Footer/ApiDetails/ApiDetails.tsx index 0568acf82c21..79578cb14d1d 100644 --- a/frontend/src/component/menu/Footer/ApiDetails/ApiDetails.tsx +++ b/frontend/src/component/menu/Footer/ApiDetails/ApiDetails.tsx @@ -13,17 +13,18 @@ interface IApiDetailsProps { export const ApiDetails = (props: IApiDetailsProps): ReactElement => { const instanceId = props.uiConfig.versionInfo?.instanceId; - const currentVersion = formatCurrentVersion(props.uiConfig); + const { name, version, buildNumber } = formatCurrentVersion(props.uiConfig); const environment = props.uiConfig.environment; const updateNotification = formatUpdateNotification(props.uiConfig); + const buildInfo = buildNumber ? ({buildNumber}) : ''; return (
- {currentVersion}{' '} + {name} {version} {buildInfo} ({environment})} + show={ ({environment})} /> - Unleash + Unleash + - ( + ( test ) @@ -43,10 +44,12 @@ exports[`renders correctly with ui-config 1`] = `

- Unleash 1.1.0 + Unleash + + 1.1.0 - ( + ( test ) @@ -77,7 +80,9 @@ exports[`renders correctly with versionInfo 1`] = `

- Unleash 1.2.3 + Unleash + + 1.2.3

@@ -111,7 +116,9 @@ exports[`renders correctly without uiConfig 1`] = `

- Unleash 1.1.0 + Unleash + + 1.1.0


diff --git a/frontend/src/component/menu/Footer/ApiDetails/apidetails.helpers.tsx b/frontend/src/component/menu/Footer/ApiDetails/apidetails.helpers.tsx index e059b91d37cc..478e2211bb33 100644 --- a/frontend/src/component/menu/Footer/ApiDetails/apidetails.helpers.tsx +++ b/frontend/src/component/menu/Footer/ApiDetails/apidetails.helpers.tsx @@ -8,18 +8,21 @@ export interface IPartialUiConfig { versionInfo?: IVersionInfo; } -export const formatCurrentVersion = (uiConfig: IPartialUiConfig): string => { +export const formatCurrentVersion = ( + uiConfig: IPartialUiConfig, +): { name: string; version: string; buildNumber?: string } => { const current = uiConfig.versionInfo?.current; - - if (current?.enterprise) { - return `${uiConfig.name} ${current.enterprise}`; - } - - if (current?.oss) { - return `${uiConfig.name} ${current.oss}`; - } - - return `${uiConfig.name} ${uiConfig.version}`; + const [version, buildNumber] = ( + current?.enterprise || + current?.oss || + uiConfig.version || + '' + ).split('+'); + return { + name: uiConfig.name, + version, + buildNumber, + }; }; export const formatUpdateNotification = ( diff --git a/frontend/src/component/menu/Footer/__snapshots__/Footer.test.tsx.snap b/frontend/src/component/menu/Footer/__snapshots__/Footer.test.tsx.snap index e92281664af8..0eb22cb19098 100644 --- a/frontend/src/component/menu/Footer/__snapshots__/Footer.test.tsx.snap +++ b/frontend/src/component/menu/Footer/__snapshots__/Footer.test.tsx.snap @@ -22,7 +22,9 @@ exports[`should render DrawerMenu 1`] = `

- Unleash 5.x + Unleash + + 5.x


@@ -566,7 +568,9 @@ exports[`should render DrawerMenu with "features" selected 1`] = `

- Unleash 5.x + Unleash + + 5.x