Skip to content

Commit 69224f6

Browse files
authored
Merge pull request #4054 from RedisInsight/fe/feature/RI-6265_update-list-of-databases
#RI-6265 - update home page
2 parents 9f40330 + b51401f commit 69224f6

File tree

101 files changed

+2143
-2354
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+2143
-2354
lines changed
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading

redisinsight/ui/src/components/import-databases-dialog/ImportDatabasesDialog.tsx

Lines changed: 0 additions & 80 deletions
This file was deleted.

redisinsight/ui/src/components/import-databases-dialog/index.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

redisinsight/ui/src/components/import-databases-dialog/styles.module.scss

Lines changed: 0 additions & 19 deletions
This file was deleted.

redisinsight/ui/src/components/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import GlobalSubscriptions from './global-subscriptions'
1919
import MonitorWrapper from './monitor'
2020
import PagePlaceholder from './page-placeholder'
2121
import BulkActionsConfig from './bulk-actions-config'
22-
import ImportDatabasesDialog from './import-databases-dialog'
2322
import OnboardingTour from './onboarding-tour'
2423
import CodeBlock from './code-block'
2524
import ShowChildByCondition from './show-child-by-condition'
@@ -67,7 +66,6 @@ export {
6766
ShortcutsFlyout,
6867
PagePlaceholder,
6968
BulkActionsConfig,
70-
ImportDatabasesDialog,
7169
OnboardingTour,
7270
CodeBlock,
7371
ShowChildByCondition,

redisinsight/ui/src/components/item-list/ItemList.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import {
44
EuiTableFieldDataColumnType,
55
EuiTableSelectionType,
66
PropertySort,
7+
EuiBasicTableProps
78
} from '@elastic/eui'
89
import cx from 'classnames'
910
import React, { useEffect, useRef, useState } from 'react'
10-
import { Maybe, Nullable } from 'uiSrc/utils'
11+
import { Maybe } from 'uiSrc/utils'
1112
import { findColumn, getColumnWidth, hideColumn } from './utils'
1213

1314
import { ActionBar, DeleteAction, ExportAction } from './components'
@@ -16,13 +17,14 @@ import styles from './styles.module.scss'
1617

1718
export interface Props<T> {
1819
width: number
19-
editedInstance: Nullable<T>
2020
columns: EuiTableFieldDataColumnType<T>[]
2121
columnsToHide?: string[]
2222
onDelete: (ids: T[]) => void
2323
hideExport?: boolean
2424
onExport?: (ids: T[], withSecrets: boolean) => void
2525
onWheel: () => void
26+
rowProps?: EuiBasicTableProps<T>['rowProps']
27+
getSelectableItems?: (item: T) => boolean
2628
loading: boolean
2729
data: T[]
2830
onTableChange: ({ sort, page }: Criteria<T>) => void
@@ -37,7 +39,8 @@ function ItemList<T extends { id: string; visible?: boolean }>({
3739
hideExport = false,
3840
onExport,
3941
onWheel,
40-
editedInstance,
42+
rowProps,
43+
getSelectableItems,
4144
loading,
4245
data: instances,
4346
onTableChange,
@@ -143,7 +146,10 @@ function ItemList<T extends { id: string; visible?: boolean }>({
143146
}
144147

145148
const selectionValue: EuiTableSelectionType<T> = {
146-
onSelectionChange: (selected: T[]) => setSelection(selected)
149+
selectable: (item) => (getSelectableItems ? getSelectableItems?.(item) : true),
150+
onSelectionChange: (selected: T[]) => {
151+
setSelection(selected)
152+
}
147153
}
148154

149155
const handleResetSelection = () => {
@@ -159,12 +165,6 @@ function ItemList<T extends { id: string; visible?: boolean }>({
159165
tableRef.current?.setSelection([])
160166
}
161167

162-
const toggleSelectedRow = (instance: T) => ({
163-
className: cx({
164-
'euiTableRow-isSelected': instance?.id === editedInstance?.id
165-
})
166-
})
167-
168168
const actionMsg = (action: string) => `
169169
Selected
170170
${' '}
@@ -183,7 +183,7 @@ function ItemList<T extends { id: string; visible?: boolean }>({
183183
loading={loading}
184184
message={message}
185185
columns={columns ?? []}
186-
rowProps={toggleSelectedRow}
186+
rowProps={rowProps}
187187
sorting={{ sort }}
188188
selection={selectionValue}
189189
onWheel={onWheel}

redisinsight/ui/src/components/navigation-menu/NavigationMenu.spec.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,13 @@ describe('NavigationMenu', () => {
143143
expect(screen.getByTestId('settings-page-btn')).toBeTruthy()
144144
})
145145

146+
it('should render cloud link', () => {
147+
const { container } = render(<NavigationMenu />)
148+
149+
const createCloudLink = container.querySelector('[data-test-subj="create-cloud-nav-link"]')
150+
expect(createCloudLink).toBeTruthy()
151+
})
152+
146153
it('should render github btn with proper link', () => {
147154
(appInfoSelector as jest.Mock).mockImplementation(() => ({
148155
...mockAppInfoSelector,

redisinsight/ui/src/components/navigation-menu/NavigationMenu.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import { FeatureFlagComponent } from 'uiSrc/components'
4343

4444
import { appContextSelector } from 'uiSrc/slices/app/context'
4545
import { AppWorkspace } from 'uiSrc/slices/interfaces'
46+
import CreateCloud from './components/create-cloud'
4647
import HelpMenu from './components/help-menu/HelpMenu'
4748
import NotificationMenu from './components/notifications-center'
4849

@@ -309,6 +310,7 @@ const NavigationMenu = () => {
309310
</div>
310311
<div className={styles.bottomContainer}>
311312
<FeatureFlagComponent name={FeatureFlags.disabledByEnv} enabledByDefault>
313+
<CreateCloud />
312314
<NotificationMenu />
313315
</FeatureFlagComponent>
314316
<HelpMenu />
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React from 'react'
2+
import { cloneDeep } from 'lodash'
3+
import { cleanup, mockedStore, render, fireEvent } from 'uiSrc/utils/test-utils'
4+
5+
import { setSSOFlow } from 'uiSrc/slices/instances/cloud'
6+
import { OAuthSocialAction, OAuthSocialSource } from 'uiSrc/slices/interfaces'
7+
import { setSocialDialogState } from 'uiSrc/slices/oauth/cloud'
8+
import CreateCloud from './CreateCloud'
9+
10+
jest.mock('uiSrc/slices/app/features', () => ({
11+
...jest.requireActual('uiSrc/slices/app/features'),
12+
appFeatureFlagsFeaturesSelector: jest.fn().mockReturnValue({
13+
cloudSso: {
14+
flag: true
15+
}
16+
}),
17+
}))
18+
19+
let store: typeof mockedStore
20+
beforeEach(() => {
21+
cleanup()
22+
store = cloneDeep(mockedStore)
23+
store.clearActions()
24+
})
25+
26+
describe('CreateCloud', () => {
27+
it('should render', () => {
28+
expect(render(<CreateCloud />)).toBeTruthy()
29+
})
30+
31+
it('should call proper actions on click cloud button', () => {
32+
const { container } = render(<CreateCloud />)
33+
const createCloudLink = container.querySelector('[data-test-subj="create-cloud-nav-link"]')
34+
35+
fireEvent.click(createCloudLink as Element)
36+
37+
expect(store.getActions()).toEqual([
38+
setSSOFlow(OAuthSocialAction.Create),
39+
setSocialDialogState(OAuthSocialSource.NavigationMenu)
40+
])
41+
})
42+
})

0 commit comments

Comments
 (0)