Skip to content

Commit

Permalink
[8.14] [Obs AI Assistant] Hide unavailable connectors (#181455) (#181537
Browse files Browse the repository at this point in the history
)

# Backport

This will backport the following commits from `main` to `8.14`:
- [[Obs AI Assistant] Hide unavailable connectors
(#181455)](#181455)

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

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

<!--BACKPORT [{"author":{"name":"Dario
Gieselaar","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-04-24T09:51:58Z","message":"[Obs
AI Assistant] Hide unavailable connectors (#181455)\n\nHides unavailable
connectors (e.g. due to license
mismatches).","sha":"214833af0bc45dad269529a1904cfbb934da945e","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Obs
AI Assistant","v8.14.0","v8.15.0"],"title":"[Obs AI Assistant] Hide
unavailable
connectors","number":181455,"url":"https://github.com/elastic/kibana/pull/181455","mergeCommit":{"message":"[Obs
AI Assistant] Hide unavailable connectors (#181455)\n\nHides unavailable
connectors (e.g. due to license
mismatches).","sha":"214833af0bc45dad269529a1904cfbb934da945e"}},"sourceBranch":"main","suggestedTargetBranches":["8.14"],"targetPullRequestStates":[{"branch":"8.14","label":"v8.14.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/181455","number":181455,"mergeCommit":{"message":"[Obs
AI Assistant] Hide unavailable connectors (#181455)\n\nHides unavailable
connectors (e.g. due to license
mismatches).","sha":"214833af0bc45dad269529a1904cfbb934da945e"}}]}]
BACKPORT-->

Co-authored-by: Dario Gieselaar <[email protected]>
  • Loading branch information
kibanamachine and dgieselaar authored Apr 24, 2024
1 parent 54d50e5 commit 0c2a4c9
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,24 @@ const listConnectorsRoute = createObservabilityAIAssistantServerRoute({
await plugins.actions.start()
).getActionsClientWithRequest(request);

const connectors = await actionsClient.getAll();
const [availableTypes, connectors] = await Promise.all([
actionsClient
.listTypes({
includeSystemActionTypes: false,
})
.then((types) =>
types
.filter((type) => type.enabled && type.enabledInLicense && type.enabledInConfig)
.map((type) => type.id)
),
actionsClient.getAll(),
]);

return connectors.filter((connector) => isSupportedConnectorType(connector.actionTypeId));
return connectors.filter(
(connector) =>
availableTypes.includes(connector.actionTypeId) &&
isSupportedConnectorType(connector.actionTypeId)
);
},
});

Expand Down

0 comments on commit 0c2a4c9

Please sign in to comment.