Skip to content

Commit 595cde1

Browse files
committed
feat(ui): update the layout of the slow log page
- update the welcome screen - update the placement of the action buttons re #RI-7437
1 parent 50ad022 commit 595cde1

File tree

10 files changed

+206
-301
lines changed

10 files changed

+206
-301
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import styled from 'styled-components'
2+
import { RiSelect } from 'uiSrc/components/base/forms/select/RiSelect'
3+
4+
export const StyledSelect = styled(RiSelect)`
5+
border: none;
6+
`

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

Lines changed: 51 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,15 @@ import {
3232
import { AnalyticsViewTab } from 'uiSrc/slices/interfaces/analytics'
3333

3434
import { FormatedDate } from 'uiSrc/components'
35-
import { FlexItem, Row } from 'uiSrc/components/base/layout/flex'
36-
import { Text } from 'uiSrc/components/base/text'
37-
import {
38-
defaultValueRender,
39-
RiSelect,
40-
} from 'uiSrc/components/base/forms/select/RiSelect'
35+
import { Col, FlexItem, Row } from 'uiSrc/components/base/layout/flex'
36+
import { Text, Title } from 'uiSrc/components/base/text'
37+
import { defaultValueRender } from 'uiSrc/components/base/forms/select/RiSelect'
4138
import { SlowLog } from 'apiSrc/modules/slow-log/models'
4239

4340
import { Actions, EmptySlowLog, SlowLogTable } from './components'
4441

4542
import styles from './styles.module.scss'
43+
import { StyledSelect } from './SlowLogPage.styles'
4644

4745
const HIDE_TIMESTAMP_FROM_WIDTH = 850
4846
const DEFAULT_COUNT_VALUE = '50'
@@ -144,61 +142,78 @@ const SlowLogPage = () => {
144142
const isEmptySlowLog = !data.length
145143

146144
return (
147-
<div className={styles.main} data-testid="slow-log-page">
148-
<Row className={styles.header} align="center" justify="between">
149-
<FlexItem>
150-
<AnalyticsTabs />
151-
</FlexItem>
152-
153-
<FlexItem>
154-
{connectionType !== ConnectionType.Cluster && config && (
155-
<Text size="xs" color="subdued" data-testid="config-info">
156-
Execution time:{' '}
157-
{numberWithSpaces(
158-
convertNumberByUnits(slowlogLogSlowerThan, durationUnit),
159-
)}
160-
&nbsp;
161-
{durationUnit === DurationUnits.milliSeconds
162-
? DurationUnits.mSeconds
163-
: DurationUnits.microSeconds}
164-
, Max length: {numberWithSpaces(slowlogMaxLen)}
165-
</Text>
166-
)}
167-
</FlexItem>
168-
</Row>
169-
145+
<Col className={styles.main} data-testid="slow-log-page">
170146
<AutoSizer disableHeight>
171147
{({ width }) => (
172148
<div style={{ width }}>
149+
<Row className={styles.header} align="center" justify="between">
150+
<FlexItem>
151+
<AnalyticsTabs />
152+
</FlexItem>
153+
154+
<FlexItem>
155+
<Row align="center" gap="xl">
156+
{connectionType !== ConnectionType.Cluster && config && (
157+
<Text size="s" color="secondary" data-testid="config-info">
158+
Execution time:{' '}
159+
{numberWithSpaces(
160+
convertNumberByUnits(
161+
slowlogLogSlowerThan,
162+
durationUnit,
163+
),
164+
)}
165+
&nbsp;
166+
{durationUnit === DurationUnits.milliSeconds
167+
? DurationUnits.mSeconds
168+
: DurationUnits.microSeconds}
169+
, Max length: {numberWithSpaces(slowlogMaxLen)}
170+
</Text>
171+
)}
172+
173+
<Actions
174+
width={width}
175+
isEmptySlowLog={isEmptySlowLog}
176+
durationUnit={durationUnit}
177+
onClear={onClearSlowLogs}
178+
onRefresh={getSlowLogs}
179+
/>
180+
</Row>
181+
</FlexItem>
182+
</Row>
183+
173184
<Row
174185
className={styles.actionsLine}
175186
align="center"
176187
justify="between"
177188
>
178189
<FlexItem>
179-
<Row align="center" gap="s">
190+
<Title size="L" color="primary">
191+
Slow Log
192+
</Title>
193+
</FlexItem>
194+
<FlexItem>
195+
<Row align="center" gap="xs">
180196
<FlexItem>
181-
<Text color="subdued">
197+
<Text size="s" color="primary">
182198
{connectionType === ConnectionType.Cluster
183199
? 'Display per node:'
184200
: 'Display up to:'}
185201
</Text>
186202
</FlexItem>
187203
<FlexItem>
188-
<RiSelect
204+
<StyledSelect
189205
options={countOptions}
190206
valueRender={defaultValueRender}
191207
value={count}
192208
onChange={(value) => setCount(value)}
193-
className={styles.countSelect}
194209
data-testid="count-select"
195210
/>
196211
</FlexItem>
197212
{width > HIDE_TIMESTAMP_FROM_WIDTH && (
198213
<FlexItem style={{ marginLeft: 12 }}>
199214
<Text
200-
size="xs"
201-
color="subdued"
215+
size="s"
216+
color="secondary"
202217
data-testid="entries-from-timestamp"
203218
>
204219
({data.length} entries
@@ -214,15 +229,6 @@ const SlowLogPage = () => {
214229
)}
215230
</Row>
216231
</FlexItem>
217-
<FlexItem>
218-
<Actions
219-
width={width}
220-
isEmptySlowLog={isEmptySlowLog}
221-
durationUnit={durationUnit}
222-
onClear={onClearSlowLogs}
223-
onRefresh={getSlowLogs}
224-
/>
225-
</FlexItem>
226232
</Row>
227233
</div>
228234
)}
@@ -239,7 +245,7 @@ const SlowLogPage = () => {
239245
durationUnit={durationUnit}
240246
/>
241247
)}
242-
</div>
248+
</Col>
243249
)
244250
}
245251

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import styled from 'styled-components'
2+
3+
export const StyledInfoIcon = styled.span`
4+
display: flex;
5+
align-self: center;
6+
cursor: pointer;
7+
`

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

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, { useState } from 'react'
22
import { useSelector } from 'react-redux'
3-
import cx from 'classnames'
43
import { useParams } from 'react-router-dom'
54
import { connectedInstanceSelector } from 'uiSrc/slices/instances/instances'
65
import { DurationUnits } from 'uiSrc/constants'
@@ -22,6 +21,7 @@ import { RiIcon } from 'uiSrc/components/base/icons/RiIcon'
2221

2322
import SlowLogConfig from '../SlowLogConfig'
2423
import styles from './styles.module.scss'
24+
import { StyledInfoIcon } from './Actions.styles'
2525

2626
export interface Props {
2727
width: number
@@ -133,8 +133,8 @@ const Actions = (props: Props) => {
133133
)
134134

135135
return (
136-
<Row className={styles.actions} gap="s" align="center">
137-
<FlexItem grow={5} style={{ alignItems: 'flex-end' }}>
136+
<Row gap="s" align="center">
137+
<FlexItem>
138138
<AutoRefresh
139139
postfix="slowlog"
140140
loading={loading}
@@ -147,17 +147,18 @@ const Actions = (props: Props) => {
147147
testid="slowlog"
148148
/>
149149
</FlexItem>
150-
<FlexItem grow>
150+
151+
<FlexItem>
151152
<RiPopover
152153
ownFocus
153154
anchorPosition="downRight"
154155
isOpen={isPopoverConfigOpen}
155156
panelPaddingSize="m"
156157
closePopover={() => {}}
157-
panelClassName={cx('popover-without-top-tail', styles.configWrapper)}
158158
button={
159159
<SecondaryButton
160160
size="small"
161+
inverted
161162
icon={SettingsIcon}
162163
aria-label="Configure"
163164
onClick={() => showConfigPopover()}
@@ -173,8 +174,9 @@ const Actions = (props: Props) => {
173174
/>
174175
</RiPopover>
175176
</FlexItem>
177+
176178
{!isEmptySlowLog && (
177-
<FlexItem grow>
179+
<FlexItem>
178180
<RiPopover
179181
anchorPosition="leftCenter"
180182
ownFocus
@@ -200,11 +202,11 @@ const Actions = (props: Props) => {
200202
</RiPopover>
201203
</FlexItem>
202204
)}
203-
<FlexItem grow>
205+
206+
<FlexItem>
204207
<RiTooltip
205208
title="Slow Log"
206209
position="bottom"
207-
anchorClassName={styles.icon}
208210
content={
209211
<span data-testid="slowlog-tooltip-text">
210212
Slow Log is a list of slow operations for your Redis instance.
@@ -218,12 +220,9 @@ const Actions = (props: Props) => {
218220
</span>
219221
}
220222
>
221-
<RiIcon
222-
className={styles.infoIcon}
223-
type="InfoIcon"
224-
style={{ cursor: 'pointer' }}
225-
data-testid="slow-log-tooltip-icon"
226-
/>
223+
<StyledInfoIcon>
224+
<RiIcon type="InfoIcon" data-testid="slow-log-tooltip-icon" />
225+
</StyledInfoIcon>
227226
</RiTooltip>
228227
</FlexItem>
229228
</Row>

redisinsight/ui/src/pages/slow-log/components/Actions/styles.module.scss

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,6 @@
1818
display: flex;
1919
align-items: center;
2020
justify-content: center;
21-
22-
&:hover {
23-
color: var(--iconsDefaultHoverColor);
24-
}
25-
26-
:global(.euiIcon) {
27-
width: 18px;
28-
height: 18px;
29-
}
30-
31-
.infoIcon {
32-
width: 20px;
33-
height: 20px;
34-
}
3521
}
3622
}
3723

@@ -60,9 +46,3 @@
6046
color: var(--htmlColor);
6147
}
6248
}
63-
64-
.configWrapper {
65-
padding: 24px !important;
66-
box-shadow: 0px 3px 15px #00000099;
67-
background-color: var(--euiColorLightestShade) !important;
68-
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import styled from 'styled-components'
2+
3+
export const StyledImage = styled.img`
4+
max-width: 120px;
5+
`

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

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import { Title } from 'uiSrc/components/base/text/Title'
44
import { convertNumberByUnits } from 'uiSrc/pages/slow-log/utils'
55
import { numberWithSpaces } from 'uiSrc/utils/numbers'
66
import { Text } from 'uiSrc/components/base/text'
7+
import { Col } from 'uiSrc/components/base/layout/flex'
8+
import NoQueryResultsIcon from 'uiSrc/assets/img/vector-search/no-query-results.svg'
79

8-
import styles from '../styles.module.scss'
10+
import { StyledImage } from './EmptySlowLog.styles'
911

1012
export interface Props {
1113
durationUnit: DurationUnits
@@ -16,24 +18,27 @@ const EmptySlowLog = (props: Props) => {
1618
const { durationUnit, slowlogLogSlowerThan } = props
1719

1820
return (
19-
<div className={styles.noSlowLogWrapper} data-testid="empty-slow-log">
20-
<div className={styles.noSlowLogText}>
21-
<Title size="M" className={styles.noFoundTitle}>
22-
No Slow Logs found
23-
</Title>
24-
<Text color="subdued">
25-
Either no commands exceeding&nbsp;
26-
{numberWithSpaces(
27-
convertNumberByUnits(slowlogLogSlowerThan, durationUnit),
28-
)}
29-
&nbsp;
30-
{durationUnit === DurationUnits.milliSeconds
31-
? DurationUnits.mSeconds
32-
: DurationUnits.microSeconds}
33-
&nbsp;were found or Slow Log is disabled on the server.
34-
</Text>
35-
</div>
36-
</div>
21+
<Col justify="center" grow data-testid="empty-slow-log">
22+
<Col align="center" justify="center" gap="xxl">
23+
<StyledImage as="img" src={NoQueryResultsIcon} alt="No Slow Logs" />
24+
<Col align="center" gap="m" grow={false}>
25+
<Title size="M" color="primary">
26+
No Slow Logs found
27+
</Title>
28+
<Text color="primary">
29+
Either no commands exceeding&nbsp;
30+
{numberWithSpaces(
31+
convertNumberByUnits(slowlogLogSlowerThan, durationUnit),
32+
)}
33+
&nbsp;
34+
{durationUnit === DurationUnits.milliSeconds
35+
? DurationUnits.mSeconds
36+
: DurationUnits.microSeconds}
37+
&nbsp;were found or Slow Log is disabled on the server.
38+
</Text>
39+
</Col>
40+
</Col>
41+
</Col>
3742
)
3843
}
3944

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import styled from 'styled-components'
2+
import { Col } from 'uiSrc/components/base/layout/flex'
3+
import { TextInput } from 'uiSrc/components/base/inputs'
4+
import { theme } from '@redis-ui/styles'
5+
6+
export const StyledContainer = styled(Col)<{ $isCluster?: boolean }>`
7+
width: ${({ $isCluster }) => ($isCluster ? '394px' : '550px')};
8+
padding: ${theme.core.space.space200};
9+
border-radius: 4px;
10+
`
11+
12+
export const StyledInput = styled(TextInput)`
13+
width: 160px;
14+
`

0 commit comments

Comments
 (0)