Skip to content

Commit a5f2de3

Browse files
committed
refactor(rdi): migrate statistics page to styled-components and remove loader backdrop
References: #RI-7839
1 parent 8b04405 commit a5f2de3

File tree

3 files changed

+64
-68
lines changed

3 files changed

+64
-68
lines changed
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+
4+
export const Container = styled(Col)`
5+
overflow: auto;
6+
position: relative;
7+
`
8+
export const ContentWrapper = styled(Col)`
9+
padding: ${({ theme }) => theme.core.space.space200};
10+
`
11+
12+
export const LoadingState = styled(Col)`
13+
z-index: 2;
14+
`

redisinsight/ui/src/pages/rdi/statistics/StatisticsPage.tsx

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,17 @@ import { formatLongName, Nullable, setTitle } from 'uiSrc/utils'
1919
import { setLastPageContext } from 'uiSrc/slices/app/context'
2020
import { PageNames } from 'uiSrc/constants'
2121
import { Loader } from 'uiSrc/components/base/display'
22-
import { IRdiStatistics, RdiPipelineStatus } from 'uiSrc/slices/interfaces'
22+
import { type IRdiStatistics, RdiPipelineStatus } from 'uiSrc/slices/interfaces'
2323

24+
import { FlexItem, Row } from 'uiSrc/components/base/layout/flex'
25+
import { AutoRefresh } from 'uiSrc/components'
2426
import Clients from './clients'
2527
import DataStreams from './data-streams'
2628
import Empty from './empty'
2729
import ProcessingPerformance from './processing-performance'
2830
import Status from './status'
2931
import TargetConnections from './target-connections'
30-
31-
import styles from './styles.module.scss'
32-
import { Col, FlexItem, Row } from 'uiSrc/components/base/layout/flex'
33-
import { AutoRefresh } from 'uiSrc/components'
32+
import * as S from './StatisticsPage.styles'
3433

3534
const shouldShowStatistics = (data: Nullable<IRdiStatistics>) =>
3635
data?.status === RdiPipelineStatus.Success && !!data?.data
@@ -123,60 +122,61 @@ const StatisticsPage = () => {
123122

124123
const { data: statisticsData } = statisticsResults
125124

126-
127125
return (
128-
<div className={styles.pageContainer}>
129-
<Col gap="xxl" style={{ padding: 16 }}>
126+
<S.Container>
127+
<S.ContentWrapper gap="xxl">
130128
{pageLoading && (
131-
<div className={styles.cover}>
129+
<S.LoadingState centered>
132130
<Loader size="xl" />
133-
</div>
131+
</S.LoadingState>
134132
)}
135133
{!shouldShowStatistics(statisticsResults) ? (
136134
// TODO add loader
137135
<Empty rdiInstanceId={rdiInstanceId} />
138136
) : (
139-
<>
140-
<Row justify="end">
141-
<FlexItem>
142-
<AutoRefresh
143-
postfix="processing-performance-info"
144-
displayText
145-
loading={isStatisticsLoading}
146-
lastRefreshTime={lastRefreshTime}
147-
enableAutoRefreshDefault
148-
testid="processing-performance-info"
149-
onRefresh={() => {
150-
setLastRefreshTime(Date.now())
151-
onRefresh('processing_performance')
152-
}}
153-
onRefreshClicked={() =>
154-
onRefreshClicked('processing_performance')
155-
}
156-
onEnableAutoRefresh={(
157-
enableAutoRefresh: boolean,
158-
refreshRate: string,
159-
) =>
160-
onChangeAutoRefresh(
161-
'processing_performance',
162-
enableAutoRefresh,
163-
refreshRate,
164-
)
165-
}
166-
/>
167-
</FlexItem>
168-
</Row>
169-
<Status data={statisticsData.rdiPipelineStatus} />
170-
<ProcessingPerformance
171-
data={statisticsData.processingPerformance}
172-
/>
173-
<TargetConnections data={statisticsData.connections} />
174-
<DataStreams data={statisticsData.dataStreams} />
175-
<Clients data={statisticsData.clients} />
176-
</>
137+
!pageLoading && (
138+
<>
139+
<Row justify="end">
140+
<FlexItem>
141+
<AutoRefresh
142+
postfix="processing-performance-info"
143+
displayText
144+
loading={isStatisticsLoading}
145+
lastRefreshTime={lastRefreshTime}
146+
enableAutoRefreshDefault
147+
testid="processing-performance-info"
148+
onRefresh={() => {
149+
setLastRefreshTime(Date.now())
150+
onRefresh('processing_performance')
151+
}}
152+
onRefreshClicked={() =>
153+
onRefreshClicked('processing_performance')
154+
}
155+
onEnableAutoRefresh={(
156+
enableAutoRefresh: boolean,
157+
refreshRate: string,
158+
) =>
159+
onChangeAutoRefresh(
160+
'processing_performance',
161+
enableAutoRefresh,
162+
refreshRate,
163+
)
164+
}
165+
/>
166+
</FlexItem>
167+
</Row>
168+
<Status data={statisticsData.rdiPipelineStatus} />
169+
<ProcessingPerformance
170+
data={statisticsData.processingPerformance}
171+
/>
172+
<TargetConnections data={statisticsData.connections} />
173+
<DataStreams data={statisticsData.dataStreams} />
174+
<Clients data={statisticsData.clients} />
175+
</>
176+
)
177177
)}
178-
</Col>
179-
</div>
178+
</S.ContentWrapper>
179+
</S.Container>
180180
)
181181
}
182182

redisinsight/ui/src/pages/rdi/statistics/styles.module.scss

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)