-
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
[ResponseOps][Rules] Move Rule Form code into @kbn/response-ops-rule-form #198725
Merged
+1,110
−1,236
Merged
Changes from 58 commits
Commits
Show all changes
76 commits
Select commit
Hold shift + click to select a range
b414b7c
Change security solution internal/_find find call to POST
Zacqary a015a44
Merge remote-tracking branch 'upstream/main'
Zacqary ee1c71b
Initial rule form package migration
Zacqary fa4f526
Move use fetch flapping settings back to alerts-ui-shared
Zacqary 34d9942
Remove missing export
Zacqary d2a953f
Fix API imports
Zacqary f7a3caf
Restore alerts-ui-shared rule types
Zacqary 9f9b58a
Update tsconfig
Zacqary d9b7e1a
[CI] Auto-commit changed files from 'node scripts/generate codeowners'
kibanamachine d6dab95
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine 2f9211c
Fix jest rootDir
Zacqary df7a742
Merge branch '195211-rule-form-package' of https://github.com/Zacqary…
Zacqary 4b193da
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine 7f7dbc7
Fix i18n, jest, tsconfig
Zacqary 783b901
Merge branch '195211-rule-form-package' of https://github.com/Zacqary…
Zacqary e824df5
Merge remote-tracking branch 'upstream/main' into 195211-rule-form-pa…
Zacqary 6c6240e
Fix bad merge of #198036
Zacqary e85e18e
Revert "Fix bad merge of #198036"
Zacqary d53c2c5
i18n fix
Zacqary 2c2d16d
Fix typecheck
Zacqary 3e2ced4
Fix imports
Zacqary 7cf86d0
Fix typecheck
Zacqary 2549198
Commit missing files
Zacqary b41dc1f
Fix types and i18n
Zacqary 2ad2f42
Fix typecheck
Zacqary a9769a9
Fix even more import errors that the typecheck finally decided to tel…
Zacqary c6222f7
Fix jest mock imports
Zacqary b5f1fe1
Merge remote-tracking branch 'upstream/main' into 195211-rule-form-pa…
Zacqary 55c4805
[CI] Auto-commit changed files from 'node scripts/generate codeowners'
kibanamachine c7a7145
Fix jest config
Zacqary e41602d
Merge branch '195211-rule-form-package' of https://github.com/Zacqary…
Zacqary b0ff57b
Merge remote-tracking branch 'upstream/main' into 195211-rule-form-pa…
Zacqary 8ae3ceb
Target imports from alerts-ui-shared
Zacqary 0721c81
Increase bundle limit
Zacqary 68acbc3
Fix imports
Zacqary 3be68cc
Reset bundle limits
Zacqary 2df05ef
Remove unneeded constants
Zacqary ba85215
Clean up exports
Zacqary aa63d2c
Fix typecheck import
Zacqary ed71df9
Force async import EcsFlat
Zacqary 4e09693
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine 471109b
Optimize import/exports to bundle rule_form in own chunk
Zacqary e0a670e
Move action_variables back into alerts-ui-shared
Zacqary 1481123
Fix import
Zacqary ef28b58
Bump triggersActionsUi limit
Zacqary a7a4871
Fix imports
Zacqary 98b3085
Fix lint
Zacqary 5038bbf
Merge remote-tracking branch 'upstream/main' into 195211-rule-form-pa…
Zacqary 9340146
Optimize observability import
Zacqary 3049709
Specify type import on stack connectors params
Zacqary aae334c
Fix lazy loading EcsFlat in useLoadRuleTypeAadTemplateFields
Zacqary 38cdbb1
Merge remote-tracking branch 'upstream/main' into 195211-rule-form-pa…
Zacqary deb9a09
Add retry.try to autocompletion test
Zacqary 5235957
Prune exports from rule form package
Zacqary 9175558
Skip failing test
Zacqary 97b3c61
Merge remote-tracking branch 'upstream/main' into 195211-rule-form-pa…
Zacqary a3a4c84
Revert async import of EcsFlat in useLoadRuleTypeAADTemplateFields
Zacqary f5c6566
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine 367adc8
Merge remote-tracking branch 'upstream/main' into 195211-rule-form-pa…
Zacqary 3694ebb
Merge branch '195211-rule-form-package' of https://github.com/Zacqary…
Zacqary 46f4fbe
Merge remote-tracking branch 'upstream/main' into 195211-rule-form-pa…
Zacqary 3ad6293
Remove unnecessary export from triggersActionsUi lib
Zacqary c622640
Optimize alerts-ui-shared bundle size
Zacqary ea0fd94
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine 4b81345
Fix imports and i18n
Zacqary 5303bba
Merge branch '195211-rule-form-package' of https://github.com/Zacqary…
Zacqary df16744
Attempt at fixing test
kdelemme 8493f7c
Unskip autocompletion test
Zacqary 68e8c28
Revert limits change
Zacqary 8c3c9ea
Merge remote-tracking branch 'upstream/main' into 195211-rule-form-pa…
Zacqary 6401b97
Merge remote-tracking branch 'upstream/main' into 195211-rule-form-pa…
Zacqary 49ab7bb
Merge branch 'main' into 195211-rule-form-package
kdelemme 78d1445
Use explicit key names for alerts search bar useQuery hooks
Zacqary d62658a
Merge remote-tracking branch 'upstream/main' into 195211-rule-form-pa…
Zacqary 9f0939b
Merge branch '195211-rule-form-package' of https://github.com/Zacqary…
Zacqary c5208b1
Merge remote-tracking branch 'upstream/main' into 195211-rule-form-pa…
Zacqary 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
Validating CODEOWNERS rules …
This file contains 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 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 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 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 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
File renamed without changes.
This file contains 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 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 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
10 changes: 10 additions & 0 deletions
10
packages/kbn-alerts-ui-shared/src/check_action_type_enabled/index.ts
This file contains 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,10 @@ | ||
/* | ||
* 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". | ||
*/ | ||
|
||
export * from './check_action_type_enabled'; |
This file contains 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 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 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 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 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 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 |
---|---|---|
|
@@ -8,4 +8,3 @@ | |
*/ | ||
|
||
export * from './transform_action'; | ||
export * from './transform_rule'; |
This file contains 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,14 @@ | ||
/* | ||
* 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". | ||
*/ | ||
|
||
export * from './rule_settings_flapping_form'; | ||
export * from './rule_settings_flapping_inputs'; | ||
export * from './rule_settings_flapping_message'; | ||
export * from './rule_settings_flapping_title_tooltip'; | ||
export * from './rule_settings_range_input'; |
This file contains 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 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 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 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,3 @@ | ||
# @kbn/response-ops-rule-form | ||
|
||
This package contains all components necessary to render the forms for creating and editing rules. |
This file contains 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,32 @@ | ||
/* | ||
* 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". | ||
*/ | ||
|
||
export * from './src/types'; | ||
export * from './src/rule_type_modal'; | ||
|
||
export { RuleForm } from './src/rule_form'; | ||
|
||
export { | ||
fetchUiConfig, | ||
createRule, | ||
updateRule, | ||
type CreateRuleBody, | ||
UPDATE_FIELDS_WITH_ACTIONS, | ||
transformCreateRuleBody, | ||
transformUpdateRuleBody, | ||
resolveRule, | ||
} from './src/common/apis'; | ||
|
||
export { CREATE_RULE_ROUTE, EDIT_RULE_ROUTE } from './src/constants'; | ||
|
||
export { | ||
RuleActionsNotifyWhen, | ||
RuleActionsAlertsFilter, | ||
RuleActionsAlertsFilterTimeframe, | ||
} from './src/rule_actions'; |
This file contains 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,15 @@ | ||
/* | ||
* 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". | ||
*/ | ||
|
||
module.exports = { | ||
preset: '@kbn/test', | ||
rootDir: '../../..', | ||
roots: ['<rootDir>/packages/response-ops/rule_form'], | ||
setupFilesAfterEnv: ['<rootDir>/packages/response-ops/rule_form/setup_tests.ts'], | ||
}; |
This file contains 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,5 @@ | ||
{ | ||
"type": "shared-browser", | ||
"id": "@kbn/response-ops-rule-form", | ||
"owner": "@elastic/response-ops" | ||
} |
This file contains 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,6 @@ | ||
{ | ||
"name": "@kbn/response-ops-rule-form", | ||
"private": true, | ||
"version": "1.0.0", | ||
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0" | ||
} |
This file contains 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,11 @@ | ||
/* | ||
* 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". | ||
*/ | ||
|
||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import '@testing-library/jest-dom'; |
File renamed without changes.
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
54 changes: 54 additions & 0 deletions
54
packages/response-ops/rule_form/src/common/apis/fetch_rule_types.ts
This file contains 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,54 @@ | ||
/* | ||
* 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 { HttpSetup } from '@kbn/core/public'; | ||
import type { AsApiContract, RewriteRequestCase } from '@kbn/actions-types'; | ||
import type { RuleType } from '@kbn/triggers-actions-ui-types'; | ||
import { BASE_ALERTING_API_PATH } from '../../constants'; | ||
|
||
const rewriteResponseRes = (results: Array<AsApiContract<RuleType>>): RuleType[] => { | ||
return results.map((item) => rewriteBodyReq(item)); | ||
}; | ||
|
||
const rewriteBodyReq: RewriteRequestCase<RuleType> = ({ | ||
enabled_in_license: enabledInLicense, | ||
recovery_action_group: recoveryActionGroup, | ||
action_groups: actionGroups, | ||
default_action_group_id: defaultActionGroupId, | ||
minimum_license_required: minimumLicenseRequired, | ||
action_variables: actionVariables, | ||
authorized_consumers: authorizedConsumers, | ||
rule_task_timeout: ruleTaskTimeout, | ||
does_set_recovery_context: doesSetRecoveryContext, | ||
default_schedule_interval: defaultScheduleInterval, | ||
has_alerts_mappings: hasAlertsMappings, | ||
has_fields_for_a_a_d: hasFieldsForAAD, | ||
...rest | ||
}: AsApiContract<RuleType>) => ({ | ||
enabledInLicense, | ||
recoveryActionGroup, | ||
actionGroups, | ||
defaultActionGroupId, | ||
minimumLicenseRequired, | ||
actionVariables, | ||
authorizedConsumers, | ||
ruleTaskTimeout, | ||
doesSetRecoveryContext, | ||
defaultScheduleInterval, | ||
hasAlertsMappings, | ||
hasFieldsForAAD, | ||
...rest, | ||
}); | ||
|
||
export async function fetchRuleTypes({ http }: { http: HttpSetup }): Promise<RuleType[]> { | ||
const res = await http.get<Array<AsApiContract<RuleType<string, string>>>>( | ||
`${BASE_ALERTING_API_PATH}/rule_types` | ||
); | ||
return rewriteResponseRes(res); | ||
} |
File renamed without changes.
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.
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.
could you please explain what happened here? why 150000?
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.
Increased this beyond 139.3kb to give it a bit of breathing room. Haven't been able to figure out why we're getting a 10kb increase in
triggersActionsUi
, that's the best I was able to get it.Plugin size is still reasonable so unless it's something obvious that someone else can spot quickly, I'd prefer not to devote more resources and to try and get this PR through
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 have now somehow managed to decrease the bundle size by 1.5kb from
main
so I guess we're good here