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 new flyout to rule form library, responsive design and illustration to rule form page #206141

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

Zacqary
Copy link
Contributor

@Zacqary Zacqary commented Jan 9, 2025

Summary

Part of #195211

Adds components for the new rule form flyout, and duplicates some of its design elements as responsive design on the Rule Page. This PR makes use of CSS @container queries, which EUI doesn't yet support natively. I've opened elastic/eui#8265 to get native EUI support for this functionality, but for now we can apply it through class names and SCSS.

The reason we're using @container is so the Rule Form can be responsive regardless of whether it's bound by the window size (in the case of the Rule Page) or a container element on a larger screen (in the Rule Flyout). When responsive design just relies on @media screen queries, we can have a situation where we're trying to render the rule form in a 500px wide flyout, but because the window is 1920px wide, it still tries to apply wide screen styling. @container instead responds to the width of an enclosing element, which can either be the body of the Rule Page, or the width of the Rule Flyout.

Non-User Facing Changes

  • Adds the new rule flyout to @kbn/response-ops-rule-form. It is not yet actually user-facing anywhere in the application, this will be done in a second PR.

Screenshots

Screenshot 2025-01-08 at 4 29 55 PM Screenshot 2025-01-08 at 4 29 59 PM Screenshot 2025-01-08 at 4 30 03 PM Screenshot 2025-01-08 at 4 30 32 PM

User-Facing Changes

These changes were added to the existing full page rule form to minimize the amount of code differences between the flyout and the full page

  • Adds some responsive styling to the rule form page to make it look more similar to the flyout when the browser window is narrow
Screenshot Screenshot 2025-01-08 at 4 31 50 PM
  • Adds the new illustrated "Add an action" empty prompt from the flyout designs to the existing rule form page
Screenshot Screenshot 2025-01-08 at 5 00 55 PM

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 the action connector modal with an in-flyout UI as called for in the design spec
  2. Add the Show Request UI
  3. 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:enhancement 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 backport:version Backport to applied version labels v8.18.0 labels Jan 9, 2025
@Zacqary Zacqary force-pushed the 195211-new-flyout branch from 949400a to d8f9597 Compare January 9, 2025 21:24
@Zacqary Zacqary marked this pull request as ready for review January 10, 2025 21:10
@Zacqary Zacqary requested review from a team as code owners January 10, 2025 21:10
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@Zacqary
Copy link
Contributor Author

Zacqary commented Jan 10, 2025

@elastic/kibana-design In addition to the SCSS file that triggered CODEOWNER, please take a look at the SVG file I pulled from the Figma designs for this feature and let me know if it's good to go.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
triggersActionsUi 850 857 +7

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
triggersActionsUi 1.7MB 1.7MB +4.3KB
Unknown metric groups

async chunk count

id before after diff
triggersActionsUi 64 65 +1

miscellaneous assets size

id before after diff
triggersActionsUi 126.3KB 505.4KB ⚠️ +379.0KB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels Feature:Alerting/RulesManagement Issues related to the Rules Management UX release_note:enhancement 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