-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Response Ops][Rule Form V2] Rule form v2: Actions Modal and Actions …
…Form (#187434) ## Summary Issue: #179105 Related PR: #180539 Final PR of the rule actions V2 PR (2/2 of the actions PRs). This PR contains the actions modal and actions form. This PR depends on #186490. I have also created a example plugin to demonstrate this PR. To access: 1. Run the branch with yarn start --run-examples 2. Navigate to http://localhost:5601/app/triggersActionsUiExample/rule/create/<ruleTypeId> (I use .es-query) 3. Create a rule 4. Navigate to http://localhost:5601/app/triggersActionsUiExample/rule/edit/<ruleId> with the rule you just created to edit the rule <img width="1236" alt="Screenshot 2024-07-02 at 5 15 51 PM" src="https://github.com/elastic/kibana/assets/74562234/1dc5d2a9-804a-4861-94ba-814de73dc3ab"> ![Screenshot 2024-07-08 at 10 53 44 PM](https://github.com/elastic/kibana/assets/74562234/07efade1-4b9c-485f-9833-84698dc29219) <img width="1087" alt="Screenshot 2024-07-02 at 5 15 58 PM" src="https://github.com/elastic/kibana/assets/74562234/903e66b5-f9a1-4d09-b121-b1dcecdff72c"> ### Checklist - [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: kibanamachine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
760455a
commit 54659e8
Showing
79 changed files
with
5,938 additions
and
494 deletions.
There are no files selected for viewing
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
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
85 changes: 85 additions & 0 deletions
85
packages/kbn-alerts-ui-shared/src/common/test_utils/actions_test_utils.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,85 @@ | ||
/* | ||
* 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 { ActionType } from '@kbn/actions-types'; | ||
import { RuleSystemAction } from '@kbn/alerting-types'; | ||
import { ActionConnector, ActionTypeModel, GenericValidationResult, RuleAction } from '../types'; | ||
import { actionTypeRegistryMock } from './action_type_registry.mock'; | ||
|
||
export const getConnector = ( | ||
id: string, | ||
overwrites?: Partial<ActionConnector> | ||
): ActionConnector => { | ||
return { | ||
id: `connector-${id}`, | ||
secrets: { secret: 'secret' }, | ||
actionTypeId: `actionType-${id}`, | ||
name: `connector-${id}`, | ||
config: { config: `config-${id}` }, | ||
isPreconfigured: false, | ||
isSystemAction: false, | ||
isDeprecated: false, | ||
...overwrites, | ||
}; | ||
}; | ||
|
||
export const getAction = (id: string, overwrites?: Partial<RuleAction>): RuleAction => { | ||
return { | ||
id: `action-${id}`, | ||
uuid: `uuid-action-${id}`, | ||
group: `group-${id}`, | ||
actionTypeId: `actionType-${id}`, | ||
params: {}, | ||
...overwrites, | ||
}; | ||
}; | ||
|
||
export const getSystemAction = ( | ||
id: string, | ||
overwrites?: Partial<RuleSystemAction> | ||
): RuleSystemAction => { | ||
return { | ||
uuid: `uuid-system-action-${id}`, | ||
id: `system-action-${id}`, | ||
actionTypeId: `actionType-${id}`, | ||
params: {}, | ||
...overwrites, | ||
}; | ||
}; | ||
|
||
export const getActionType = (id: string, overwrites?: Partial<ActionType>): ActionType => { | ||
return { | ||
id: `actionType-${id}`, | ||
name: `actionType: ${id}`, | ||
enabled: true, | ||
enabledInConfig: true, | ||
enabledInLicense: true, | ||
minimumLicenseRequired: 'basic', | ||
supportedFeatureIds: ['stackAlerts'], | ||
isSystemActionType: false, | ||
...overwrites, | ||
}; | ||
}; | ||
|
||
export const getActionTypeModel = ( | ||
id: string, | ||
overwrites?: Partial<ActionTypeModel> | ||
): ActionTypeModel => { | ||
return actionTypeRegistryMock.createMockActionTypeModel({ | ||
id: `actionTypeModel-${id}`, | ||
iconClass: 'test', | ||
selectMessage: 'test', | ||
validateParams: (): Promise<GenericValidationResult<unknown>> => { | ||
const validationResult = { errors: {} }; | ||
return Promise.resolve(validationResult); | ||
}, | ||
actionConnectorFields: null, | ||
...overwrites, | ||
}); | ||
}; |
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
Oops, something went wrong.