Skip to content

Commit c482cf5

Browse files
committed
fix(frontend): dynamic enterprise features in expired page
1 parent f8df448 commit c482cf5

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

frontend/src/components/pages/admin/license-expired-page.tsx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,28 @@ import { api } from '../../../state/backend-api';
77
import { DISABLE_SSO_DOCS_LINK } from '../../license/license-utils';
88
import { PageComponent } from '../page';
99

10+
/**
11+
* Formats a list of enabled enterprise feature names into a human-readable string.
12+
* Returns undefined if no features are enabled.
13+
*/
14+
function formatEnabledFeatures(features: { name: string; enabled: boolean }[]): string | undefined {
15+
const enabledFeatures = features.filter((f) => f.enabled).map((f) => f.name);
16+
17+
if (enabledFeatures.length === 0) {
18+
return;
19+
}
20+
21+
if (enabledFeatures.length === 1) {
22+
return enabledFeatures[0];
23+
}
24+
25+
if (enabledFeatures.length === 2) {
26+
return `${enabledFeatures[0]} and ${enabledFeatures[1]}`;
27+
}
28+
29+
return `${enabledFeatures.slice(0, -1).join(', ')}, and ${enabledFeatures.at(-1)}`;
30+
}
31+
1032
@observer
1133
export default class LicenseExpiredPage extends PageComponent {
1234
initPage(): void {
@@ -21,6 +43,8 @@ export default class LicenseExpiredPage extends PageComponent {
2143
}
2244

2345
render() {
46+
const enabledFeaturesText = formatEnabledFeatures(api.enterpriseFeaturesUsed);
47+
2448
return (
2549
<Flex align="center" justify="center" p={4}>
2650
<Box bg="white" height="100vh" left={0} opacity={0.5} position="fixed" top={0} width="100vw" zIndex={1000} />
@@ -35,7 +59,9 @@ export default class LicenseExpiredPage extends PageComponent {
3559

3660
{/* Subtext */}
3761
<Text fontSize="lg">
38-
You were using Console RBAC/SSO and your trial license has expired. To continue using them, you will need
62+
{enabledFeaturesText
63+
? `You were using ${enabledFeaturesText} and your license has expired. To continue using these features, you will need`
64+
: 'Your license has expired. To continue using enterprise features, you will need'}{' '}
3965
an{' '}
4066
<Link href="https://redpanda.com/upgrade" rel="noopener noreferrer" target="_blank">
4167
Enterprise license

0 commit comments

Comments
 (0)