Skip to content

Commit

Permalink
Check updatesEnabled when rendering updates modal
Browse files Browse the repository at this point in the history
  • Loading branch information
doracretu3pillar committed Dec 19, 2024
1 parent a49f760 commit e49f7ee
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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());
Expand All @@ -43,8 +45,7 @@ const PerconaUpdateVersion = () => {
dispatch(setShowUpdateModal(false));
};

const onDismiss = async () => {
await snoozeUpdate();
const onDismiss = () => {
dispatch(setShowUpdateModal(false));
};

Expand Down

0 comments on commit e49f7ee

Please sign in to comment.