Skip to content

Commit

Permalink
Merge branch 'master' into maps/ts_source_layer
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine committed Apr 20, 2020
2 parents a9cbf10 + 8f7bb05 commit eb9a691
Show file tree
Hide file tree
Showing 405 changed files with 6,115 additions and 3,778 deletions.
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ A high level overview of our contributing guidelines.
- [Setting Up SSL](#setting-up-ssl)
- [Linting](#linting)
- [Internationalization](#internationalization)
- [Localization](#localization)
- [Testing and Building](#testing-and-building)
- [Debugging server code](#debugging-server-code)
- [Instrumenting with Elastic APM](#instrumenting-with-elastic-apm)
Expand Down Expand Up @@ -408,6 +409,11 @@ ReactDOM.render(
There are a number of tools created to support internationalization in Kibana that would allow one to validate internationalized labels,
extract them to a `JSON` file or integrate translations back to Kibana. To know more, please read corresponding [readme](src/dev/i18n/README.md) file.

### Localization

We cannot support accepting contributions to the translations from any source other than the translators we have engaged to do the work.
We are still to develop a proper process to accept any contributed translations. We certainly appreciate that people care enough about the localization effort to want to help improve the quality. We aim to build out a more comprehensive localization process for the future and will notify you once contributions can be supported, but for the time being, we are not able to incorporate suggestions.

### Testing and Building

To ensure that your changes will not break other functionality, please run the test suite and build process before submitting your Pull Request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
| [SavedQuery](./kibana-plugin-plugins-data-public.savedquery.md) | |
| [SavedQueryService](./kibana-plugin-plugins-data-public.savedqueryservice.md) | |
| [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) | |
| [SearchStrategyProvider](./kibana-plugin-plugins-data-public.searchstrategyprovider.md) | |
| [TabbedAggColumn](./kibana-plugin-plugins-data-public.tabbedaggcolumn.md) | \* |
| [TabbedTable](./kibana-plugin-plugins-data-public.tabbedtable.md) | \* |
| [TimeRange](./kibana-plugin-plugins-data-public.timerange.md) | |
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

15 changes: 12 additions & 3 deletions docs/user/alerting/action-types.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,23 @@ a| <<webhook-action-type, Webhook>>

[NOTE]
==============================================
Some action types are paid commercial features, while others are free.
For a comparison of the Elastic subscription levels,
see https://www.elastic.co/subscriptions[the subscription page].
Some action types are paid commercial features, while others are free.
For a comparison of the Elastic subscription levels,
see https://www.elastic.co/subscriptions[the subscription page].
==============================================

[float]
[[create-connectors]]
=== Connectors

You can create connectors for actions in <<managing-alerts-and-actions, Alerts and Actions>> or via the action API.
For out-of-the-box and standardized connectors, you can <<pre-configured-connectors, preconfigure connectors>>
before {kib} starts.

include::action-types/email.asciidoc[]
include::action-types/index.asciidoc[]
include::action-types/pagerduty.asciidoc[]
include::action-types/server-log.asciidoc[]
include::action-types/slack.asciidoc[]
include::action-types/webhook.asciidoc[]
include::pre-configured-connectors.asciidoc[]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 88 additions & 0 deletions docs/user/alerting/pre-configured-connectors.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
[role="xpack"]
[[pre-configured-connectors]]

== Preconfigured connectors

You can preconfigure an action connector to have all the information it needs prior to startup
by adding it to the `kibana.yml` file.
Sensitive configuration information, such as credentials, can use the {kib} keystore.

Preconfigured connectors offer the following capabilities:

- Require no setup. Configuration and credentials needed to execute an
action are predefined, including the connector name and ID.
- Appear in all spaces because they are not saved objects.
- Cannot be edited or deleted.

[float]
[[preconfigured-connector-example]]
=== Example of a preconfigured connector

The following example shows a valid configuration 2 out-of-the box connector.

[source,console]
------------------------
xpack.actions.preconfigured:
- id: 'my-slack1' <1>
actionTypeId: .slack <2>
name: 'Slack #xyz' <3>
config: <4>
webhookUrl: 'https://hooks.slack.com/services/abcd/efgh/ijklmnopqrstuvwxyz'
- id: 'webhook-service'
actionTypeId: .webhook
name: 'Email service'
config:
url: 'https://email-alert-service.elastic.co'
method: post
headers:
header1: value1
header2: value2
secrets: <5>
user: elastic
password: changeme
------------------------

<1> `id` is the action connector identifier.
<2> `actionTypeId` is the action type identifier.
<3> `name` is the name of the preconfigured connector.
<4> `config` is the action type specific to the configuration.
<5> `secrets` is sensitive configuration, such as username, password, and keys.

[NOTE]
==============================================
Sensitive properties, such as passwords, can also be stored in the {kib} keystore.
==============================================

[float]
[[pre-configured-connector-alert-form]]
=== Creating an alert with a preconfigured connector

When attaching an action to an alert,
select from a list of available action types, and
then select the Slack or Webhook type. Those action types were configured previously.
The preconfigured connector is installed and is automatically selected.

[role="screenshot"]
image::images/alert-pre-configured-slack-connector.png[Create alert with selected Slack action type]

The dropdown is populated with additional preconfigured Slack connectors.
The `preconfigured` label distinguishes them from space-aware connectors that use saved objects.

[role="screenshot"]
image::images/alert-pre-configured-connectors-dropdown.png[Dropdown list with pre-cofigured connectors]

[float]
[[managing-pre-configured-connectors]]
=== Managing preconfigured connectors

Preconfigured connectors appear in the connector list, regardless of which space the user is in.
They are tagged as “preconfigured” and cannot be deleted.

[role="screenshot"]
image::images/pre-configured-connectors-managing.png[Connectors managing tab with pre-cofigured]

Clicking on a preconfigured connector shows the description, but not any of the configuration.
A message indicates that this is a preconfigured connector.

[role="screenshot"]
image::images/pre-configured-connectors-view-screen.png[Pre-configured connector view details]
12 changes: 6 additions & 6 deletions src/core/public/plugins/plugin_loader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test('`loadPluginBundles` creates a script tag and loads initializer', async ()
const fakeScriptTag = createdScriptTags[0];
expect(fakeScriptTag.setAttribute).toHaveBeenCalledWith(
'src',
'/bundles/plugin/plugin-a/plugin-a.plugin.js'
'/bundles/plugin:plugin-a/plugin-a.plugin.js'
);
expect(fakeScriptTag.setAttribute).toHaveBeenCalledWith('id', 'kbn-plugin-plugin-a');
expect(fakeScriptTag.onload).toBeInstanceOf(Function);
Expand All @@ -85,7 +85,7 @@ test('`loadPluginBundles` includes the basePath', async () => {
const fakeScriptTag = createdScriptTags[0];
expect(fakeScriptTag.setAttribute).toHaveBeenCalledWith(
'src',
'/mybasepath/bundles/plugin/plugin-a/plugin-a.plugin.js'
'/mybasepath/bundles/plugin:plugin-a/plugin-a.plugin.js'
);
});

Expand All @@ -96,7 +96,7 @@ test('`loadPluginBundles` rejects if script.onerror is called', async () => {
fakeScriptTag1.onerror(new Error('Whoa there!'));

await expect(loadPromise).rejects.toThrowErrorMatchingInlineSnapshot(
`"Failed to load \\"plugin-a\\" bundle (/bundles/plugin/plugin-a/plugin-a.plugin.js)"`
`"Failed to load \\"plugin-a\\" bundle (/bundles/plugin:plugin-a/plugin-a.plugin.js)"`
);
});

Expand All @@ -105,7 +105,7 @@ test('`loadPluginBundles` rejects if timeout is reached', async () => {
// Override the timeout to 1 ms for testi.
loadPluginBundle(addBasePath, 'plugin-a', { timeoutMs: 1 })
).rejects.toThrowErrorMatchingInlineSnapshot(
`"Timeout reached when loading \\"plugin-a\\" bundle (/bundles/plugin/plugin-a/plugin-a.plugin.js)"`
`"Timeout reached when loading \\"plugin-a\\" bundle (/bundles/plugin:plugin-a/plugin-a.plugin.js)"`
);
});

Expand All @@ -115,11 +115,11 @@ test('`loadPluginBundles` rejects if bundle does attach an initializer to window
const fakeScriptTag1 = createdScriptTags[0];

// Setup a fake initializer as if a plugin bundle had actually been loaded.
coreWindow.__kbnBundles__['plugin/plugin-a'] = undefined;
coreWindow.__kbnBundles__['plugin:plugin-a'] = undefined;
// Call the onload callback
fakeScriptTag1.onload();

await expect(loadPromise).rejects.toThrowErrorMatchingInlineSnapshot(
`"Definition of plugin \\"plugin-a\\" should be a function (/bundles/plugin/plugin-a/plugin-a.plugin.js)."`
`"Definition of plugin \\"plugin-a\\" should be a function (/bundles/plugin:plugin-a/plugin-a.plugin.js)."`
);
});
2 changes: 1 addition & 1 deletion src/core/public/plugins/plugin_loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const loadPluginBundle: LoadPluginBundle = <

const script = document.createElement('script');
// Assumes that all plugin bundles get put into the bundles/plugins subdirectory
const bundlePath = addBasePath(`/bundles/plugin/${pluginName}/${pluginName}.plugin.js`);
const bundlePath = addBasePath(`/bundles/plugin:${pluginName}/${pluginName}.plugin.js`);
script.setAttribute('src', bundlePath);
script.setAttribute('id', `kbn-plugin-${pluginName}`);
script.setAttribute('async', '');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import { getIndices } from './get_indices';
import { IndexPatternCreationConfig } from '../../../../../../../../../plugins/index_pattern_management/public';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { LegacyApiCaller } from '../../../../../../../../../plugins/data/public/search';
import { LegacyApiCaller } from '../../../../../../../../../plugins/data/public/search/legacy';

export const successfulResponse = {
hits: {
Expand Down
8 changes: 4 additions & 4 deletions src/legacy/ui/ui_render/bootstrap/template.js.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ if (window.__kbnStrictCsp__ && window.__kbnCspNotEnforced__) {
'{{this}}',
{{/each}}
'{{regularBundlePath}}/commons.bundle.js',
{{!-- '{{regularBundlePath}}/plugin/data/data.plugin.js', --}}
'{{regularBundlePath}}/plugin/kibanaUtils/kibanaUtils.plugin.js',
'{{regularBundlePath}}/plugin/esUiShared/esUiShared.plugin.js',
'{{regularBundlePath}}/plugin/kibanaReact/kibanaReact.plugin.js'
{{!-- '{{regularBundlePath}}/plugin:data/data.plugin.js', --}}
'{{regularBundlePath}}/plugin:kibanaUtils/kibanaUtils.plugin.js',
'{{regularBundlePath}}/plugin:esUiShared/esUiShared.plugin.js',
'{{regularBundlePath}}/plugin:kibanaReact/kibanaReact.plugin.js'
], function () {
load([
'{{regularBundlePath}}/{{appId}}.bundle.js',
Expand Down
4 changes: 2 additions & 2 deletions src/optimize/bundles_route/bundles_route.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ export function createBundlesRoute({
),
...npUiPluginPublicDirs.map(({ id, path }) =>
buildRouteForBundles(
`${basePublicPath}/bundles/plugin/${id}/`,
`/bundles/plugin/${id}/`,
`${basePublicPath}/bundles/plugin:${id}/`,
`/bundles/plugin:${id}/`,
path,
fileHashCache
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { FilterUtils } from './lib/filter_utils';
import {
DashboardAppState,
DashboardAppStateDefaults,
DashboardAppStateInUrl,
DashboardAppStateTransitions,
SavedDashboardPanel,
} from '../types';
Expand Down Expand Up @@ -165,11 +166,12 @@ export class DashboardStateManager {
});

// setup state syncing utils. state container will be synced with url into `this.STATE_STORAGE_KEY` query param
this.stateSyncRef = syncState<DashboardAppState>({
this.stateSyncRef = syncState<DashboardAppStateInUrl>({
storageKey: this.STATE_STORAGE_KEY,
stateContainer: {
...this.stateContainer,
set: (state: DashboardAppState | null) => {
get: () => this.toUrlState(this.stateContainer.get()),
set: (state: DashboardAppStateInUrl | null) => {
// sync state required state container to be able to handle null
// overriding set() so it could handle null coming from url
if (state) {
Expand Down Expand Up @@ -558,9 +560,9 @@ export class DashboardStateManager {
*/
private saveState({ replace }: { replace: boolean }): boolean {
// schedules setting current state to url
this.kbnUrlStateStorage.set<DashboardAppState>(
this.kbnUrlStateStorage.set<DashboardAppStateInUrl>(
this.STATE_STORAGE_KEY,
this.stateContainer.get()
this.toUrlState(this.stateContainer.get())
);
// immediately forces scheduled updates and changes location
return this.kbnUrlStateStorage.flush({ replace });
Expand Down Expand Up @@ -620,4 +622,13 @@ export class DashboardStateManager {
const current = _.omit(this.stateContainer.get(), propsToIgnore);
return !_.isEqual(initial, current);
}

private toUrlState(state: DashboardAppState): DashboardAppStateInUrl {
if (state.viewMode === ViewMode.VIEW) {
const { panels, ...stateWithoutPanels } = state;
return stateWithoutPanels;
}

return state;
}
}
8 changes: 8 additions & 0 deletions src/plugins/dashboard/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ export type DashboardAppStateDefaults = DashboardAppState & {
description?: string;
};

/**
* In URL panels are optional,
* Panels are not added to the URL when in "view" mode
*/
export type DashboardAppStateInUrl = Omit<DashboardAppState, 'panels'> & {
panels?: SavedDashboardPanel[];
};

export interface DashboardAppStateTransitions {
set: (
state: DashboardAppState
Expand Down
1 change: 0 additions & 1 deletion src/plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ export {
SearchRequest,
SearchResponse,
SearchError,
SearchStrategyProvider,
ISearchSource,
SearchSource,
createSearchSource,
Expand Down
Loading

0 comments on commit eb9a691

Please sign in to comment.