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 [updatingHardwareReport, setUpdatingHardwareReport] =
createSignal(false);
const handleUpdateSummary = async () => {
setUpdatingHardwareReport(true);
try {
// TODO: Debounce
const call = client.fetch("run_machine_hardware_info", {
target_host: {
@@ -182,7 +188,10 @@ const CheckHardware = () => {
},
});
await call.result;
hardwareQuery.refetch();
await hardwareQuery.refetch();
} finally {
setUpdatingHardwareReport(false);
}
};
const reportExists = () => hardwareQuery?.data?.hardware_config !== "none";
@@ -197,12 +206,12 @@ const CheckHardware = () => {
Hardware Report
</Typography>
<Button
disabled={hardwareQuery.isLoading}
disabled={hardwareQuery.isLoading || updatingHardwareReport()}
hierarchy="secondary"
startIcon="Report"
onClick={handleUpdateSummary}
class="flex gap-3"
loading={hardwareQuery.isFetching}
loading={hardwareQuery.isFetching || updatingHardwareReport()}
>
Update hardware report
</Button>