Skip to content

Commit 5c2f320

Browse files
authored
Merge pull request #2168 from RedisInsight/fe/bugfix/RI-4106_rework-search
fix #RI-4597, #RI-4598, #RI-4610
2 parents 92edb6f + 34190a8 commit 5c2f320

File tree

9 files changed

+58
-23
lines changed

9 files changed

+58
-23
lines changed

redisinsight/ui/src/pages/browser/components/browser-right-panel/BrowserRightPanel.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ const BrowserRightPanel = (props: Props) => {
137137
)}
138138
{isCreateIndexPanelOpen && every([!isAddKeyPanelOpen, !isBulkActionsPanelOpen], Boolean) && (
139139
<CreateRedisearchIndex
140+
arePanelsCollapsed={arePanelsCollapsed}
140141
onCreateIndex={closePanel}
141142
onClosePanel={onCloseRedisearchPanel}
142143
/>

redisinsight/ui/src/pages/browser/components/create-redisearch-index/CreateRedisearchIndex.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ const CreateRedisearchIndex = ({ onClosePanel, onCreateIndex }: Props) => {
302302
borderRadius="none"
303303
className={styles.footer}
304304
>
305-
<EuiFlexGroup justifyContent="flexEnd">
305+
<EuiFlexGroup justifyContent="flexEnd" responsive={false}>
306306
<EuiFlexItem grow={false}>
307307
<EuiButton
308308
color="secondary"

redisinsight/ui/src/pages/browser/components/create-redisearch-index/CreateRedisearchIndexWrapper.tsx

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react'
22
import {
3+
EuiButton,
34
EuiButtonIcon,
45
EuiFlexGroup,
56
EuiFlexItem,
@@ -14,37 +15,53 @@ import CreateRedisearchIndex from './CreateRedisearchIndex'
1415
import styles from './styles.module.scss'
1516

1617
export interface Props {
18+
arePanelsCollapsed?: boolean
1719
onClosePanel?: () => void
1820
onCreateIndex?: () => void
1921
}
2022

21-
const CreateRedisearchIndexWrapper = ({ onClosePanel, onCreateIndex }: Props) => (
23+
const CreateRedisearchIndexWrapper = ({ arePanelsCollapsed, onClosePanel, onCreateIndex }: Props) => (
2224
<div className={styles.page} data-testid="create-index-panel">
2325
<EuiFlexGroup
2426
justifyContent="center"
2527
direction="column"
2628
className={cx(styles.container, 'relative')}
2729
gutterSize="none"
30+
responsive={false}
2831
>
2932
<div className={styles.headerWrapper}>
3033
<EuiFlexItem grow style={{ marginBottom: '16px' }}>
3134
<EuiTitle size="xs" className={styles.header}>
3235
<h4>New Index</h4>
3336
</EuiTitle>
34-
<EuiToolTip
35-
content="Close"
36-
position="left"
37-
anchorClassName={styles.closeBtnTooltip}
38-
>
39-
<EuiButtonIcon
40-
iconType="cross"
41-
color="primary"
42-
aria-label="Close panel"
43-
className={styles.closeBtn}
44-
data-testid="create-index-close-panel"
37+
{arePanelsCollapsed ? (
38+
<EuiButton
39+
fill
40+
color="secondary"
4541
onClick={onClosePanel}
46-
/>
47-
</EuiToolTip>
42+
size="s"
43+
iconType="arrowLeft"
44+
className={styles.backBtn}
45+
data-testid="create-index-back-btn"
46+
>
47+
Back
48+
</EuiButton>
49+
) : (
50+
<EuiToolTip
51+
content="Close"
52+
position="left"
53+
anchorClassName={styles.closeBtnTooltip}
54+
>
55+
<EuiButtonIcon
56+
iconType="cross"
57+
color="primary"
58+
aria-label="Close panel"
59+
className={styles.closeBtn}
60+
data-testid="create-index-close-panel"
61+
onClick={onClosePanel}
62+
/>
63+
</EuiToolTip>
64+
)}
4865
</EuiFlexItem>
4966
<EuiFlexItem className={styles.header}>
5067
<EuiText size="s">Use CLI or Workbench to create more advanced indexes. See more details in the

redisinsight/ui/src/pages/browser/components/create-redisearch-index/styles.module.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@
3131
}
3232
}
3333

34+
.backBtn:global(.euiButton.euiButton--fill.euiButton--secondary) {
35+
background-color: var(--browserComponentActive) !important;
36+
border-color: var(--browserComponentActive) !important;
37+
color: var(--buttonSecondaryTextColor) !important;
38+
39+
position: absolute;
40+
top: 22px;
41+
right: 18px;
42+
43+
&:hover, &:focus {
44+
color: var(--buttonSecondaryTextColor) !important;
45+
}
46+
}
47+
3448
.controlsDivider {
3549
margin: 32px 0;
3650
}

redisinsight/ui/src/pages/browser/components/filter-key-type/styles.module.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.container {
22
width: 168px;
33
height: 36px;
4+
flex-shrink: 0;
5+
46
:global {
57
.euiFormControlLayout {
68
.euiSuperSelectControl {

redisinsight/ui/src/pages/browser/components/redisearch-key-list/RediSearchIndexesList.spec.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
render,
1212
screen,
1313
} from 'uiSrc/utils/test-utils'
14-
import { loadKeys, loadList, redisearchListSelector, setSelectedIndex } from 'uiSrc/slices/browser/redisearch'
14+
import { loadList, redisearchListSelector, setSelectedIndex } from 'uiSrc/slices/browser/redisearch'
1515
import { bufferToString, stringToBuffer } from 'uiSrc/utils'
1616
import { localStorageService } from 'uiSrc/services'
1717
import { SearchMode } from 'uiSrc/slices/interfaces/keys'
@@ -111,7 +111,7 @@ describe('RediSearchIndexesList', () => {
111111
localStorageService.set = jest.fn();
112112

113113
(connectedInstanceSelector as jest.Mock).mockImplementation(() => ({
114-
loading: false,
114+
host: '123.123.2.2',
115115
modules: [],
116116
}))
117117

@@ -138,7 +138,7 @@ describe('RediSearchIndexesList', () => {
138138
);
139139

140140
(connectedInstanceSelector as jest.Mock).mockImplementation(() => ({
141-
loading: false,
141+
host: '123.23.1.1',
142142
modules: [{ name: RedisDefaultModules.Search, }]
143143
}))
144144

@@ -182,7 +182,7 @@ describe('RediSearchIndexesList', () => {
182182
);
183183

184184
(connectedInstanceSelector as jest.Mock).mockImplementation(() => ({
185-
loading: false,
185+
host: '123.123.1.1',
186186
modules: [{ name: RedisDefaultModules.Search, }]
187187
}))
188188

redisinsight/ui/src/pages/browser/components/redisearch-key-list/RediSearchIndexesList.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ const RediSearchIndexesList = (props: Props) => {
3939
const { viewType, searchMode } = useSelector(keysSelector)
4040
const { selectedIndex = '' } = useSelector(redisearchSelector)
4141
const { data: list = [], loading } = useSelector(redisearchListSelector)
42-
const { id: instanceId, modules, loading: instanceLoading } = useSelector(connectedInstanceSelector)
42+
const { id: instanceId, modules, host: instanceHost } = useSelector(connectedInstanceSelector)
4343

4444
const [isSelectOpen, setIsSelectOpen] = useState<boolean>(false)
4545
const [index, setIndex] = useState<Nullable<string>>(JSON.stringify(selectedIndex))
4646

4747
const dispatch = useDispatch()
4848

4949
useEffect(() => {
50-
if (instanceLoading) return
50+
if (!instanceHost) return
5151

5252
const moduleExists = isRedisearchAvailable(modules)
5353
if (moduleExists) {
@@ -57,7 +57,7 @@ const RediSearchIndexesList = (props: Props) => {
5757

5858
localStorageService.set(BrowserStorageItem.browserSearchMode, SearchMode.Pattern)
5959
}
60-
}, [instanceLoading, modules])
60+
}, [instanceHost, modules])
6161

6262
useEffect(() => {
6363
setIndex(JSON.stringify(selectedIndex || ''))

redisinsight/ui/src/pages/browser/components/redisearch-key-list/styles.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
min-width: 80px;
55
overflow: hidden;
66
position: relative;
7+
flex-shrink: 0;
78

89
:global {
910
.euiFormControlLayout {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ const ModuleNotLoaded = ({ moduleName, id, type = 'workbench' }: IProps) => {
6363
})
6464

6565
const getStartedLink = (baseUrl: string) => {
66-
const url = new URL(baseUrl)
6766
try {
67+
const url = new URL(baseUrl)
6868
url.searchParams.append('utm_source', 'redisinsight')
6969
url.searchParams.append('utm_medium', 'app')
7070
url.searchParams.append('utm_campaign', type === 'browser' ? 'redisinsight_browser_search' : 'redisinsight_workbench')

0 commit comments

Comments
 (0)