Skip to content

Commit b04e6a7

Browse files
authored
Merge pull request #2777 from RedisInsight/fe/feature/RI-5033_Refactor_key_details_v2
#RI-5033 - refactor key details v2
2 parents d098316 + 64a1ab0 commit b04e6a7

File tree

217 files changed

+2744
-2009
lines changed

Some content is hidden

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

217 files changed

+2744
-2009
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react'
2+
import { instance, mock } from 'ts-mockito'
3+
import { render } from 'uiSrc/utils/test-utils'
4+
import { Props, FullScreen } from './FullScreen'
5+
6+
const mockedProps = mock<Props>()
7+
8+
describe('FullScreen', () => {
9+
it('should render', () => {
10+
expect(render(<FullScreen {...instance(mockedProps)} />)).toBeTruthy()
11+
})
12+
})
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import {
2+
EuiButtonIcon,
3+
EuiToolTip,
4+
} from '@elastic/eui'
5+
import React from 'react'
6+
7+
export interface Props {
8+
isFullScreen: boolean
9+
onToggleFullScreen: () => void
10+
anchorClassName?: string
11+
btnTestId?: string
12+
}
13+
14+
const FullScreen = ({
15+
isFullScreen,
16+
onToggleFullScreen,
17+
anchorClassName = '',
18+
btnTestId = 'toggle-full-screen',
19+
}: Props) => (
20+
<EuiToolTip
21+
content={isFullScreen ? 'Exit Full Screen' : 'Full Screen'}
22+
position="left"
23+
anchorClassName={anchorClassName}
24+
>
25+
<EuiButtonIcon
26+
iconType={isFullScreen ? 'fullScreenExit' : 'fullScreen'}
27+
color="primary"
28+
aria-label="Open full screen"
29+
onClick={onToggleFullScreen}
30+
data-testid={btnTestId}
31+
/>
32+
</EuiToolTip>
33+
)
34+
35+
export { FullScreen }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { FullScreen } from './FullScreen'

redisinsight/ui/src/components/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ import ShowChildByCondition from './show-child-by-condition'
2626
import RecommendationVoting from './recommendation-voting'
2727
import RecommendationCopyComponent from './recommendation-copy-component'
2828
import FeatureFlagComponent from './feature-flag-component'
29+
import AutoRefresh from './auto-refresh'
2930
import { ModuleNotLoaded, FilterNotAvailable } from './messages'
3031

32+
export { FullScreen } from './full-screen'
33+
3134
export * from './oauth'
3235

3336
export {
@@ -64,4 +67,5 @@ export {
6467
FeatureFlagComponent,
6568
ModuleNotLoaded,
6669
FilterNotAvailable,
70+
AutoRefresh,
6771
}

redisinsight/ui/src/components/query-card/QueryCardHeader/QueryCardHeader.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import { getViewTypeOptions, WBQueryType, getProfileViewTypeOptions, ProfileQuer
3636
import { IPluginVisualization } from 'uiSrc/slices/interfaces'
3737
import { RunQueryMode, ResultsMode, ResultsSummary } from 'uiSrc/slices/interfaces/workbench'
3838
import { appRedisCommandsSelector } from 'uiSrc/slices/app/redis-commands'
39+
import { FullScreen } from 'uiSrc/components'
3940

4041
import DefaultPluginIconDark from 'uiSrc/assets/img/workbench/default_view_dark.svg'
4142
import DefaultPluginIconLight from 'uiSrc/assets/img/workbench/default_view_light.svg'
@@ -391,18 +392,7 @@ const QueryCardHeader = (props: Props) => {
391392
</EuiFlexItem>
392393
<EuiFlexItem grow={false} className={styles.buttonIcon} onClick={onDropDownViewClick}>
393394
{(isOpen || isFullScreen) && (
394-
<EuiToolTip
395-
content={isFullScreen ? 'Exit Full Screen' : 'Full Screen'}
396-
position="left"
397-
>
398-
<EuiButtonIcon
399-
iconType={isFullScreen ? 'fullScreenExit' : 'fullScreen'}
400-
color="primary"
401-
aria-label="Open full screen"
402-
onClick={toggleFullScreen}
403-
data-testid="toggle-full-screen"
404-
/>
405-
</EuiToolTip>
395+
<FullScreen isFullScreen={isFullScreen} onToggleFullScreen={toggleFullScreen} />
406396
)}
407397
</EuiFlexItem>
408398
<EuiFlexItem grow={false} className={styles.buttonIcon}>

0 commit comments

Comments
 (0)