Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New visualization editor Lens #36437

Merged
merged 162 commits into from
Sep 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
1c3bfaa
[lens] Initial Commit (#35627)
May 3, 2019
11a9173
[lens] Initial state for IndexPatternDatasource (#36052)
wylieconlon May 7, 2019
38ce5a4
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon May 7, 2019
c7e0704
[lens] Editor frame initializes datasources and visualizations (#36060)
wylieconlon May 9, 2019
abc6f04
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 May 10, 2019
0dfd683
[lens][draft] Lens/drag drop (#36268)
chrisdavies May 10, 2019
dd51978
remove local package (#36456)
flash1293 May 10, 2019
3329f33
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 May 12, 2019
ddb68e2
[lens] Native renderer (#36165)
flash1293 May 12, 2019
87c1d81
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 May 20, 2019
2961d76
[Lens] No explicit any (#36515)
flash1293 May 21, 2019
83b864c
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 May 21, 2019
4581a2f
[Lens] Implement basic editor frame state handling (#36443)
flash1293 May 22, 2019
7837bd5
[lens] Load index patterns and render in data panel (#36463)
wylieconlon May 22, 2019
77bee20
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 May 23, 2019
63d59da
[draft] Lens/line chart renderer (#36827)
chrisdavies May 23, 2019
37202a5
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 May 24, 2019
3902b92
[lens] Index pattern data panel (initial) (#37015)
May 24, 2019
76556f3
[Lens] Editor state 2 (#36513)
flash1293 May 27, 2019
f88ee1e
[lens] Dimension panel that generates columns (#37117)
May 29, 2019
35a28e9
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon May 29, 2019
c3df4c2
[lens] Generate esdocs queries from index pattern (#37361)
May 29, 2019
de5bb7f
Merge branch 'origin/master' into feature/lens
wylieconlon May 30, 2019
f179ee6
Update yarn.lock from yarn kbn bootstrap
wylieconlon May 30, 2019
51996f9
Merge branch 'master' into feature/lens
flash1293 May 31, 2019
d362819
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 May 31, 2019
6575000
[Lens] Add basic Lens xy chart suggestions (#37030)
chrisdavies May 31, 2019
f67a1ba
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Jun 3, 2019
9d5b3ea
[Lens] Expression rendering (#37648)
flash1293 Jun 3, 2019
bca7b17
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Jun 3, 2019
98a3e69
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Jun 4, 2019
b5ffb12
[Lens] Expression handling (#37876)
flash1293 Jun 5, 2019
bbf80f2
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Jun 6, 2019
717eaff
[Lens] Lens/xy config panel (#37391)
chrisdavies Jun 6, 2019
21b9431
[Lens] Xy expression building (#37967)
flash1293 Jun 7, 2019
b594b6c
[Lens] Initialize visualization with datasource api (#38142)
flash1293 Jun 7, 2019
8f231d2
[lens] Dimension panel lets users select operations and fields indivi…
Jun 7, 2019
f67878e
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Jun 10, 2019
142cb9d
[Lens] Rename columns (#38278)
flash1293 Jun 12, 2019
307cb12
[Lens] Lens/index pattern drag drop (#37711)
chrisdavies Jun 12, 2019
c83651c
[lens] Only allow aggregated dimensions (#38820)
Jun 14, 2019
f73057c
[lens] Suggest on drop (#38848)
Jun 14, 2019
1bba073
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Jun 17, 2019
acad4e7
fix merge
flash1293 Jun 17, 2019
f780d02
[Lens] Parameter configurations and new dimension config flow (#38863)
flash1293 Jun 18, 2019
4ce7fe6
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Jun 18, 2019
1f4d7ae
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Jun 19, 2019
8bf1626
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Jun 21, 2019
4c69044
fix eslint failure
flash1293 Jun 21, 2019
abed39a
[lens] Fix build by updating saved objects and i18n (#39391)
Jun 21, 2019
2a1eea8
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Jun 21, 2019
8e1fdbf
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Jun 24, 2019
85d4543
[lens] Fix arguments to esaggs using booleans (#39462)
Jun 24, 2019
02a3698
[lens] Datatable visualization plugin (#39390)
Jun 24, 2019
cbcabf1
[lens] Use first suggestion when switching visualizations (#39377)
Jun 24, 2019
6cb569f
[lens] Label each Y axis with its operation label (#39461)
Jun 25, 2019
306d384
[Lens] Suggestion preview rendering (#39576)
flash1293 Jun 27, 2019
2297f95
[Lens] Popover configs (#39565)
flash1293 Jun 27, 2019
95d7735
[Lens] Basic layouting (#39587)
flash1293 Jun 28, 2019
d857227
remove datasource public API in suggestions (#39772)
flash1293 Jun 28, 2019
1dd57f6
[Lens] Basic save / load (#39257)
chrisdavies Jun 28, 2019
54ae4c2
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Jul 1, 2019
b7bd0cd
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Jul 2, 2019
1130e56
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Jul 2, 2019
6bf5018
[lens] Fix lint error
wylieconlon Jul 2, 2019
aefc18b
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Jul 3, 2019
8b4807b
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Jul 5, 2019
d2b8d91
[lens] Use node scripts/eslint.js --fix to fix errors
wylieconlon Jul 5, 2019
9c754fe
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Jul 8, 2019
e2dc494
[lens] Include link to lens from Visualize (#40542)
Jul 9, 2019
65ab82d
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Jul 10, 2019
cbccad6
[lens] Support stacking in xy visualization (#40546)
Jul 10, 2019
b0a2325
[Lens] Add xy split series support (#39726)
chrisdavies Jul 10, 2019
5c6f552
[lens] Lens Filter Ratio (#40196)
Jul 12, 2019
4e361a6
[Lens] Terms order direction (#39884)
flash1293 Jul 15, 2019
97f6818
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Jul 16, 2019
d0ae61c
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Jul 16, 2019
dd49f8a
fix types
flash1293 Jul 16, 2019
9202916
[Lens] Data panel styling and optimizations (#40787)
chrisdavies Jul 17, 2019
292aa40
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Jul 18, 2019
9581e4e
[Lens] Optimize dimension panel flow (#41114)
flash1293 Jul 18, 2019
7933175
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Jul 19, 2019
e5b7cad
[Lens] re-introduce no-explicit-any (#41454)
flash1293 Jul 19, 2019
e071976
[Lens] No results marker (#41450)
flash1293 Jul 22, 2019
1a0d705
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Jul 22, 2019
7db032c
[lens] Support layers for visualizing results of multiple queries (#4…
Jul 24, 2019
0143fcd
[Lens] Embeddable (#41361)
flash1293 Jul 25, 2019
a68aacf
[lens] Move XY chart config into popover and fix layering (#41927)
Jul 25, 2019
e60f6c7
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Jul 26, 2019
3bbac9a
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Jul 29, 2019
112c5b0
[Lens] Fix bugs in date_histogram and filter ratio (#42046)
flash1293 Jul 29, 2019
9ff1638
[Lens] Performance improvements (#41784)
flash1293 Jul 29, 2019
8f76203
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Jul 30, 2019
2d9fbb3
fix type error
flash1293 Jul 30, 2019
4a1c899
switch default size of terms operation to 3 (#42334)
flash1293 Jul 31, 2019
8b1105d
[lens] Improve suggestions for split series (#42052)
flash1293 Aug 2, 2019
78ea487
[lens] Add chart switcher (#42093)
chrisdavies Aug 2, 2019
d73a483
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Aug 2, 2019
b00f3df
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Aug 5, 2019
b10ddc8
solve merge conflicts
flash1293 Aug 5, 2019
c94e3fe
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Aug 5, 2019
9941757
fix test case
flash1293 Aug 5, 2019
ce1f652
[Lens] Allow only current visualization on field drop in workspace (#…
flash1293 Aug 5, 2019
79ceaa1
[Lens] Remove indexpattern id on column (#42429)
flash1293 Aug 5, 2019
b8eba00
[lens] Implement app-level filtering and time picker (#42031)
Aug 7, 2019
23d453f
[Lens] Add some tests around document handling in dimension panel (#4…
flash1293 Aug 7, 2019
13ea53e
[Lens] Terms operation boolean support (#42817)
flash1293 Aug 7, 2019
36cd955
[lens] Minor UX/UI improvements in Lens (#42852)
Aug 8, 2019
2e22935
Add missing translations (#42921)
Aug 8, 2019
2282946
[Lens] Config panel design (#42980)
cchaos Aug 8, 2019
629f63a
Remove a couple of non-null assertions (#43013)
Aug 9, 2019
5492e13
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Aug 9, 2019
7c9db79
[Lens] Switch indexpattern manually (#42599)
flash1293 Aug 9, 2019
27be022
[Lens] Update frame to put suggestions at the bottom (#42997)
cchaos Aug 9, 2019
f961fc9
fix type errors
flash1293 Aug 11, 2019
c808106
switch indexpattern on layer if there is only a single empty one (#43…
flash1293 Aug 13, 2019
65ea9e3
[Lens] Suggest reduced versions of current data table (#42537)
flash1293 Aug 13, 2019
43a9bf1
[Lens] Field formatter support (#38874)
flash1293 Aug 13, 2019
bf18d72
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Aug 13, 2019
398a3de
Fix bugs
flash1293 Aug 13, 2019
e9f5807
[Lens] Add bucket nesting editor to indexpattern (#42869)
chrisdavies Aug 14, 2019
4b09eba
[Lens] Remove unnecessary fields and indexing from mappings (#43285)
chrisdavies Aug 15, 2019
1bc7e10
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Aug 16, 2019
8f35c2b
[Lens] Xy scale type (#42142)
flash1293 Aug 19, 2019
54d9d41
[lens] Allow updater function to be used for updating state (#43373)
Aug 20, 2019
2401b4f
[Lens] Lens metric visualization (#39364)
chrisdavies Aug 20, 2019
ea662ec
Fix axis rotation (#43792)
Aug 23, 2019
db9bce7
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Aug 23, 2019
c7fae6c
[Lens] Auto date histogram (#43775)
Aug 23, 2019
6fa6715
[Lens] Fix query bar integration (#43865)
flash1293 Aug 26, 2019
9775b02
Merge branch 'master' of github.com:elastic/kibana into feature/lens
chrisdavies Aug 26, 2019
8e81b5b
[Lens] Clean up operations code (#43784)
flash1293 Aug 28, 2019
1bb0910
[Lens] Functional tests (#44279)
chrisdavies Aug 29, 2019
65008c9
[Lens] Add Lens visualizations to Visualize list (#43398)
chrisdavies Aug 29, 2019
3948678
[Lens] Suggestion improvements (#43688)
flash1293 Sep 2, 2019
426d9d7
[lens] Calculate existence of fields in datasource (#44422)
Sep 3, 2019
b443d3e
[Lens ] Preview metric (#43755)
flash1293 Sep 4, 2019
57d9380
format filter ratio as percentage (#44625)
flash1293 Sep 4, 2019
32ddc97
[Lens] Remove datasource suggestion id (#44495)
flash1293 Sep 4, 2019
a4e53b8
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Sep 4, 2019
c250c7d
[Lens] Make breadcrumbs look and feel like Visualize (#44258)
chrisdavies Sep 4, 2019
68e0515
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Sep 4, 2019
9f36baf
[lens] Fix breakage from app-arch movements (#44720)
wylieconlon Sep 5, 2019
894e76f
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Sep 9, 2019
c40938e
[lens] Fix type error in test from merge
wylieconlon Sep 9, 2019
19510ba
[lens] Fix registration of embeddable (#45171)
Sep 9, 2019
1abef4b
[Lens] Functional tests (#44814)
chrisdavies Sep 10, 2019
ad61702
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Sep 10, 2019
3d1e668
[lens] Add Lens to CODEOWNERS (#45296)
Sep 10, 2019
6067f7d
Merge remote-tracking branch 'upstream/master' into feature/lens
flash1293 Sep 11, 2019
4e76620
[lens] Fix visualization alias registration
wylieconlon Sep 11, 2019
44dcc7e
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Sep 11, 2019
234ffb6
[lens] Fix usage of EUI after typescript upgrade (#45404)
Sep 11, 2019
910640a
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Sep 12, 2019
5aad545
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Sep 12, 2019
2bad5fe
[lens] Fix usage of expressions plugin (#45544)
Sep 13, 2019
d4987b8
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Sep 13, 2019
018f628
[lens] More cleanup from QueryBar changes in master (#45687)
Sep 16, 2019
9c90541
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Sep 16, 2019
c5009c4
Merge remote-tracking branch 'origin/master' into feature/lens
wylieconlon Sep 16, 2019
1dee1b4
[lens] Fix build and use new platform from entry points (#45834)
Sep 17, 2019
df20bcc
Merge branch 'master' into feature/lens
elasticmachine Sep 17, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,16 @@ module.exports = {
},
},

/**
* Lens overrides
*/
{
files: ['x-pack/legacy/plugins/lens/**/*.ts', 'x-pack/legacy/plugins/lens/**/*.tsx'],
rules: {
'@typescript-eslint/no-explicit-any': 'error',
},
},

/**
* disable jsx-a11y for kbn-ui-framework
*/
Expand Down
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Identify which groups will be pinged by changes to different parts of the codebase.
# For more info, see https://help.github.com/articles/about-codeowners/

# App
/x-pack/legacy/plugins/lens/ @elastic/kibana-app

# App Architecture
/src/plugins/data/ @elastic/kibana-app-arch
/src/plugins/kibana_utils/ @elastic/kibana-app-arch
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-interpreter/src/common/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@

export { Registry } from './lib/registry';

export { fromExpression, toExpression, Ast } from './lib/ast';
export { fromExpression, toExpression, Ast, ExpressionFunctionAST } from './lib/ast';
15 changes: 14 additions & 1 deletion packages/kbn-interpreter/src/common/lib/ast.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,20 @@
* under the License.
*/

export type Ast = unknown;
export type ExpressionArgAST = string | boolean | number | Ast;

export interface ExpressionFunctionAST {
type: 'function';
function: string;
arguments: {
[key: string]: ExpressionArgAST[];
};
}

export interface Ast {
type: 'expression';
chain: ExpressionFunctionAST[];
}

export declare function fromExpression(expression: string): Ast;
export declare function toExpression(astObj: Ast, type?: string): string;
3 changes: 2 additions & 1 deletion src/fixtures/logstash_fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ function stubbedLogstashFields() {
['area', 'geo_shape', true, true ],
['hashed', 'murmur3', false, true ],
['geo.coordinates', 'geo_point', true, true ],
['extension', 'keyword', true, true ],
['extension', 'text', true, true],
['extension.keyword', 'keyword', true, true, {}, 'extension', 'multi' ],
['machine.os', 'text', true, true ],
['machine.os.raw', 'keyword', true, true, {}, 'machine.os', 'multi' ],
['geo.src', 'keyword', true, true ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,5 +359,4 @@ export class QueryBarTopRowUI extends Component<Props, State> {
}
}

// @ts-ignore
export const QueryBarTopRow = injectI18n(QueryBarTopRowUI);
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { IExpressionLoader, ExpressionLoader } from './lib/loader';
// Accept all options of the runner as props except for the
// dom element which is provided by the component itself
export interface ExpressionRendererProps extends IExpressionLoaderParams {
className: 'string';
className: string;
expression: string | ExpressionAST;
/**
* If an element is specified, but the response of the expression run can't be rendered
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { setInspector, setInterpreter } from './services';
import { execute } from './lib/execute';
import { loader } from './lib/loader';
import { render } from './lib/render';
import { IInterpreter } from './lib/_types';
import { createRenderer } from './expression_renderer';

import { Start as IInspector } from '../../../../../plugins/inspector/public';
Expand All @@ -40,7 +41,9 @@ export class ExpressionsService {
// eslint-disable-next-line
const { getInterpreter } = require('../../../interpreter/public/interpreter');
getInterpreter()
.then(setInterpreter)
.then(({ interpreter }: { interpreter: IInterpreter }) => {
setInterpreter(interpreter);
})
.catch((e: Error) => {
throw new Error('interpreter is not initialized');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* under the License.
*/

import { TimeRange } from 'src/plugins/data/public';
import { Filter } from '@kbn/es-query';
import { TimeRange } from '../../../../../../plugins/data/public';
import { Adapters } from '../../../../../../plugins/inspector/public';
import { Query } from '../../../../../../plugins/data/public';
import { ExpressionAST } from '../../../../../../plugins/expressions/common';
Expand Down Expand Up @@ -68,13 +68,13 @@ export interface IInterpreterRenderHandlers {
event: (event: event) => void;
}

export interface IInterpreterRenderFunction {
export interface IInterpreterRenderFunction<T = unknown> {
name: string;
displayName: string;
help: string;
validate: () => void;
reuseDomNode: boolean;
render: (domNode: Element, data: unknown, handlers: IInterpreterRenderHandlers) => void;
render: (domNode: Element, data: T, handlers: IInterpreterRenderHandlers) => void | Promise<void>;
}

export interface IInterpreter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class VisualizeListingTableUi extends Component {
editItem={capabilities.get().visualize.save ? this.props.editItem : null}
tableColumns={this.getTableColumns()}
listingLimit={this.props.listingLimit}
selectable={item => item.canDelete}
initialFilter={''}
noItemsFragment={this.getNoItemsMessage()}
entityName={
Expand Down
1 change: 1 addition & 0 deletions src/legacy/plugin_discovery/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export interface LegacyPluginOptions {
icon: string;
euiIconType: string;
order: number;
listed: boolean;
}>;
apps: any;
hacks: string[];
Expand Down
20 changes: 20 additions & 0 deletions src/plugins/data/common/query/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 * from './types';
1 change: 1 addition & 0 deletions x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"xpack.indexLifecycleMgmt": "legacy/plugins/index_lifecycle_management",
"xpack.infra": "legacy/plugins/infra",
"xpack.kueryAutocomplete": "legacy/plugins/kuery_autocomplete",
"xpack.lens": "legacy/plugins/lens",
"xpack.licensing": "plugins/licensing",
"xpack.licenseMgmt": "legacy/plugins/license_management",
"xpack.maps": "legacy/plugins/maps",
Expand Down
2 changes: 2 additions & 0 deletions x-pack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { snapshotRestore } from './legacy/plugins/snapshot_restore';
import { actions } from './legacy/plugins/actions';
import { alerting } from './legacy/plugins/alerting';
import { advancedUiActions } from './legacy/plugins/advanced_ui_actions';
import { lens } from './legacy/plugins/lens';

module.exports = function (kibana) {
return [
Expand Down Expand Up @@ -83,6 +84,7 @@ module.exports = function (kibana) {
ossTelemetry(kibana),
fileUpload(kibana),
encryptedSavedObjects(kibana),
lens(kibana),
snapshotRestore(kibana),
actions(kibana),
alerting(kibana),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

// @ts-ignore - Interpreter not typed yet
import { fromExpression, toExpression } from '@kbn/interpreter/common';
import { fromExpression, toExpression, Ast } from '@kbn/interpreter/common';
import { get } from 'lodash';
import React from 'react';
import ReactDOM from 'react-dom';
Expand Down Expand Up @@ -58,7 +57,7 @@ export const dropdownFilter: RendererFactory<Config> = () => ({
if (commitValue === '%%CANVAS_MATCH_ALL%%') {
handlers.setFilter('');
} else {
const newFilterAST = {
const newFilterAST: Ast = {
type: 'expression',
chain: [
{
Expand Down
14 changes: 14 additions & 0 deletions x-pack/legacy/plugins/lens/common/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export const PLUGIN_ID = 'lens';

export const BASE_APP_URL = '/app/lens';
export const BASE_API_URL = '/api/lens';

export function getEditPath(id: string) {
return `${BASE_APP_URL}#/edit/${encodeURIComponent(id)}`;
}
7 changes: 7 additions & 0 deletions x-pack/legacy/plugins/lens/common/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export * from './constants';
99 changes: 99 additions & 0 deletions x-pack/legacy/plugins/lens/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import * as Joi from 'joi';
import { resolve } from 'path';
import { LegacyPluginInitializer } from 'src/legacy/types';
import KbnServer, { Server } from 'src/legacy/server/kbn_server';
import { CoreSetup } from 'src/core/server';
import mappings from './mappings.json';
import { PLUGIN_ID, getEditPath, BASE_API_URL } from './common';
import { lensServerPlugin } from './server';

const NOT_INTERNATIONALIZED_PRODUCT_NAME = 'Lens Visualizations';

export const lens: LegacyPluginInitializer = kibana => {
return new kibana.Plugin({
id: PLUGIN_ID,
configPrefix: `xpack.${PLUGIN_ID}`,
require: ['kibana', 'elasticsearch', 'xpack_main', 'interpreter', 'data'],
publicDir: resolve(__dirname, 'public'),

uiExports: {
app: {
title: NOT_INTERNATIONALIZED_PRODUCT_NAME,
description: 'Explore and visualize data.',
main: `plugins/${PLUGIN_ID}/index`,
listed: false,
},
embeddableFactories: ['plugins/lens/register_embeddable'],
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
mappings,
visTypes: ['plugins/lens/register_vis_type_alias'],
savedObjectsManagement: {
lens: {
defaultSearchField: 'title',
isImportableAndExportable: true,
getTitle: (obj: { attributes: { title: string } }) => obj.attributes.title,
getInAppUrl: (obj: { id: string }) => ({
path: getEditPath(obj.id),
uiCapabilitiesPath: 'lens.show',
}),
},
},
},

config: () => {
return Joi.object({
enabled: Joi.boolean().default(true),
}).default();
},

init(server: Server) {
const kbnServer = (server as unknown) as KbnServer;

server.plugins.xpack_main.registerFeature({
id: PLUGIN_ID,
name: NOT_INTERNATIONALIZED_PRODUCT_NAME,
app: [PLUGIN_ID, 'kibana'],
catalogue: [PLUGIN_ID],
privileges: {
all: {
api: [PLUGIN_ID],
catalogue: [PLUGIN_ID],
savedObject: {
all: [],
read: [],
},
ui: ['save', 'show'],
},
read: {
api: [PLUGIN_ID],
catalogue: [PLUGIN_ID],
savedObject: {
all: [],
read: [],
},
ui: ['show'],
},
},
});

// Set up with the new platform plugin lifecycle API.
const plugin = lensServerPlugin();
plugin.setup(({
http: {
...kbnServer.newPlatform.setup.core.http,
createRouter: () => kbnServer.newPlatform.setup.core.http.createRouter(BASE_API_URL),
},
} as unknown) as CoreSetup);

server.events.on('stop', () => {
plugin.stop();
});
},
});
};
20 changes: 20 additions & 0 deletions x-pack/legacy/plugins/lens/mappings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"lens": {
"properties": {
"title": {
"type": "text"
},
"visualizationType": {
"type": "keyword"
},
"state": {
"enabled": false,
"type": "object"
},
"expression": {
"index": false,
"type": "keyword"
}
}
}
}
Loading