Skip to content

Commit 2f99a56

Browse files
committed
RI-5934 truncate date in css
1 parent d425f95 commit 2f99a56

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

redisinsight/ui/src/components/formated-date/FormatedDate.tsx

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,25 @@
1-
import { EuiToolTip } from '@elastic/eui'
21
import React from 'react'
32
import { useSelector } from 'react-redux'
43
import { DATETIME_FORMATTER_DEFAULT, TimezoneOption } from 'uiSrc/constants'
54
import { userSettingsConfigSelector } from 'uiSrc/slices/user/user-settings'
65
import { formatTimestamp } from 'uiSrc/utils'
6+
import styles from './styles.module.scss'
77

88
export interface Props {
99
date: Date | string | number
10-
truncate?: number
1110
}
1211

13-
const FormatedDate = ({ date, truncate }: Props) => {
12+
const FormatedDate = ({ date }: Props) => {
1413
const config = useSelector(userSettingsConfigSelector)
1514
const dateFormat = config?.dateFormat || DATETIME_FORMATTER_DEFAULT
1615
const timezone = config?.timezone || TimezoneOption.Local
1716

1817
const formatedDate = formatTimestamp(date, dateFormat, timezone)
1918

20-
if (truncate && dateFormat.length > truncate) {
21-
return (
22-
<EuiToolTip
23-
content={formatedDate}
24-
>
25-
<>{formatedDate.slice(0, truncate).concat('...')}</>
26-
</EuiToolTip>
27-
)
28-
}
29-
3019
return (
31-
<span>{formatedDate}</span>
20+
<span className={styles.text}>
21+
{formatedDate}
22+
</span>
3223
)
3324
}
3425

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.text {
2+
display: inline-block;
3+
text-overflow: ellipsis;
4+
white-space: nowrap;
5+
overflow: hidden;
6+
position: relative;
7+
max-width: 100%;
8+
vertical-align: middle;
9+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ const QueryCardHeader = (props: Props) => {
311311
<EuiFlexItem className={cx(styles.time)} data-testid="command-execution-date-time">
312312
{!!createdAt && (
313313
<EuiTextColor className={styles.timeText} component="div">
314-
<FormatedDate date={createdAt} truncate={15} />
314+
<FormatedDate date={createdAt} />
315315
</EuiTextColor>
316316
)}
317317
</EuiFlexItem>

redisinsight/ui/src/pages/pub-sub/components/messages-list/MessagesList/MessagesList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const MessagesList = (props: Props) => {
120120

121121
return (
122122
<div style={style} className={styles.item} data-testid={`row-${index}`}>
123-
<div className={styles.time}><FormatedDate date={time} truncate={18} /></div>
123+
<div className={styles.time}><FormatedDate date={time} /></div>
124124
<div className={styles.channel}>
125125
<EuiToolTip
126126
content={channel}

redisinsight/ui/src/pages/slow-log/SlowLogPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ const SlowLogPage = () => {
174174
{lastTimestamp && (
175175
<>
176176
<span>&nbsp;from &nbsp;</span>
177-
<FormatedDate date={lastTimestamp * 1000} truncate={30} />
177+
<FormatedDate date={lastTimestamp * 1000} />
178178
</>
179179
)})
180180
</EuiText>

redisinsight/ui/src/pages/slow-log/components/SlowLogTable/SlowLogTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const SlowLogTable = (props: Props) => {
4747
isSortable: true,
4848
render: (timestamp) => (
4949
<EuiText size="s" color="subdued" data-testid="timestamp-value">
50-
<FormatedDate date={timestamp * 1000} truncate={20} />
50+
<FormatedDate date={timestamp * 1000} />
5151
</EuiText>
5252
)
5353
},

0 commit comments

Comments
 (0)