Skip to content

Commit

Permalink
[9.0] [Agentless Connectors] Integration overview panel (elastic#210222
Browse files Browse the repository at this point in the history
…) (elastic#210609)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[Agentless Connectors] Integration overview panel
(elastic#210222)](elastic#210222)

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

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

<!--BACKPORT [{"author":{"name":"Jedr
Blaszyk","email":"jedrazb@gmail.com"},"sourceCommit":{"committedDate":"2025-02-11T15:26:04Z","message":"[Agentless
Connectors] Integration overview panel (elastic#210222)\n\n## Summary\n\nAdd
links to relevant areas for agentless connector:\n- link integration
owning this connector\n- if policy related to this connector exist:\n -
add link to view policy\n - otherwise display `No policy found`\n- if
agent related to this policy exists \n - display agent status (e.g. is
it offline, or any other state)\n - link to fleet agent host overview\n-
create discover app link to show logs related to agent/connector
for\nthe past 6 hrs (select relevant columns :) )\n - otherwise, handle
this \n\nChanged isWaitingOnAgentlessDeployment to just check whether
`last_seen`\n(connector heartbeat field) was populated, this is to
address this\nreported
[issue](https://github.com/elastic/search-team/issues/9165).\n\n###
Happy
path\n\n\nhttps://github.com/user-attachments/assets/76db0b66-dda3-43a7-a74b-79348c7e7989\n\n###
Handling edge cases\n\n#### No agent / inactive
agent\n\n\nhttps://github.com/user-attachments/assets/eae9b8da-de24-4d77-bc9e-b7cfad75b426\n\nsimilarly
we handle edge cases with policy not existing yet\n\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [x] Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [ x [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[x] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [x] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n---------\n\nCo-authored-by:
José Luis González <joseluisgj@gmail.com>\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"0edba3919be24626dc1a395fa2b7768e84a5778c","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:version","v9.1.0"],"title":"[Agentless
Connectors] Integration overview
panel","number":210222,"url":"https://github.com/elastic/kibana/pull/210222","mergeCommit":{"message":"[Agentless
Connectors] Integration overview panel (elastic#210222)\n\n## Summary\n\nAdd
links to relevant areas for agentless connector:\n- link integration
owning this connector\n- if policy related to this connector exist:\n -
add link to view policy\n - otherwise display `No policy found`\n- if
agent related to this policy exists \n - display agent status (e.g. is
it offline, or any other state)\n - link to fleet agent host overview\n-
create discover app link to show logs related to agent/connector
for\nthe past 6 hrs (select relevant columns :) )\n - otherwise, handle
this \n\nChanged isWaitingOnAgentlessDeployment to just check whether
`last_seen`\n(connector heartbeat field) was populated, this is to
address this\nreported
[issue](https://github.com/elastic/search-team/issues/9165).\n\n###
Happy
path\n\n\nhttps://github.com/user-attachments/assets/76db0b66-dda3-43a7-a74b-79348c7e7989\n\n###
Handling edge cases\n\n#### No agent / inactive
agent\n\n\nhttps://github.com/user-attachments/assets/eae9b8da-de24-4d77-bc9e-b7cfad75b426\n\nsimilarly
we handle edge cases with policy not existing yet\n\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [x] Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [ x [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[x] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [x] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n---------\n\nCo-authored-by:
José Luis González <joseluisgj@gmail.com>\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"0edba3919be24626dc1a395fa2b7768e84a5778c"}},"sourceBranch":"main","suggestedTargetBranches":["9.0"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/210222","number":210222,"mergeCommit":{"message":"[Agentless
Connectors] Integration overview panel (elastic#210222)\n\n## Summary\n\nAdd
links to relevant areas for agentless connector:\n- link integration
owning this connector\n- if policy related to this connector exist:\n -
add link to view policy\n - otherwise display `No policy found`\n- if
agent related to this policy exists \n - display agent status (e.g. is
it offline, or any other state)\n - link to fleet agent host overview\n-
create discover app link to show logs related to agent/connector
for\nthe past 6 hrs (select relevant columns :) )\n - otherwise, handle
this \n\nChanged isWaitingOnAgentlessDeployment to just check whether
`last_seen`\n(connector heartbeat field) was populated, this is to
address this\nreported
[issue](https://github.com/elastic/search-team/issues/9165).\n\n###
Happy
path\n\n\nhttps://github.com/user-attachments/assets/76db0b66-dda3-43a7-a74b-79348c7e7989\n\n###
Handling edge cases\n\n#### No agent / inactive
agent\n\n\nhttps://github.com/user-attachments/assets/eae9b8da-de24-4d77-bc9e-b7cfad75b426\n\nsimilarly
we handle edge cases with policy not existing yet\n\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [x] Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [ x [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[x] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [x] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n---------\n\nCo-authored-by:
José Luis González <joseluisgj@gmail.com>\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"0edba3919be24626dc1a395fa2b7768e84a5778c"}}]}]
BACKPORT-->

Co-authored-by: Jedr Blaszyk <jedrazb@gmail.com>
  • Loading branch information
kibanamachine and jedrazb authored Feb 11, 2025
1 parent 53b06e0 commit 11c09a7
Show file tree
Hide file tree
Showing 13 changed files with 589 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export enum ErrorCode {
ANALYTICS_COLLECTION_ALREADY_EXISTS = 'analytics_collection_already_exists',
ANALYTICS_COLLECTION_NOT_FOUND = 'analytics_collection_not_found',
CONNECTOR_DOCUMENT_ALREADY_EXISTS = 'connector_document_already_exists',
CONNECTOR_UNSUPPORTED_OPERATION = 'connector_unsupported_operation',
CRAWLER_ALREADY_EXISTS = 'crawler_already_exists',
DOCUMENT_NOT_FOUND = 'document_not_found',
EXPENSIVE_QUERY_NOT_ALLOWED_ERROR = 'expensive_queries_not_allowed',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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 { Agent } from '@kbn/fleet-plugin/common';

import { createApiLogic, Actions } from '../../../shared/api_logic/create_api_logic';
import { HttpLogic } from '../../../shared/http';

export interface GetConnectorAgentlessPolicyApiArgs {
connectorId: string;
}

export interface GetConnectorAgentlessPolicyApiResponse {
policy: {
id: string;
name: string;
};
agent: Pick<Agent, 'last_checkin_status' | 'id' | 'status'>;
}

export const getConnectorAgentlessPolicy = async ({
connectorId,
}: GetConnectorAgentlessPolicyApiArgs): Promise<GetConnectorAgentlessPolicyApiResponse> => {
const route = `/internal/enterprise_search/${connectorId}/agentless_policy`;

return await HttpLogic.values.http.get<GetConnectorAgentlessPolicyApiResponse>(route);
};

export const GetConnectorAgentlessPolicyApiLogic = createApiLogic(
['get_connector_agentless_policy'],
getConnectorAgentlessPolicy
);

export type GetConnectorAgentlessPolicyApiLogicActions = Actions<
GetConnectorAgentlessPolicyApiArgs,
GetConnectorAgentlessPolicyApiResponse
>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* 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 React from 'react';

import { EuiBadge, EuiBadgeProps } from '@elastic/eui';
import { Agent } from '@kbn/fleet-plugin/common';
import { FormattedMessage } from '@kbn/i18n-react';
import { euiLightVars as euiVars } from '@kbn/ui-theme';

export const AgentlessConnectorStatusBadge = ({
status,
...restOfProps
}: {
status: Agent['status'];
} & EuiBadgeProps): React.ReactElement => {
switch (status) {
case 'error':
case 'degraded':
return (
<EuiBadge color="warning" {...restOfProps}>
<FormattedMessage
id="xpack.enterpriseSearch.connectors.elasticManaged.agentHealth.unhealthyStatusText"
defaultMessage="Unhealthy"
/>
</EuiBadge>
);
case 'inactive':
return (
<EuiBadge color={euiVars.euiColorDarkShade} {...restOfProps}>
<FormattedMessage
id="xpack.enterpriseSearch.connectors.elasticManaged.agentHealth.inactiveStatusText"
defaultMessage="Inactive"
/>
</EuiBadge>
);
case 'offline':
return (
<EuiBadge color="default" {...restOfProps}>
<FormattedMessage
id="xpack.enterpriseSearch.connectors.elasticManaged.agentHealth.offlineStatusText"
defaultMessage="Offline"
/>
</EuiBadge>
);
case 'uninstalled':
return (
<EuiBadge color="default" {...restOfProps}>
<FormattedMessage
id="xpack.enterpriseSearch.connectors.elasticManaged.agentHealth.uninstalledStatusText"
defaultMessage="Uninstalled"
/>
</EuiBadge>
);
case 'orphaned':
return (
<EuiBadge color="warning" {...restOfProps}>
<FormattedMessage
id="xpack.enterpriseSearch.connectors.elasticManaged.agentHealth.orphanedStatusText"
defaultMessage="Orphaned"
/>
</EuiBadge>
);

case 'unenrolling':
case 'enrolling':
case 'updating':
return (
<EuiBadge color="primary" {...restOfProps}>
<FormattedMessage
id="xpack.enterpriseSearch.connectors.elasticManaged.agentHealth.updatingStatusText"
defaultMessage="Updating"
/>
</EuiBadge>
);
case 'unenrolled':
return (
<EuiBadge color={euiVars.euiColorDisabled} {...restOfProps}>
<FormattedMessage
id="xpack.enterpriseSearch.connectors.elasticManaged.agentHealth.unenrolledStatusText"
defaultMessage="Unenrolled"
/>
</EuiBadge>
);
default:
return (
<EuiBadge color="success" {...restOfProps}>
<FormattedMessage
id="xpack.enterpriseSearch.connectors.elasticManaged.agentHealth.healthyStatusText"
defaultMessage="Healthy"
/>
</EuiBadge>
);
}
};
Loading

0 comments on commit 11c09a7

Please sign in to comment.