-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[Incident Management] Investigation guide frontend #217106
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
Merged
justinkambic
merged 403 commits into
elastic:main
from
justinkambic:investigation-guide-frontend
May 29, 2025
Merged
Changes from all commits
Commits
Show all changes
403 commits
Select commit
Hold shift + click to select a range
d776aa0
make artifacts optional
mgiota 6e24df3
type return value of injectReferencesIntoArtifacts
mgiota 1e191c4
add more tests to transform_rule_attributes_to_rule_domain
mgiota e606da3
fix type issues
mgiota 68cb0f0
Merge branch 'main' into artifacts_dashboard_schema
elasticmachine 674db1a
return fake artifact along with dashboards
mgiota 0926084
remove the call to the dashboard api
mgiota ec63b16
Add new `transformRawArtifactsToDomainArtifacts` function.
justinkambic 92486e8
Add tests for `transformRawArtifactsToDomainArtifacts`.
justinkambic 3764712
Merge branch 'artifacts_dashboard_schema' of github.com:mgiota/kibana…
justinkambic e785bd5
Merge branch 'artifacts_dashboard_schema' into investigation-guide-ba…
justinkambic 6e66bb7
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic e625e73
Make `artifacts` a required parameter of `extractReferences`.
justinkambic 43e0918
Add additional coverage to update artifacts test.
justinkambic c4efff7
rename isInternal to includeArtifacts
mgiota 5a57446
Merge branch 'main' into artifacts_dashboard_schema
elasticmachine a88b335
Merge branch 'artifacts_dashboard_schema' into investigation-guide-ba…
justinkambic adb09e6
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic 4e8a8fc
Merge branch 'investigation-guide-backend' into investigation-guide-f…
justinkambic ae5de30
Fix i18n.
justinkambic 67f8302
update_rule tests updates
mgiota 4e240fd
find_rules_route unit tests
mgiota e3f236a
find_internal_rules_route unit tests
mgiota bb48349
Merge remote-tracking branch 'panagiota/artifacts_dashboard_schema' i…
justinkambic a248557
Merge branch 'investigation-guide-backend' into investigation-guide-f…
justinkambic 75d463c
test that artifacts are mapped correctly
mgiota 061777a
Merge branch 'main' into artifacts_dashboard_schema
elasticmachine 51ebefc
import schema from artifacts_schema
mgiota 5696fd7
Fix i18n.
justinkambic 91fbbb3
Merge remote-tracking branch 'panagiota/artifacts_dashboard_schema' i…
justinkambic a9c1444
Fix unit test.
justinkambic 41c5505
Merge branch 'investigation-guide-backend' into investigation-guide-f…
justinkambic c5ba626
Fix tests, change return value to always include dashboards array.
justinkambic 8830c5e
Merge branch 'artifacts_dashboard_schema' of github.com:mgiota/kibana…
justinkambic 6e5ca07
Change a word.
justinkambic 7058cc8
Use lodash `uniqBy` to deduplicate reference list.
justinkambic 848ef13
Merge branch 'artifacts_dashboard_schema' into investigation-guide-ba…
justinkambic 393c4ab
Merge branch 'investigation-guide-backend' into investigation-guide-f…
justinkambic 21687c0
Revert changes to oas_docs because they seem to be broken on CI.
justinkambic 86e52c1
Update test snapshot where there are duplicate SO ref IDs.
justinkambic 5bc206c
Merge branch 'artifacts_dashboard_schema' into investigation-guide-fr…
justinkambic 0efdf2d
Merge branch 'artifacts_dashboard_schema' into investigation-guide-ba…
justinkambic 87b3e5c
Merge branch 'investigation-guide-backend' into investigation-guide-f…
justinkambic 26f910f
Fixup.
justinkambic 943cf42
[CI] Auto-commit changed files from 'node scripts/capture_oas_snapsho…
kibanamachine 7b9fe55
[CI] Auto-commit changed files from 'make api-docs'
kibanamachine 3f8cd80
Revert "Update test snapshot where there are duplicate SO ref IDs."
justinkambic dba5032
Revert "Use lodash `uniqBy` to deduplicate reference list."
justinkambic e83c655
Merge branch 'artifacts_dashboard_schema' into investigation-guide-ba…
justinkambic 99b386d
Merge branch 'investigation-guide-backend' into investigation-guide-f…
justinkambic 0b94e26
Merge branch 'investigation-guide-frontend' of github.com:justinkambi…
justinkambic 9aede2f
Merge branch 'main' into artifacts_dashboard_schema
elasticmachine e57875e
move injectReferencesIntoArtifacts after hasLegacyActions
mgiota feeb68c
Merge branch 'main' into artifacts_dashboard_schema
elasticmachine 9b44f70
make artifacts required
mgiota bf4a511
Merge remote-tracking branch 'panagiota/artifacts_dashboard_schema' i…
justinkambic 9d78881
Fix types.
justinkambic 80e4817
Fix unit tests.
justinkambic 3c55b26
Fix more unit tests.
justinkambic 78efbb7
Fix more unit tests.
justinkambic f3ec10b
fix lint error
mgiota a84329b
Merge branch 'main' into artifacts_dashboard_schema
elasticmachine 8c2e505
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine 4795010
Fix some API tests.
justinkambic b159a0b
do not mock denormalizeArtifacts
mgiota 678a3df
Merge branch 'main' into artifacts_dashboard_schema
elasticmachine 9423e7f
Merge remote-tracking branch 'panagiota/artifacts_dashboard_schema' i…
justinkambic 0956a35
Merge branch 'investigation-guide-backend' of github.com:justinkambic…
justinkambic de115d2
Fix one more test 🤞.
justinkambic 0533aac
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic f11c7c1
Update schema to v6 for new `investigation_guide` fields.
justinkambic 12263fe
Fix types/imports.
justinkambic 40a5612
Merge branch 'investigation-guide-backend' into investigation-guide-f…
justinkambic 7208972
[CI] Auto-commit changed files from 'node scripts/jest_integration -u…
kibanamachine edaa369
[CI] Auto-commit changed files from 'node scripts/jest_integration -u…
kibanamachine c30f7e0
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic 980c7b1
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic 8950be9
Merge branch 'main' into investigation-guide-backend
justinkambic 197b7ad
Merge branch 'investigation-guide-backend' into investigation-guide-f…
justinkambic 3d76ad7
Merge branch 'investigation-guide-frontend' of github.com:justinkambi…
justinkambic 318ae25
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic 3120b59
Merge branch 'investigation-guide-backend' into investigation-guide-f…
justinkambic 9944587
TEMP
justinkambic a16fb49
Implement new test for PR feedback.
justinkambic 5ee4cd2
Merge branch 'investigation-guide-backend' of github.com:justinkambic…
justinkambic c0214d1
Include unit test for rule update with new investigation_guide text.
justinkambic ccfdb7e
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic c9e5bac
[CI] Auto-commit changed files from 'node scripts/jest_integration -u…
kibanamachine 49b1251
Update raw rule schema definitions based on PR feedback.
justinkambic 5d6248a
Add check for updated IG text in API test.
justinkambic 9459dc2
Merge branch 'investigation-guide-backend' of github.com:justinkambic…
justinkambic f98bb9e
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic e73dae2
PR feedback.
justinkambic 713548b
Add limits for `investigation_guide` size and `dashboards` length.
justinkambic 592fba0
Specify `investigation_guide` as an indexed field for model/root mapp…
justinkambic 2a32804
[CI] Auto-commit changed files from 'node scripts/check_mappings_upda…
kibanamachine e03d4db
[CI] Auto-commit changed files from 'node scripts/capture_oas_snapsho…
kibanamachine b4d1d37
[CI] Auto-commit changed files from 'make api-docs'
kibanamachine 669179f
[CI] Auto-commit changed files from 'node scripts/jest_integration -u…
kibanamachine f0b0ea9
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic d36ae48
Update API artifacts test to use `investigation_guide` as well.
justinkambic 7cc23c2
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic 14ce40d
Remove unneeded properties per PR feedback.
justinkambic 70c970b
Merge branch 'investigation-guide-backend' of github.com:justinkambic…
justinkambic c8eaca2
Merge branch 'investigation-guide-backend' into investigation-guide-f…
justinkambic c5adc44
[CI] Auto-commit changed files from 'node scripts/check_mappings_upda…
kibanamachine b246e7f
[CI] Auto-commit changed files from 'node scripts/jest_integration -u…
kibanamachine 8f0397b
Add meta description for investigation guide blob field.
justinkambic 2714689
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic b2018e5
Merge branch 'investigation-guide-backend' of github.com:justinkambic…
justinkambic 7cb500b
[CI] Auto-commit changed files from 'node scripts/capture_oas_snapsho…
kibanamachine 8ddc483
[CI] Auto-commit changed files from 'make api-docs'
kibanamachine 88cb045
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine 9ece936
Fix some API tests
justinkambic 27d8865
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic 88207ee
Merge branch 'investigation-guide-backend' of github.com:justinkambic…
justinkambic a8092cb
Merge branch 'investigation-guide-backend' into investigation-guide-f…
justinkambic 12c37c2
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic 4d33985
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine b7d42ed
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic 6143fb1
Fix form submit for edit rule.
justinkambic b07bd23
Merge branch 'investigation-guide-frontend' of github.com:justinkambi…
justinkambic 415aa9e
Remove console.log
justinkambic df6afe3
Add test file for investigation guide editor.
justinkambic 0ea9927
Rename investigation guide editor file.
justinkambic 4649abe
Rename test file.
justinkambic 0f5d71a
Remove console.log.
justinkambic 8509436
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic 5951d66
Merge branch 'main' into investigation-guide-frontend
justinkambic 00ed85f
Explicitly remove artifacts when flag specifies.
justinkambic 86b156e
Update test snapshot.
justinkambic a68e3d2
Make `update` transform exclude artifacts if flag is passed.
justinkambic 5c6d6c5
Fix some tests.
justinkambic 4731415
Exclude artifacts from `bulk_delete` route response.
justinkambic c02c46f
Fix unit test and types.
justinkambic a68871e
Skip functional test for now.
justinkambic 4f6e7cf
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic 0294f6f
Remove beta badge.
justinkambic fb3850d
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic 7cb1862
Do not leak artifacts in bulk_enable.
justinkambic e4bddf6
Revert superfluous change to transform function.
justinkambic 04cb844
Remove unneccesary async.
justinkambic 5cf88b9
Perform a review pass and delete unneeded code.
justinkambic 9d900f5
More sanitizing.
justinkambic 4f23ea9
Fixup.
justinkambic 2a02e58
Merge branch 'main' into investigation-guide-frontend
justinkambic f6bdc6d
Merge branch 'main' into investigation-guide-frontend
justinkambic f5a7e2f
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic 7436061
Translate icon tip.
justinkambic 0c58a69
Merge branch 'investigation-guide-frontend' of github.com:justinkambi…
justinkambic e3b1b48
Move `InvestigationGuide` to Details tab.
justinkambic fbf5bf5
Remove unneeded field.
justinkambic 12e8a2e
Remove unneeded field.
justinkambic 3f4f627
Destroy `any`.
justinkambic 7d714c4
Simplify.
justinkambic e32f971
TEMP.
justinkambic 1e376c7
Impelement design changes for rule create form details update.
justinkambic de7480b
Make row/column direction responsive.
justinkambic 5350afc
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic e0e8e83
Fix a unit test
justinkambic 3ce7023
Revert "TEMP."
justinkambic 9379593
Fixup.
justinkambic a7b6742
Fix outdated snapshot.
justinkambic a9fd750
Merge branch 'response-ops_rule-create-form-design-updates' into inve…
justinkambic e52dcd0
i18n fixup.
justinkambic cd94913
Simplify.
justinkambic ceca146
Merge remote-tracking branch 'upstream/main' into response-ops_rule-c…
justinkambic 8e5751b
Merge branch 'response-ops_rule-create-form-design-updates' into inve…
justinkambic 9ab2009
Impelement design changes for rule create form details update.
justinkambic 4bf1f39
Make row/column direction responsive.
justinkambic 664751b
i18n fixup.
justinkambic dd0a60a
Simplify.
justinkambic f2780d2
Remove obsolete code.
justinkambic b1223d3
Fix unit tests file.
justinkambic 332901d
Delete unneeded code.
justinkambic 21e60a2
Merge branch 'response-ops_rule-create-form-design-updates' into inve…
justinkambic 17261ac
Add translation to file.
justinkambic 464d968
Impelement design changes for rule create form details update.
justinkambic 53c70d8
Make row/column direction responsive.
justinkambic 6e85a61
i18n fixup.
justinkambic 1b69b91
Simplify.
justinkambic c309105
Remove obsolete code.
justinkambic 7e9b291
Fix unit tests file.
justinkambic cfdf28b
Delete unneeded code.
justinkambic 9a8c834
Simplify.
justinkambic bd04cb0
Merge branch 'response-ops_rule-create-form-design-updates' into inve…
justinkambic b697d47
Impelement design changes for rule create form details update.
justinkambic 0d5ad80
Make row/column direction responsive.
justinkambic 57ada23
i18n fixup.
justinkambic f789ab9
Simplify.
justinkambic aa06700
Remove obsolete code.
justinkambic 0ed5c5c
Fix unit tests file.
justinkambic 5f85969
Delete unneeded code.
justinkambic 574f00b
Simplify.
justinkambic 44f121e
Merge branch 'response-ops_rule-create-form-design-updates' into inve…
justinkambic b2af692
Move a test.
justinkambic 3ba1888
Impelement design changes for rule create form details update.
justinkambic 07f071b
Make row/column direction responsive.
justinkambic 5b589f7
i18n fixup.
justinkambic abdfaf2
Simplify.
justinkambic 00dca54
Remove obsolete code.
justinkambic 3dc4013
Fix unit tests file.
justinkambic be94853
Delete unneeded code.
justinkambic 2a4570a
Simplify.
justinkambic 4681951
Fix weird FTR failure.
justinkambic 766c926
Merge branch 'response-ops_rule-create-form-design-updates' into inve…
justinkambic 60cc3e5
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic 9c791a5
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic 087ef26
Merge branch 'main' into investigation-guide-frontend
justinkambic 1e1ff6f
Fix unit test mock and delete unneeded test code.
justinkambic 6b15ebb
Copy fix.
justinkambic 6120ad3
Copy fix.
justinkambic 145809c
Make Investigation Guide tab remain highlighted on refresh.
justinkambic cb881ea
Specify `word-wrap` for markdown visualizers to keep words within the…
justinkambic abe2697
Add an icon tip to the Investigation Guide.
justinkambic cb384b2
Fixup.
justinkambic de4a98d
Fixup.
justinkambic 8506ec9
Implement form validation for investigation guide.
justinkambic b3e874a
Fix i18n.
justinkambic 90b86a9
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic 59736db
Merge branch 'main' into investigation-guide-frontend
justinkambic 0d76d68
Merge branch 'main' into investigation-guide-frontend
justinkambic 79ae43b
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic c40f74d
Merge branch 'main' into investigation-guide-frontend
elasticmachine ef77fe7
Merge branch 'investigation-guide-frontend' of github.com:justinkambi…
justinkambic 09af9c8
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic 2f9ce4e
Move investigation guide editor component to the rule details directory.
justinkambic 9801a1f
Revert UI changes to troubleshoot CI failure.
justinkambic 6beb46f
Revert "Revert UI changes to troubleshoot CI failure."
justinkambic 6a72013
Reduce scope of UI change reversion to eliminate surface area of issue.
justinkambic 8596777
Revert "Reduce scope of UI change reversion to eliminate surface area…
justinkambic 8874115
Is event handler causing this not to pass?
justinkambic 86da740
fix type error and temporarily remove onSetArtifacts
mgiota fe2fed8
Expand removed code to find bug.
justinkambic 65547be
Improve translation key name.
justinkambic 9657386
fix failing unit tests
mgiota 5f18245
Revert "fix failing unit tests"
mgiota d8114d0
remove markdown validation
mgiota ea0cf7b
Revert "remove markdown validation"
mgiota baeb37d
fix failing test
mgiota a7dbeb2
Further isolate in search of CI failure.
justinkambic 9e7d0da
Merge branch 'investigation-guide-frontend' of github.com:justinkambi…
justinkambic 30121fb
Be lazy.
justinkambic abbe8ce
add placeholder back to fix failing unit tests
mgiota c210459
Revert "Be lazy."
justinkambic 4086ef4
Re-introduce full code.
justinkambic 016e52f
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic 80cc137
Merge branch 'investigation-guide-frontend' of github.com:justinkambi…
justinkambic da8c669
Merge remote-tracking branch 'upstream/main' into investigation-guide…
justinkambic fb57d60
Fix imports.
justinkambic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...s/shared/response-ops/rule_form/src/rule_details/rule_investigation_guide_editor.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| * 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 { render as rtlRender, screen } from '@testing-library/react'; | ||
| import { __IntlProvider as IntlProvider } from '@kbn/i18n-react'; | ||
| import { InvestigationGuideEditor } from './rule_investigation_guide_editor'; | ||
| import { userEvent } from '@testing-library/user-event'; | ||
|
|
||
| const render = (toRender: any) => rtlRender(toRender, { wrapper: IntlProvider }); | ||
|
|
||
| describe('RuleInvestigationGuide', () => { | ||
| it('should render the investigation guide when provided', () => { | ||
| const setRuleParams = jest.fn(); | ||
| render(<InvestigationGuideEditor setRuleParams={setRuleParams} value="123" />); | ||
| const editorElement = screen.getByLabelText( | ||
| 'Add guidelines for addressing alerts created by this rule' | ||
| ); | ||
| expect(editorElement).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('should call setRuleParams when the value changes', async () => { | ||
| const setRuleParams = jest.fn(); | ||
| render(<InvestigationGuideEditor setRuleParams={setRuleParams} value="# Markdown Summary" />); | ||
| const editorElement = screen.getByLabelText( | ||
| 'Add guidelines for addressing alerts created by this rule' | ||
| ); | ||
| expect(editorElement).toBeInTheDocument(); | ||
| expect(editorElement).toHaveValue('# Markdown Summary'); | ||
| expect(setRuleParams).toHaveBeenCalledTimes(0); | ||
|
|
||
| await userEvent.type(editorElement!, '!'); | ||
|
|
||
| expect(setRuleParams).toHaveBeenCalled(); | ||
| expect(setRuleParams.mock.calls[0]).toHaveLength(1); | ||
| expect(setRuleParams.mock.calls[0][0]).toEqual({ | ||
| investigation_guide: { blob: '# Markdown Summary!' }, | ||
| }); | ||
| }); | ||
| }); |
68 changes: 68 additions & 0 deletions
68
...ckages/shared/response-ops/rule_form/src/rule_details/rule_investigation_guide_editor.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| /* | ||
| * 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 { EuiMarkdownAstNode, EuiMarkdownEditor, EuiMarkdownParseError } from '@elastic/eui'; | ||
| import { css } from '@emotion/react'; | ||
| import { i18n } from '@kbn/i18n'; | ||
| import React, { useCallback } from 'react'; | ||
| import { MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH } from '../constants'; | ||
|
|
||
| interface Props { | ||
| setRuleParams: (v: { investigation_guide: { blob: string } }) => void; | ||
| value: string; | ||
| } | ||
|
|
||
| export function InvestigationGuideEditor({ setRuleParams, value }: Props) { | ||
| const [errorMessages, setErrorMessages] = React.useState<string[]>([]); | ||
| const onParse = useCallback( | ||
| (_: EuiMarkdownParseError | null, { ast }: { ast: EuiMarkdownAstNode }) => { | ||
| const length = ast.position?.end.offset ?? 0; | ||
| if (length > MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH) { | ||
| setErrorMessages([ | ||
| i18n.translate('responseOpsRuleForm.investigationGuide.editor.errorMessage', { | ||
| defaultMessage: | ||
| 'The Investigation Guide is too long. Please shorten it.\nCurrent length: {length}.\nMax length: {maxLength}.', | ||
| values: { length, maxLength: MAX_ARTIFACTS_INVESTIGATION_GUIDE_LENGTH }, | ||
| }), | ||
| ]); | ||
| } else if (errorMessages.length) { | ||
| setErrorMessages([]); | ||
| } | ||
| }, | ||
| [errorMessages] | ||
| ); | ||
| return ( | ||
| <EuiMarkdownEditor | ||
| aria-label={i18n.translate( | ||
| 'responseOpsRuleForm.ruleDetails.investigationGuide.editor.ariaLabel', | ||
| { | ||
| defaultMessage: 'Add guidelines for addressing alerts created by this rule', | ||
| } | ||
| )} | ||
| placeholder={i18n.translate( | ||
| 'responseOpsRuleForm.ruleDetails.investigationGuide.editor.placeholder', | ||
| { | ||
| defaultMessage: 'Add guidelines for addressing alerts created by this rule', | ||
| } | ||
| )} | ||
| css={css` | ||
| .euiMarkdownFormat { | ||
| word-wrap: break-word; | ||
| } | ||
| `} | ||
| value={value} | ||
| onChange={(blob) => setRuleParams({ investigation_guide: { blob } })} | ||
| onParse={onParse} | ||
| errors={errorMessages} | ||
| height={200} | ||
| data-test-subj="investigationGuideEditor" | ||
| initialViewMode="editing" | ||
| /> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.