Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: display the build number as extra data #8022

Merged
merged 5 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions frontend/src/component/menu/Footer/ApiDetails/ApiDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? <small> ({buildNumber})</small> : '';
return (
<section title='API details'>
<FooterTitle>
{currentVersion}{' '}
{name} {version} {buildInfo}
<ConditionallyRender
condition={Boolean(environment)}
show={<small>({environment})</small>}
show={<small> ({environment})</small>}
/>
</FooterTitle>
<ConditionallyRender
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ exports[`renders correctly with empty version 1`] = `
<h2
class="css-gtu1fw"
>
Unleash
Unleash


<small>
(
(
test
)
</small>
Expand Down Expand Up @@ -43,10 +44,12 @@ exports[`renders correctly with ui-config 1`] = `
<h2
class="css-gtu1fw"
>
Unleash 1.1.0
Unleash

1.1.0

<small>
(
(
test
)
</small>
Expand Down Expand Up @@ -77,7 +80,9 @@ exports[`renders correctly with versionInfo 1`] = `
<h2
class="css-gtu1fw"
>
Unleash 1.2.3
Unleash

1.2.3

</h2>
<small>
Expand Down Expand Up @@ -111,7 +116,9 @@ exports[`renders correctly without uiConfig 1`] = `
<h2
class="css-gtu1fw"
>
Unleash 1.1.0
Unleash

1.1.0

</h2>
<br />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ exports[`should render DrawerMenu 1`] = `
<h2
className="css-gtu1fw"
>
Unleash 5.x
Unleash

5.x

</h2>
<br />
Expand Down Expand Up @@ -566,7 +568,9 @@ exports[`should render DrawerMenu with "features" selected 1`] = `
<h2
className="css-gtu1fw"
>
Unleash 5.x
Unleash

5.x

</h2>
<br />
Expand Down
Loading