diff --git a/src/components/header/ACLK/cloud-connection-status-modal.tsx b/src/components/header/ACLK/cloud-connection-status-modal.tsx index 172ad8a1..e902b566 100644 --- a/src/components/header/ACLK/cloud-connection-status-modal.tsx +++ b/src/components/header/ACLK/cloud-connection-status-modal.tsx @@ -36,7 +36,7 @@ const CloudConnectionStatusModal = ({ const handleClickedCTA1 = useCallback( ({ link }: { link: string }) => { closeModal() - window.open(link, "_blank") + window.location.href = link }, [closeModal] ) diff --git a/src/components/sidebar/spaces/userSettings.js b/src/components/sidebar/spaces/userSettings.js index ff9b7dca..3d229290 100644 --- a/src/components/sidebar/spaces/userSettings.js +++ b/src/components/sidebar/spaces/userSettings.js @@ -11,7 +11,7 @@ import SignIn from "components/auth/signIn" const SignInItem = () => { const onClick = (e, link) => { e.stopPropagation() - window.open(link, "_blank", "noopener,noreferrer") + window.location.href = link } return ( diff --git a/src/domains/dashboard/components/migration-manager/migration-manager.tsx b/src/domains/dashboard/components/migration-manager/migration-manager.tsx index 9a1a02a9..b259e48f 100644 --- a/src/domains/dashboard/components/migration-manager/migration-manager.tsx +++ b/src/domains/dashboard/components/migration-manager/migration-manager.tsx @@ -75,15 +75,15 @@ const MigrationManager = () => { ...userNodeAccess, }) - const prefrenceID = migrationModalPromoInfo?.tickBoxOption.prefrenceID || "" + const preferenceID = migrationModalPromoInfo?.tickBoxOption.preferenceID || "" /** * There is seem to be a bug when we are using the useLocalStorage, - * the value to be returned does not change when prefrenceID is changing. + * the value to be returned does not change when preferenceID is changing. * For that reason we acces the localStorage directly */ - const [, savePromoRemindMeSelection] = useLocalStorage(prefrenceID) - const hasPromoSelectionSaved = localStorage.getItem(prefrenceID) + const [, savePromoRemindMeSelection] = useLocalStorage(preferenceID) + const hasPromoSelectionSaved = localStorage.getItem(preferenceID) const closeModal = () => { setModalOpen(false) diff --git a/src/domains/dashboard/components/migration-modal/migration-modal.js b/src/domains/dashboard/components/migration-modal/migration-modal.js index 24f4fb1d..96cb3842 100644 --- a/src/domains/dashboard/components/migration-modal/migration-modal.js +++ b/src/domains/dashboard/components/migration-modal/migration-modal.js @@ -40,7 +40,7 @@ const MigrationModal = ({ setUserPrefrence(CTA1.userPreference) savePromoRemindMeSelection(isRememberChoiceChecked) } - if (toPath !== "agent") window.open(link, "_blank") + if (toPath !== "agent") window.location.href = link closeModal() } else if (CTA1.action === "REFRESH") { requestRefreshOfAccess() diff --git a/src/domains/dashboard/components/migration-modal/use-migration-modal.tsx b/src/domains/dashboard/components/migration-modal/use-migration-modal.tsx index b918fc05..ea026043 100644 --- a/src/domains/dashboard/components/migration-modal/use-migration-modal.tsx +++ b/src/domains/dashboard/components/migration-modal/use-migration-modal.tsx @@ -36,7 +36,7 @@ type MigrationModalContent = { bullets?: Array React.ReactNode)> footer?: ((props: any) => React.ReactNode) | string } - tickBoxOption: { text: string; prefrenceID: MigrationModalPromos } + tickBoxOption: { text: string; preferenceID: MigrationModalPromos } CTA1: MigrationModalActions CTA2?: MigrationModalActions } @@ -72,7 +72,7 @@ export const migrationmodalInfo: MigrationModalInfo = { }, tickBoxOption: { text: "Remember my choice", - prefrenceID: MigrationModalPromos.PROMO_SIGN_UP_CLOUD, + preferenceID: MigrationModalPromos.PROMO_SIGN_UP_CLOUD, }, CTA1: { text: "Wow! Let’s go to Netdata Cloud", @@ -112,7 +112,7 @@ export const migrationmodalInfo: MigrationModalInfo = { }, tickBoxOption: { text: "Remember my choice", - prefrenceID: MigrationModalPromos.PROMO_SIGN_IN_CLOUD, + preferenceID: MigrationModalPromos.PROMO_SIGN_IN_CLOUD, }, CTA1: { text: "Sign-in or get a Netdata Cloud account", @@ -140,7 +140,7 @@ export const migrationmodalInfo: MigrationModalInfo = { }, tickBoxOption: { text: "Don't remind me of this again", - prefrenceID: MigrationModalPromos.PROMO_IVNITED_TO_SPACE, + preferenceID: MigrationModalPromos.PROMO_IVNITED_TO_SPACE, }, CTA1: { text: "Thanks, stay at Agent dashboard for now", @@ -198,7 +198,7 @@ export const migrationmodalInfo: MigrationModalInfo = { }, tickBoxOption: { text: "Remember my choice.", - prefrenceID: MigrationModalPromos.PROMO_CLAIM_NODE, + preferenceID: MigrationModalPromos.PROMO_CLAIM_NODE, }, CTA1: { text: "Wow! Let’s go to Netdata Cloud", @@ -226,7 +226,7 @@ export const migrationmodalInfo: MigrationModalInfo = { }, tickBoxOption: { text: "Remember my choice", - prefrenceID: MigrationModalPromos.PROMO_TO_USE_NEW_DASHBAORD, + preferenceID: MigrationModalPromos.PROMO_TO_USE_NEW_DASHBAORD, }, CTA1: { text: "Wow! Let’s go to Netdata Cloud ", @@ -273,7 +273,7 @@ export const migrationmodalInfo: MigrationModalInfo = { }, tickBoxOption: { text: "Don't show this again", - prefrenceID: MigrationModalPromos.FALLBACK_TO_AGENT, + preferenceID: MigrationModalPromos.FALLBACK_TO_AGENT, }, CTA1: { text: "Check again please", @@ -308,7 +308,7 @@ export const migrationmodalInfo: MigrationModalInfo = { }, tickBoxOption: { text: "Don't show this again", - prefrenceID: MigrationModalPromos.NO_INFO_FALLBACK_TO_AGENT, + preferenceID: MigrationModalPromos.NO_INFO_FALLBACK_TO_AGENT, }, CTA1: { text: "Check again please", @@ -417,16 +417,18 @@ export const goToCloud = ({ nodeLiveness === "LIVE" && userNodeAccess === "ACCESS_OK" -const modalStatusWithPromoFunctions: Record boolean> = - { - [MigrationModalPromos.FALLBACK_TO_AGENT]: isFallbackToAgent, - [MigrationModalPromos.NO_INFO_FALLBACK_TO_AGENT]: isNoInfoFallbackToAgent, - [MigrationModalPromos.PROMO_TO_USE_NEW_DASHBAORD]: isPromoToNewDasboardOnCloud, - [MigrationModalPromos.PROMO_CLAIM_NODE]: isPromoToClaimThisNode, - [MigrationModalPromos.PROMO_IVNITED_TO_SPACE]: isPromoInvitedToSpace, - [MigrationModalPromos.PROMO_SIGN_IN_CLOUD]: isPromoSignIn, - [MigrationModalPromos.PROMO_SIGN_UP_CLOUD]: isPromoSignUp, - } +const modalStatusWithPromoFunctions: Record< + MigrationModalPromos, + (props: PromoProps) => boolean +> = { + [MigrationModalPromos.FALLBACK_TO_AGENT]: isFallbackToAgent, + [MigrationModalPromos.NO_INFO_FALLBACK_TO_AGENT]: isNoInfoFallbackToAgent, + [MigrationModalPromos.PROMO_TO_USE_NEW_DASHBAORD]: isPromoToNewDasboardOnCloud, + [MigrationModalPromos.PROMO_CLAIM_NODE]: isPromoToClaimThisNode, + [MigrationModalPromos.PROMO_IVNITED_TO_SPACE]: isPromoInvitedToSpace, + [MigrationModalPromos.PROMO_SIGN_IN_CLOUD]: isPromoSignIn, + [MigrationModalPromos.PROMO_SIGN_UP_CLOUD]: isPromoSignUp, +} const useMigrationModal = ({ userStatus, @@ -434,8 +436,9 @@ const useMigrationModal = ({ userNodeAccess, nodeLiveness, }: PromoProps) => { - const [userSavedPreference, setUserPrefrence] = - useLocalStorage("USER_SAVED_PREFERENCE") + const [userSavedPreference, setUserPrefrence] = useLocalStorage( + "USER_SAVED_PREFERENCE" + ) const migrationModalPromo = useMemo(() => { return Object.keys(modalStatusWithPromoFunctions).find(modalStatus => {