Skip to content

Commit 69d4402

Browse files
Merge pull request #2215 from redpanda-data/use-adp-config
frontend: use ADP config
2 parents ea668a0 + de32fb5 commit 69d4402

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

frontend/src/config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ export type SetConfigArguments = {
129129
setSidebarItems?: (items: SidebarItem[]) => void;
130130
setBreadcrumbs?: (items: Breadcrumb[]) => void;
131131
isServerless?: boolean;
132+
isAdpEnabled?: boolean;
132133
featureFlags?: Record<keyof typeof FEATURE_FLAGS, boolean>;
133134
};
134135

@@ -173,6 +174,7 @@ type Config = {
173174
setSidebarItems: (items: SidebarItem[]) => void;
174175
setBreadcrumbs: (items: Breadcrumb[]) => void;
175176
isServerless: boolean;
177+
isAdpEnabled: boolean;
176178
featureFlags: Record<keyof typeof FEATURE_FLAGS, boolean>;
177179
};
178180

@@ -193,6 +195,7 @@ export const config: Config = observable({
193195
// no op - set by parent application
194196
},
195197
isServerless: false,
198+
isAdpEnabled: false,
196199
featureFlags: FEATURE_FLAGS,
197200
});
198201

@@ -201,6 +204,7 @@ const setConfig = ({
201204
urlOverride,
202205
jwt,
203206
isServerless: isServerlessMode,
207+
isAdpEnabled: isAdpEnabledMode,
204208
featureFlags,
205209
...args
206210
}: SetConfigArguments) => {
@@ -246,6 +250,7 @@ const setConfig = ({
246250
jwt,
247251
dataplaneTransport,
248252
isServerless: isServerlessMode,
253+
isAdpEnabled: isAdpEnabledMode ?? false,
249254
restBasePath: getRestBasePath(urlOverride?.rest),
250255
grpcBasePath: getGrpcBasePath(urlOverride?.grpc),
251256
controlplaneUrl: config.controlplaneUrl,
@@ -348,6 +353,10 @@ export function isServerless() {
348353
return config.isServerless;
349354
}
350355

356+
export function isAdpEnabled() {
357+
return config.isAdpEnabled;
358+
}
359+
351360
export const embeddedAvailableRoutesObservable = observable({
352361
get routes() {
353362
return getEmbeddedAvailableRoutes();

frontend/src/utils/route-utils.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import {
3535
UserCircleIcon,
3636
} from '../components/icons';
3737
import { MCPIcon } from '../components/redpanda-ui/components/icons';
38-
import { isEmbedded, isFeatureFlagEnabled, isServerless } from '../config';
38+
import { isAdpEnabled, isEmbedded, isFeatureFlagEnabled, isServerless } from '../config';
3939
import { api } from '../state/backend-api';
4040
import { Feature, isSupported, shouldHideIfNotSupported } from '../state/supported-features';
4141

@@ -220,7 +220,7 @@ export const SIDEBAR_ITEMS: SidebarItem[] = [
220220
title: 'Knowledge Bases',
221221
icon: BookOpenIcon,
222222
visibilityCheck: routeVisibility(
223-
() => isFeatureFlagEnabled('enableKnowledgeBaseInConsoleUi'),
223+
() => isAdpEnabled() && isFeatureFlagEnabled('enableKnowledgeBaseInConsoleUi'),
224224
[Feature.PipelineService]
225225
),
226226
},
@@ -261,7 +261,7 @@ export const SIDEBAR_ITEMS: SidebarItem[] = [
261261
title: 'Transcripts',
262262
icon: ActivityIcon,
263263
visibilityCheck: routeVisibility(
264-
() => isEmbedded() && isFeatureFlagEnabled('enableTranscriptsInConsole'),
264+
() => isEmbedded() && isAdpEnabled() && isFeatureFlagEnabled('enableTranscriptsInConsole'),
265265
[Feature.TracingService]
266266
),
267267
},
@@ -300,6 +300,7 @@ export const SIDEBAR_ITEMS: SidebarItem[] = [
300300
visibilityCheck: routeVisibility(
301301
() =>
302302
isEmbedded() &&
303+
isAdpEnabled() &&
303304
(!isServerless() || isFeatureFlagEnabled('enableAiAgentsInConsoleServerless')) &&
304305
isFeatureFlagEnabled('enableAiAgentsInConsole')
305306
),

frontend/tests/test-variant-console/acls/user-management.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test.describe('ACL User Management', () => {
1313

1414
// Wait for API initialization to complete and button to be enabled
1515
// This handles timing differences between local and CI environments
16-
await expect(page.getByTestId('create-user-button')).toBeEnabled({ timeout: 10000 });
16+
await expect(page.getByTestId('create-user-button')).toBeEnabled({ timeout: 10_000 });
1717
});
1818

1919
test('should create a new user with special characters in password', async ({ page }) => {
@@ -367,7 +367,7 @@ test.describe('ACL User Management', () => {
367367
});
368368

369369
await test.step('6. Verify redirect to users list', async () => {
370-
await page.waitForURL('/security/users', { timeout: 10000 });
370+
await page.waitForURL('/security/users', { timeout: 10_000 });
371371
});
372372
});
373373
});

0 commit comments

Comments
 (0)