Merge pull request 'feat(ui): set loading status on update hardware report button in install workflow' (#4951) from ui/update-hardware-report-loading-state into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4951
This commit is contained in:
brianmcgee
2025-08-25 16:46:16 +00:00

View File

@@ -166,7 +166,13 @@ const CheckHardware = () => {
const client = useApiClient(); const client = useApiClient();
const [updatingHardwareReport, setUpdatingHardwareReport] =
createSignal(false);
const handleUpdateSummary = async () => { const handleUpdateSummary = async () => {
setUpdatingHardwareReport(true);
try {
// TODO: Debounce // TODO: Debounce
const call = client.fetch("run_machine_hardware_info", { const call = client.fetch("run_machine_hardware_info", {
target_host: { target_host: {
@@ -182,7 +188,10 @@ const CheckHardware = () => {
}, },
}); });
await call.result; await call.result;
hardwareQuery.refetch(); 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>