1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-27 11:02:16 +01:00

chore: show edge instances in license info (#10810)

https://linear.app/unleash/issue/2-3981/show-edge-instances-in-license-information-in-unleash

Show edge instances in license info.

Adapts to new logic, so resources are only shown if they are present.
This commit is contained in:
Nuno Góis 2025-10-20 14:49:41 +01:00 committed by GitHub
parent f37fde2a27
commit 1b60ed5df8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 29 additions and 17 deletions

View File

@ -68,6 +68,12 @@ export const License = () => {
}
};
const resources = {
Seats: license.resources.seats,
'Release templates': license.resources.releaseTemplates,
'Edge instances': license.resources.edgeInstances,
};
return (
<PageContent header={<PageHeader title='Unleash Enterprise License' />}>
<StyledBox>
@ -97,20 +103,21 @@ export const License = () => {
{license.plan}
</StyledPropertyDetails>
</StyledDataCollectionPropertyRow>
<StyledDataCollectionPropertyRow>
<StyledPropertyName>Seats</StyledPropertyName>
<StyledPropertyDetails>
{license.seats}
</StyledPropertyDetails>
</StyledDataCollectionPropertyRow>
<StyledDataCollectionPropertyRow>
<StyledPropertyName>
Release templates
</StyledPropertyName>
<StyledPropertyDetails>
{license.releaseTemplates}
</StyledPropertyDetails>
</StyledDataCollectionPropertyRow>
{Object.entries(resources).map(
([resourceName, resourceValue]) =>
resourceValue && (
<StyledDataCollectionPropertyRow
key={resourceName}
>
<StyledPropertyName>
{resourceName}
</StyledPropertyName>
<StyledPropertyDetails>
{resourceValue}
</StyledPropertyDetails>
</StyledDataCollectionPropertyRow>
),
)}
<StyledDataCollectionPropertyRow>
<StyledPropertyName>
Expire at

View File

@ -18,14 +18,19 @@ const fallback = {
loading: false,
};
type LicenseResources = {
seats?: number;
releaseTemplates?: number;
edgeInstances?: number;
};
export interface License {
license?: {
token: string;
customer: string;
instanceName: string;
plan: string;
seats: number;
releaseTemplates: number;
resources: LicenseResources;
expireAt: Date;
};
loading: boolean;
@ -58,7 +63,7 @@ export const useLicense = (): License => {
);
return {
license: { ...data },
license: data,
loading: !error && !data,
refetchLicense: () => mutate(),
error,