Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use doc link services in CCR #98436

Merged
merged 8 commits into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ readonly links: {
readonly visualize: Record<string, string>;
readonly apis: Readonly<{
bulkIndexAlias: string;
byteSizeUnits: string;
createAutoFollowPattern: string;
createFollower: string;
createIndex: string;
createSnapshotLifecyclePolicy: string;
createRoleMapping: string;
Expand All @@ -153,6 +156,7 @@ readonly links: {
putIndexTemplateV1: string;
putWatch: string;
simulatePipeline: string;
timeUnits: string;
updateTransform: string;
}>;
readonly observability: Record<string, string>;
Expand Down

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ export class DocLinksService {
},
apis: {
bulkIndexAlias: `${ELASTICSEARCH_DOCS}indices-aliases.html`,
byteSizeUnits: `${ELASTICSEARCH_DOCS}common-options.html#byte-units`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] I see there's also an elasticsearch property. I'm not as familiar with how the doc links are organized, but that seems like it might be more appropriate than to live under apis.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page is a subsection of a long "API conventions" page, which is why I put it under "apis" in the link service. If we end up having to differentiate between conventions for Cloud/Kibana/Elasticsearch APIs, then maybe it's worth revisiting but I'll stick with this for now unless you have strong objections.

createAutoFollowPattern: `${ELASTICSEARCH_DOCS}ccr-put-auto-follow-pattern.html`,
createFollower: `${ELASTICSEARCH_DOCS}ccr-put-follow.html`,
createIndex: `${ELASTICSEARCH_DOCS}indices-create-index.html`,
createSnapshotLifecyclePolicy: `${ELASTICSEARCH_DOCS}slm-api-put-policy.html`,
createRoleMapping: `${ELASTICSEARCH_DOCS}security-api-put-role-mapping.html`,
Expand All @@ -329,6 +332,7 @@ export class DocLinksService {
putSnapshotLifecyclePolicy: `${ELASTICSEARCH_DOCS}slm-api-put-policy.html`,
putWatch: `${ELASTICSEARCH_DOCS}watcher-api-put-watch.html`,
simulatePipeline: `${ELASTICSEARCH_DOCS}simulate-pipeline-api.html`,
timeUnits: `${ELASTICSEARCH_DOCS}common-options.html#time-units`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar comment here

updateTransform: `${ELASTICSEARCH_DOCS}update-transform.html`,
},
plugins: {
Expand Down Expand Up @@ -527,6 +531,9 @@ export interface DocLinksStart {
readonly visualize: Record<string, string>;
readonly apis: Readonly<{
bulkIndexAlias: string;
byteSizeUnits: string;
createAutoFollowPattern: string;
createFollower: string;
createIndex: string;
createSnapshotLifecyclePolicy: string;
createRoleMapping: string;
Expand All @@ -546,6 +553,7 @@ export interface DocLinksStart {
putIndexTemplateV1: string;
putWatch: string;
simulatePipeline: string;
timeUnits: string;
updateTransform: string;
}>;
readonly observability: Record<string, string>;
Expand Down
4 changes: 4 additions & 0 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,9 @@ export interface DocLinksStart {
readonly visualize: Record<string, string>;
readonly apis: Readonly<{
bulkIndexAlias: string;
byteSizeUnits: string;
createAutoFollowPattern: string;
createFollower: string;
createIndex: string;
createSnapshotLifecyclePolicy: string;
createRoleMapping: string;
Expand All @@ -638,6 +641,7 @@ export interface DocLinksStart {
putIndexTemplateV1: string;
putWatch: string;
simulatePipeline: string;
timeUnits: string;
updateTransform: string;
}>;
readonly observability: Record<string, string>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import axios from 'axios';
import axiosXhrAdapter from 'axios/lib/adapters/xhr';

import { docLinksServiceMock } from '../../../../../../../src/core/public/mocks';
import { setHttpClient } from '../../../app/services/api';
import { init as initDocumentation } from '../../../app/services/documentation_links';
import { init as initHttpRequests } from './http_requests';

export const setupEnvironment = () => {
Expand All @@ -17,6 +19,7 @@ export const setupEnvironment = () => {
const client = axios.create({ adapter: axiosXhrAdapter });
client.interceptors.response.use(({ data }) => data);
setHttpClient(client);
initDocumentation(docLinksServiceMock.createStartContract());

const { server, httpRequestsMockHelpers } = initHttpRequests();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
EuiTitle,
} from '@elastic/eui';

import { getAutoFollowPatternUrl } from '../services/documentation_links';
import { documentationLinks } from '../services/documentation_links';

export const AutoFollowPatternPageTitle = ({ title }) => (
<Fragment>
Expand All @@ -36,7 +36,7 @@ export const AutoFollowPatternPageTitle = ({ title }) => (
<EuiButtonEmpty
size="s"
flush="right"
href={getAutoFollowPatternUrl()}
href={documentationLinks.apis.createAutoFollowPattern}
target="_blank"
iconType="help"
data-test-subj="docsButton"
Expand Down
Loading