This is an automated email from the ASF dual-hosted git repository. zqr10159 pushed a commit to branch 2.0.0 in repository https://gitbox.apache.org/repos/asf/hertzbeat.git
commit 23523355b7edc46623ced8e5e275b638dd3df25d Author: Logic <[email protected]> AuthorDate: Sun May 31 09:33:25 2026 +0800 fix(web-next): keep topology search input explicit --- web-next/app/topology/page.test.tsx | 13 +++++++++---- web-next/app/topology/topology-page.tsx | 9 +++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/web-next/app/topology/page.test.tsx b/web-next/app/topology/page.test.tsx index 172759c94d..f7db52bbe8 100644 --- a/web-next/app/topology/page.test.tsx +++ b/web-next/app/topology/page.test.tsx @@ -303,7 +303,8 @@ describe('topology page', () => { expect(source).toContain('overlayMode="non-occluding"'); expect(source).toContain('const topologyLiveHoverEdge = topologyHoveredDetailEdge;'); expect(source).toContain('topologyHoveredDetailEdge ?? topologyDetailEdge'); - expect(source).toContain("const topologyG6SearchQuery = topologySearchQuery ?? '';"); + expect(source).toContain("const topologyToolbarSearchQuery = topologySearchQuery ?? '';"); + expect(source).toContain('const topologyG6SearchQuery = topologyToolbarSearchQuery;'); expect(source).toContain('searchQuery={topologyG6SearchQuery}'); expect(source).toContain('topologyNodeIds'); expect(source).not.toContain('const topologyNodeHrefById'); @@ -427,6 +428,8 @@ describe('topology page', () => { expect(source).not.toContain('setTopologyLayout(value as TopologyLayoutMode);'); expect(source).toContain('const [topologySearchQuery, setTopologySearchQuery] = React.useState<string | undefined>(undefined);'); expect(source).toContain('const topologyEffectiveSearchQuery = topologySearchQuery ?? map.filterContext.search;'); + expect(source).toContain("const topologyToolbarSearchQuery = topologySearchQuery ?? '';"); + expect(source).toContain('const topologyG6SearchQuery = topologyToolbarSearchQuery;'); expect(source).toContain('const handleTopologySearchChange = React.useCallback'); expect(source).toContain('setTopologySearchQuery(event.currentTarget.value);'); expect(source).toContain('data-topology-layout-navigation="in-page-g6-layout"'); @@ -461,10 +464,11 @@ describe('topology page', () => { expect(source).toContain('onSearchChange={handleTopologySearchChange}'); expect(source).toContain('onReset={handleTopologyResetScope}'); expect(source).not.toContain('layoutValue={topologyLayout}'); - expect(source).toContain('searchValue={topologyEffectiveSearchQuery}'); + expect(source).toContain('searchValue={topologyToolbarSearchQuery}'); expect(source).toContain("layout={topologyLayout}"); expect(source).toContain("layout={topologyG6Layout}"); expect(source).toContain('searchQuery={topologyG6SearchQuery}'); + expect(source).toContain("if (topologyToolbarSearchQuery) topologyG6SearchParams.set('search', topologyToolbarSearchQuery);"); expect(source).not.toContain('setLoadedApiGraph(undefined);'); }); @@ -895,7 +899,8 @@ describe('topology page', () => { expect(html).toContain('data-hz-topology-g6-filter-control-value="none"'); expect(html).toContain('data-hz-topology-g6-filter-control="search"'); expect(html).toContain('data-hz-topology-g6-filter-control-kind="search"'); - expect(html).toContain('data-hz-topology-g6-filter-control-value="checkout-api"'); + expect(html).not.toContain('data-hz-topology-g6-filter-control-value="checkout-api"'); + expect(html).not.toContain('value="checkout-api"'); expect(html).toContain('data-hz-topology-g6-filter-control="reset"'); expect(html).toContain('data-hz-topology-g6-filter-control-kind="reset"'); expect(html).toContain('data-hz-topology-g6-overlay-mode="non-occluding"'); @@ -1874,7 +1879,7 @@ describe('topology page', () => { expect(html).toMatch(/data-topology-node-id="svc-checkout"[^>]+data-topology-node-focus="active"/); expect(html).toMatch(/data-topology-edge-source="database-middleware-connection"[^>]+data-topology-edge-focus="active-path"/); expect(html).toContain('data-topology-view-mode-active="service-call"'); - expect(html).toContain('value="checkout-api"'); + expect(html).not.toContain('value="checkout-api"'); expect(html).toContain('last-30m'); expect(html).toContain('timeRange=last-30m'); expect(html).toContain('当前筛选'); diff --git a/web-next/app/topology/topology-page.tsx b/web-next/app/topology/topology-page.tsx index 334aea845e..76feb0035c 100644 --- a/web-next/app/topology/topology-page.tsx +++ b/web-next/app/topology/topology-page.tsx @@ -684,7 +684,8 @@ export default function TopologyPage({ [apiOwnedEmptyGraph, loadedApiGraph, routeContext, t] ); const topologyEffectiveSearchQuery = topologySearchQuery ?? map.filterContext.search; - const topologyG6SearchQuery = topologySearchQuery ?? ''; + const topologyToolbarSearchQuery = topologySearchQuery ?? ''; + const topologyG6SearchQuery = topologyToolbarSearchQuery; const topologyIsPending = loadedApiGraph === undefined; const topologyTraceCallScope = map.filterContext.sourceKind === 'otlp-trace-call' || map.filterContext.viewMode === 'service-call'; const topologyTraceCallMissingEdges = @@ -847,7 +848,7 @@ export default function TopologyPage({ const topologyG6GroupParams = new URLSearchParams(topologyG6ResetParams); topologyG6GroupParams.set('groupBy', 'source-kind'); const topologyG6SearchParams = new URLSearchParams(topologyG6ResetParams); - if (topologyEffectiveSearchQuery) topologyG6SearchParams.set('search', topologyEffectiveSearchQuery); + if (topologyToolbarSearchQuery) topologyG6SearchParams.set('search', topologyToolbarSearchQuery); if (map.filterContext.groupBy !== 'none') topologyG6SearchParams.set('groupBy', map.filterContext.groupBy); const handleTopologyEnvironmentChange = React.useCallback( (value: string) => { @@ -1423,7 +1424,7 @@ export default function TopologyPage({ ]} searchLabel={t('topology.search.aria')} searchPlaceholder={t('topology.search.placeholder')} - searchValue={topologyEffectiveSearchQuery} + searchValue={topologyToolbarSearchQuery} sourceKindLabel={t('topology.focus-trail.filter.source')} sourceKindValue={map.filterContext.sourceKind ?? 'all'} sourceKindOptions={[ @@ -1520,7 +1521,7 @@ export default function TopologyPage({ id: 'search', kind: 'search', label: t('topology.state.focus'), - value: topologyEffectiveSearchQuery || t('topology.all-entities'), + value: topologyToolbarSearchQuery || t('topology.all-entities'), href: `/topology?${topologyG6SearchParams.toString()}` }, { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
