Skip to content

Commit

Permalink
[8.17] [Search][Connectors] Disable Elastic managed option when runni…
Browse files Browse the repository at this point in the history
…ng Kibana locally (#201950) (#202590)

# Backport

This will backport the following commits from `main` to `8.17`:
- [[Search][Connectors] Disable Elastic managed option when running
Kibana locally (#201950)](#201950)

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

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

<!--BACKPORT [{"author":{"name":"José Luis
González","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-02T21:37:01Z","message":"[Search][Connectors]
Disable Elastic managed option when running Kibana locally
(#201950)\n\n## Summary\r\n\r\nThis PR disables the _Elastic managed_
option when creating a connector\r\nwhile running Kibana locally. We
also inform and encourage users to get\r\na Cloud trial taking them
to\r\nhttps://cloud.elastic.co/registration?onboarding_token=connectors
If the\r\nuser finish up the registration process he will en up in
the\r\n`/app/enterprise_search/content/connectors` in product
connectors\r\nsection.\r\n\r\n![CleanShot 2024-12-02 at 22
33\r\n07](https://github.com/user-attachments/assets/f95181c5-1d9f-447c-8c30-ac251a60b6c1)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>","sha":"b5273734317b6278b015851b396d0b4c4edcc571","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Search","backport:version","v8.17.0","v8.18.0","v8.16.2"],"title":"[Search][Connectors]
Disable Elastic managed option when running Kibana
locally","number":201950,"url":"https://github.com/elastic/kibana/pull/201950","mergeCommit":{"message":"[Search][Connectors]
Disable Elastic managed option when running Kibana locally
(#201950)\n\n## Summary\r\n\r\nThis PR disables the _Elastic managed_
option when creating a connector\r\nwhile running Kibana locally. We
also inform and encourage users to get\r\na Cloud trial taking them
to\r\nhttps://cloud.elastic.co/registration?onboarding_token=connectors
If the\r\nuser finish up the registration process he will en up in
the\r\n`/app/enterprise_search/content/connectors` in product
connectors\r\nsection.\r\n\r\n![CleanShot 2024-12-02 at 22
33\r\n07](https://github.com/user-attachments/assets/f95181c5-1d9f-447c-8c30-ac251a60b6c1)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>","sha":"b5273734317b6278b015851b396d0b4c4edcc571"}},"sourceBranch":"main","suggestedTargetBranches":["8.17","8.x","8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201950","number":201950,"mergeCommit":{"message":"[Search][Connectors]
Disable Elastic managed option when running Kibana locally
(#201950)\n\n## Summary\r\n\r\nThis PR disables the _Elastic managed_
option when creating a connector\r\nwhile running Kibana locally. We
also inform and encourage users to get\r\na Cloud trial taking them
to\r\nhttps://cloud.elastic.co/registration?onboarding_token=connectors
If the\r\nuser finish up the registration process he will en up in
the\r\n`/app/enterprise_search/content/connectors` in product
connectors\r\nsection.\r\n\r\n![CleanShot 2024-12-02 at 22
33\r\n07](https://github.com/user-attachments/assets/f95181c5-1d9f-447c-8c30-ac251a60b6c1)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>","sha":"b5273734317b6278b015851b396d0b4c4edcc571"}},{"branch":"8.17","label":"v8.17.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: José Luis González <[email protected]>
  • Loading branch information
kibanamachine and JoseLuisGJ authored Dec 2, 2024
1 parent 68721fb commit d6797d4
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
*/
import React, { useState } from 'react';

import { css } from '@emotion/react';

import {
EuiButton,
EuiButtonIcon,
EuiCallOut,
EuiFlexGroup,
Expand Down Expand Up @@ -83,13 +86,15 @@ const connectorClientPopoverPanels = [
];

export interface ConnectorDescriptionPopoverProps {
isDisabled: boolean;
isNative: boolean;
isRunningLocally?: boolean;
showIsOnlySelfManaged: boolean;
}

export const ConnectorDescriptionPopover: React.FC<ConnectorDescriptionPopoverProps> = ({
isNative,
isDisabled,
isRunningLocally,
showIsOnlySelfManaged,
}) => {
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
const panels = isNative ? nativePopoverPanels : connectorClientPopoverPanels;
Expand All @@ -111,55 +116,115 @@ export const ConnectorDescriptionPopover: React.FC<ConnectorDescriptionPopoverPr
setIsPopoverOpen(false);
}}
>
<EuiPanel hasBorder={false} hasShadow={false}>
{isDisabled && (
<EuiFlexGroup>
<EuiFlexItem>
<EuiCallOut
title={i18n.translate(
'xpack.enterpriseSearch.createConnector.connectorDescriptionBadge.notAvailableTitle',
{
defaultMessage:
'This connector is not available as an Elastic-managed Connector',
<EuiPanel
css={css`
max-width: 700px;
`}
hasBorder={false}
hasShadow={false}
>
{(showIsOnlySelfManaged || isRunningLocally) && (
<>
<EuiFlexGroup>
<EuiFlexItem>
<EuiCallOut
title={
showIsOnlySelfManaged
? i18n.translate(
'xpack.enterpriseSearch.createConnector.connectorDescriptionBadge.isOnlySelfManagedAvailableTitle',
{
defaultMessage:
'This connector is not available as an Elastic-managed Connector',
}
)
: i18n.translate(
'xpack.enterpriseSearch.createConnector.connectorDescriptionBadge.isRunningLocallyTitle',
{
defaultMessage:
'Elastic managed connectors are only available in Elastic Cloud',
}
)
}
)}
size="s"
iconType="warning"
color="warning"
/>
</EuiFlexItem>
size="s"
iconType="warning"
color="warning"
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="m" />
</>
)}

{!isRunningLocally && (
<EuiFlexGroup>
{panels.map((panel) => {
return (
<EuiFlexItem grow={false} key={panel.id}>
<EuiFlexGroup
direction="column"
alignItems="center"
gutterSize="s"
style={{ maxWidth: 200 }}
>
<EuiFlexItem grow={false}>
<EuiFlexGroup responsive={false} gutterSize="s">
{panel.icons.map((icon, index) => (
<EuiFlexItem grow={false} key={index}>
{icon}
</EuiFlexItem>
))}
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiText size="s" grow={false} textAlign="center">
<p>{panel.description}</p>
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
);
})}
</EuiFlexGroup>
)}
<EuiSpacer size="m" />
<EuiFlexGroup>
{panels.map((panel) => {
return (
<EuiFlexItem grow={false} key={panel.id}>
<EuiFlexGroup
direction="column"
alignItems="center"
gutterSize="s"
style={{ maxWidth: 200 }}
{isRunningLocally && (
<>
<EuiSpacer size="m" />
<EuiFlexGroup direction="column" justifyContent="center">
<EuiFlexItem grow>
<EuiText textAlign="center">
<h3>
{i18n.translate(
'xpack.enterpriseSearch.createConnector.connectorDescriptionBadge.learnMore',
{ defaultMessage: 'Explore Elastic Cloud with your 14-day free trial' }
)}
</h3>
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow>
<EuiText size="s" textAlign="center" color="subdued">
{i18n.translate(
'xpack.enterpriseSearch.createConnector.connectorDescriptionBadge.learnMore',
{
defaultMessage:
'Take advantage of Elastic managed connectors and generative AI capabilities to address search challenges across your organization in real time, at scale.',
}
)}
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton
data-test-subj="enterpriseSearchConnectorStartFreeTrialButton"
href="https://cloud.elastic.co/registration?onboarding_token=connectors"
target="_blank"
>
<EuiFlexItem grow={false}>
<EuiFlexGroup responsive={false} gutterSize="s">
{panel.icons.map((icon, index) => (
<EuiFlexItem grow={false} key={index}>
{icon}
</EuiFlexItem>
))}
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiText size="s" grow={false} textAlign="center">
<p>{panel.description}</p>
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
{i18n.translate('xpack.enterpriseSearch.createConnector.startTrialButtonLabel', {
defaultMessage: 'Start free trial',
})}
</EuiButton>
</EuiFlexItem>
);
})}
</EuiFlexGroup>
</EuiFlexGroup>
</>
)}
</EuiPanel>
</EuiPopover>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,14 @@ export const CreateConnector: React.FC = () => {
const { setCurrentStep } = useActions(NewConnectorLogic);
const stepStates = generateStepState(currentStep);

const { config } = useValues(KibanaLogic);
const isRunningLocally = (config.host ?? '').includes('localhost');

useEffect(() => {
// TODO: separate this to ability and preference
if (selectedConnector && !selectedConnector.isNative && selfManagePreference === 'native') {
if (
(selectedConnector && !selectedConnector.isNative && selfManagePreference === 'native') ||
isRunningLocally
) {
setSelfManagePreference('selfManaged');
}
}, [selectedConnector]);
Expand Down Expand Up @@ -141,6 +146,7 @@ export const CreateConnector: React.FC = () => {
setSelfManagePreference(preference);
}}
error={errorToText(error)}
isRunningLocally={isRunningLocally}
/>
),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { SelfManagePreference } from './create_connector';

interface StartStepProps {
error?: string | React.ReactNode;
isRunningLocally: boolean;
onSelfManagePreferenceChange(preference: SelfManagePreference): void;
selfManagePreference: SelfManagePreference;
setCurrentStep: Function;
Expand All @@ -48,6 +49,7 @@ interface StartStepProps {

export const StartStep: React.FC<StartStepProps> = ({
title,
isRunningLocally,
selfManagePreference,
setCurrentStep,
onSelfManagePreferenceChange,
Expand Down Expand Up @@ -206,14 +208,15 @@ export const StartStep: React.FC<StartStepProps> = ({
{ defaultMessage: 'Elastic managed' }
)}
checked={selfManagePreference === 'native'}
disabled={selectedConnector?.isNative === false}
disabled={selectedConnector?.isNative === false || isRunningLocally}
onChange={() => onSelfManagePreferenceChange('native')}
name="setUp"
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<ConnectorDescriptionPopover
isDisabled={selectedConnector?.isNative === false}
showIsOnlySelfManaged={selectedConnector?.isNative === false}
isRunningLocally={isRunningLocally}
isNative
/>
</EuiFlexItem>
Expand All @@ -231,7 +234,7 @@ export const StartStep: React.FC<StartStepProps> = ({
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<ConnectorDescriptionPopover isDisabled={false} isNative={false} />
<ConnectorDescriptionPopover showIsOnlySelfManaged={false} isNative={false} />
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -18333,7 +18333,6 @@
"xpack.enterpriseSearch.createConnector.configurationStep.configurationLabel": "Configuration",
"xpack.enterpriseSearch.createConnector.configurationStep.h4.finishUpLabel": "Terminer",
"xpack.enterpriseSearch.createConnector.configurationStep.p.description": "Vous pouvez synchroniser manuellement vos données, planifier une synchronisation récurrente ou gérer vos domaines.",
"xpack.enterpriseSearch.createConnector.connectorDescriptionBadge.notAvailableTitle": "Ce connecteur n'est pas disponible en tant que connecteur géré par Elastic",
"xpack.enterpriseSearch.createConnector.connectorDocsLinkLabel": "référence du connecteur",
"xpack.enterpriseSearch.createConnector.DeploymentStep.Configuration.description": "Maintenant, configurez votre robot Elastic et synchronisez les données.",
"xpack.enterpriseSearch.createConnector.DeploymentStep.Configuration.title": "Configuration",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -18307,7 +18307,6 @@
"xpack.enterpriseSearch.createConnector.configurationStep.configurationLabel": "構成",
"xpack.enterpriseSearch.createConnector.configurationStep.h4.finishUpLabel": "終了",
"xpack.enterpriseSearch.createConnector.configurationStep.p.description": "データを手動で同期したり、繰り返し同期をスケジュールしたり、ドメインを管理したりできます。",
"xpack.enterpriseSearch.createConnector.connectorDescriptionBadge.notAvailableTitle": "このコネクターは、Elasticマネージドコネクターとして利用できません。",
"xpack.enterpriseSearch.createConnector.connectorDocsLinkLabel": "コネクター参照",
"xpack.enterpriseSearch.createConnector.DeploymentStep.Configuration.description": "次に、Elasticクローラーを構成し、データを同期します。",
"xpack.enterpriseSearch.createConnector.DeploymentStep.Configuration.title": "構成",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -18350,7 +18350,6 @@
"xpack.enterpriseSearch.createConnector.configurationStep.configurationLabel": "配置",
"xpack.enterpriseSearch.createConnector.configurationStep.h4.finishUpLabel": "结束",
"xpack.enterpriseSearch.createConnector.configurationStep.p.description": "您可以手动同步数据,计划重复同步或管理您的域。",
"xpack.enterpriseSearch.createConnector.connectorDescriptionBadge.notAvailableTitle": "此连接器不可用作 Elastic 托管连接器",
"xpack.enterpriseSearch.createConnector.connectorDocsLinkLabel": "连接器参考",
"xpack.enterpriseSearch.createConnector.DeploymentStep.Configuration.description": "立即配置您的 Elastic 网络爬虫并同步数据。",
"xpack.enterpriseSearch.createConnector.DeploymentStep.Configuration.title": "配置",
Expand Down

0 comments on commit d6797d4

Please sign in to comment.