Skip to content

Commit

Permalink
[8.x] [ResponseOps][Connectors]Preconfigured connectors of disabled t…
Browse files Browse the repository at this point in the history
…ypes show as disabled, but are actually enabled (#198792) (#199157)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ResponseOps][Connectors]Preconfigured connectors of disabled types
show as disabled, but are actually enabled
(#198792)](#198792)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Georgiana-Andreea
Onoleață","email":"georgiana.onoleata@elastic.co"},"sourceCommit":{"committedDate":"2024-11-06T14:43:48Z","message":"[ResponseOps][Connectors]Preconfigured
connectors of disabled types show as disabled, but are actually enabled
(#198792)\n\nCloses
https://github.com/elastic/kibana/issues/190420\r\n\r\n##
Summary\r\n\r\n- the preconfigured connectors should be displayed as
enabled and not\r\nhave the tooltip icon even if the
xpack.actions.enabledActionTypes: []\r\nsetting is present in the
kibana.yml (to disable all the connector\r\ntypes)\r\n\r\n![Screenshot
2024-11-04 at 14
38\r\n10](https://github.com/user-attachments/assets/ee817087-a079-481b-bf82-b7247f3ea923)\r\n\r\n---------\r\n\r\nCo-authored-by:
Antonio
<antoniodcoelho@gmail.com>","sha":"56b0ac2eda55b0fe1a3dc0cd445d704320b69981","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","v9.0.0","backport:prev-minor","v8.17.0"],"title":"[ResponseOps][Connectors]Preconfigured
connectors of disabled types show as disabled, but are actually
enabled","number":198792,"url":"https://github.com/elastic/kibana/pull/198792","mergeCommit":{"message":"[ResponseOps][Connectors]Preconfigured
connectors of disabled types show as disabled, but are actually enabled
(#198792)\n\nCloses
https://github.com/elastic/kibana/issues/190420\r\n\r\n##
Summary\r\n\r\n- the preconfigured connectors should be displayed as
enabled and not\r\nhave the tooltip icon even if the
xpack.actions.enabledActionTypes: []\r\nsetting is present in the
kibana.yml (to disable all the connector\r\ntypes)\r\n\r\n![Screenshot
2024-11-04 at 14
38\r\n10](https://github.com/user-attachments/assets/ee817087-a079-481b-bf82-b7247f3ea923)\r\n\r\n---------\r\n\r\nCo-authored-by:
Antonio
<antoniodcoelho@gmail.com>","sha":"56b0ac2eda55b0fe1a3dc0cd445d704320b69981"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198792","number":198792,"mergeCommit":{"message":"[ResponseOps][Connectors]Preconfigured
connectors of disabled types show as disabled, but are actually enabled
(#198792)\n\nCloses
https://github.com/elastic/kibana/issues/190420\r\n\r\n##
Summary\r\n\r\n- the preconfigured connectors should be displayed as
enabled and not\r\nhave the tooltip icon even if the
xpack.actions.enabledActionTypes: []\r\nsetting is present in the
kibana.yml (to disable all the connector\r\ntypes)\r\n\r\n![Screenshot
2024-11-04 at 14
38\r\n10](https://github.com/user-attachments/assets/ee817087-a079-481b-bf82-b7247f3ea923)\r\n\r\n---------\r\n\r\nCo-authored-by:
Antonio
<antoniodcoelho@gmail.com>","sha":"56b0ac2eda55b0fe1a3dc0cd445d704320b69981"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Georgiana-Andreea Onoleață <georgiana.onoleata@elastic.co>
  • Loading branch information
kibanamachine and georgianaonoleata1904 authored Nov 6, 2024
1 parent 5194e64 commit cd89eb9
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,26 @@ describe('checkActionTypeEnabled', () => {
}
`);
});
test('checkActionTypeEnabled returns true when actionType is disabled by config', async () => {
const actionType: ActionType = {
id: '1',
minimumLicenseRequired: 'basic',
supportedFeatureIds: ['alerting'],
name: 'my action',
enabled: false,
enabledInConfig: false,
enabledInLicense: true,
isSystemActionType: false,
};

const isPreconfiguredConnector = true;

expect(checkActionTypeEnabled(actionType, isPreconfiguredConnector)).toMatchInlineSnapshot(`
Object {
"isEnabled": true,
}
`);
});
});

describe('checkActionFormActionTypeEnabled', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ export interface IsDisabledResult {
}

export const checkActionTypeEnabled = (
actionType?: ActionType
actionType?: ActionType,
isPreconfiguredConnector: boolean = false
): IsEnabledResult | IsDisabledResult => {
if (actionType?.enabledInLicense === false) {
return getLicenseCheckResult(actionType);
}

if (actionType?.enabledInConfig === false) {
if (actionType?.enabledInConfig === false && isPreconfiguredConnector === false) {
return configurationCheckResult;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,12 @@ describe('actions_connectors_list', () => {
referencedByCount: 1,
config: {},
},
{
id: '3',
actionTypeId: 'test3',
isPreconfigured: true,
isDeprecated: false,
},
] as ActionConnector[]
}
setActions={() => {}}
Expand All @@ -766,14 +772,21 @@ describe('actions_connectors_list', () => {
it('renders table of connectors', async () => {
await setup();
expect(wrapper.find('EuiInMemoryTable')).toHaveLength(1);
expect(wrapper.find('EuiTableRow')).toHaveLength(2);
expect(wrapper.find('EuiTableRow')).toHaveLength(3);
expect(wrapper.find('EuiTableRow').at(0).prop('className')).toEqual(
'actConnectorsList__tableRowDisabled'
);
expect(wrapper.find('EuiTableRow').at(1).prop('className')).toEqual(
'actConnectorsList__tableRowDisabled'
);
});

it('renders preconfigured connectors as enabled', async () => {
await setup();
expect(wrapper.find('EuiTableRow').at(2).prop('className')).not.toEqual(
'actConnectorsList__tableRowDisabled'
);
});
});

describe('component with deprecated connectors', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ const ActionsConnectorsList = ({
truncateText: true,
render: (value: string, item: ActionConnectorTableItem) => {
const checkEnabledResult = checkActionTypeEnabled(
actionTypesIndex && actionTypesIndex[item.actionTypeId]
actionTypesIndex && actionTypesIndex[item.actionTypeId],
item.isPreconfigured
);

/**
* TODO: Remove when connectors can provide their own UX message.
* Issue: https://github.com/elastic/kibana/issues/114507
Expand Down Expand Up @@ -363,7 +363,8 @@ const ActionsConnectorsList = ({
columns={actionsTableColumns}
rowProps={(item: ActionConnectorTableItem) => ({
className:
!actionTypesIndex || !actionTypesIndex[item.actionTypeId]?.enabled
!item.isPreconfigured &&
(!actionTypesIndex || !actionTypesIndex[item.actionTypeId]?.enabled)
? 'actConnectorsList__tableRowDisabled'
: '',
'data-test-subj': 'connectors-row',
Expand Down

0 comments on commit cd89eb9

Please sign in to comment.