From e49f7ee961010863ad63a1ba12b1e7c0a23647ef Mon Sep 17 00:00:00 2001 From: DoraCretu594118 <103416234+doracretu3pillar@users.noreply.github.com> Date: Thu, 19 Dec 2024 12:22:38 +0200 Subject: [PATCH] Check updatesEnabled when rendering updates modal --- .../PerconaUpdateVersion/PerconaUpdateVersion.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/public/app/percona/shared/components/PerconaBootstrapper/PerconaUpdateVersion/PerconaUpdateVersion.tsx b/public/app/percona/shared/components/PerconaBootstrapper/PerconaUpdateVersion/PerconaUpdateVersion.tsx index 117a82f8b41a5..7938837006665 100644 --- a/public/app/percona/shared/components/PerconaBootstrapper/PerconaUpdateVersion/PerconaUpdateVersion.tsx +++ b/public/app/percona/shared/components/PerconaBootstrapper/PerconaUpdateVersion/PerconaUpdateVersion.tsx @@ -9,7 +9,7 @@ import { UpdatesChangeLogs, } from 'app/percona/shared/core/reducers/updates'; import { setSnoozedVersion } from 'app/percona/shared/core/reducers/user/user'; -import { getPerconaUser, getUpdatesInfo } from 'app/percona/shared/core/selectors'; +import { getPerconaSettings, getPerconaUser, getUpdatesInfo } from 'app/percona/shared/core/selectors'; import { useAppDispatch } from 'app/store/store'; import { useSelector } from 'app/types'; @@ -18,13 +18,15 @@ import { getStyles } from './PerconaUpdateVersion.styles'; const PerconaUpdateVersion = () => { const { updateAvailable, installed, latest, changeLogs, showUpdateModal } = useSelector(getUpdatesInfo); + const { result: settings } = useSelector(getPerconaSettings); + const { updatesEnabled } = settings!; const { snoozedPmmVersion } = useSelector(getPerconaUser); const dispatch = useAppDispatch(); const styles = useStyles2(getStyles); useEffect(() => { const prepareModal = async () => { - if (installed?.version === latest?.version || snoozedPmmVersion === latest?.version) { + if (installed?.version === latest?.version || snoozedPmmVersion === latest?.version || !updatesEnabled) { dispatch(setShowUpdateModal(false)); } else { await dispatch(checkUpdatesChangeLogs()); @@ -43,8 +45,7 @@ const PerconaUpdateVersion = () => { dispatch(setShowUpdateModal(false)); }; - const onDismiss = async () => { - await snoozeUpdate(); + const onDismiss = () => { dispatch(setShowUpdateModal(false)); };