Skip to content

Commit

Permalink
Merge branch 'master' into pjhampton/diagnostic-alert-telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Dec 9, 2020
2 parents d14f8f9 + e9ad56d commit 58672b3
Show file tree
Hide file tree
Showing 263 changed files with 16,318 additions and 67,229 deletions.
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
],
"maps_legacy": "src/plugins/maps_legacy",
"monaco": "packages/kbn-monaco/src",
"presentationUtil": "src/plugins/presentation_util",
"indexPatternManagement": "src/plugins/index_pattern_management",
"advancedSettings": "src/plugins/advanced_settings",
"kibana_legacy": "src/plugins/kibana_legacy",
Expand Down
4 changes: 4 additions & 0 deletions config/kibana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
# default to `true` starting in Kibana 7.0.
#server.rewriteBasePath: false

# Specifies the public URL at which Kibana is available for end users. If
# `server.basePath` is configured this URL should end with the same basePath.
#server.publicBaseUrl: ""

# The maximum payload size in bytes for incoming server requests.
#server.maxPayloadBytes: 1048576

Expand Down
6 changes: 5 additions & 1 deletion docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ as uiSettings within the code.
- Adds a dashboard embeddable that can be used in other applications.
|{kib-repo}blob/{branch}/src/plugins/data/README.md[data]
|{kib-repo}blob/{branch}/src/plugins/data/README.mdx[data]
|The data plugin provides common data access services, such as search and query, for solutions and application developers.
Expand Down Expand Up @@ -160,6 +160,10 @@ It also provides a stateful version of it on the start contract.
Content is fetched from the remote (https://feeds.elastic.co and https://feeds-staging.elastic.co in dev mode) once a day, with periodic checks if the content needs to be refreshed. All newsfeed content is hosted remotely.
|{kib-repo}blob/{branch}/src/plugins/presentation_util/README.md[presentationUtil]
|Utilities and components used by the presentation-related plugins
|{kib-repo}blob/{branch}/src/plugins/region_map/README.md[regionMap]
|Create choropleth maps. Display the results of a term-aggregation as e.g. countries, zip-codes, states.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface IBasePath
| --- | --- | --- |
| [get](./kibana-plugin-core-public.ibasepath.get.md) | <code>() =&gt; string</code> | Gets the <code>basePath</code> string. |
| [prepend](./kibana-plugin-core-public.ibasepath.prepend.md) | <code>(url: string) =&gt; string</code> | Prepends <code>path</code> with the basePath. |
| [publicBaseUrl](./kibana-plugin-core-public.ibasepath.publicbaseurl.md) | <code>string</code> | The server's publicly exposed base URL, if configured. Includes protocol, host, port (optional) and the [IBasePath.serverBasePath](./kibana-plugin-core-public.ibasepath.serverbasepath.md)<!-- -->. |
| [remove](./kibana-plugin-core-public.ibasepath.remove.md) | <code>(url: string) =&gt; string</code> | Removes the prepended basePath from the <code>path</code>. |
| [serverBasePath](./kibana-plugin-core-public.ibasepath.serverbasepath.md) | <code>string</code> | Returns the server's root basePath as configured, without any namespace prefix.<!-- -->See for getting the basePath value for a specific request |

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- 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; [IBasePath](./kibana-plugin-core-public.ibasepath.md) &gt; [publicBaseUrl](./kibana-plugin-core-public.ibasepath.publicbaseurl.md)

## IBasePath.publicBaseUrl property

The server's publicly exposed base URL, if configured. Includes protocol, host, port (optional) and the [IBasePath.serverBasePath](./kibana-plugin-core-public.ibasepath.serverbasepath.md)<!-- -->.

<b>Signature:</b>

```typescript
readonly publicBaseUrl?: string;
```

## Remarks

Should be used for generating external URL links back to this Kibana instance.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The constructor for this class is marked as internal. Third-party code should no
| --- | --- | --- | --- |
| [get](./kibana-plugin-core-server.basepath.get.md) | | <code>(request: KibanaRequest &#124; LegacyRequest) =&gt; string</code> | returns <code>basePath</code> value, specific for an incoming request. |
| [prepend](./kibana-plugin-core-server.basepath.prepend.md) | | <code>(path: string) =&gt; string</code> | Prepends <code>path</code> with the basePath. |
| [publicBaseUrl](./kibana-plugin-core-server.basepath.publicbaseurl.md) | | <code>string</code> | The server's publicly exposed base URL, if configured. Includes protocol, host, port (optional) and the [BasePath.serverBasePath](./kibana-plugin-core-server.basepath.serverbasepath.md)<!-- -->. |
| [remove](./kibana-plugin-core-server.basepath.remove.md) | | <code>(path: string) =&gt; string</code> | Removes the prepended basePath from the <code>path</code>. |
| [serverBasePath](./kibana-plugin-core-server.basepath.serverbasepath.md) | | <code>string</code> | returns the server's basePath<!-- -->See [BasePath.get](./kibana-plugin-core-server.basepath.get.md) for getting the basePath value for a specific request |
| [set](./kibana-plugin-core-server.basepath.set.md) | | <code>(request: KibanaRequest &#124; LegacyRequest, requestSpecificBasePath: string) =&gt; void</code> | sets <code>basePath</code> value, specific for an incoming request. |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [BasePath](./kibana-plugin-core-server.basepath.md) &gt; [publicBaseUrl](./kibana-plugin-core-server.basepath.publicbaseurl.md)

## BasePath.publicBaseUrl property

The server's publicly exposed base URL, if configured. Includes protocol, host, port (optional) and the [BasePath.serverBasePath](./kibana-plugin-core-server.basepath.serverbasepath.md)<!-- -->.

<b>Signature:</b>

```typescript
readonly publicBaseUrl?: string;
```

## Remarks

Should be used for generating external URL links back to this Kibana instance.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

## HttpServerInfo interface

Information about what hostname, port, and protocol the server process is running on. Note that this may not match the URL that end-users access Kibana at. For the public URL, see [BasePath.publicBaseUrl](./kibana-plugin-core-server.basepath.publicbaseurl.md)<!-- -->.

<b>Signature:</b>

Expand Down
2 changes: 1 addition & 1 deletion docs/development/core/server/kibana-plugin-core-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [HttpResourcesRenderOptions](./kibana-plugin-core-server.httpresourcesrenderoptions.md) | Allows to configure HTTP response parameters |
| [HttpResourcesServiceToolkit](./kibana-plugin-core-server.httpresourcesservicetoolkit.md) | Extended set of [KibanaResponseFactory](./kibana-plugin-core-server.kibanaresponsefactory.md) helpers used to respond with HTML or JS resource. |
| [HttpResponseOptions](./kibana-plugin-core-server.httpresponseoptions.md) | HTTP response parameters |
| [HttpServerInfo](./kibana-plugin-core-server.httpserverinfo.md) | |
| [HttpServerInfo](./kibana-plugin-core-server.httpserverinfo.md) | Information about what hostname, port, and protocol the server process is running on. Note that this may not match the URL that end-users access Kibana at. For the public URL, see [BasePath.publicBaseUrl](./kibana-plugin-core-server.basepath.publicbaseurl.md)<!-- -->. |
| [HttpServiceSetup](./kibana-plugin-core-server.httpservicesetup.md) | Kibana HTTP Service provides own abstraction for work with HTTP stack. Plugins don't have direct access to <code>hapi</code> server and its primitives anymore. Moreover, plugins shouldn't rely on the fact that HTTP Service uses one or another library under the hood. This gives the platform flexibility to upgrade or changing our internal HTTP stack without breaking plugins. If the HTTP Service lacks functionality you need, we are happy to discuss and support your needs. |
| [HttpServiceStart](./kibana-plugin-core-server.httpservicestart.md) | |
| [I18nServiceSetup](./kibana-plugin-core-server.i18nservicesetup.md) | |
Expand Down
5 changes: 5 additions & 0 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,11 @@ running behind a proxy. Use the <<server-rewriteBasePath, `server.rewriteBasePat
if it should remove the basePath from requests it receives, and to prevent a
deprecation warning at startup. This setting cannot end in a slash (`/`).

|[[server-publicBaseUrl]] `server.publicBaseUrl:`
| The publicly available URL that end-users access Kibana at. Must include the protocol, hostname, port
(if different than the defaults for `http` and `https`, 80 and 443 respectively), and the
<<server-basePath, `server.basePath`>> (if configured). This setting cannot end in a slash (`/`).

| [[server-compression]] `server.compression.enabled:`
| Set to `false` to disable HTTP compression for all responses. *Default: `true`*

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
"**/minimist": "^1.2.5",
"**/node-jose/node-forge": "^0.10.0",
"**/prismjs": "1.22.0",
"**/react-syntax-highlighter": "^15.3.1",
"**/react-syntax-highlighter/**/highlight.js": "^10.4.1",
"**/request": "^2.88.2",
"**/trim": "0.0.3",
"**/typescript": "4.1.2"
Expand Down Expand Up @@ -680,7 +682,7 @@
"has-ansi": "^3.0.0",
"hdr-histogram-js": "^1.2.0",
"he": "^1.2.0",
"highlight.js": "9.15.10",
"highlight.js": "^9.18.5",
"history-extra": "^5.0.1",
"hoist-non-react-statics": "^3.3.2",
"html": "1.0.0",
Expand Down Expand Up @@ -784,7 +786,7 @@
"react-router-redux": "^4.0.8",
"react-shortcuts": "^2.0.0",
"react-sizeme": "^2.3.6",
"react-syntax-highlighter": "^5.7.0",
"react-syntax-highlighter": "^15.3.1",
"react-test-renderer": "^16.12.0",
"react-tiny-virtual-list": "^2.2.0",
"react-virtualized": "^9.21.2",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ describe('#get', () => {
keepaliveTimeout: 5000,
socketTimeout: 2000,
port: 1234,
publicBaseUrl: 'https://myhost.com/abc',
rewriteBasePath: false,
ssl: { enabled: true, keyPassphrase: 'some-phrase', someNewValue: 'new' },
compression: { enabled: true },
Expand All @@ -113,6 +114,7 @@ describe('#get', () => {
keepaliveTimeout: 5000,
socketTimeout: 2000,
port: 1234,
publicBaseUrl: 'http://myhost.com/abc',
rewriteBasePath: false,
ssl: { enabled: false, certificate: 'cert', key: 'key' },
compression: { enabled: true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export class LegacyObjectToConfigAdapter extends ObjectToConfigAdapter {
maxPayload: configValue.maxPayloadBytes,
name: configValue.name,
port: configValue.port,
publicBaseUrl: configValue.publicBaseUrl,
rewriteBasePath: configValue.rewriteBasePath,
ssl: configValue.ssl,
keepaliveTimeout: configValue.keepaliveTimeout,
Expand Down
4 changes: 3 additions & 1 deletion packages/kbn-dev-utils/src/plugin_list/discover_plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ export interface Plugin {
export type Plugins = Plugin[];

const getReadmeName = (directory: string) =>
Fs.readdirSync(directory).find((name) => name.toLowerCase() === 'readme.md');
Fs.readdirSync(directory).find(
(name) => name.toLowerCase() === 'readme.md' || name.toLowerCase() === 'readme.mdx'
);

const getReadmeAsciidocName = (directory: string) =>
Fs.readdirSync(directory).find((name) => name.toLowerCase() === 'readme.asciidoc');
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,4 @@ pageLoadAssetSize:
watcher: 43598
runtimeFields: 41752
stackAlerts: 29684
presentationUtil: 28545

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/core/public/http/base_path.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,13 @@ describe('BasePath', () => {
expect(new BasePath('/foo/bar', '/foo').serverBasePath).toEqual('/foo');
});
});

describe('publicBaseUrl', () => {
it('returns value passed into construtor', () => {
expect(new BasePath('/foo/bar', '/foo').publicBaseUrl).toEqual(undefined);
expect(new BasePath('/foo/bar', '/foo', 'http://myhost.com/foo').publicBaseUrl).toEqual(
'http://myhost.com/foo'
);
});
});
});
3 changes: 2 additions & 1 deletion src/core/public/http/base_path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import { modifyUrl } from '@kbn/std';
export class BasePath {
constructor(
private readonly basePath: string = '',
public readonly serverBasePath: string = basePath
public readonly serverBasePath: string = basePath,
public readonly publicBaseUrl?: string
) {}

public get = () => {
Expand Down
3 changes: 2 additions & 1 deletion src/core/public/http/http_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export class HttpService implements CoreService<HttpSetup, HttpStart> {
const kibanaVersion = injectedMetadata.getKibanaVersion();
const basePath = new BasePath(
injectedMetadata.getBasePath(),
injectedMetadata.getServerBasePath()
injectedMetadata.getServerBasePath(),
injectedMetadata.getPublicBaseUrl()
);
const fetchService = new Fetch({ basePath, kibanaVersion });
const loadingCount = this.loadingCount.setup({ fatalErrors });
Expand Down
9 changes: 9 additions & 0 deletions src/core/public/http/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ export interface IBasePath {
* See {@link BasePath.get} for getting the basePath value for a specific request
*/
readonly serverBasePath: string;

/**
* The server's publicly exposed base URL, if configured. Includes protocol, host, port (optional) and the
* {@link IBasePath.serverBasePath}.
*
* @remarks
* Should be used for generating external URL links back to this Kibana instance.
*/
readonly publicBaseUrl?: string;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const createSetupContractMock = () => {
const setupContract: jest.Mocked<InjectedMetadataSetup> = {
getBasePath: jest.fn(),
getServerBasePath: jest.fn(),
getPublicBaseUrl: jest.fn(),
getKibanaVersion: jest.fn(),
getKibanaBranch: jest.fn(),
getCspConfig: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export interface InjectedMetadataParams {
branch: string;
basePath: string;
serverBasePath: string;
publicBaseUrl: string;
category?: AppCategory;
csp: {
warnLegacyBrowsers: boolean;
Expand Down Expand Up @@ -95,6 +96,10 @@ export class InjectedMetadataService {
return this.state.serverBasePath;
},

getPublicBaseUrl: () => {
return this.state.publicBaseUrl;
},

getAnonymousStatusPage: () => {
return this.state.anonymousStatusPage;
},
Expand Down Expand Up @@ -142,6 +147,7 @@ export class InjectedMetadataService {
export interface InjectedMetadataSetup {
getBasePath: () => string;
getServerBasePath: () => string;
getPublicBaseUrl: () => string;
getKibanaBuildNumber: () => number;
getKibanaBranch: () => string;
getKibanaVersion: () => string;
Expand Down
1 change: 1 addition & 0 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,7 @@ export interface IAnonymousPaths {
export interface IBasePath {
get: () => string;
prepend: (url: string) => string;
readonly publicBaseUrl?: string;
remove: (url: string) => string;
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "BasePath"
readonly serverBasePath: string;
Expand Down
16 changes: 8 additions & 8 deletions src/core/server/http/__snapshots__/http_config.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions src/core/server/http/base_path_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ describe('BasePath', () => {
});
});

describe('publicBaseUrl', () => {
it('defaults to an undefined', () => {
const basePath = new BasePath();
expect(basePath.publicBaseUrl).toBe(undefined);
});

it('returns the publicBaseUrl', () => {
const basePath = new BasePath('/server', 'http://myhost.com/server');
expect(basePath.publicBaseUrl).toBe('http://myhost.com/server');
});
});

describe('#get()', () => {
it('returns base path associated with an incoming Legacy.Request request', () => {
const request = httpServerMock.createRawRequest();
Expand Down
Loading

0 comments on commit 58672b3

Please sign in to comment.