Skip to content

Commit

Permalink
Merge branch 'master' into remove-defaultAppId
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine committed Aug 31, 2021
2 parents ad6d126 + c568a43 commit 32c9bd2
Show file tree
Hide file tree
Showing 337 changed files with 8,144 additions and 3,719 deletions.
1 change: 1 addition & 0 deletions .buildkite/scripts/common/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,4 @@ export TEST_ES_URL="http://elastic:changeme@localhost:6102"
export TEST_ES_TRANSPORT_PORT=6301-6309
export TEST_CORS_SERVER_PORT=6106
export ALERTING_PROXY_PORT=6105
export TEST_PROXY_SERVER_PORT=6107
3 changes: 3 additions & 0 deletions docs/api/spaces-management.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ The following {kib} spaces APIs are available:

* <<spaces-api-resolve-copy-saved-objects-conflicts, Resolve copy saved objects to space conflicts API>> to overwrite saved objects returned as errors from the copy saved objects to space API

* <<spaces-api-disable-legacy-url-aliases, Disable legacy URL aliases API>> to disable legacy URL aliases if an error is encountered

include::spaces-management/post.asciidoc[]
include::spaces-management/put.asciidoc[]
include::spaces-management/get.asciidoc[]
include::spaces-management/get_all.asciidoc[]
include::spaces-management/delete.asciidoc[]
include::spaces-management/copy_saved_objects.asciidoc[]
include::spaces-management/resolve_copy_saved_objects_conflicts.asciidoc[]
include::spaces-management/disable_legacy_url_aliases.asciidoc[]
59 changes: 59 additions & 0 deletions docs/api/spaces-management/disable_legacy_url_aliases.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[[spaces-api-disable-legacy-url-aliases]]
=== Disable legacy URL aliases API
++++
<titleabbrev>Disable legacy URL aliases</titleabbrev>
++++

experimental[] Disable a <<legacy-url-aliases,legacy URL alias>> in {kib}.

[[spaces-api-disable-legacy-url-aliases-request]]
==== {api-request-title}

`POST <kibana host>:<port>/api/spaces/_disable_legacy_url_aliases`

[role="child_attributes"]
[[spaces-api-disable-legacy-url-aliases-request-body]]
==== {api-request-body-title}

`aliases`::
(Required, object array) The aliases to disable.
+
.Properties of `aliases`
[%collapsible%open]
=====
`targetSpace`:::
(Required, string) The space where the alias target object exists.
`targetType`:::
(Required, string) The type of the alias target object.
`sourceId`:::
(Required, string) The ID of the alias source object. This is the "legacy" object ID.
=====

[[spaces-api-disable-legacy-url-aliases-response-codes]]
==== {api-response-codes-title}

`204`::
Indicates a successful call.

[[spaces-api-disable-legacy-url-aliases-example]]
==== {api-examples-title}

[source,sh]
--------------------------------------------------
$ curl -X POST api/spaces/_disable_legacy_url_aliases
{
"aliases": [
{
"targetSpace": "bills-space",
"targetType": "dashboard",
"sourceId": "123"
}
]
}
--------------------------------------------------
// KIBANA

This example leaves the alias intact, but the legacy URL for this alias, http://localhost:5601/s/bills-space/app/dashboards#/view/123, will
no longer function. The dashboard still exists, and you can access it with the new URL.
5 changes: 4 additions & 1 deletion docs/developer/advanced/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* <<development-basepath>>
* <<upgrading-nodejs>>
* <<sharing-saved-objects>>
* <<legacy-url-aliases>>

include::development-es-snapshots.asciidoc[leveloffset=+1]

Expand All @@ -15,4 +16,6 @@ include::development-basepath.asciidoc[leveloffset=+1]

include::upgrading-nodejs.asciidoc[leveloffset=+1]

include::sharing-saved-objects.asciidoc[leveloffset=+1]
include::sharing-saved-objects.asciidoc[leveloffset=+1]

include::legacy-url-aliases.asciidoc[leveloffset=+1]
45 changes: 45 additions & 0 deletions docs/developer/advanced/legacy-url-aliases.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[[legacy-url-aliases]]
== Legacy URL Aliases

This page describes legacy URL aliases: what they are, where they come from, and how to disable them.

[[legacy-url-aliases-overview]]
=== Overview

Many saved object types were converted in {kib} 8.0, so they can eventually be shared across <<xpack-spaces,spaces>>. Before 8.0, you could
have two objects with the same type and same ID in two different spaces. Part of this conversion is to make sure all object IDs of a given
type are *globally unique across all spaces*.

{kib} creates a special entity called a **legacy URL alias** for each saved object that requires a new ID. This legacy URL alias allows
{kib} to preserve any deep link URLs that exist for these objects.

[[legacy-url-aliases-example]]
=== Example

Consider the following scenario:

You have {kib} 7.16, and you create a new dashboard.The ID of this dashboard is "123". You create a new space called "Bill's space" and
<<managing-saved-objects-copy-to-space,copy>> your dashboard to the other space. Now you have two different dashboards that can be accessed
at the following URLs:

* *Default space*: `http://localhost:5601/app/dashboards#/view/123`
* *Bill's space*: `http://localhost:5601/s/bills-space/app/dashboards#/view/123`

You use these two dashboards frequently, so you bookmark them in your web browser. After some time, you decide to upgrade to {kib} 8.0. When
these two dashboards go through the conversion process, the one in "Bill's space" will have its ID changed to "456". The URL to access that
dashboard is different -- not to worry though, there is a legacy URL alias for that dashboard.

If you use your bookmark to access that dashboard using its old URL, {kib} detects that you are using a legacy URL, and finds the new object
ID. If you navigate to `http://localhost:5601/s/bills-space/app/dashboards#/view/123`, you'll see a message indicating that the dashboard
has a new URL, and you're automatically redirected to `http://localhost:5601/s/bills-space/app/dashboards#/view/456`.

[[legacy-url-aliases-handling-errors]]
=== Handling errors

Legacy URL aliases are intended to be fully transparent, but there are rare situations where this can lead to an error. For example, you
might have a dashboard and one of the visualizations fails to load, directing you to this page. If you encounter an error in this situation,
you might want to disable the legacy URL alias completely. This leaves the saved object intact, and you will not lose any data -- you just
won't be able to use the old URL to access that saved object.

To disable a legacy URL alias, you need three pieces of information: the `targetSpace`, the `targetType`, and the `sourceId`. Then use the
<<spaces-api-disable-legacy-url-aliases,`_disable_legacy_url_aliases`>> API to disable the problematic legacy URL alias.
84 changes: 1 addition & 83 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ The size limit policy will perform a rollover when the log file reaches a maximu

The time interval policy will rotate the log file every given interval of time. *Default 24h*

| [[regionmap-ES-map]] `map.includeElasticMapsService:` {ess-icon}
| `map.includeElasticMapsService:` {ess-icon}
| Set to `false` to disable connections to Elastic Maps Service.
When `includeElasticMapsService` is turned off, only tile layer configured by <<tilemap-url, `map.tilemap.url`>> is available in <<maps, Maps>>. *Default: `true`*

Expand All @@ -383,88 +383,6 @@ When `includeElasticMapsService` is turned off, only tile layer configured by <<
Set to `true` to proxy all <<maps, Maps application>> Elastic Maps Service
requests through the {kib} server. *Default: `false`*

| [[regionmap-settings]] `map.regionmap:` {ess-icon}
| deprecated:[7.14.0,"In 8.0 and later, this setting will no longer be supported."]
Specifies additional vector layers for
use in <<maps, Maps>> visualizations. Each layer
object points to an external vector file that contains a geojson
FeatureCollection. The file must use the
https://en.wikipedia.org/wiki/World_Geodetic_System[WGS84 coordinate reference system (ESPG:4326)]
and only include polygons. If the file is hosted on a separate domain from
{kib}, the server needs to be CORS-enabled so {kib} can download the file.
The following example shows a valid region map configuration.

|===

[source,text]
--
map.regionmap:
layers:
- name: "Departments of France"
url: "http://my.cors.enabled.server.org/france_departements.geojson"
attribution: "INRAP"
fields:
- name: "department"
description: "Full department name"
- name: "INSEE"
description: "INSEE numeric identifier"
--

[cols="2*<"]
|===

| [[regionmap-attribution]] `map.regionmap.layers[].attribution:` {ess-icon}
| deprecated:[7.14.0,"In 8.0 and later, this setting will no longer be supported."]
Optional. References the originating source of the geojson file.

| [[regionmap-fields]] `map.regionmap.layers[].fields[]:` {ess-icon}
| deprecated:[7.14.0,"In 8.0 and later, this setting will no longer be supported."]
Mandatory. Each layer
can contain multiple fields to indicate what properties from the geojson
features you wish to expose. The following shows how to define multiple
properties:

|===

[source,text]
--
map.regionmap:
layers:
- name: "Departments of France"
url: "http://my.cors.enabled.server.org/france_departements.geojson"
attribution: "INRAP"
fields:
- name: "department"
description: "Full department name"
- name: "INSEE"
description: "INSEE numeric identifier"
--

[cols="2*<"]
|===

| [[regionmap-field-description]] `map.regionmap.layers[].fields[].description:` {ess-icon}
| deprecated:[7.14.0,"In 8.0 and later, this setting will no longer be supported."]
Mandatory. The human readable text that is shown under the Options tab when
building the Region Map visualization.

| [[regionmap-field-name]] `map.regionmap.layers[].fields[].name:` {ess-icon}
| deprecated:[7.14.0,"In 8.0 and later, this setting will no longer be supported."]
Mandatory.
This value is used to do an inner-join between the document stored in
{es} and the geojson file. For example, if the field in the geojson is
called `Location` and has city names, there must be a field in {es}
that holds the same values that {kib} can then use to lookup for the geoshape
data.

| [[regionmap-name]] `map.regionmap.layers[].name:` {ess-icon}
| deprecated:[7.14.0,"In 8.0 and later, this setting will no longer be supported."]
Mandatory. A description of the map being provided.

| [[regionmap-url]] `map.regionmap.layers[].url:` {ess-icon}
| deprecated:[7.14.0,"In 8.0 and later, this setting will no longer be supported."]
Mandatory. The location of the geojson file as provided by a webserver.

| [[tilemap-settings]] `map.tilemap.options.attribution:` {ess-icon}
| The map attribution string.
*Default: `"© [Elastic Maps Service](https://www.elastic.co/elastic-maps-service)"`*
Expand Down
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"@elastic/apm-rum-react": "^1.3.1",
"@elastic/charts": "34.2.1",
"@elastic/datemath": "link:bazel-bin/packages/elastic-datemath",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@^8.0.0-canary.18",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@^8.0.0-canary.19",
"@elastic/ems-client": "7.15.0",
"@elastic/eui": "37.3.0",
"@elastic/filesaver": "1.1.2",
Expand Down Expand Up @@ -287,7 +287,7 @@
"lodash": "^4.17.21",
"lru-cache": "^4.1.5",
"lz-string": "^1.4.4",
"mapbox-gl": "1.13.1",
"maplibre-gl": "1.15.2",
"mapbox-gl-draw-rectangle-mode": "1.0.4",
"markdown-it": "^10.0.0",
"md5": "^2.1.0",
Expand Down Expand Up @@ -332,7 +332,7 @@
"raw-loader": "^3.1.0",
"rbush": "^3.0.1",
"re-resizable": "^6.1.1",
"re2": "^1.15.4",
"re2": "^1.16.0",
"react": "^16.12.0",
"react-ace": "^7.0.5",
"react-beautiful-dnd": "^13.0.0",
Expand Down Expand Up @@ -400,7 +400,6 @@
"tar": "4.4.13",
"tinycolor2": "1.4.1",
"tinygradient": "0.4.3",
"topojson-client": "3.1.0",
"tree-kill": "^1.2.2",
"ts-easing": "^0.2.0",
"tslib": "^2.0.0",
Expand Down Expand Up @@ -430,6 +429,7 @@
"devDependencies": {
"@babel/cli": "^7.12.10",
"@babel/core": "^7.12.10",
"@babel/generator": "^7.12.11",
"@babel/parser": "^7.12.11",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-export-namespace-from": "^7.12.1",
Expand Down Expand Up @@ -572,7 +572,6 @@
"@types/lodash": "^4.14.159",
"@types/lru-cache": "^5.1.0",
"@types/lz-string": "^1.3.34",
"@types/mapbox-gl": "1.13.1",
"@types/markdown-it": "^0.0.7",
"@types/md5": "^2.2.0",
"@types/memoize-one": "^4.1.0",
Expand Down Expand Up @@ -790,7 +789,7 @@
"multimatch": "^4.0.0",
"mutation-observer": "^1.0.3",
"ncp": "^2.0.0",
"node-sass": "^4.14.1",
"node-sass": "^6.0.1",
"null-loader": "^3.0.0",
"nyc": "^15.0.1",
"oboe": "^2.1.4",
Expand All @@ -810,7 +809,7 @@
"regenerate": "^1.4.0",
"resolve": "^1.7.1",
"rxjs-marbles": "^5.0.6",
"sass-loader": "^8.0.2",
"sass-loader": "^10.2.0",
"sass-resources-loader": "^2.0.1",
"selenium-webdriver": "^4.0.0-alpha.7",
"serve-static": "1.14.1",
Expand Down
2 changes: 2 additions & 0 deletions packages/kbn-dev-utils/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ RUNTIME_DEPS = [
"@npm//load-json-file",
"@npm//markdown-it",
"@npm//normalize-path",
"@npm//prettier",
"@npm//rxjs",
"@npm//tar",
"@npm//tree-kill",
Expand All @@ -81,6 +82,7 @@ TYPES_DEPS = [
"@npm//@types/markdown-it",
"@npm//@types/node",
"@npm//@types/normalize-path",
"@npm//@types/prettier",
"@npm//@types/react",
"@npm//@types/tar",
"@npm//@types/testing-library__jest-dom",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-dev-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ export * from './plugins';
export * from './streams';
export * from './babel';
export * from './extract';
export * from './vscode_config';
9 changes: 9 additions & 0 deletions packages/kbn-dev-utils/src/vscode_config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export * from './update_vscode_config_cli';
40 changes: 40 additions & 0 deletions packages/kbn-dev-utils/src/vscode_config/managed_config_keys.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export interface ManagedConfigKey {
key: string;
value: Record<string, any>;
}

/**
* Defines the keys which we overrite in user's vscode config for the workspace. We currently
* only support object values because that's all we needed to support, but support for non object
* values should be easy to add.
*/
export const MANAGED_CONFIG_KEYS: ManagedConfigKey[] = [
{
key: 'files.watcherExclude',
value: {
['**/.eslintcache']: true,
['**/.es']: true,
['**/.yarn-local-mirror']: true,
['**/.chromium']: true,
['**/packages/kbn-pm/dist/index.js']: true,
['**/bazel-*']: true,
['**/node_modules']: true,
['**/target']: true,
['**/*.log']: true,
},
},
{
key: 'search.exclude',
value: {
['**/packages/kbn-pm/dist/index.js']: true,
},
},
];
Loading

0 comments on commit 32c9bd2

Please sign in to comment.