Skip to content

Commit 3d1bcbc

Browse files
committed
RI-7091 - Add an environment variable to skip the EULA screen - replacing a function call with 3 files and a folder
1 parent d07defd commit 3d1bcbc

File tree

3 files changed

+33
-21
lines changed

3 files changed

+33
-21
lines changed

redisinsight/ui/src/components/consents-settings/ConsentOption/ConsentOption.tsx

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React from 'react'
2-
import { EuiLink, EuiSwitch, EuiText } from '@elastic/eui'
2+
import { EuiSwitch, EuiText } from '@elastic/eui'
33
import parse from 'html-react-parser'
44

55
import { FlexItem, Row } from 'uiSrc/components/base/layout/flex'
66
import { Spacer } from 'uiSrc/components/base/layout/spacer'
7+
import { ItemDescription } from './components'
78
import { IConsent } from '../ConsentsSettings'
89

910
import styles from '../styles.module.scss'
@@ -27,24 +28,6 @@ const ConsentOption = (props: Props) => {
2728
linkToPrivacyPolicy = false,
2829
} = props
2930

30-
const getText = () => (
31-
<>
32-
{consent.description && parse(consent.description)}
33-
{linkToPrivacyPolicy && (
34-
<>
35-
<EuiLink
36-
external={false}
37-
target="_blank"
38-
href="https://redis.io/legal/privacy-policy/?utm_source=redisinsight&utm_medium=app&utm_campaign=telemetry"
39-
>
40-
Privacy Policy
41-
</EuiLink>
42-
.
43-
</>
44-
)}
45-
</>
46-
)
47-
4831
return (
4932
<FlexItem key={consent.agreementName} grow>
5033
{isSettingsPage && consent.description && (
@@ -55,7 +38,7 @@ const ConsentOption = (props: Props) => {
5538
color="subdued"
5639
style={{ marginTop: '12px' }}
5740
>
58-
{getText()}
41+
<ItemDescription description={consent.description} withLink={linkToPrivacyPolicy} />
5942
</EuiText>
6043
<Spacer size="m" />
6144
</>
@@ -83,7 +66,7 @@ const ConsentOption = (props: Props) => {
8366
color="subdued"
8467
style={{ marginTop: '12px' }}
8568
>
86-
{getText()}
69+
<ItemDescription description={consent.description} withLink={linkToPrivacyPolicy} />
8770
</EuiText>
8871
)}
8972
</FlexItem>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { EuiLink } from '@elastic/eui'
2+
import parse from 'html-react-parser'
3+
import React from 'react'
4+
5+
interface ItemDescriptionProps {
6+
description: string;
7+
withLink: boolean;
8+
}
9+
10+
export const ItemDescription = ({ description, withLink }: ItemDescriptionProps) => (
11+
<>
12+
{description && parse(description)}
13+
{withLink && (
14+
<>
15+
<EuiLink
16+
external={false}
17+
target="_blank"
18+
href="https://redis.io/legal/privacy-policy/?utm_source=redisinsight&utm_medium=app&utm_campaign=telemetry"
19+
>
20+
Privacy Policy
21+
</EuiLink>
22+
.
23+
</>
24+
)}
25+
</>
26+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { ItemDescription } from './ItemDescription'
2+
3+
export { ItemDescription }

0 commit comments

Comments
 (0)