[7.x]Use documentation link service for index pattern field editor #100609 (#100708)

This commit is contained in:
Lisa Cawley 2021-05-26 12:30:35 -07:00 committed by GitHub
parent 112e174c31
commit 7b977771d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 31 additions and 22 deletions

View file

@ -23,14 +23,24 @@ core.application.register({
title: 'Translated title',
keywords: ['translated keyword1', 'translated keyword2'],
deepLinks: [
{ id: 'sub1', title: 'Sub1', path: '/sub1', keywords: ['subpath1'] },
{
id: 'sub2',
title: 'Sub2',
deepLinks: [
{ id: 'subsub', title: 'SubSub', path: '/sub2/sub', keywords: ['subpath2'] }
]
}
{
id: 'sub1',
title: 'Sub1',
path: '/sub1',
keywords: ['subpath1'],
},
{
id: 'sub2',
title: 'Sub2',
deepLinks: [
{
id: 'subsub',
title: 'SubSub',
path: '/sub2/sub',
keywords: ['subpath2'],
},
],
},
],
mount: () => { ... }
})

View file

@ -111,6 +111,7 @@ readonly links: {
readonly introduction: string;
readonly fieldFormattersNumber: string;
readonly fieldFormattersString: string;
readonly runtimeFields: string;
};
readonly addData: string;
readonly kibana: string;

File diff suppressed because one or more lines are too long

View file

@ -131,6 +131,7 @@ export class DocLinksService {
introduction: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/index-patterns.html`,
fieldFormattersNumber: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/numeral.html`,
fieldFormattersString: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/field-formatters-string.html`,
runtimeFields: `${KIBANA_DOCS}managing-index-patterns.html#runtime-fields`,
},
addData: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/connect-to-elasticsearch.html`,
kibana: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/index.html`,
@ -514,6 +515,7 @@ export interface DocLinksStart {
readonly introduction: string;
readonly fieldFormattersNumber: string;
readonly fieldFormattersString: string;
readonly runtimeFields: string;
};
readonly addData: string;
readonly kibana: string;

View file

@ -584,6 +584,7 @@ export interface DocLinksStart {
readonly introduction: string;
readonly fieldFormattersNumber: string;
readonly fieldFormattersString: string;
readonly runtimeFields: string;
};
readonly addData: string;
readonly kibana: string;

View file

@ -14,12 +14,11 @@ import { registerTestBed, TestBed, getCommonActions } from '../../test_utils';
import { RuntimeFieldPainlessError } from '../../lib';
import { Field } from '../../types';
import { FieldEditor, Props, FieldEditorFormState } from './field_editor';
import { docLinksServiceMock } from '../../../../../core/public/mocks';
const defaultProps: Props = {
onChange: jest.fn(),
links: {
runtimePainless: 'https://elastic.co',
},
links: docLinksServiceMock.createStartContract() as any,
ctx: {
existingConcreteFields: [],
namesNotAllowed: [],

View file

@ -8,15 +8,16 @@
import { act } from 'react-dom/test-utils';
import '../test_utils/setup_environment';
import { registerTestBed, TestBed, noop, docLinks, getCommonActions } from '../test_utils';
import { registerTestBed, TestBed, noop, getCommonActions } from '../test_utils';
import { FieldEditor } from './field_editor';
import { FieldEditorFlyoutContent, Props } from './field_editor_flyout_content';
import { docLinksServiceMock } from '../../../../core/public/mocks';
const defaultProps: Props = {
onSave: noop,
onCancel: noop,
docLinks,
docLinks: docLinksServiceMock.createStartContract() as any,
FieldEditor,
indexPattern: { fields: [] } as any,
uiSettings: {} as any,

View file

@ -8,14 +8,9 @@
import { DocLinksStart } from 'src/core/public';
export const getLinks = (docLinks: DocLinksStart) => {
const { DOC_LINK_VERSION, ELASTIC_WEBSITE_URL } = docLinks;
const docsBase = `${ELASTIC_WEBSITE_URL}guide/en`;
const painlessDocsBase = `${docsBase}/elasticsearch/painless/${DOC_LINK_VERSION}`;
const kibanaDocsBase = `${docsBase}/kibana/${DOC_LINK_VERSION}`;
export const getLinks = ({ links }: DocLinksStart) => {
return {
runtimePainless: `${kibanaDocsBase}/managing-index-patterns.html#runtime-fields`,
painlessSyntax: `${painlessDocsBase}/painless-lang-spec.html`,
runtimePainless: links.indexPatterns.runtimeFields,
painlessSyntax: links.scriptedFields.painlessLangSpec,
};
};