diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md index 0e23064385a63..93bd6886c0974 100644 --- a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md +++ b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md @@ -108,12 +108,38 @@ readonly links: { readonly ml: Record; readonly transforms: Record; readonly visualize: Record; - readonly apis: Record; + readonly apis: { + createIndex: string; + createSnapshotLifecyclePolicy: string; + createRoleMapping: string; + createRoleMappingTemplates: string; + createApiKey: string; + createPipeline: string; + createTransformRequest: string; + executeWatchActionModes: string; + openIndex: string; + putComponentTemplate: string; + painlessExecute: string; + putComponentTemplateMetadata: string; + putWatch: string; + updateTransform: string; + }; readonly observability: Record; readonly alerting: Record; readonly maps: Record; readonly monitoring: Record; - readonly security: Record; + readonly security: { + apiKeyServiceSettings: string; + clusterPrivileges: string; + elasticsearchSettings: string; + elasticsearchEnableSecurity: string; + indicesPrivileges: string; + kibanaTLS: string; + kibanaPrivileges: string; + mappingRoles: string; + mappingRolesFieldRules: string; + runAsPrivilege: string; + }; readonly watcher: Record; readonly ccs: Record; }; diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md index 3ad747a42f84e..6db8c98633834 100644 --- a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md +++ b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md @@ -17,5 +17,5 @@ export interface DocLinksStart | --- | --- | --- | | [DOC\_LINK\_VERSION](./kibana-plugin-core-public.doclinksstart.doc_link_version.md) | string | | | [ELASTIC\_WEBSITE\_URL](./kibana-plugin-core-public.doclinksstart.elastic_website_url.md) | string | | -| [links](./kibana-plugin-core-public.doclinksstart.links.md) | {
readonly dashboard: {
readonly guide: string;
readonly drilldowns: string;
readonly drilldownsTriggerPicker: string;
readonly urlDrilldownTemplateSyntax: string;
readonly urlDrilldownVariables: string;
};
readonly filebeat: {
readonly base: string;
readonly installation: string;
readonly configuration: string;
readonly elasticsearchOutput: string;
readonly startup: string;
readonly exportedFields: string;
};
readonly auditbeat: {
readonly base: string;
};
readonly metricbeat: {
readonly base: string;
};
readonly heartbeat: {
readonly base: string;
};
readonly logstash: {
readonly base: string;
};
readonly functionbeat: {
readonly base: string;
};
readonly winlogbeat: {
readonly base: string;
};
readonly aggs: {
readonly date_histogram: string;
readonly date_range: string;
readonly date_format_pattern: string;
readonly filter: string;
readonly filters: string;
readonly geohash_grid: string;
readonly histogram: string;
readonly ip_range: string;
readonly range: string;
readonly significant_terms: string;
readonly terms: string;
readonly avg: string;
readonly avg_bucket: string;
readonly max_bucket: string;
readonly min_bucket: string;
readonly sum_bucket: string;
readonly cardinality: string;
readonly count: string;
readonly cumulative_sum: string;
readonly derivative: string;
readonly geo_bounds: string;
readonly geo_centroid: string;
readonly max: string;
readonly median: string;
readonly min: string;
readonly moving_avg: string;
readonly percentile_ranks: string;
readonly serial_diff: string;
readonly std_dev: string;
readonly sum: string;
readonly top_hits: string;
};
readonly runtimeFields: string;
readonly scriptedFields: {
readonly scriptFields: string;
readonly scriptAggs: string;
readonly painless: string;
readonly painlessApi: string;
readonly painlessSyntax: string;
readonly luceneExpressions: string;
};
readonly indexPatterns: {
readonly loadingData: string;
readonly introduction: string;
};
readonly addData: string;
readonly kibana: string;
readonly elasticsearch: Record<string, string>;
readonly siem: {
readonly guide: string;
readonly gettingStarted: string;
};
readonly query: {
readonly eql: string;
readonly luceneQuerySyntax: string;
readonly queryDsl: string;
readonly kueryQuerySyntax: string;
};
readonly date: {
readonly dateMath: string;
};
readonly management: Record<string, string>;
readonly ml: Record<string, string>;
readonly transforms: Record<string, string>;
readonly visualize: Record<string, string>;
readonly apis: Record<string, string>;
readonly observability: Record<string, string>;
readonly alerting: Record<string, string>;
readonly maps: Record<string, string>;
readonly monitoring: Record<string, string>;
readonly security: Record<string, string>;
readonly watcher: Record<string, string>;
readonly ccs: Record<string, string>;
} | | +| [links](./kibana-plugin-core-public.doclinksstart.links.md) | {
readonly dashboard: {
readonly guide: string;
readonly drilldowns: string;
readonly drilldownsTriggerPicker: string;
readonly urlDrilldownTemplateSyntax: string;
readonly urlDrilldownVariables: string;
};
readonly discover: Record<string, string>;
readonly filebeat: {
readonly base: string;
readonly installation: string;
readonly configuration: string;
readonly elasticsearchOutput: string;
readonly startup: string;
readonly exportedFields: string;
};
readonly auditbeat: {
readonly base: string;
};
readonly metricbeat: {
readonly base: string;
};
readonly heartbeat: {
readonly base: string;
};
readonly logstash: {
readonly base: string;
};
readonly functionbeat: {
readonly base: string;
};
readonly winlogbeat: {
readonly base: string;
};
readonly aggs: {
readonly date_histogram: string;
readonly date_range: string;
readonly date_format_pattern: string;
readonly filter: string;
readonly filters: string;
readonly geohash_grid: string;
readonly histogram: string;
readonly ip_range: string;
readonly range: string;
readonly significant_terms: string;
readonly terms: string;
readonly avg: string;
readonly avg_bucket: string;
readonly max_bucket: string;
readonly min_bucket: string;
readonly sum_bucket: string;
readonly cardinality: string;
readonly count: string;
readonly cumulative_sum: string;
readonly derivative: string;
readonly geo_bounds: string;
readonly geo_centroid: string;
readonly max: string;
readonly median: string;
readonly min: string;
readonly moving_avg: string;
readonly percentile_ranks: string;
readonly serial_diff: string;
readonly std_dev: string;
readonly sum: string;
readonly top_hits: string;
};
readonly runtimeFields: string;
readonly scriptedFields: {
readonly scriptFields: string;
readonly scriptAggs: string;
readonly painless: string;
readonly painlessApi: string;
readonly painlessSyntax: string;
readonly luceneExpressions: string;
};
readonly indexPatterns: {
readonly loadingData: string;
readonly introduction: string;
};
readonly addData: string;
readonly kibana: string;
readonly elasticsearch: Record<string, string>;
readonly siem: {
readonly guide: string;
readonly gettingStarted: string;
};
readonly query: {
readonly eql: string;
readonly luceneQuerySyntax: string;
readonly queryDsl: string;
readonly kueryQuerySyntax: string;
};
readonly date: {
readonly dateMath: string;
};
readonly management: Record<string, string>;
readonly ml: Record<string, string>;
readonly transforms: Record<string, string>;
readonly visualize: Record<string, string>;
readonly apis: {
createIndex: string;
createSnapshotLifecyclePolicy: string;
createRoleMapping: string;
createRoleMappingTemplates: string;
createApiKey: string;
createPipeline: string;
createTransformRequest: string;
executeWatchActionModes: string;
openIndex: string;
putComponentTemplate: string;
painlessExecute: string;
putComponentTemplateMetadata: string;
putWatch: string;
updateTransform: string;
};
readonly observability: Record<string, string>;
readonly alerting: Record<string, string>;
readonly maps: Record<string, string>;
readonly monitoring: Record<string, string>;
readonly security: {
apiKeyServiceSettings: string;
clusterPrivileges: string;
elasticsearchSettings: string;
elasticsearchEnableSecurity: string;
indicesPrivileges: string;
kibanaTLS: string;
kibanaPrivileges: string;
mappingRoles: string;
mappingRolesFieldRules: string;
runAsPrivilege: string;
};
readonly watcher: Record<string, string>;
readonly ccs: Record<string, string>;
} | | diff --git a/src/core/public/doc_links/doc_links_service.ts b/src/core/public/doc_links/doc_links_service.ts index 43960ce7db467..605f9dcfd8b63 100644 --- a/src/core/public/doc_links/doc_links_service.ts +++ b/src/core/public/doc_links/doc_links_service.ts @@ -220,7 +220,7 @@ export class DocLinksService { }, apis: { createIndex: `${ELASTICSEARCH_DOCS}indices-create-index.html`, - createSnapshotLifecylePolicy: `${ELASTICSEARCH_DOCS}slm-api-put-policy.html`, + createSnapshotLifecyclePolicy: `${ELASTICSEARCH_DOCS}slm-api-put-policy.html`, createRoleMapping: `${ELASTICSEARCH_DOCS}security-api-put-role-mapping.html`, createRoleMappingTemplates: `${ELASTICSEARCH_DOCS}security-api-put-role-mapping.html#_role_templates`, createApiKey: `${ELASTICSEARCH_DOCS}security-api-create-api-key.html`, @@ -344,12 +344,38 @@ export interface DocLinksStart { readonly ml: Record; readonly transforms: Record; readonly visualize: Record; - readonly apis: Record; + readonly apis: { + createIndex: string; + createSnapshotLifecyclePolicy: string; + createRoleMapping: string; + createRoleMappingTemplates: string; + createApiKey: string; + createPipeline: string; + createTransformRequest: string; + executeWatchActionModes: string; + openIndex: string; + putComponentTemplate: string; + painlessExecute: string; + putComponentTemplateMetadata: string; + putWatch: string; + updateTransform: string; + }; readonly observability: Record; readonly alerting: Record; readonly maps: Record; readonly monitoring: Record; - readonly security: Record; + readonly security: { + apiKeyServiceSettings: string; + clusterPrivileges: string; + elasticsearchSettings: string; + elasticsearchEnableSecurity: string; + indicesPrivileges: string; + kibanaTLS: string; + kibanaPrivileges: string; + mappingRoles: string; + mappingRolesFieldRules: string; + runAsPrivilege: string; + }; readonly watcher: Record; readonly ccs: Record; }; diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index c5b49519ef7b2..99277c7e31c24 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -587,12 +587,38 @@ export interface DocLinksStart { readonly ml: Record; readonly transforms: Record; readonly visualize: Record; - readonly apis: Record; + readonly apis: { + createIndex: string; + createSnapshotLifecyclePolicy: string; + createRoleMapping: string; + createRoleMappingTemplates: string; + createApiKey: string; + createPipeline: string; + createTransformRequest: string; + executeWatchActionModes: string; + openIndex: string; + putComponentTemplate: string; + painlessExecute: string; + putComponentTemplateMetadata: string; + putWatch: string; + updateTransform: string; + }; readonly observability: Record; readonly alerting: Record; readonly maps: Record; readonly monitoring: Record; - readonly security: Record; + readonly security: { + apiKeyServiceSettings: string; + clusterPrivileges: string; + elasticsearchSettings: string; + elasticsearchEnableSecurity: string; + indicesPrivileges: string; + kibanaTLS: string; + kibanaPrivileges: string; + mappingRoles: string; + mappingRolesFieldRules: string; + runAsPrivilege: string; + }; readonly watcher: Record; readonly ccs: Record; }; diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/__snapshots__/api_keys_grid_page.test.tsx.snap b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/__snapshots__/api_keys_grid_page.test.tsx.snap index 3c6458a6d2467..44b6c081bcfba 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/__snapshots__/api_keys_grid_page.test.tsx.snap +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/__snapshots__/api_keys_grid_page.test.tsx.snap @@ -1,132 +1,123 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`APIKeysGridPage renders a callout when API keys are not enabled 1`] = ` - } > - - } +
- - + + -
- - - , - } - } - > - Contact your system administrator and refer to the - - + +
+ + -
-
- - + (opens in a new tab or window) + + + + + + to enable API keys. + +
+ + +
`; exports[`APIKeysGridPage renders permission denied if user does not have required permissions 1`] = ` diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.test.tsx b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.test.tsx index 68daf427677ff..b3fc3d3642f58 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.test.tsx +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.test.tsx @@ -13,7 +13,6 @@ import type { PublicMethodsOf } from '@kbn/utility-types'; import { NotEnabled } from './not_enabled'; import { PermissionDenied } from './permission_denied'; import { APIKeysAPIClient } from '../api_keys_api_client'; -import { DocumentationLinksService } from '../documentation_links'; import { APIKeysGridPage } from './api_keys_grid_page'; import { coreMock } from '../../../../../../../src/core/public/mocks'; @@ -70,7 +69,7 @@ describe('APIKeysGridPage', () => { const getViewProperties = () => { const { docLinks, notifications, application } = coreStart; return { - docLinks: new DocumentationLinksService(docLinks), + docLinks, navigateToApp: application.navigateToApp, notifications, apiKeysAPIClient: apiClientMock, @@ -96,7 +95,7 @@ describe('APIKeysGridPage', () => { return updatedWrapper.find(NotEnabled).length > 0; }); - expect(wrapper.find(NotEnabled)).toMatchSnapshot(); + expect(wrapper.find(NotEnabled).find(EuiCallOut)).toMatchSnapshot(); }); it('renders permission denied if user does not have required permissions', async () => { diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.tsx b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.tsx index b4ea91ea024f9..0a647e2797b97 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.tsx +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.tsx @@ -28,11 +28,10 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import type { PublicMethodsOf } from '@kbn/utility-types'; import moment from 'moment-timezone'; -import { ApplicationStart, NotificationsStart } from 'src/core/public'; +import type { ApplicationStart, DocLinksStart, NotificationsStart } from 'src/core/public'; import { SectionLoading } from '../../../../../../../src/plugins/es_ui_shared/public'; import { ApiKey, ApiKeyToInvalidate } from '../../../../common/model'; import { APIKeysAPIClient } from '../api_keys_api_client'; -import { DocumentationLinksService } from '../documentation_links'; import { PermissionDenied } from './permission_denied'; import { EmptyPrompt } from './empty_prompt'; import { NotEnabled } from './not_enabled'; @@ -40,7 +39,7 @@ import { InvalidateProvider } from './invalidate_provider'; interface Props { notifications: NotificationsStart; - docLinks: DocumentationLinksService; + docLinks: DocLinksStart; apiKeysAPIClient: PublicMethodsOf; navigateToApp: ApplicationStart['navigateToApp']; } diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/empty_prompt/empty_prompt.tsx b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/empty_prompt/empty_prompt.tsx index 9b2ccfcb99ef3..e70e687dfe9b8 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/empty_prompt/empty_prompt.tsx +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/empty_prompt/empty_prompt.tsx @@ -5,15 +5,14 @@ */ import React, { Fragment } from 'react'; -import { ApplicationStart } from 'kibana/public'; +import type { ApplicationStart, DocLinksStart } from 'kibana/public'; import { EuiEmptyPrompt, EuiButton, EuiLink } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { DocumentationLinksService } from '../../documentation_links'; interface Props { isAdmin: boolean; - docLinks: DocumentationLinksService; + docLinks: DocLinksStart; navigateToApp: ApplicationStart['navigateToApp']; } @@ -47,7 +46,7 @@ export const EmptyPrompt: React.FunctionComponent = ({ defaultMessage="You can create an {link} from Console." values={{ link: ( - + = ({ docLinks }) => ( @@ -29,7 +29,7 @@ export const NotEnabled: React.FunctionComponent = ({ docLinks }) => ( defaultMessage="Contact your system administrator and refer to the {link} to enable API keys." values={{ link: ( - + ({ - APIKeysGridPage: (props: any) => `Page: ${JSON.stringify(props)}`, + APIKeysGridPage: (props: any) => + // `docLinks` object is too big to include into test snapshot, so we just check its existence. + `Page: ${JSON.stringify({ ...props, docLinks: props.docLinks ? {} : undefined })}`, })); import { apiKeysManagementApp } from './api_keys_management_app'; import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks'; @@ -43,7 +45,7 @@ describe('apiKeysManagementApp', () => { expect(setBreadcrumbs).toHaveBeenCalledWith([{ href: '/', text: 'API Keys' }]); expect(container).toMatchInlineSnapshot(`
- Page: {"notifications":{"toasts":{}},"docLinks":{"apiKeySettings":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/security-settings.html#api-key-service-settings","createApiKey":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/security-api-create-api-key.html"},"apiKeysAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}}} + Page: {"notifications":{"toasts":{}},"docLinks":{},"apiKeysAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}}}
`); diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_management_app.tsx b/x-pack/plugins/security/public/management/api_keys/api_keys_management_app.tsx index 6ff91852d0a3e..7240375d26213 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_management_app.tsx +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_management_app.tsx @@ -10,7 +10,6 @@ import { i18n } from '@kbn/i18n'; import { StartServicesAccessor } from 'src/core/public'; import { RegisterManagementAppArgs } from '../../../../../../src/plugins/management/public'; import { PluginStartDependencies } from '../../plugin'; -import { DocumentationLinksService } from './documentation_links'; interface CreateParams { getStartServices: StartServicesAccessor; @@ -50,7 +49,7 @@ export const apiKeysManagementApp = Object.freeze({ , diff --git a/x-pack/plugins/security/public/management/api_keys/documentation_links.ts b/x-pack/plugins/security/public/management/api_keys/documentation_links.ts deleted file mode 100644 index 66a54f1cb7b72..0000000000000 --- a/x-pack/plugins/security/public/management/api_keys/documentation_links.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { DocLinksStart } from 'src/core/public'; - -export class DocumentationLinksService { - private readonly apiKeySettings: string; - private readonly createApiKey: string; - - constructor(docLinks: DocLinksStart) { - this.apiKeySettings = `${docLinks.links.security.apiKeyServiceSettings}`; - this.createApiKey = `${docLinks.links.apis.createApiKey}`; - } - - public getApiKeyServiceSettingsDocUrl() { - return `${this.apiKeySettings}`; - } - - public getCreateApiKeyDocUrl() { - return `${this.createApiKey}`; - } -} diff --git a/x-pack/plugins/security/public/management/role_mappings/components/no_compatible_realms/no_compatible_realms.tsx b/x-pack/plugins/security/public/management/role_mappings/components/no_compatible_realms/no_compatible_realms.tsx index 5e14b0c179bfd..96e8ba2901046 100644 --- a/x-pack/plugins/security/public/management/role_mappings/components/no_compatible_realms/no_compatible_realms.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/components/no_compatible_realms/no_compatible_realms.tsx @@ -7,10 +7,10 @@ import React from 'react'; import { EuiCallOut, EuiLink } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { DocumentationLinksService } from '../../documentation_links'; +import type { DocLinksStart } from 'src/core/public'; interface Props { - docLinks: DocumentationLinksService; + docLinks: DocLinksStart; } export const NoCompatibleRealms: React.FunctionComponent = ({ docLinks }: Props) => ( @@ -29,7 +29,7 @@ export const NoCompatibleRealms: React.FunctionComponent = ({ docLinks }: defaultMessage="Role mappings will not be applied to any users. Contact your system administrator and refer to the {link} for more information." values={{ link: ( - + { roleMappingsAPI={roleMappingsAPI} rolesAPIClient={rolesAPI} notifications={notifications} - docLinks={new DocumentationLinksService(docLinks)} + docLinks={docLinks} history={history} /> ); @@ -119,7 +118,7 @@ describe('EditRoleMappingPage', () => { roleMappingsAPI={roleMappingsAPI} rolesAPIClient={rolesAPI} notifications={notifications} - docLinks={new DocumentationLinksService(docLinks)} + docLinks={docLinks} history={history} /> ); @@ -167,7 +166,7 @@ describe('EditRoleMappingPage', () => { roleMappingsAPI={roleMappingsAPI} rolesAPIClient={rolesAPI} notifications={notifications} - docLinks={new DocumentationLinksService(docLinks)} + docLinks={docLinks} history={history} /> ); @@ -195,7 +194,7 @@ describe('EditRoleMappingPage', () => { roleMappingsAPI={roleMappingsAPI} rolesAPIClient={rolesAPI} notifications={notifications} - docLinks={new DocumentationLinksService(docLinks)} + docLinks={docLinks} history={history} /> ); @@ -233,7 +232,7 @@ describe('EditRoleMappingPage', () => { roleMappingsAPI={roleMappingsAPI} rolesAPIClient={rolesAPI} notifications={notifications} - docLinks={new DocumentationLinksService(docLinks)} + docLinks={docLinks} history={history} /> ); @@ -274,7 +273,7 @@ describe('EditRoleMappingPage', () => { roleMappingsAPI={roleMappingsAPI} rolesAPIClient={rolesAPI} notifications={notifications} - docLinks={new DocumentationLinksService(docLinks)} + docLinks={docLinks} history={history} /> ); @@ -317,7 +316,7 @@ describe('EditRoleMappingPage', () => { roleMappingsAPI={roleMappingsAPI} rolesAPIClient={rolesAPI} notifications={notifications} - docLinks={new DocumentationLinksService(docLinks)} + docLinks={docLinks} history={history} /> ); @@ -372,7 +371,7 @@ describe('EditRoleMappingPage', () => { roleMappingsAPI={roleMappingsAPI} rolesAPIClient={rolesAPI} notifications={notifications} - docLinks={new DocumentationLinksService(docLinks)} + docLinks={docLinks} history={history} /> ); @@ -428,7 +427,7 @@ describe('EditRoleMappingPage', () => { roleMappingsAPI={roleMappingsAPI} rolesAPIClient={rolesAPI} notifications={notifications} - docLinks={new DocumentationLinksService(docLinks)} + docLinks={docLinks} history={history} /> ); diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.tsx index 30584348960a5..cca8ca966ebda 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.tsx @@ -20,7 +20,7 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import { NotificationsStart, ScopedHistory } from 'src/core/public'; +import type { NotificationsStart, ScopedHistory, DocLinksStart } from 'src/core/public'; import { RoleMapping } from '../../../../common/model'; import { RuleEditorPanel } from './rule_editor_panel'; import { @@ -32,7 +32,6 @@ import { import { RolesAPIClient } from '../../roles'; import { validateRoleMappingForSave } from './services/role_mapping_validation'; import { MappingInfoPanel } from './mapping_info_panel'; -import { DocumentationLinksService } from '../documentation_links'; import { RoleMappingsAPIClient } from '../role_mappings_api_client'; interface State { @@ -54,7 +53,7 @@ interface Props { roleMappingsAPI: PublicMethodsOf; rolesAPIClient: PublicMethodsOf; notifications: NotificationsStart; - docLinks: DocumentationLinksService; + docLinks: DocLinksStart; history: ScopedHistory; } @@ -163,7 +162,7 @@ export class EditRoleMappingPage extends Component { values={{ learnMoreLink: ( diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.test.tsx index dbd034ff3f764..f9201a8dbf249 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.test.tsx @@ -10,7 +10,6 @@ import { mountWithIntl } from '@kbn/test/jest'; import { findTestSubject } from '@kbn/test/jest'; import { Role, RoleMapping } from '../../../../../common/model'; import { RolesAPIClient } from '../../../roles'; -import { DocumentationLinksService } from '../../documentation_links'; import { RoleSelector } from '../role_selector'; import { RoleTemplateEditor } from '../role_selector/role_template_editor'; import { MappingInfoPanel } from '.'; @@ -39,7 +38,7 @@ describe('MappingInfoPanel', () => { metadata: {}, } as RoleMapping, mode: 'create', - docLinks: new DocumentationLinksService(coreMock.createStart().docLinks), + docLinks: coreMock.createStart().docLinks, rolesAPIClient: rolesAPI, } as MappingInfoPanel['props']; @@ -86,7 +85,7 @@ describe('MappingInfoPanel', () => { metadata: {}, } as RoleMapping, mode: 'edit', - docLinks: new DocumentationLinksService(coreMock.createStart().docLinks), + docLinks: coreMock.createStart().docLinks, rolesAPIClient: rolesAPI, } as MappingInfoPanel['props']; @@ -112,7 +111,7 @@ describe('MappingInfoPanel', () => { canUseInlineScripts: true, canUseStoredScripts: false, validateForm: false, - docLinks: new DocumentationLinksService(coreMock.createStart().docLinks), + docLinks: coreMock.createStart().docLinks, rolesAPIClient: rolesAPI, }; @@ -153,7 +152,7 @@ describe('MappingInfoPanel', () => { canUseInlineScripts: false, canUseStoredScripts: true, validateForm: false, - docLinks: new DocumentationLinksService(coreMock.createStart().docLinks), + docLinks: coreMock.createStart().docLinks, rolesAPIClient: rolesAPI, }; @@ -194,7 +193,7 @@ describe('MappingInfoPanel', () => { canUseInlineScripts: false, canUseStoredScripts: false, validateForm: false, - docLinks: new DocumentationLinksService(coreMock.createStart().docLinks), + docLinks: coreMock.createStart().docLinks, rolesAPIClient: rolesAPI, }; @@ -219,7 +218,7 @@ describe('MappingInfoPanel', () => { metadata: {}, } as RoleMapping, mode: 'edit', - docLinks: new DocumentationLinksService(coreMock.createStart().docLinks), + docLinks: coreMock.createStart().docLinks, rolesAPIClient: rolesAPI, } as MappingInfoPanel['props']; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.tsx index faf0278e5d8f3..8176950a46339 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.tsx @@ -20,6 +20,7 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import type { PublicMethodsOf } from '@kbn/utility-types'; +import type { DocLinksStart } from 'src/core/public'; import { RoleMapping } from '../../../../../common/model'; import { RolesAPIClient } from '../../../roles'; import { @@ -28,7 +29,6 @@ import { validateRoleMappingRoleTemplates, } from '../services/role_mapping_validation'; import { RoleSelector } from '../role_selector'; -import { DocumentationLinksService } from '../../documentation_links'; interface Props { roleMapping: RoleMapping; @@ -38,7 +38,7 @@ interface Props { canUseInlineScripts: boolean; canUseStoredScripts: boolean; rolesAPIClient: PublicMethodsOf; - docLinks: DocumentationLinksService; + docLinks: DocLinksStart; } interface State { @@ -205,7 +205,7 @@ export class MappingInfoPanel extends Component { defaultMessage="Create templates that describe the roles to assign to your users." />{' '} diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.test.tsx index bae41b31cdcc1..c327609a8c05b 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.test.tsx @@ -18,7 +18,6 @@ import { mountWithIntl } from '@kbn/test/jest'; import { JSONRuleEditor } from './json_rule_editor'; import { EuiCodeEditor } from '@elastic/eui'; import { AllRule, AnyRule, FieldRule, ExceptAnyRule, ExceptAllRule } from '../../model'; -import { DocumentationLinksService } from '../../documentation_links'; import { coreMock } from '../../../../../../../../src/core/public/mocks'; @@ -28,7 +27,7 @@ describe('JSONRuleEditor', () => { rules: null, onChange: jest.fn(), onValidityChange: jest.fn(), - docLinks: new DocumentationLinksService(coreMock.createStart().docLinks), + docLinks: coreMock.createStart().docLinks, }; const wrapper = mountWithIntl(); @@ -50,7 +49,7 @@ describe('JSONRuleEditor', () => { ]), onChange: jest.fn(), onValidityChange: jest.fn(), - docLinks: new DocumentationLinksService(coreMock.createStart().docLinks), + docLinks: coreMock.createStart().docLinks, }; const wrapper = mountWithIntl(); @@ -84,7 +83,7 @@ describe('JSONRuleEditor', () => { rules: null, onChange: jest.fn(), onValidityChange: jest.fn(), - docLinks: new DocumentationLinksService(coreMock.createStart().docLinks), + docLinks: coreMock.createStart().docLinks, }; const wrapper = mountWithIntl(); @@ -103,7 +102,7 @@ describe('JSONRuleEditor', () => { rules: null, onChange: jest.fn(), onValidityChange: jest.fn(), - docLinks: new DocumentationLinksService(coreMock.createStart().docLinks), + docLinks: coreMock.createStart().docLinks, }; const wrapper = mountWithIntl(); @@ -131,7 +130,7 @@ describe('JSONRuleEditor', () => { rules: null, onChange: jest.fn(), onValidityChange: jest.fn(), - docLinks: new DocumentationLinksService(coreMock.createStart().docLinks), + docLinks: coreMock.createStart().docLinks, }; const wrapper = mountWithIntl(); diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.tsx index e7a9149513d20..a535c99b31b60 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.tsx @@ -11,14 +11,14 @@ import 'brace/theme/github'; import { EuiCodeEditor, EuiFormRow, EuiButton, EuiSpacer, EuiLink, EuiText } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import { DocumentationLinksService } from '../../documentation_links'; +import type { DocLinksStart } from 'src/core/public'; import { Rule, RuleBuilderError, generateRulesFromRaw } from '../../model'; interface Props { rules: Rule | null; onChange: (updatedRules: Rule | null) => void; onValidityChange: (isValid: boolean) => void; - docLinks: DocumentationLinksService; + docLinks: DocLinksStart; } export const JSONRuleEditor = (props: Props) => { @@ -108,7 +108,7 @@ export const JSONRuleEditor = (props: Props) => { values={{ roleMappingAPI: ( diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.test.tsx index ac31900b11a67..7c0101ce94996 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.test.tsx @@ -17,7 +17,6 @@ import '@kbn/test/target/jest/utils/stub_web_worker'; import { AllRule, FieldRule } from '../../model'; import { EuiErrorBoundary } from '@elastic/eui'; -import { DocumentationLinksService } from '../../documentation_links'; import { coreMock } from '../../../../../../../../src/core/public/mocks'; @@ -28,7 +27,7 @@ describe('RuleEditorPanel', () => { onChange: jest.fn(), onValidityChange: jest.fn(), validateForm: false, - docLinks: new DocumentationLinksService(coreMock.createStart().docLinks), + docLinks: coreMock.createStart().docLinks, }; const wrapper = mountWithIntl(); expect(wrapper.find(VisualRuleEditor)).toHaveLength(1); @@ -49,7 +48,7 @@ describe('RuleEditorPanel', () => { onChange: jest.fn(), onValidityChange: jest.fn(), validateForm: false, - docLinks: new DocumentationLinksService(coreMock.createStart().docLinks), + docLinks: coreMock.createStart().docLinks, }; const wrapper = mountWithIntl(); expect(wrapper.find(VisualRuleEditor)).toHaveLength(1); @@ -73,7 +72,7 @@ describe('RuleEditorPanel', () => { onChange: jest.fn(), onValidityChange: jest.fn(), validateForm: false, - docLinks: new DocumentationLinksService(coreMock.createStart().docLinks), + docLinks: coreMock.createStart().docLinks, }; const wrapper = mountWithIntl(); @@ -109,7 +108,7 @@ describe('RuleEditorPanel', () => { onChange: jest.fn(), onValidityChange: jest.fn(), validateForm: false, - docLinks: new DocumentationLinksService(coreMock.createStart().docLinks), + docLinks: coreMock.createStart().docLinks, }; const wrapper = mountWithIntl(); diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.tsx index 6e6641caa1f39..8e350c1d6ff9d 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.tsx @@ -22,12 +22,12 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; +import type { DocLinksStart } from 'src/core/public'; import { RoleMapping } from '../../../../../common/model'; import { VisualRuleEditor } from './visual_rule_editor'; import { JSONRuleEditor } from './json_rule_editor'; import { VISUAL_MAX_RULE_DEPTH } from '../services/role_mapping_constants'; import { Rule, generateRulesFromRaw } from '../../model'; -import { DocumentationLinksService } from '../../documentation_links'; import { validateRoleMappingRules } from '../services/role_mapping_validation'; interface Props { @@ -35,7 +35,7 @@ interface Props { onChange: (rawRules: RoleMapping['rules']) => void; onValidityChange: (isValid: boolean) => void; validateForm: boolean; - docLinks: DocumentationLinksService; + docLinks: DocLinksStart; } interface State { @@ -92,7 +92,7 @@ export class RuleEditorPanel extends Component { values={{ learnMoreLink: ( diff --git a/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.test.tsx b/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.test.tsx index a8001c1b775ea..f9e44e9b73c2f 100644 --- a/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.test.tsx @@ -13,7 +13,6 @@ import { EmptyPrompt } from './empty_prompt'; import { findTestSubject } from '@kbn/test/jest'; import { EuiLink } from '@elastic/eui'; import { act } from '@testing-library/react'; -import { DocumentationLinksService } from '../documentation_links'; import { coreMock, scopedHistoryMock } from '../../../../../../../src/core/public/mocks'; import { roleMappingsAPIClientMock } from '../role_mappings_api_client.mock'; @@ -42,7 +41,7 @@ describe('RoleMappingsGridPage', () => { rolesAPIClient={rolesAPIClientMock.create()} roleMappingsAPI={roleMappingsAPI} notifications={notifications} - docLinks={new DocumentationLinksService(docLinks)} + docLinks={docLinks} history={history} navigateToApp={coreStart.application.navigateToApp} /> @@ -71,7 +70,7 @@ describe('RoleMappingsGridPage', () => { rolesAPIClient={rolesAPIClientMock.create()} roleMappingsAPI={roleMappingsAPI} notifications={notifications} - docLinks={new DocumentationLinksService(docLinks)} + docLinks={docLinks} history={history} navigateToApp={coreStart.application.navigateToApp} /> @@ -108,7 +107,7 @@ describe('RoleMappingsGridPage', () => { rolesAPIClient={rolesAPIClientMock.create()} roleMappingsAPI={roleMappingsAPI} notifications={notifications} - docLinks={new DocumentationLinksService(docLinks)} + docLinks={docLinks} history={history} navigateToApp={coreStart.application.navigateToApp} /> @@ -144,7 +143,7 @@ describe('RoleMappingsGridPage', () => { rolesAPIClient={rolesAPIClientMock.create()} roleMappingsAPI={roleMappingsAPI} notifications={notifications} - docLinks={new DocumentationLinksService(docLinks)} + docLinks={docLinks} history={history} navigateToApp={coreStart.application.navigateToApp} /> @@ -178,7 +177,7 @@ describe('RoleMappingsGridPage', () => { rolesAPIClient={rolesAPIClientMock.create()} roleMappingsAPI={roleMappingsAPI} notifications={notifications} - docLinks={new DocumentationLinksService(docLinks)} + docLinks={docLinks} history={history} navigateToApp={coreStart.application.navigateToApp} /> @@ -218,7 +217,7 @@ describe('RoleMappingsGridPage', () => { rolesAPIClient={rolesAPIClientMock.create()} roleMappingsAPI={roleMappingsAPI} notifications={notifications} - docLinks={new DocumentationLinksService(docLinks)} + docLinks={docLinks} history={history} navigateToApp={coreStart.application.navigateToApp} /> @@ -281,7 +280,7 @@ describe('RoleMappingsGridPage', () => { rolesAPIClient={roleAPIClient} roleMappingsAPI={roleMappingsAPI} notifications={notifications} - docLinks={new DocumentationLinksService(docLinks)} + docLinks={docLinks} history={history} navigateToApp={coreStart.application.navigateToApp} /> diff --git a/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.tsx b/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.tsx index 7e83c3654cac3..59d5769a00480 100644 --- a/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.tsx @@ -25,7 +25,12 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import { NotificationsStart, ApplicationStart, ScopedHistory } from 'src/core/public'; +import type { + NotificationsStart, + ApplicationStart, + DocLinksStart, + ScopedHistory, +} from 'src/core/public'; import { RoleMapping, Role } from '../../../../common/model'; import { EmptyPrompt } from './empty_prompt'; import { @@ -35,7 +40,6 @@ import { SectionLoading, } from '../components'; import { EDIT_ROLE_MAPPING_PATH, getEditRoleMappingHref } from '../../management_urls'; -import { DocumentationLinksService } from '../documentation_links'; import { RoleMappingsAPIClient } from '../role_mappings_api_client'; import { RoleTableDisplay } from '../../role_table_display'; import { RolesAPIClient } from '../../roles'; @@ -46,7 +50,7 @@ interface Props { rolesAPIClient: PublicMethodsOf; roleMappingsAPI: PublicMethodsOf; notifications: NotificationsStart; - docLinks: DocumentationLinksService; + docLinks: DocLinksStart; history: ScopedHistory; navigateToApp: ApplicationStart['navigateToApp']; } @@ -148,7 +152,7 @@ export class RoleMappingsGridPage extends Component { values={{ learnMoreLink: ( diff --git a/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.test.tsx b/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.test.tsx index c72aeac5ba6f2..0d7443bad5f32 100644 --- a/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.test.tsx @@ -5,11 +5,21 @@ */ jest.mock('./role_mappings_grid', () => ({ - RoleMappingsGridPage: (props: any) => `Role Mappings Page: ${JSON.stringify(props)}`, + RoleMappingsGridPage: (props: any) => + // `docLinks` object is too big to include into test snapshot, so we just check its existence. + `Role Mappings Page: ${JSON.stringify({ + ...props, + docLinks: props.docLinks ? {} : undefined, + })}`, })); jest.mock('./edit_role_mapping', () => ({ - EditRoleMappingPage: (props: any) => `Role Mapping Edit Page: ${JSON.stringify(props)}`, + EditRoleMappingPage: (props: any) => + // `docLinks` object is too big to include into test snapshot, so we just check its existence. + `Role Mapping Edit Page: ${JSON.stringify({ + ...props, + docLinks: props.docLinks ? {} : undefined, + })}`, })); import { roleMappingsManagementApp } from './role_mappings_management_app'; @@ -54,7 +64,7 @@ describe('roleMappingsManagementApp', () => { expect(setBreadcrumbs).toHaveBeenCalledWith([{ href: `/`, text: 'Role Mappings' }]); expect(container).toMatchInlineSnapshot(`
- Role Mappings Page: {"notifications":{"toasts":{}},"rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"roleMappingsAPI":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"docLinks":{"mappingRoles":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/mapping-roles.html","createRoleMapping":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/security-api-put-role-mapping.html","createRoleMappingTemplates":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/security-api-put-role-mapping.html#_role_templates","roleMappingFieldRules":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/role-mapping-resources.html#mapping-roles-rule-field"},"history":{"action":"PUSH","length":1,"location":{"pathname":"/","search":"","hash":""}}} + Role Mappings Page: {"notifications":{"toasts":{}},"rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"roleMappingsAPI":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"docLinks":{},"history":{"action":"PUSH","length":1,"location":{"pathname":"/","search":"","hash":""}}}
`); @@ -73,7 +83,7 @@ describe('roleMappingsManagementApp', () => { ]); expect(container).toMatchInlineSnapshot(`
- Role Mapping Edit Page: {"roleMappingsAPI":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"notifications":{"toasts":{}},"docLinks":{"mappingRoles":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/mapping-roles.html","createRoleMapping":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/security-api-put-role-mapping.html","createRoleMappingTemplates":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/security-api-put-role-mapping.html#_role_templates","roleMappingFieldRules":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/role-mapping-resources.html#mapping-roles-rule-field"},"history":{"action":"PUSH","length":1,"location":{"pathname":"/edit","search":"","hash":""}}} + Role Mapping Edit Page: {"roleMappingsAPI":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"notifications":{"toasts":{}},"docLinks":{},"history":{"action":"PUSH","length":1,"location":{"pathname":"/edit","search":"","hash":""}}}
`); @@ -94,7 +104,7 @@ describe('roleMappingsManagementApp', () => { ]); expect(container).toMatchInlineSnapshot(`
- Role Mapping Edit Page: {"name":"role@mapping","roleMappingsAPI":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"notifications":{"toasts":{}},"docLinks":{"mappingRoles":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/mapping-roles.html","createRoleMapping":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/security-api-put-role-mapping.html","createRoleMappingTemplates":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/security-api-put-role-mapping.html#_role_templates","roleMappingFieldRules":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/role-mapping-resources.html#mapping-roles-rule-field"},"history":{"action":"PUSH","length":1,"location":{"pathname":"/edit/role@mapping","search":"","hash":""}}} + Role Mapping Edit Page: {"name":"role@mapping","roleMappingsAPI":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"notifications":{"toasts":{}},"docLinks":{},"history":{"action":"PUSH","length":1,"location":{"pathname":"/edit/role@mapping","search":"","hash":""}}}
`); diff --git a/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.tsx b/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.tsx index ce4ded5a9acbc..74eac417f0c4e 100644 --- a/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.tsx @@ -11,7 +11,6 @@ import { i18n } from '@kbn/i18n'; import { StartServicesAccessor } from 'src/core/public'; import { RegisterManagementAppArgs } from '../../../../../../src/plugins/management/public'; import { PluginStartDependencies } from '../../plugin'; -import { DocumentationLinksService } from './documentation_links'; import { tryDecodeURIComponent } from '../url_utils'; interface CreateParams { @@ -53,7 +52,6 @@ export const roleMappingsManagementApp = Object.freeze({ ]); const roleMappingsAPIClient = new RoleMappingsAPIClient(http); - const dockLinksService = new DocumentationLinksService(docLinks); const RoleMappingsGridPageWithBreadcrumbs = () => { setBreadcrumbs(roleMappingsBreadcrumbs); return ( @@ -61,7 +59,7 @@ export const roleMappingsManagementApp = Object.freeze({ notifications={notifications} rolesAPIClient={new RolesAPIClient(http)} roleMappingsAPI={roleMappingsAPIClient} - docLinks={dockLinksService} + docLinks={docLinks} history={history} navigateToApp={coreStart.application.navigateToApp} /> @@ -92,7 +90,7 @@ export const roleMappingsManagementApp = Object.freeze({ roleMappingsAPI={roleMappingsAPIClient} rolesAPIClient={new RolesAPIClient(http)} notifications={notifications} - docLinks={dockLinksService} + docLinks={docLinks} history={history} /> ); diff --git a/x-pack/plugins/security/public/management/roles/documentation_links.ts b/x-pack/plugins/security/public/management/roles/documentation_links.ts deleted file mode 100644 index aa19fbecb9c7b..0000000000000 --- a/x-pack/plugins/security/public/management/roles/documentation_links.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { DocLinksStart } from 'src/core/public'; - -export class DocumentationLinksService { - private readonly esClusterPrivileges: string; - private readonly esRunAsPrivilege: string; - private readonly esIndicesPrivileges: string; - - constructor(docLinks: DocLinksStart) { - this.esClusterPrivileges = `${docLinks.links.security.clusterPrivileges}`; - this.esRunAsPrivilege = `${docLinks.links.security.runAsPrivilege}`; - this.esIndicesPrivileges = `${docLinks.links.security.indicesPrivileges}`; - } - - public getESClusterPrivilegesDocUrl() { - return `${this.esClusterPrivileges}`; - } - - public getESRunAsPrivilegesDocUrl() { - return `${this.esRunAsPrivilege}`; - } - - public getESIndicesPrivilegesDocUrl() { - return `${this.esIndicesPrivileges}`; - } -} diff --git a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx index b86fa1f175e96..e431b49bf2f84 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx @@ -11,7 +11,6 @@ import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { Capabilities } from 'src/core/public'; import { KibanaFeature } from '../../../../../features/public'; import { Role } from '../../../../common/model'; -import { DocumentationLinksService } from '../documentation_links'; import { EditRolePage } from './edit_role_page'; import { SimplePrivilegeSection } from './privileges/kibana/simple_privilege_section'; @@ -184,7 +183,7 @@ function getProps({ userAPIClient, getFeatures: () => Promise.resolve(buildFeatures()), notifications, - docLinks: new DocumentationLinksService(docLinks), + docLinks, fatalErrors, uiCapabilities: buildUICapabilities(canManageSpaces), history: scopedHistoryMock.create(), diff --git a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx index d24191c54bd94..c750ec373b9f7 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx @@ -38,7 +38,7 @@ import { IHttpFetchError, NotificationsStart, } from 'src/core/public'; -import { ScopedHistory } from 'kibana/public'; +import type { DocLinksStart, ScopedHistory } from 'kibana/public'; import { FeaturesPluginStart } from '../../../../../features/public'; import { KibanaFeature } from '../../../../../features/common'; import { IndexPatternsContract } from '../../../../../../../src/plugins/data/public'; @@ -61,7 +61,6 @@ import { ElasticsearchPrivileges, KibanaPrivilegesRegion } from './privileges'; import { ReservedRoleBadge } from './reserved_role_badge'; import { SecurityLicense } from '../../../../common/licensing'; import { UserAPIClient } from '../../users'; -import { DocumentationLinksService } from '../documentation_links'; import { IndicesAPIClient } from '../indices_api_client'; import { RolesAPIClient } from '../roles_api_client'; import { PrivilegesAPIClient } from '../privileges_api_client'; @@ -77,7 +76,7 @@ interface Props { rolesAPIClient: PublicMethodsOf; privilegesAPIClient: PublicMethodsOf; getFeatures: FeaturesPluginStart['getFeatures']; - docLinks: DocumentationLinksService; + docLinks: DocLinksStart; http: HttpStart; license: SecurityLicense; uiCapabilities: Capabilities; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.test.tsx index 316822f7db024..4a29c5a5b134c 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.test.tsx @@ -6,7 +6,6 @@ import React from 'react'; import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; -import { DocumentationLinksService } from '../../../documentation_links'; import { RoleValidator } from '../../validate_role'; import { ClusterPrivileges } from './cluster_privileges'; import { ElasticsearchPrivileges } from './elasticsearch_privileges'; @@ -45,7 +44,7 @@ function getProps() { index: ['all', 'read', 'write', 'index'], }, indicesAPIClient: indicesAPIClientMock.create(), - docLinks: new DocumentationLinksService(docLinks), + docLinks, license, }; } diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.tsx index 8fc09ce167400..ca7a086639051 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.tsx @@ -19,6 +19,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import type { PublicMethodsOf } from '@kbn/utility-types'; import React, { Component, Fragment } from 'react'; +import type { DocLinksStart } from 'src/core/public'; import { Role, BuiltinESPrivileges } from '../../../../../../common/model'; import { SecurityLicense } from '../../../../../../common/licensing'; import { IndicesAPIClient } from '../../../indices_api_client'; @@ -26,13 +27,12 @@ import { RoleValidator } from '../../validate_role'; import { CollapsiblePanel } from '../../collapsible_panel'; import { ClusterPrivileges } from './cluster_privileges'; import { IndexPrivileges } from './index_privileges'; -import { DocumentationLinksService } from '../../../documentation_links'; interface Props { role: Role; editable: boolean; indicesAPIClient: PublicMethodsOf; - docLinks: DocumentationLinksService; + docLinks: DocLinksStart; license: SecurityLicense; onChange: (role: Role) => void; runAsUsers: string[]; @@ -90,7 +90,7 @@ export class ElasticsearchPrivileges extends Component { id="xpack.security.management.editRole.elasticSearchPrivileges.manageRoleActionsDescription" defaultMessage="Manage the actions this role can perform against your cluster. " /> - {this.learnMore(docLinks.getESClusterPrivilegesDocUrl())} + {this.learnMore(docLinks.links.security.clusterPrivileges)}

} > @@ -120,7 +120,7 @@ export class ElasticsearchPrivileges extends Component { id="xpack.security.management.editRole.elasticSearchPrivileges.howToBeSubmittedOnBehalfOfOtherUsersDescription" defaultMessage="Allow requests to be submitted on the behalf of other users. " /> - {this.learnMore(docLinks.getESRunAsPrivilegesDocUrl())} + {this.learnMore(docLinks.links.security.runAsPrivilege)}

} > @@ -164,7 +164,7 @@ export class ElasticsearchPrivileges extends Component { id="xpack.security.management.editRole.elasticSearchPrivileges.controlAccessToClusterDataDescription" defaultMessage="Control access to the data in your cluster. " /> - {this.learnMore(docLinks.getESIndicesPrivilegesDocUrl())} + {this.learnMore(docLinks.links.security.indicesPrivileges)}

diff --git a/x-pack/plugins/security/public/management/roles/roles_management_app.test.tsx b/x-pack/plugins/security/public/management/roles/roles_management_app.test.tsx index 8003b21f5d906..12c1951fc60f0 100644 --- a/x-pack/plugins/security/public/management/roles/roles_management_app.test.tsx +++ b/x-pack/plugins/security/public/management/roles/roles_management_app.test.tsx @@ -11,7 +11,9 @@ jest.mock('./roles_grid', () => ({ })); jest.mock('./edit_role', () => ({ - EditRolePage: (props: any) => `Role Edit Page: ${JSON.stringify(props)}`, + // `docLinks` object is too big to include into test snapshot, so we just check its existence. + EditRolePage: (props: any) => + `Role Edit Page: ${JSON.stringify({ ...props, docLinks: props.docLinks ? {} : undefined })}`, })); import { rolesManagementApp } from './roles_management_app'; @@ -87,7 +89,7 @@ describe('rolesManagementApp', () => { expect(setBreadcrumbs).toHaveBeenCalledWith([{ href: `/`, text: 'Roles' }, { text: 'Create' }]); expect(container).toMatchInlineSnapshot(`
- Role Edit Page: {"action":"edit","rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"userAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"indicesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"privilegesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}},"notifications":{"toasts":{}},"fatalErrors":{},"license":{"features$":{"_isScalar":false}},"docLinks":{"esClusterPrivileges":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/security-privileges.html#privileges-list-cluster","esRunAsPrivilege":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/security-privileges.html#_run_as_privilege","esIndicesPrivileges":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/security-privileges.html#privileges-list-indices"},"uiCapabilities":{"catalogue":{},"management":{},"navLinks":{}},"history":{"action":"PUSH","length":1,"location":{"pathname":"/edit","search":"","hash":""}}} + Role Edit Page: {"action":"edit","rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"userAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"indicesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"privilegesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}},"notifications":{"toasts":{}},"fatalErrors":{},"license":{"features$":{"_isScalar":false}},"docLinks":{},"uiCapabilities":{"catalogue":{},"management":{},"navLinks":{}},"history":{"action":"PUSH","length":1,"location":{"pathname":"/edit","search":"","hash":""}}}
`); @@ -108,7 +110,7 @@ describe('rolesManagementApp', () => { ]); expect(container).toMatchInlineSnapshot(`
- Role Edit Page: {"action":"edit","roleName":"role@name","rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"userAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"indicesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"privilegesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}},"notifications":{"toasts":{}},"fatalErrors":{},"license":{"features$":{"_isScalar":false}},"docLinks":{"esClusterPrivileges":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/security-privileges.html#privileges-list-cluster","esRunAsPrivilege":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/security-privileges.html#_run_as_privilege","esIndicesPrivileges":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/security-privileges.html#privileges-list-indices"},"uiCapabilities":{"catalogue":{},"management":{},"navLinks":{}},"history":{"action":"PUSH","length":1,"location":{"pathname":"/edit/role@name","search":"","hash":""}}} + Role Edit Page: {"action":"edit","roleName":"role@name","rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"userAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"indicesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"privilegesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}},"notifications":{"toasts":{}},"fatalErrors":{},"license":{"features$":{"_isScalar":false}},"docLinks":{},"uiCapabilities":{"catalogue":{},"management":{},"navLinks":{}},"history":{"action":"PUSH","length":1,"location":{"pathname":"/edit/role@name","search":"","hash":""}}}
`); @@ -126,7 +128,7 @@ describe('rolesManagementApp', () => { expect(setBreadcrumbs).toHaveBeenCalledWith([{ href: `/`, text: 'Roles' }, { text: 'Create' }]); expect(container).toMatchInlineSnapshot(`
- Role Edit Page: {"action":"clone","roleName":"someRoleName","rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"userAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"indicesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"privilegesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}},"notifications":{"toasts":{}},"fatalErrors":{},"license":{"features$":{"_isScalar":false}},"docLinks":{"esClusterPrivileges":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/security-privileges.html#privileges-list-cluster","esRunAsPrivilege":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/security-privileges.html#_run_as_privilege","esIndicesPrivileges":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/security-privileges.html#privileges-list-indices"},"uiCapabilities":{"catalogue":{},"management":{},"navLinks":{}},"history":{"action":"PUSH","length":1,"location":{"pathname":"/clone/someRoleName","search":"","hash":""}}} + Role Edit Page: {"action":"clone","roleName":"someRoleName","rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"userAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"indicesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"privilegesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}}},"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{},"externalUrl":{}},"notifications":{"toasts":{}},"fatalErrors":{},"license":{"features$":{"_isScalar":false}},"docLinks":{},"uiCapabilities":{"catalogue":{},"management":{},"navLinks":{}},"history":{"action":"PUSH","length":1,"location":{"pathname":"/clone/someRoleName","search":"","hash":""}}}
`); diff --git a/x-pack/plugins/security/public/management/roles/roles_management_app.tsx b/x-pack/plugins/security/public/management/roles/roles_management_app.tsx index d5b3b4998a09d..26c679516b46e 100644 --- a/x-pack/plugins/security/public/management/roles/roles_management_app.tsx +++ b/x-pack/plugins/security/public/management/roles/roles_management_app.tsx @@ -12,7 +12,6 @@ import { StartServicesAccessor, FatalErrorsSetup } from 'src/core/public'; import { RegisterManagementAppArgs } from '../../../../../../src/plugins/management/public'; import { SecurityLicense } from '../../../common/licensing'; import { PluginStartDependencies } from '../../plugin'; -import { DocumentationLinksService } from './documentation_links'; import { tryDecodeURIComponent } from '../url_utils'; interface CreateParams { @@ -97,7 +96,7 @@ export const rolesManagementApp = Object.freeze({ notifications={notifications} fatalErrors={fatalErrors} license={license} - docLinks={new DocumentationLinksService(docLinks)} + docLinks={docLinks} uiCapabilities={application.capabilities} indexPatterns={data.indexPatterns} history={history} diff --git a/x-pack/plugins/security/public/security_checkup/components/insecure_cluster_alert.tsx b/x-pack/plugins/security/public/security_checkup/components/insecure_cluster_alert.tsx index 310caeac91dc1..844444c0e64d5 100644 --- a/x-pack/plugins/security/public/security_checkup/components/insecure_cluster_alert.tsx +++ b/x-pack/plugins/security/public/security_checkup/components/insecure_cluster_alert.tsx @@ -7,7 +7,7 @@ import React, { useState } from 'react'; import { i18n } from '@kbn/i18n'; import { I18nProvider, FormattedMessage } from '@kbn/i18n/react'; import { render, unmountComponentAtNode } from 'react-dom'; -import { MountPoint } from 'kibana/public'; +import type { DocLinksStart, MountPoint } from 'kibana/public'; import { EuiCheckbox, EuiText, @@ -16,7 +16,6 @@ import { EuiFlexItem, EuiButton, } from '@elastic/eui'; -import { DocumentationLinksService } from '../documentation_links'; export const insecureClusterAlertTitle = i18n.translate( 'xpack.security.checkup.insecureClusterTitle', @@ -24,12 +23,15 @@ export const insecureClusterAlertTitle = i18n.translate( ); export const insecureClusterAlertText = ( - getDocLinksService: () => DocumentationLinksService, + getDocLinks: () => DocLinksStart, onDismiss: (persist: boolean) => void ) => ((e) => { const AlertText = () => { const [persist, setPersist] = useState(false); + const enableSecurityDocLink = `${ + getDocLinks().links.security.elasticsearchEnableSecurity + }?blade=kibanasecuritymessage`; return ( @@ -56,7 +58,7 @@ export const insecureClusterAlertText = ( size="s" color="primary" fill - href={getDocLinksService().getEnableSecurityDocUrl()} + href={enableSecurityDocLink} target="_blank" data-test-subj="learnMoreButton" > diff --git a/x-pack/plugins/security/public/security_checkup/documentation_links.ts b/x-pack/plugins/security/public/security_checkup/documentation_links.ts deleted file mode 100644 index 4a2a2bc968cc6..0000000000000 --- a/x-pack/plugins/security/public/security_checkup/documentation_links.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { DocLinksStart } from 'src/core/public'; - -export class DocumentationLinksService { - private readonly esEnableSecurity: string; - - constructor(docLinks: DocLinksStart) { - this.esEnableSecurity = `${docLinks.links.security.elasticsearchEnableSecurity}`; - } - - public getEnableSecurityDocUrl() { - return `${this.esEnableSecurity}?blade=kibanasecuritymessage`; - } -} diff --git a/x-pack/plugins/security/public/security_checkup/security_checkup_service.tsx b/x-pack/plugins/security/public/security_checkup/security_checkup_service.tsx index a0ea194170dff..bda9f210b02ec 100644 --- a/x-pack/plugins/security/public/security_checkup/security_checkup_service.tsx +++ b/x-pack/plugins/security/public/security_checkup/security_checkup_service.tsx @@ -4,14 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ -import { DocLinksStart } from 'kibana/public'; +import type { DocLinksStart } from 'kibana/public'; import { SecurityOssPluginSetup, SecurityOssPluginStart, } from '../../../../../src/plugins/security_oss/public'; import { insecureClusterAlertTitle, insecureClusterAlertText } from './components'; -import { DocumentationLinksService } from './documentation_links'; interface SetupDeps { securityOssSetup: SecurityOssPluginSetup; @@ -25,13 +24,13 @@ interface StartDeps { export class SecurityCheckupService { private securityOssStart?: SecurityOssPluginStart; - private docLinksService?: DocumentationLinksService; + private docLinks?: DocLinksStart; public setup({ securityOssSetup }: SetupDeps) { securityOssSetup.insecureCluster.setAlertTitle(insecureClusterAlertTitle); securityOssSetup.insecureCluster.setAlertText( insecureClusterAlertText( - () => this.docLinksService!, + () => this.docLinks!, (persist: boolean) => this.onDismiss(persist) ) ); @@ -39,7 +38,7 @@ export class SecurityCheckupService { public start({ securityOssStart, docLinks }: StartDeps) { this.securityOssStart = securityOssStart; - this.docLinksService = new DocumentationLinksService(docLinks); + this.docLinks = docLinks; } private onDismiss(persist: boolean) {