Dashboard
概览的总数、图表和排行列表放在同一个由细线分隔的面板上;总数就是标签页,决定图表显示什么。
Requests per day, UTC
- This period
- Prior 30 days
| 时间 | This period | Prior 30 days |
|---|---|---|
| 10月9日周五 | 1,840 | 1,522 |
| 10月10日周六 | 1,910 | 1,620 |
| 10月11日周日 | 2,120 | 1,837 |
| 10月12日周一 | 1,610 | 1,436 |
| 10月13日周二 | 1,730 | 1,456 |
| 10月14日周三 | 1,980 | 1,708 |
| 10月15日周四 | 1,820 | 1,607 |
| 10月16日周五 | 1,860 | 1,559 |
| 10月17日周六 | 1,880 | 1,613 |
| 10月18日周日 | 1,930 | 1,693 |
| 10月19日周一 | 1,870 | 1,558 |
| 10月20日周二 | 1,850 | 1,578 |
| 10月21日周三 | 1,900 | 1,658 |
| 10月22日周四 | 4,170 | 3,527 |
| 10月23日周五 | 1,950 | 1,655 |
| 10月24日周六 | 2,090 | 1,812 |
| 10月25日周日 | 2,080 | 1,841 |
| 10月26日周一 | 2,060 | 1,741 |
| 10月27日周二 | 2,010 | 1,735 |
| 10月28日周三 | 1,990 | 1,754 |
| 10月29日周四 | 1,970 | 1,654 |
| 10月30日周五 | 1,960 | 1,683 |
| 10月31日周六 | 2,200 | 1,926 |
| 11月1日周日 | 2,050 | 1,714 |
| 11月2日周一 | 1,880 | 1,605 |
| 11月3日周二 | 1,990 | 1,736 |
| 11月4日周三 | 2,010 | 1,671 |
| 11月5日周四 | 2,060 | 1,751 |
| 11月6日周五 | 2,030 | 1,762 |
| 11月7日周六 | 1,460 | 1,309 |
Cache hit
48%↑0.5% 向好62.6M input tokens from cache
November so far$13.39
Forecast$60.45
Models by requests
function Overview() {
const [metric, setMetric] = useState("requests");
return (
<div className="w-full">
<Dashboard aria-label="Usage in the period" headingLevel={2}>
<MetricTabs aria-label="Metric to chart" items={TABS} value={metric} onValueChange={setMetric} controls="dashboard-chart" />
<DashboardCell className="lg:col-span-8" title="Requests per day, UTC">
<CellInset grow>
<Legend
items={[
{ id: "now", label: "This period", color: "var(--k-viz-1)" },
{ id: "before", label: "Prior 30 days", color: "var(--k-text-tertiary)", dashed: true },
]}
/>
<div id="dashboard-chart" className="mt-16">
<TimeseriesChart
aria-label="Requests per day"
kind="area"
hideLegend
height={220}
timeZone="UTC"
series={[
{ id: "now", label: "This period", color: "var(--k-viz-1)", points: points(NOW) },
{ id: "before", label: "Prior 30 days", color: "var(--k-text-tertiary)", dashed: true, points: points(BEFORE) },
]}
/>
</div>
</CellInset>
</DashboardCell>
<DashboardCell className="lg:col-span-4" title="Cache hit">
<Readout value="48%" change={{ value: 0.005 }} detail="62.6M input tokens from cache" />
<div className="mt-20 grid grid-cols-2">
<Readout size="sm" label="November so far" value="$13.39" />
<Readout size="sm" label="Forecast" value="$60.45" />
</div>
</DashboardCell>
<DashboardCell className="lg:col-span-12" title="Models by requests">
<RankList aria-label="Models by requests" items={MODELS} onOpen={() => {}} />
</DashboardCell>
</Dashboard>
</div>
);
}import { Dashboard, DashboardCell, CellInset, MetricTabs, Readout, RankList, Legend } from "@logicplanes/kaeso-ui";属性
aria-labelstring面板的无障碍名称,例如“期间内的用量”。
busyboolean在加载下一组数字时,将当前数字以减淡的方式保留在屏幕上。
childrenReactNodeMetricTabs和若干DashboardCell。columns4 | 2 | 3 | 5 | 6 | 12 = 12从 1024px 起的列数。设为与
MetricTabs的标签数相同,并让每个单元格跨越完整的标签,使下方每条细线都延续某个标签的边缘;自由布局用 12。headingLevel2 | 3 = 3单元格标题的级别:位于某个区块标题下方时为 3(默认),上方只有页面标题时为 2。
wideColumns4 | 2 | 3 | 6 | 12从 1280px 起的列数,用于单元格需要比
columns在 1024px 时更多空间的界面:1024px 时两列、1280px 时四列,可让每个单元格都足够宽以便阅读。