feat(ui): set loading status on update hardware report button in install workflow

This commit is contained in:
Brian McGee
2025-08-25 17:32:15 +01:00
parent 59e50c6150
commit 1fa4ef82e9

View File

@@ -166,23 +166,32 @@ const CheckHardware = () => {
const client = useApiClient(); const client = useApiClient();
const [updatingHardwareReport, setUpdatingHardwareReport] =
createSignal(false);
const handleUpdateSummary = async () => { const handleUpdateSummary = async () => {
// TODO: Debounce setUpdatingHardwareReport(true);
const call = client.fetch("run_machine_hardware_info", {
target_host: { try {
address: store.install.targetHost, // TODO: Debounce
}, const call = client.fetch("run_machine_hardware_info", {
opts: { target_host: {
machine: { address: store.install.targetHost,
flake: {
identifier: clanUri,
},
name: store.install.machineName,
}, },
}, opts: {
}); machine: {
await call.result; flake: {
hardwareQuery.refetch(); identifier: clanUri,
},
name: store.install.machineName,
},
},
});
await call.result;
await hardwareQuery.refetch();
} finally {
setUpdatingHardwareReport(false);
}
}; };
const reportExists = () => hardwareQuery?.data?.hardware_config !== "none"; const reportExists = () => hardwareQuery?.data?.hardware_config !== "none";
@@ -197,12 +206,12 @@ const CheckHardware = () => {
Hardware Report Hardware Report
</Typography> </Typography>
<Button <Button
disabled={hardwareQuery.isLoading} disabled={hardwareQuery.isLoading || updatingHardwareReport()}
hierarchy="secondary" hierarchy="secondary"
startIcon="Report" startIcon="Report"
onClick={handleUpdateSummary} onClick={handleUpdateSummary}
class="flex gap-3" class="flex gap-3"
loading={hardwareQuery.isFetching} loading={hardwareQuery.isFetching || updatingHardwareReport()}
> >
Update hardware report Update hardware report
</Button> </Button>