mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[8.x] [Ent Search Plugin] Fix loading initial plugin data, save kbn version in kea, fix connector img version (#199777) (#200529)
# Backport This will backport the following commits from `main` to `8.x`: - [[Ent Search Plugin] Fix loading initial plugin data, save kbn version in kea, fix connector img version (#199777)](https://github.com/elastic/kibana/pull/199777) <!--- 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":"2024-11-18T10:13:19Z","message":"[Ent Search Plugin] Fix loading initial plugin data, save kbn version in kea, fix connector img version (#199777)\n\n## Summary\r\n\r\nPR is a bugfix to dynamically populate the `version` of the connectors\r\ndocker image shown in the onboarding. It's hardcoded to `8.15.0` now\r\n....\r\n\r\nIdeally we want to backport this to 8.16.1 +\r\n\r\nChanges:\r\n- Given that we are already getting\r\n[kibanaVersion](https://github.com/elastic/kibana/blob/main/x-pack/plugins/enterprise_search/public/applications/index.tsx#L65)\r\nfrom the\r\n[backend](https://github.com/elastic/kibana/blob/main/x-pack/plugins/enterprise_search/public/plugin.ts#L212),\r\nI'm saving the version in `KibanaLogic` reducer and use it to popuale\r\nthe docker image version\r\n- I realised that because of [this\r\nchange](664c1a0a08 (diff-19a48c92980fd550e48c5e1d4d1f9a2bec4d309909b7cfa693264c92b387fe3dR95)
)\r\n~10 months ago, we stopped passing plugin data, due to `if\r\n(!this.config.host) return; // No API to call` therefore I removed this\r\nline to fix this. Why I think it's safe to merge?\r\n- It was only added 10 months ago, before things were working without\r\nthis extra if statement\r\n- The backend logic handles the non-existent host: see\r\n[here](https://github.com/elastic/kibana/blob/main/x-pack/plugins/enterprise_search/server/lib/enterprise_search_config_api.ts#L45-L61)\r\n- We are guaranteed that other config fields exist, see [config\r\nschema](d276b48995/x-pack/plugins/enterprise_search/server/index.ts (L16-L42)
)\r\n\r\n<img width=\"1204\" alt=\"Screenshot 2024-11-13 at 10 51 36\"\r\nsrc=\"https://github.com/user-attachments/assets/dbd2395b-00e5-4331-a9be-cb2a87133321\">\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"5d00a0a098930b2292ea7777cd1ee9f46a91a778","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["backport","release_note:skip","v9.0.0","v8.17.0","v8.16.1"],"title":"[Ent Search Plugin] Fix loading initial plugin data, save kbn version in kea, fix connector img version","number":199777,"url":"https://github.com/elastic/kibana/pull/199777","mergeCommit":{"message":"[Ent Search Plugin] Fix loading initial plugin data, save kbn version in kea, fix connector img version (#199777)\n\n## Summary\r\n\r\nPR is a bugfix to dynamically populate the `version` of the connectors\r\ndocker image shown in the onboarding. It's hardcoded to `8.15.0` now\r\n....\r\n\r\nIdeally we want to backport this to 8.16.1 +\r\n\r\nChanges:\r\n- Given that we are already getting\r\n[kibanaVersion](https://github.com/elastic/kibana/blob/main/x-pack/plugins/enterprise_search/public/applications/index.tsx#L65)\r\nfrom the\r\n[backend](https://github.com/elastic/kibana/blob/main/x-pack/plugins/enterprise_search/public/plugin.ts#L212),\r\nI'm saving the version in `KibanaLogic` reducer and use it to popuale\r\nthe docker image version\r\n- I realised that because of [this\r\nchange](664c1a0a08 (diff-19a48c92980fd550e48c5e1d4d1f9a2bec4d309909b7cfa693264c92b387fe3dR95)
)\r\n~10 months ago, we stopped passing plugin data, due to `if\r\n(!this.config.host) return; // No API to call` therefore I removed this\r\nline to fix this. Why I think it's safe to merge?\r\n- It was only added 10 months ago, before things were working without\r\nthis extra if statement\r\n- The backend logic handles the non-existent host: see\r\n[here](https://github.com/elastic/kibana/blob/main/x-pack/plugins/enterprise_search/server/lib/enterprise_search_config_api.ts#L45-L61)\r\n- We are guaranteed that other config fields exist, see [config\r\nschema](d276b48995/x-pack/plugins/enterprise_search/server/index.ts (L16-L42)
)\r\n\r\n<img width=\"1204\" alt=\"Screenshot 2024-11-13 at 10 51 36\"\r\nsrc=\"https://github.com/user-attachments/assets/dbd2395b-00e5-4331-a9be-cb2a87133321\">\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"5d00a0a098930b2292ea7777cd1ee9f46a91a778"}},"sourceBranch":"main","suggestedTargetBranches":["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/199777","number":199777,"mergeCommit":{"message":"[Ent Search Plugin] Fix loading initial plugin data, save kbn version in kea, fix connector img version (#199777)\n\n## Summary\r\n\r\nPR is a bugfix to dynamically populate the `version` of the connectors\r\ndocker image shown in the onboarding. It's hardcoded to `8.15.0` now\r\n....\r\n\r\nIdeally we want to backport this to 8.16.1 +\r\n\r\nChanges:\r\n- Given that we are already getting\r\n[kibanaVersion](https://github.com/elastic/kibana/blob/main/x-pack/plugins/enterprise_search/public/applications/index.tsx#L65)\r\nfrom the\r\n[backend](https://github.com/elastic/kibana/blob/main/x-pack/plugins/enterprise_search/public/plugin.ts#L212),\r\nI'm saving the version in `KibanaLogic` reducer and use it to popuale\r\nthe docker image version\r\n- I realised that because of [this\r\nchange](664c1a0a08 (diff-19a48c92980fd550e48c5e1d4d1f9a2bec4d309909b7cfa693264c92b387fe3dR95)
)\r\n~10 months ago, we stopped passing plugin data, due to `if\r\n(!this.config.host) return; // No API to call` therefore I removed this\r\nline to fix this. Why I think it's safe to merge?\r\n- It was only added 10 months ago, before things were working without\r\nthis extra if statement\r\n- The backend logic handles the non-existent host: see\r\n[here](https://github.com/elastic/kibana/blob/main/x-pack/plugins/enterprise_search/server/lib/enterprise_search_config_api.ts#L45-L61)\r\n- We are guaranteed that other config fields exist, see [config\r\nschema](d276b48995/x-pack/plugins/enterprise_search/server/index.ts (L16-L42)
)\r\n\r\n<img width=\"1204\" alt=\"Screenshot 2024-11-13 at 10 51 36\"\r\nsrc=\"https://github.com/user-attachments/assets/dbd2395b-00e5-4331-a9be-cb2a87133321\">\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"5d00a0a098930b2292ea7777cd1ee9f46a91a778"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Jedr Blaszyk <jedrazb@gmail.com>
This commit is contained in:
parent
cfa54f7704
commit
702d5f96c5
6 changed files with 11 additions and 2 deletions
|
@ -47,6 +47,7 @@ export const mockKibanaValues = {
|
|||
indexMappingComponent: null,
|
||||
isCloud: false,
|
||||
isSidebarEnabled: true,
|
||||
kibanaVersion: null,
|
||||
lens: {
|
||||
EmbeddableComponent: jest.fn(),
|
||||
stateHelperApi: jest.fn().mockResolvedValue({
|
||||
|
|
|
@ -34,12 +34,14 @@ export interface DockerInstructionsStepProps {
|
|||
hasApiKey: boolean;
|
||||
isWaitingForConnector: boolean;
|
||||
serviceType: string;
|
||||
connectorVersion: string;
|
||||
}
|
||||
export const DockerInstructionsStep: React.FC<DockerInstructionsStepProps> = ({
|
||||
connectorId,
|
||||
isWaitingForConnector,
|
||||
serviceType,
|
||||
apiKeyData,
|
||||
connectorVersion,
|
||||
}) => {
|
||||
const [isOpen, setIsOpen] = React.useState<EuiAccordionProps['forceState']>('open');
|
||||
const { elasticsearchUrl } = useCloudDetails();
|
||||
|
@ -163,7 +165,7 @@ export const DockerInstructionsStep: React.FC<DockerInstructionsStepProps> = ({
|
|||
showTopBar={false}
|
||||
languageType="bash"
|
||||
codeSnippet={getRunFromDockerSnippet({
|
||||
version: '8.15.0',
|
||||
version: connectorVersion,
|
||||
})}
|
||||
/>
|
||||
</EuiAccordion>
|
||||
|
|
|
@ -30,6 +30,7 @@ import { ConnectorStatus } from '@kbn/search-connectors';
|
|||
|
||||
import { Status } from '../../../../../common/types/api';
|
||||
|
||||
import { KibanaLogic } from '../../../shared/kibana';
|
||||
import { GetApiKeyByIdLogic } from '../../api/api_key/get_api_key_by_id_api_logic';
|
||||
|
||||
import { GenerateConnectorApiKeyApiLogic } from '../../api/connector/generate_connector_api_key_api_logic';
|
||||
|
@ -48,6 +49,7 @@ export const ConnectorDeployment: React.FC = () => {
|
|||
const [selectedDeploymentMethod, setSelectedDeploymentMethod] = useState<'docker' | 'source'>(
|
||||
'docker'
|
||||
);
|
||||
const { kibanaVersion } = useValues(KibanaLogic);
|
||||
const { generatedData, isGenerateLoading } = useValues(DeploymentLogic);
|
||||
const { index, isLoading, connector, connectorId } = useValues(ConnectorViewLogic);
|
||||
const { fetchConnector } = useActions(ConnectorViewLogic);
|
||||
|
@ -199,6 +201,7 @@ export const ConnectorDeployment: React.FC = () => {
|
|||
serviceType={connector.service_type ?? ''}
|
||||
isWaitingForConnector={isWaitingForConnector}
|
||||
apiKeyData={apiKey}
|
||||
connectorVersion={kibanaVersion ?? ''}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
|
|
@ -119,6 +119,7 @@ export const renderApp = (
|
|||
history,
|
||||
indexMappingComponent,
|
||||
isSidebarEnabled,
|
||||
kibanaVersion,
|
||||
lens,
|
||||
ml,
|
||||
navigateToUrl,
|
||||
|
|
|
@ -60,6 +60,7 @@ export interface KibanaLogicProps {
|
|||
history: ScopedHistory;
|
||||
indexMappingComponent?: React.FC<IndexMappingProps>;
|
||||
isSidebarEnabled: boolean;
|
||||
kibanaVersion?: string;
|
||||
lens?: LensPublicStart;
|
||||
ml?: MlPluginStart;
|
||||
navigateToUrl: RequiredFieldsOnly<ApplicationStart['navigateToUrl']>;
|
||||
|
@ -94,6 +95,7 @@ export interface KibanaValues {
|
|||
indexMappingComponent: React.FC<IndexMappingProps> | null;
|
||||
isCloud: boolean;
|
||||
isSidebarEnabled: boolean;
|
||||
kibanaVersion: string | null;
|
||||
lens: LensPublicStart | null;
|
||||
ml: MlPluginStart | null;
|
||||
navigateToUrl(path: string, options?: CreateHrefOptions): Promise<void>;
|
||||
|
@ -133,6 +135,7 @@ export const KibanaLogic = kea<MakeLogicType<KibanaValues>>({
|
|||
history: [props.history, {}],
|
||||
indexMappingComponent: [props.indexMappingComponent || null, {}],
|
||||
isSidebarEnabled: [props.isSidebarEnabled, {}],
|
||||
kibanaVersion: [props.kibanaVersion || null, {}],
|
||||
lens: [props.lens || null, {}],
|
||||
ml: [props.ml || null, {}],
|
||||
navigateToUrl: [
|
||||
|
|
|
@ -199,7 +199,6 @@ export class EnterpriseSearchPlugin implements Plugin {
|
|||
this.esConfig = { elasticsearch_host: ELASTICSEARCH_URL_PLACEHOLDER };
|
||||
}
|
||||
|
||||
if (!this.config.host) return; // No API to call
|
||||
if (this.hasInitialized) return; // We've already made an initial call
|
||||
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue