Skip to content

Commit edf687f

Browse files
authored
Loading text on TableWrapper (#135)
1 parent cb60eba commit edf687f

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

portal-ui/src/screens/Console/Common/TableWrapper/TableWrapper.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
Paper,
2828
Grid,
2929
Checkbox,
30+
Typography,
3031
} from "@material-ui/core";
3132
import { createStyles, Theme, withStyles } from "@material-ui/core/styles";
3233
import { TablePaginationActionsProps } from "@material-ui/core/TablePagination/TablePaginationActions";
@@ -103,6 +104,7 @@ const styles = (theme: Theme) =>
103104
overflow: "auto",
104105
flexDirection: "column",
105106
padding: "19px 38px",
107+
minHeight: "200px",
106108
},
107109
minTableHeader: {
108110
color: "#393939",
@@ -148,6 +150,10 @@ const styles = (theme: Theme) =>
148150
checkBoxRow: {
149151
borderColor: borderColor,
150152
},
153+
loadingBox: {
154+
paddingTop: "100px",
155+
paddingBottom: "100px",
156+
},
151157
});
152158

153159
// Function that renders Title Columns
@@ -226,7 +232,16 @@ const TableWrapper = ({
226232
return (
227233
<Grid item xs={12}>
228234
<Paper className={classes.paper}>
229-
{isLoading && <LinearProgress />}
235+
{isLoading && (
236+
<Grid container className={classes.loadingBox}>
237+
<Grid item xs={12} style={{ textAlign: "center" }}>
238+
<Typography component="h3">Loading...</Typography>
239+
</Grid>
240+
<Grid item xs={12}>
241+
<LinearProgress />
242+
</Grid>
243+
</Grid>
244+
)}
230245
{records && records.length > 0 ? (
231246
<Table size="small" stickyHeader={stickyHeader}>
232247
<TableHead className={classes.minTableHeader}>
@@ -298,7 +313,9 @@ const TableWrapper = ({
298313
</TableBody>
299314
</Table>
300315
) : (
301-
<div>{`There are no ${entityName} yet.`}</div>
316+
<React.Fragment>
317+
{!isLoading && <div>{`There are no ${entityName} yet.`}</div>}
318+
</React.Fragment>
302319
)}
303320
</Paper>
304321
{paginatorConfig && (

0 commit comments

Comments
 (0)