diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index df69c0e9e996aa..a864b7ee9aa27d 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -20285,7 +20285,6 @@
"xpack.triggersActionsUI.sections.addModalConnectorForm.saveButtonLabel": "保存",
"xpack.triggersActionsUI.sections.addModalConnectorForm.updateSuccessNotificationText": "「{connectorName}」を作成しました",
"xpack.triggersActionsUI.sections.alertAdd.betaBadgeTooltipContent": "{pluginName} はベータ段階で、変更される可能性があります。デザインとコードはオフィシャル GA 機能よりも完成度が低く、現状のまま保証なしで提供されています。ベータ機能にはオフィシャル GA 機能の SLA が適用されません。",
- "xpack.triggersActionsUI.sections.alertAdd.cancelButtonLabel": "キャンセル",
"xpack.triggersActionsUI.sections.alertAdd.conditionPrompt": "条件を定義してください",
"xpack.triggersActionsUI.sections.alertAdd.errorLoadingAlertVisualizationTitle": "アラートビジュアライゼーションを読み込めません",
"xpack.triggersActionsUI.sections.alertAdd.flyoutTitle": "アラートの作成",
@@ -20293,7 +20292,6 @@
"xpack.triggersActionsUI.sections.alertAdd.loadingAlertVisualizationDescription": "アラートビジュアライゼーションを読み込み中...",
"xpack.triggersActionsUI.sections.alertAdd.operationName": "作成",
"xpack.triggersActionsUI.sections.alertAdd.previewAlertVisualizationDescription": "プレビューを生成するための式を完成します。",
- "xpack.triggersActionsUI.sections.alertAdd.saveButtonLabel": "保存",
"xpack.triggersActionsUI.sections.alertAdd.saveErrorNotificationText": "アラートを作成できません。",
"xpack.triggersActionsUI.sections.alertAdd.saveSuccessNotificationText": "「{alertName}」 を保存しました",
"xpack.triggersActionsUI.sections.alertAdd.selectIndex": "インデックスを選択してください",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index 767e27c16e86ed..a53ebe41b899df 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -20305,7 +20305,6 @@
"xpack.triggersActionsUI.sections.addModalConnectorForm.saveButtonLabel": "保存",
"xpack.triggersActionsUI.sections.addModalConnectorForm.updateSuccessNotificationText": "已创建“{connectorName}”",
"xpack.triggersActionsUI.sections.alertAdd.betaBadgeTooltipContent": "{pluginName} 为公测版,可能会进行更改。设计和代码相对于正式发行版功能还不够成熟,将按原样提供,且不提供任何保证。公测版功能不受正式发行版功能支持 SLA 的约束。",
- "xpack.triggersActionsUI.sections.alertAdd.cancelButtonLabel": "取消",
"xpack.triggersActionsUI.sections.alertAdd.conditionPrompt": "定义条件",
"xpack.triggersActionsUI.sections.alertAdd.errorLoadingAlertVisualizationTitle": "无法加载告警可视化",
"xpack.triggersActionsUI.sections.alertAdd.flyoutTitle": "创建告警",
@@ -20313,7 +20312,6 @@
"xpack.triggersActionsUI.sections.alertAdd.loadingAlertVisualizationDescription": "正在加载告警可视化……",
"xpack.triggersActionsUI.sections.alertAdd.operationName": "创建",
"xpack.triggersActionsUI.sections.alertAdd.previewAlertVisualizationDescription": "完成表达式以生成预览。",
- "xpack.triggersActionsUI.sections.alertAdd.saveButtonLabel": "保存",
"xpack.triggersActionsUI.sections.alertAdd.saveErrorNotificationText": "无法创建告警。",
"xpack.triggersActionsUI.sections.alertAdd.saveSuccessNotificationText": "已保存“{alertName}”",
"xpack.triggersActionsUI.sections.alertAdd.selectIndex": "选择索引",
diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.test.tsx
index 1d908920db8b0d..a7de73c9aab295 100644
--- a/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.test.tsx
+++ b/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.test.tsx
@@ -10,6 +10,7 @@ import { HealthCheck } from './health_check';
import { act } from 'react-dom/test-utils';
import { httpServiceMock } from '../../../../../../src/core/public/mocks';
+import { HealthContextProvider } from '../context/health_context';
const docLinks = { ELASTIC_WEBSITE_URL: 'elastic.co/', DOC_LINK_VERSION: 'current' };
@@ -20,9 +21,11 @@ describe('health check', () => {
http.get.mockImplementationOnce(() => new Promise(() => {}));
const { queryByText, container } = render(
-
- {'shouldnt render'}
-
+
+
+ {'shouldnt render'}
+
+
);
await act(async () => {
// wait for useEffect to run
@@ -32,13 +35,33 @@ describe('health check', () => {
expect(queryByText('shouldnt render')).not.toBeInTheDocument();
});
+ it('renders children immediately if waitForCheck is false', async () => {
+ http.get.mockImplementationOnce(() => new Promise(() => {}));
+
+ const { queryByText, container } = render(
+
+
+ {'should render'}
+
+
+ );
+ await act(async () => {
+ // wait for useEffect to run
+ });
+
+ expect(container.getElementsByClassName('euiLoadingSpinner').length).toBe(0);
+ expect(queryByText('should render')).toBeInTheDocument();
+ });
+
it('renders children if keys are enabled', async () => {
http.get.mockResolvedValue({ isSufficientlySecure: true, hasPermanentEncryptionKey: true });
const { queryByText } = render(
-
- {'should render'}
-
+
+
+ {'should render'}
+
+
);
await act(async () => {
// wait for useEffect to run
@@ -53,9 +76,11 @@ describe('health check', () => {
}));
const { queryAllByText } = render(
-
- {'should render'}
-
+
+
+ {'should render'}
+
+
);
await act(async () => {
// wait for useEffect to run
@@ -81,9 +106,11 @@ describe('health check', () => {
}));
const { queryByText, queryByRole } = render(
-
- {'should render'}
-
+
+
+ {'should render'}
+
+
);
await act(async () => {
// wait for useEffect to run
@@ -108,9 +135,11 @@ describe('health check', () => {
}));
const { queryByText } = render(
-
- {'should render'}
-
+
+
+ {'should render'}
+
+
);
await act(async () => {
// wait for useEffect to run
diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.tsx
index 009f5824247654..c4d0b4976266e0 100644
--- a/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.tsx
+++ b/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.tsx
@@ -18,33 +18,39 @@ import { EuiEmptyPrompt, EuiCode } from '@elastic/eui';
import { AlertingFrameworkHealth } from '../../types';
import { health } from '../lib/alert_api';
import './health_check.scss';
+import { useHealthContext } from '../context/health_context';
interface Props {
docLinks: Pick;
http: HttpSetup;
inFlyout?: boolean;
+ waitForCheck: boolean;
}
export const HealthCheck: React.FunctionComponent = ({
docLinks,
http,
children,
+ waitForCheck,
inFlyout = false,
}) => {
+ const { setLoadingHealthCheck } = useHealthContext();
const [alertingHealth, setAlertingHealth] = React.useState