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
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@ import {
cliSettingsSelector,
clearSearchingCommand,
setCliEnteringCommand,
toggleHideCliHelper,
} from 'uiSrc/slices/cli/cli-settings'
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'

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

const BottomGroupMinimized = () => {
const { isShowHelper, isShowCli } = useSelector(cliSettingsSelector)
const { instanceId = '' } = useParams<{ instanceId: string }>()
const {
isShowCli,
cliClientUuid,
isShowHelper,
isMinimizedHelper,
} = useSelector(cliSettingsSelector)
const dispatch = useDispatch()

useEffect(() =>
Expand All @@ -43,6 +49,7 @@ const BottomGroupMinimized = () => {
databaseId: instanceId
}
})
isMinimizedHelper && dispatch(toggleHideCliHelper())
dispatch(toggleCliHelper())
}

Expand All @@ -60,7 +67,7 @@ const BottomGroupMinimized = () => {
onClick={handleExpandCli}
data-testid="expand-cli"
>
<EuiBadge className={cx(styles.componentBadge, { [styles.active]: isShowCli })}>
<EuiBadge className={cx(styles.componentBadge, { [styles.active]: isShowCli || cliClientUuid })}>
<EuiIcon type="console" size="m" />
<span>CLI</span>
</EuiBadge>
Expand All @@ -71,7 +78,11 @@ const BottomGroupMinimized = () => {
onClick={handleExpandHelper}
data-testid="expand-command-helper"
>
<EuiBadge className={cx(styles.componentBadge, { [styles.active]: isShowHelper })}>
<EuiBadge className={cx(
styles.componentBadge,
{ [styles.active]: isShowHelper || isMinimizedHelper }
)}
>
<EuiIcon type="documents" size="m" />
<span>Command Helper</span>
</EuiBadge>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
render,
screen,
} from 'uiSrc/utils/test-utils'
import { resetCliHelperSettings, toggleCliHelper } from 'uiSrc/slices/cli/cli-settings'
import { resetCliHelperSettings, toggleCliHelper, toggleHideCliHelper } from 'uiSrc/slices/cli/cli-settings'
import CommandHelperHeader from './CommandHelperHeader'

let store: typeof mockedStore
Expand All @@ -33,7 +33,7 @@ describe('CommandHelperHeader', () => {
render(<CommandHelperHeader />)
fireEvent.click(screen.getByTestId('hide-command-helper'))

const expectedActions = [toggleCliHelper()]
const expectedActions = [toggleCliHelper(), toggleHideCliHelper()]
expect(store.getActions()).toEqual(expectedActions)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
EuiIcon,
} from '@elastic/eui'
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
import { resetCliHelperSettings, toggleCliHelper } from 'uiSrc/slices/cli/cli-settings'
import { resetCliHelperSettings, toggleCliHelper, toggleHideCliHelper } from 'uiSrc/slices/cli/cli-settings'

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

Expand All @@ -37,6 +37,7 @@ const CommandHelperHeader = () => {
}
})
dispatch(toggleCliHelper())
dispatch(toggleHideCliHelper())
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const AddInstanceControls = ({ onAddInstance, direction, welcomePage = false }:
HELP_LINKS.createRedisCloud.event,
{ source: HELP_LINKS.createRedisCloud.sources[welcomePage ? 'welcome' : 'databaseList'] }
)}
data-testid="promo-btn"
>
<EuiText className={styles.createTitle}>
{HELP_LINKS.createRedisCloud.label}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
width: 413px;
height: 64px;
padding-right: 40px;
background: url(../../../../assets/img/NYbg.jpg) center;
background-size: cover;

&::before {
content: '';
Expand All @@ -50,9 +52,7 @@
right: 0px;
bottom: 0px;
left: 0px;
opacity: .9;
background: url(../../../../assets/img/NYbg.jpg) center;
background-size: cover;
background-color: var(--overlayPromoNYColor);
}

&:hover {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const ModuleNotLoaded = ({ content = {} }: Props) => {
HELP_LINKS.createRedisCloud.event,
{ source: HELP_LINKS.createRedisCloud.sources.redisearch }
)}
data-testid="promo-btn"
>
<EuiText className={styles.createTitle}>
{HELP_LINKS.createRedisCloud.label}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
width: 413px;
height: 64px;
padding-right: 40px;
background: url(../../../../assets/img/NYbg.jpg) center;
background-size: cover;

&::before {
content: '';
Expand All @@ -61,9 +63,7 @@
right: 0px;
bottom: 0px;
left: 0px;
opacity: .9;
background: url(../../../../assets/img/NYbg.jpg) center;
background-size: cover;
background-color: var(--overlayPromoNYColor);
}

&:hover {
Expand Down
2 changes: 1 addition & 1 deletion redisinsight/ui/src/pages/workbench/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export enum ModuleCommandPrefix {
export const RSNotLoadedContent: IModuleNotLoadedContent = {
output: 'RediSearch module is not loaded for this database',
createCloudBtnText: 'Create your free Redis database with RediSearch on Redis Cloud​',
createCloudBtnHref: 'https://redis.com/try-free/?utm_source=redis&utm_medium=app&utm_campaign=redisinsight_offer_jan',
createCloudBtnHref: 'https://redis.com/try-free/?utm_source=redis&utm_medium=app&utm_campaign=redisinsight_redisearch_offer_jan',
summaryText: 'RedisInsight supports RediSearch and allows you to:<br/><br/>'
+ '<ul><li>Build and execute queries</li><li>Browse, analyse and export results</li></ul></br>'
+ 'As a benefit you get faster turnarounds when building your application using Redis and RediSearch.',
Expand Down
15 changes: 10 additions & 5 deletions redisinsight/ui/src/slices/cli/cli-settings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createSlice } from '@reduxjs/toolkit'
import { apiService, localStorageService, sessionStorageService } from 'uiSrc/services'
import { apiService, sessionStorageService } from 'uiSrc/services'
import { ApiEndpoints, BrowserStorageItem } from 'uiSrc/constants'
import { getApiErrorMessage, getUrl, isStatusSuccessful } from 'uiSrc/utils'
import { CreateCliClientResponse, DeleteClientResponse } from 'apiSrc/modules/cli/dto/cli.dto'
Expand All @@ -8,6 +8,7 @@ import { AppDispatch, RootState } from '../store'
import { StateCliSettings } from '../interfaces/cli'

export const initialState: StateCliSettings = {
isMinimizedHelper: false,
isShowHelper: false,
isShowCli: false,
loading: false,
Expand Down Expand Up @@ -35,10 +36,12 @@ const cliSettingsSlice = createSlice({
},
// collapse / uncollapse CLI Helper
toggleCliHelper: (state) => {
const isShowHelper = !state.isShowHelper
state.isShowHelper = isShowHelper

localStorageService?.set(BrowserStorageItem.cliIsShowHelper, isShowHelper)
state.isShowHelper = !state.isShowHelper
state.isMinimizedHelper = !state.isMinimizedHelper
},
// hide / unhide CLI Helper
toggleHideCliHelper: (state) => {
state.isMinimizedHelper = !state.isMinimizedHelper
},

setMatchedCommand: (state, { payload }: { payload: string }) => {
Expand Down Expand Up @@ -121,6 +124,7 @@ const cliSettingsSlice = createSlice({
state.isShowHelper = false
state.isSearching = false
state.isEnteringCommand = false
state.isMinimizedHelper = false
state.matchedCommand = ''
state.searchingCommand = ''
state.searchedCommand = ''
Expand All @@ -134,6 +138,7 @@ export const {
setCliSettingsInitialState,
toggleCli,
toggleCliHelper,
toggleHideCliHelper,
setMatchedCommand,
setSearchedCommand,
setSearchingCommand,
Expand Down
1 change: 1 addition & 0 deletions redisinsight/ui/src/slices/interfaces/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export enum ClusterNodeRole {
}

export interface StateCliSettings {
isMinimizedHelper: boolean;
isShowCli: boolean;
isShowHelper: boolean;
cliClientUuid: string;
Expand Down
9 changes: 7 additions & 2 deletions redisinsight/ui/src/slices/tests/cli/cli-settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ describe('cliSettings slice', () => {
const state: typeof initialState = {
...initialState,
isShowHelper: false,
isMinimizedHelper: false,
}

expect(cliSettingsSelector(initialStateDefault)).toEqual(state)
Expand All @@ -58,6 +59,7 @@ describe('cliSettings slice', () => {
const state: typeof initialState = {
...initialState,
isShowHelper: true,
isMinimizedHelper: true,
}

// Act
Expand All @@ -79,6 +81,7 @@ describe('cliSettings slice', () => {
const state: typeof initialState = {
...initialState,
isShowCli: true,
isMinimizedHelper: false,
}

// Act
Expand All @@ -95,7 +98,7 @@ describe('cliSettings slice', () => {
})

describe('setMatchedCommand', () => {
it('should properly set !isShowCli', () => {
it('should properly set matchedCommand', () => {
// Arrange
const matchedCommand = 'get'
const state: typeof initialState = {
Expand All @@ -117,7 +120,7 @@ describe('cliSettings slice', () => {
})

describe('setCliEnteringCommand', () => {
it('should properly set !isShowCli', () => {
it('should properly set isEnteringCommand = true', () => {
// Arrange
const state: typeof initialState = {
...initialState,
Expand Down Expand Up @@ -281,6 +284,7 @@ describe('cliSettings slice', () => {
isShowHelper: true,
isSearching: true,
isEnteringCommand: true,
isMinimizedHelper: true,
matchedCommand: '123',
searchingCommand: '123',
searchedCommand: '123',
Expand All @@ -292,6 +296,7 @@ describe('cliSettings slice', () => {
isShowHelper: false,
isSearching: false,
isEnteringCommand: false,
isMinimizedHelper: false,
matchedCommand: '',
searchingCommand: '',
searchedCommand: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
--moduleBackgroundColor: #{$commandGroupBadgeColor};
--callOutBackgroundColor: #{$euiTooltipBackgroundColor};

--overlayPromoNYColor: #{$overlayPromoNYColor};

// KeyTypes
--typeHashColor: #{$typeHashColor};
--typeListColor: #{$typeListColor};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ $cliOutputResponseFailColor: #e06c75;
$badgeBackgroundColor: #707070;
$commandGroupBadgeColor: #3F4B5F;

$overlayPromoNYColor: #0000001a;

// Types colors
$typeHashColor: #364CFF;
$typeListColor: #008556;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@
--moduleBackgroundColor: #{$typeHashColor};
--callOutBackgroundColor: #{$callOutBackgroundColor};

--overlayPromoNYColor: #{$overlayPromoNYColor};

// KeyTypes
--typeHashColor: #{$typeHashColor};
--typeListColor: #{$typeListColor};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ $badgeBackgroundColor: #E8EFFF;
$commandGroupBadgeColor: #B8C5DB;
$callOutBackgroundColor: #E9EDFA;

$overlayPromoNYColor: #ffffff1a;

// Types colors
$typeHashColor: #CDDDF8;
$typeListColor: #A5D4C3;
Expand Down