Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Response Ops] [Rule Form] Add Rule Form Flyout v2 #206685

Open
wants to merge 122 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
1ef801c
Hide close button when show request is open
Zacqary Jan 9, 2025
1faf112
Use EUI breakpoint variables for container breakpoints
Zacqary Jan 15, 2025
4cb5b1d
Revert "Use EUI breakpoint variables for container breakpoints"
Zacqary Jan 17, 2025
e5b287a
Decouple RuleForm component from react router
Zacqary Jan 13, 2025
74f59b7
Initially replace flyout in Discover plugin
Zacqary Jan 13, 2025
dd6e167
Replace add/edit rule flyouts with getRuleFormFlyout
Zacqary Jan 14, 2025
6dd013d
Remove missing import
Zacqary Jan 14, 2025
69eb8fa
Add isServerless flag to rule flyout
Zacqary Jan 14, 2025
74d5339
Fix metadata typing
Zacqary Jan 14, 2025
646af0f
Fix initialMetadata error
Zacqary Jan 14, 2025
d4c91d3
Add flyout close confirm and no actions callout
Zacqary Jan 14, 2025
2d61517
Fix action UI display papercuts
Zacqary Jan 14, 2025
1ffea47
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Jan 14, 2025
19f2fdc
Fix typecheck
Zacqary Jan 14, 2025
3e9ebe4
Fix bundle size
Zacqary Jan 14, 2025
70d4dab
Fix typecheck
Zacqary Jan 16, 2025
9c4d831
Lazy load rule form component from response ops package
Zacqary Jan 16, 2025
547c4da
Fix lazy loading rule form
Zacqary Jan 16, 2025
c2174d6
Begin fixing discover tests
Zacqary Jan 16, 2025
4719faf
Fix button ids on discover test
Zacqary Jan 16, 2025
51e33f9
Fix system actions test
Zacqary Jan 17, 2025
c25c283
Fix get app menu header id
Zacqary Jan 17, 2025
dc8c9ab
Fix cancelAlertFlyout function in ML anomaly tests
Zacqary Jan 17, 2025
114e98a
Fix monitor alerts journey for closing rule form flyout
Zacqary Jan 17, 2025
e3a0e7e
Create /components folder for common components
Zacqary Jan 22, 2025
dbc9712
Move confirm close modal to own component
Zacqary Jan 22, 2025
fd7abec
Replace flyout callouts and screens with confirm modals
Zacqary Jan 22, 2025
4dbc4f0
Merge branch 'main' into 195211-replace-flyout
elasticmachine Jan 23, 2025
b0f977b
Remove unused import
Zacqary Jan 23, 2025
4b806ac
Merge branch '195211-replace-flyout' of https://github.com/Zacqary/ki…
Zacqary Jan 23, 2025
13429c1
Fix ES query expression error display
Zacqary Jan 23, 2025
f557eb2
Fix errorParam ternary syntax
Zacqary Jan 23, 2025
286721f
Fix APM chypress test
Zacqary Jan 23, 2025
1fd34d0
Fix APM cypress test
Zacqary Jan 23, 2025
c437919
Reduce discover accessibility test flakiness
Zacqary Jan 23, 2025
dbbe03a
Fix data touched tracking
Zacqary Jan 23, 2025
f9f82ed
Fix custom threshold preview test
Zacqary Jan 23, 2025
f21566b
Fix monitor alerts journey
Zacqary Jan 23, 2025
0efa925
Merge remote-tracking branch 'upstream/main' into 195211-replace-flyout
Zacqary Jan 24, 2025
fb70192
Merge isServerless implementation from main
Zacqary Jan 24, 2025
4fd1228
Fix APM cypress
Zacqary Jan 24, 2025
f2e01b9
Fix some tests, improve loading prompty
Zacqary Jan 24, 2025
e6befaf
Fix initial metadata override
Zacqary Jan 24, 2025
07ee45a
Fix typecheck
Zacqary Jan 24, 2025
370a2b6
Fix i18n
Zacqary Jan 27, 2025
908d36c
Merge remote-tracking branch 'upstream/main' into 195211-replace-flyout
Zacqary Jan 27, 2025
52c6414
Fix uptime rule form flyout and observability rule params
Zacqary Jan 27, 2025
aa0287f
Fix uptime tests
Zacqary Jan 27, 2025
9ef99b5
Fix serverless search source test
Zacqary Jan 27, 2025
bb09a7d
Fix APM cypress
Zacqary Jan 27, 2025
d182820
Add debug logs to accessibility testing
Zacqary Jan 27, 2025
118a154
Fix synthetics journey
Zacqary Jan 27, 2025
b8a2e33
Fix APM cypress
Zacqary Jan 27, 2025
09d456d
Remove code path for experimental use of v1 flyout
Zacqary Jan 27, 2025
c89a707
Update synthetics journey
Zacqary Jan 28, 2025
565c974
Update uptime synthetic test and skip discover accessibility test
Zacqary Jan 28, 2025
def9107
Merge remote-tracking branch 'upstream/main' into 195211-replace-flyout
Zacqary Jan 28, 2025
3f16b58
Unskip discover accessibility test
Zacqary Jan 28, 2025
27cb8b3
Remove flyout loading check from discover test
Zacqary Jan 28, 2025
688c145
Update synthetics tests
Zacqary Jan 28, 2025
c3eff4f
Omit dataViews from RequiredRuleFormPlugins typedef
Zacqary Jan 29, 2025
3ef3181
Add encryption key to discover accessibility test
Zacqary Jan 29, 2025
756cfa8
Fix uptime journey
Zacqary Jan 29, 2025
95b14da
Merge remote-tracking branch 'upstream/main' into 195211-replace-flyout
Zacqary Jan 29, 2025
aa0abd0
Fix typecheck
Zacqary Jan 30, 2025
990a73c
Attempt synthetics test fix
Zacqary Jan 30, 2025
c4a2c9b
Merge remote-tracking branch 'upstream/main' into 195211-replace-flyout
Zacqary Jan 30, 2025
3772d57
Merge branch 'main' into 195211-replace-flyout
Zacqary Feb 3, 2025
319f869
Replace getRuleFormFlyout with RuleFormFlyoutLazy
Zacqary Feb 5, 2025
99c4dba
Ensure all solutions use required plugins for rule form
Zacqary Feb 5, 2025
9298807
Merge branch '195211-replace-flyout' of https://github.com/Zacqary/ki…
Zacqary Feb 5, 2025
0b991bf
[CI] Auto-commit changed files from 'ts-node .buildkite/pipeline-reso…
kibanamachine Feb 5, 2025
732ce23
Fix i18n
Zacqary Feb 5, 2025
4539f97
Merge remote-tracking branch 'upstream/main' into 195211-replace-flyout
Zacqary Feb 5, 2025
929ce73
Merge branch '195211-replace-flyout' of https://github.com/Zacqary/ki…
Zacqary Feb 5, 2025
e9948a2
Fix infra type imports
Zacqary Feb 7, 2025
944621a
Merge remote-tracking branch 'upstream/main' into 195211-replace-flyout
Zacqary Feb 7, 2025
699300b
[CI] Auto-commit changed files from 'node scripts/styled_components_m…
kibanamachine Feb 7, 2025
1f1f1a5
Fix SLO jest
Zacqary Feb 10, 2025
89f8aaa
Merge branch '195211-replace-flyout' of https://github.com/Zacqary/ki…
Zacqary Feb 10, 2025
0249c2d
Merge remote-tracking branch 'upstream/main' into 195211-replace-flyout
Zacqary Feb 10, 2025
0a01b81
Add i18n for default rule name
Zacqary Feb 10, 2025
42e12ee
Add missing action type handler to icon
Zacqary Feb 10, 2025
abb8326
Test isIncomplete functionality
Zacqary Feb 10, 2025
1013d20
Add comment for regex
Zacqary Feb 10, 2025
4453609
Move flyout wrapper into own lazy-load folder and improve loading dis…
Zacqary Feb 11, 2025
a8ffcf1
Merge remote-tracking branch 'upstream/main' into 195211-replace-flyout
Zacqary Feb 11, 2025
619a37b
Expand flyout to 620px
Zacqary Feb 11, 2025
850bb6b
Remove unnecessary export
Zacqary Feb 12, 2025
acaddb9
Make flyout resizable
Zacqary Feb 12, 2025
3ab44d2
Merge remote-tracking branch 'upstream/main' into 195211-replace-flyout
Zacqary Feb 12, 2025
fc004b0
Fix bad merge
Zacqary Feb 12, 2025
c1edbf3
Merge remote-tracking branch 'upstream/main' into 195211-replace-flyout
Zacqary Feb 13, 2025
2d229e6
Fix synthetics test
Zacqary Feb 14, 2025
30c3d46
Merge remote-tracking branch 'upstream/main' into 195211-replace-flyout
Zacqary Feb 14, 2025
f8b000b
Add comment explaining onClickClose
Zacqary Feb 18, 2025
75f6b91
Clarify initialValues typedef
Zacqary Feb 18, 2025
ce5d6d6
Remove unused isFlyout
Zacqary Feb 18, 2025
7797540
Remove regexes from form steps tests
Zacqary Feb 18, 2025
887b65d
Fix ruleformflyout name
Zacqary Feb 18, 2025
cee9258
Use eui-textBreakWord class
Zacqary Feb 18, 2025
c72958b
Remove getRuleFormFlyout from jest tests
Zacqary Feb 18, 2025
9e7716d
Merge remote-tracking branch 'upstream/main' into 195211-replace-flyout
Zacqary Feb 18, 2025
314d14c
Remove useNewRuleForm conditional
Zacqary Feb 18, 2025
e1fac6f
Revert discover accessibility test changes
Zacqary Feb 18, 2025
3b0f4aa
Merge remote-tracking branch 'upstream/main' into 195211-replace-flyout
Zacqary Feb 18, 2025
35acdb7
Merge remote-tracking branch 'upstream/main' into 195211-replace-flyout
Zacqary Feb 19, 2025
feb0c83
Use FieldsMetadata service instead of importing EcsFlat for template …
Zacqary Feb 19, 2025
8b13750
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Feb 19, 2025
9c5b11a
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Feb 19, 2025
b168e01
Fix lint
Zacqary Feb 19, 2025
30b89de
Merge branch '195211-replace-flyout' of https://github.com/Zacqary/ki…
Zacqary Feb 19, 2025
f4aff0f
Fix jest
Zacqary Feb 20, 2025
6e765ec
Merge remote-tracking branch 'upstream/main' into 195211-replace-flyout
Zacqary Feb 21, 2025
c015311
Make FieldsMetadata required
Zacqary Feb 21, 2025
85971c3
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Feb 21, 2025
587f5c2
[CI] Auto-commit changed files from 'ts-node .buildkite/pipeline-reso…
kibanamachine Feb 21, 2025
5e84003
Add error handling to rRuleActionsConnectorsBody
Zacqary Feb 21, 2025
fd7e080
Merge branch '195211-replace-flyout' of https://github.com/Zacqary/ki…
Zacqary Feb 21, 2025
9e3d7e9
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Feb 21, 2025
20c0821
Fix typecheck
Zacqary Feb 21, 2025
78cf8db
Merge branch '195211-replace-flyout' of https://github.com/Zacqary/ki…
Zacqary Feb 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export type RuleTypeWithDescription = RuleType<string, string> & { description?:
export type RuleTypeIndexWithDescriptions = Map<string, RuleTypeWithDescription>;

export type RuleTypeParams = Record<string, unknown>;
export type RuleTypeMetaData = Record<string, unknown>;

export interface RuleFormBaseErrors {
name?: string[];
Expand Down Expand Up @@ -104,7 +105,7 @@ export interface RuleTypeParamsExpressionProps<
metadata?: MetaData;
charts: ChartsPluginSetup;
data: DataPublicPluginStart;
dataViews: DataViewsPublicPluginStart;
dataViews?: DataViewsPublicPluginStart;
unifiedSearch: UnifiedSearchPublicPluginStart;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This export path is only for lazy loading the flyout. Importing `@kbn/response-ops-rule-form` directly generally increases a plugin's bundle size unnecessarily.

Flyout UI is handled at the root of this component to avoid UI glitches. We want to render loading states and the fully loaded flyout body within the same <EuiFlyout> component, otherwise the user will see multiple flyouts and overlay masks flickering in and out.

This should be the ONLY export path for contexts that use the rule form as a flyout and not as the full page.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export * from './rule_form_flyout';
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { EuiFlyoutResizable, EuiLoadingElastic } from '@elastic/eui';
import React, { Suspense, lazy, useCallback } from 'react';
import type { RuleFormProps } from '../src/rule_form';
import type { RuleTypeMetaData } from '../src/types';
import {
RuleFlyoutUIContextProvider,
useRuleFlyoutUIContext,
RuleFormErrorPromptWrapper,
} from '../lib';

const RuleForm: React.LazyExoticComponent<React.FC<RuleFormProps<any>>> = lazy(() =>
import('../src/rule_form').then((module) => ({ default: module.RuleForm }))
);

const RuleFormFlyoutRenderer = <MetaData extends RuleTypeMetaData>(
props: RuleFormProps<MetaData>
) => {
const { onClickClose, hideCloseButton } = useRuleFlyoutUIContext();
const onClose = useCallback(() => {
// If onClickClose has been initialized, call it instead of onCancel. onClickClose should be used to
// determine if the close confirmation modal should be shown. props.onCancel is passed down the component hierarchy
// and will be called 1) by onClickClose, if the confirmation modal doesn't need to be shown, or 2) by the confirm
// button on the confirmation modal
if (onClickClose) {
onClickClose();
} else {
// ONLY call props.onCancel directly from this level of the component hierarcht if onClickClose has not yet been initialized.
// This will only occur if the user tries to close the flyout while the Suspense fallback is still visible
props.onCancel?.();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we call props.onCancel either way? For example:

onClickClose?.();
props.onCancel?.();

}
}, [onClickClose, props]);
return (
<EuiFlyoutResizable
ownFocus
onClose={onClose}
aria-labelledby="flyoutTitle"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
aria-labelledby="flyoutTitle"
aria-labelledby="Rule form flyout"

Shouldn't also translate it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aria-labelledBy takes a DOM id, not a string

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I was not aware.

size={620}
minWidth={500}
className="ruleFormFlyout__container"
hideCloseButton={hideCloseButton}
>
<Suspense
fallback={
<RuleFormErrorPromptWrapper hasBorder={false} hasShadow={false}>
<EuiLoadingElastic size="xl" />
</RuleFormErrorPromptWrapper>
}
>
<RuleForm {...props} isFlyout />
</Suspense>
</EuiFlyoutResizable>
);
};

export const RuleFormFlyout = <MetaData extends RuleTypeMetaData>(
props: RuleFormProps<MetaData>
) => {
return (
<RuleFlyoutUIContextProvider>
<RuleFormFlyoutRenderer {...props} />
</RuleFlyoutUIContextProvider>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
export * from './src/types';
export * from './src/rule_type_modal';

export { RuleForm } from './src/rule_form';
export { RuleForm, type RuleFormProps } from './src/rule_form';

export {
fetchUiConfig,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This export path is for utility functions that might be necessary both for plugins that import from `@kbn/response-ops-rule-form` or from `@kbn/response-ops-rule-form/flyout` to keep their bundle size down.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export * from './is_valid_rule_form_plugins';
export * from './rule_flyout_ui_context';
export * from './rule_form_error_prompt_wrapper';
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import type { RuleFormProps } from '../src/rule_form';

const requiredPluginNames = [
'http',
'i18n',
'theme',
'userProfile',
'application',
'notifications',
'charts',
'settings',
'data',
'unifiedSearch',
'docLinks',
'dataViews',
'fieldsMetadata',
];

type RequiredRuleFormPlugins = Omit<
RuleFormProps['plugins'],
'actionTypeRegistry' | 'ruleTypeRegistry'
>;

export const isValidRuleFormPlugins = (input: unknown): input is RequiredRuleFormPlugins => {
if (typeof input !== 'object' || input === null) {
return false;
}

requiredPluginNames.forEach((pluginName) => {
if (!(pluginName in input)) {
// eslint-disable-next-line no-console
console.error(`RuleForm plugins is missing required plugin: ${pluginName}`);
return false;
}
});

return true;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import React, { createContext, useState } from 'react';

const initialRuleFlyoutUIContext: {
onClickClose: (() => void) | null;
hideCloseButton: boolean;
setOnClickClose: (onClickClose: () => void) => void;
setHideCloseButton: (hideCloseButton: boolean) => void;
} = {
onClickClose: null,
hideCloseButton: false,
setOnClickClose: () => {},
setHideCloseButton: () => {},
};

export const RuleFlyoutUIContext = createContext(initialRuleFlyoutUIContext);

export const RuleFlyoutUIContextProvider: React.FC<React.PropsWithChildren> = ({ children }) => {
const [onClickClose, setOnClickClose] = useState<(() => void) | null>(null);
const [hideCloseButton, setHideCloseButton] = useState<boolean>(false);
return (
<RuleFlyoutUIContext.Provider
value={{
onClickClose,
hideCloseButton,
setOnClickClose,
setHideCloseButton,
}}
>
{children}
</RuleFlyoutUIContext.Provider>
);
};

export const useRuleFlyoutUIContext = () => {
return React.useContext(RuleFlyoutUIContext);
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const RuleFormErrorPromptWrapper: React.FC<
const styles = {
backgroundColor: 'transparent',
};

return (
<EuiPageTemplate offset={0} css={styles}>
<EuiPageTemplate.EmptyPrompt paddingSize="none" hasBorder={hasBorder} hasShadow={hasShadow}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import React from 'react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { waitFor, renderHook } from '@testing-library/react';
import { httpServiceMock } from '@kbn/core/public/mocks';
import { EcsFlat } from '@elastic/ecs';

import { useLoadRuleTypeAadTemplateField } from './use_load_rule_type_aad_template_fields';

Expand All @@ -21,6 +22,14 @@ const wrapper = ({ children }: { children: React.ReactNode }) => (
);

const http = httpServiceMock.createStartContract();
const fieldsMetadataMock = {
useFieldsMetadata: jest.fn(),
getClient: jest.fn(() =>
Promise.resolve({
find: () => Promise.resolve({ fields: EcsFlat }),
})
),
};

describe('useLoadRuleTypeAadTemplateFields', () => {
beforeEach(() => {
Expand All @@ -43,6 +52,7 @@ describe('useLoadRuleTypeAadTemplateFields', () => {
() =>
useLoadRuleTypeAadTemplateField({
http,
fieldsMetadata: fieldsMetadataMock,
ruleTypeId: 'ruleTypeId',
enabled: true,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,42 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { EcsFlat } from '@elastic/ecs';
import { useRef } from 'react';
import { isEmpty } from 'lodash';
import { ActionVariable } from '@kbn/alerting-types';
import type { HttpStart } from '@kbn/core-http-browser';
import { useQuery } from '@tanstack/react-query';
import {
fetchRuleTypeAadTemplateFields,
getDescription,
} from '@kbn/alerts-ui-shared/src/common/apis';
import { FieldsMetadataPublicStart } from '@kbn/fields-metadata-plugin/public';

export interface UseLoadRuleTypeAadTemplateFieldProps {
http: HttpStart;
ruleTypeId?: string;
enabled: boolean;
cacheTime?: number;
fieldsMetadata?: FieldsMetadataPublicStart;
}

export const useLoadRuleTypeAadTemplateField = (props: UseLoadRuleTypeAadTemplateFieldProps) => {
const { http, ruleTypeId, enabled, cacheTime } = props;
const ecsFlat = useRef<Record<string, any>>({});
const { http, ruleTypeId, enabled, cacheTime, fieldsMetadata } = props;

const queryFn = async () => {
if (!ruleTypeId) {
return;
}

if (isEmpty(ecsFlat.current)) {
const fmClient = await fieldsMetadata?.getClient();
if (fmClient) {
const { fields } = await fmClient.find({});
ecsFlat.current = fields;
}
}

return fetchRuleTypeAadTemplateFields({ http, ruleTypeId });
};

Expand All @@ -44,7 +57,7 @@ export const useLoadRuleTypeAadTemplateField = (props: UseLoadRuleTypeAadTemplat
select: (dataViewFields) => {
return dataViewFields?.map<ActionVariable>((d) => ({
name: d.name,
description: getDescription(d.name, EcsFlat),
description: getDescription(d.name, ecsFlat.current),
}));
},
cacheTime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ import {
CONFIRM_RULE_SAVE_CONFIRM_BUTTON_TEXT,
CONFIRM_RULE_SAVE_CANCEL_BUTTON_TEXT,
CONFIRM_RULE_SAVE_MESSAGE_TEXT,
} from '../translations';
} from '../../translations';

export interface RulePageConfirmCreateRuleProps {
export interface ConfirmCreateRuleProps {
onCancel: () => void;
onConfirm: () => void;
}

export const RulePageConfirmCreateRule = (props: RulePageConfirmCreateRuleProps) => {
export const ConfirmCreateRule = (props: ConfirmCreateRuleProps) => {
const { onCancel, onConfirm } = props;

return (
<EuiConfirmModal
data-test-subj="rulePageConfirmCreateRule"
data-test-subj="confirmCreateRuleModal"
title={CONFIRMATION_RULE_SAVE_TITLE}
onCancel={onCancel}
onConfirm={onConfirm}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export * from './confirm_create_rule';
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import React from 'react';
import { EuiConfirmModal, EuiText } from '@elastic/eui';
import {
RULE_FORM_CANCEL_MODAL_TITLE,
RULE_FORM_CANCEL_MODAL_CONFIRM,
RULE_FORM_CANCEL_MODAL_CANCEL,
RULE_FORM_CANCEL_MODAL_DESCRIPTION,
} from '../../translations';

export interface ConfirmRuleCloseRuleProps {
onCancel: () => void;
onConfirm: () => void;
}

export const ConfirmRuleClose = (props: ConfirmRuleCloseRuleProps) => {
const { onCancel, onConfirm } = props;

return (
<EuiConfirmModal
onCancel={onCancel}
onConfirm={onConfirm}
data-test-subj="confirmRuleCloseModal"
buttonColor="danger"
defaultFocusedButton="confirm"
title={RULE_FORM_CANCEL_MODAL_TITLE}
confirmButtonText={RULE_FORM_CANCEL_MODAL_CONFIRM}
cancelButtonText={RULE_FORM_CANCEL_MODAL_CANCEL}
>
<EuiText>
<p>{RULE_FORM_CANCEL_MODAL_DESCRIPTION}</p>
</EuiText>
</EuiConfirmModal>
);
};
Loading