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

View File

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