From 8b95a0d764d8a94a095c16a199b09e41b41bd08f Mon Sep 17 00:00:00 2001 From: shenlan Date: Sun, 21 Sep 2025 22:36:36 +0800 Subject: [PATCH] Refine insight workspace global filters (#285) --- .../insight/explore/ExploreBuilder.tsx | 93 +++++------------- .../insight/layout/BreadcrumbBar.tsx | 17 ++-- .../insight/layout/TimeRangePicker.tsx | 8 +- .../insight/topology/NetworkTopologyPanel.tsx | 94 +------------------ 4 files changed, 40 insertions(+), 172 deletions(-) diff --git a/ui/homepage/app/components/insight/explore/ExploreBuilder.tsx b/ui/homepage/app/components/insight/explore/ExploreBuilder.tsx index a96ce57..da90ea2 100644 --- a/ui/homepage/app/components/insight/explore/ExploreBuilder.tsx +++ b/ui/homepage/app/components/insight/explore/ExploreBuilder.tsx @@ -47,12 +47,6 @@ const defaultRecord = (value: T): Record => ({ traceql: value }) -const orgOptions = ['global-org', 'ecommerce', 'payments'] -const projectOptions = ['observability', 'checkout', 'growth'] -const envOptions = ['production', 'staging', 'dev'] -const regionOptions = ['us-west-2', 'eu-central-1', 'ap-southeast-1'] -const timeRanges = ['15m', '1h', '6h', '24h', '7d'] - export function ExploreBuilder({ state, updateState, @@ -236,18 +230,9 @@ export function ExploreBuilder({ {!isCollapsed && (
{inputMode === 'menu' ? ( -
- updateState({ org: value })} options={orgOptions} /> - updateState({ project: value })} - options={projectOptions} - /> - updateState({ env: value })} options={envOptions} /> - updateState({ region: value })} options={regionOptions} /> - updateState({ timeRange: value })} /> -
+
+ +

Query preview

                     {state.queries[language] || meta.placeholder}
@@ -328,63 +313,29 @@ export function ExploreBuilder({
   return 
{panels}
} -interface MenuSelectProps { - label: string - value: string - onChange: (value: string) => void - options: string[] -} +function ContextSummary({ state }: { state: InsightState }) { + const context = [ + { label: 'Org', value: state.org }, + { label: 'Environment', value: state.env }, + { label: 'Region', value: state.region }, + { label: 'Project', value: state.project }, + { label: 'Time range', value: state.timeRange } + ] -function MenuSelect({ label, value, onChange, options }: MenuSelectProps) { return ( - - ) -} - -interface MenuTimeRangeProps { - value: string - onChange: (value: string) => void -} - -function MenuTimeRange({ value, onChange }: MenuTimeRangeProps) { - return ( - +
) } diff --git a/ui/homepage/app/components/insight/layout/BreadcrumbBar.tsx b/ui/homepage/app/components/insight/layout/BreadcrumbBar.tsx index d7e46e6..ea612c2 100644 --- a/ui/homepage/app/components/insight/layout/BreadcrumbBar.tsx +++ b/ui/homepage/app/components/insight/layout/BreadcrumbBar.tsx @@ -2,6 +2,7 @@ import { useState } from 'react' import { InsightState } from '../../insight/store/urlState' +import { TimeRangePicker } from './TimeRangePicker' interface BreadcrumbBarProps { state: InsightState @@ -28,17 +29,19 @@ export function BreadcrumbBar({ state, updateState, shareableLink }: BreadcrumbB } return ( -
+
updateState({ org })} /> + updateState({ env })} /> + + updateState({ region })} /> + updateState({ project })} /> - updateState({ env })} /> - - updateState({ region })} /> + @@ -58,12 +61,12 @@ function Selector({ onChange: (value: string) => void }) { return ( -
+ ) } diff --git a/ui/homepage/app/components/insight/topology/NetworkTopologyPanel.tsx b/ui/homepage/app/components/insight/topology/NetworkTopologyPanel.tsx index 82abac1..9632cd7 100644 --- a/ui/homepage/app/components/insight/topology/NetworkTopologyPanel.tsx +++ b/ui/homepage/app/components/insight/topology/NetworkTopologyPanel.tsx @@ -10,14 +10,8 @@ interface NetworkTopologyPanelProps { updateState: (partial: Partial) => void } -const orgOptions = ['global-org', 'ecommerce', 'payments'] -const projectOptions = ['observability', 'checkout', 'growth'] -const envOptions = ['production', 'staging', 'dev'] -const regionOptions = ['us-west-2', 'eu-central-1', 'ap-southeast-1'] -const timeRanges = ['15m', '1h', '6h', '24h', '7d'] - export function NetworkTopologyPanel({ state, updateState }: NetworkTopologyPanelProps) { - const [filtersCollapsed, setFiltersCollapsed] = useState(false) + const [advancedVisible, setAdvancedVisible] = useState(false) const subtitle = useMemo( () => `${state.env} · ${state.region} · ${state.org}/${state.project}`, @@ -37,10 +31,10 @@ export function NetworkTopologyPanel({ state, updateState }: NetworkTopologyPane
- ))} - onChange(event.target.value)} - className="w-32 rounded-xl border border-slate-800 bg-slate-950/60 px-3 py-1.5 text-xs text-slate-200" - placeholder="Custom" - /> -
- - ) -} - interface TextFieldProps { label: string value: string