mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Alerts] Hide case connector (#85398)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
90893f9487
commit
8b5c68ab63
2 changed files with 27 additions and 9 deletions
|
@ -12,6 +12,7 @@ import { loadActionTypes } from '../../lib/action_connector_api';
|
|||
import { actionTypeCompare } from '../../lib/action_type_compare';
|
||||
import { checkActionTypeEnabled } from '../../lib/check_action_type_enabled';
|
||||
import { useKibana } from '../../../common/lib/kibana';
|
||||
import { DEFAULT_HIDDEN_ACTION_TYPES } from '../../..';
|
||||
|
||||
interface Props {
|
||||
onActionTypeChange: (actionType: ActionType) => void;
|
||||
|
@ -35,7 +36,18 @@ export const ActionTypeMenu = ({
|
|||
useEffect(() => {
|
||||
(async () => {
|
||||
try {
|
||||
const availableActionTypes = actionTypes ?? (await loadActionTypes({ http }));
|
||||
/**
|
||||
* Hidden action types will be hidden only on Alerts & Actions.
|
||||
* actionTypes prop is not filtered. Thus, any consumer that provides it's own actionTypes
|
||||
* can use the hidden action types. For example, Cases or Detections of Security Solution.
|
||||
*
|
||||
* TODO: Remove when cases connector is available across Kibana. Issue: https://github.com/elastic/kibana/issues/82502.
|
||||
* */
|
||||
const availableActionTypes =
|
||||
actionTypes ??
|
||||
(await loadActionTypes({ http })).filter(
|
||||
(actionType) => !DEFAULT_HIDDEN_ACTION_TYPES.includes(actionType.id)
|
||||
);
|
||||
const index: ActionTypeIndex = {};
|
||||
for (const actionTypeItem of availableActionTypes) {
|
||||
index[actionTypeItem.id] = actionTypeItem;
|
||||
|
|
|
@ -39,6 +39,7 @@ import './actions_connectors_list.scss';
|
|||
import { ActionConnector, ActionConnectorTableItem, ActionTypeIndex } from '../../../../types';
|
||||
import { EmptyConnectorsPrompt } from '../../../components/prompts/empty_connectors_prompt';
|
||||
import { useKibana } from '../../../../common/lib/kibana';
|
||||
import { DEFAULT_HIDDEN_ACTION_TYPES } from '../../../../';
|
||||
|
||||
export const ActionsConnectorsList: React.FunctionComponent = () => {
|
||||
const {
|
||||
|
@ -94,18 +95,23 @@ export const ActionsConnectorsList: React.FunctionComponent = () => {
|
|||
}, []);
|
||||
|
||||
const actionConnectorTableItems: ActionConnectorTableItem[] = actionTypesIndex
|
||||
? actions.map((action) => {
|
||||
return {
|
||||
...action,
|
||||
actionType: actionTypesIndex[action.actionTypeId]
|
||||
? actionTypesIndex[action.actionTypeId].name
|
||||
: action.actionTypeId,
|
||||
};
|
||||
})
|
||||
? actions
|
||||
// TODO: Remove when cases connector is available across Kibana. Issue: https://github.com/elastic/kibana/issues/82502.
|
||||
.filter((action) => !DEFAULT_HIDDEN_ACTION_TYPES.includes(action.actionTypeId))
|
||||
.map((action) => {
|
||||
return {
|
||||
...action,
|
||||
actionType: actionTypesIndex[action.actionTypeId]
|
||||
? actionTypesIndex[action.actionTypeId].name
|
||||
: action.actionTypeId,
|
||||
};
|
||||
})
|
||||
: [];
|
||||
|
||||
const actionTypesList: Array<{ value: string; name: string }> = actionTypesIndex
|
||||
? Object.values(actionTypesIndex)
|
||||
// TODO: Remove when cases connector is available across Kibana. Issue: https://github.com/elastic/kibana/issues/82502.
|
||||
.filter((actionType) => !DEFAULT_HIDDEN_ACTION_TYPES.includes(actionType.id))
|
||||
.map((actionType) => ({
|
||||
value: actionType.id,
|
||||
name: `${actionType.name} (${getActionsCountByActionType(actions, actionType.id)})`,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue