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

[Connectors] Detect deploying agentless infra state #205395

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -97,6 +97,9 @@ export const GeneratedConfigFields: React.FC<GeneratedConfigFieldsProps> = ({
setIsModalVisible(false);
};

const showApiKeyInfoForSelfManagedConnector = !connector.is_native;
const showApiKeyBanner = showApiKeyInfoForSelfManagedConnector && apiKey?.encoded;

return (
<>
{isModalVisible && <ConfirmModal onCancel={onCancel} onConfirm={onConfirm} />}
Expand Down Expand Up @@ -193,96 +196,99 @@ export const GeneratedConfigFields: React.FC<GeneratedConfigFieldsProps> = ({
)}
</EuiFlexItem>
<EuiFlexItem />
<EuiFlexItem>
<EuiFlexGroup responsive={false} gutterSize="xs">
{showApiKeyInfoForSelfManagedConnector && (
<>
<EuiFlexItem>
<EuiFlexGroup responsive={false} gutterSize="xs">
<EuiFlexItem grow={false}>
<EuiIcon type="check" />
</EuiFlexItem>
<EuiFlexItem>
{i18n.translate(
'xpack.enterpriseSearch.connectorDeployment.apiKeyCreatedFlexItemLabel',
{ defaultMessage: 'API key created' }
)}
{apiKey?.encoded && ` *`}
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiIcon type="check" />
<EuiLink
data-test-subj="enterpriseSearchConnectorDeploymentLink"
href={generateEncodedPath(MANAGE_API_KEYS_URL, {})}
external
target="_blank"
>
{apiKey?.name}
</EuiLink>
</EuiFlexItem>
<EuiFlexItem>
{i18n.translate(
'xpack.enterpriseSearch.connectorDeployment.apiKeyCreatedFlexItemLabel',
{ defaultMessage: 'API key created' }
)}
{apiKey?.encoded && ` *`}
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiLink
data-test-subj="enterpriseSearchConnectorDeploymentLink"
href={generateEncodedPath(MANAGE_API_KEYS_URL, {})}
external
target="_blank"
>
{apiKey?.name}
</EuiLink>
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexGroup
responsive={false}
gutterSize="xs"
justifyContent="flexEnd"
alignItems="center"
>
{apiKey?.encoded ? (
<EuiFlexItem>
<EuiCopy textToCopy={apiKey?.encoded}>
{(copy) => (
<EuiFlexGroup responsive={false} alignItems="center" gutterSize="xs">
<EuiFlexItem>
<EuiCode>{apiKey?.encoded}</EuiCode>
</EuiFlexItem>
{generateApiKey && (
<EuiFlexItem grow={false}>
<EuiButtonIcon
data-test-subj="enterpriseSearchGeneratedConfigFieldsButton"
size="xs"
iconType="refresh"
isLoading={isGenerateLoading}
onClick={refreshButtonClick}
disabled={!connector.index_name}
aria-label={i18n.translate(
'xpack.enterpriseSearch.connectorDeployment.refreshAPIKey',
{ defaultMessage: 'Refresh an Elasticsearch API key' }
)}
/>
</EuiFlexItem>
)}
<EuiFlexItem grow={false}>
<EuiButtonIcon
size="xs"
data-test-subj="enterpriseSearchConnectorDeploymentButton"
iconType="copyClipboard"
onClick={copy}
aria-label={i18n.translate(
'xpack.enterpriseSearch.connectorDeployment.copyIndexName',
{ defaultMessage: 'Copy index name' }
<EuiFlexGroup
responsive={false}
gutterSize="xs"
justifyContent="flexEnd"
alignItems="center"
>
{apiKey?.encoded ? (
<EuiFlexItem>
<EuiCopy textToCopy={apiKey?.encoded}>
{(copy) => (
<EuiFlexGroup responsive={false} alignItems="center" gutterSize="xs">
<EuiFlexItem>
<EuiCode>{apiKey?.encoded}</EuiCode>
</EuiFlexItem>
{generateApiKey && (
<EuiFlexItem grow={false}>
<EuiButtonIcon
data-test-subj="enterpriseSearchGeneratedConfigFieldsButton"
size="xs"
iconType="refresh"
isLoading={isGenerateLoading}
onClick={refreshButtonClick}
disabled={!connector.index_name}
aria-label={i18n.translate(
'xpack.enterpriseSearch.connectorDeployment.refreshAPIKey',
{ defaultMessage: 'Refresh an Elasticsearch API key' }
)}
/>
</EuiFlexItem>
)}
/>
</EuiFlexItem>
</EuiFlexGroup>
)}
</EuiCopy>
</EuiFlexItem>
) : (
generateApiKey && (
<EuiFlexItem grow={false}>
<EuiButtonIcon
data-test-subj="enterpriseSearchGeneratedConfigFieldsButton"
size="xs"
iconType="refresh"
isLoading={isGenerateLoading}
onClick={refreshButtonClick}
disabled={!connector.index_name}
/>
</EuiFlexItem>
)
)}
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon
size="xs"
data-test-subj="enterpriseSearchConnectorDeploymentButton"
iconType="copyClipboard"
onClick={copy}
aria-label={i18n.translate(
'xpack.enterpriseSearch.connectorDeployment.copyIndexName',
{ defaultMessage: 'Copy index name' }
)}
/>
</EuiFlexItem>
</EuiFlexGroup>
)}
</EuiCopy>
</EuiFlexItem>
) : (
generateApiKey && (
<EuiFlexItem grow={false}>
<EuiButtonIcon
data-test-subj="enterpriseSearchGeneratedConfigFieldsButton"
size="xs"
iconType="refresh"
isLoading={isGenerateLoading}
onClick={refreshButtonClick}
disabled={!connector.index_name}
/>
</EuiFlexItem>
)
)}
</EuiFlexGroup>
</EuiFlexItem>
</>
)}
</EuiFlexGrid>

{apiKey?.encoded && (
{showApiKeyBanner && (
<>
<EuiSpacer size="m" />
<EuiCallOut
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ import {
hasDocumentLevelSecurityFeature,
hasIncrementalSyncFeature,
} from '../../utils/connector_helpers';
import { getConnectorLastSeenError, isLastSeenOld } from '../../utils/connector_status_helpers';
import {
getConnectorLastSeenError,
hasConnectorBeenSeenRecently,
isLastSeenOld,
} from '../../utils/connector_status_helpers';

import {
ConnectorNameAndDescriptionActions,
Expand Down Expand Up @@ -82,6 +86,7 @@ export interface ConnectorViewValues {
isCanceling: boolean;
isHiddenIndex: boolean;
isLoading: boolean;
isWaitingOnAgentlessDeployment: boolean;
lastUpdated: string | null;
pipelineData: IngestPipelineParams | undefined;
recheckIndexLoading: boolean;
Expand Down Expand Up @@ -206,6 +211,7 @@ export const ConnectorViewLogic = kea<MakeLogicType<ConnectorViewValues, Connect
() => [selectors.hasAdvancedFilteringFeature, selectors.hasBasicFilteringFeature],
(advancedFeature: boolean, basicFeature: boolean) => advancedFeature || basicFeature,
],

hasIncrementalSyncFeature: [
() => [selectors.connector],
(connector?: Connector) => hasIncrementalSyncFeature(connector),
Expand All @@ -231,6 +237,14 @@ export const ConnectorViewLogic = kea<MakeLogicType<ConnectorViewValues, Connect
[Status.IDLE && Status.LOADING].includes(fetchConnectorApiStatus) ||
(index && [Status.IDLE && Status.LOADING].includes(fetchIndexApiStatus)),
],
isWaitingOnAgentlessDeployment: [
() => [selectors.connector],
(connector: Connector) => {
if (!connector || !connector.is_native) return false;

return !hasConnectorBeenSeenRecently(connector);
},
],
pipelineData: [
() => [selectors.connector],
(connector: Connector | undefined) => connector?.pipeline ?? undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@ import React from 'react';

import { useActions, useValues } from 'kea';

import { EuiButton, EuiCallOut, EuiCode, EuiLink, EuiSpacer, EuiText } from '@elastic/eui';
import {
EuiButton,
EuiCallOut,
EuiCode,
EuiFlexGroup,
EuiFlexItem,
EuiLink,
EuiLoadingSpinner,
EuiSpacer,
EuiText,
} from '@elastic/eui';

import { i18n } from '@kbn/i18n';

Expand Down Expand Up @@ -38,7 +48,7 @@ import { ConnectorViewLogic } from './connector_view_logic';

export const ConnectorDetailOverview: React.FC = () => {
const { indexData } = useValues(IndexViewLogic);
const { connector, error } = useValues(ConnectorViewLogic);
const { connector, error, isWaitingOnAgentlessDeployment } = useValues(ConnectorViewLogic);
const { isCloud } = useValues(KibanaLogic);
const { showModal } = useActions(ConvertConnectorLogic);
const { isModalVisible } = useValues(ConvertConnectorLogic);
Expand Down Expand Up @@ -73,6 +83,39 @@ export const ConnectorDetailOverview: React.FC = () => {
</>
)
}
{isWaitingOnAgentlessDeployment && (
<>
<EuiCallOut
color="warning"
title={
<EuiFlexGroup alignItems="center">
<EuiFlexItem grow={false}>
<EuiLoadingSpinner />
</EuiFlexItem>
<EuiFlexItem>
{i18n.translate(
'xpack.enterpriseSearch.content.connectors.overview.agentlessDeploymentNotReadyCallOut.title',
{
defaultMessage: 'Provisioning infrastructure',
}
)}
</EuiFlexItem>
</EuiFlexGroup>
}
>
<EuiSpacer size="s" />
<EuiText size="s">
{i18n.translate(
'xpack.enterpriseSearch.content.connectors.overview.agentlessDeploymentNotReadyCallOut.description',
{
defaultMessage: 'Setting up the agentless infrastructure to run the connector.',
}
)}
</EuiText>
</EuiCallOut>
<EuiSpacer />
</>
)}
{error && (
<>
<EuiCallOut
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ import { SelfManagePreference } from '../create_connector';

interface ChooseConnectorSelectableProps {
selfManaged: SelfManagePreference;
disabled?: boolean;
}
interface OptionData {
secondaryContent?: string;
}

export const ChooseConnector: React.FC<ChooseConnectorSelectableProps> = ({ selfManaged }) => {
export const ChooseConnector: React.FC<ChooseConnectorSelectableProps> = ({
selfManaged,
disabled,
}) => {
const { euiTheme } = useEuiTheme();
const [selectedOption, setSelectedOption] = useState<Array<EuiComboBoxOptionOption<OptionData>>>(
[]
Expand Down Expand Up @@ -142,6 +146,7 @@ export const ChooseConnector: React.FC<ChooseConnectorSelectableProps> = ({ self

return (
<EuiComboBox
isDisabled={disabled}
aria-label={i18n.translate(
'xpack.enterpriseSearch.createConnector.chooseConnectorSelectable.euiComboBox.accessibleScreenReaderLabelLabel',
{ defaultMessage: 'Select a data source for your connector to use.' }
Expand Down
Loading
Loading