Skip to content

Commit 37ecb47

Browse files
#RI-2956,2954,2955 fix (#675)
* #RI-2956,2954,2955 fix
1 parent 24890a1 commit 37ecb47

File tree

5 files changed

+34
-35
lines changed

5 files changed

+34
-35
lines changed

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,24 @@ const RangeFilter = (props: Props) => {
157157
<div className={styles.slider}>
158158
<div className={styles.sliderTrack} />
159159
<div ref={range} className={styles.sliderRange}>
160-
<div className={styles.sliderLeftValue}>{getFormatTime(start?.toString())}</div>
161-
<div className={styles.sliderRightValue}>{getFormatTime(end?.toString())}</div>
160+
<div className={
161+
cx(styles.sliderLeftValue,
162+
{
163+
[styles.leftPosition]: max - startVal < (max - min) / 2
164+
})
165+
}
166+
>
167+
{getFormatTime(startVal?.toString())}
168+
</div>
169+
<div className={
170+
cx(styles.sliderRightValue,
171+
{
172+
[styles.rightPosition]: max - endVal > (max - min) / 2
173+
})
174+
}
175+
>
176+
{getFormatTime(endVal?.toString())}
177+
</div>
162178
</div>
163179
</div>
164180
</div>

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@
5656
margin-top: -30px;
5757
}
5858

59+
.sliderLeftValue.leftPosition {
60+
transform: translateX(-100%);
61+
}
62+
63+
.sliderRightValue.rightPosition {
64+
transform: translateX(100%);
65+
}
66+
5967
.sliderRightValue {
6068
right: -4px;
6169
}

redisinsight/ui/src/pages/browser/components/stream-details/StreamDetails/StreamDetails.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,18 @@ const StreamDetails = (props: Props) => {
150150
)
151151

152152
useEffect(() => {
153+
if (isNull(firstEntry)) {
154+
dispatch(updateStart(''))
155+
}
153156
if (start === '' && firstEntry?.id !== '') {
154157
dispatch(updateStart(firstEntryTimeStamp.toString()))
155158
}
156159
}, [firstEntryTimeStamp])
157160

158161
useEffect(() => {
162+
if (isNull(lastEntry)) {
163+
dispatch(updateEnd(''))
164+
}
159165
if (end === '' && lastEntry?.id !== '') {
160166
dispatch(updateEnd(lastEntryTimeStamp.toString()))
161167
}

redisinsight/ui/src/slices/tests/browser/stream.spec.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -318,37 +318,6 @@ describe('stream slice', () => {
318318
})
319319
})
320320

321-
describe('removeEntriesFromList', () => {
322-
it('should properly remove entries from list', () => {
323-
// Arrange
324-
const startState = {
325-
...initialState,
326-
data: {
327-
...mockedData
328-
}
329-
}
330-
331-
const endState = {
332-
...initialState,
333-
loading: false,
334-
data: {
335-
...mockedData,
336-
entries: [],
337-
total: 0
338-
}
339-
}
340-
341-
// Act
342-
const nextState = reducer(startState, removeEntriesFromList([mockedData.entries[0].id]))
343-
344-
// Assert
345-
const rootState = Object.assign(initialStateDefault, {
346-
browser: { stream: nextState },
347-
})
348-
expect(streamSelector(rootState)).toEqual(endState)
349-
})
350-
})
351-
352321
describe('updateStart', () => {
353322
it('should properly set the state', () => {
354323
// Arrange

redisinsight/ui/src/utils/streamUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ export const getTimestampFromId = (id: string = ''): number =>
88
parseInt(id.split('-')[0], 10)
99

1010
export const getStreamRangeStart = (start: string, firstEntryId: string) => {
11-
if (start === '' || firstEntryId === '' || start === getTimestampFromId(firstEntryId).toString()) {
11+
if (start === '' || !firstEntryId || start === getTimestampFromId(firstEntryId).toString()) {
1212
return SCAN_STREAM_START_DEFAULT
1313
}
1414
return start
1515
}
1616

1717
export const getStreamRangeEnd = (end: string, endEtryId: string) => {
18-
if (end === '' || endEtryId === '' || end === getTimestampFromId(endEtryId).toString()) {
18+
if (end === '' || !endEtryId || end === getTimestampFromId(endEtryId).toString()) {
1919
return SCAN_STREAM_END_DEFAULT
2020
}
2121
return end

0 commit comments

Comments
 (0)