Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Obs AI Assistant] Hide unavailable connectors #181455

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,22 @@ 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).map((type) => type.id)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cnasikas there is also enabledInConfig, but I wasn't sure what that means. Do we also need to take it into account?

Copy link
Member

@cnasikas cnasikas Apr 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. Users can disable connector types in kibana.yml by using the xpack.actions.enabledActionTypes config. By default all types are available. Better to filter them out.

),
actionsClient.getAll(),
]);

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

Expand Down
Loading