Skip to content

Commit 39dcc01

Browse files
frontend: remove embeddedAvailableRoutesObservable
1 parent 5032e63 commit 39dcc01

2 files changed

Lines changed: 1 addition & 74 deletions

File tree

frontend/src/federation/console-app.test.tsx

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,6 @@ vi.mock('config', () => ({
4242
getGrpcBasePath: vi.fn(() => 'http://localhost:9090'),
4343
addBearerTokenInterceptor: vi.fn((next) => async (request: unknown) => await next(request)),
4444
checkExpiredLicenseInterceptor: vi.fn((next) => async (request: unknown) => await next(request)),
45-
embeddedAvailableRoutesObservable: {
46-
routes: [
47-
{ path: '/topics', title: 'Topics', icon: () => null },
48-
{ path: '/groups', title: 'Consumer Groups', icon: () => null },
49-
],
50-
},
51-
}));
52-
53-
vi.mock('state/ui-state', () => ({
54-
uiState: {
55-
pageTitle: '',
56-
pageBreadcrumbs: [],
57-
},
5845
}));
5946

6047
vi.mock('protobuf-registry', () => ({
@@ -161,22 +148,6 @@ describe('ConsoleApp', () => {
161148
});
162149
});
163150

164-
test('calls onSidebarItemsChange after initialization', async () => {
165-
render(<ConsoleApp {...defaultProps} />);
166-
167-
await waitFor(() => {
168-
expect(mockOnSidebarItemsChange).toHaveBeenCalled();
169-
});
170-
171-
const sidebarItems = mockOnSidebarItemsChange.mock.calls[0][0];
172-
expect(sidebarItems).toEqual(
173-
expect.arrayContaining([
174-
expect.objectContaining({ title: 'Topics', to: '/topics' }),
175-
expect.objectContaining({ title: 'Consumer Groups', to: '/groups' }),
176-
])
177-
);
178-
});
179-
180151
test('stays in loading state while token refresh is pending', async () => {
181152
// Create a deferred promise that never resolves during this test
182153
const tokenPromise = new Promise<string>(() => {});

frontend/src/federation/console-app.tsx

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,8 @@ import { FederatedProviders } from './federated-providers';
4141
import { TokenManager } from './token-manager';
4242
import type { ConsoleAppProps } from './types';
4343
import { NotFoundPage } from '../components/misc/not-found-page';
44-
import {
45-
addBearerTokenInterceptor,
46-
checkExpiredLicenseInterceptor,
47-
config,
48-
embeddedAvailableRoutesObservable,
49-
getGrpcBasePath,
50-
type SidebarItem,
51-
setup,
52-
} from '../config';
44+
import { addBearerTokenInterceptor, checkExpiredLicenseInterceptor, config, getGrpcBasePath, setup } from '../config';
5345
import { routeTree } from '../routeTree.gen';
54-
import { uiState } from '../state/ui-state';
5546

5647
/**
5748
* Creates an interceptor that refreshes the token on 401 and retries the request.
@@ -224,41 +215,6 @@ function ConsoleAppInner({
224215
};
225216
}, [tokenManager, queryClient, clusterId, onSidebarItemsChange, onBreadcrumbsChange, featureFlags, configOverrides]);
226217

227-
// Sync sidebar items when routes change
228-
useEffect(() => {
229-
if (!(isInitialized && onSidebarItemsChange)) {
230-
return;
231-
}
232-
233-
// Push current sidebar items to host
234-
const sidebarItems = embeddedAvailableRoutesObservable.routes.map(
235-
(r, i) =>
236-
({
237-
title: String(r.title),
238-
to: r.path,
239-
icon: r.icon,
240-
order: i,
241-
group: r.group,
242-
}) as SidebarItem
243-
);
244-
245-
onSidebarItemsChange(sidebarItems);
246-
}, [isInitialized, onSidebarItemsChange]);
247-
248-
// Sync breadcrumbs when they change
249-
useEffect(() => {
250-
if (!(isInitialized && onBreadcrumbsChange)) {
251-
return;
252-
}
253-
254-
const breadcrumbs = uiState.pageBreadcrumbs.map((v) => ({
255-
title: v.title,
256-
to: v.linkTo,
257-
}));
258-
259-
onBreadcrumbsChange(breadcrumbs);
260-
}, [isInitialized, onBreadcrumbsChange]);
261-
262218
// Create transport with token interceptors (including refresh on 401)
263219
const dataplaneTransport = useMemo(
264220
() =>

0 commit comments

Comments
 (0)