-
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.
Merge branch 'system_actions_mvp' of github.com:elastic/kibana into s…
…ystem_actions_mvp
- Loading branch information
Showing
58 changed files
with
2,458 additions
and
535 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
36 changes: 36 additions & 0 deletions
36
x-pack/plugins/alerting/common/system_actions/is_system_action.test.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,36 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { RuleSystemAction, RuleActionTypes, RuleDefaultAction } from '../rule'; | ||
import { isSystemAction } from './is_system_action'; | ||
|
||
describe('isSystemAction', () => { | ||
const defaultAction: RuleDefaultAction = { | ||
actionTypeId: '.test', | ||
uuid: '111', | ||
group: 'default', | ||
id: '1', | ||
params: {}, | ||
type: RuleActionTypes.DEFAULT, | ||
}; | ||
|
||
const systemAction: RuleSystemAction = { | ||
id: '1', | ||
uuid: '123', | ||
params: { 'not-exist': 'test' }, | ||
actionTypeId: '.test', | ||
type: RuleActionTypes.SYSTEM, | ||
}; | ||
|
||
it('returns true if it is a system action', () => { | ||
expect(isSystemAction(systemAction)).toBe(true); | ||
}); | ||
|
||
it('returns false if it is not a system action', () => { | ||
expect(isSystemAction(defaultAction)).toBe(false); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
x-pack/plugins/alerting/common/system_actions/is_system_action.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,17 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { AsApiContract } from '@kbn/actions-plugin/common'; | ||
import { RuleAction, RuleSystemAction, RuleActionTypes } from '../rule'; | ||
|
||
type GetSystemActionType<T> = T extends RuleAction | ||
? RuleSystemAction | ||
: AsApiContract<RuleSystemAction>; | ||
|
||
export const isSystemAction = ( | ||
action: RuleAction | AsApiContract<RuleAction> | ||
): action is GetSystemActionType<typeof action> => action.type === RuleActionTypes.SYSTEM; |
Oops, something went wrong.