@@ -30,6 +30,43 @@ const useStyles = makeStyles(theme => ({
30
30
} ,
31
31
} ) ) ;
32
32
33
+ function InstallPrometheusBanner ( ) {
34
+ const classes = useStyles ( ) ;
35
+ const pluginSettings = usePluginSettings ( ) ;
36
+
37
+ return (
38
+ < Grid
39
+ container
40
+ spacing = { 2 }
41
+ direction = "column"
42
+ justifyContent = "center"
43
+ alignItems = "center"
44
+ className = { classes . skeletonBox }
45
+ >
46
+ < Grid item >
47
+ < Typography variant = "h5" > Install Prometheus for accessing metrics charts</ Typography >
48
+ </ Grid >
49
+ < Grid item >
50
+ < Typography >
51
+ < Link href = { learnMoreLink } target = "_blank" >
52
+ Learn more about enabling advanced charts.
53
+ </ Link >
54
+ </ Typography >
55
+ </ Grid >
56
+ < Grid item >
57
+ < Button
58
+ className = { classes . dismissButton }
59
+ size = "small"
60
+ variant = "contained"
61
+ onClick = { ( ) => pluginSettings . setIsVisible ( false ) }
62
+ >
63
+ Dismiss
64
+ </ Button >
65
+ </ Grid >
66
+ </ Grid >
67
+ )
68
+ }
69
+
33
70
export function GenericMetricsChart ( props : {
34
71
cpuQuery : string ;
35
72
memoryQuery : string ;
@@ -45,7 +82,6 @@ export function GenericMetricsChart(props: {
45
82
INSTALLED ,
46
83
}
47
84
48
- const classes = useStyles ( ) ;
49
85
const pluginSettings = usePluginSettings ( ) ;
50
86
const [ chartVariant , setChartVariant ] = useState < string > ( 'cpu' ) ;
51
87
const [ refresh , setRefresh ] = useState < boolean > ( true ) ;
@@ -160,35 +196,7 @@ export function GenericMetricsChart(props: {
160
196
< Alert severity = "warning" > Error fetching prometheus Info</ Alert >
161
197
</ Box >
162
198
) : (
163
- < Grid
164
- container
165
- spacing = { 2 }
166
- direction = "column"
167
- justifyContent = "center"
168
- alignItems = "center"
169
- className = { classes . skeletonBox }
170
- >
171
- < Grid item >
172
- < Typography variant = "h5" > Install Prometheus for accessing metrics charts</ Typography >
173
- </ Grid >
174
- < Grid item >
175
- < Typography >
176
- < Link href = { learnMoreLink } target = "_blank" >
177
- Learn more about enabling advanced charts.
178
- </ Link >
179
- </ Typography >
180
- </ Grid >
181
- < Grid item >
182
- < Button
183
- className = { classes . dismissButton }
184
- size = "small"
185
- variant = "contained"
186
- onClick = { ( ) => pluginSettings . setIsVisible ( false ) }
187
- >
188
- Dismiss
189
- </ Button >
190
- </ Grid >
191
- </ Grid >
199
+ < InstallPrometheusBanner />
192
200
) }
193
201
</ SectionBox >
194
202
) ;
@@ -205,7 +213,6 @@ export function DiskMetricsChart(props: {
205
213
INSTALLED ,
206
214
}
207
215
208
- const classes = useStyles ( ) ;
209
216
const pluginSettings = usePluginSettings ( ) ;
210
217
const [ refresh , setRefresh ] = useState < boolean > ( true ) ;
211
218
@@ -281,35 +288,7 @@ export function DiskMetricsChart(props: {
281
288
< Alert severity = "warning" > Error fetching prometheus Info</ Alert >
282
289
</ Box >
283
290
) : (
284
- < Grid
285
- container
286
- spacing = { 2 }
287
- direction = "column"
288
- justifyContent = "center"
289
- alignItems = "center"
290
- className = { classes . skeletonBox }
291
- >
292
- < Grid item >
293
- < Typography variant = "h5" > Install Prometheus for accessing metrics charts</ Typography >
294
- </ Grid >
295
- < Grid item >
296
- < Typography >
297
- < Link href = { learnMoreLink } target = "_blank" >
298
- Learn more about enabling advanced charts.
299
- </ Link >
300
- </ Typography >
301
- </ Grid >
302
- < Grid item >
303
- < Button
304
- className = { classes . dismissButton }
305
- size = "small"
306
- variant = "contained"
307
- onClick = { ( ) => pluginSettings . setIsVisible ( false ) }
308
- >
309
- Dismiss
310
- </ Button >
311
- </ Grid >
312
- </ Grid >
291
+ < InstallPrometheusBanner />
313
292
) }
314
293
</ SectionBox >
315
294
) ;
0 commit comments