Skip to content
This repository was archived by the owner on Apr 19, 2024. It is now read-only.

Commit e6a4db7

Browse files
authored
Updated redirection to cloud in the same window. (#399)
1 parent 025d426 commit e6a4db7

File tree

5 files changed

+30
-27
lines changed

5 files changed

+30
-27
lines changed

src/components/header/ACLK/cloud-connection-status-modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const CloudConnectionStatusModal = ({
3636
const handleClickedCTA1 = useCallback(
3737
({ link }: { link: string }) => {
3838
closeModal()
39-
window.open(link, "_blank")
39+
window.location.href = link
4040
},
4141
[closeModal]
4242
)

src/components/sidebar/spaces/userSettings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import SignIn from "components/auth/signIn"
1111
const SignInItem = () => {
1212
const onClick = (e, link) => {
1313
e.stopPropagation()
14-
window.open(link, "_blank", "noopener,noreferrer")
14+
window.location.href = link
1515
}
1616
return (
1717
<SignIn utmParameters={{ content: "userSettings" }}>

src/domains/dashboard/components/migration-manager/migration-manager.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ const MigrationManager = () => {
7575
...userNodeAccess,
7676
})
7777

78-
const prefrenceID = migrationModalPromoInfo?.tickBoxOption.prefrenceID || ""
78+
const preferenceID = migrationModalPromoInfo?.tickBoxOption.preferenceID || ""
7979

8080
/**
8181
* There is seem to be a bug when we are using the useLocalStorage,
82-
* the value to be returned does not change when prefrenceID is changing.
82+
* the value to be returned does not change when preferenceID is changing.
8383
* For that reason we acces the localStorage directly
8484
*/
85-
const [, savePromoRemindMeSelection] = useLocalStorage(prefrenceID)
86-
const hasPromoSelectionSaved = localStorage.getItem(prefrenceID)
85+
const [, savePromoRemindMeSelection] = useLocalStorage(preferenceID)
86+
const hasPromoSelectionSaved = localStorage.getItem(preferenceID)
8787

8888
const closeModal = () => {
8989
setModalOpen(false)

src/domains/dashboard/components/migration-modal/migration-modal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const MigrationModal = ({
4040
setUserPrefrence(CTA1.userPreference)
4141
savePromoRemindMeSelection(isRememberChoiceChecked)
4242
}
43-
if (toPath !== "agent") window.open(link, "_blank")
43+
if (toPath !== "agent") window.location.href = link
4444
closeModal()
4545
} else if (CTA1.action === "REFRESH") {
4646
requestRefreshOfAccess()

src/domains/dashboard/components/migration-modal/use-migration-modal.tsx

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type MigrationModalContent = {
3636
bullets?: Array<string | ((props?: any) => React.ReactNode)>
3737
footer?: ((props: any) => React.ReactNode) | string
3838
}
39-
tickBoxOption: { text: string; prefrenceID: MigrationModalPromos }
39+
tickBoxOption: { text: string; preferenceID: MigrationModalPromos }
4040
CTA1: MigrationModalActions
4141
CTA2?: MigrationModalActions
4242
}
@@ -72,7 +72,7 @@ export const migrationmodalInfo: MigrationModalInfo = {
7272
},
7373
tickBoxOption: {
7474
text: "Remember my choice",
75-
prefrenceID: MigrationModalPromos.PROMO_SIGN_UP_CLOUD,
75+
preferenceID: MigrationModalPromos.PROMO_SIGN_UP_CLOUD,
7676
},
7777
CTA1: {
7878
text: "Wow! Let’s go to Netdata Cloud",
@@ -112,7 +112,7 @@ export const migrationmodalInfo: MigrationModalInfo = {
112112
},
113113
tickBoxOption: {
114114
text: "Remember my choice",
115-
prefrenceID: MigrationModalPromos.PROMO_SIGN_IN_CLOUD,
115+
preferenceID: MigrationModalPromos.PROMO_SIGN_IN_CLOUD,
116116
},
117117
CTA1: {
118118
text: "Sign-in or get a Netdata Cloud account",
@@ -140,7 +140,7 @@ export const migrationmodalInfo: MigrationModalInfo = {
140140
},
141141
tickBoxOption: {
142142
text: "Don't remind me of this again",
143-
prefrenceID: MigrationModalPromos.PROMO_IVNITED_TO_SPACE,
143+
preferenceID: MigrationModalPromos.PROMO_IVNITED_TO_SPACE,
144144
},
145145
CTA1: {
146146
text: "Thanks, stay at Agent dashboard for now",
@@ -198,7 +198,7 @@ export const migrationmodalInfo: MigrationModalInfo = {
198198
},
199199
tickBoxOption: {
200200
text: "Remember my choice.",
201-
prefrenceID: MigrationModalPromos.PROMO_CLAIM_NODE,
201+
preferenceID: MigrationModalPromos.PROMO_CLAIM_NODE,
202202
},
203203
CTA1: {
204204
text: "Wow! Let’s go to Netdata Cloud",
@@ -226,7 +226,7 @@ export const migrationmodalInfo: MigrationModalInfo = {
226226
},
227227
tickBoxOption: {
228228
text: "Remember my choice",
229-
prefrenceID: MigrationModalPromos.PROMO_TO_USE_NEW_DASHBAORD,
229+
preferenceID: MigrationModalPromos.PROMO_TO_USE_NEW_DASHBAORD,
230230
},
231231
CTA1: {
232232
text: "Wow! Let’s go to Netdata Cloud ",
@@ -273,7 +273,7 @@ export const migrationmodalInfo: MigrationModalInfo = {
273273
},
274274
tickBoxOption: {
275275
text: "Don't show this again",
276-
prefrenceID: MigrationModalPromos.FALLBACK_TO_AGENT,
276+
preferenceID: MigrationModalPromos.FALLBACK_TO_AGENT,
277277
},
278278
CTA1: {
279279
text: "Check again please",
@@ -308,7 +308,7 @@ export const migrationmodalInfo: MigrationModalInfo = {
308308
},
309309
tickBoxOption: {
310310
text: "Don't show this again",
311-
prefrenceID: MigrationModalPromos.NO_INFO_FALLBACK_TO_AGENT,
311+
preferenceID: MigrationModalPromos.NO_INFO_FALLBACK_TO_AGENT,
312312
},
313313
CTA1: {
314314
text: "Check again please",
@@ -417,25 +417,28 @@ export const goToCloud = ({
417417
nodeLiveness === "LIVE" &&
418418
userNodeAccess === "ACCESS_OK"
419419

420-
const modalStatusWithPromoFunctions: Record<MigrationModalPromos, (props: PromoProps) => boolean> =
421-
{
422-
[MigrationModalPromos.FALLBACK_TO_AGENT]: isFallbackToAgent,
423-
[MigrationModalPromos.NO_INFO_FALLBACK_TO_AGENT]: isNoInfoFallbackToAgent,
424-
[MigrationModalPromos.PROMO_TO_USE_NEW_DASHBAORD]: isPromoToNewDasboardOnCloud,
425-
[MigrationModalPromos.PROMO_CLAIM_NODE]: isPromoToClaimThisNode,
426-
[MigrationModalPromos.PROMO_IVNITED_TO_SPACE]: isPromoInvitedToSpace,
427-
[MigrationModalPromos.PROMO_SIGN_IN_CLOUD]: isPromoSignIn,
428-
[MigrationModalPromos.PROMO_SIGN_UP_CLOUD]: isPromoSignUp,
429-
}
420+
const modalStatusWithPromoFunctions: Record<
421+
MigrationModalPromos,
422+
(props: PromoProps) => boolean
423+
> = {
424+
[MigrationModalPromos.FALLBACK_TO_AGENT]: isFallbackToAgent,
425+
[MigrationModalPromos.NO_INFO_FALLBACK_TO_AGENT]: isNoInfoFallbackToAgent,
426+
[MigrationModalPromos.PROMO_TO_USE_NEW_DASHBAORD]: isPromoToNewDasboardOnCloud,
427+
[MigrationModalPromos.PROMO_CLAIM_NODE]: isPromoToClaimThisNode,
428+
[MigrationModalPromos.PROMO_IVNITED_TO_SPACE]: isPromoInvitedToSpace,
429+
[MigrationModalPromos.PROMO_SIGN_IN_CLOUD]: isPromoSignIn,
430+
[MigrationModalPromos.PROMO_SIGN_UP_CLOUD]: isPromoSignUp,
431+
}
430432

431433
const useMigrationModal = ({
432434
userStatus,
433435
nodeClaimedStatus,
434436
userNodeAccess,
435437
nodeLiveness,
436438
}: PromoProps) => {
437-
const [userSavedPreference, setUserPrefrence] =
438-
useLocalStorage<UserPreference>("USER_SAVED_PREFERENCE")
439+
const [userSavedPreference, setUserPrefrence] = useLocalStorage<UserPreference>(
440+
"USER_SAVED_PREFERENCE"
441+
)
439442

440443
const migrationModalPromo = useMemo<MigrationModalPromos>(() => {
441444
return Object.keys(modalStatusWithPromoFunctions).find(modalStatus => {

0 commit comments

Comments
 (0)