feat(usage): break down chart export by instance/volume with owner user column

Group the GPU Instances and Storage chart exports by date+instance /
date+volume, add Instance/Storage and (org-admin only) User columns, and
mark deleted instances/volumes and their owner user independently in both
the preview and the exported sheet.
This commit is contained in:
jialin
2026-07-10 16:31:35 +08:00
committed by jialin
parent f92499cbe5
commit 1f861c5844
4 changed files with 124 additions and 10 deletions
+30 -1
View File
@@ -307,6 +307,21 @@ const StorageTab: React.FC = () => {
dataIndex: 'date',
key: 'date'
},
{
title: intl.formatMessage({ id: 'usage.tabs.storage' }),
dataIndex: 'volume_name',
key: 'volume_name'
},
// Owner User column — org admins only (members see just their own rows).
...(canManageUsers
? [
{
title: intl.formatMessage({ id: 'usage.table.users' }),
dataIndex: 'user_name',
key: 'user_name'
}
]
: []),
{
title: intl.formatMessage({ id: 'usage.metric.gbDays' }),
dataIndex: 'storage_gb_days',
@@ -333,7 +348,7 @@ const StorageTab: React.FC = () => {
// The preview modal now only backs the by-date chart export.
const exportConfig = {
groupBy: ['date'],
groupBy: ['date', 'volume'],
columns: chartExportColumns,
fileName: `storage_chart_${dateSuffix}.xlsx`,
sheetName: intl.formatMessage({ id: 'usage.tabs.storage' })
@@ -442,6 +457,20 @@ const StorageTab: React.FC = () => {
initialDateRange={dateRange}
initialSelectedUsers={selectedUsers}
initialSelectedResources={selectedVolumes}
deletedNameFields={[
// The row's ``deleted`` is the grouped volume; the owner user
// carries its own ``user_deleted``.
{ name: 'volume_name', id: 'volume_id', deletedFlag: 'deleted' },
...(canManageUsers
? [
{
name: 'user_name',
id: 'user_id',
deletedFlag: 'user_deleted'
}
]
: [])
]}
/>
</div>
);