fix: remove per-card Refresh button in InstanceCard, consolidate to page-level refresh
- Remove onRefresh prop from InstanceCard component - Remove handleRefresh callback from InstancesManagementPage - Remove onRefresh passing from both filtered and unfiltered instance lists - Keep global page refresh button in PageHeader
This commit is contained in:
@ -27,7 +27,6 @@ interface InstanceCardProps {
|
|||||||
instance: InstanceResponse;
|
instance: InstanceResponse;
|
||||||
onModify: (instance: InstanceResponse) => void;
|
onModify: (instance: InstanceResponse) => void;
|
||||||
onTerminate: (instance: InstanceResponse) => void;
|
onTerminate: (instance: InstanceResponse) => void;
|
||||||
onRefresh: (instance: InstanceResponse) => void;
|
|
||||||
onViewEntries: (instance: InstanceResponse) => void;
|
onViewEntries: (instance: InstanceResponse) => void;
|
||||||
onViewDiagnostics: (instance: InstanceResponse) => void;
|
onViewDiagnostics: (instance: InstanceResponse) => void;
|
||||||
}
|
}
|
||||||
@ -135,7 +134,6 @@ export const InstanceCard: React.FC<InstanceCardProps> = ({
|
|||||||
instance,
|
instance,
|
||||||
onModify,
|
onModify,
|
||||||
onTerminate,
|
onTerminate,
|
||||||
onRefresh,
|
|
||||||
onViewEntries,
|
onViewEntries,
|
||||||
onViewDiagnostics,
|
onViewDiagnostics,
|
||||||
}) => {
|
}) => {
|
||||||
|
|||||||
@ -188,37 +188,6 @@ const InstancesManagementPage: React.FC = () => {
|
|||||||
};
|
};
|
||||||
}, [autoRefresh]);
|
}, [autoRefresh]);
|
||||||
|
|
||||||
const handleRefresh = useCallback(async (instance: Instance) => {
|
|
||||||
const clusterId = instance.clusterId;
|
|
||||||
if (!clusterId) {
|
|
||||||
toastError("Cluster ID is missing");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
toastInfo(`Refreshing status for "${instance.name || "instance"}"...`, {
|
|
||||||
title: "Instance Status",
|
|
||||||
durationMs: 1800,
|
|
||||||
mergeKey: `instance-refresh-${instance.id || clusterId}`,
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
const normalized = await fetchClusterInstances(clusterId);
|
|
||||||
setInstancesByCluster((prev) => {
|
|
||||||
const next = new Map(prev);
|
|
||||||
next.set(clusterId, normalized.instances);
|
|
||||||
return next;
|
|
||||||
});
|
|
||||||
setInstanceTotals((prev) => {
|
|
||||||
const next = new Map(prev);
|
|
||||||
next.set(clusterId, normalized.total);
|
|
||||||
return next;
|
|
||||||
});
|
|
||||||
success(SuccessMessages.INSTANCE_STATUS_REFRESHED);
|
|
||||||
} catch (err: unknown) {
|
|
||||||
toastError(formatApiError(err) || InstanceErrors.STATUS_FETCH_FAILED);
|
|
||||||
}
|
|
||||||
}, [success, toastError, toastInfo]);
|
|
||||||
|
|
||||||
const handleModify = useCallback((instance: Instance) => {
|
const handleModify = useCallback((instance: Instance) => {
|
||||||
setModifyInstance(instance);
|
setModifyInstance(instance);
|
||||||
}, []);
|
}, []);
|
||||||
@ -459,7 +428,7 @@ const InstancesManagementPage: React.FC = () => {
|
|||||||
instance={instance}
|
instance={instance}
|
||||||
onModify={handleModify}
|
onModify={handleModify}
|
||||||
onTerminate={handleTerminate}
|
onTerminate={handleTerminate}
|
||||||
onRefresh={handleRefresh}
|
|
||||||
onViewEntries={handleViewEntries}
|
onViewEntries={handleViewEntries}
|
||||||
onViewDiagnostics={handleViewDiagnostics}
|
onViewDiagnostics={handleViewDiagnostics}
|
||||||
/>
|
/>
|
||||||
@ -476,7 +445,7 @@ const InstancesManagementPage: React.FC = () => {
|
|||||||
instance={instance}
|
instance={instance}
|
||||||
onModify={handleModify}
|
onModify={handleModify}
|
||||||
onTerminate={handleTerminate}
|
onTerminate={handleTerminate}
|
||||||
onRefresh={handleRefresh}
|
|
||||||
onViewEntries={handleViewEntries}
|
onViewEntries={handleViewEntries}
|
||||||
onViewDiagnostics={handleViewDiagnostics}
|
onViewDiagnostics={handleViewDiagnostics}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user