Skip to content

Commit

Permalink
Merge branch 'master' into config-breaking/remove-deprecated-configs-…
Browse files Browse the repository at this point in the history
…misc
  • Loading branch information
kibanamachine authored Sep 27, 2021
2 parents b99fc39 + 90792cf commit f2e2e32
Show file tree
Hide file tree
Showing 336 changed files with 18,128 additions and 4,528 deletions.
9 changes: 8 additions & 1 deletion .buildkite/scripts/steps/storybooks/build_and_upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@ const path = require('path');
const STORYBOOKS = [
'apm',
'canvas',
'codeeditor',
'ci_composite',
'url_template_editor',
'codeeditor',
'dashboard',
'dashboard_enhanced',
'data_enhanced',
'embeddable',
'expression_error',
'expression_image',
'expression_metric',
'expression_repeat_image',
'expression_reveal_image',
'expression_shape',
'expression_tagcloud',
'fleet',
'infra',
'security_solution',
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
/examples/url_generators_examples/ @elastic/kibana-app-services
/examples/url_generators_explorer/ @elastic/kibana-app-services
/examples/field_formats_example/ @elastic/kibana-app-services
/examples/partial_results_example/ @elastic/kibana-app-services
/packages/elastic-datemath/ @elastic/kibana-app-services
/packages/kbn-interpreter/ @elastic/kibana-app-services
/src/plugins/bfetch/ @elastic/kibana-app-services
Expand Down
4 changes: 4 additions & 0 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ as uiSettings within the code.
|Console provides the user with tools for storing and executing requests against Elasticsearch.
|{kib-repo}blob/{branch}/src/plugins/custom_integrations/README.md[customIntegrations]
|Register add-data cards
|<<kibana-dashboard-plugin>>
|- Registers the dashboard application.
- Adds a dashboard embeddable that can be used in other applications.
Expand Down
4 changes: 2 additions & 2 deletions docs/setup/secure-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ To create the `kibana.keystore`, use the `create` command:
bin/kibana-keystore create
----------------------------------------------------------------

The file `kibana.keystore` will be created in the directory defined by the
<<path-data, `path.data`>> configuration setting.
The file `kibana.keystore` will be created in the `config` directory defined by the
environment variable `KBN_PATH_CONF`.

[float]
[[list-settings]]
Expand Down
18 changes: 17 additions & 1 deletion docs/user/dashboard/lens.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -441,4 +441,20 @@ Pagination in a data table is unsupported. To use pagination in data tables, cre
[%collapsible]
====
Specifying the color for a single data point, such as a single bar or line, is unsupported.
====
====

[discrete]
[[is-it-possible-to-inspect-the-elasticsearch-queries-in-Lens]]
.*How do I inspect {es} queries in visualizations?*
[%collapsible]
====
You can inspect the requests sent by the visualization to {es} using the Inspector. It can be accessed within the editor or in the dashboard.
====

[discrete]
[[how-to-isolate-a-single-series-in-a-chart]]
.*How do I isolate a single series in a chart?*
[%collapsible]
====
For area, line, and bar charts, press Shift, then click the series in the legend. All other series are automatically unselected.
====
9 changes: 9 additions & 0 deletions examples/partial_results_example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Partial Results Example

The partial results is a feature of the expressions plugin allowing to emit intermediate execution results over time.

This example plugin demonstrates:

1. An expression function emitting a datatable with intermediate results (`getEvents`).
2. An expression function emitting an infinite number of results (`countEvent`).
3. A combination of those two functions using the `mapColumn` function that continuously updates the resulting table.
12 changes: 12 additions & 0 deletions examples/partial_results_example/kibana.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"id": "paertialResultsExample",
"version": "0.1.0",
"kibanaVersion": "kibana",
"ui": true,
"owner": {
"name": "App Services",
"githubTeam": "kibana-app-services"
},
"description": "A plugin demonstrating partial results in the expressions plugin",
"requiredPlugins": ["developerExamples", "expressions"]
}
90 changes: 90 additions & 0 deletions examples/partial_results_example/public/app/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* 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.
*/

import React, { useContext, useEffect, useState } from 'react';
import { pluck } from 'rxjs/operators';
import {
EuiBasicTable,
EuiCallOut,
EuiCodeBlock,
EuiPage,
EuiPageBody,
EuiPageContent,
EuiPageContentBody,
EuiPageHeader,
EuiPageHeaderSection,
EuiSpacer,
EuiText,
EuiTitle,
} from '@elastic/eui';
import type { Datatable } from 'src/plugins/expressions';
import { ExpressionsContext } from './expressions_context';

const expression = `getEvents
| mapColumn name="Count" expression={
countEvent {pluck "event"}
}
`;

export function App() {
const expressions = useContext(ExpressionsContext);
const [datatable, setDatatable] = useState<Datatable>();

useEffect(() => {
const subscription = expressions
?.execute<null, Datatable>(expression, null)
.getData()
.pipe(pluck('result'))
.subscribe((value) => setDatatable(value as Datatable));

return () => subscription?.unsubscribe();
}, [expressions]);

return (
<EuiPage>
<EuiPageBody style={{ maxWidth: 1200, margin: '0 auto' }}>
<EuiPageHeader>
<EuiPageHeaderSection>
<EuiTitle size="l">
<h1>Partial Results Demo</h1>
</EuiTitle>
</EuiPageHeaderSection>
</EuiPageHeader>
<EuiPageContent>
<EuiPageContentBody style={{ maxWidth: 800, margin: '0 auto' }}>
<EuiText data-test-subj="example-help">
<p>
This example listens for the window events and adds them to the table along with a
trigger counter.
</p>
</EuiText>
<EuiSpacer size={'m'} />
<EuiCodeBlock>{expression}</EuiCodeBlock>
<EuiSpacer size={'m'} />
{datatable ? (
<EuiBasicTable
textOnly={true}
data-test-subj={'example-table'}
columns={datatable.columns?.map(({ id: field, name }) => ({
field,
name,
'data-test-subj': `example-column-${field.toLowerCase()}`,
}))}
items={datatable.rows ?? []}
/>
) : (
<EuiCallOut color="success">
<p>Click or press any key.</p>
</EuiCallOut>
)}
</EuiPageContentBody>
</EuiPageContent>
</EuiPageBody>
</EuiPage>
);
}
12 changes: 12 additions & 0 deletions examples/partial_results_example/public/app/expressions_context.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* 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.
*/

import { createContext } from 'react';
import type { ExpressionsServiceStart } from 'src/plugins/expressions';

export const ExpressionsContext = createContext<ExpressionsServiceStart | undefined>(undefined);
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
* Side Public License, v 1.
*/

export { getElasticsearchDeprecationsProvider } from './deprecation_provider';
export * from './app';
export * from './expressions_context';
40 changes: 40 additions & 0 deletions examples/partial_results_example/public/functions/count_event.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.
*/

import { Observable, fromEvent } from 'rxjs';
import { scan, startWith } from 'rxjs/operators';
import type { ExpressionFunctionDefinition } from 'src/plugins/expressions';

export interface CountEventArguments {
event: string;
}

export const countEvent: ExpressionFunctionDefinition<
'countEvent',
null,
CountEventArguments,
Observable<number>
> = {
name: 'countEvent',
type: 'number',
help: 'Subscribes for an event and counts a number of triggers.',
args: {
event: {
aliases: ['_'],
types: ['string'],
help: 'The event name.',
required: true,
},
},
fn(input, { event }) {
return fromEvent(window, event).pipe(
scan((count) => count + 1, 1),
startWith(1)
);
},
};
51 changes: 51 additions & 0 deletions examples/partial_results_example/public/functions/get_events.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* 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.
*/

import { Observable, fromEvent, merge } from 'rxjs';
import { distinct, map, pluck, scan, take } from 'rxjs/operators';
import type { Datatable, ExpressionFunctionDefinition } from 'src/plugins/expressions';

const EVENTS: Array<keyof WindowEventMap> = [
'mousedown',
'mouseup',
'click',
'keydown',
'keyup',
'keypress',
];

export const getEvents: ExpressionFunctionDefinition<
'getEvents',
null,
{},
Observable<Datatable>
> = {
name: 'getEvents',
type: 'datatable',
help: 'Listens for the window events and returns a table with the triggered ones.',
args: {},
fn() {
return merge(...EVENTS.map((event) => fromEvent(window, event))).pipe(
pluck('type'),
distinct(),
take(EVENTS.length),
scan((events, event) => [...events, event], [] as string[]),
map((events) => ({
type: 'datatable',
columns: [
{
id: 'event',
meta: { type: 'string' },
name: 'Event',
},
],
rows: Array.from(events).map((event) => ({ event })),
}))
);
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Side Public License, v 1.
*/

export const isInlineScriptingDisabledMock = jest.fn();
jest.doMock('./is_scripting_disabled', () => ({
isInlineScriptingDisabled: isInlineScriptingDisabledMock,
}));
export * from './count_event';
export * from './get_events';
export * from './pluck';
32 changes: 32 additions & 0 deletions examples/partial_results_example/public/functions/pluck.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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.
*/

import type { Datatable, ExpressionFunctionDefinition } from 'src/plugins/expressions';

export interface PluckArguments {
key: string;
}

export const pluck: ExpressionFunctionDefinition<'pluck', Datatable, PluckArguments, unknown> = {
name: 'pluck',
inputTypes: ['datatable'],
help: 'Takes a cell from the first table row.',
args: {
key: {
aliases: ['_'],
types: ['string'],
help: 'The column id.',
required: true,
},
},
fn({ rows }, { key }) {
const [{ [key]: value }] = rows;

return value;
},
};
12 changes: 12 additions & 0 deletions examples/partial_results_example/public/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* 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.
*/
import { PartialResultsExamplePlugin } from './plugin';

export function plugin() {
return new PartialResultsExamplePlugin();
}
Loading

0 comments on commit f2e2e32

Please sign in to comment.