This is an automated email from the ASF dual-hosted git repository.
lizhimins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new e79635659 fix(clients): let the language filter select unconfirmed
languages (#6104)
e79635659 is described below
commit e79635659a976457d731a8724376587812d603c6
Author: Apulupie <[email protected]>
AuthorDate: Fri Nov 27 12:52:47 2026 +0800
fix(clients): let the language filter select unconfirmed languages (#6104)
---
.../pages/cluster/__tests__/ClientsPage.test.tsx | 52 ++++++++++++++++++++++
web/src/pages/cluster/clients.tsx | 19 +++++---
2 files changed, 65 insertions(+), 6 deletions(-)
diff --git a/web/src/pages/cluster/__tests__/ClientsPage.test.tsx
b/web/src/pages/cluster/__tests__/ClientsPage.test.tsx
index 797feac4d..1d599247f 100644
--- a/web/src/pages/cluster/__tests__/ClientsPage.test.tsx
+++ b/web/src/pages/cluster/__tests__/ClientsPage.test.tsx
@@ -548,6 +548,58 @@ describe('Clients page', () => {
expect(csv).not.toContain('[email protected]:49153');
});
+ it('filters rows with an unconfirmed language through the language filter',
async () => {
+ const createObjectURL = vi.fn((blob: Blob | MediaSource) => {
+ expect(blob).toBeInstanceOf(Blob);
+ return 'blob:unknown-language-connections';
+ });
+ Object.defineProperty(URL, 'createObjectURL', {
+ writable: true,
+ value: createObjectURL,
+ });
+ Object.defineProperty(URL, 'revokeObjectURL', {
+ writable: true,
+ value: vi.fn(),
+ });
+ vi.spyOn(HTMLAnchorElement.prototype, 'click').mockImplementation(() =>
{});
+ const user = userEvent.setup({ pointerEventsCheck: 0 });
+ vi.mocked(connectionsService.listConnections).mockResolvedValue([
+ { ...connection, language: null },
+ connections[1],
+ ]);
+ renderWithProviders(<ClientsPage />);
+
+ await screen.findAllByText('[email protected]:49153');
+ // The distribution names the rows the broker reported no language for, so
the table has to be
+ // able to filter down to them.
+ expect(
+
within(screen.getByTestId('language-version-distribution')).getByText(/未知
5\.0\.7: 1/),
+ ).toBeInTheDocument();
+ const filterTriggers =
document.querySelectorAll<HTMLElement>('.ant-table-filter-trigger');
+ await user.click(filterTriggers[3]);
+ const filterDropdown =
document.querySelector<HTMLElement>('.ant-table-filter-dropdown');
+ expect(filterDropdown).not.toBeNull();
+ await user.click(within(filterDropdown!).getByText('未知'));
+ await user.click(within(filterDropdown!).getByRole('button', { name: 'OK'
}));
+
+ const hasDetailButton = (candidate: HTMLElement) =>
+ within(candidate).queryByRole('button', { name: /详情/ }) !== null;
+ const orderRows = await screen.findAllByRole('row', {
+ name: /order-svc-0@10\.0\.1\.12:49152/,
+ });
+ expect(orderRows.some(hasDetailButton)).toBe(true);
+ const paymentRows = screen.queryAllByRole('row', {
+ name: /payment-svc-0@10\.0\.1\.13:49153/,
+ });
+ expect(paymentRows.some(hasDetailButton)).toBe(false);
+
+ await user.click(screen.getByRole('button', { name: /导出/ }));
+ const blob = createObjectURL.mock.calls[0][0] as Blob;
+ const csv = await blob.text();
+ expect(csv).toContain('[email protected]:49152');
+ expect(csv).not.toContain('[email protected]:49153');
+ });
+
it('keeps incomplete client metadata searchable by address', async () => {
const user = userEvent.setup({ pointerEventsCheck: 0 });
vi.mocked(connectionsService.listConnections).mockResolvedValue([
diff --git a/web/src/pages/cluster/clients.tsx
b/web/src/pages/cluster/clients.tsx
index 565ae74a7..e72b3a1e1 100644
--- a/web/src/pages/cluster/clients.tsx
+++ b/web/src/pages/cluster/clients.tsx
@@ -368,7 +368,7 @@ const ClientsPage = () => {
matches('clusterName', connection.clusterName) &&
matches('type', connection.type) &&
matches('protocol', connection.protocol ?? UNKNOWN_PROTOCOL) &&
- matches('language', connection.language ?? ''),
+ matches('language', connection.language ?? UNKNOWN_LANGUAGE),
);
}, [columnFilters, filtered]);
@@ -489,12 +489,19 @@ const ClientsPage = () => {
dataIndex: 'language',
key: 'language',
width: 100,
- filters: Object.entries(languageConfig).map(([value, config]) => ({
- text: config.label,
- value,
- })),
+ filters: [
+ ...Object.entries(languageConfig).map(([value, config]) => ({
+ text: config.label,
+ value,
+ })),
+ // Rows whose broker-reported language has no known counterpart are
tagged "unknown" and
+ // grouped into the distribution's unknown bucket; without this option
the table cannot be
+ // filtered down to them, the way the protocol column can.
+ { text: t('common.unknown'), value: UNKNOWN_LANGUAGE },
+ ],
filteredValue: columnFilters.language ?? null,
- onFilter: (value, record) => record.language === value,
+ onFilter: (value, record) =>
+ value === UNKNOWN_LANGUAGE ? !record.language : record.language ===
value,
render: (lang?: string | null) => renderLanguageTag(lang),
},
{