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

Move Expression typings from Canvas to OSS Interpreter #36960

Closed
wants to merge 114 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
0415303
Move Expression types to OSS.
lukeelmers May 23, 2019
2af0f75
Add interfaces for KibanaContext and KibanaDatatable types.
lukeelmers May 23, 2019
14e8043
Convert esaggs expression function to TypeScript.
lukeelmers May 23, 2019
248d0ed
Clean up KibanaDatatable and KibanaContext types.
lukeelmers May 23, 2019
1229151
[Code] refactor launcher code, add unit tests (#36863)
May 24, 2019
8e53461
feature(code/frontend): breadcrumb links to code root and project roo…
May 24, 2019
ff51461
[Code] fix query string key conflict (#36620)
May 24, 2019
8070a1f
[SIEM] Remove imports from server folder (#37037)
XavierM May 24, 2019
0259b96
moves ui out of index patterns service (#36348)
ppisljar May 24, 2019
80193a1
[Tagcloud] Allow to send showLabel parameter with false value (#36563)
maryia-lapata May 24, 2019
cca9ba8
[TSVB] Fix Rollup Search with auto interval for Rollup Jobs in calend…
alexwizp May 24, 2019
2db82c5
[TSVB] Table tests (#36762)
vitalics May 24, 2019
5e59de2
Remove unused translations (#37069)
maryia-lapata May 24, 2019
3232fc8
Expressions service (#36885)
flash1293 May 24, 2019
9d759a2
[TSVB] Rollup Search - override index pattern functionality is not wo…
alexwizp May 24, 2019
4fabe6c
[Canvas] Adds telemetry info for custom elements (#36177)
May 24, 2019
3da94cc
Once the buffer has any events, the collector is always ready (#36995)
chrisronline May 24, 2019
eb2ede6
[Monitoring] Fix 500 error from /api/stats (#36986)
chrisronline May 24, 2019
82fa749
[TSVB] Get rid of default export on TSVB (#36872)
May 24, 2019
673d92e
[APM] Fix encoding issue with forward slash in path (#37072)
sorenlouv May 24, 2019
9463fd8
[ML] Improve anomalies in Kibana sample data (#36982)
stevedodson May 24, 2019
cdd1a1d
[Vis] Move propFilter from ui/filter to ui/agg_types/filter (#36875)
maryia-lapata May 24, 2019
dc228ff
[ML] Data Frames: Fix (error) messages, data field aggs, date picker …
walterra May 24, 2019
6b26b9c
Swapped the anchor tag with EuiLink (#37020)
igoristic May 24, 2019
3f4c2c8
Revert "[Canvas] Adds telemetry info for custom elements (#36177)" (#…
May 24, 2019
ec1dc71
Typecasting the attr boolean to the correct type (#37031)
igoristic May 24, 2019
b7b7aa5
Update QueryBarInput to accept index pattern strings (#36916)
Bargs May 24, 2019
fcf0466
[siem/ui] avoid importing server code in ui (#37103)
May 24, 2019
c4277fd
[ML] Anomaly explorer query bar - ensure anomalies table results reta…
alvarezmelissa87 May 24, 2019
67dc8a4
Split ciGroup3 and ciGroup5 (#36928)
May 24, 2019
1ec734f
update CONTRIBUTING.md re: linting with VSCode (#37005)
pmuellr May 24, 2019
e390be2
No unused vars cleanup set two (#37051)
mattkime May 24, 2019
1a2ec83
Remove improper usage (#37099)
chrisronline May 24, 2019
34e6c90
[Monitoring] Used fixed_interval explicitly for date_histogram aggreg…
chrisronline May 24, 2019
6d1a894
[feat] add reach-like functionality to object (#37118)
toddself May 24, 2019
d7d392e
disable failing test
May 24, 2019
93970bc
[Grok Debugger] Trim trailing whitespace in sample data and grok patt…
ycombinator May 24, 2019
2327a12
Remove unused propType (#37138)
cqliu1 May 25, 2019
f78995c
Fixes check for existing min/max value in axisConfig (#37119)
cqliu1 May 25, 2019
b393a6e
[SIEM] Fix for removal of first filter clearing remaining filters (#3…
spong May 25, 2019
6686b1c
[APM] Add useMemo and minor feedback for environment filters (#36970)
sorenlouv May 25, 2019
2e3fbd2
[APM] Make sure conditions under which transaction menu items are sho…
dgieselaar May 25, 2019
5b03632
[ML] Data Frames: Fix calendar_interval for date histograms. (#36905)
walterra May 25, 2019
58fbf44
[APM] Make sure URL hooks are in sync with history.location (#36676)
dgieselaar May 25, 2019
987b27e
[ML] Data Frames: Fixes aggregation item overflow. (#37068)
walterra May 25, 2019
bfadef6
[Code] Reset the default search scope (#37014)
mw-ding May 26, 2019
d187ba0
[Code] improve project status polling management (#36841)
mw-ding May 26, 2019
57bc4b8
[APM] Navigate to default transaction sample (#36223)
dgieselaar May 27, 2019
80d9a25
TSVB: selecting the colour picker crashes Kibana (#37176)
alexwizp May 27, 2019
3c0bc30
Tsfy screenshot service and comparepng internal lib (#37177)
vitalics May 27, 2019
ed29276
[TSVB] markdown variables(revert fix) (#34067)
vitalics May 27, 2019
f02c78b
Fix Canvas fullscreen
rashidkpc May 28, 2019
288f471
Revert "Fix Canvas fullscreen"
May 28, 2019
255fc92
Closes #36992 by fixing path params bug by checking if serviceName ev…
ogupte May 28, 2019
7d21cb1
Add automatic alignment to gauge visualisation (#34845)
kertal May 28, 2019
7c556ca
TSVB: functional test for color picker, preview disable and series cl…
dmlemeshko May 28, 2019
959416a
[ML] Data Frames: Fix to avoid queries for indices with more than 102…
walterra May 28, 2019
be14547
Move all switches to the SwitchParamEditor (#37215)
sulemanof May 28, 2019
af34b9f
[docs][skip ci] Infrastructure and Logs read only access (#35566)
kobelb May 28, 2019
bc37f86
Moved query filter and push filter into filter manager (#36764)
May 28, 2019
4095908
[ML] Fix access denied for data frames. (#37178)
walterra May 28, 2019
03fe269
[DOCS] Facilitates content re-use in the monitoring configuration (#3…
lcawl May 28, 2019
149160f
[ML] Fix to not add configs with names which would result in nesting …
walterra May 28, 2019
50bd081
[SIEM] Fixes timeline notes overflowing the modal (#37134)
andrew-goldstein May 28, 2019
ca2a66d
return false for each jobId if it does not exist (#37116)
alvarezmelissa87 May 28, 2019
1cfad73
[SIEM] Low impact linter rules to start with (#37137)
FrankHassanabad May 28, 2019
ab4d8b1
fix persistence of timeline when you pinned or add a note to an event…
XavierM May 28, 2019
74a2b7f
[SIEM] Fixed unescaped HTML entity issue (#37257)
FrankHassanabad May 28, 2019
e426518
[ML] Prevent overflow of large metric values in data visualizer/file …
alvarezmelissa87 May 28, 2019
a0d75ea
update yarn.lock file
May 28, 2019
a684756
[SIEM] Fix state issues to avoid potential React update issues (#37261)
FrankHassanabad May 28, 2019
ab6f0a7
Expose plugin contracts to Legacy platform (#37218)
mshustov May 28, 2019
ddc24b8
[visualize/_shared_item] skip test due to #37130 (#37131)
dmlemeshko May 28, 2019
dbb013d
Fix infinite loop in QueryBarInput's componentDidUpdate (#36946)
Bargs May 28, 2019
4ff32f0
Fix: Fullscreen sizing on old workpads (#37289)
w33ble May 28, 2019
3f8f363
[Code] Reenable lsp_indexer mocha tests and incooporate language filt…
mw-ding May 28, 2019
0ba4dda
[Code] change Typescript to TypeScript in UI (#37270)
chongzhe May 29, 2019
f1c7940
Remove validation from OIDC endpoint (#37159)
jkakavas May 29, 2019
90fdb14
Remove duplicate fields of rollup based index patterns (#37221)
kertal May 29, 2019
ac3eb85
[SIEM] Replace Eui chart with elastic charts for siem kpis (#36660)
angorayc May 29, 2019
16ab6dd
Visual Builder duration in second showing as number (#35813)
alexwizp May 29, 2019
963152f
Move filter bar and apply filters to data plugin (#36778)
May 29, 2019
580edcd
Introduce Kerberos authentication provider. (#36112)
azasypkin May 29, 2019
e28dc58
[Vis Editor] Fix undefined error in Field control (#37179)
maryia-lapata May 29, 2019
38b95b1
[Vis: Default editor] EUIficate top_sort param editor (#36629)
sulemanof May 29, 2019
8007c3f
[TSVB] [AT] TimeSeries refactor (#36987)
vitalics May 29, 2019
f6e91cc
Upgrade enzyme and enzyme-adapter-react-16 to the latest (#37064)
sulemanof May 29, 2019
906a078
add docs how to use config in New Platform (#36782)
mshustov May 29, 2019
0ff0936
[Vis: Default editor] EUIficate controls of Geohash agg (#37213)
maryia-lapata May 29, 2019
575cdbe
[Code] fix lsp init unit test by using fake timers (#37201)
May 29, 2019
b0c0165
introduce pre-/post-auth request hooks for HttpServer (#36690)
mshustov May 29, 2019
3665ba0
[Vis: Default editor] EUIficate top_aggregate and size param editors …
sulemanof May 29, 2019
1a898b1
[Vis: Default editor] EUIficate Percentile Ranks and Percentiles (#35…
maryia-lapata May 29, 2019
5cc9809
[Docs] i18n docs add japanese (#37233)
Bamieh May 29, 2019
a2542d3
[Vis: Default editor] EUIficate order_agg param editor (#36984)
sulemanof May 29, 2019
e1b2b48
[i18n] JP translations (#37229)
Bamieh May 29, 2019
38eb16d
Security - remove auth scope provider (#36998)
legrego May 29, 2019
78afde9
[SIEM] Update Empty Page Messages (#37251)
May 29, 2019
9cbd5d1
[checks-reporter] reenable (#37280)
May 29, 2019
1ea4b54
[Canvas] Fixes Workpad prop typo (#37351)
cqliu1 May 29, 2019
2f162d4
Remove directory from dockerfiles target (#37258)
Conky5 May 29, 2019
86c3ac4
[Feature/Reporting] Export Saved Search CSV as Dashboard Panel Action…
May 29, 2019
3f78d29
[SIEM] fix data provider query when the field is a timestamp (#37281)
XavierM May 29, 2019
58ef3a3
Add addError function to toastNotifications (#32187)
timroes May 29, 2019
8f693be
bump github-checks-reporter to delay 60s on retries and retry 10x (#3…
mattkime May 29, 2019
461a6c0
[feat] create additional http servers (#36804)
toddself May 29, 2019
07ef100
Configure Renovate (#37385)
renovate[bot] May 29, 2019
ddefbe0
[Code] change suggested clone url (#37354)
zfy0701 May 29, 2019
c4c1377
Fix: handle null argument values (#37411)
w33ble May 29, 2019
5519056
Fix formatdate not allowing strings (#37301)
clintandrewhall May 29, 2019
0965f7c
[Code] add util scripts to run tests/checks (#37365)
zfy0701 May 29, 2019
9169169
Update ArgumentString-related types to simply be TypeString.
lukeelmers May 29, 2019
a9c0e73
Rename types.ts to index.ts so types can be imported at the top level.
lukeelmers May 29, 2019
b54e622
Resolve merge conflicts.
lukeelmers May 29, 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
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,29 @@
* under the License.
*/

// @ts-ignore
import { boolean } from './boolean';
// @ts-ignore
import { datatable } from './datatable';
// @ts-ignore
import { error } from './error';
// @ts-ignore
import { filter } from './filter';
// @ts-ignore
import { image } from './image';
// @ts-ignore
import { nullType } from './null';
// @ts-ignore
import { number } from './number';
// @ts-ignore
import { pointseries } from './pointseries';
// @ts-ignore
import { render } from './render';
// @ts-ignore
import { shape } from './shape';
// @ts-ignore
import { string } from './string';
// @ts-ignore
import { style } from './style';
import { kibanaContext } from './kibana_context';
import { kibanaDatatable } from './kibana_datatable';
Expand All @@ -48,3 +60,6 @@ export const typeSpecs = [
kibanaContext,
kibanaDatatable,
];

export { KibanaContext } from './kibana_context';
export { KibanaDatatable } from './kibana_datatable';
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,23 @@
* under the License.
*/

import { Filters, Query, TimeRange } from 'ui/visualize';

const name = 'kibana_context';

export interface KibanaContext {
type: typeof name;
query?: Query;
filters?: Filters;
timeRange?: TimeRange;
}

export const kibanaContext = () => ({
name: 'kibana_context',
name,
from: {
null: () => {
return {
type: 'kibana_context',
type: name,
};
},
},
Expand All @@ -32,5 +43,5 @@ export const kibanaContext = () => ({
type: 'null',
};
},
}
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,49 @@

import { map } from 'lodash';

const name = 'kibana_datatable';

interface Column {
id: string;
name: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the column not contain any type information? That'd be pretty handy to have in a number of situations. (e.g. type: 'string')

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so -- kibana_datatable is just the tabified data format, e.g.

{
  columns: [{ id: 'foo', name: 'Foo Col' }],
  rows: [{ foo: 'bar' }, { foo: 'baz' }],
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chris, yes it'd be handy, it's not present at the moment, but typed table attribs had come up in discussion. For example, in the context of TS, it could warn that one wants to multiply a numeric column with an alpha column, or filter a time attribute represented as milliseconds since epoch with a range that represents time as days since epoch (ie. the physical type matches but the attribute domains have mismatched semantics).

Also, semantic types would be great for something like.... helping determine Kibana Lens options :-) For example, if an editor knew that those numbers represent time in milliseconds, then appropriate time filters etc. can be added (example is made up, only to illustrate that physical, easy to infer types such as numbers don't help a downstream, uncoupled consumer very much). On the demo day prez for shareable dataviz I touched on using attribute types as a goal, and super early steps.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisdavies ^ I should've used the handle

}

interface Row {
[key: string]: unknown;
}

export interface KibanaDatatable {
type: typeof name;
columns: Column[];
rows: Row[];
}

export const kibanaDatatable = () => ({
name: 'kibana_datatable',
name,
from: {
datatable: context => {
// TODO: import datatable types here instead of using any
datatable: (context: any) => {
return {
type: 'kibana_datatable',
type: name,
rows: context.rows,
columns: context.columns.map(column => {
columns: context.columns.map((column: any) => {
return {
id: column.name,
name: column.name,
};
}),
};
},
pointseries: context => {
const columns = map(context.columns, (column, name) => {
return { id: name, name, ...column };
// TODO: import pointseries types here instead of using any
pointseries: (context: any) => {
const columns = map(context.columns, (column, n) => {
return { id: n, name: n, ...column };
});
return {
type: 'kibana_datatable',
type: name,
rows: context.rows,
columns: columns,
columns,
};
}
},
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@

import { get } from 'lodash';
import { i18n } from '@kbn/i18n';
// @ts-ignore
import { CourierRequestHandlerProvider } from 'ui/vis/request_handlers/courier';
import { AggConfigs } from 'ui/vis/agg_configs';
// @ts-ignore
import { AggConfigs } from 'ui/vis/agg_configs.js';

// need to get rid of angular from these
// @ts-ignore
import { IndexPatternsProvider } from 'ui/index_patterns';
// @ts-ignore
import { SearchSourceProvider } from 'ui/courier/search_source';
import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter';

Expand All @@ -32,37 +36,56 @@ import chrome from 'ui/chrome';
const courierRequestHandlerProvider = CourierRequestHandlerProvider;
const courierRequestHandler = courierRequestHandlerProvider().handler;

export const esaggs = () => ({
name: 'esaggs',
import { ExpressionFunction } from '../types';
import { KibanaContext, KibanaDatatable } from '../../common/types';

const name = 'esaggs';

type Context = KibanaContext | null;

interface Arguments {
index: string | null;
metricsAtAllLevels: boolean;
partialRows: boolean;
aggConfigs: string;
}

type Return = Promise<KibanaDatatable>;

export const esaggs = (): ExpressionFunction<typeof name, Context, Arguments, Return> => ({
name,
type: 'kibana_datatable',
context: {
types: [
'kibana_context',
'null',
],
types: ['kibana_context', 'null'],
},
help: i18n.translate('interpreter.functions.esaggs.help', { defaultMessage: 'Run AggConfig aggregation' }),
help: i18n.translate('interpreter.functions.esaggs.help', {
defaultMessage: 'Run AggConfig aggregation',
}),
args: {
index: {
types: ['string', 'null'],
default: null,
help: '',
},
metricsAtAllLevels: {
types: ['boolean'],
default: false,
help: '',
},
partialRows: {
types: ['boolean'],
default: false,
help: '',
},
aggConfigs: {
types: ['string'],
default: '""',
help: '',
},
},
async fn(context, args, handlers) {
const $injector = await chrome.dangerouslyGetActiveInjector();
const Private = $injector.get('Private');
const Private: Function = $injector.get('Private');
const indexPatterns = Private(IndexPatternsProvider);
const SearchSource = Private(SearchSourceProvider);
const queryFilter = Private(FilterBarQueryFilterProvider);
Expand All @@ -76,9 +99,9 @@ export const esaggs = () => ({
searchSource.setField('index', indexPattern);
searchSource.setField('size', 0);

const response = await courierRequestHandler({
searchSource: searchSource,
aggs: aggs,
const response: Pick<KibanaDatatable, 'columns' | 'rows'> = await courierRequestHandler({
searchSource,
aggs,
timeRange: get(context, 'timeRange', null),
query: get(context, 'query', null),
filters: get(context, 'filters', null),
Expand Down
20 changes: 20 additions & 0 deletions src/legacy/core_plugins/interpreter/public/types.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';
Loading