From 2503fa64b6d9cc6219b3253c5f38635f67b6288a Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Mon, 10 Jan 2022 16:58:52 -0800 Subject: [PATCH] [8.0] Use doc link service in ILM (#122104) (#122617) * Use doc link service in ILM (#122104) (cherry picked from commit b5d5ba972d467046a1098c552aff83bb7550ea8a) * Fixes linting --- .../client_integration/app/app.helpers.tsx | 9 +++++- .../edit_policy/init_test_bed.tsx | 2 ++ .../__jest__/policy_table.test.tsx | 5 ++- .../public/application/index.tsx | 7 ++-- .../components/learn_more_link.tsx | 4 +-- .../components/phases/hot_phase/hot_phase.tsx | 6 ++-- .../no_custom_attributes_messages.tsx | 9 +++--- .../components/node_allocation.tsx | 32 +++++++++---------- .../phases/shared_fields/forcemerge_field.tsx | 7 ++-- .../shared_fields/index_priority_field.tsx | 5 ++- .../phases/shared_fields/readonly_field.tsx | 5 +-- .../searchable_snapshot_field.tsx | 24 +++++++++----- .../phases/shared_fields/shrink_field.tsx | 4 ++- .../shared_fields/snapshot_policies_field.tsx | 4 +-- .../components/timeline/timeline.tsx | 6 +++- .../sections/edit_policy/edit_policy.tsx | 9 ++---- .../add_policy_to_template_confirm_modal.tsx | 5 ++- .../application/services/documentation.ts | 28 ---------------- .../public/plugin.tsx | 9 ++---- .../public/types.ts | 2 ++ 20 files changed, 92 insertions(+), 90 deletions(-) delete mode 100644 x-pack/plugins/index_lifecycle_management/public/application/services/documentation.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/app/app.helpers.tsx b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/app/app.helpers.tsx index ff9980c1d2777..8d55a3e093a31 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/app/app.helpers.tsx +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/app/app.helpers.tsx @@ -8,6 +8,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { docLinksServiceMock } from 'src/core/public/mocks'; import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; import { createBreadcrumbsMock } from '../../../public/application/services/breadcrumbs.mock'; import { licensingMock } from '../../../../licensing/public/mocks'; @@ -17,7 +18,13 @@ const breadcrumbService = createBreadcrumbsMock(); const AppWithContext = (props: any) => { return ( - + ); diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/init_test_bed.tsx b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/init_test_bed.tsx index 54d68edc7382f..251ff234c230e 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/init_test_bed.tsx +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/init_test_bed.tsx @@ -7,6 +7,7 @@ import React from 'react'; import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; +import { docLinksServiceMock } from 'src/core/public/mocks'; import '../helpers/global_mocks'; @@ -35,6 +36,7 @@ const EditPolicyContainer = ({ appServicesContext, ...rest }: any) => { services={{ breadcrumbService, license: licensingMock.createLicense({ license: { type: 'enterprise' } }), + docLinks: docLinksServiceMock.createStartContract(), getUrlForApp: () => {}, ...appServicesContext, }} diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/policy_table.test.tsx b/x-pack/plugins/index_lifecycle_management/__jest__/policy_table.test.tsx index cf25b1c335ae9..1a45b2c6d93dc 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/policy_table.test.tsx +++ b/x-pack/plugins/index_lifecycle_management/__jest__/policy_table.test.tsx @@ -14,6 +14,7 @@ import { findTestSubject, takeMountedSnapshot } from '@elastic/eui/lib/test'; import { fatalErrorsServiceMock, injectedMetadataServiceMock, + docLinksServiceMock, } from '../../../../src/core/public/mocks'; import { HttpService } from '../../../../src/core/public/http'; import { usageCollectionPluginMock } from '../../../../src/plugins/usage_collection/public/mocks'; @@ -99,7 +100,9 @@ const testSort = (headerName: string) => { const TestComponent = ({ testPolicies }: { testPolicies: PolicyFromES[] }) => { return ( - '' }}> + '', docLinks: docLinksServiceMock.createStartContract() }} + > diff --git a/x-pack/plugins/index_lifecycle_management/public/application/index.tsx b/x-pack/plugins/index_lifecycle_management/public/application/index.tsx index 5a6d8bb878c37..2a03781a86cd0 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/index.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/index.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; -import { I18nStart, ScopedHistory, ApplicationStart } from 'kibana/public'; +import { I18nStart, ScopedHistory, ApplicationStart, DocLinksStart } from 'kibana/public'; import { UnmountCallback } from 'src/core/public'; import { CloudSetup } from '../../../cloud/public'; import { ILicense } from '../../../licensing/public'; @@ -26,13 +26,16 @@ export const renderApp = ( application: ApplicationStart, breadcrumbService: BreadcrumbService, license: ILicense, + docLinks: DocLinksStart, cloud?: CloudSetup ): UnmountCallback => { const { getUrlForApp } = application; render( - + diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/learn_more_link.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/learn_more_link.tsx index 5e7923898a99a..660cc753623c9 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/learn_more_link.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/learn_more_link.tsx @@ -9,8 +9,6 @@ import React, { ReactNode } from 'react'; import { EuiLink } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; -import { createDocLink } from '../../../services/documentation'; - interface Props { docPath: string; text?: ReactNode; @@ -23,7 +21,7 @@ export const LearnMoreLink: React.FunctionComponent = ({ docPath, text }) ); return ( - + {content} ); diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/hot_phase.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/hot_phase.tsx index 3e67cabf570a4..8905200779d23 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/hot_phase.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/hot_phase.tsx @@ -11,7 +11,7 @@ import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; import { EuiSpacer, EuiCallOut, EuiTextColor, EuiSwitch, EuiText } from '@elastic/eui'; -import { useFormData } from '../../../../../../shared_imports'; +import { useFormData, useKibana } from '../../../../../../shared_imports'; import { i18nTexts } from '../../../i18n_texts'; @@ -52,6 +52,8 @@ export const HotPhase: FunctionComponent = () => { const showEmptyRolloverFieldsError = useRolloverValueRequiredValidation(); + const { docLinks } = useKibana().services; + return ( { defaultMessage="Learn more" /> } - docPath="ilm-rollover.html" + docPath={docLinks.links.elasticsearch.ilmRollover} />

diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/components/no_custom_attributes_messages.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/components/no_custom_attributes_messages.tsx index d31818e3557b1..01f10cf2d98ce 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/components/no_custom_attributes_messages.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/components/no_custom_attributes_messages.tsx @@ -10,9 +10,6 @@ import { EuiLink } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import { DocLinksStart } from 'src/core/public'; - -import { getNodeAllocationMigrationLink } from '../../../../../../../services/documentation'; - export interface Props { docLinks: DocLinksStart; } @@ -28,7 +25,11 @@ export const nodeAllocationMigrationGuidance = ({ docLinks }: Props) => ( defaultMessage="To allocate data to particular data nodes, {roleBasedGuidance} or configure custom node attributes in elasticsearch.yml." values={{ roleBasedGuidance: ( - + {i18n.translate( 'xpack.indexLifecycleMgmt.editPolicy.defaultToDataNodesDescription.migrationGuidanceMessage', { diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/components/node_allocation.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/components/node_allocation.tsx index 323f5144ac837..a2bad060a5893 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/components/node_allocation.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/components/node_allocation.tsx @@ -11,7 +11,7 @@ import { get } from 'lodash'; import { FormattedMessage } from '@kbn/i18n-react'; import { EuiButtonEmpty, EuiText, EuiSpacer } from '@elastic/eui'; -import { SelectField, useFormData } from '../../../../../../../../shared_imports'; +import { SelectField, useFormData, useKibana } from '../../../../../../../../shared_imports'; import { UseField } from '../../../../../form'; @@ -21,18 +21,6 @@ import { NodeAttrsDetails } from './node_attrs_details'; import { SharedProps } from './types'; -const learnMoreLink = ( - - } - docPath="modules-cluster.html#cluster-shard-allocation-settings" - /> -); - const i18nTexts = { allocateToDataNodesOption: i18n.translate( 'xpack.indexLifecycleMgmt.editPolicy.nodeAllocation.allocateToDataNodesOption', @@ -52,7 +40,8 @@ export const NodeAllocation: FunctionComponent = ({ const [formData] = useFormData({ watch: [allocationNodeAttributePath], }); - + const { docLinks } = useKibana().services; + const shardAllocationSettingsUrl = docLinks.links.elasticsearch.shardAllocationSettings; const selectedAllocationNodeAttribute = get(formData, allocationNodeAttributePath); const [selectedNodeAttrsForDetails, setSelectedNodeAttrsForDetails] = useState( @@ -79,7 +68,6 @@ export const NodeAllocation: FunctionComponent = ({ } nodeAllocationOptions = nodeAllocationOptions.concat(nodeOptions); - return ( <> @@ -87,7 +75,19 @@ export const NodeAllocation: FunctionComponent = ({ + } + docPath={shardAllocationSettingsUrl} + /> + ), + }} />

diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/forcemerge_field.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/forcemerge_field.tsx index d6f5e97c166e4..04a57fd2d9ace 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/forcemerge_field.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/forcemerge_field.tsx @@ -10,8 +10,7 @@ import { FormattedMessage } from '@kbn/i18n-react'; import uuid from 'uuid'; import { EuiCheckbox, EuiSpacer, EuiFlexGroup, EuiFlexItem, EuiIconTip } from '@elastic/eui'; -import { NumericField } from '../../../../../../shared_imports'; - +import { NumericField, useKibana } from '../../../../../../shared_imports'; import { i18nTexts } from '../../../i18n_texts'; import { useEditPolicyContext } from '../../../edit_policy_context'; @@ -31,6 +30,8 @@ export const ForcemergeField: React.FunctionComponent = ({ phase }) => { return policy.phases[phase]?.actions?.forcemerge != null; }, [policy, phase]); + const { docLinks } = useKibana().services; + return ( = ({ phase }) => { id="xpack.indexLifecycleMgmt.editPolicy.forceMerge.enableExplanationText" defaultMessage="Reduce the number of segments in each index shard and clean up deleted documents." />{' '} - + } titleSize="xs" diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/index_priority_field.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/index_priority_field.tsx index 1665e4a360ad0..309e283c14d7c 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/index_priority_field.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/index_priority_field.tsx @@ -17,6 +17,7 @@ import { useEditPolicyContext } from '../../../edit_policy_context'; import { UseField } from '../../../form'; import { LearnMoreLink, DescribedFormRow } from '../..'; +import { useKibana } from '../../../../../../shared_imports'; interface Props { phase: PhaseExceptDelete; @@ -33,6 +34,8 @@ export const IndexPriorityField: FunctionComponent = ({ phase }) => { ); }, [isNewPolicy, policy.phases, phase]); + const { docLinks } = useKibana().services; + return ( = ({ phase }) => { defaultMessage="Set the priority for recovering your indices after a node restart. Indices with higher priorities are recovered before indices with lower priorities." />{' '} - + } titleSize="xs" diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/readonly_field.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/readonly_field.tsx index 85805f1a266af..4283f357bff88 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/readonly_field.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/readonly_field.tsx @@ -10,12 +10,13 @@ import { FormattedMessage } from '@kbn/i18n-react'; import { EuiTextColor } from '@elastic/eui'; import { LearnMoreLink } from '../../learn_more_link'; import { ToggleFieldWithDescribedFormRow } from '../../described_form_row'; - +import { useKibana } from '../../../../../../shared_imports'; interface Props { phase: 'hot' | 'warm' | 'cold'; } export const ReadonlyField: React.FunctionComponent = ({ phase }) => { + const { docLinks } = useKibana().services; return ( = ({ phase }) => { id="xpack.indexLifecycleMgmt.editPolicy.readonlyDescription" defaultMessage="Enable to make the index and index metadata read only, disable to allow writes and metadata changes." />{' '} - + } fullWidth diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/searchable_snapshot_field/searchable_snapshot_field.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/searchable_snapshot_field/searchable_snapshot_field.tsx index 3cfb83878812f..ac15441a49590 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/searchable_snapshot_field/searchable_snapshot_field.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/searchable_snapshot_field/searchable_snapshot_field.tsx @@ -25,7 +25,11 @@ export interface Props { canBeDisabled?: boolean; } -const geti18nTexts = (phase: Props['phase']) => { +const geti18nTexts = ( + phase: Props['phase'], + fullyMountedSearchableSnapshotLink: string, + partiallyMountedSearchableSnapshotLink: string +) => { switch (phase) { // Hot and cold phases both create fully mounted snapshots. case 'hot': @@ -42,7 +46,7 @@ const geti18nTexts = (phase: Props['phase']) => { id="xpack.indexLifecycleMgmt.editPolicy.fullyMountedSearchableSnapshotField.description" defaultMessage="Convert to a fully-mounted index that contains a complete copy of your data and is backed by a snapshot. You can reduce the number of replicas and rely on the snapshot for resiliency. {learnMoreLink}" values={{ - learnMoreLink: , + learnMoreLink: , }} /> ), @@ -66,9 +70,7 @@ const geti18nTexts = (phase: Props['phase']) => { id="xpack.indexLifecycleMgmt.editPolicy.frozenPhase.partiallyMountedSearchableSnapshotField.description" defaultMessage="Convert to a partially-mounted index that caches the index metadata. Data is retrieved from the snapshot as needed to process search requests. This minimizes the index footprint while keeping all of your data fully searchable. {learnMoreLink}" values={{ - learnMoreLink: ( - - ), + learnMoreLink: , }} /> ), @@ -85,7 +87,7 @@ export const SearchableSnapshotField: FunctionComponent = ({ canBeDisabled = true, }) => { const { - services: { cloud, getUrlForApp }, + services: { cloud, docLinks, getUrlForApp }, } = useKibana(); const { policy, license, isNewPolicy } = useEditPolicyContext(); const { isUsingSearchableSnapshotInHotPhase } = useConfiguration(); @@ -109,8 +111,14 @@ export const SearchableSnapshotField: FunctionComponent = ({ policy.phases[phase]?.actions?.searchable_snapshot?.snapshot_repository ) ); - - const i18nTexts = geti18nTexts(phase); + const fullyMountedSearchableSnapshotLink = docLinks.links.elasticsearch.ilmSearchableSnapshot; + const partiallyMountedSearchableSnapshotLink = + docLinks.links.elasticsearch.searchableSnapshotSharedCache; + const i18nTexts = geti18nTexts( + phase, + fullyMountedSearchableSnapshotLink, + partiallyMountedSearchableSnapshotLink + ); useEffect(() => { if (isDisabledDueToLicense) { diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/shrink_field.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/shrink_field.tsx index 9439afd1c071d..adcc33fdc8697 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/shrink_field.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/shrink_field.tsx @@ -19,6 +19,7 @@ import { i18nTexts } from '../../../i18n_texts'; import { LearnMoreLink, DescribedFormRow } from '../../'; import { byteSizeUnits } from '../../../constants'; import { UnitField } from './unit_field'; +import { useKibana } from '../../../../../../shared_imports'; interface Props { phase: 'hot' | 'warm'; @@ -35,6 +36,7 @@ export const ShrinkField: FunctionComponent = ({ phase }) => { const path = `phases.${phase}.actions.shrink.${ isUsingShardSize ? 'max_primary_shard_size' : 'number_of_shards' }`; + const { docLinks } = useKibana().services; return ( = ({ phase }) => { id="xpack.indexLifecycleMgmt.editPolicy.shrinkIndexExplanationText" defaultMessage="Shrink the index to a new index with fewer primary shards." />{' '} - + } titleSize="xs" diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/snapshot_policies_field.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/snapshot_policies_field.tsx index 89e43b2675854..791a70ae6212d 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/snapshot_policies_field.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/snapshot_policies_field.tsx @@ -29,7 +29,7 @@ const waitForSnapshotFormField = 'phases.delete.actions.wait_for_snapshot.policy export const SnapshotPoliciesField: React.FunctionComponent = () => { const { - services: { getUrlForApp }, + services: { docLinks, getUrlForApp }, } = useKibana(); const { error, isLoading, data, resendRequest } = useLoadSnapshotPolicies(); const [formData] = useFormData({ @@ -159,7 +159,7 @@ export const SnapshotPoliciesField: React.FunctionComponent = () => { id="xpack.indexLifecycleMgmt.editPolicy.deletePhase.waitForSnapshotDescription" defaultMessage="Specify a snapshot policy to be executed before the deletion of the index. This ensures that a snapshot of the deleted index is available." />{' '} - + } titleSize="xs" diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/timeline/timeline.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/timeline/timeline.tsx index b04445162e48b..d56f69248e2c1 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/timeline/timeline.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/timeline/timeline.tsx @@ -11,6 +11,8 @@ import { FormattedMessage } from '@kbn/i18n-react'; import React, { FunctionComponent, memo } from 'react'; import { EuiFlexGroup, EuiFlexItem, EuiTitle, EuiText, EuiIconTip } from '@elastic/eui'; +import { useKibana } from '../../../../../shared_imports'; + import { PhaseExceptDelete } from '../../../../../../common/types'; import { @@ -141,6 +143,8 @@ export const Timeline: FunctionComponent = memo( ) : null; + const { docLinks } = useKibana().services; + return ( @@ -151,7 +155,7 @@ export const Timeline: FunctionComponent = memo( {i18nTexts.description}   { } = useEditPolicyContext(); const { - services: { cloud }, + services: { cloud, docLinks }, } = useKibana(); const [isClonedPolicy, setIsClonedPolicy] = useState(false); @@ -166,11 +165,7 @@ export const EditPolicy: React.FunctionComponent = () => { } bottomBorder rightSideItems={[ - + = ( } ); + const { docLinks } = useKibana().services; + return ( = ( all indices which match the index template." />{' '} `${_esDocBasePath}${docPath}`; -export const getNodeAllocationMigrationLink = ({ links }: DocLinksStart) => - `${links.elasticsearch.migrateIndexAllocationFilters}`; diff --git a/x-pack/plugins/index_lifecycle_management/public/plugin.tsx b/x-pack/plugins/index_lifecycle_management/public/plugin.tsx index bc0981529c34f..455060f522cc5 100644 --- a/x-pack/plugins/index_lifecycle_management/public/plugin.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/plugin.tsx @@ -11,7 +11,6 @@ import { CoreSetup, PluginInitializerContext, Plugin } from 'src/core/public'; import { FeatureCatalogueCategory } from '../../../../src/plugins/home/public'; import { PLUGIN } from '../common/constants'; import { init as initHttp } from './application/services/http'; -import { init as initDocumentation } from './application/services/documentation'; import { init as initUiMetric } from './application/services/ui_metric'; import { init as initNotification } from './application/services/notification'; import { BreadcrumbService } from './application/services/breadcrumbs'; @@ -55,8 +54,8 @@ export class IndexLifecycleManagementPlugin const { chrome: { docTitle }, i18n: { Context: I18nContext }, - docLinks: { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION }, application, + docLinks, } = coreStart; const license = await licensing.license$.pipe(first()).toPromise(); @@ -64,11 +63,6 @@ export class IndexLifecycleManagementPlugin docTitle.change(PLUGIN.TITLE); this.breadcrumbService.setup(setBreadcrumbs); - // Initialize additional services. - initDocumentation( - `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/` - ); - const { renderApp } = await import('./application'); const unmountAppCallback = renderApp( @@ -78,6 +72,7 @@ export class IndexLifecycleManagementPlugin application, this.breadcrumbService, license, + docLinks, cloud ); diff --git a/x-pack/plugins/index_lifecycle_management/public/types.ts b/x-pack/plugins/index_lifecycle_management/public/types.ts index 0339d124e1279..6c8239fd44da3 100644 --- a/x-pack/plugins/index_lifecycle_management/public/types.ts +++ b/x-pack/plugins/index_lifecycle_management/public/types.ts @@ -6,6 +6,7 @@ */ import { ApplicationStart } from 'kibana/public'; +import { DocLinksStart } from 'src/core/public'; import { HomePublicPluginSetup } from '../../../../src/plugins/home/public'; import { UsageCollectionSetup } from '../../../../src/plugins/usage_collection/public'; import { ManagementSetup } from '../../../../src/plugins/management/public'; @@ -40,4 +41,5 @@ export interface AppServicesContext { license: ILicense; cloud?: CloudSetup; getUrlForApp: ApplicationStart['getUrlForApp']; + docLinks: DocLinksStart; }