Disable buttons while webUI updating

This commit is contained in:
schroda
2024-05-04 22:48:06 +02:00
parent c731d08547
commit b892c93d7a
2 changed files with 8 additions and 3 deletions

View File

@@ -24,6 +24,7 @@ interface BaseProps {
actionTitle: string;
updateCheckerProps: Parameters<typeof useUpdateChecker>;
changelogUrl?: string;
disabled?: boolean;
}
interface UrlActionProps extends BaseProps {
@@ -45,6 +46,7 @@ export const VersionUpdateInfoDialog = ({
actionTitle,
updateCheckerProps,
changelogUrl,
disabled,
}: VersionUpdateInfoDialogProps) => {
const { t } = useTranslation();
@@ -71,7 +73,9 @@ export const VersionUpdateInfoDialog = ({
<PopupState variant="popover" popupId="update-checker-close-menu">
{(popupState) => (
<>
<Button {...bindTrigger(popupState)}>{t('global.label.close')}</Button>
<Button disabled={disabled} {...bindTrigger(popupState)}>
{t('global.label.close')}
</Button>
<Menu {...bindMenu(popupState)}>
<MenuItem
onClick={() => {
@@ -94,11 +98,11 @@ export const VersionUpdateInfoDialog = ({
)}
</PopupState>
{actionUrl ? (
<Button variant="contained" href={actionUrl} target="_blank">
<Button disabled={disabled} variant="contained" href={actionUrl} target="_blank">
{actionTitle}
</Button>
) : (
<Button onClick={onAction} variant="contained">
<Button disabled={disabled} onClick={onAction} variant="contained">
{actionTitle}
</Button>
)}

View File

@@ -120,6 +120,7 @@ export const WebUIUpdateChecker = () => {
version: webUIUpdateData?.checkForWebUIUpdate.tag,
channel: webUIUpdateData?.checkForWebUIUpdate.channel,
})}
disabled={isUpdateInProgress}
onAction={() =>
requestManager
.updateWebUI()