22// SPDX-License-Identifier: Apache-2.0
33
44import * as Redux from 'redux'
5- import { ChevronLeftRounded , ChevronRightRounded } from '@mui/icons-material'
65import {
6+ Button ,
77 Chip ,
88 Container ,
99 Table ,
@@ -14,6 +14,7 @@ import {
1414 Tooltip ,
1515 createTheme ,
1616} from '@mui/material'
17+ import { ChevronLeftRounded , ChevronRightRounded , Refresh } from '@mui/icons-material'
1718import { Dataset } from '../../types/api'
1819import { IState } from '../../store/reducers'
1920import { MqScreenLoad } from '../../components/core/screen-load/MqScreenLoad'
@@ -25,6 +26,7 @@ import { fetchDatasets, resetDatasets } from '../../store/actionCreators'
2526import { formatUpdatedAt } from '../../helpers'
2627import { useTheme } from '@emotion/react'
2728import Box from '@mui/material/Box'
29+ import CircularProgress from '@mui/material/CircularProgress/CircularProgress'
2830import IconButton from '@mui/material/IconButton'
2931import MqEmpty from '../../components/core/empty/MqEmpty'
3032import MqStatus from '../../components/core/status/MqStatus'
@@ -93,26 +95,58 @@ const Datasets: React.FC<DatasetsProps> = ({
9395 const i18next = require ( 'i18next' )
9496 return (
9597 < Container maxWidth = { 'lg' } disableGutters >
96- < MqScreenLoad loading = { isDatasetsLoading || ! isDatasetsInit } >
98+ < Box p = { 2 } display = { 'flex' } justifyContent = { 'space-between' } alignItems = { 'center' } >
99+ < Box display = { 'flex' } >
100+ < MqText heading > { i18next . t ( 'datasets_route.heading' ) } </ MqText >
101+ < Chip
102+ size = { 'small' }
103+ variant = { 'outlined' }
104+ color = { 'primary' }
105+ sx = { { marginLeft : 1 } }
106+ label = { totalCount + ' total' }
107+ > </ Chip >
108+ </ Box >
109+ < Box display = { 'flex' } alignItems = { 'center' } >
110+ { isDatasetsLoading && < CircularProgress size = { 16 } /> }
111+ < Tooltip title = { 'Refresh' } >
112+ < IconButton
113+ sx = { { ml : 2 } }
114+ color = { 'primary' }
115+ size = { 'small' }
116+ onClick = { ( ) => {
117+ if ( selectedNamespace ) {
118+ fetchDatasets ( selectedNamespace , PAGE_SIZE , state . page * PAGE_SIZE )
119+ }
120+ } }
121+ >
122+ < Refresh fontSize = { 'small' } />
123+ </ IconButton >
124+ </ Tooltip >
125+ </ Box >
126+ </ Box >
127+ < MqScreenLoad loading = { isDatasetsLoading && ! isDatasetsInit } >
97128 < >
98129 { datasets . length === 0 ? (
99130 < Box p = { 2 } >
100131 < MqEmpty title = { i18next . t ( 'datasets_route.empty_title' ) } >
101- < MqText subdued > { i18next . t ( 'datasets_route.empty_body' ) } </ MqText >
132+ < >
133+ < MqText subdued > { i18next . t ( 'datasets_route.empty_body' ) } </ MqText >
134+ < Button
135+ color = { 'primary' }
136+ size = { 'small' }
137+ onClick = { ( ) => {
138+ if ( selectedNamespace ) {
139+ fetchDatasets ( selectedNamespace , PAGE_SIZE , state . page * PAGE_SIZE )
140+ }
141+ } }
142+ >
143+ Refresh
144+ </ Button >
145+ </ >
102146 </ MqEmpty >
103147 </ Box >
104148 ) : (
105149 < >
106- < Box p = { 2 } display = { 'flex' } >
107- < MqText heading > { i18next . t ( 'datasets_route.heading' ) } </ MqText >
108- < Chip
109- size = { 'small' }
110- variant = { 'outlined' }
111- color = { 'primary' }
112- sx = { { marginLeft : 1 } }
113- label = { totalCount + ' total' }
114- > </ Chip >
115- </ Box >
116150 < Table size = 'small' >
117151 < TableHead >
118152 < TableRow >
0 commit comments