Skip to content

Commit 646de14

Browse files
committed
wrap components in feature flag
1 parent 632ac08 commit 646de14

File tree

2 files changed

+71
-64
lines changed

2 files changed

+71
-64
lines changed

redisinsight/ui/src/components/messages/module-not-loaded-minimalized/ModuleNotLoadedMinimalized.tsx

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import TelescopeImg from 'uiSrc/assets/img/telescope-dark.svg'
66
import { OAuthSocialAction, OAuthSocialSource, RedisDefaultModules } from 'uiSrc/slices/interfaces'
77
import { freeInstancesSelector } from 'uiSrc/slices/instances/instances'
88

9-
import { ExternalLink, OAuthConnectFreeDb, OAuthSsoHandlerDialog } from 'uiSrc/components'
9+
import { ExternalLink, FeatureFlagComponent, OAuthConnectFreeDb, OAuthSsoHandlerDialog } from 'uiSrc/components'
1010
import { getUtmExternalLink } from 'uiSrc/utils/links'
1111
import { EXTERNAL_LINKS, UTM_CAMPAINGS } from 'uiSrc/constants/links'
1212
import { getDbWithModuleLoaded, getSourceTutorialByCapability } from 'uiSrc/utils'
1313
import { useCapability } from 'uiSrc/services'
14+
import { FeatureFlags } from 'uiSrc/constants'
1415
import { MODULE_CAPABILITY_TEXT_NOT_AVAILABLE } from './constants'
1516
import styles from './styles.module.scss'
1617

@@ -42,30 +43,34 @@ const ModuleNotLoadedMinimalized = (props: Props) => {
4243
<EuiText color="subdued" size="s">
4344
{moduleText?.text}
4445
</EuiText>
45-
<EuiSpacer size="s" />
46-
<OAuthSsoHandlerDialog>
47-
{(ssoCloudHandlerClick) => (
46+
<FeatureFlagComponent name={FeatureFlags.envDependent}>
47+
<>
48+
<EuiSpacer size="s" />
49+
<OAuthSsoHandlerDialog>
50+
{(ssoCloudHandlerClick) => (
51+
<ExternalLink
52+
iconSize="s"
53+
href={getUtmExternalLink(EXTERNAL_LINKS.tryFree, { campaign: UTM_CAMPAINGS[source] ?? source })}
54+
onClick={(e: React.MouseEvent) => {
55+
ssoCloudHandlerClick(e, { source, action: OAuthSocialAction.Create }, `${moduleName}_${source}`)
56+
onClose?.()
57+
}}
58+
data-testid="tutorials-get-started-link"
59+
>
60+
Start with Cloud for free
61+
</ExternalLink>
62+
)}
63+
</OAuthSsoHandlerDialog>
64+
<EuiSpacer size="xs" />
4865
<ExternalLink
4966
iconSize="s"
50-
href={getUtmExternalLink(EXTERNAL_LINKS.tryFree, { campaign: UTM_CAMPAINGS[source] ?? source })}
51-
onClick={(e: React.MouseEvent) => {
52-
ssoCloudHandlerClick(e, { source, action: OAuthSocialAction.Create }, `${moduleName}_${source}`)
53-
onClose?.()
54-
}}
55-
data-testid="tutorials-get-started-link"
67+
href={getUtmExternalLink(EXTERNAL_LINKS.docker, { campaign: UTM_CAMPAINGS[source] ?? source })}
68+
data-testid="tutorials-docker-link"
5669
>
57-
Start with Cloud for free
70+
Start with Docker
5871
</ExternalLink>
59-
)}
60-
</OAuthSsoHandlerDialog>
61-
<EuiSpacer size="xs" />
62-
<ExternalLink
63-
iconSize="s"
64-
href={getUtmExternalLink(EXTERNAL_LINKS.docker, { campaign: UTM_CAMPAINGS[source] ?? source })}
65-
data-testid="tutorials-docker-link"
66-
>
67-
Start with Docker
68-
</ExternalLink>
72+
</>
73+
</FeatureFlagComponent>
6974
</>
7075
)}
7176
{!!freeDbWithModule && (

redisinsight/ui/src/components/messages/module-not-loaded/ModuleNotLoaded.tsx

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import React, { useCallback, useEffect, useState } from 'react'
22
import cx from 'classnames'
3-
import { EuiButton, EuiIcon, EuiLink, EuiText, EuiTextColor, EuiTitle, } from '@elastic/eui'
3+
import { EuiButton, EuiIcon, EuiLink, EuiText, EuiTextColor, EuiTitle } from '@elastic/eui'
44
import { useSelector } from 'react-redux'
55

66
import MobileIcon from 'uiSrc/assets/img/icons/mobile_module_not_loaded.svg?react'
77
import DesktopIcon from 'uiSrc/assets/img/icons/module_not_loaded.svg?react'
88
import TelescopeImg from 'uiSrc/assets/img/telescope-dark.svg?react'
99
import CheerIcon from 'uiSrc/assets/img/icons/cheer.svg?react'
10-
import { MODULE_NOT_LOADED_CONTENT as CONTENT, MODULE_TEXT_VIEW } from 'uiSrc/constants'
10+
import { FeatureFlags, MODULE_NOT_LOADED_CONTENT as CONTENT, MODULE_TEXT_VIEW } from 'uiSrc/constants'
1111
import { OAuthSocialAction, OAuthSocialSource, RedisDefaultModules } from 'uiSrc/slices/interfaces'
12-
import { OAuthConnectFreeDb, OAuthSsoHandlerDialog } from 'uiSrc/components'
12+
import { FeatureFlagComponent, OAuthConnectFreeDb, OAuthSsoHandlerDialog } from 'uiSrc/components'
1313
import { freeInstancesSelector } from 'uiSrc/slices/instances/instances'
1414
import { getUtmExternalLink } from 'uiSrc/utils/links'
1515

@@ -133,47 +133,49 @@ const ModuleNotLoaded = ({ moduleName, id, type = 'workbench', onClose }: IProps
133133
/>
134134
)}
135135
{!freeDbWithModule && (
136-
<>
137-
<EuiLink
138-
className={cx(styles.text, styles.link)}
139-
external={false}
140-
target="_blank"
141-
href={getUtmExternalLink(CONTENT[moduleName]?.link, { campaign: utmCampaign })}
142-
data-testid="learn-more-link"
143-
>
144-
Learn More
145-
</EuiLink>
146-
<OAuthSsoHandlerDialog>
147-
{(ssoCloudHandlerClick) => (
148-
<EuiLink
149-
className={styles.link}
150-
external={false}
151-
target="_blank"
152-
href={getUtmExternalLink(EXTERNAL_LINKS.tryFree, { campaign: utmCampaign })}
153-
onClick={(e) => {
154-
ssoCloudHandlerClick(
155-
e,
156-
{
157-
source: type === 'browser' ? OAuthSocialSource.BrowserSearch : OAuthSocialSource[module],
158-
action: OAuthSocialAction.Create
159-
}
160-
)
161-
onFreeDatabaseClick()
162-
}}
163-
data-testid="get-started-link"
164-
>
165-
<EuiButton
166-
fill
167-
size="s"
168-
color="secondary"
169-
className={styles.btnLink}
136+
<FeatureFlagComponent name={FeatureFlags.envDependent}>
137+
<>
138+
<EuiLink
139+
className={cx(styles.text, styles.link)}
140+
external={false}
141+
target="_blank"
142+
href={getUtmExternalLink(CONTENT[moduleName]?.link, { campaign: utmCampaign })}
143+
data-testid="learn-more-link"
144+
>
145+
Learn More
146+
</EuiLink>
147+
<OAuthSsoHandlerDialog>
148+
{(ssoCloudHandlerClick) => (
149+
<EuiLink
150+
className={styles.link}
151+
external={false}
152+
target="_blank"
153+
href={getUtmExternalLink(EXTERNAL_LINKS.tryFree, { campaign: utmCampaign })}
154+
onClick={(e) => {
155+
ssoCloudHandlerClick(
156+
e,
157+
{
158+
source: type === 'browser' ? OAuthSocialSource.BrowserSearch : OAuthSocialSource[module],
159+
action: OAuthSocialAction.Create
160+
}
161+
)
162+
onFreeDatabaseClick()
163+
}}
164+
data-testid="get-started-link"
170165
>
171-
Get Started For Free
172-
</EuiButton>
173-
</EuiLink>
174-
)}
175-
</OAuthSsoHandlerDialog>
176-
</>
166+
<EuiButton
167+
fill
168+
size="s"
169+
color="secondary"
170+
className={styles.btnLink}
171+
>
172+
Get Started For Free
173+
</EuiButton>
174+
</EuiLink>
175+
)}
176+
</OAuthSsoHandlerDialog>
177+
</>
178+
</FeatureFlagComponent>
177179
)}
178180
</div>
179181
</div>

0 commit comments

Comments
 (0)