mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-26 13:48:33 +02:00
feat: display the build number as extra data (#8022)
## About the changes Show the build number between parenthesis separated from the version. When there's no build number:  When there is: 
This commit is contained in:
parent
79fccbd8f3
commit
bb5aa64756
@ -13,17 +13,18 @@ interface IApiDetailsProps {
|
|||||||
|
|
||||||
export const ApiDetails = (props: IApiDetailsProps): ReactElement => {
|
export const ApiDetails = (props: IApiDetailsProps): ReactElement => {
|
||||||
const instanceId = props.uiConfig.versionInfo?.instanceId;
|
const instanceId = props.uiConfig.versionInfo?.instanceId;
|
||||||
const currentVersion = formatCurrentVersion(props.uiConfig);
|
const { name, version, buildNumber } = formatCurrentVersion(props.uiConfig);
|
||||||
const environment = props.uiConfig.environment;
|
const environment = props.uiConfig.environment;
|
||||||
const updateNotification = formatUpdateNotification(props.uiConfig);
|
const updateNotification = formatUpdateNotification(props.uiConfig);
|
||||||
|
|
||||||
|
const buildInfo = buildNumber ? <small> ({buildNumber})</small> : '';
|
||||||
return (
|
return (
|
||||||
<section title='API details'>
|
<section title='API details'>
|
||||||
<FooterTitle>
|
<FooterTitle>
|
||||||
{currentVersion}{' '}
|
{name} {version} {buildInfo}
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={Boolean(environment)}
|
condition={Boolean(environment)}
|
||||||
show={<small>({environment})</small>}
|
show={<small> ({environment})</small>}
|
||||||
/>
|
/>
|
||||||
</FooterTitle>
|
</FooterTitle>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
|
@ -11,6 +11,7 @@ exports[`renders correctly with empty version 1`] = `
|
|||||||
>
|
>
|
||||||
Unleash
|
Unleash
|
||||||
|
|
||||||
|
|
||||||
<small>
|
<small>
|
||||||
(
|
(
|
||||||
test
|
test
|
||||||
@ -43,7 +44,9 @@ exports[`renders correctly with ui-config 1`] = `
|
|||||||
<h2
|
<h2
|
||||||
class="css-gtu1fw"
|
class="css-gtu1fw"
|
||||||
>
|
>
|
||||||
Unleash 1.1.0
|
Unleash
|
||||||
|
|
||||||
|
1.1.0
|
||||||
|
|
||||||
<small>
|
<small>
|
||||||
(
|
(
|
||||||
@ -77,7 +80,9 @@ exports[`renders correctly with versionInfo 1`] = `
|
|||||||
<h2
|
<h2
|
||||||
class="css-gtu1fw"
|
class="css-gtu1fw"
|
||||||
>
|
>
|
||||||
Unleash 1.2.3
|
Unleash
|
||||||
|
|
||||||
|
1.2.3
|
||||||
|
|
||||||
</h2>
|
</h2>
|
||||||
<small>
|
<small>
|
||||||
@ -111,7 +116,9 @@ exports[`renders correctly without uiConfig 1`] = `
|
|||||||
<h2
|
<h2
|
||||||
class="css-gtu1fw"
|
class="css-gtu1fw"
|
||||||
>
|
>
|
||||||
Unleash 1.1.0
|
Unleash
|
||||||
|
|
||||||
|
1.1.0
|
||||||
|
|
||||||
</h2>
|
</h2>
|
||||||
<br />
|
<br />
|
||||||
|
@ -8,18 +8,21 @@ export interface IPartialUiConfig {
|
|||||||
versionInfo?: IVersionInfo;
|
versionInfo?: IVersionInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const formatCurrentVersion = (uiConfig: IPartialUiConfig): string => {
|
export const formatCurrentVersion = (
|
||||||
|
uiConfig: IPartialUiConfig,
|
||||||
|
): { name: string; version: string; buildNumber?: string } => {
|
||||||
const current = uiConfig.versionInfo?.current;
|
const current = uiConfig.versionInfo?.current;
|
||||||
|
const [version, buildNumber] = (
|
||||||
if (current?.enterprise) {
|
current?.enterprise ||
|
||||||
return `${uiConfig.name} ${current.enterprise}`;
|
current?.oss ||
|
||||||
}
|
uiConfig.version ||
|
||||||
|
''
|
||||||
if (current?.oss) {
|
).split('+');
|
||||||
return `${uiConfig.name} ${current.oss}`;
|
return {
|
||||||
}
|
name: uiConfig.name,
|
||||||
|
version,
|
||||||
return `${uiConfig.name} ${uiConfig.version}`;
|
buildNumber,
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const formatUpdateNotification = (
|
export const formatUpdateNotification = (
|
||||||
|
@ -22,7 +22,9 @@ exports[`should render DrawerMenu 1`] = `
|
|||||||
<h2
|
<h2
|
||||||
className="css-gtu1fw"
|
className="css-gtu1fw"
|
||||||
>
|
>
|
||||||
Unleash 5.x
|
Unleash
|
||||||
|
|
||||||
|
5.x
|
||||||
|
|
||||||
</h2>
|
</h2>
|
||||||
<br />
|
<br />
|
||||||
@ -566,7 +568,9 @@ exports[`should render DrawerMenu with "features" selected 1`] = `
|
|||||||
<h2
|
<h2
|
||||||
className="css-gtu1fw"
|
className="css-gtu1fw"
|
||||||
>
|
>
|
||||||
Unleash 5.x
|
Unleash
|
||||||
|
|
||||||
|
5.x
|
||||||
|
|
||||||
</h2>
|
</h2>
|
||||||
<br />
|
<br />
|
||||||
|
Loading…
Reference in New Issue
Block a user