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:
@@ -13,6 +13,7 @@
|
||||
* The previous implementation lived in this file; it now lives in
|
||||
* ``components/token-tab.tsx`` so we can host it as a tab pane.
|
||||
*/
|
||||
import { useAccess } from '@umijs/max';
|
||||
import { Tabs, TabsProps } from 'antd';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import GpuInstancesTab from './components/gpu-instances-tab';
|
||||
@@ -22,6 +23,7 @@ import SummaryTab from './components/summary-tab';
|
||||
import TokenTab from './components/token-tab';
|
||||
|
||||
const Usage: React.FC = () => {
|
||||
const access = useAccess();
|
||||
// Land on the cross-resource Summary by default.
|
||||
const [activeKey, setActiveKey] = useState<string>('summary');
|
||||
|
||||
@@ -56,6 +58,12 @@ const Usage: React.FC = () => {
|
||||
[]
|
||||
);
|
||||
|
||||
// Users who can't see GPU Service (MaaS-only: no cluster, no resource usage)
|
||||
// only have token usage — drop the tab shell and show Tokens directly.
|
||||
if (!access.canSeeGpuService) {
|
||||
return <TokenTab />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Tabs
|
||||
activeKey={activeKey}
|
||||
|
||||
Reference in New Issue
Block a user