Skip to content

Commit

Permalink
Merge branch 'main' of github.com:elastic/kibana
Browse files Browse the repository at this point in the history
  • Loading branch information
thomheymann committed Jan 24, 2022
2 parents 17b997e + fd340b9 commit fa15574
Show file tree
Hide file tree
Showing 828 changed files with 11,541 additions and 21,616 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ snapshots.js
/packages/kbn-test/src/functional_test_runner/__tests__/fixtures/
/packages/kbn-test/src/functional_test_runner/lib/config/__tests__/fixtures/
/packages/kbn-ui-framework/dist
/packages/kbn-ui-shared-deps-src/src/flot_charts
/packages/kbn-flot-charts/lib
/packages/kbn-monaco/src/painless/antlr

# Bazel
Expand Down
6 changes: 1 addition & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,6 @@ const RESTRICTED_IMPORTS = [
name: 'react-use',
message: 'Please use react-use/lib/{method} instead.',
},
{
name: '@kbn/io-ts-utils',
message: `Import directly from @kbn/io-ts-utils/{method} submodules`,
},
];

module.exports = {
Expand Down Expand Up @@ -1569,7 +1565,7 @@ module.exports = {
},
},
{
files: ['packages/kbn-ui-shared-deps-src/src/flot_charts/**/*.js'],
files: ['packages/kbn-flot-charts/lib/**/*.js'],
env: {
jquery: true,
},
Expand Down
2 changes: 1 addition & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"expressionShape": "src/plugins/expression_shape",
"expressionTagcloud": "src/plugins/chart_expressions/expression_tagcloud",
"fieldFormats": "src/plugins/field_formats",
"flot": "packages/kbn-ui-shared-deps-src/src/flot_charts",
"flot": "packages/kbn-flot-charts/lib",
"home": "src/plugins/home",
"indexPatternEditor": "src/plugins/data_view_editor",
"indexPatternFieldEditor": "src/plugins/data_view_field_editor",
Expand Down
2 changes: 2 additions & 0 deletions docs/canvas/canvas-expression-lifecycle.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ To use demo dataset available in Canvas to produce a table, run the following ex

[source,text]
----
/* Simple demo table */
filters
| demodata
| table
Expand All @@ -24,6 +25,7 @@ This expression starts out with the <<filters_fn, filters>> function, which prov

The filtered <<demodata_fn, demo data>> becomes the _context_ of the next function, <<table_fn, table>>, which creates a table visualization from this data set. The <<table_fn, table>> function isn’t strictly required, but by being explicit, you have the option of providing arguments to control things like the font used in the table. The output of the <<table_fn, table>> function becomes the _context_ of the <<render_fn, render>> function. Like the <<table_fn, table>>, the <<render_fn, render>> function isn’t required either, but it allows access to other arguments, such as styling the border of the element or injecting custom CSS.

It is possible to add comments to the expression by starting them with a `//` sequence or by using `/*` and `*/` to enclose multi-line comments.

[[canvas-function-arguments]]
=== Function arguments
Expand Down
3 changes: 3 additions & 0 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ All the arguments to expression functions need to be serializable, as well as in
Expression functions should try to stay 'pure'. This makes functions easy to reuse and also
make it possible to serialize the whole chain as well as output at every step of execution.
It is possible to add comments to expressions by starting them with a `//` sequence
or by using `/*` and `*/` to enclose multi-line comments.
Expressions power visualizations in Dashboard and Lens, as well as, every
*element* in Canvas is backed by an expression.
Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"**/istanbul-lib-coverage": "^3.2.0",
"**/json-schema": "^0.4.0",
"**/minimist": "^1.2.5",
"**/node-forge": "^1.1.0",
"**/node-forge": "^1.2.1",
"**/pdfkit/crypto-js": "4.0.0",
"**/react-syntax-highlighter": "^15.3.1",
"**/react-syntax-highlighter/**/highlight.js": "^10.4.1",
Expand Down Expand Up @@ -137,6 +137,7 @@
"@kbn/crypto": "link:bazel-bin/packages/kbn-crypto",
"@kbn/es-query": "link:bazel-bin/packages/kbn-es-query",
"@kbn/field-types": "link:bazel-bin/packages/kbn-field-types",
"@kbn/flot-charts": "link:bazel-bin/packages/kbn-flot-charts",
"@kbn/i18n": "link:bazel-bin/packages/kbn-i18n",
"@kbn/i18n-react": "link:bazel-bin/packages/kbn-i18n-react",
"@kbn/interpreter": "link:bazel-bin/packages/kbn-interpreter",
Expand Down Expand Up @@ -169,6 +170,7 @@
"@kbn/ui-framework": "link:bazel-bin/packages/kbn-ui-framework",
"@kbn/ui-shared-deps-npm": "link:bazel-bin/packages/kbn-ui-shared-deps-npm",
"@kbn/ui-shared-deps-src": "link:bazel-bin/packages/kbn-ui-shared-deps-src",
"@kbn/ui-theme": "link:bazel-bin/packages/kbn-ui-theme",
"@kbn/utility-types": "link:bazel-bin/packages/kbn-utility-types",
"@kbn/utils": "link:bazel-bin/packages/kbn-utils",
"@loaders.gl/core": "^2.3.1",
Expand Down Expand Up @@ -300,7 +302,7 @@
"mustache": "^2.3.2",
"nock": "12.0.3",
"node-fetch": "^2.6.1",
"node-forge": "^1.1.0",
"node-forge": "^1.2.1",
"nodemailer": "^6.6.2",
"normalize-path": "^3.0.0",
"object-hash": "^1.3.1",
Expand Down Expand Up @@ -340,7 +342,7 @@
"react-moment-proptypes": "^1.7.0",
"react-monaco-editor": "^0.41.2",
"react-popper-tooltip": "^2.10.1",
"react-query": "^3.28.0",
"react-query": "^3.34.0",
"react-redux": "^7.2.0",
"react-resizable": "^1.7.5",
"react-resize-detector": "^4.2.0",
Expand Down Expand Up @@ -576,6 +578,7 @@
"@types/kbn__i18n": "link:bazel-bin/packages/kbn-i18n/npm_module_types",
"@types/kbn__i18n-react": "link:bazel-bin/packages/kbn-i18n-react/npm_module_types",
"@types/kbn__interpreter": "link:bazel-bin/packages/kbn-interpreter/npm_module_types",
"@types/kbn__io-ts-utils": "link:bazel-bin/packages/kbn-io-ts-utils/npm_module_types",
"@types/kbn__mapbox-gl": "link:bazel-bin/packages/kbn-mapbox-gl/npm_module_types",
"@types/kbn__monaco": "link:bazel-bin/packages/kbn-monaco/npm_module_types",
"@types/kbn__optimizer": "link:bazel-bin/packages/kbn-optimizer/npm_module_types",
Expand All @@ -602,6 +605,8 @@
"@types/kbn__std": "link:bazel-bin/packages/kbn-std/npm_module_types",
"@types/kbn__telemetry-tools": "link:bazel-bin/packages/kbn-telemetry-tools/npm_module_types",
"@types/kbn__ui-shared-deps-npm": "link:bazel-bin/packages/kbn-ui-shared-deps-npm/npm_module_types",
"@types/kbn__ui-shared-deps-src": "link:bazel-bin/packages/kbn-ui-shared-deps-src/npm_module_types",
"@types/kbn__ui-theme": "link:bazel-bin/packages/kbn-ui-theme/npm_module_types",
"@types/kbn__utility-types": "link:bazel-bin/packages/kbn-utility-types/npm_module_types",
"@types/kbn__utils": "link:bazel-bin/packages/kbn-utils/npm_module_types",
"@types/license-checker": "15.0.0",
Expand Down
5 changes: 5 additions & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ filegroup(
"//packages/kbn-eslint-plugin-eslint:build",
"//packages/kbn-expect:build",
"//packages/kbn-field-types:build",
"//packages/kbn-flot-charts:build",
"//packages/kbn-i18n:build",
"//packages/kbn-i18n-react:build",
"//packages/kbn-interpreter:build",
Expand Down Expand Up @@ -66,6 +67,7 @@ filegroup(
"//packages/kbn-ui-framework:build",
"//packages/kbn-ui-shared-deps-npm:build",
"//packages/kbn-ui-shared-deps-src:build",
"//packages/kbn-ui-theme:build",
"//packages/kbn-utility-types:build",
"//packages/kbn-utils:build",
],
Expand Down Expand Up @@ -95,6 +97,7 @@ filegroup(
"//packages/kbn-i18n:build_types",
"//packages/kbn-i18n-react:build_types",
"//packages/kbn-interpreter:build_types",
"//packages/kbn-io-ts-utils:build_types",
"//packages/kbn-mapbox-gl:build_types",
"//packages/kbn-monaco:build_types",
"//packages/kbn-optimizer:build_types",
Expand All @@ -121,6 +124,8 @@ filegroup(
"//packages/kbn-std:build_types",
"//packages/kbn-telemetry-tools:build_types",
"//packages/kbn-ui-shared-deps-npm:build_types",
"//packages/kbn-ui-shared-deps-src:build_types",
"//packages/kbn-ui-theme:build_types",
"//packages/kbn-utility-types:build_types",
"//packages/kbn-utils:build_types",
],
Expand Down
2 changes: 1 addition & 1 deletion packages/elastic-eslint-config-kibana/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ module.exports = {
].map(from => ({
from,
to: false,
disallowedMessage: `Use "@kbn/ui-shared-deps-src/theme" to access theme vars.`
disallowedMessage: `Use "@kbn/ui-theme" to access theme vars.`
})),
],
],
Expand Down
File renamed without changes.
51 changes: 51 additions & 0 deletions packages/kbn-flot-charts/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "pkg_npm")

PKG_BASE_NAME = "kbn-flot-charts"
PKG_REQUIRE_NAME = "@kbn/flot-charts"

SOURCE_FILES = glob([
"lib/**/*.js",
"index.js",
])

SRCS = SOURCE_FILES

filegroup(
name = "srcs",
srcs = SRCS,
)

NPM_MODULE_EXTRA_FILES = [
"package.json",
"API.md",
]

RUNTIME_DEPS = [
"//packages/kbn-i18n",
]

js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES + [
":srcs",
],
deps = RUNTIME_DEPS,
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)

pkg_npm(
name = "npm_module",
deps = [
":%s" % PKG_BASE_NAME,
]
)

filegroup(
name = "build",
srcs = [
":npm_module",
],
visibility = ["//visibility:public"],
)
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* 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.
*/

/* @notice
*
* This product includes code that is based on flot-charts, which was available
Expand Down Expand Up @@ -26,15 +34,15 @@
* THE SOFTWARE.
*/

import './jquery_flot';
import './jquery_flot_canvas';
import './jquery_flot_time';
import './jquery_flot_symbol';
import './jquery_flot_crosshair';
import './jquery_flot_selection';
import './jquery_flot_pie';
import './jquery_flot_stack';
import './jquery_flot_threshold';
import './jquery_flot_fillbetween';
import './jquery_flot_log';
import './jquery_flot_axislabels';
import './lib/jquery_flot';
import './lib/jquery_flot_canvas';
import './lib/jquery_flot_time';
import './lib/jquery_flot_symbol';
import './lib/jquery_flot_crosshair';
import './lib/jquery_flot_selection';
import './lib/jquery_flot_pie';
import './lib/jquery_flot_stack';
import './lib/jquery_flot_threshold';
import './lib/jquery_flot_fillbetween';
import './lib/jquery_flot_log';
import './lib/jquery_flot_axislabels';
File renamed without changes.
7 changes: 7 additions & 0 deletions packages/kbn-flot-charts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@kbn/flot-charts",
"version": "1.0.0",
"private": true,
"main": "./index.js",
"license": "SSPL-1.0 OR Elastic License 2.0"
}
22 changes: 17 additions & 5 deletions packages/kbn-interpreter/grammar/grammar.peggy
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ start
= expression

expression
= space? first:function? rest:('|' space? fn:function { return fn; })* {
= blank? first:function? rest:('|' blank? fn:function { return fn; })* {
return addMeta({
type: 'expression',
chain: first ? [first].concat(rest) : []
Expand All @@ -44,7 +44,7 @@ function "function"
/* ----- Arguments ----- */

argument_assignment
= name:identifier space? '=' space? value:argument {
= name:identifier blank? '=' blank? value:argument {
return { name, value };
}
/ value:argument {
Expand All @@ -58,7 +58,7 @@ argument
}

arg_list
= args:(space arg:argument_assignment { return arg; })* space? {
= args:(blank arg:argument_assignment { return arg; })* blank? {
return args.reduce((accumulator, { name, value }) => ({
...accumulator,
[name]: (accumulator[name] || []).concat(value)
Expand All @@ -82,7 +82,7 @@ phrase

unquoted_string_or_number
// Make sure we're not matching the beginning of a search
= string:unquoted+ { // this also matches nulls, booleans, and numbers
= !comment string:unquoted+ { // this also matches nulls, booleans, and numbers
var result = string.join('');
// Sort of hacky, but PEG doesn't have backtracking so
// a null/boolean/number rule is hard to read, and performs worse
Expand All @@ -93,8 +93,20 @@ unquoted_string_or_number
return Number(result);
}

blank
= (space / comment)+

space
= [\ \t\r\n]+
= [\ \t\r\n]

comment
= inline_comment / multiline_comment

inline_comment
= "//" [^\n]*

multiline_comment
= "/*" (!"*/" .)* "*/"?

unquoted
= "\\" sequence:([\"'(){}<>\[\]$`|=\ \t\n\r] / "\\") { return sequence; }
Expand Down
22 changes: 17 additions & 5 deletions packages/kbn-interpreter/src/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,26 @@
* Side Public License, v 1.
*/

export type { Ast, ExpressionFunctionAST } from './lib/ast';
export { fromExpression, toExpression, safeElementFromExpression } from './lib/ast';
export type {
Ast,
AstArgument,
AstFunction,
AstNode,
AstWithMeta,
AstArgumentWithMeta,
AstFunctionWithMeta,
} from './lib/ast';
export {
fromExpression,
isAst,
isAstWithMeta,
toExpression,
safeElementFromExpression,
} from './lib/ast';
export { Fn } from './lib/fn';
export { getType } from './lib/get_type';
export { castProvider } from './lib/cast';
// @ts-expect-error
// @internal
export { parse } from '../../grammar';
export { parse } from './lib/parse';
export { getByAlias } from './lib/get_by_alias';
export { Registry } from './lib/registry';
export { addRegistries, register, registryFactory } from './registries';
Loading

0 comments on commit fa15574

Please sign in to comment.