Skip to content

Commit eaa0f36

Browse files
Fe/bugfix/ri 7545 fix stream layout (#5024)
* RI-7545: Fix strean layout * RI-7545: Fix edit button position
1 parent 4e4d32b commit eaa0f36

File tree

15 files changed

+159
-174
lines changed

15 files changed

+159
-174
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React, { ComponentProps } from 'react'
2+
3+
import { Input } from '@redis-ui/components'
4+
5+
export type ComposedInputProps = ComponentProps<typeof Input> & {
6+
before?: JSX.Element
7+
after?: JSX.Element
8+
}
9+
10+
export default function ComposedInput(props: ComposedInputProps) {
11+
const { before, after, placeholder, ...inputProps } = props
12+
return (
13+
<Input.Compose {...inputProps}>
14+
{before}
15+
<Input.Tag placeholder={placeholder} />
16+
{after}
17+
</Input.Compose>
18+
)
19+
}

redisinsight/ui/src/components/base/inputs/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ export { default as SearchInput } from './SearchInput'
33
export { default as NumericInput } from './NumericInput'
44
export { default as SwitchInput } from './SwitchInput'
55
export { default as TextArea } from './TextArea'
6-
export { default as TextInput } from './TextInput'
6+
export { default as TextInput } from './TextInput'
7+
export { default as ComposedInput } from './ComposedInput'

redisinsight/ui/src/components/base/tooltip/RITooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface RiTooltipProps
1313
}
1414

1515
const StyledTooltip = styled(Tooltip)`
16-
word-break: break-all;
16+
word-break: break-word;
1717
`
1818

1919
export const RiTooltip = ({

redisinsight/ui/src/components/confirmation-popover/ConfirmationPopover.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Col, Row } from 'uiSrc/components/base/layout/flex'
55
import { Text, Title } from 'uiSrc/components/base/text'
66

77
const PopoverContentWrapper = styled(Col)`
8-
word-break: break-all;
8+
word-break: break-word;
99
max-width: 300px;
1010
`
1111

@@ -26,7 +26,7 @@ const ConfirmationPopover = (props: ConfirmationPopoverProps) => {
2626
{title && <Title size="S">{title}</Title>}
2727
{message && <Text size="m">{message}</Text>}
2828
{appendInfo}
29-
<Row>{confirmButton}</Row>
29+
<Row justify="end">{confirmButton}</Row>
3030
</PopoverContentWrapper>
3131
</RiPopover>
3232
)

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

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,41 @@
11
import React, { useCallback, useState, useEffect, useRef } from 'react'
22
import cx from 'classnames'
3+
import styled from 'styled-components'
34

45
import { FormatedDate } from '../formated-date'
56
import styles from './styles.module.scss'
7+
import { Theme } from 'uiSrc/components/base/theme/types'
8+
9+
const SliderRange = styled.div<
10+
React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>
11+
>`
12+
background-color: ${({ theme }: { theme: Theme }) =>
13+
theme.semantic.color.background.primary400};
14+
height: 1px;
15+
z-index: 2;
16+
transform: translateY(2px);
17+
18+
&:before {
19+
content: '';
20+
width: 1px;
21+
height: 6px;
22+
position: absolute;
23+
top: -5px;
24+
left: -1px;
25+
background-color: ${({ theme }: { theme: Theme }) =>
26+
theme.semantic.color.background.primary400};
27+
}
28+
29+
&:after {
30+
content: '';
31+
width: 1px;
32+
height: 6px;
33+
position: absolute;
34+
right: -1px;
35+
background-color: ${({ theme }: { theme: Theme }) =>
36+
theme.semantic.color.background.primary400};
37+
}
38+
`
639

740
const buttonString = 'Reset Filter'
841

@@ -130,7 +163,7 @@ const RangeFilter = (props: Props) => {
130163
if (start === end) {
131164
return (
132165
<div data-testid="mock-fill-range" className={styles.rangeWrapper}>
133-
<div className={cx(styles.sliderRange, styles.mockRange)}>
166+
<SliderRange className={cx(styles.sliderRange, styles.mockRange)}>
134167
<div
135168
className={styles.sliderLeftValue}
136169
data-testid="range-left-timestamp"
@@ -143,7 +176,7 @@ const RangeFilter = (props: Props) => {
143176
>
144177
<FormatedDate date={end?.toString()} />
145178
</div>
146-
</div>
179+
</SliderRange>
147180
</div>
148181
)
149182
}
@@ -177,7 +210,7 @@ const RangeFilter = (props: Props) => {
177210
/>
178211
<div className={styles.slider}>
179212
<div className={styles.sliderTrack} />
180-
<div
213+
<SliderRange
181214
ref={range}
182215
className={cx(styles.sliderRange, {
183216
[styles.leftPosition]: max - startVal < (max - min) / 2,
@@ -200,7 +233,7 @@ const RangeFilter = (props: Props) => {
200233
>
201234
<FormatedDate date={endVal?.toString()} />
202235
</div>
203-
</div>
236+
</SliderRange>
204237
</div>
205238
</div>
206239
{(start !== min || end !== max) && (

redisinsight/ui/src/components/range-filter/styles.module.scss

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -37,32 +37,6 @@
3737
z-index: 1;
3838
}
3939

40-
.rangeWrapper .sliderRange {
41-
height: 1px;
42-
background-color: var(--euiColorPrimary);
43-
z-index: 2;
44-
transform: translateY(2px);
45-
46-
&:before {
47-
content: '';
48-
width: 1px;
49-
height: 6px;
50-
position: absolute;
51-
top: -5px;
52-
left: -1px;
53-
background-color: var(--euiColorPrimary);
54-
}
55-
56-
&:after {
57-
content: '';
58-
width: 1px;
59-
height: 6px;
60-
position: absolute;
61-
right: -1px;
62-
background-color: var(--euiColorPrimary);
63-
}
64-
}
65-
6640
.rangeWrapper:hover .sliderRange:not(.disabled) {
6741
height: 5px;
6842
transform: translateY(0px);
@@ -92,14 +66,6 @@
9266
margin-top: -25px;
9367
}
9468

95-
.rangeWrapper:hover .sliderLeftValue:not(.disabled) {
96-
margin-top: -23px;
97-
}
98-
99-
.rangeWrapper:hover .sliderRightValue:not(.disabled) {
100-
margin-top: 10px;
101-
}
102-
10369
.sliderLeftValue.leftPosition {
10470
transform: translateX(-100%);
10571
}

redisinsight/ui/src/components/virtual-grid/VirtualGrid.tsx

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { SCAN_COUNT_DEFAULT } from 'uiSrc/constants/api'
1111
import { Text } from 'uiSrc/components/base/text'
1212
import { RiIcon } from 'uiSrc/components/base/icons/RiIcon'
1313
import { ProgressBarLoader } from 'uiSrc/components/base/display'
14+
import { Row } from 'uiSrc/components/base/layout/flex'
1415
import { IProps } from './interfaces'
1516
import { getColumnWidth, useInnerElementType } from './utils'
1617

@@ -202,19 +203,22 @@ const VirtualGrid = (props: IProps) => {
202203
className={styles.gridHeaderItemSortable}
203204
onClick={() => changeSorting(column.id)}
204205
>
205-
{content.render
206-
? content.render(content)
207-
: renderNotEmptyContent(content.label)}
208-
<span style={{ paddingLeft: 0 }}>
209-
<RiIcon
210-
style={{ marginLeft: '4px' }}
211-
type={
212-
sortedColumn?.order === SortOrder.DESC
213-
? 'ArrowDownIcon'
214-
: 'ArrowUpIcon'
215-
}
216-
/>
217-
</span>
206+
<Row align="center">
207+
{content.render
208+
? content.render(content)
209+
: renderNotEmptyContent(content.label)}
210+
<span style={{ paddingLeft: 0 }}>
211+
<RiIcon
212+
size="S"
213+
style={{ marginLeft: '4px' }}
214+
type={
215+
sortedColumn?.order === SortOrder.DESC
216+
? 'ArrowDownIcon'
217+
: 'ArrowUpIcon'
218+
}
219+
/>
220+
</span>
221+
</Row>
218222
</button>
219223
)}
220224
{!content?.sortable &&

redisinsight/ui/src/constants/texts.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,16 @@ export const ScanNoResultsFoundText = (
5050

5151
export const lastDeliveredIDTooltipText = (
5252
<>
53-
Specify the ID of the last delivered entry in the stream from the new
54-
group's perspective.
53+
<Text size="s">
54+
Specify the ID of the last delivered entry in the stream from the new
55+
group's perspective.
56+
</Text>
5557
<Spacer size="xs" />
56-
Otherwise, <b>$</b> represents the ID of the last entry in the stream,&nbsp;
57-
<b>0</b> fetches the entire stream from the beginning.
58+
<Text size="s">
59+
Otherwise, <b>$</b> represents the ID of the last entry in the
60+
stream,&nbsp;
61+
<b>0</b> fetches the entire stream from the beginning.
62+
</Text>
5863
</>
5964
)
6065

redisinsight/ui/src/pages/browser/modules/key-details/components/stream-details/groups-view/GroupsView/styles.module.scss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,3 @@
3636
display: flex;
3737
}
3838
}
39-
40-
.editBtn {
41-
position: absolute;
42-
top: 20px;
43-
right: 0;
44-
}

redisinsight/ui/src/pages/browser/modules/key-details/components/stream-details/groups-view/GroupsViewWrapper.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ import { FormatedDate, RiTooltip } from 'uiSrc/components'
3737
import { Text } from 'uiSrc/components/base/text'
3838
import { FormField } from 'uiSrc/components/base/forms/FormField'
3939
import { RiIcon } from 'uiSrc/components/base/icons/RiIcon'
40-
import { TextInput } from 'uiSrc/components/base/inputs'
40+
import { ComposedInput } from 'uiSrc/components/base/inputs'
41+
4142
import {
4243
ConsumerDto,
4344
ConsumerGroupDto,
@@ -371,19 +372,8 @@ const GroupsViewWrapper = (props: Props) => {
371372
delay={500}
372373
editBtnClassName={styles.editBtn}
373374
>
374-
<FormField
375-
additionalText={
376-
<RiTooltip
377-
anchorClassName="inputAppendIcon"
378-
position="left"
379-
title="Enter Valid ID, 0 or $"
380-
content={lastDeliveredIDTooltipText}
381-
>
382-
<RiIcon type="InfoIcon" style={{ cursor: 'pointer' }} />
383-
</RiTooltip>
384-
}
385-
>
386-
<TextInput
375+
<FormField>
376+
<ComposedInput
387377
name="id"
388378
id="id"
389379
placeholder="ID*"
@@ -396,6 +386,16 @@ const GroupsViewWrapper = (props: Props) => {
396386
style={{ width: 240 }}
397387
autoComplete="off"
398388
data-testid="last-id-field"
389+
after={
390+
<RiTooltip
391+
anchorClassName="inputAppendIcon"
392+
position="left"
393+
title="Enter Valid ID, 0 or $"
394+
content={lastDeliveredIDTooltipText}
395+
>
396+
<RiIcon type="InfoIcon" style={{ cursor: 'pointer' }} />
397+
</RiTooltip>
398+
}
399399
/>
400400
{!showIdError && (
401401
<span className={styles.idText} data-testid="id-help-text">

0 commit comments

Comments
 (0)