Skip to content

Commit

Permalink
Merge branch 'main' into feat/so-type-validation
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Jan 5, 2022
2 parents fe183e5 + f793411 commit d737fb8
Show file tree
Hide file tree
Showing 195 changed files with 9,476 additions and 1,122 deletions.
4 changes: 3 additions & 1 deletion .buildkite/pipelines/flaky_tests/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ function getTestSuitesFromMetadata() {
}

const value =
overrideCount || execSync(`buildkite-agent meta-data get '${key}'`).toString().trim();
overrideCount && overrideCount !== '0'
? overrideCount
: execSync(`buildkite-agent meta-data get '${key}'`).toString().trim();

const count = value === '' ? defaultCount : parseInt(value);
testSuites.push({
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 @@ -40,6 +40,7 @@
/src/plugins/chart_expressions/expression_metric/ @elastic/kibana-vis-editors
/src/plugins/chart_expressions/expression_heatmap/ @elastic/kibana-vis-editors
/src/plugins/chart_expressions/expression_gauge/ @elastic/kibana-vis-editors
/src/plugins/chart_expressions/expression_pie/ @elastic/kibana-vis-editors
/src/plugins/url_forwarding/ @elastic/kibana-vis-editors
/packages/kbn-tinymath/ @elastic/kibana-vis-editors
/x-pack/test/functional/apps/lens @elastic/kibana-vis-editors
Expand Down
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"expressionGauge": "src/plugins/chart_expressions/expression_gauge",
"expressionTagcloud": "src/plugins/chart_expressions/expression_tagcloud",
"expressionMetricVis": "src/plugins/chart_expressions/expression_metric",
"expressionPie": "src/plugins/chart_expressions/expression_pie",
"inputControl": "src/plugins/input_control_vis",
"inspector": "src/plugins/inspector",
"inspectorViews": "src/legacy/core_plugins/inspector_views",
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 @@ -114,6 +114,10 @@ This API doesn't support angular, for registering angular dev tools, bootstrap a
|Expression MetricVis plugin adds a metric renderer and function to the expression plugin. The renderer will display the metric chart.
|{kib-repo}blob/{branch}/src/plugins/chart_expressions/expression_pie/README.md[expressionPie]
|Expression Pie plugin adds a pie renderer and function to the expression plugin. The renderer will display the Pie chart.
|{kib-repo}blob/{branch}/src/plugins/expression_repeat_image/README.md[expressionRepeatImage]
|Expression Repeat Image plugin adds a repeatImage function to the expression plugin and an associated renderer. The renderer will display the given image in mutliple instances.
Expand Down
1 change: 1 addition & 0 deletions nav-kibana-dev.docnav.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
{
"category": "Contributors Newsletters",
"items": [
{ "id": "kibDecember2021ContributorNewsletter" },
{ "id": "kibNovember2021ContributorNewsletter" },
{ "id": "kibOctober2021ContributorNewsletter" },
{ "id": "kibSeptember2021ContributorNewsletter" },
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
"**/istanbul-lib-coverage": "^3.2.0",
"**/json-schema": "^0.4.0",
"**/minimist": "^1.2.5",
"**/node-jose/node-forge": "^0.10.0",
"**/pdfkit/crypto-js": "4.0.0",
"**/react-syntax-highlighter": "^15.3.1",
"**/react-syntax-highlighter/**/highlight.js": "^10.4.1",
Expand All @@ -112,7 +111,7 @@
"@elastic/node-crypto": "1.2.1",
"@elastic/numeral": "^2.5.1",
"@elastic/react-search-ui": "^1.6.0",
"@elastic/request-crypto": "1.1.4",
"@elastic/request-crypto": "2.0.0",
"@elastic/safer-lodash-set": "link:bazel-bin/packages/elastic-safer-lodash-set",
"@elastic/search-ui-app-search-connector": "^1.6.0",
"@emotion/cache": "^11.4.0",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,4 @@ pageLoadAssetSize:
visTypeHeatmap: 25340
screenshotting: 17017
expressionGauge: 25000
expressionPie: 26338
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export const action = t.exact(
})
);

export type Action = t.TypeOf<typeof action>;

export const actions = t.array(action);
export type Actions = t.TypeOf<typeof actions>;

Expand Down
6 changes: 6 additions & 0 deletions packages/kbn-storybook/src/lib/default_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ export const defaultConfig: StorybookConfig = {
features: {
postcss: false,
},
// @ts-expect-error StorybookConfig type is incomplete
// https://storybook.js.org/docs/react/configure/babel#custom-configuration
babel: async (options) => {
options.presets.push('@emotion/babel-preset-css-prop');
return options;
},
webpackFinal: (config, options) => {
if (process.env.CI) {
config.parallelism = 4;
Expand Down
9 changes: 9 additions & 0 deletions src/plugins/chart_expressions/expression_pie/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# expressionPie

Expression Pie plugin adds a `pie` renderer and function to the expression plugin. The renderer will display the `Pie` chart.

---

## Development

See the [kibana contributing guide](https:/elastic/kibana/blob/main/CONTRIBUTING.md) for instructions setting up your development environment.
16 changes: 16 additions & 0 deletions src/plugins/chart_expressions/expression_pie/common/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* 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.
*/

export const PLUGIN_ID = 'expressionPie';
export const PLUGIN_NAME = 'expressionPie';

export const PIE_VIS_EXPRESSION_NAME = 'pie_vis';
export const PIE_LABELS_VALUE = 'pie_labels_value';
export const PIE_LABELS_FUNCTION = 'pie_labels';

export const DEFAULT_PERCENT_DECIMALS = 2;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* 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.
*/

export { pieVisFunction } from './pie_vis_function';
export { pieLabelsFunction } from './pie_labels_function';
Original file line number Diff line number Diff line change
Expand Up @@ -7,100 +7,75 @@
*/

import { i18n } from '@kbn/i18n';
import {
ExpressionFunctionDefinition,
Datatable,
ExpressionValueBoxed,
} from '../../../../expressions/public';
import { ExpressionFunctionDefinition, Datatable } from '../../../../expressions/common';
import { PIE_LABELS_FUNCTION, PIE_LABELS_VALUE } from '../constants';
import { ExpressionValuePieLabels, PieLabelsArguments } from '../types/expression_functions';

interface Arguments {
show: boolean;
position: string;
values: boolean;
truncate: number | null;
valuesFormat: string;
lastLevel: boolean;
percentDecimals: number;
}

export type ExpressionValuePieLabels = ExpressionValueBoxed<
'pie_labels',
{
show: boolean;
position: string;
values: boolean;
truncate: number | null;
valuesFormat: string;
last_level: boolean;
percentDecimals: number;
}
>;

export const pieLabels = (): ExpressionFunctionDefinition<
'pielabels',
export const pieLabelsFunction = (): ExpressionFunctionDefinition<
typeof PIE_LABELS_FUNCTION,
Datatable | null,
Arguments,
PieLabelsArguments,
ExpressionValuePieLabels
> => ({
name: 'pielabels',
help: i18n.translate('visTypePie.function.pieLabels.help', {
name: PIE_LABELS_FUNCTION,
help: i18n.translate('expressionPie.pieLabels.function.help', {
defaultMessage: 'Generates the pie labels object',
}),
type: 'pie_labels',
type: PIE_LABELS_VALUE,
args: {
show: {
types: ['boolean'],
help: i18n.translate('visTypePie.function.pieLabels.show.help', {
help: i18n.translate('expressionPie.pieLabels.function.args.show.help', {
defaultMessage: 'Displays the pie labels',
}),
required: true,
},
position: {
types: ['string'],
default: 'default',
help: i18n.translate('visTypePie.function.pieLabels.position.help', {
help: i18n.translate('expressionPie.pieLabels.function.args.position.help', {
defaultMessage: 'Defines the label position',
}),
},
values: {
types: ['boolean'],
help: i18n.translate('visTypePie.function.pieLabels.values.help', {
help: i18n.translate('expressionPie.pieLabels.function.args.values.help', {
defaultMessage: 'Displays the values inside the slices',
}),
default: true,
},
percentDecimals: {
types: ['number'],
help: i18n.translate('visTypePie.function.pieLabels.percentDecimals.help', {
help: i18n.translate('expressionPie.pieLabels.function.args.percentDecimals.help', {
defaultMessage: 'Defines the number of decimals that will appear on the values as percent',
}),
default: 2,
},
lastLevel: {
types: ['boolean'],
help: i18n.translate('visTypePie.function.pieLabels.lastLevel.help', {
help: i18n.translate('expressionPie.pieLabels.function.args.lastLevel.help', {
defaultMessage: 'Show top level labels only',
}),
default: true,
},
truncate: {
types: ['number', 'null'],
help: i18n.translate('visTypePie.function.pieLabels.truncate.help', {
types: ['number'],
help: i18n.translate('expressionPie.pieLabels.function.args.truncate.help', {
defaultMessage: 'Defines the number of characters that the slice value will display',
}),
default: null,
},
valuesFormat: {
types: ['string'],
default: 'percent',
help: i18n.translate('visTypePie.function.pieLabels.valuesFormat.help', {
help: i18n.translate('expressionPie.pieLabels.function.args.valuesFormat.help', {
defaultMessage: 'Defines the format of the values',
}),
},
},
fn: (context, args) => {
return {
type: 'pie_labels',
type: PIE_LABELS_VALUE,
show: args.show,
position: args.position,
percentDecimals: args.percentDecimals,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
* Side Public License, v 1.
*/

import { functionWrapper } from '../../../expressions/common/expression_functions/specs/tests/utils';
import { createPieVisFn } from './pie_fn';
import { PieVisConfig } from './types';
import { Datatable } from '../../../expressions/common/expression_types/specs';
import { EMPTY_SIZE_RATIOS } from './editor/constants';
import { functionWrapper } from '../../../../expressions/common/expression_functions/specs/tests/utils';
import { PieVisConfig, EmptySizeRatios } from '../types/expression_renderers';
import { pieVisFunction } from './pie_vis_function';
import { Datatable } from '../../../../expressions/common/expression_types/specs';

describe('interpreter/functions#pie', () => {
const fn = functionWrapper(createPieVisFn());
const fn = functionWrapper(pieVisFunction());
const context = {
type: 'datatable',
rows: [{ 'col-0-1': 0 }],
columns: [{ id: 'col-0-1', name: 'Count' }],
} as unknown as Datatable;

const visConfig = {
addTooltip: true,
addLegend: true,
legendPosition: 'right',
isDonut: true,
emptySizeRatio: EMPTY_SIZE_RATIOS.SMALL,
emptySizeRatio: EmptySizeRatios.SMALL,
nestedLegend: true,
truncateLegend: true,
maxLegendLines: true,
Expand Down
Loading

0 comments on commit d737fb8

Please sign in to comment.