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 ( return (
<PageContent header={<PageHeader title='Unleash Enterprise License' />}> <PageContent header={<PageHeader title='Unleash Enterprise License' />}>
<StyledBox> <StyledBox>
@ -97,20 +103,21 @@ export const License = () => {
{license.plan} {license.plan}
</StyledPropertyDetails> </StyledPropertyDetails>
</StyledDataCollectionPropertyRow> </StyledDataCollectionPropertyRow>
<StyledDataCollectionPropertyRow> {Object.entries(resources).map(
<StyledPropertyName>Seats</StyledPropertyName> ([resourceName, resourceValue]) =>
<StyledPropertyDetails> resourceValue && (
{license.seats} <StyledDataCollectionPropertyRow
</StyledPropertyDetails> key={resourceName}
</StyledDataCollectionPropertyRow> >
<StyledDataCollectionPropertyRow>
<StyledPropertyName> <StyledPropertyName>
Release templates {resourceName}
</StyledPropertyName> </StyledPropertyName>
<StyledPropertyDetails> <StyledPropertyDetails>
{license.releaseTemplates} {resourceValue}
</StyledPropertyDetails> </StyledPropertyDetails>
</StyledDataCollectionPropertyRow> </StyledDataCollectionPropertyRow>
),
)}
<StyledDataCollectionPropertyRow> <StyledDataCollectionPropertyRow>
<StyledPropertyName> <StyledPropertyName>
Expire at Expire at

View File

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