Skip to content

Commit

Permalink
expose DocLinks API from start only (elastic#68745)
Browse files Browse the repository at this point in the history
* exose DocLinks API from start only

* update docs

* fix type errors

* update docs

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
mshustov and elasticmachine committed Jun 24, 2020
1 parent 30b997f commit 28f8de5
Show file tree
Hide file tree
Showing 22 changed files with 62 additions and 133 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export interface CoreSetup<TPluginsStart extends object = object, TStart = unkno
| --- | --- | --- |
| [application](./kibana-plugin-core-public.coresetup.application.md) | <code>ApplicationSetup</code> | [ApplicationSetup](./kibana-plugin-core-public.applicationsetup.md) |
| [context](./kibana-plugin-core-public.coresetup.context.md) | <code>ContextSetup</code> | [ContextSetup](./kibana-plugin-core-public.contextsetup.md) |
| [docLinks](./kibana-plugin-core-public.coresetup.doclinks.md) | <code>DocLinksSetup</code> | [DocLinksSetup](./kibana-plugin-core-public.doclinkssetup.md) |
| [fatalErrors](./kibana-plugin-core-public.coresetup.fatalerrors.md) | <code>FatalErrorsSetup</code> | [FatalErrorsSetup](./kibana-plugin-core-public.fatalerrorssetup.md) |
| [getStartServices](./kibana-plugin-core-public.coresetup.getstartservices.md) | <code>StartServicesAccessor&lt;TPluginsStart, TStart&gt;</code> | [StartServicesAccessor](./kibana-plugin-core-public.startservicesaccessor.md) |
| [http](./kibana-plugin-core-public.coresetup.http.md) | <code>HttpSetup</code> | [HttpSetup](./kibana-plugin-core-public.httpsetup.md) |
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md) &gt; [DOC\_LINK\_VERSION](./kibana-plugin-core-public.doclinksstart.doc_link_version.md)

## DocLinksStart.DOC\_LINK\_VERSION property

<b>Signature:</b>

```typescript
readonly DOC_LINK_VERSION: string;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md) &gt; [ELASTIC\_WEBSITE\_URL](./kibana-plugin-core-public.doclinksstart.elastic_website_url.md)

## DocLinksStart.ELASTIC\_WEBSITE\_URL property

<b>Signature:</b>

```typescript
readonly ELASTIC_WEBSITE_URL: string;
```
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [DocLinksSetup](./kibana-plugin-core-public.doclinkssetup.md) &gt; [links](./kibana-plugin-core-public.doclinkssetup.links.md)
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md) &gt; [links](./kibana-plugin-core-public.doclinksstart.links.md)

## DocLinksSetup.links property
## DocLinksStart.links property

<b>Signature:</b>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md)

## DocLinksStart type
## DocLinksStart interface


<b>Signature:</b>

```typescript
export declare type DocLinksStart = DocLinksSetup;
export interface DocLinksStart
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [DOC\_LINK\_VERSION](./kibana-plugin-core-public.doclinksstart.doc_link_version.md) | <code>string</code> | |
| [ELASTIC\_WEBSITE\_URL](./kibana-plugin-core-public.doclinksstart.elastic_website_url.md) | <code>string</code> | |
| [links](./kibana-plugin-core-public.doclinksstart.links.md) | <code>{</code><br/><code> readonly dashboard: {</code><br/><code> readonly drilldowns: string;</code><br/><code> };</code><br/><code> readonly filebeat: {</code><br/><code> readonly base: string;</code><br/><code> readonly installation: string;</code><br/><code> readonly configuration: string;</code><br/><code> readonly elasticsearchOutput: string;</code><br/><code> readonly startup: string;</code><br/><code> readonly exportedFields: string;</code><br/><code> };</code><br/><code> readonly auditbeat: {</code><br/><code> readonly base: string;</code><br/><code> };</code><br/><code> readonly metricbeat: {</code><br/><code> readonly base: string;</code><br/><code> };</code><br/><code> readonly heartbeat: {</code><br/><code> readonly base: string;</code><br/><code> };</code><br/><code> readonly logstash: {</code><br/><code> readonly base: string;</code><br/><code> };</code><br/><code> readonly functionbeat: {</code><br/><code> readonly base: string;</code><br/><code> };</code><br/><code> readonly winlogbeat: {</code><br/><code> readonly base: string;</code><br/><code> };</code><br/><code> readonly aggs: {</code><br/><code> readonly date_histogram: string;</code><br/><code> readonly date_range: string;</code><br/><code> readonly filter: string;</code><br/><code> readonly filters: string;</code><br/><code> readonly geohash_grid: string;</code><br/><code> readonly histogram: string;</code><br/><code> readonly ip_range: string;</code><br/><code> readonly range: string;</code><br/><code> readonly significant_terms: string;</code><br/><code> readonly terms: string;</code><br/><code> readonly avg: string;</code><br/><code> readonly avg_bucket: string;</code><br/><code> readonly max_bucket: string;</code><br/><code> readonly min_bucket: string;</code><br/><code> readonly sum_bucket: string;</code><br/><code> readonly cardinality: string;</code><br/><code> readonly count: string;</code><br/><code> readonly cumulative_sum: string;</code><br/><code> readonly derivative: string;</code><br/><code> readonly geo_bounds: string;</code><br/><code> readonly geo_centroid: string;</code><br/><code> readonly max: string;</code><br/><code> readonly median: string;</code><br/><code> readonly min: string;</code><br/><code> readonly moving_avg: string;</code><br/><code> readonly percentile_ranks: string;</code><br/><code> readonly serial_diff: string;</code><br/><code> readonly std_dev: string;</code><br/><code> readonly sum: string;</code><br/><code> readonly top_hits: string;</code><br/><code> };</code><br/><code> readonly scriptedFields: {</code><br/><code> readonly scriptFields: string;</code><br/><code> readonly scriptAggs: string;</code><br/><code> readonly painless: string;</code><br/><code> readonly painlessApi: string;</code><br/><code> readonly painlessSyntax: string;</code><br/><code> readonly luceneExpressions: string;</code><br/><code> };</code><br/><code> readonly indexPatterns: {</code><br/><code> readonly loadingData: string;</code><br/><code> readonly introduction: string;</code><br/><code> };</code><br/><code> readonly kibana: string;</code><br/><code> readonly siem: {</code><br/><code> readonly guide: string;</code><br/><code> readonly gettingStarted: string;</code><br/><code> };</code><br/><code> readonly query: {</code><br/><code> readonly luceneQuerySyntax: string;</code><br/><code> readonly queryDsl: string;</code><br/><code> readonly kueryQuerySyntax: string;</code><br/><code> };</code><br/><code> readonly date: {</code><br/><code> readonly dateMath: string;</code><br/><code> };</code><br/><code> readonly management: Record&lt;string, string&gt;;</code><br/><code> }</code> | |

3 changes: 1 addition & 2 deletions docs/development/core/public/kibana-plugin-core-public.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [ContextSetup](./kibana-plugin-core-public.contextsetup.md) | An object that handles registration of context providers and configuring handlers with context. |
| [CoreSetup](./kibana-plugin-core-public.coresetup.md) | Core services exposed to the <code>Plugin</code> setup lifecycle |
| [CoreStart](./kibana-plugin-core-public.corestart.md) | Core services exposed to the <code>Plugin</code> start lifecycle |
| [DocLinksSetup](./kibana-plugin-core-public.doclinkssetup.md) | |
| [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md) | |
| [EnvironmentMode](./kibana-plugin-core-public.environmentmode.md) | |
| [ErrorToastOptions](./kibana-plugin-core-public.errortoastoptions.md) | Options available for [IToasts](./kibana-plugin-core-public.itoasts.md) error APIs. |
| [FatalErrorInfo](./kibana-plugin-core-public.fatalerrorinfo.md) | Represents the <code>message</code> and <code>stack</code> of a fatal Error |
Expand Down Expand Up @@ -157,7 +157,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [ChromeHelpExtensionMenuGitHubLink](./kibana-plugin-core-public.chromehelpextensionmenugithublink.md) | |
| [ChromeHelpExtensionMenuLink](./kibana-plugin-core-public.chromehelpextensionmenulink.md) | |
| [ChromeNavLinkUpdateableFields](./kibana-plugin-core-public.chromenavlinkupdateablefields.md) | |
| [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md) | |
| [FatalErrorsStart](./kibana-plugin-core-public.fatalerrorsstart.md) | FatalErrors stop the Kibana Public Core and displays a fatal error screen with details about the Kibana build and the error. |
| [Freezable](./kibana-plugin-core-public.freezable.md) | |
| [HandlerContextType](./kibana-plugin-core-public.handlercontexttype.md) | Extracts the type of the first argument of a [HandlerFunction](./kibana-plugin-core-public.handlerfunction.md) to represent the type of the context. |
Expand Down
5 changes: 2 additions & 3 deletions src/core/public/core_system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export class CoreSystem {
i18n: this.i18n.getContext(),
});
await this.integrations.setup();
const docLinks = this.docLinks.setup({ injectedMetadata });
this.docLinks.setup();
const http = this.http.setup({ injectedMetadata, fatalErrors: this.fatalErrorsSetup });
const uiSettings = this.uiSettings.setup({ http, injectedMetadata });
const notifications = this.notifications.setup({ uiSettings });
Expand All @@ -185,7 +185,6 @@ export class CoreSystem {
const core: InternalCoreSetup = {
application,
context,
docLinks,
fatalErrors: this.fatalErrorsSetup,
http,
injectedMetadata,
Expand Down Expand Up @@ -217,7 +216,7 @@ export class CoreSystem {
try {
const injectedMetadata = await this.injectedMetadata.start();
const uiSettings = await this.uiSettings.start();
const docLinks = this.docLinks.start();
const docLinks = this.docLinks.start({ injectedMetadata });
const http = await this.http.start();
const savedObjects = await this.savedObjects.start({ http });
const i18n = await this.i18n.start();
Expand Down
12 changes: 5 additions & 7 deletions src/core/public/doc_links/doc_links_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,23 @@
*/

import { injectedMetadataServiceMock } from '../injected_metadata/injected_metadata_service.mock';
import { DocLinksService, DocLinksSetup, DocLinksStart } from './doc_links_service';
import { DocLinksService, DocLinksStart } from './doc_links_service';

const createSetupContractMock = (): DocLinksSetup => {
const createStartContractMock = (): DocLinksStart => {
// This service is so simple that we actually use the real implementation
const injectedMetadata = injectedMetadataServiceMock.createStartContract();
injectedMetadata.getKibanaBranch.mockReturnValue('mocked-test-branch');
return new DocLinksService().setup({ injectedMetadata });
return new DocLinksService().start({ injectedMetadata });
};

const createStartContractMock: () => DocLinksStart = createSetupContractMock;

type DocLinksServiceContract = PublicMethodsOf<DocLinksService>;
const createMock = (): jest.Mocked<DocLinksServiceContract> => ({
setup: jest.fn().mockReturnValue(createSetupContractMock()),
setup: jest.fn().mockReturnValue(undefined),
start: jest.fn().mockReturnValue(createStartContractMock()),
});

export const docLinksServiceMock = {
create: createMock,
createSetupContract: createSetupContractMock,
createSetupContract: () => jest.fn(),
createStartContract: createStartContractMock,
};
Loading

0 comments on commit 28f8de5

Please sign in to comment.