;
getAlertsTableDefaultAlertActions: (
props: P
@@ -403,7 +411,7 @@ export class Plugin
connectorServices: this.connectorServices!,
});
},
- getAddRuleFlyout: (props: Omit) => {
+ getAddRuleFlyout: (props) => {
return getAddRuleFlyoutLazy({
...props,
actionTypeRegistry: this.actionTypeRegistry,
@@ -411,9 +419,7 @@ export class Plugin
connectorServices: this.connectorServices!,
});
},
- getEditRuleFlyout: (
- props: Omit
- ) => {
+ getEditRuleFlyout: (props) => {
return getEditRuleFlyoutLazy({
...props,
actionTypeRegistry: this.actionTypeRegistry,
diff --git a/x-pack/plugins/triggers_actions_ui/public/types.ts b/x-pack/plugins/triggers_actions_ui/public/types.ts
index b47d80a0839e5..36cc294bbda5f 100644
--- a/x-pack/plugins/triggers_actions_ui/public/types.ts
+++ b/x-pack/plugins/triggers_actions_ui/public/types.ts
@@ -51,6 +51,7 @@ import {
AlertingFrameworkHealth,
RuleNotifyWhenType,
RuleTypeParams,
+ RuleTypeMetaData,
ActionVariable,
RuleLastRun,
MaintenanceWindow,
@@ -127,6 +128,7 @@ export type {
AlertingFrameworkHealth,
RuleNotifyWhenType,
RuleTypeParams,
+ RuleTypeMetaData,
ResolvedRule,
SanitizedRule,
RuleStatusDropdownProps,
@@ -412,8 +414,11 @@ export enum EditConnectorTabs {
Test = 'test',
}
-export interface RuleEditProps> {
- initialRule: Rule;
+export interface RuleEditProps<
+ Params extends RuleTypeParams = RuleTypeParams,
+ MetaData extends RuleTypeMetaData = RuleTypeMetaData
+> {
+ initialRule: Rule;
ruleTypeRegistry: RuleTypeRegistryContract;
actionTypeRegistry: ActionTypeRegistryContract;
onClose: (reason: RuleFlyoutCloseReason, metadata?: MetaData) => void;
@@ -425,14 +430,27 @@ export interface RuleEditProps> {
ruleType?: RuleType;
}
-export interface RuleAddProps> {
+export interface RuleAddProps<
+ Params extends RuleTypeParams = RuleTypeParams,
+ MetaData extends RuleTypeMetaData = RuleTypeMetaData
+> {
+ /**
+ * ID of the feature this rule should be created for.
+ *
+ * Notes:
+ * - The feature needs to be registered using `featuresPluginSetup.registerKibanaFeature()` API during your plugin's setup phase.
+ * - The user needs to have permission to access the feature in order to create the rule.
+ * */
consumer: string;
ruleTypeRegistry: RuleTypeRegistryContract;
actionTypeRegistry: ActionTypeRegistryContract;
onClose: (reason: RuleFlyoutCloseReason, metadata?: MetaData) => void;
ruleTypeId?: string;
+ /**
+ * Determines whether the user should be able to change the rule type in the UI.
+ */
canChangeTrigger?: boolean;
- initialValues?: Partial;
+ initialValues?: Partial>;
/** @deprecated use `onSave` as a callback after an alert is saved*/
reloadRules?: () => Promise;
hideGrouping?: boolean;
@@ -445,8 +463,8 @@ export interface RuleAddProps> {
useRuleProducer?: boolean;
initialSelectedConsumer?: RuleCreationValidConsumer | null;
}
-export interface RuleDefinitionProps {
- rule: Rule;
+export interface RuleDefinitionProps {
+ rule: Rule;
ruleTypeRegistry: RuleTypeRegistryContract;
actionTypeRegistry: ActionTypeRegistryContract;
onEditRule: () => Promise;