Skip to content

Commit 33ddad5

Browse files
authored
Merge branch 'master' into usage_collection/schema/apm
2 parents e4fb0be + c1a3002 commit 33ddad5

151 files changed

Lines changed: 2883 additions & 1467 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/developer/contributing/development-github.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Pull requests are made into the `master` branch and then backported when it is s
2525
* Breaking changes do not get backported and only go into `master`.
2626
* All non-breaking changes can be backported to the `<major>.x` branch.
2727
* Features should not be backported to a `<major>.<minor>` branch.
28-
* Bugs can be backported to a `<major>.<minor>` branch if the changes are safe and appropriate. Safety is a judgment call you make based on factors like the bug's severity, test coverage, confidence in the changes, etc. Your reasoning should be included in the pull request description.
28+
* Bug fixes can be backported to a `<major>.<minor>` branch if the changes are safe and appropriate. Safety is a judgment call you make based on factors like the bug's severity, test coverage, confidence in the changes, etc. Your reasoning should be included in the pull request description.
2929
* Documentation changes can be backported to any branch at any time.
3030

3131
[discrete]

docs/development/core/public/kibana-plugin-core-public.applicationstart.geturlforapp.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
## ApplicationStart.getUrlForApp() method
66

7-
Returns an URL to a given app, including the global base path. By default, the URL is relative (/basePath/app/my-app). Use the `absolute` option to generate an absolute url (http://host:port/basePath/app/my-app)
7+
Returns the absolute path (or URL) to a given app, including the global base path.
88

9-
Note that when generating absolute urls, the origin (protocol, host and port) are determined from the browser's location.
9+
By default, it returns the absolute path of the application (e.g `/basePath/app/my-app`<!-- -->). Use the `absolute` option to generate an absolute url instead (e.g `http://host:port/basePath/app/my-app`<!-- -->)
10+
11+
Note that when generating absolute urls, the origin (protocol, host and port) are determined from the browser's current location.
1012

1113
<b>Signature:</b>
1214

docs/development/core/public/kibana-plugin-core-public.applicationstart.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export interface ApplicationStart
2323

2424
| Method | Description |
2525
| --- | --- |
26-
| [getUrlForApp(appId, options)](./kibana-plugin-core-public.applicationstart.geturlforapp.md) | Returns an URL to a given app, including the global base path. By default, the URL is relative (/basePath/app/my-app). Use the <code>absolute</code> option to generate an absolute url (http://host:port/basePath/app/my-app)<!-- -->Note that when generating absolute urls, the origin (protocol, host and port) are determined from the browser's location. |
26+
| [getUrlForApp(appId, options)](./kibana-plugin-core-public.applicationstart.geturlforapp.md) | Returns the absolute path (or URL) to a given app, including the global base path.<!-- -->By default, it returns the absolute path of the application (e.g <code>/basePath/app/my-app</code>). Use the <code>absolute</code> option to generate an absolute url instead (e.g <code>http://host:port/basePath/app/my-app</code>)<!-- -->Note that when generating absolute urls, the origin (protocol, host and port) are determined from the browser's current location. |
2727
| [navigateToApp(appId, options)](./kibana-plugin-core-public.applicationstart.navigatetoapp.md) | Navigate to a given app |
28-
| [navigateToUrl(url)](./kibana-plugin-core-public.applicationstart.navigatetourl.md) | Navigate to given url, which can either be an absolute url or a relative path, in a SPA friendly way when possible.<!-- -->If all these criteria are true for the given url: - (only for absolute URLs) The origin of the URL matches the origin of the browser's current location - The pathname of the URL starts with the current basePath (eg. /mybasepath/s/my-space) - The pathname segment after the basePath matches any known application route (eg. /app/<id>/ or any application's <code>appRoute</code> configuration)<!-- -->Then a SPA navigation will be performed using <code>navigateToApp</code> using the corresponding application and path. Otherwise, fallback to a full page reload to navigate to the url using <code>window.location.assign</code> |
28+
| [navigateToUrl(url)](./kibana-plugin-core-public.applicationstart.navigatetourl.md) | Navigate to given URL in a SPA friendly way when possible (when the URL will redirect to a valid application within the current basePath).<!-- -->The method resolves pathnames the same way browsers do when resolving a <code>&lt;a href&gt;</code> value. The provided <code>url</code> can be: - an absolute URL - an absolute path - a path relative to the current URL (window.location.href)<!-- -->If all these criteria are true for the given URL: - (only for absolute URLs) The origin of the URL matches the origin of the browser's current location - The resolved pathname of the provided URL/path starts with the current basePath (eg. /mybasepath/s/my-space) - The pathname segment after the basePath matches any known application route (eg. /app/<id>/ or any application's <code>appRoute</code> configuration)<!-- -->Then a SPA navigation will be performed using <code>navigateToApp</code> using the corresponding application and path. Otherwise, fallback to a full page reload to navigate to the url using <code>window.location.assign</code> |
2929
| [registerMountContext(contextName, provider)](./kibana-plugin-core-public.applicationstart.registermountcontext.md) | Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. Deprecated, use [CoreSetup.getStartServices](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->. |
3030

docs/development/core/public/kibana-plugin-core-public.applicationstart.navigatetourl.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
## ApplicationStart.navigateToUrl() method
66

7-
Navigate to given url, which can either be an absolute url or a relative path, in a SPA friendly way when possible.
7+
Navigate to given URL in a SPA friendly way when possible (when the URL will redirect to a valid application within the current basePath).
88

9-
If all these criteria are true for the given url: - (only for absolute URLs) The origin of the URL matches the origin of the browser's current location - The pathname of the URL starts with the current basePath (eg. /mybasepath/s/my-space) - The pathname segment after the basePath matches any known application route (eg. /app/<id>/ or any application's `appRoute` configuration)
9+
The method resolves pathnames the same way browsers do when resolving a `<a href>` value. The provided `url` can be: - an absolute URL - an absolute path - a path relative to the current URL (window.location.href)
10+
11+
If all these criteria are true for the given URL: - (only for absolute URLs) The origin of the URL matches the origin of the browser's current location - The resolved pathname of the provided URL/path starts with the current basePath (eg. /mybasepath/s/my-space) - The pathname segment after the basePath matches any known application route (eg. /app/<id>/ or any application's `appRoute` configuration)
1012

1113
Then a SPA navigation will be performed using `navigateToApp` using the corresponding application and path. Otherwise, fallback to a full page reload to navigate to the url using `window.location.assign`
1214

@@ -20,7 +22,7 @@ navigateToUrl(url: string): Promise<void>;
2022

2123
| Parameter | Type | Description |
2224
| --- | --- | --- |
23-
| url | <code>string</code> | an absolute url, or a relative path, to navigate to. |
25+
| url | <code>string</code> | an absolute URL, an absolute path or a relative path, to navigate to. |
2426

2527
<b>Returns:</b>
2628

@@ -35,11 +37,14 @@ navigateToUrl(url: string): Promise<void>;
3537
// will call `application.navigateToApp('discover', { path: '/some-path?foo=bar'})`
3638
application.navigateToUrl('https://kibana:8080/base-path/s/my-space/app/discover/some-path?foo=bar')
3739
application.navigateToUrl('/base-path/s/my-space/app/discover/some-path?foo=bar')
40+
application.navigateToUrl('./discover/some-path?foo=bar')
3841

3942
// will perform a full page reload using `window.location.assign`
4043
application.navigateToUrl('https://elsewhere:8080/base-path/s/my-space/app/discover/some-path') // origin does not match
4144
application.navigateToUrl('/app/discover/some-path') // does not include the current basePath
4245
application.navigateToUrl('/base-path/s/my-space/app/unknown-app/some-path') // unknown application
46+
application.navigateToUrl('../discover') // resolve to `/base-path/s/my-space/discover` which is not a path of a known app.
47+
application.navigateToUrl('../../other-space/discover') // resolve to `/base-path/s/other-space/discover` which is not within the current basePath.
4348

4449
```
4550

docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionrenderdefinition.displayname.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ A user friendly name of the renderer as will be displayed to user in UI.
99
<b>Signature:</b>
1010

1111
```typescript
12-
displayName: string;
12+
displayName?: string;
1313
```

docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionrenderdefinition.displayname.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ A user friendly name of the renderer as will be displayed to user in UI.
99
<b>Signature:</b>
1010

1111
```typescript
12-
displayName: string;
12+
displayName?: string;
1313
```

docs/user/dashboard/vega-reference.asciidoc

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ For additional *Vega* and *Vega-Lite* information, refer to the reference sectio
1111

1212
{kib} has extended Vega and Vega-Lite with extensions that support:
1313

14-
* Default height and width
14+
* Automatic sizing
1515
* Default theme to match {kib}
1616
* Writing {es} queries using the time range and filters from dashboards
1717
* Using the Elastic Map Service in Vega maps
@@ -22,12 +22,35 @@ For additional *Vega* and *Vega-Lite* information, refer to the reference sectio
2222

2323
[float]
2424
[[vega-sizing-and-positioning]]
25-
==== Default height and width
25+
==== Automatic sizing
2626

27-
By default, Vega visualizations use the `autosize = { type: 'fit', contains: 'padding' }` layout.
28-
`fit` uses all available space, ignores `width` and `height` values,
29-
and respects the padding values. To override this behavior, change the
30-
`autosize` value.
27+
Most users will want their Vega visualizations to take the full available space, so unlike
28+
Vega examples, `width` and `height` are not required parameters in {kib}. To set the width
29+
or height manually, set `autosize: none`. For example, to set the height to a specific pixel value:
30+
31+
```
32+
autosize: none
33+
width: container
34+
height: 200
35+
```
36+
37+
The default {kib} settings which are inherited by your visualizations are:
38+
39+
```
40+
autosize: {
41+
type: fit
42+
contains: padding
43+
}
44+
width: container
45+
height: container
46+
```
47+
48+
{kib} is able to merge your custom `autosize` settings with the defaults. The options `fit-x`
49+
and `fit-y` are supported but not recommended over the default `fit` setting.
50+
51+
To learn more, read about
52+
https://vega.github.io/vega/docs/specification/#autosize[autosize]
53+
in the Vega documentation.
3154

3255
[float]
3356
[[vega-theme]]

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229
"devDependencies": {
230230
"@babel/parser": "^7.11.2",
231231
"@babel/types": "^7.11.0",
232-
"@elastic/apm-rum": "^5.6.0",
232+
"@elastic/apm-rum": "^5.6.1",
233233
"@elastic/charts": "21.1.2",
234234
"@elastic/ems-client": "7.10.0",
235235
"@elastic/eslint-config-kibana": "0.15.0",
@@ -478,7 +478,7 @@
478478
"tree-kill": "^1.2.2",
479479
"typescript": "4.0.2",
480480
"ui-select": "0.19.8",
481-
"vega": "^5.16.1",
481+
"vega": "^5.17.0",
482482
"vega-lite": "^4.16.8",
483483
"vega-schema-url-parser": "^2.1.0",
484484
"vega-tooltip": "^0.24.2",

packages/kbn-std/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ export { mapToObject } from './map_to_object';
2424
export { merge } from './merge';
2525
export { pick } from './pick';
2626
export { withTimeout } from './promise';
27-
export { isRelativeUrl, modifyUrl, URLMeaningfulParts } from './url';
27+
export { isRelativeUrl, modifyUrl, getUrlOrigin, URLMeaningfulParts } from './url';
2828
export { unset } from './unset';
2929
export { getFlattenedObject } from './get_flattened_object';

packages/kbn-std/src/url.test.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* under the License.
1818
*/
1919

20-
import { modifyUrl, isRelativeUrl } from './url';
20+
import { modifyUrl, isRelativeUrl, getUrlOrigin } from './url';
2121

2222
describe('modifyUrl()', () => {
2323
test('throws an error with invalid input', () => {
@@ -83,3 +83,27 @@ describe('isRelativeUrl()', () => {
8383
expect(isRelativeUrl(' //evil.com')).toBe(false);
8484
});
8585
});
86+
87+
describe('getOrigin', () => {
88+
describe('when passing an absolute url', () => {
89+
it('return origin without port when the url does not have a port', () => {
90+
expect(getUrlOrigin('https://example.com/file/to/path?example')).toEqual(
91+
'https://example.com'
92+
);
93+
});
94+
it('return origin with port when the url does have a port', () => {
95+
expect(getUrlOrigin('http://example.com:80/path/to/file')).toEqual('http://example.com:80');
96+
});
97+
});
98+
describe('when passing a non absolute url', () => {
99+
it('returns null for relative url', () => {
100+
expect(getUrlOrigin('./path/to/file')).toBeNull();
101+
});
102+
it('returns null for absolute path', () => {
103+
expect(getUrlOrigin('/path/to/file')).toBeNull();
104+
});
105+
it('returns null for empty url', () => {
106+
expect(getUrlOrigin('')).toBeNull();
107+
});
108+
});
109+
});

0 commit comments

Comments
 (0)