mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-30 06:16:37 +08:00
86d2d6b0ad
Split rate-limits into analysis/config tabs; reuse access-log overview filters; chart hourly RPS vs visits with dataZoom; rank top hosts/IPs by window-average RPS.
52 lines
1.1 KiB
TypeScript
52 lines
1.1 KiB
TypeScript
import {
|
|
Card,
|
|
CardContent,
|
|
CardDescription,
|
|
CardHeader,
|
|
CardTitle,
|
|
} from '@/components/ui/card';
|
|
|
|
import { RankChart } from './rank-chart';
|
|
|
|
type RankCardItem = {
|
|
label: string;
|
|
value: number;
|
|
};
|
|
|
|
type RankCardProps = {
|
|
title: string;
|
|
description: string;
|
|
items: RankCardItem[];
|
|
color?: string;
|
|
valueFormatter?: (value: number) => string;
|
|
};
|
|
|
|
export function RankCard({
|
|
title,
|
|
description,
|
|
items,
|
|
color = '#3b82f6',
|
|
valueFormatter,
|
|
}: RankCardProps) {
|
|
return (
|
|
<Card className='border-dashed shadow-none'>
|
|
<CardHeader className='pb-3'>
|
|
<CardTitle className='text-sm font-semibold text-foreground'>
|
|
{title}
|
|
</CardTitle>
|
|
<CardDescription className='text-xs text-muted-foreground'>
|
|
{description}
|
|
</CardDescription>
|
|
</CardHeader>
|
|
<CardContent className='pt-0'>
|
|
<RankChart
|
|
items={items}
|
|
color={color}
|
|
valueFormatter={valueFormatter}
|
|
emptyMessage={`暂无 ${title} 数据`}
|
|
/>
|
|
</CardContent>
|
|
</Card>
|
|
);
|
|
}
|