Skip to content

Commit 96050a2

Browse files
authored
Merge branch 'master' into dls.apm.cl
2 parents f30f689 + 705fe22 commit 96050a2

File tree

98 files changed

+1864
-480
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1864
-480
lines changed

docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ readonly links: {
1313
readonly kibanaSettings: string;
1414
readonly supportedServiceMaps: string;
1515
readonly customLinks: string;
16+
readonly droppedTransactionSpans: string;
17+
readonly upgrading: string;
18+
readonly metaData: string;
1619
};
1720
readonly canvas: {
1821
readonly guide: string;

docs/development/core/public/kibana-plugin-core-public.doclinksstart.md

Lines changed: 2 additions & 0 deletions
Large diffs are not rendered by default.

src/core/public/doc_links/doc_links_service.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export class DocLinksService {
2424
const KIBANA_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/`;
2525
const FLEET_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/fleet/${DOC_LINK_VERSION}/`;
2626
const PLUGIN_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/plugins/${DOC_LINK_VERSION}/`;
27+
const APM_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/apm/`;
2728

2829
return deepFreeze({
2930
DOC_LINK_VERSION,
@@ -34,6 +35,9 @@ export class DocLinksService {
3435
kibanaSettings: `${KIBANA_DOCS}apm-settings-in-kibana.html`,
3536
supportedServiceMaps: `${KIBANA_DOCS}service-maps.html#service-maps-supported`,
3637
customLinks: `${KIBANA_DOCS}custom-links.html`,
38+
droppedTransactionSpans: `${APM_DOCS}get-started/${DOC_LINK_VERSION}/transaction-spans.html#dropped-spans`,
39+
upgrading: `${APM_DOCS}server/${DOC_LINK_VERSION}/upgrading.html`,
40+
metaData: `${APM_DOCS}get-started/${DOC_LINK_VERSION}/metadata.html`,
3741
},
3842
canvas: {
3943
guide: `${KIBANA_DOCS}canvas.html`,
@@ -460,6 +464,9 @@ export interface DocLinksStart {
460464
readonly kibanaSettings: string;
461465
readonly supportedServiceMaps: string;
462466
readonly customLinks: string;
467+
readonly droppedTransactionSpans: string;
468+
readonly upgrading: string;
469+
readonly metaData: string;
463470
};
464471
readonly canvas: {
465472
readonly guide: string;

src/core/public/public.api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,9 @@ export interface DocLinksStart {
477477
readonly kibanaSettings: string;
478478
readonly supportedServiceMaps: string;
479479
readonly customLinks: string;
480+
readonly droppedTransactionSpans: string;
481+
readonly upgrading: string;
482+
readonly metaData: string;
480483
};
481484
readonly canvas: {
482485
readonly guide: string;

src/dev/storybook/aliases.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const storybookAliases = {
2323
expression_repeat_image: 'src/plugins/expression_repeat_image/.storybook',
2424
expression_reveal_image: 'src/plugins/expression_reveal_image/.storybook',
2525
expression_shape: 'src/plugins/expression_shape/.storybook',
26+
expression_tagcloud: 'src/plugins/chart_expressions/expression_tagcloud/.storybook',
2627
infra: 'x-pack/plugins/infra/.storybook',
2728
security_solution: 'x-pack/plugins/security_solution/.storybook',
2829
ui_actions_enhanced: 'x-pack/plugins/ui_actions_enhanced/.storybook',
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
5+
* in compliance with, at your election, the Elastic License 2.0 or the Server
6+
* Side Public License, v 1.
7+
*/
8+
import { defaultConfig } from '@kbn/storybook';
9+
import webpackMerge from 'webpack-merge';
10+
import { resolve } from 'path';
11+
12+
const mockConfig = {
13+
resolve: {
14+
alias: {
15+
'../format_service': resolve(__dirname, '../public/__mocks__/format_service.ts'),
16+
},
17+
},
18+
};
19+
20+
module.exports = {
21+
...defaultConfig,
22+
webpackFinal: (config) => webpackMerge(config, mockConfig),
23+
};

src/plugins/chart_expressions/expression_tagcloud/common/expression_functions/__snapshots__/tagcloud_function.test.ts.snap

Lines changed: 94 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/plugins/chart_expressions/expression_tagcloud/common/expression_functions/tagcloud_function.test.ts

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,76 @@
99
import { tagcloudFunction } from './tagcloud_function';
1010

1111
import { functionWrapper } from '../../../../expressions/common/expression_functions/specs/tests/utils';
12+
import { ExpressionValueVisDimension } from '../../../../visualizations/public';
1213
import { Datatable } from '../../../../expressions/common/expression_types/specs';
1314

1415
describe('interpreter/functions#tagcloud', () => {
1516
const fn = functionWrapper(tagcloudFunction());
17+
const column1 = 'Count';
18+
const column2 = 'country';
1619
const context = {
1720
type: 'datatable',
18-
rows: [{ 'col-0-1': 0 }],
19-
columns: [{ id: 'col-0-1', name: 'Count' }],
21+
columns: [
22+
{ id: column1, name: column1 },
23+
{ id: column2, name: column2 },
24+
],
25+
rows: [
26+
{ [column1]: 0, [column2]: 'US' },
27+
{ [column1]: 10, [column2]: 'UK' },
28+
],
2029
};
2130
const visConfig = {
2231
scale: 'linear',
2332
orientation: 'single',
2433
minFontSize: 18,
2534
maxFontSize: 72,
2635
showLabel: true,
27-
metric: { accessor: 0, format: { id: 'number' } },
28-
bucket: { accessor: 1, format: { id: 'number' } },
2936
};
3037

31-
it('returns an object with the correct structure', () => {
32-
const actual = fn(context, visConfig, undefined);
38+
const numberAccessors = {
39+
metric: { accessor: 0 },
40+
bucket: { accessor: 1 },
41+
};
42+
43+
const stringAccessors: {
44+
metric: ExpressionValueVisDimension;
45+
bucket: ExpressionValueVisDimension;
46+
} = {
47+
metric: {
48+
type: 'vis_dimension',
49+
accessor: {
50+
id: column1,
51+
name: column1,
52+
meta: {
53+
type: 'number',
54+
},
55+
},
56+
format: {
57+
params: {},
58+
},
59+
},
60+
bucket: {
61+
type: 'vis_dimension',
62+
accessor: {
63+
id: column2,
64+
name: column2,
65+
meta: {
66+
type: 'string',
67+
},
68+
},
69+
format: {
70+
params: {},
71+
},
72+
},
73+
};
74+
75+
it('returns an object with the correct structure for number accessors', () => {
76+
const actual = fn(context, { ...visConfig, ...numberAccessors }, undefined);
77+
expect(actual).toMatchSnapshot();
78+
});
79+
80+
it('returns an object with the correct structure for string accessors', () => {
81+
const actual = fn(context, { ...visConfig, ...stringAccessors }, undefined);
3382
expect(actual).toMatchSnapshot();
3483
});
3584

@@ -44,7 +93,7 @@ describe('interpreter/functions#tagcloud', () => {
4493
},
4594
},
4695
};
47-
await fn(context, visConfig, handlers as any);
96+
await fn(context, { ...visConfig, ...numberAccessors }, handlers as any);
4897

4998
expect(loggedTable!).toMatchSnapshot();
5099
});

src/plugins/chart_expressions/expression_tagcloud/common/expression_functions/tagcloud_function.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import { i18n } from '@kbn/i18n';
99

1010
import { prepareLogTable, Dimension } from '../../../../visualizations/common/prepare_log_table';
11-
import { TagCloudVisParams } from '../types';
11+
import { TagCloudRendererParams } from '../types';
1212
import { ExpressionTagcloudFunction } from '../types';
1313
import { EXPRESSION_NAME } from '../constants';
1414

@@ -125,7 +125,7 @@ export const tagcloudFunction: ExpressionTagcloudFunction = () => {
125125
},
126126
},
127127
fn(input, args, handlers) {
128-
const visParams = {
128+
const visParams: TagCloudRendererParams = {
129129
scale: args.scale,
130130
orientation: args.orientation,
131131
minFontSize: args.minFontSize,
@@ -139,7 +139,7 @@ export const tagcloudFunction: ExpressionTagcloudFunction = () => {
139139
type: 'palette',
140140
name: args.palette,
141141
},
142-
} as TagCloudVisParams;
142+
};
143143

144144
if (handlers?.inspectorAdapters?.tables) {
145145
const argsTable: Dimension[] = [[[args.metric], dimension.tagSize]];

src/plugins/chart_expressions/expression_tagcloud/common/types/expression_functions.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,10 @@ import {
1010
Datatable,
1111
ExpressionFunctionDefinition,
1212
ExpressionValueRender,
13-
SerializedFieldFormat,
1413
} from '../../../../expressions';
1514
import { ExpressionValueVisDimension } from '../../../../visualizations/common';
1615
import { EXPRESSION_NAME } from '../constants';
1716

18-
interface Dimension {
19-
accessor: number;
20-
format: {
21-
id?: string;
22-
params?: SerializedFieldFormat<object>;
23-
};
24-
}
25-
2617
interface TagCloudCommonParams {
2718
scale: 'linear' | 'log' | 'square root';
2819
orientation: 'single' | 'right angled' | 'multiple';
@@ -36,16 +27,16 @@ export interface TagCloudVisConfig extends TagCloudCommonParams {
3627
bucket?: ExpressionValueVisDimension;
3728
}
3829

39-
export interface TagCloudVisParams extends TagCloudCommonParams {
30+
export interface TagCloudRendererParams extends TagCloudCommonParams {
4031
palette: PaletteOutput;
41-
metric: Dimension;
42-
bucket?: Dimension;
32+
metric: ExpressionValueVisDimension;
33+
bucket?: ExpressionValueVisDimension;
4334
}
4435

4536
export interface TagcloudRendererConfig {
4637
visType: typeof EXPRESSION_NAME;
4738
visData: Datatable;
48-
visParams: TagCloudVisParams;
39+
visParams: TagCloudRendererParams;
4940
syncColors: boolean;
5041
}
5142

0 commit comments

Comments
 (0)