Skip to content

Commit

Permalink
Merge branch 'master' into reporting/unskip-screenshot-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Sep 23, 2020
2 parents f4226ee + 298d5c1 commit 13c6b80
Show file tree
Hide file tree
Showing 38 changed files with 1,812 additions and 1,352 deletions.
63 changes: 29 additions & 34 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ overwritten by client-side headers, regardless of the
|[[elasticsearch-hosts]] `elasticsearch.hosts:`
| The URLs of the {es} instances to use for all your queries. All nodes
listed here must be on the same cluster. *Default: `[ "http://localhost:9200" ]`*
+

To enable SSL/TLS for outbound connections to {es}, use the `https` protocol
in this setting.

Expand Down Expand Up @@ -129,7 +129,7 @@ be set to `"required"` or `"optional"` to request a client certificate from

[NOTE]
============
These settings cannot be used in conjunction with
These settings cannot be used in conjunction with
<<elasticsearch-ssl-keystore-path, `elasticsearch.ssl.keystore.path`>>.
============

Expand All @@ -141,9 +141,9 @@ These settings cannot be used in conjunction with
certificates, which make up a trusted certificate chain for {es}. This chain is
used by {kib} to establish trust when making outbound SSL/TLS connections to
{es}.
+

In addition to this setting, trusted certificates may be specified via
<<elasticsearch-ssl-keystore-path, `elasticsearch.ssl.keystore.path`>> and/or
<<elasticsearch-ssl-keystore-path, `elasticsearch.ssl.keystore.path`>> and/or
<<elasticsearch-ssl-truststore-path, `elasticsearch.ssl.truststore.path`>>.

| `elasticsearch.ssl.keyPassphrase:`
Expand All @@ -157,7 +157,7 @@ corresponding private key. These are used by {kib} to authenticate itself when
making outbound SSL/TLS connections to {es}. For this setting, you must also set
the `xpack.security.http.ssl.client_authentication` setting in {es} to
`"required"` or `"optional"` to request a client certificate from {kib}.
+

If the keystore contains any additional certificates, they are used as a
trusted certificate chain for {es}. This chain is used by {kib} to establish
trust when making outbound SSL/TLS connections to {es}. In addition to this
Expand All @@ -178,7 +178,7 @@ This setting cannot be used in conjunction with

| `elasticsearch.ssl.keystore.password:`
| The password that decrypts the keystore specified via
<<elasticsearch-ssl-keystore-path, `elasticsearch.ssl.keystore.path`>>. If the keystore has no password, leave this
<<elasticsearch-ssl-keystore-path, `elasticsearch.ssl.keystore.path`>>. If the keystore has no password, leave this
as blank. If the keystore has an empty password, set this to
`""`.

Expand All @@ -187,14 +187,14 @@ as blank. If the keystore has an empty password, set this to
authority (CA) certificates, which make up a trusted certificate chain for
{es}. This chain is used by {kib} to establish trust when making outbound
SSL/TLS connections to {es}.
+

In addition to this setting, trusted certificates may be specified via
<<elasticsearch-ssl-certificateAuthorities, `elasticsearch.ssl.certificateAuthorities`>> and/or
<<elasticsearch-ssl-keystore-path, `elasticsearch.ssl.keystore.path`>>.

|`elasticsearch.ssl.truststore.password:`
| The password that decrypts the trust store specified via
<<elasticsearch-ssl-truststore-path, `elasticsearch.ssl.truststore.path`>>. If the trust store
<<elasticsearch-ssl-truststore-path, `elasticsearch.ssl.truststore.path`>>. If the trust store
has no password, leave this as blank. If the trust store has an empty password, set this to `""`.

| `elasticsearch.ssl.verificationMode:`
Expand Down Expand Up @@ -300,15 +300,16 @@ the `polling` method could be used enabling that option. *Default: `false`*
suppress all logging output. *Default: `false`*

| `logging.timezone`
| Set to the canonical timezone ID
(for example, `America/Los_Angeles`) to log events using that timezone. For a
list of timezones, refer to https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. *Default: `UTC`*
| Set to the canonical time zone ID
(for example, `America/Los_Angeles`) to log events using that time zone.
For possible values, refer to
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones[database time zones]. *Default: `UTC`*

| [[logging-verbose]] `logging.verbose:` {ece-icon}
| [[logging-verbose]] `logging.verbose:` {ess-icon}
| Set to `true` to log all events, including system usage information and all
requests. *Default: `false`*

| `map.includeElasticMapsService:` {ess-icon}
| [[regionmap-ES-map]] `map.includeElasticMapsService:` {ess-icon}
| Set to `false` to disable connections to Elastic Maps Service.
When `includeElasticMapsService` is turned off, only the vector layers configured by <<regionmap-settings, `map.regionmap`>>
and the tile layer configured by <<tilemap-url, `map.tilemap.url`>> are available in <<maps, Maps>>. *Default: `true`*
Expand All @@ -317,7 +318,7 @@ and the tile layer configured by <<tilemap-url, `map.tilemap.url`>> are availabl
| 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} {ece-icon}
| [[regionmap-settings]] `map.regionmap:` {ess-icon}
| Specifies additional vector layers for
use in <<maps, Maps>> visualizations. Each layer
object points to an external vector file that contains a geojson
Expand Down Expand Up @@ -347,16 +348,10 @@ map.regionmap:
[cols="2*<"]
|===

| [[regionmap-ES-map]] `map.includeElasticMapsService:` {ece-icon}
| Turns on or off whether layers from the Elastic Maps Service should be included in the vector
layer option list. By turning this off,
only the layers that are configured here will be included. The default is `true`.
This also affects whether tile-service from the Elastic Maps Service will be available.

| [[regionmap-attribution]] `map.regionmap.layers[].attribution:` {ess-icon} {ece-icon}
| [[regionmap-attribution]] `map.regionmap.layers[].attribution:` {ess-icon}
| Optional. References the originating source of the geojson file.

| [[regionmap-fields]] `map.regionmap.layers[].fields[]:` {ess-icon} {ece-icon}
| [[regionmap-fields]] `map.regionmap.layers[].fields[]:` {ess-icon}
| 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
Expand All @@ -382,42 +377,42 @@ map.regionmap:
[cols="2*<"]
|===

| [[regionmap-field-description]] `map.regionmap.layers[].fields[].description:` {ess-icon} {ece-icon}
| [[regionmap-field-description]] `map.regionmap.layers[].fields[].description:` {ess-icon}
| 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} {ece-icon}
| [[regionmap-field-name]] `map.regionmap.layers[].fields[].name:` {ess-icon}
| 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} {ece-icon}
| [[regionmap-name]] `map.regionmap.layers[].name:` {ess-icon}
| Mandatory. A description of
the map being provided.

| [[regionmap-url]] `map.regionmap.layers[].url:` {ess-icon} {ece-icon}
| [[regionmap-url]] `map.regionmap.layers[].url:` {ess-icon}
| Mandatory. The location of the
geojson file as provided by a webserver.

| [[tilemap-settings]] `map.tilemap.options.attribution:` {ess-icon} {ece-icon}
| [[tilemap-settings]] `map.tilemap.options.attribution:` {ess-icon}
| The map attribution string.
*Default: `"© [Elastic Maps Service](https://www.elastic.co/elastic-maps-service)"`*

| [[tilemap-max-zoom]] `map.tilemap.options.maxZoom:` {ess-icon} {ece-icon}
| [[tilemap-max-zoom]] `map.tilemap.options.maxZoom:` {ess-icon}
| The maximum zoom level. *Default: `10`*

| [[tilemap-min-zoom]] `map.tilemap.options.minZoom:` {ess-icon} {ece-icon}
| [[tilemap-min-zoom]] `map.tilemap.options.minZoom:` {ess-icon}
| The minimum zoom level. *Default: `1`*

| [[tilemap-subdomains]] `map.tilemap.options.subdomains:` {ess-icon} {ece-icon}
| [[tilemap-subdomains]] `map.tilemap.options.subdomains:` {ess-icon}
| An array of subdomains
used by the tile service. Specify the position of the subdomain the URL with
the token `{s}`.

| [[tilemap-url]] `map.tilemap.url:` {ess-icon} {ece-icon}
| [[tilemap-url]] `map.tilemap.url:` {ess-icon}
| The URL to the tileservice that {kib} uses
to display map tiles in tilemap visualizations. By default,
{kib} reads this URL from an external metadata service, but users can
Expand Down Expand Up @@ -521,7 +516,7 @@ These settings cannot be used in conjunction with <<server-ssl-keystore-path, `s
| Paths to one or more PEM-encoded X.509 certificate authority (CA) certificates which make up a
trusted certificate chain for {kib}. This chain is used by {kib} to establish trust when receiving inbound SSL/TLS connections from end
users. If PKI authentication is enabled, this chain is also used by {kib} to verify client certificates from end users.
+

In addition to this setting, trusted certificates may be specified via <<server-ssl-keystore-path, `server.ssl.keystore.path`>> and/or <<server-ssl-truststore-path, `server.ssl.truststore.path`>>.

| `server.ssl.cipherSuites:`
Expand Down Expand Up @@ -549,7 +544,7 @@ is optional, as the key may not be encrypted.
keystore contains any additional certificates, those will be used as a trusted certificate chain for {kib}. All of these are used by {kib}
to establish trust when receiving inbound SSL/TLS connections from end users. The certificate chain is also used by {kib} to verify client
certificates from end users when PKI authentication is enabled.
+

In addition to this setting, trusted certificates may be specified via <<server-ssl-certificateAuthorities, `server.ssl.certificateAuthorities`>> and/or
<<server-ssl-truststore-path, `server.ssl.truststore.path`>>.

Expand All @@ -571,7 +566,7 @@ keystore has no password, leave this unset. If the keystore has an empty passwor
| Path to a PKCS#12 trust store that contains one or more X.509 certificate authority (CA) certificates which
make up a trusted certificate chain for {kib}. This chain is used by {kib} to establish trust when receiving inbound SSL/TLS connections
from end users. If PKI authentication is enabled, this chain is also used by {kib} to verify client certificates from end users.
+

In addition to this setting, trusted certificates may be specified via <<server-ssl-certificateAuthorities, `server.ssl.certificateAuthorities`>> and/or
<<server-ssl-keystore-path, `server.ssl.keystore.path`>>.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export class LibraryNotificationAction implements ActionByType<typeof ACTION_LIB

public isCompatible = async ({ embeddable }: LibraryNotificationActionContext) => {
return (
embeddable.getRoot().isContainer &&
embeddable.getInput()?.viewMode !== ViewMode.VIEW &&
isReferenceOrValueEmbeddable(embeddable) &&
embeddable.inputIsRefType(embeddable.getInput())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ import {
ViewMode,
ContainerOutput,
EmbeddableInput,
SavedObjectEmbeddableInput,
} from '../../../embeddable/public';
import { NavAction, SavedDashboardPanel } from '../types';

Expand Down Expand Up @@ -178,7 +177,7 @@ export class DashboardAppController {
chrome.docTitle.change(dash.title);
}

const incomingEmbeddable = embeddable
let incomingEmbeddable = embeddable
.getStateTransfer(scopedHistory())
.getIncomingEmbeddablePackage();

Expand Down Expand Up @@ -344,6 +343,22 @@ export class DashboardAppController {
dashboardStateManager.getPanels().forEach((panel: SavedDashboardPanel) => {
embeddablesMap[panel.panelIndex] = convertSavedDashboardPanelToPanelState(panel);
});

// If the incoming embeddable state's id already exists in the embeddables map, replace the input, retaining the existing gridData for that panel.
if (incomingEmbeddable?.embeddableId && embeddablesMap[incomingEmbeddable.embeddableId]) {
const originalPanelState = embeddablesMap[incomingEmbeddable.embeddableId];
embeddablesMap[incomingEmbeddable.embeddableId] = {
gridData: originalPanelState.gridData,
type: incomingEmbeddable.type,
explicitInput: {
...originalPanelState.explicitInput,
...incomingEmbeddable.input,
id: incomingEmbeddable.embeddableId,
},
};
incomingEmbeddable = undefined;
}

let expandedPanelId;
if (dashboardContainer && !isErrorEmbeddable(dashboardContainer)) {
expandedPanelId = dashboardContainer.getInput().expandedPanelId;
Expand Down Expand Up @@ -482,32 +497,16 @@ export class DashboardAppController {
refreshDashboardContainer();
});

if (incomingEmbeddable) {
if ('id' in incomingEmbeddable) {
container.addOrUpdateEmbeddable<SavedObjectEmbeddableInput>(
incomingEmbeddable.type,
{
savedObjectId: incomingEmbeddable.id,
}
);
} else if ('input' in incomingEmbeddable) {
const input = incomingEmbeddable.input;
// @ts-expect-error
delete input.id;
const explicitInput = {
savedVis: input,
};
const embeddableId =
'embeddableId' in incomingEmbeddable
? incomingEmbeddable.embeddableId
: undefined;
container.addOrUpdateEmbeddable<EmbeddableInput>(
incomingEmbeddable.type,
// This ugly solution is temporary - https://github.com/elastic/kibana/pull/70272 fixes this whole section
(explicitInput as unknown) as EmbeddableInput,
embeddableId
);
}
// If the incomingEmbeddable does not yet exist in the panels listing, create a new panel using the container's addEmbeddable method.
if (
incomingEmbeddable &&
(!incomingEmbeddable.embeddableId ||
!container.getInput().panels[incomingEmbeddable.embeddableId])
) {
container.addNewEmbeddable<EmbeddableInput>(
incomingEmbeddable.type,
incomingEmbeddable.input
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { ATTRIBUTE_SERVICE_KEY } from './attribute_service';
import { mockAttributeService } from './attribute_service_mock';
import { mockAttributeService } from './attribute_service.mock';
import { coreMock } from '../../../../core/public/mocks';

interface TestAttributes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,8 @@ export class AttributeService<
};

public getExplicitInputFromEmbeddable(embeddable: IEmbeddable): ValType | RefType {
return embeddable.getRoot() &&
(embeddable.getRoot() as Container).getInput().panels[embeddable.id].explicitInput
? ((embeddable.getRoot() as Container).getInput().panels[embeddable.id].explicitInput as
| ValType
| RefType)
: (embeddable.getInput() as ValType | RefType);
return ((embeddable.getRoot() as Container).getInput()?.panels?.[embeddable.id]
?.explicitInput ?? embeddable.getInput()) as ValType | RefType;
}

getInputAsValueType = async (input: ValType | RefType): Promise<ValType> => {
Expand Down Expand Up @@ -204,7 +200,14 @@ export class AttributeService<
const newAttributes = { ...input[ATTRIBUTE_SERVICE_KEY] };
newAttributes.title = props.newTitle;
const wrappedInput = (await this.wrapAttributes(newAttributes, true)) as RefType;
resolve(wrappedInput);

// Remove unneeded attributes from the original input.
delete (input as { [ATTRIBUTE_SERVICE_KEY]?: SavedObjectAttributes })[
ATTRIBUTE_SERVICE_KEY
];

// Combine input and wrapped input to preserve any passed in explicit Input.
resolve({ ...input, ...wrappedInput });
return { id: wrappedInput.savedObjectId };
} catch (error) {
reject(error);
Expand Down
20 changes: 20 additions & 0 deletions src/plugins/dashboard/public/attribute_service/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export { AttributeService, ATTRIBUTE_SERVICE_KEY } from './attribute_service';
4 changes: 2 additions & 2 deletions src/plugins/dashboard/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export {
} from './application';
export { DashboardConstants, createDashboardEditUrl } from './dashboard_constants';

export { DashboardStart, DashboardUrlGenerator } from './plugin';
export { DashboardStart, DashboardUrlGenerator, DashboardFeatureFlagConfig } from './plugin';
export {
DASHBOARD_APP_URL_GENERATOR,
createDashboardUrlGenerator,
Expand All @@ -40,7 +40,7 @@ export {
export { addEmbeddableToDashboardUrl } from './url_utils/url_helper';
export { SavedObjectDashboard } from './saved_dashboards';
export { SavedDashboardPanel } from './types';
export { AttributeService, ATTRIBUTE_SERVICE_KEY } from './attribute_service/attribute_service';
export { AttributeService, ATTRIBUTE_SERVICE_KEY } from './attribute_service';

export function plugin(initializerContext: PluginInitializerContext) {
return new DashboardPlugin(initializerContext);
Expand Down
1 change: 1 addition & 0 deletions src/plugins/dashboard/public/mocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import { DashboardStart } from './plugin';

export type Start = jest.Mocked<DashboardStart>;
export { mockAttributeService } from './attribute_service/attribute_service.mock';

const createStartContract = (): DashboardStart => {
// @ts-ignore
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/dashboard/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ declare module '../../share/public' {

export type DashboardUrlGenerator = UrlGeneratorContract<typeof DASHBOARD_APP_URL_GENERATOR>;

interface DashboardFeatureFlagConfig {
export interface DashboardFeatureFlagConfig {
allowByValueEmbeddables: boolean;
}

Expand Down
Loading

0 comments on commit 13c6b80

Please sign in to comment.