feat(usage): resource usage metering page

Add the Usage page with Summary / Tokens / GPU Instances / Storage / Resource
Events tabs over the new metering endpoints: per-resource breakdowns with
date / scope / user / resource filters, trend charts, server-side sortable
tables (GPU-Hours, Instance-Hours, GB-Days, GB-Hours), Excel export with an
in-dialog preview, and KPI cards with help tooltips explaining each metric.

MaaS-only users (no Kubernetes cluster and no resource events) get a
tokens-only view with the tab bar dropped; GPU Service / the full page unlock
for admins, cluster owners, or anyone who has run a resource. Instance-type
rows reuse the GPU Instances list styling, and deleted users / instances /
volumes are flagged in breakdowns and filters.
This commit is contained in:
michelia
2026-06-04 19:52:52 +08:00
committed by jialin
parent 50601b0aff
commit 62f34ffcaf
14 changed files with 459 additions and 45 deletions
@@ -47,6 +47,10 @@ const PieChart: React.FC<PieChartProps> = ({
color: colors,
tooltip: {
trigger: 'item',
// Keep the tooltip inside the chart box — the donut sits on the left, so
// a left-slice tooltip could otherwise spill out and get hidden behind
// the side menu.
confine: true,
backgroundColor: token.colorBgElevated,
borderColor: 'transparent',
formatter: (params: any) => {
@@ -69,6 +73,9 @@ const PieChart: React.FC<PieChartProps> = ({
itemWidth: 8,
itemHeight: 8,
itemGap: 10,
// Long names are truncated in the legend; hovering shows the full name
// in a tooltip.
tooltip: { show: true },
textStyle: {
color: token.colorTextTertiary,
overflow: 'truncate',