Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions redisinsight/ui/src/assets/img/redis-software.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions redisinsight/ui/src/assets/img/shield.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
import { Pages } from 'uiSrc/constants'
import ConnectivityOptions from './components/connectivity-options'
import ConnectionUrl from './components/connection-url'
import { Values } from './constants'

import styles from './styles.module.scss'

Expand Down Expand Up @@ -63,9 +64,9 @@ const AddDatabaseScreen = (props: Props) => {
const dispatch = useDispatch()
const history = useHistory()

const validate = (values: any) => {
const validate = (values: Values) => {
const payload = getPayload(values.connectionURL, true)
setIsInvalid(!payload && values.connectionURL)
setIsInvalid(!payload && !!values.connectionURL)
}

const handleTestConnection = () => {
Expand All @@ -87,7 +88,7 @@ const AddDatabaseScreen = (props: Props) => {
}))
}

const formik = useFormik({
const formik = useFormik<Values>({
initialValues: {
connectionURL: 'redis://default@127.0.0.1:6379'
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { EuiButton, EuiFlexGrid, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui'
import { EuiBadge, EuiButton, EuiFlexGrid, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui'
import cx from 'classnames'
import { AddDbType } from 'uiSrc/pages/home/constants'
import { OAuthSsoHandlerDialog } from 'uiSrc/components'
Expand All @@ -8,7 +8,7 @@ import { EXTERNAL_LINKS, UTM_CAMPAINGS } from 'uiSrc/constants/links'
import { OAuthSocialAction, OAuthSocialSource } from 'uiSrc/slices/interfaces'

import CloudIcon from 'uiSrc/assets/img/oauth/cloud_centered.svg?react'
import StarIcon from 'uiSrc/assets/img/icons/star.svg?react'
import RocketIcon from 'uiSrc/assets/img/oauth/rocket.svg?react'

import { CONNECTIVITY_OPTIONS } from '../../constants'

Expand All @@ -24,30 +24,31 @@ const ConnectivityOptions = (props: Props) => {

return (
<>
<section>
<section className={styles.cloudSection}>
<EuiTitle size="xs" className={styles.sectionTitle}>
<span>
<CloudIcon className={styles.cloudIcon} />Get started with Redis Cloud account
Get started with Redis Cloud account
</span>
</EuiTitle>
<EuiSpacer />
<EuiFlexGrid columns={3}>
<EuiFlexItem grow={1}>
<EuiFlexGrid>
<EuiFlexItem grow={false}>
<EuiButton
color="secondary"
className={styles.typeBtn}
onClick={() => onClickOption(AddDbType.cloud)}
data-testid="discover-cloud-btn"
>
Add Cloud databases
<CloudIcon className={styles.btnIcon} />
Add databases
</EuiButton>
</EuiFlexItem>
<EuiFlexItem grow={1}>
<EuiFlexItem grow={false}>
<OAuthSsoHandlerDialog>
{(ssoCloudHandlerClick, isSSOEnabled) => (
<EuiButton
color="secondary"
className={cx(styles.typeBtn, styles.primary)}
className={styles.typeBtn}
href={getUtmExternalLink(EXTERNAL_LINKS.tryFree, {
campaign: UTM_CAMPAINGS[OAuthSocialSource.AddDbForm]
})}
Expand All @@ -61,8 +62,9 @@ const ConnectivityOptions = (props: Props) => {
}}
data-testid="create-free-db-btn"
>
<StarIcon className={styles.star} />
Create free database
<EuiBadge color="subdued" className={styles.freeBadge}>Free</EuiBadge>
<RocketIcon className={cx(styles.btnIcon, styles.rocket)} />
New database
</EuiButton>
)}
</OAuthSsoHandlerDialog>
Expand All @@ -76,15 +78,16 @@ const ConnectivityOptions = (props: Props) => {
<span>More connectivity options</span>
</EuiTitle>
<EuiSpacer />
<EuiFlexGrid columns={3}>
{CONNECTIVITY_OPTIONS.map(({ id, type, title }) => (
<EuiFlexItem grow={1} key={id}>
<EuiFlexGrid>
{CONNECTIVITY_OPTIONS.map(({ id, type, title, icon }) => (
<EuiFlexItem grow={false} key={id}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't tested, but isn't grow={false} = grow={0}?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, there are type FlexItemGrowSize = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | true | false | null;

<EuiButton
color="secondary"
className={styles.typeBtn}
className={cx(styles.typeBtn, styles.small)}
onClick={() => onClickOption(type)}
data-testid={`option-btn-${id}`}
>
{icon?.({ className: styles.btnIcon })}
{title}
</EuiButton>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,72 @@
font-weight: 400 !important;
display: flex;
align-items: center;
}

.cloudIcon {
margin-right: 8px;
.cloudSection {
.typeBtn {
min-width: 160px !important;
}
}

.typeBtn {
position: relative;
width: 100%;
height: 76px !important;
height: 84px !important;
padding: 0 12px;

border-color: var(--separatorColorLight) !important;
color: var(--buttonSecondaryTextColor) !important;
box-shadow: none !important;

&.primary {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we still have a component that uses .primary. Either we should remove this style from the component, or keep it here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, removed

border-color: var(--euiColorSecondary) !important;
&.small {
padding: 0 8px;
height: 52px !important;

:global(.euiButton__text) {
flex-direction: row;
}

.btnIcon {
margin-right: 8px;
}
}

&:hover {
background-color: transparent !important;
}
}

.star {
margin-right: 4px;
:global(.euiButton__text) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: why do we need :global?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since there is a global class, not scoped

display: flex;
flex-direction: column;
align-items: center;
font-weight: 400 !important;
}

&:not(.small) {
.btnIcon {
margin-bottom: 8px;

&.rocket {
fill: currentColor;
height: 24px;
width: 24px;
}
}
}



.freeBadge {
position: absolute;
top: 0;
left: 50%;
transform: translate(-50%, -50%);
z-index: 1;

text-transform: uppercase;
background-color: var(--euiColorLightestShade);
border: 1px solid var(--euiColorPrimary);
border-radius: 2px !important;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react'
import { EuiIcon } from '@elastic/eui'
import { AddDbType } from 'uiSrc/pages/home/constants'

import ShieldIcon from 'uiSrc/assets/img/shield.svg?react'
import RedisSoftwareIcon from 'uiSrc/assets/img/redis-software.svg?react'

export interface Values {
connectionURL: string
}

export const CONNECTIVITY_OPTIONS = [
{
id: 'sentinel',
title: 'Redis Sentinel',
type: AddDbType.sentinel,
icon: (props: Record<string, any> = {}) => <ShieldIcon {...props} />
},
{
id: 'software',
title: 'Redis Software',
type: AddDbType.software,
icon: (props: Record<string, any> = {}) => <RedisSoftwareIcon {...props} />
},
{
id: 'import',
title: 'Import from file',
type: AddDbType.import,
icon: (props: Record<string, any> = {}) => <EuiIcon type="importAction" {...props} />
}
]
Loading