Use documentation link service for runtime fields (#95256)
This commit is contained in:
parent
6b59fe3d01
commit
68722313f2
|
@ -87,7 +87,9 @@ readonly links: {
|
||||||
readonly sum: string;
|
readonly sum: string;
|
||||||
readonly top_hits: string;
|
readonly top_hits: string;
|
||||||
};
|
};
|
||||||
readonly runtimeFields: string;
|
readonly runtimeFields: {
|
||||||
|
readonly mapping: string;
|
||||||
|
};
|
||||||
readonly scriptedFields: {
|
readonly scriptedFields: {
|
||||||
readonly scriptFields: string;
|
readonly scriptFields: string;
|
||||||
readonly scriptAggs: string;
|
readonly scriptAggs: string;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -108,7 +108,9 @@ export class DocLinksService {
|
||||||
sum: `${ELASTICSEARCH_DOCS}search-aggregations-metrics-sum-aggregation.html`,
|
sum: `${ELASTICSEARCH_DOCS}search-aggregations-metrics-sum-aggregation.html`,
|
||||||
top_hits: `${ELASTICSEARCH_DOCS}search-aggregations-metrics-top-hits-aggregation.html`,
|
top_hits: `${ELASTICSEARCH_DOCS}search-aggregations-metrics-top-hits-aggregation.html`,
|
||||||
},
|
},
|
||||||
runtimeFields: `${ELASTICSEARCH_DOCS}runtime.html`,
|
runtimeFields: {
|
||||||
|
mapping: `${ELASTICSEARCH_DOCS}runtime-mapping-fields.html`,
|
||||||
|
},
|
||||||
scriptedFields: {
|
scriptedFields: {
|
||||||
scriptFields: `${ELASTICSEARCH_DOCS}search-request-script-fields.html`,
|
scriptFields: `${ELASTICSEARCH_DOCS}search-request-script-fields.html`,
|
||||||
scriptAggs: `${ELASTICSEARCH_DOCS}search-aggregations.html`,
|
scriptAggs: `${ELASTICSEARCH_DOCS}search-aggregations.html`,
|
||||||
|
@ -381,7 +383,9 @@ export interface DocLinksStart {
|
||||||
readonly sum: string;
|
readonly sum: string;
|
||||||
readonly top_hits: string;
|
readonly top_hits: string;
|
||||||
};
|
};
|
||||||
readonly runtimeFields: string;
|
readonly runtimeFields: {
|
||||||
|
readonly mapping: string;
|
||||||
|
};
|
||||||
readonly scriptedFields: {
|
readonly scriptedFields: {
|
||||||
readonly scriptFields: string;
|
readonly scriptFields: string;
|
||||||
readonly scriptAggs: string;
|
readonly scriptAggs: string;
|
||||||
|
|
|
@ -559,7 +559,9 @@ export interface DocLinksStart {
|
||||||
readonly sum: string;
|
readonly sum: string;
|
||||||
readonly top_hits: string;
|
readonly top_hits: string;
|
||||||
};
|
};
|
||||||
readonly runtimeFields: string;
|
readonly runtimeFields: {
|
||||||
|
readonly mapping: string;
|
||||||
|
};
|
||||||
readonly scriptedFields: {
|
readonly scriptedFields: {
|
||||||
readonly scriptFields: string;
|
readonly scriptFields: string;
|
||||||
readonly scriptAggs: string;
|
readonly scriptAggs: string;
|
||||||
|
|
|
@ -7,7 +7,10 @@
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { GlobalFlyout } from '../../../../../../../../../../src/plugins/es_ui_shared/public';
|
import { GlobalFlyout } from '../../../../../../../../../../src/plugins/es_ui_shared/public';
|
||||||
import { uiSettingsServiceMock } from '../../../../../../../../../../src/core/public/mocks';
|
import {
|
||||||
|
docLinksServiceMock,
|
||||||
|
uiSettingsServiceMock,
|
||||||
|
} from '../../../../../../../../../../src/core/public/mocks';
|
||||||
import { MappingsEditorProvider } from '../../../mappings_editor_context';
|
import { MappingsEditorProvider } from '../../../mappings_editor_context';
|
||||||
import { createKibanaReactContext } from '../../../shared_imports';
|
import { createKibanaReactContext } from '../../../shared_imports';
|
||||||
|
|
||||||
|
@ -80,10 +83,7 @@ const { Provider: KibanaReactContextProvider } = createKibanaReactContext({
|
||||||
});
|
});
|
||||||
|
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
docLinks: {
|
docLinks: docLinksServiceMock.createStartContract(),
|
||||||
DOC_LINK_VERSION: 'master',
|
|
||||||
ELASTIC_WEBSITE_URL: 'https://jest.elastic.co',
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const WithAppDependencies = (Comp: any) => (props: any) => (
|
export const WithAppDependencies = (Comp: any) => (props: any) => (
|
||||||
|
|
|
@ -24,7 +24,10 @@ const setup = (props?: Props) =>
|
||||||
const docLinks: DocLinksStart = {
|
const docLinks: DocLinksStart = {
|
||||||
ELASTIC_WEBSITE_URL: 'https://jestTest.elastic.co',
|
ELASTIC_WEBSITE_URL: 'https://jestTest.elastic.co',
|
||||||
DOC_LINK_VERSION: 'jest',
|
DOC_LINK_VERSION: 'jest',
|
||||||
links: {} as any,
|
links: {
|
||||||
|
runtimeFields: { mapping: 'https://jestTest.elastic.co/to-be-defined.html' },
|
||||||
|
scriptedFields: {} as any,
|
||||||
|
} as any,
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('Runtime field editor', () => {
|
describe('Runtime field editor', () => {
|
||||||
|
|
|
@ -23,7 +23,10 @@ const setup = (props?: Props) =>
|
||||||
const docLinks: DocLinksStart = {
|
const docLinks: DocLinksStart = {
|
||||||
ELASTIC_WEBSITE_URL: 'htts://jestTest.elastic.co',
|
ELASTIC_WEBSITE_URL: 'htts://jestTest.elastic.co',
|
||||||
DOC_LINK_VERSION: 'jest',
|
DOC_LINK_VERSION: 'jest',
|
||||||
links: {} as any,
|
links: {
|
||||||
|
runtimeFields: { mapping: 'https://jestTest.elastic.co/to-be-defined.html' },
|
||||||
|
scriptedFields: {} as any,
|
||||||
|
} as any,
|
||||||
};
|
};
|
||||||
|
|
||||||
const noop = () => {};
|
const noop = () => {};
|
||||||
|
|
|
@ -7,14 +7,11 @@
|
||||||
|
|
||||||
import { DocLinksStart } from 'src/core/public';
|
import { DocLinksStart } from 'src/core/public';
|
||||||
|
|
||||||
export const getLinks = (docLinks: DocLinksStart) => {
|
export const getLinks = ({ links }: DocLinksStart) => {
|
||||||
const { DOC_LINK_VERSION, ELASTIC_WEBSITE_URL } = docLinks;
|
const runtimePainless = `${links.runtimeFields.mapping}`;
|
||||||
const docsBase = `${ELASTIC_WEBSITE_URL}guide/en`;
|
const painlessSyntax = `${links.scriptedFields.painlessLangSpec}`;
|
||||||
const esDocsBase = `${docsBase}/elasticsearch/reference/${DOC_LINK_VERSION}`;
|
|
||||||
const painlessDocsBase = `${docsBase}/elasticsearch/painless/${DOC_LINK_VERSION}`;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
runtimePainless: `${esDocsBase}/runtime.html#runtime-mapping-fields`,
|
runtimePainless,
|
||||||
painlessSyntax: `${painlessDocsBase}/painless-lang-spec.html`,
|
painlessSyntax,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue