From 5ce90fe2e5984c92a24fa9ed8d7551692e9cef78 Mon Sep 17 00:00:00 2001 From: opsx Date: Wed, 28 Oct 2026 22:06:17 +0800 Subject: [PATCH] =?UTF-8?q?fix(analysis):=20=E5=8E=BB=E6=8E=89=E5=8E=9F?= =?UTF-8?q?=E5=A7=8B=E6=97=A5=E5=BF=97=E5=BA=95=E6=A0=8F=E4=B8=8E=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E7=A9=BA=E9=97=B4=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 按产品/设计锁死:删底部 goQuery 虚线卡(表内「查看日志」保留);筛选栏去掉命名空间下拉与 labelValues 加载,指标固定全命名空间聚合。 --- frontend/src/i18n/locales/en/analysis.ts | 8 ---- frontend/src/i18n/locales/zh/analysis.ts | 8 ---- frontend/src/pages/analysis/index.tsx | 51 ++---------------------- 3 files changed, 4 insertions(+), 63 deletions(-) diff --git a/frontend/src/i18n/locales/en/analysis.ts b/frontend/src/i18n/locales/en/analysis.ts index b8a4dd0..b6edaa4 100644 --- a/frontend/src/i18n/locales/en/analysis.ts +++ b/frontend/src/i18n/locales/en/analysis.ts @@ -14,8 +14,6 @@ export default { filter: { source: 'Source', sourceEmpty: 'No sources', - namespace: 'Namespace', - allNamespaces: 'All namespaces', refresh: 'Refresh', }, stats: { @@ -43,11 +41,6 @@ export default { empty: 'No namespace-dimension data', other: 'Other', }, - goQuery: { - title: 'Need raw logs?', - desc: 'Search, Tail, and context live on the log query page; this page is aggregates only.', - action: 'Go to log query', - }, daily: { fixedBadge: 'Fixed last 7 days', title: 'Daily volume by app', @@ -61,7 +54,6 @@ export default { rank: '#', app: 'App', appWithKey: 'App ({{key}})', - namespace: 'Namespace', volume: 'Volume', share: 'Share', errors: 'Errors', diff --git a/frontend/src/i18n/locales/zh/analysis.ts b/frontend/src/i18n/locales/zh/analysis.ts index c60e785..61c644f 100644 --- a/frontend/src/i18n/locales/zh/analysis.ts +++ b/frontend/src/i18n/locales/zh/analysis.ts @@ -14,8 +14,6 @@ export default { filter: { source: '数据源', sourceEmpty: '暂无数据源', - namespace: '命名空间', - allNamespaces: '全部命名空间', refresh: '刷新', }, stats: { @@ -43,11 +41,6 @@ export default { empty: '没有命名空间维度的数据', other: '其他', }, - goQuery: { - title: '需要看原始日志?', - desc: '检索、Tail、前后文请到日志查询页;本页只做聚合统计。', - action: '去日志查询', - }, daily: { fixedBadge: '固定近 7 天', title: '应用每日日志量', @@ -61,7 +54,6 @@ export default { rank: '#', app: '应用', appWithKey: '应用({{key}})', - namespace: '命名空间', volume: '日志量', share: '占比', errors: '错误量', diff --git a/frontend/src/pages/analysis/index.tsx b/frontend/src/pages/analysis/index.tsx index 9b7c224..ecd77a8 100644 --- a/frontend/src/pages/analysis/index.tsx +++ b/frontend/src/pages/analysis/index.tsx @@ -5,7 +5,6 @@ import '@/i18n/domains' import { BarChart3, Boxes, FileWarning, Loader2, RefreshCw, ScrollText, TriangleAlert } from 'lucide-react' import { Button } from '@/components/ui/button' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select' -import { SearchableValueSelect } from '@/components/SearchableValueSelect' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { PageContainer } from '@/components/PageContainer' import { EmptyState } from '@/components/EmptyState' @@ -36,9 +35,6 @@ const AnalysisPage = memo(function AnalysisPage() { const [sources, setSources] = useState([]) const [sourceId, setSourceId] = useState(0) - const [namespaces, setNamespaces] = useState([]) - const [namespacesLoading, setNamespacesLoading] = useState(false) - const [namespace, setNamespace] = useState('') const [start, setStart] = useState(() => toLocal(new Date(Date.now() - 3600000))) const [end, setEnd] = useState(() => toLocal(new Date())) @@ -54,25 +50,10 @@ const AnalysisPage = memo(function AnalysisPage() { }) .catch(() => setSources([])) }, []) - // 命名空间候选随数据源变化(切换数据源时在 onChange 里同步清掉已选命名空间) - useEffect(() => { - if (!sourceId) { - setNamespaces([]) - setNamespacesLoading(false) - return - } - let active = true - setNamespacesLoading(true) - logsApi.labelValues(sourceId, 'namespace') - .then(list => { if (active) setNamespaces(Array.isArray(list) ? list : []) }) - .catch(() => { if (active) setNamespaces([]) }) - .finally(() => { if (active) setNamespacesLoading(false) }) - return () => { active = false } - }, [sourceId]) - const { data, loading, error, appLabel, refresh } = useAnalysisMetrics({ sourceId, start, end, namespace }) + const { data, loading, error, appLabel, refresh } = useAnalysisMetrics({ sourceId, start, end, namespace: '' }) // 每日统计固定近 7 天,不随上方时间范围变化;错误就地展示,不影响主区 - const daily = useDailyVolume({ sourceId, namespace, appLabel }) + const daily = useDailyVolume({ sourceId, namespace: '', appLabel }) // 非 admin:菜单不可见,直访时给明确提示(后端 AdminAuth 403 兜底) if (!isAdmin) { @@ -94,11 +75,11 @@ const AnalysisPage = memo(function AnalysisPage() { } > - {/* 筛选栏:数据源 / 命名空间 / 时间范围 */} + {/* 筛选栏:数据源 / 时间范围(全命名空间聚合) */}
- { setStart(nextStart); setEnd(nextEnd) }} />
@@ -208,18 +177,6 @@ const AnalysisPage = memo(function AnalysisPage() { - - -
-

{t('goQuery.title')}

-

{t('goQuery.desc')}

-
- -
-
)}