@@ -21,11 +21,15 @@ import { ActionNeededPrompt } from './prompts/action_needed_prompt';
2121interface Props {
2222 docLinks : Pick < DocLinksStart , 'ELASTIC_WEBSITE_URL' | 'DOC_LINK_VERSION' > ;
2323 http : HttpSetup ;
24+ alignToTop ?: boolean ;
2425}
2526
26- export const HealthCheck : React . FunctionComponent < Props > = ( { docLinks, http, children } ) => {
27- const { ELASTIC_WEBSITE_URL , DOC_LINK_VERSION } = docLinks ;
28-
27+ export const HealthCheck : React . FunctionComponent < Props > = ( {
28+ docLinks,
29+ http,
30+ children,
31+ alignToTop = false ,
32+ } ) => {
2933 const [ alertingHealth , setAlertingHealth ] = React . useState < Option < AlertingFrameworkHealth > > ( none ) ;
3034
3135 React . useEffect ( ( ) => {
@@ -42,68 +46,82 @@ export const HealthCheck: React.FunctionComponent<Props> = ({ docLinks, http, ch
4246 return healthCheck ?. isSufficientlySecure && healthCheck ?. hasPermanentEncryptionKey ? (
4347 < Fragment > { children } </ Fragment >
4448 ) : (
45- < ActionNeededPrompt >
46- { ! healthCheck . isSufficientlySecure && ! healthCheck . hasPermanentEncryptionKey ? (
47- < p role = "banner" >
48- { i18n . translate (
49- 'xpack.triggersActionsUI.components.healthCheck.tlsAndEncryptionError' ,
50- {
51- defaultMessage :
52- 'Alerting relies on API keys, which require TLS between Elasticsearch and Kibana, and a permanent Encryption Key. Learn how to ' ,
53- }
54- ) }
55- < EuiLink
56- href = { `${ ELASTIC_WEBSITE_URL } guide/en/kibana/${ DOC_LINK_VERSION } /alerting-getting-started.html#alerting-setup-prerequisites` }
57- external
58- target = "_blank"
59- >
60- { i18n . translate (
61- 'xpack.triggersActionsUI.components.healthCheck.tlsAndEncryptionErrorAction' ,
62- {
63- defaultMessage : 'enable TLS and a permanent Encryption Key' ,
64- }
65- ) }
66- </ EuiLink >
67- </ p >
68- ) : ! healthCheck . hasPermanentEncryptionKey ? (
69- < p role = "banner" >
70- { i18n . translate ( 'xpack.triggersActionsUI.components.healthCheck.encryptionError' , {
71- defaultMessage :
72- 'Alerting relies on API keys, which requires a permanent Encryption Key. Learn how to ' ,
73- } ) }
74- < EuiLink
75- href = { `${ ELASTIC_WEBSITE_URL } guide/en/kibana/${ DOC_LINK_VERSION } /alert-action-settings-kb.html#general-alert-action-settings` }
76- external
77- target = "_blank"
78- >
79- { i18n . translate (
80- 'xpack.triggersActionsUI.components.healthCheck.encryptionErrorAction' ,
81- {
82- defaultMessage : 'set a permanent Encryption Key' ,
83- }
84- ) }
85- </ EuiLink >
86- </ p >
87- ) : (
88- < p role = "banner" >
89- { i18n . translate ( 'xpack.triggersActionsUI.components.healthCheck.tlsError' , {
90- defaultMessage :
91- 'Alerting relies on API keys, which require TLS between Elasticsearch and Kibana. Learn how to ' ,
92- } ) }
93- < EuiLink
94- href = { `${ ELASTIC_WEBSITE_URL } guide/en/kibana/${ DOC_LINK_VERSION } /configuring-tls.html` }
95- external
96- target = "_blank"
97- >
98- { i18n . translate ( 'xpack.triggersActionsUI.components.healthCheck.tlsErrorAction' , {
99- defaultMessage : 'enable TLS' ,
100- } ) }
101- </ EuiLink >
102- </ p >
103- ) }
49+ < ActionNeededPrompt style = { alignToTop ? { marginTop : '1em ' } : { } } >
50+ < p role = "banner" >
51+ { ! healthCheck . isSufficientlySecure && ! healthCheck . hasPermanentEncryptionKey ? (
52+ < TlsAndEncryptionError docLinks = { docLinks } />
53+ ) : ! healthCheck . hasPermanentEncryptionKey ? (
54+ < EncryptionError docLinks = { docLinks } />
55+ ) : (
56+ < TlsError docLinks = { docLinks } />
57+ ) }
58+ </ p >
10459 </ ActionNeededPrompt >
10560 ) ;
10661 }
10762 )
10863 ) ;
10964} ;
65+
66+ const TlsAndEncryptionError = ( {
67+ docLinks : { ELASTIC_WEBSITE_URL , DOC_LINK_VERSION } ,
68+ } : Pick < Props , 'docLinks' > ) => (
69+ < Fragment >
70+ { i18n . translate ( 'xpack.triggersActionsUI.components.healthCheck.tlsAndEncryptionError' , {
71+ defaultMessage :
72+ 'Alerting relies on API keys, which require TLS between Elasticsearch and Kibana, and a permanent Encryption Key. Learn how to ' ,
73+ } ) }
74+ < EuiLink
75+ href = { `${ ELASTIC_WEBSITE_URL } guide/en/kibana/${ DOC_LINK_VERSION } /alerting-getting-started.html#alerting-setup-prerequisites` }
76+ external
77+ target = "_blank"
78+ >
79+ { i18n . translate (
80+ 'xpack.triggersActionsUI.components.healthCheck.tlsAndEncryptionErrorAction' ,
81+ {
82+ defaultMessage : 'enable TLS and a permanent Encryption Key' ,
83+ }
84+ ) }
85+ </ EuiLink >
86+ </ Fragment >
87+ ) ;
88+
89+ const EncryptionError = ( {
90+ docLinks : { ELASTIC_WEBSITE_URL , DOC_LINK_VERSION } ,
91+ } : Pick < Props , 'docLinks' > ) => (
92+ < Fragment >
93+ { i18n . translate ( 'xpack.triggersActionsUI.components.healthCheck.encryptionError' , {
94+ defaultMessage :
95+ 'Alerting relies on API keys, which requires a permanent Encryption Key. Learn how to ' ,
96+ } ) }
97+ < EuiLink
98+ href = { `${ ELASTIC_WEBSITE_URL } guide/en/kibana/${ DOC_LINK_VERSION } /alert-action-settings-kb.html#general-alert-action-settings` }
99+ external
100+ target = "_blank"
101+ >
102+ { i18n . translate ( 'xpack.triggersActionsUI.components.healthCheck.encryptionErrorAction' , {
103+ defaultMessage : 'set a permanent Encryption Key' ,
104+ } ) }
105+ </ EuiLink >
106+ </ Fragment >
107+ ) ;
108+
109+ const TlsError = ( {
110+ docLinks : { ELASTIC_WEBSITE_URL , DOC_LINK_VERSION } ,
111+ } : Pick < Props , 'docLinks' > ) => (
112+ < Fragment >
113+ { i18n . translate ( 'xpack.triggersActionsUI.components.healthCheck.tlsError' , {
114+ defaultMessage :
115+ 'Alerting relies on API keys, which require TLS between Elasticsearch and Kibana. Learn how to ' ,
116+ } ) }
117+ < EuiLink
118+ href = { `${ ELASTIC_WEBSITE_URL } guide/en/kibana/${ DOC_LINK_VERSION } /configuring-tls.html` }
119+ external
120+ target = "_blank"
121+ >
122+ { i18n . translate ( 'xpack.triggersActionsUI.components.healthCheck.tlsErrorAction' , {
123+ defaultMessage : 'enable TLS' ,
124+ } ) }
125+ </ EuiLink >
126+ </ Fragment >
127+ ) ;
0 commit comments