fix(usage): format Last Active as local time on GPU & Storage tabs
The Last Active column had no renderer, so it dumped the raw ISO timestamp (gpustack/gpustack#5523). It's a UTC instant (max bucket hour), so format it to the user's local time with dayjs — matching the Resource Events time column and the rest of the product. (Token Last Active is a daily date, not an instant, so it stays a plain date with no timezone shift.)
This commit is contained in:
@@ -328,6 +328,13 @@ const GpuInstancesTab: React.FC = () => {
|
|||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
// Last Active is a UTC instant (max bucket hour) → show formatted local time.
|
||||||
|
const lastActiveCol = {
|
||||||
|
title: intl.formatMessage({ id: 'usage.table.lastActive' }),
|
||||||
|
dataIndex: 'last_active',
|
||||||
|
key: 'last_active',
|
||||||
|
render: (v?: string) => (v ? dayjs(v).format('YYYY-MM-DD HH:mm:ss') : '-')
|
||||||
|
};
|
||||||
if (activeTableTab === 'gpu_type') {
|
if (activeTableTab === 'gpu_type') {
|
||||||
return [
|
return [
|
||||||
instanceTypeColType,
|
instanceTypeColType,
|
||||||
@@ -337,11 +344,7 @@ const GpuInstancesTab: React.FC = () => {
|
|||||||
dataIndex: 'active_instances',
|
dataIndex: 'active_instances',
|
||||||
key: 'active_instances'
|
key: 'active_instances'
|
||||||
},
|
},
|
||||||
{
|
lastActiveCol
|
||||||
title: intl.formatMessage({ id: 'usage.table.lastActive' }),
|
|
||||||
dataIndex: 'last_active',
|
|
||||||
key: 'last_active'
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if (activeTableTab === 'instance') {
|
if (activeTableTab === 'instance') {
|
||||||
@@ -353,11 +356,7 @@ const GpuInstancesTab: React.FC = () => {
|
|||||||
},
|
},
|
||||||
instanceTypeColInstance,
|
instanceTypeColInstance,
|
||||||
...baseValueCols,
|
...baseValueCols,
|
||||||
{
|
lastActiveCol
|
||||||
title: intl.formatMessage({ id: 'usage.table.lastActive' }),
|
|
||||||
dataIndex: 'last_active',
|
|
||||||
key: 'last_active'
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
// user tab
|
// user tab
|
||||||
@@ -368,11 +367,7 @@ const GpuInstancesTab: React.FC = () => {
|
|||||||
key: 'user_name'
|
key: 'user_name'
|
||||||
},
|
},
|
||||||
...baseValueCols,
|
...baseValueCols,
|
||||||
{
|
lastActiveCol
|
||||||
title: intl.formatMessage({ id: 'usage.table.lastActive' }),
|
|
||||||
dataIndex: 'last_active',
|
|
||||||
key: 'last_active'
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
}, [activeTableTab, tableSort, intl]);
|
}, [activeTableTab, tableSort, intl]);
|
||||||
|
|
||||||
|
|||||||
@@ -293,6 +293,13 @@ const StorageTab: React.FC = () => {
|
|||||||
render: (v: number) => (v ?? 0).toFixed(2)
|
render: (v: number) => (v ?? 0).toFixed(2)
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
// Last Active is a UTC instant (max bucket hour) → show formatted local time.
|
||||||
|
const lastActiveCol = {
|
||||||
|
title: intl.formatMessage({ id: 'usage.table.lastActive' }),
|
||||||
|
dataIndex: 'last_active',
|
||||||
|
key: 'last_active',
|
||||||
|
render: (v?: string) => (v ? dayjs(v).format('YYYY-MM-DD HH:mm:ss') : '-')
|
||||||
|
};
|
||||||
if (activeTableTab === 'volume') {
|
if (activeTableTab === 'volume') {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@@ -314,11 +321,7 @@ const StorageTab: React.FC = () => {
|
|||||||
render: (v?: number) => (v ? `${Math.round(v / 1024)}GB` : '-')
|
render: (v?: number) => (v ? `${Math.round(v / 1024)}GB` : '-')
|
||||||
},
|
},
|
||||||
...valueCols,
|
...valueCols,
|
||||||
{
|
lastActiveCol
|
||||||
title: intl.formatMessage({ id: 'usage.table.lastActive' }),
|
|
||||||
dataIndex: 'last_active',
|
|
||||||
key: 'last_active'
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
@@ -333,11 +336,7 @@ const StorageTab: React.FC = () => {
|
|||||||
dataIndex: 'active_volumes',
|
dataIndex: 'active_volumes',
|
||||||
key: 'active_volumes'
|
key: 'active_volumes'
|
||||||
},
|
},
|
||||||
{
|
lastActiveCol
|
||||||
title: intl.formatMessage({ id: 'usage.table.lastActive' }),
|
|
||||||
dataIndex: 'last_active',
|
|
||||||
key: 'last_active'
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
}, [activeTableTab, tableSort, intl]);
|
}, [activeTableTab, tableSort, intl]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user