1
- import { ColoredIconProps , GreenCheckCircleIcon , RedExclamationCircleIcon , YellowExclamationTriangleIcon } from '@openshift-console/dynamic-plugin-sdk' ;
1
+ import {
2
+ ColoredIconProps ,
3
+ GreenCheckCircleIcon ,
4
+ RedExclamationCircleIcon ,
5
+ YellowExclamationTriangleIcon ,
6
+ } from '@openshift-console/dynamic-plugin-sdk' ;
2
7
import { Icon } from '@patternfly/react-core' ;
3
8
import { UnknownIcon } from '@patternfly/react-icons' ;
4
9
import * as React from 'react' ;
5
10
import { css } from '@patternfly/react-styles' ;
6
11
import { useTranslation } from 'react-i18next' ;
7
12
8
13
type CamelAppHealthProps = {
9
- health : string ;
14
+ health : string ;
10
15
} ;
11
16
12
17
const CamelAppHealth : React . FC < CamelAppHealthProps > = ( { health } ) => {
13
- const { t } = useTranslation ( 'plugin__camel-openshift-console-plugin' ) ;
14
- // FIXME: manage undefined
15
- switch ( health . toLowerCase ( ) ) {
16
- case 'ok' :
17
- return (
18
- < > < GreenCheckCircleIcon title = { t ( health ) } /> { t ( health ) } </ >
19
- ) ;
20
- case 'warning' :
21
- return (
22
- < > < YellowExclamationTriangleIcon title = { t ( health ) } /> { t ( health ) } </ >
23
- ) ;
24
- case 'error' :
25
- return (
26
- < > < RedExclamationCircleIcon title = { t ( health ) } /> { t ( health ) } </ >
27
- ) ;
28
- default :
29
- return (
30
- < > < GrayUnknownIcon title = { t ( 'Unknown' ) } /> { t ( 'Unknown' ) } </ >
31
- ) ;
32
- }
33
-
34
- }
18
+ const { t } = useTranslation ( 'plugin__camel-openshift-console-plugin' ) ;
19
+ // FIXME: manage undefined
20
+ switch ( health . toLowerCase ( ) ) {
21
+ case 'ok' :
22
+ return (
23
+ < >
24
+ < GreenCheckCircleIcon title = { t ( health ) } />
25
+ { t ( health ) }
26
+ </ >
27
+ ) ;
28
+ case 'warning' :
29
+ return (
30
+ < >
31
+ < YellowExclamationTriangleIcon title = { t ( health ) } />
32
+ { t ( health ) }
33
+ </ >
34
+ ) ;
35
+ case 'error' :
36
+ return (
37
+ < >
38
+ < RedExclamationCircleIcon title = { t ( health ) } />
39
+ { t ( health ) }
40
+ </ >
41
+ ) ;
42
+ default :
43
+ return (
44
+ < >
45
+ < GrayUnknownIcon title = { t ( 'Unknown' ) } />
46
+ { t ( 'Unknown' ) }
47
+ </ >
48
+ ) ;
49
+ }
50
+ } ;
35
51
36
52
export const GrayUnknownIcon : React . FC < ColoredIconProps > = ( { className, title, size } ) => {
37
- const icon = (
38
- < UnknownIcon
39
- data-test = "unknown-icon"
40
- className = { css ( 'unknown-icon' , className ) }
41
- title = { title }
42
- />
43
- ) ;
44
- if ( size ) {
45
- return < Icon size = { size } > { icon } </ Icon > ;
46
- }
47
- return icon ;
53
+ const icon = (
54
+ < UnknownIcon
55
+ data-test = "unknown-icon"
56
+ className = { css ( 'unknown-icon' , className ) }
57
+ title = { title }
58
+ />
59
+ ) ;
60
+ if ( size ) {
61
+ return < Icon size = { size } > { icon } </ Icon > ;
62
+ }
63
+ return icon ;
48
64
} ;
49
65
50
-
51
- export default CamelAppHealth ;
66
+ export default CamelAppHealth ;
0 commit comments