Skip to content

Commit

Permalink
[Alerting UI] Changed alerting UIs use new rule APIs. (elastic#96018) (
Browse files Browse the repository at this point in the history
…elastic#96426)

* [Alerting UI] Changed alerting UIs use new rule APIs.

* added unit tests

* fixed types

* fixed types

* fixed types

* fixed due to comments
  • Loading branch information
YulNaumenko authored Apr 7, 2021
1 parent d6f0730 commit aedd603
Show file tree
Hide file tree
Showing 41 changed files with 2,033 additions and 1,181 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@ describe('health check', () => {

it('renders children if keys are enabled', async () => {
useKibanaMock().services.http.get = jest.fn().mockResolvedValue({
isSufficientlySecure: true,
hasPermanentEncryptionKey: true,
is_sufficiently_secure: true,
has_permanent_encryption_key: true,
alerting_framework_heath: {
decryption_health: { status: 'ok', timestamp: '2021-04-01T21:29:22.991Z' },
execution_health: { status: 'ok', timestamp: '2021-04-01T21:29:22.991Z' },
read_health: { status: 'ok', timestamp: '2021-04-01T21:29:22.991Z' },
},
isAlertsAvailable: true,
});
const { queryByText } = render(
Expand All @@ -78,8 +83,13 @@ describe('health check', () => {

test('renders warning if TLS is required', async () => {
useKibanaMock().services.http.get = jest.fn().mockImplementation(async () => ({
isSufficientlySecure: false,
hasPermanentEncryptionKey: true,
is_sufficiently_secure: false,
has_permanent_encryption_key: true,
alerting_framework_heath: {
decryption_health: { status: 'ok', timestamp: '2021-04-01T21:29:22.991Z' },
execution_health: { status: 'ok', timestamp: '2021-04-01T21:29:22.991Z' },
read_health: { status: 'ok', timestamp: '2021-04-01T21:29:22.991Z' },
},
isAlertsAvailable: true,
}));
const { queryAllByText } = render(
Expand Down Expand Up @@ -110,8 +120,13 @@ describe('health check', () => {

test('renders warning if encryption key is ephemeral', async () => {
useKibanaMock().services.http.get = jest.fn().mockImplementation(async () => ({
isSufficientlySecure: true,
hasPermanentEncryptionKey: false,
is_sufficiently_secure: true,
has_permanent_encryption_key: false,
alerting_framework_heath: {
decryption_health: { status: 'ok', timestamp: '2021-04-01T21:29:22.991Z' },
execution_health: { status: 'ok', timestamp: '2021-04-01T21:29:22.991Z' },
read_health: { status: 'ok', timestamp: '2021-04-01T21:29:22.991Z' },
},
isAlertsAvailable: true,
}));
const { queryByText, queryByRole } = render(
Expand Down Expand Up @@ -139,8 +154,13 @@ describe('health check', () => {

test('renders warning if encryption key is ephemeral and keys are disabled', async () => {
useKibanaMock().services.http.get = jest.fn().mockImplementation(async () => ({
isSufficientlySecure: false,
hasPermanentEncryptionKey: false,
is_sufficiently_secure: false,
has_permanent_encryption_key: false,
alerting_framework_heath: {
decryption_health: { status: 'ok', timestamp: '2021-04-01T21:29:22.991Z' },
execution_health: { status: 'ok', timestamp: '2021-04-01T21:29:22.991Z' },
read_health: { status: 'ok', timestamp: '2021-04-01T21:29:22.991Z' },
},
isAlertsAvailable: true,
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import { i18n } from '@kbn/i18n';

import { EuiEmptyPrompt, EuiCode } from '@elastic/eui';
import { DocLinksStart } from 'kibana/public';
import { alertingFrameworkHealth } from '../lib/alert_api';
import './health_check.scss';
import { useHealthContext } from '../context/health_context';
import { useKibana } from '../../common/lib/kibana';
import { CenterJustifiedSpinner } from './center_justified_spinner';
import { triggersActionsUiHealth } from '../../common/lib/health_api';
import { alertingFrameworkHealth } from '../lib/alert_api';

interface Props {
inFlyout?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

import { i18n } from '@kbn/i18n';

export { LEGACY_BASE_ALERT_API_PATH } from '../../../../alerting/common';
export {
BASE_ALERTING_API_PATH,
INTERNAL_BASE_ALERTING_API_PATH,
} from '../../../../alerting/common';
export { BASE_ACTION_API_PATH } from '../../../../actions/common';

export type Section = 'connectors' | 'rules';
Expand Down
Loading

0 comments on commit aedd603

Please sign in to comment.