Skip to content

Commit 6dbeb9e

Browse files
Merge pull request #684 from RedisInsight/feature/RI-2932_Consumer_Groups
#RI-2932 - Show Consumer groups
2 parents d589975 + 83fe389 commit 6dbeb9e

File tree

73 files changed

+3476
-651
lines changed

Some content is hidden

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

73 files changed

+3476
-651
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@
202202
"opencollective-postinstall": "^2.0.3",
203203
"react-hot-loader": "^4.13.0",
204204
"react-refresh": "^0.9.0",
205-
"react-test-renderer": "^17.0.1",
206205
"redux-mock-store": "^1.5.4",
207206
"regenerator-runtime": "^0.13.5",
208207
"rimraf": "^3.0.2",

redisinsight/ui/src/components/page-placeholder/PagePlaceholder.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@ import { ReactComponent as LogoIcon } from 'uiSrc/assets/img/logo.svg'
33
import { EuiLoadingLogo, EuiEmptyPrompt } from '@elastic/eui'
44

55
const PagePlaceholder = () => (
6-
<EuiEmptyPrompt
7-
icon={<EuiLoadingLogo logo={LogoIcon} size="xl" style={{ fontSize: '40px' }} />}
8-
titleSize="s"
9-
/>
6+
<>
7+
{ process.env.NODE_ENV !== 'development' && (
8+
<EuiEmptyPrompt
9+
icon={<EuiLoadingLogo logo={LogoIcon} size="xl" style={{ fontSize: '40px' }} />}
10+
titleSize="s"
11+
/>
12+
)}
13+
</>
14+
1015
)
1116

1217
export default PagePlaceholder
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react'
2+
import { instance, mock } from 'ts-mockito'
3+
import { render, screen, fireEvent } from 'uiSrc/utils/test-utils'
4+
import PopoverItemEditor, { Props } from './PopoverItemEditor'
5+
6+
const mockedProps = mock<Props>()
7+
8+
describe('PopoverItemEditor', () => {
9+
it('should render', () => {
10+
expect(
11+
render(
12+
<PopoverItemEditor
13+
{...instance(mockedProps)}
14+
onDecline={jest.fn()}
15+
>
16+
<></>
17+
</PopoverItemEditor>
18+
)
19+
).toBeTruthy()
20+
})
21+
})
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
import React, {
2+
FormEvent,
3+
useEffect,
4+
useState,
5+
} from 'react'
6+
7+
import {
8+
EuiButton,
9+
EuiButtonIcon, EuiFlexGroup, EuiFlexItem, EuiForm,
10+
EuiPopover,
11+
} from '@elastic/eui'
12+
import styles from './styles.module.scss'
13+
14+
export interface Props {
15+
children: React.ReactElement
16+
className?: string
17+
onOpen: () => void
18+
onApply: () => void
19+
onDecline?: () => void
20+
isLoading?: boolean
21+
isDisabled?: boolean
22+
declineOnUnmount?: boolean
23+
btnTestId?: string
24+
btnIconType?: string
25+
}
26+
27+
const PopoverItemEditor = (props: Props) => {
28+
const {
29+
onOpen,
30+
onDecline,
31+
onApply,
32+
children,
33+
isLoading,
34+
declineOnUnmount = true,
35+
isDisabled,
36+
btnTestId,
37+
btnIconType,
38+
className
39+
} = props
40+
const [isPopoverOpen, setIsPopoverOpen] = useState<boolean>(false)
41+
42+
useEffect(() =>
43+
// componentWillUnmount
44+
() => {
45+
declineOnUnmount && onDecline?.()
46+
},
47+
[])
48+
49+
const onFormSubmit = (e: FormEvent<HTMLFormElement>) => {
50+
e.preventDefault()
51+
handleApply()
52+
}
53+
54+
const handleApply = (): void => {
55+
setIsPopoverOpen(false)
56+
onApply()
57+
}
58+
59+
const handleDecline = () => {
60+
setIsPopoverOpen(false)
61+
onDecline?.()
62+
}
63+
64+
const handleButtonClick = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
65+
e.stopPropagation()
66+
onOpen?.()
67+
setIsPopoverOpen(true)
68+
}
69+
70+
const isDisabledApply = (): boolean => !!(isLoading || isDisabled)
71+
72+
const button = (
73+
<EuiButtonIcon
74+
iconType={btnIconType || 'pencil'}
75+
aria-label="Edit field"
76+
color="primary"
77+
disabled={isLoading}
78+
onClick={handleButtonClick}
79+
data-testid={btnTestId || 'popover-edit-bnt'}
80+
/>
81+
)
82+
83+
return (
84+
<EuiPopover
85+
ownFocus
86+
anchorPosition="downLeft"
87+
isOpen={isPopoverOpen}
88+
anchorClassName={className}
89+
panelClassName={styles.popoverWrapper}
90+
closePopover={handleDecline}
91+
button={button}
92+
data-testid="popover-item-editor"
93+
onClick={(e) => e.stopPropagation()}
94+
>
95+
<EuiForm component="form" onSubmit={onFormSubmit}>
96+
<div className={styles.content}>
97+
{children}
98+
</div>
99+
<EuiFlexGroup className={styles.footer} responsive={false} justifyContent="flexEnd">
100+
<EuiFlexItem grow={false}>
101+
<EuiButton color="secondary" onClick={() => handleDecline()} data-testid="cancel-btn">
102+
Cancel
103+
</EuiButton>
104+
</EuiFlexItem>
105+
106+
<EuiFlexItem grow={false}>
107+
<EuiButton
108+
fill
109+
type="submit"
110+
color="secondary"
111+
isDisabled={isDisabledApply()}
112+
data-testid="save-btn"
113+
>
114+
Save
115+
</EuiButton>
116+
</EuiFlexItem>
117+
</EuiFlexGroup>
118+
</EuiForm>
119+
</EuiPopover>
120+
)
121+
}
122+
123+
export default PopoverItemEditor
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import PopoverItemEditor from './PopoverItemEditor'
2+
3+
export default PopoverItemEditor
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.content {
2+
3+
}
4+
5+
.footer {
6+
margin-top: 6px !important;
7+
}

redisinsight/ui/src/components/range-filter/RangeFilter.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface Props {
1212
min: number
1313
start: number
1414
end: number
15+
disabled?: boolean
1516
handleChangeStart: (value: number, shouldSentEventTelemetry: boolean) => void
1617
handleChangeEnd: (value: number, shouldSentEventTelemetry: boolean) => void
1718
handleUpdateRangeMax: (value: number) => void
@@ -33,6 +34,7 @@ const RangeFilter = (props: Props) => {
3334
min,
3435
start,
3536
end,
37+
disabled = false,
3638
handleChangeStart,
3739
handleChangeEnd,
3840
handleUpdateRangeMax,
@@ -152,6 +154,7 @@ const RangeFilter = (props: Props) => {
152154
max={max}
153155
value={startVal}
154156
ref={minValRef}
157+
disabled={disabled}
155158
onChange={onChangeStart}
156159
onMouseUp={onMouseUpStart}
157160
className={cx(styles.thumb, styles.thumbZindex3)}
@@ -163,6 +166,7 @@ const RangeFilter = (props: Props) => {
163166
max={max}
164167
value={endVal}
165168
ref={maxValRef}
169+
disabled={disabled}
166170
onChange={onChangeEnd}
167171
onMouseUp={onMouseUpEnd}
168172
className={cx(styles.thumb, styles.thumbZindex4)}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import RangeFilter from './RangeFilter'
2+
3+
export default RangeFilter

redisinsight/ui/src/components/virtual-table/styles.module.scss

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,6 @@ $footerHeight: 38px;
151151
white-space: pre-wrap;
152152
}
153153

154-
:global(.key-details-table) {
155-
:global(.ReactVirtualized__Table__row) {
156-
font-size: 13px;
157-
}
158-
}
159-
160154
:global(.key-list-table) {
161155
height: calc(100% - 58px);
162156
}
@@ -176,6 +170,9 @@ $footerHeight: 38px;
176170
}
177171
}
178172
}
173+
:global(.ReactVirtualized__Table__row) {
174+
font-size: 13px;
175+
}
179176
:global(.ReactVirtualized__Table__headerRow) {
180177
border: 1px solid var(--tableLightestBorderColor) !important;
181178
}

redisinsight/ui/src/constants/api.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ enum ApiEndpoints {
3535
REJSON_ARRAPPEND = 'rejson-rl/arrappend',
3636
STREAMS_ENTRIES = 'streams/entries',
3737
STREAMS_ENTRIES_GET = 'streams/entries/get',
38+
STREAMS_CONSUMER_GROUPS = 'streams/consumer-groups',
39+
STREAMS_CONSUMER_GROUPS_GET = 'streams/consumer-groups/get',
40+
STREAMS_CONSUMERS_GET = 'streams/consumer-groups/consumers/get',
41+
STREAMS_CONSUMERS_MESSAGES_GET = 'streams/consumer-groups/consumers/pending-messages/get',
3842
STREAMS = 'streams',
3943
CLI = 'cli',
4044
CLI_BLOCKING_COMMANDS = 'info/cli-blocking-commands',

0 commit comments

Comments
 (0)