fix: ux issues

This commit is contained in:
jialin
2026-05-26 19:16:50 +08:00
committed by jialin
parent acb90531b2
commit c6e34db329
27 changed files with 354 additions and 244 deletions
@@ -19,6 +19,7 @@ type ViewEventsModalProps = {
name: string;
namespace: string;
clusterID?: number;
hasPersistentVolume?: boolean;
onCancel: () => void;
};
@@ -31,7 +32,8 @@ const eventTypeStatus: Record<string, 'success' | 'warning' | 'error'> = {
const ViewEventsModal: React.FC<ViewEventsModalProps> = (props) => {
const intl = useIntl();
const { open, onCancel, name, namespace, clusterID } = props || {};
const { open, onCancel, name, namespace, clusterID, hasPersistentVolume } =
props || {};
const [activeKey, setActiveKey] = useState('instance');
const {
@@ -54,7 +56,9 @@ const ViewEventsModal: React.FC<ViewEventsModalProps> = (props) => {
const refreshAll = () => {
if (!name || !namespace || !clusterID) return;
fetchInstanceEvents({ name, namespace, clusterID });
fetchVolumeEvents({ name, namespace, clusterID });
if (hasPersistentVolume) {
fetchVolumeEvents({ name, namespace, clusterID });
}
};
useEffect(() => {
@@ -184,16 +188,20 @@ const ViewEventsModal: React.FC<ViewEventsModalProps> = (props) => {
}),
children: renderTable(instanceEvents, instanceLoading)
},
{
key: 'volume',
label: intl.formatMessage({
id: 'gpuservice.instance.event.tab.volume'
}),
children: renderTable(volumeEvents, volumeLoading)
}
...(hasPersistentVolume
? [
{
key: 'volume',
label: intl.formatMessage({
id: 'gpuservice.instance.event.tab.volume'
}),
children: renderTable(volumeEvents, volumeLoading)
}
]
: [])
];
const isLoading = instanceLoading || volumeLoading;
const isLoading = instanceLoading || (hasPersistentVolume && volumeLoading);
return (
<ScrollerModal