Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] [Response Ops] [Rule Form] Add Show Request and Add Action scre…
…ens to flyout (#206154) (#207903) # Backport This will backport the following commits from `main` to `8.x`: - [[Response Ops] [Rule Form] Add Show Request and Add Action screens to flyout (#206154)](#206154) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Zacqary Adam Xeper","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-22T18:53:08Z","message":"[Response Ops] [Rule Form] Add Show Request and Add Action screens to flyout (#206154)\n\n## Summary\r\n\r\nPart of #195211\r\n\r\n- Adds Show Request screen to the new rule form flyout\r\n\r\n<details>\r\n<summary>Screenshot</summary>\r\n<img width=\"585\" alt=\"Screenshot 2025-01-10 at 1 30 15 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/72500b0d-d959-4d17-944e-a7dc0894fb98\"\r\n/>\r\n</details>\r\n\r\n- Renders the action connectors UI within the flyout instead of opening\r\na modal\r\n \r\n<details>\r\n<summary>Screenshot</summary>\r\n<img width=\"505\" alt=\"Screenshot 2025-01-10 at 1 28 38 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/b5b464c0-7359-43ab-bea1-93d2981a5794\"\r\n/>\r\n</details>\r\n\r\n- Duplicates the dropdown filter design from the flyout UI within the\r\naction connectors modal when displayed on a smaller screen\r\n\r\n<details>\r\n<summary>Screenshot</summary>\r\n<img width=\"809\" alt=\"Screenshot 2025-01-10 at 1 30 28 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/5ef28458-1b6d-4a29-961d-fbcc1640e706\"\r\n/>\r\n</details>\r\n\r\n### Implementation notes\r\n\r\nIn order to get the action connectors UI to render the same way in both\r\na modal and the flyout, without duplicating a large amount of code, I\r\nhad to introduce a little bit of complexity. Within the Rule Page, it's\r\nas simple as opening the UI inside a modal, but the flyout cannot open a\r\nsecond flyout; it has to know when and how to completely replace its own\r\ncontents.\r\n\r\n- The bulk of the action connectors UI is now moved to\r\n`<RuleActionsConnectorsBody>`. `<RuleActionsConnectorsModal>` and\r\n`<RuleFlyoutSelectConnector>` act as wrappers for this component.\r\n- The `<RuleActions>` step no longer handles rendering the connector UI,\r\nbecause it's not at a high enough level to know if it's in the\r\n`<RulePage>` or the `<RuleFlyout>`. Instead, it simply sends a signal up\r\nthe context hierarchy to `setIsConnectorsScreenVisible`.\r\n- A new context called `RuleFormScreenContext` keeps track of\r\n`isConnectorsScreenVisible`, a state for whether or not the action\r\nconnectors \"screen\" is open, regardless of whether that screen is\r\ndisplayed in a modal or a flyout.\r\n- The Rule Page uses `isConnectorsScreenVisible` to determine whether to\r\nrender the modal. This works the same way as it used to, but handled by\r\nthe `<RulePage>` instead of the `<RuleActions>` component.\r\n- The Rule Flyout uses `isConnectorsScreenVisible` to determine whether\r\nto continue to render `<RuleFlyoutBody>` or to completely replace its\r\ncontents with `<RuleFlyoutSelectConnector>`\r\n\r\nFor consistency, this PR also moves the Show Request modal/flyout screen\r\ninto the same system.\r\n\r\n### Testing\r\n\r\nTo test the new flyout, edit\r\n`packages/response-ops/rule_form/src/create_rule_form.tsx` and\r\n`packages/response-ops/rule_form/src/edit_rule_form.tsx` so that they\r\nrender `<RuleFlyout>` instead of `<RulePage>`.\r\n\r\n<details>\r\n<summary><strong>Use this diff block</strong></summary>\r\n\r\n```diff\r\ndiff --git a/packages/response-ops/rule_form/src/create_rule_form.tsx b/packages/response-ops/rule_form/src/create_rule_form.tsx\r\nindex 2f5e0472dcd..564744b96ec 100644\r\n--- a/packages/response-ops/rule_form/src/create_rule_form.tsx\r\n+++ b/packages/response-ops/rule_form/src/create_rule_form.tsx\r\n@@ -31,6 +31,7 @@ import {\r\n parseRuleCircuitBreakerErrorMessage,\r\n } from './utils';\r\n import { RULE_CREATE_SUCCESS_TEXT, RULE_CREATE_ERROR_TEXT } from './translations';\r\n+import { RuleFlyout } from './rule_flyout';\r\n \r\n export interface CreateRuleFormProps {\r\n ruleTypeId: string;\r\n@@ -199,7 +200,7 @@ export const CreateRuleForm = (props: CreateRuleFormProps) => {\r\n }),\r\n }}\r\n >\r\n- <RulePage isEdit={false} isSaving={isSaving} onCancel={onCancel} onSave={onSave} />\r\n+ <RuleFlyout isEdit={false} isSaving={isSaving} onCancel={onCancel} onSave={onSave} />\r\n </RuleFormStateProvider>\r\n </div>\r\n );\r\ndiff --git a/packages/response-ops/rule_form/src/edit_rule_form.tsx b/packages/response-ops/rule_form/src/edit_rule_form.tsx\r\nindex 392447114ed..41aecd7245a 100644\r\n--- a/packages/response-ops/rule_form/src/edit_rule_form.tsx\r\n+++ b/packages/response-ops/rule_form/src/edit_rule_form.tsx\r\n@@ -26,6 +26,7 @@ import {\r\n import { RULE_EDIT_ERROR_TEXT, RULE_EDIT_SUCCESS_TEXT } from './translations';\r\n import { getAvailableRuleTypes, parseRuleCircuitBreakerErrorMessage } from './utils';\r\n import { DEFAULT_VALID_CONSUMERS, getDefaultFormData } from './constants';\r\n+import { RuleFlyout } from './rule_flyout';\r\n \r\n export interface EditRuleFormProps {\r\n id: string;\r\n@@ -193,7 +194,7 @@ export const EditRuleForm = (props: EditRuleFormProps) => {\r\n showMustacheAutocompleteSwitch,\r\n }}\r\n >\r\n- <RulePage isEdit={true} isSaving={isSaving} onSave={onSave} onCancel={onCancel} />\r\n+ <RuleFlyout isEdit={true} isSaving={isSaving} onSave={onSave} onCancel={onCancel} />\r\n </RuleFormStateProvider>\r\n </div>\r\n );\r\n```\r\n\r\n</details>\r\n\r\n### Still Todo\r\n\r\n1. Replace all instances of the v1 rule flyout with this new one (it's\r\nused heavily in solutions, not in Stack Management)\r\n\r\n### Checklist\r\n\r\n- [x] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"8004e3e70ad63b938d724eafd561533eeb225cd9","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","v9.0.0","Feature:Alerting/RulesManagement","backport:version","v8.18.0"],"title":"[Response Ops] [Rule Form] Add Show Request and Add Action screens to flyout","number":206154,"url":"https://github.com/elastic/kibana/pull/206154","mergeCommit":{"message":"[Response Ops] [Rule Form] Add Show Request and Add Action screens to flyout (#206154)\n\n## Summary\r\n\r\nPart of #195211\r\n\r\n- Adds Show Request screen to the new rule form flyout\r\n\r\n<details>\r\n<summary>Screenshot</summary>\r\n<img width=\"585\" alt=\"Screenshot 2025-01-10 at 1 30 15 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/72500b0d-d959-4d17-944e-a7dc0894fb98\"\r\n/>\r\n</details>\r\n\r\n- Renders the action connectors UI within the flyout instead of opening\r\na modal\r\n \r\n<details>\r\n<summary>Screenshot</summary>\r\n<img width=\"505\" alt=\"Screenshot 2025-01-10 at 1 28 38 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/b5b464c0-7359-43ab-bea1-93d2981a5794\"\r\n/>\r\n</details>\r\n\r\n- Duplicates the dropdown filter design from the flyout UI within the\r\naction connectors modal when displayed on a smaller screen\r\n\r\n<details>\r\n<summary>Screenshot</summary>\r\n<img width=\"809\" alt=\"Screenshot 2025-01-10 at 1 30 28 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/5ef28458-1b6d-4a29-961d-fbcc1640e706\"\r\n/>\r\n</details>\r\n\r\n### Implementation notes\r\n\r\nIn order to get the action connectors UI to render the same way in both\r\na modal and the flyout, without duplicating a large amount of code, I\r\nhad to introduce a little bit of complexity. Within the Rule Page, it's\r\nas simple as opening the UI inside a modal, but the flyout cannot open a\r\nsecond flyout; it has to know when and how to completely replace its own\r\ncontents.\r\n\r\n- The bulk of the action connectors UI is now moved to\r\n`<RuleActionsConnectorsBody>`. `<RuleActionsConnectorsModal>` and\r\n`<RuleFlyoutSelectConnector>` act as wrappers for this component.\r\n- The `<RuleActions>` step no longer handles rendering the connector UI,\r\nbecause it's not at a high enough level to know if it's in the\r\n`<RulePage>` or the `<RuleFlyout>`. Instead, it simply sends a signal up\r\nthe context hierarchy to `setIsConnectorsScreenVisible`.\r\n- A new context called `RuleFormScreenContext` keeps track of\r\n`isConnectorsScreenVisible`, a state for whether or not the action\r\nconnectors \"screen\" is open, regardless of whether that screen is\r\ndisplayed in a modal or a flyout.\r\n- The Rule Page uses `isConnectorsScreenVisible` to determine whether to\r\nrender the modal. This works the same way as it used to, but handled by\r\nthe `<RulePage>` instead of the `<RuleActions>` component.\r\n- The Rule Flyout uses `isConnectorsScreenVisible` to determine whether\r\nto continue to render `<RuleFlyoutBody>` or to completely replace its\r\ncontents with `<RuleFlyoutSelectConnector>`\r\n\r\nFor consistency, this PR also moves the Show Request modal/flyout screen\r\ninto the same system.\r\n\r\n### Testing\r\n\r\nTo test the new flyout, edit\r\n`packages/response-ops/rule_form/src/create_rule_form.tsx` and\r\n`packages/response-ops/rule_form/src/edit_rule_form.tsx` so that they\r\nrender `<RuleFlyout>` instead of `<RulePage>`.\r\n\r\n<details>\r\n<summary><strong>Use this diff block</strong></summary>\r\n\r\n```diff\r\ndiff --git a/packages/response-ops/rule_form/src/create_rule_form.tsx b/packages/response-ops/rule_form/src/create_rule_form.tsx\r\nindex 2f5e0472dcd..564744b96ec 100644\r\n--- a/packages/response-ops/rule_form/src/create_rule_form.tsx\r\n+++ b/packages/response-ops/rule_form/src/create_rule_form.tsx\r\n@@ -31,6 +31,7 @@ import {\r\n parseRuleCircuitBreakerErrorMessage,\r\n } from './utils';\r\n import { RULE_CREATE_SUCCESS_TEXT, RULE_CREATE_ERROR_TEXT } from './translations';\r\n+import { RuleFlyout } from './rule_flyout';\r\n \r\n export interface CreateRuleFormProps {\r\n ruleTypeId: string;\r\n@@ -199,7 +200,7 @@ export const CreateRuleForm = (props: CreateRuleFormProps) => {\r\n }),\r\n }}\r\n >\r\n- <RulePage isEdit={false} isSaving={isSaving} onCancel={onCancel} onSave={onSave} />\r\n+ <RuleFlyout isEdit={false} isSaving={isSaving} onCancel={onCancel} onSave={onSave} />\r\n </RuleFormStateProvider>\r\n </div>\r\n );\r\ndiff --git a/packages/response-ops/rule_form/src/edit_rule_form.tsx b/packages/response-ops/rule_form/src/edit_rule_form.tsx\r\nindex 392447114ed..41aecd7245a 100644\r\n--- a/packages/response-ops/rule_form/src/edit_rule_form.tsx\r\n+++ b/packages/response-ops/rule_form/src/edit_rule_form.tsx\r\n@@ -26,6 +26,7 @@ import {\r\n import { RULE_EDIT_ERROR_TEXT, RULE_EDIT_SUCCESS_TEXT } from './translations';\r\n import { getAvailableRuleTypes, parseRuleCircuitBreakerErrorMessage } from './utils';\r\n import { DEFAULT_VALID_CONSUMERS, getDefaultFormData } from './constants';\r\n+import { RuleFlyout } from './rule_flyout';\r\n \r\n export interface EditRuleFormProps {\r\n id: string;\r\n@@ -193,7 +194,7 @@ export const EditRuleForm = (props: EditRuleFormProps) => {\r\n showMustacheAutocompleteSwitch,\r\n }}\r\n >\r\n- <RulePage isEdit={true} isSaving={isSaving} onSave={onSave} onCancel={onCancel} />\r\n+ <RuleFlyout isEdit={true} isSaving={isSaving} onSave={onSave} onCancel={onCancel} />\r\n </RuleFormStateProvider>\r\n </div>\r\n );\r\n```\r\n\r\n</details>\r\n\r\n### Still Todo\r\n\r\n1. Replace all instances of the v1 rule flyout with this new one (it's\r\nused heavily in solutions, not in Stack Management)\r\n\r\n### Checklist\r\n\r\n- [x] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"8004e3e70ad63b938d724eafd561533eeb225cd9"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/206154","number":206154,"mergeCommit":{"message":"[Response Ops] [Rule Form] Add Show Request and Add Action screens to flyout (#206154)\n\n## Summary\r\n\r\nPart of #195211\r\n\r\n- Adds Show Request screen to the new rule form flyout\r\n\r\n<details>\r\n<summary>Screenshot</summary>\r\n<img width=\"585\" alt=\"Screenshot 2025-01-10 at 1 30 15 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/72500b0d-d959-4d17-944e-a7dc0894fb98\"\r\n/>\r\n</details>\r\n\r\n- Renders the action connectors UI within the flyout instead of opening\r\na modal\r\n \r\n<details>\r\n<summary>Screenshot</summary>\r\n<img width=\"505\" alt=\"Screenshot 2025-01-10 at 1 28 38 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/b5b464c0-7359-43ab-bea1-93d2981a5794\"\r\n/>\r\n</details>\r\n\r\n- Duplicates the dropdown filter design from the flyout UI within the\r\naction connectors modal when displayed on a smaller screen\r\n\r\n<details>\r\n<summary>Screenshot</summary>\r\n<img width=\"809\" alt=\"Screenshot 2025-01-10 at 1 30 28 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/5ef28458-1b6d-4a29-961d-fbcc1640e706\"\r\n/>\r\n</details>\r\n\r\n### Implementation notes\r\n\r\nIn order to get the action connectors UI to render the same way in both\r\na modal and the flyout, without duplicating a large amount of code, I\r\nhad to introduce a little bit of complexity. Within the Rule Page, it's\r\nas simple as opening the UI inside a modal, but the flyout cannot open a\r\nsecond flyout; it has to know when and how to completely replace its own\r\ncontents.\r\n\r\n- The bulk of the action connectors UI is now moved to\r\n`<RuleActionsConnectorsBody>`. `<RuleActionsConnectorsModal>` and\r\n`<RuleFlyoutSelectConnector>` act as wrappers for this component.\r\n- The `<RuleActions>` step no longer handles rendering the connector UI,\r\nbecause it's not at a high enough level to know if it's in the\r\n`<RulePage>` or the `<RuleFlyout>`. Instead, it simply sends a signal up\r\nthe context hierarchy to `setIsConnectorsScreenVisible`.\r\n- A new context called `RuleFormScreenContext` keeps track of\r\n`isConnectorsScreenVisible`, a state for whether or not the action\r\nconnectors \"screen\" is open, regardless of whether that screen is\r\ndisplayed in a modal or a flyout.\r\n- The Rule Page uses `isConnectorsScreenVisible` to determine whether to\r\nrender the modal. This works the same way as it used to, but handled by\r\nthe `<RulePage>` instead of the `<RuleActions>` component.\r\n- The Rule Flyout uses `isConnectorsScreenVisible` to determine whether\r\nto continue to render `<RuleFlyoutBody>` or to completely replace its\r\ncontents with `<RuleFlyoutSelectConnector>`\r\n\r\nFor consistency, this PR also moves the Show Request modal/flyout screen\r\ninto the same system.\r\n\r\n### Testing\r\n\r\nTo test the new flyout, edit\r\n`packages/response-ops/rule_form/src/create_rule_form.tsx` and\r\n`packages/response-ops/rule_form/src/edit_rule_form.tsx` so that they\r\nrender `<RuleFlyout>` instead of `<RulePage>`.\r\n\r\n<details>\r\n<summary><strong>Use this diff block</strong></summary>\r\n\r\n```diff\r\ndiff --git a/packages/response-ops/rule_form/src/create_rule_form.tsx b/packages/response-ops/rule_form/src/create_rule_form.tsx\r\nindex 2f5e0472dcd..564744b96ec 100644\r\n--- a/packages/response-ops/rule_form/src/create_rule_form.tsx\r\n+++ b/packages/response-ops/rule_form/src/create_rule_form.tsx\r\n@@ -31,6 +31,7 @@ import {\r\n parseRuleCircuitBreakerErrorMessage,\r\n } from './utils';\r\n import { RULE_CREATE_SUCCESS_TEXT, RULE_CREATE_ERROR_TEXT } from './translations';\r\n+import { RuleFlyout } from './rule_flyout';\r\n \r\n export interface CreateRuleFormProps {\r\n ruleTypeId: string;\r\n@@ -199,7 +200,7 @@ export const CreateRuleForm = (props: CreateRuleFormProps) => {\r\n }),\r\n }}\r\n >\r\n- <RulePage isEdit={false} isSaving={isSaving} onCancel={onCancel} onSave={onSave} />\r\n+ <RuleFlyout isEdit={false} isSaving={isSaving} onCancel={onCancel} onSave={onSave} />\r\n </RuleFormStateProvider>\r\n </div>\r\n );\r\ndiff --git a/packages/response-ops/rule_form/src/edit_rule_form.tsx b/packages/response-ops/rule_form/src/edit_rule_form.tsx\r\nindex 392447114ed..41aecd7245a 100644\r\n--- a/packages/response-ops/rule_form/src/edit_rule_form.tsx\r\n+++ b/packages/response-ops/rule_form/src/edit_rule_form.tsx\r\n@@ -26,6 +26,7 @@ import {\r\n import { RULE_EDIT_ERROR_TEXT, RULE_EDIT_SUCCESS_TEXT } from './translations';\r\n import { getAvailableRuleTypes, parseRuleCircuitBreakerErrorMessage } from './utils';\r\n import { DEFAULT_VALID_CONSUMERS, getDefaultFormData } from './constants';\r\n+import { RuleFlyout } from './rule_flyout';\r\n \r\n export interface EditRuleFormProps {\r\n id: string;\r\n@@ -193,7 +194,7 @@ export const EditRuleForm = (props: EditRuleFormProps) => {\r\n showMustacheAutocompleteSwitch,\r\n }}\r\n >\r\n- <RulePage isEdit={true} isSaving={isSaving} onSave={onSave} onCancel={onCancel} />\r\n+ <RuleFlyout isEdit={true} isSaving={isSaving} onSave={onSave} onCancel={onCancel} />\r\n </RuleFormStateProvider>\r\n </div>\r\n );\r\n```\r\n\r\n</details>\r\n\r\n### Still Todo\r\n\r\n1. Replace all instances of the v1 rule flyout with this new one (it's\r\nused heavily in solutions, not in Stack Management)\r\n\r\n### Checklist\r\n\r\n- [x] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"8004e3e70ad63b938d724eafd561533eeb225cd9"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Zacqary Adam Xeper <[email protected]>
- Loading branch information