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 Show Request and Add Action screens to flyout #206154

Draft
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

Zacqary
Copy link
Contributor

@Zacqary Zacqary commented Jan 10, 2025

This PR is DEPENDENT on #206141

Because we use a fork-and-pull contribution structure at Elastic, Github is not able to base this PR off the correct branch without opening the PR outside the main Kibana repo. Please use manual diffing tools to review this code until #206401 merges

Summary

Part of #195211

  • Adds Show Request screen to the new rule form flyout
Screenshot Screenshot 2025-01-10 at 1 30 15 PM
  • Renders the action connectors UI within the flyout instead of opening a modal
Screenshot Screenshot 2025-01-10 at 1 28 38 PM
  • Duplicates the dropdown filter design from the flyout UI within the action connectors modal when displayed on a smaller screen
Screenshot Screenshot 2025-01-10 at 1 30 28 PM

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>.

Use this diff block
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>
   );

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

@Zacqary Zacqary added release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v9.0.0 Feature:Alerting/RulesManagement Issues related to the Rules Management UX v8.18.0 labels Jan 10, 2025
@elasticmachine
Copy link
Contributor

elasticmachine commented Jan 10, 2025

🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!

@Zacqary Zacqary force-pushed the 195211-demodalize-flyout branch from 0f462bd to 990cb8e Compare January 10, 2025 21:14
@elasticmachine
Copy link
Contributor

elasticmachine commented Jan 10, 2025

💔 Build Failed

Failed CI Steps

History

@Zacqary Zacqary force-pushed the 195211-demodalize-flyout branch from 990cb8e to 2191969 Compare January 10, 2025 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Alerting/RulesManagement Issues related to the Rules Management UX release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants