fix(analysis): 去掉原始日志底栏与命名空间筛选
按产品/设计锁死:删底部 goQuery 虚线卡(表内「查看日志」保留);筛选栏去掉命名空间下拉与 labelValues 加载,指标固定全命名空间聚合。
This commit is contained in:
1 parent
305d7c5904
commit
5ce90fe2e5
3 files changed
+4
-63
No files matched your search
@@ -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',
|
||||
|
||||
@@ -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: '错误量',
|
||||
|
||||
@@ -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<LogSource[]>([])
|
||||
const [sourceId, setSourceId] = useState(0)
|
||||
const [namespaces, setNamespaces] = useState<string[]>([])
|
||||
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() {
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
{/* 筛选栏:数据源 / 命名空间 / 时间范围 */}
|
||||
{/* 筛选栏:数据源 / 时间范围(全命名空间聚合) */}
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<Select
|
||||
value={sourceId ? String(sourceId) : undefined}
|
||||
onValueChange={value => { setSourceId(Number(value)); setNamespace('') }}
|
||||
onValueChange={value => setSourceId(Number(value))}
|
||||
disabled={sources.length === 0}
|
||||
>
|
||||
<SelectTrigger className="h-9 min-w-40" aria-label={t('filter.source')}>
|
||||
@@ -110,18 +91,6 @@ const AnalysisPage = memo(function AnalysisPage() {
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<SearchableValueSelect
|
||||
hideLabel
|
||||
ariaLabel={t('filter.namespace')}
|
||||
values={namespaces}
|
||||
value={namespace}
|
||||
onChange={setNamespace}
|
||||
allowEmpty
|
||||
emptyLabel={t('filter.allNamespaces')}
|
||||
loading={namespacesLoading}
|
||||
disabled={!sourceId}
|
||||
className="min-w-36"
|
||||
/>
|
||||
<TimeRangePicker start={start} end={end} onChange={(nextStart, nextEnd) => { setStart(nextStart); setEnd(nextEnd) }} />
|
||||
</div>
|
||||
|
||||
@@ -208,18 +177,6 @@ const AnalysisPage = memo(function AnalysisPage() {
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="border-dashed">
|
||||
<CardContent className="flex flex-wrap items-center justify-between gap-3 p-4">
|
||||
<div>
|
||||
<p className="text-sm font-medium">{t('goQuery.title')}</p>
|
||||
<p className="text-xs text-muted-foreground">{t('goQuery.desc')}</p>
|
||||
</div>
|
||||
<Button variant="outline" onClick={() => navigate('/logs')}>
|
||||
<ScrollText className="mr-1 size-4" />
|
||||
{t('goQuery.action')}
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</>
|
||||
)}
|
||||
</PageContainer>
|
||||
|
||||
Reference in new issue
Block a user