Skip to content

Commit 90da085

Browse files
committed
RI-6041 fix display formated time in streams
1 parent b311ea5 commit 90da085

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import cx from 'classnames'
33

44
import { getFormatTime } from 'uiSrc/utils/streamUtils'
55

6+
import FormatedDate from '../formated-date'
67
import styles from './styles.module.scss'
78

89
const buttonString = 'Reset Filter'
@@ -138,8 +139,8 @@ const RangeFilter = (props: Props) => {
138139
return (
139140
<div data-testid="mock-fill-range" className={styles.rangeWrapper}>
140141
<div className={cx(styles.sliderRange, styles.mockRange)}>
141-
<div className={styles.sliderLeftValue} data-testid="range-left-timestamp">{getFormatTime(start?.toString())}</div>
142-
<div className={styles.sliderRightValue} data-testid="range-right-timestamp">{getFormatTime(end?.toString())}</div>
142+
<div className={styles.sliderLeftValue} data-testid="range-left-timestamp"><FormatedDate date={start?.toString()} /></div>
143+
<div className={styles.sliderRightValue} data-testid="range-right-timestamp"><FormatedDate date={end?.toString()} /></div>
143144
</div>
144145
</div>
145146
)
@@ -192,7 +193,7 @@ const RangeFilter = (props: Props) => {
192193
})
193194
}
194195
>
195-
{getFormatTime(startVal?.toString())}
196+
<FormatedDate date={startVal?.toString()} />
196197
</div>
197198
<div className={
198199
cx(styles.sliderRightValue,
@@ -202,7 +203,7 @@ const RangeFilter = (props: Props) => {
202203
})
203204
}
204205
>
205-
{getFormatTime(endVal?.toString())}
206+
<FormatedDate date={endVal?.toString()} />
206207
</div>
207208
</div>
208209
</div>

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import {
2121
import { ITableColumn } from 'uiSrc/components/virtual-table/interfaces'
2222
import PopoverDelete from 'uiSrc/pages/browser/components/popover-delete/PopoverDelete'
2323
import { bufferToString, consumerGroupIdRegex, formatLongName, isEqualBuffers, validateConsumerGroupId } from 'uiSrc/utils'
24-
import { getFormatTime } from 'uiSrc/utils/streamUtils'
2524
import { TableCellTextAlignment } from 'uiSrc/constants'
2625
import { StreamViewType } from 'uiSrc/slices/interfaces/stream'
2726
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
2827
import { RedisResponseBuffer } from 'uiSrc/slices/interfaces'
2928
import EditablePopover from 'uiSrc/pages/browser/modules/key-details/shared/editable-popover'
3029

30+
import { FormatedDate } from 'uiSrc/components'
3131
import { ConsumerDto, ConsumerGroupDto, UpdateConsumerGroupDto } from 'apiSrc/modules/browser/stream/dto'
3232

3333
import GroupsView from './GroupsView'
@@ -240,7 +240,14 @@ const GroupsViewWrapper = (props: Props) => {
240240
const smallestTimestamp = smallestPendingId?.viewValue?.split('-')?.[0]
241241
const greatestTimestamp = greatestPendingId?.viewValue?.split('-')?.[0]
242242

243-
const tooltipContent = `${getFormatTime(smallestTimestamp)}${getFormatTime(greatestTimestamp)}`
243+
const tooltipContent = (
244+
<>
245+
<FormatedDate date={smallestTimestamp} />
246+
<span>&nbsp;–&nbsp;</span>
247+
<FormatedDate date={greatestTimestamp} />
248+
</>
249+
)
250+
244251
return (
245252
<EuiText size="s" style={{ maxWidth: '100%' }}>
246253
<div style={{ display: 'flex' }} className="truncateText" data-testid={`group-pending-${viewName}`}>
@@ -285,7 +292,7 @@ const GroupsViewWrapper = (props: Props) => {
285292
style={{ display: 'flex' }}
286293
data-testid={`stream-group-date-${id}`}
287294
>
288-
{getFormatTime(timestamp)}
295+
<FormatedDate date={timestamp} />
289296
</div>
290297
</EuiText>
291298
<EuiText size="s" style={{ maxWidth: '100%' }}>

redisinsight/ui/src/pages/browser/modules/key-details/components/stream-details/stream-data-view/StreamDataViewWrapper.tsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,20 @@ import {
99
createDeleteFieldHeader,
1010
createDeleteFieldMessage,
1111
createTooltipContent,
12-
formatTimestamp,
1312
formattingBuffer,
1413
stringToBuffer
1514
} from 'uiSrc/utils'
1615
import { streamDataSelector, deleteStreamEntry } from 'uiSrc/slices/browser/stream'
1716
import { ITableColumn } from 'uiSrc/components/virtual-table/interfaces'
1817
import PopoverDelete from 'uiSrc/pages/browser/components/popover-delete/PopoverDelete'
19-
import { DATETIME_FORMATTER_DEFAULT, KeyTypes, TableCellTextAlignment, TEXT_FAILED_CONVENT_FORMATTER, TimezoneOption } from 'uiSrc/constants'
18+
import { KeyTypes, TableCellTextAlignment, TEXT_FAILED_CONVENT_FORMATTER } from 'uiSrc/constants'
2019
import { getBasedOnViewTypeEvent, sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
2120
import { connectedInstanceSelector } from 'uiSrc/slices/instances/instances'
2221
import { keysSelector, selectedKeySelector, updateSelectedKeyRefreshTime } from 'uiSrc/slices/browser/keys'
2322
import { decompressingBuffer } from 'uiSrc/utils/decompressors'
2423

25-
import { userSettingsConfigSelector } from 'uiSrc/slices/user/user-settings'
2624
import { FormattedValue } from 'uiSrc/pages/browser/modules/key-details/shared'
25+
import { FormatedDate } from 'uiSrc/components'
2726
import { StreamEntryDto } from 'apiSrc/modules/browser/stream/dto'
2827
import StreamDataView from './StreamDataView'
2928
import styles from './StreamDataView/styles.module.scss'
@@ -48,7 +47,6 @@ const StreamDataViewWrapper = (props: Props) => {
4847
const { id: instanceId, compressor = null } = useSelector(connectedInstanceSelector)
4948
const { viewType: browserViewType } = useSelector(keysSelector)
5049
const { viewFormat: viewFormatProp } = useSelector(selectedKeySelector)
51-
const config = useSelector(userSettingsConfigSelector)
5250

5351
const dispatch = useDispatch()
5452

@@ -249,18 +247,15 @@ const StreamDataViewWrapper = (props: Props) => {
249247
render: function Id({ id }: StreamEntryDto) {
250248
const idStr = bufferToString(id, viewFormat)
251249
const timestamp = idStr.split('-')?.[0]
252-
const formattedTimestamp = timestamp.length > MAX_FORMAT_LENGTH_STREAM_TIMESTAMP ? '-' : formatTimestamp(
253-
timestamp,
254-
config?.dateFormat || DATETIME_FORMATTER_DEFAULT,
255-
config?.timezone || TimezoneOption.Local
256-
)
257250

258251
return (
259252
<div>
260253
{id.length < MAX_VISIBLE_LENGTH_STREAM_TIMESTAMP && (
261254
<EuiText color="subdued" size="s" style={{ maxWidth: '100%' }}>
262255
<div className="streamItem truncateText" style={{ display: 'flex' }} data-testid={`stream-entry-${id}-date`}>
263-
{formattedTimestamp}
256+
{timestamp.length > MAX_FORMAT_LENGTH_STREAM_TIMESTAMP ? '-' : (
257+
<FormatedDate date={timestamp} />
258+
)}
264259
</div>
265260
</EuiText>
266261
)}

0 commit comments

Comments
 (0)