1
1
import { useCluster } from '@kinvolk/headlamp-plugin/lib/k8s' ;
2
2
import { Button , Grid , Link , Paper , Typography } from '@mui/material' ;
3
- import makeStyles from '@mui/styles/makeStyles ' ;
3
+ import { styled } from '@mui/material/styles ' ;
4
4
import { useHistory } from 'react-router-dom' ;
5
5
import skeletonImg from '../../../assets/chart-skeleton.png' ;
6
6
import { disableMetrics } from '../../util' ;
7
7
import { formatBytes , PLUGIN_NAME } from '../../util' ;
8
8
9
9
const learnMoreLink = 'https://github.com/headlamp-k8s/plugins/tree/main/prometheus#readme' ;
10
10
11
- const useStyles = makeStyles ( theme => ( {
12
- skeletonBox : {
13
- backgroundImage : `url(${ skeletonImg } )` ,
14
- backgroundSize : 'contain' ,
15
- backgroundRepeat : 'no-repeat' ,
16
- backgroundPositionX : 'center' ,
17
- height : '450px' ,
18
- color : theme . palette . common . black ,
19
- } ,
20
- dismissButton : {
21
- backgroundColor : theme . palette . common . black ,
22
- color : theme . palette . common . white ,
23
- '&:hover' : {
24
- color : theme . palette . primary . text ,
25
- } ,
11
+ const StyledGrid = styled ( Grid ) ( ( { theme } ) => ( {
12
+ backgroundImage : `url(${ skeletonImg } )` ,
13
+ backgroundSize : 'contain' ,
14
+ backgroundRepeat : 'no-repeat' ,
15
+ backgroundPositionX : 'center' ,
16
+ height : '450px' ,
17
+ color : theme . palette . common . black ,
18
+ } ) ) ;
19
+
20
+ const DismissButton = styled ( Button ) ( ( { theme } ) => ( {
21
+ backgroundColor : theme . palette . common . black ,
22
+ color : theme . palette . common . white ,
23
+ '&:hover' : {
24
+ color : theme . palette . primary . text ,
26
25
} ,
27
26
} ) ) ;
28
27
@@ -31,18 +30,16 @@ const useStyles = makeStyles(theme => ({
31
30
* @returns {JSX.Element }
32
31
*/
33
32
export function PrometheusNotFoundBanner ( ) {
34
- const classes = useStyles ( ) ;
35
33
const cluster = useCluster ( ) ;
36
34
const history = useHistory ( ) ;
37
35
38
36
return (
39
- < Grid
37
+ < StyledGrid
40
38
container
41
39
spacing = { 2 }
42
40
direction = "column"
43
41
justifyContent = "center"
44
42
alignItems = "center"
45
- className = { classes . skeletonBox }
46
43
>
47
44
< Grid item >
48
45
< Typography variant = "h5" > Couldn't detect Prometheus in your cluster.</ Typography >
@@ -67,16 +64,11 @@ export function PrometheusNotFoundBanner() {
67
64
</ Typography >
68
65
</ Grid >
69
66
< Grid item >
70
- < Button
71
- className = { classes . dismissButton }
72
- size = "small"
73
- variant = "contained"
74
- onClick = { ( ) => disableMetrics ( cluster ) }
75
- >
67
+ < DismissButton size = "small" variant = "contained" onClick = { ( ) => disableMetrics ( cluster ) } >
76
68
Dismiss
77
- </ Button >
69
+ </ DismissButton >
78
70
</ Grid >
79
- </ Grid >
71
+ </ StyledGrid >
80
72
) ;
81
73
}
82
74
0 commit comments