-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 Show Request and Add Action screens to flyout #206154
Conversation
2191969
to
553f892
Compare
553f892
to
ddca944
Compare
ddca944
to
fb3027e
Compare
Pinging @elastic/response-ops (Team:ResponseOps) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SCSS
Congrats on breaking ground with container queries :)
@joana-cps fyi if you'd like to QA the design; I approved only the SCSS change. |
This reverts commit 8d58b28.
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
History
|
@elasticmachine merge upstream |
import { DEFAULT_FREQUENCY } from '../constants'; | ||
import { getDefaultParams } from '../utils'; | ||
|
||
export const useOnSelectConnector = ({ onClose }: { onClose: () => void }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like it's not being used anywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was trying something here and I forgot to remove it
* This provides logic that works on both the Rule Page, which displays these screens in a modal, | ||
* and the Rule Flyout, which displays these screens by replacing the entire content of the flyout. | ||
*/ | ||
const initialRuleFormScreenContextState = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure what "screen" is referring to. I would think "element" might be fitting too, but not sure. Could you please elaborate a little bit on the reasoning behind "screen"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idk naming things is hard. I don't think it's an "element" because it could either be a modal or a full replacement of the content of the flyout, and there isn't a specific DOM element that corresponds to in both cases. "View" maybe? Remember when it was 2015 and we had model-view-controllers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to think of a good word that conveys "replace the entire contents of this thing, or show this thing in a modal, depending on how we do things" and I guess "screen" came to mind. Open to whatever.
Starting backport for target branches: 8.x |
… flyout (elastic#206154) ## Summary Part of elastic#195211 - Adds Show Request screen to the new rule form flyout <details> <summary>Screenshot</summary> <img width="585" alt="Screenshot 2025-01-10 at 1 30 15 PM" src="https://github.com/user-attachments/assets/72500b0d-d959-4d17-944e-a7dc0894fb98" /> </details> - Renders the action connectors UI within the flyout instead of opening a modal <details> <summary>Screenshot</summary> <img width="505" alt="Screenshot 2025-01-10 at 1 28 38 PM" src="https://github.com/user-attachments/assets/b5b464c0-7359-43ab-bea1-93d2981a5794" /> </details> - Duplicates the dropdown filter design from the flyout UI within the action connectors modal when displayed on a smaller screen <details> <summary>Screenshot</summary> <img width="809" alt="Screenshot 2025-01-10 at 1 30 28 PM" src="https://github.com/user-attachments/assets/5ef28458-1b6d-4a29-961d-fbcc1640e706" /> </details> ### Implementation notes In order to get the action connectors UI to render the same way in both a modal and the flyout, without duplicating a large amount of code, I had to introduce a little bit of complexity. Within the Rule Page, it's as simple as opening the UI inside a modal, but the flyout cannot open a second flyout; it has to know when and how to completely replace its own contents. - The bulk of the action connectors UI is now moved to `<RuleActionsConnectorsBody>`. `<RuleActionsConnectorsModal>` and `<RuleFlyoutSelectConnector>` act as wrappers for this component. - The `<RuleActions>` step no longer handles rendering the connector UI, because it's not at a high enough level to know if it's in the `<RulePage>` or the `<RuleFlyout>`. Instead, it simply sends a signal up the context hierarchy to `setIsConnectorsScreenVisible`. - A new context called `RuleFormScreenContext` keeps track of `isConnectorsScreenVisible`, a state for whether or not the action connectors "screen" is open, regardless of whether that screen is displayed in a modal or a flyout. - The Rule Page uses `isConnectorsScreenVisible` to determine whether to render the modal. This works the same way as it used to, but handled by the `<RulePage>` instead of the `<RuleActions>` component. - The Rule Flyout uses `isConnectorsScreenVisible` to determine whether to continue to render `<RuleFlyoutBody>` or to completely replace its contents with `<RuleFlyoutSelectConnector>` For consistency, this PR also moves the Show Request modal/flyout screen into the same system. ### Testing To test the new flyout, edit `packages/response-ops/rule_form/src/create_rule_form.tsx` and `packages/response-ops/rule_form/src/edit_rule_form.tsx` so that they render `<RuleFlyout>` instead of `<RulePage>`. <details> <summary><strong>Use this diff block</strong></summary> ```diff diff --git a/packages/response-ops/rule_form/src/create_rule_form.tsx b/packages/response-ops/rule_form/src/create_rule_form.tsx index 2f5e0472dcd..564744b96ec 100644 --- a/packages/response-ops/rule_form/src/create_rule_form.tsx +++ b/packages/response-ops/rule_form/src/create_rule_form.tsx @@ -31,6 +31,7 @@ import { parseRuleCircuitBreakerErrorMessage, } from './utils'; import { RULE_CREATE_SUCCESS_TEXT, RULE_CREATE_ERROR_TEXT } from './translations'; +import { RuleFlyout } from './rule_flyout'; export interface CreateRuleFormProps { ruleTypeId: string; @@ -199,7 +200,7 @@ export const CreateRuleForm = (props: CreateRuleFormProps) => { }), }} > - <RulePage isEdit={false} isSaving={isSaving} onCancel={onCancel} onSave={onSave} /> + <RuleFlyout isEdit={false} isSaving={isSaving} onCancel={onCancel} onSave={onSave} /> </RuleFormStateProvider> </div> ); diff --git a/packages/response-ops/rule_form/src/edit_rule_form.tsx b/packages/response-ops/rule_form/src/edit_rule_form.tsx index 392447114ed..41aecd7245a 100644 --- a/packages/response-ops/rule_form/src/edit_rule_form.tsx +++ b/packages/response-ops/rule_form/src/edit_rule_form.tsx @@ -26,6 +26,7 @@ import { import { RULE_EDIT_ERROR_TEXT, RULE_EDIT_SUCCESS_TEXT } from './translations'; import { getAvailableRuleTypes, parseRuleCircuitBreakerErrorMessage } from './utils'; import { DEFAULT_VALID_CONSUMERS, getDefaultFormData } from './constants'; +import { RuleFlyout } from './rule_flyout'; export interface EditRuleFormProps { id: string; @@ -193,7 +194,7 @@ export const EditRuleForm = (props: EditRuleFormProps) => { showMustacheAutocompleteSwitch, }} > - <RulePage isEdit={true} isSaving={isSaving} onSave={onSave} onCancel={onCancel} /> + <RuleFlyout isEdit={true} isSaving={isSaving} onSave={onSave} onCancel={onCancel} /> </RuleFormStateProvider> </div> ); ``` </details> ### Still Todo 1. Replace all instances of the v1 rule flyout with this new one (it's used heavily in solutions, not in Stack Management) ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Elastic Machine <[email protected]> (cherry picked from commit 8004e3e)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…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]>
… flyout (elastic#206154) ## Summary Part of elastic#195211 - Adds Show Request screen to the new rule form flyout <details> <summary>Screenshot</summary> <img width="585" alt="Screenshot 2025-01-10 at 1 30 15 PM" src="https://github.com/user-attachments/assets/72500b0d-d959-4d17-944e-a7dc0894fb98" /> </details> - Renders the action connectors UI within the flyout instead of opening a modal <details> <summary>Screenshot</summary> <img width="505" alt="Screenshot 2025-01-10 at 1 28 38 PM" src="https://github.com/user-attachments/assets/b5b464c0-7359-43ab-bea1-93d2981a5794" /> </details> - Duplicates the dropdown filter design from the flyout UI within the action connectors modal when displayed on a smaller screen <details> <summary>Screenshot</summary> <img width="809" alt="Screenshot 2025-01-10 at 1 30 28 PM" src="https://github.com/user-attachments/assets/5ef28458-1b6d-4a29-961d-fbcc1640e706" /> </details> ### Implementation notes In order to get the action connectors UI to render the same way in both a modal and the flyout, without duplicating a large amount of code, I had to introduce a little bit of complexity. Within the Rule Page, it's as simple as opening the UI inside a modal, but the flyout cannot open a second flyout; it has to know when and how to completely replace its own contents. - The bulk of the action connectors UI is now moved to `<RuleActionsConnectorsBody>`. `<RuleActionsConnectorsModal>` and `<RuleFlyoutSelectConnector>` act as wrappers for this component. - The `<RuleActions>` step no longer handles rendering the connector UI, because it's not at a high enough level to know if it's in the `<RulePage>` or the `<RuleFlyout>`. Instead, it simply sends a signal up the context hierarchy to `setIsConnectorsScreenVisible`. - A new context called `RuleFormScreenContext` keeps track of `isConnectorsScreenVisible`, a state for whether or not the action connectors "screen" is open, regardless of whether that screen is displayed in a modal or a flyout. - The Rule Page uses `isConnectorsScreenVisible` to determine whether to render the modal. This works the same way as it used to, but handled by the `<RulePage>` instead of the `<RuleActions>` component. - The Rule Flyout uses `isConnectorsScreenVisible` to determine whether to continue to render `<RuleFlyoutBody>` or to completely replace its contents with `<RuleFlyoutSelectConnector>` For consistency, this PR also moves the Show Request modal/flyout screen into the same system. ### Testing To test the new flyout, edit `packages/response-ops/rule_form/src/create_rule_form.tsx` and `packages/response-ops/rule_form/src/edit_rule_form.tsx` so that they render `<RuleFlyout>` instead of `<RulePage>`. <details> <summary><strong>Use this diff block</strong></summary> ```diff diff --git a/packages/response-ops/rule_form/src/create_rule_form.tsx b/packages/response-ops/rule_form/src/create_rule_form.tsx index 2f5e0472dcd..564744b96ec 100644 --- a/packages/response-ops/rule_form/src/create_rule_form.tsx +++ b/packages/response-ops/rule_form/src/create_rule_form.tsx @@ -31,6 +31,7 @@ import { parseRuleCircuitBreakerErrorMessage, } from './utils'; import { RULE_CREATE_SUCCESS_TEXT, RULE_CREATE_ERROR_TEXT } from './translations'; +import { RuleFlyout } from './rule_flyout'; export interface CreateRuleFormProps { ruleTypeId: string; @@ -199,7 +200,7 @@ export const CreateRuleForm = (props: CreateRuleFormProps) => { }), }} > - <RulePage isEdit={false} isSaving={isSaving} onCancel={onCancel} onSave={onSave} /> + <RuleFlyout isEdit={false} isSaving={isSaving} onCancel={onCancel} onSave={onSave} /> </RuleFormStateProvider> </div> ); diff --git a/packages/response-ops/rule_form/src/edit_rule_form.tsx b/packages/response-ops/rule_form/src/edit_rule_form.tsx index 392447114ed..41aecd7245a 100644 --- a/packages/response-ops/rule_form/src/edit_rule_form.tsx +++ b/packages/response-ops/rule_form/src/edit_rule_form.tsx @@ -26,6 +26,7 @@ import { import { RULE_EDIT_ERROR_TEXT, RULE_EDIT_SUCCESS_TEXT } from './translations'; import { getAvailableRuleTypes, parseRuleCircuitBreakerErrorMessage } from './utils'; import { DEFAULT_VALID_CONSUMERS, getDefaultFormData } from './constants'; +import { RuleFlyout } from './rule_flyout'; export interface EditRuleFormProps { id: string; @@ -193,7 +194,7 @@ export const EditRuleForm = (props: EditRuleFormProps) => { showMustacheAutocompleteSwitch, }} > - <RulePage isEdit={true} isSaving={isSaving} onSave={onSave} onCancel={onCancel} /> + <RuleFlyout isEdit={true} isSaving={isSaving} onSave={onSave} onCancel={onCancel} /> </RuleFormStateProvider> </div> ); ``` </details> ### Still Todo 1. Replace all instances of the v1 rule flyout with this new one (it's used heavily in solutions, not in Stack Management) ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Elastic Machine <[email protected]>
Summary
Part of #195211
Screenshot
Screenshot
Screenshot
Implementation notes
In order to get the action connectors UI to render the same way in both a modal and the flyout, without duplicating a large amount of code, I had to introduce a little bit of complexity. Within the Rule Page, it's as simple as opening the UI inside a modal, but the flyout cannot open a second flyout; it has to know when and how to completely replace its own contents.
<RuleActionsConnectorsBody>
.<RuleActionsConnectorsModal>
and<RuleFlyoutSelectConnector>
act as wrappers for this component.<RuleActions>
step no longer handles rendering the connector UI, because it's not at a high enough level to know if it's in the<RulePage>
or the<RuleFlyout>
. Instead, it simply sends a signal up the context hierarchy tosetIsConnectorsScreenVisible
.RuleFormScreenContext
keeps track ofisConnectorsScreenVisible
, a state for whether or not the action connectors "screen" is open, regardless of whether that screen is displayed in a modal or a flyout.isConnectorsScreenVisible
to determine whether to render the modal. This works the same way as it used to, but handled by the<RulePage>
instead of the<RuleActions>
component.isConnectorsScreenVisible
to determine whether to continue to render<RuleFlyoutBody>
or to completely replace its contents with<RuleFlyoutSelectConnector>
For consistency, this PR also moves the Show Request modal/flyout screen into the same system.
Testing
To test the new flyout, edit
packages/response-ops/rule_form/src/create_rule_form.tsx
andpackages/response-ops/rule_form/src/edit_rule_form.tsx
so that they render<RuleFlyout>
instead of<RulePage>
.Use this diff block
Still Todo
Checklist