Skip to content

Commit afa3904

Browse files
Merge branch 'master' into test/lens/chart-data-test-2
2 parents 0d5b6c4 + c0d6e12 commit afa3904

218 files changed

Lines changed: 4042 additions & 40578 deletions

File tree

Some content is hidden

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@
824824
"url-loader": "^2.2.0",
825825
"use-resize-observer": "^6.0.0",
826826
"val-loader": "^1.1.1",
827-
"vega": "^5.17.1",
827+
"vega": "^5.17.3",
828828
"vega-lite": "^4.17.0",
829829
"vega-schema-url-parser": "^2.1.0",
830830
"vega-tooltip": "^0.24.2",

src/plugins/expressions/public/react_expression_renderer.test.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,4 +304,22 @@ describe('ExpressionRenderer', () => {
304304
expect(onEvent).toHaveBeenCalledTimes(1);
305305
expect(onEvent.mock.calls[0][0]).toBe(event);
306306
});
307+
308+
it('should correctly assign classes to the wrapper node', () => {
309+
(ExpressionLoader as jest.Mock).mockImplementation(() => {
310+
return {
311+
render$: new Subject(),
312+
data$: new Subject(),
313+
loading$: new Subject(),
314+
update: jest.fn(),
315+
destroy: jest.fn(),
316+
};
317+
});
318+
319+
const instance = mount(<ReactExpressionRenderer className="myClassName" expression="" />);
320+
// Counte is 2 because the class is applied to ReactExpressionRenderer + internal component
321+
expect(instance.find('.myClassName').length).toBe(2);
322+
323+
instance.unmount();
324+
});
307325
});

src/plugins/expressions/public/react_expression_renderer.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,9 @@ export const ReactExpressionRenderer = ({
211211
}
212212
}, [state.error]);
213213

214-
const classes = classNames('expExpressionRenderer', {
214+
const classes = classNames('expExpressionRenderer', className, {
215215
'expExpressionRenderer-isEmpty': state.isEmpty,
216216
'expExpressionRenderer-hasError': !!state.error,
217-
className,
218217
});
219218

220219
const expressionStyles: React.CSSProperties = {};

src/plugins/vis_type_vislib/public/vis_wrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const VislibWrapper = ({ core, charts, visData, visConfig, handlers }: VislibWra
6161
visController.current?.destroy();
6262
visController.current = null;
6363
};
64-
}, [core, charts, handlers]);
64+
}, [core, charts]);
6565

6666
useEffect(updateChart, [updateChart]);
6767

src/plugins/vis_type_xy/kibana.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
"version": "kibana",
44
"server": true,
55
"ui": true,
6-
"requiredPlugins": ["charts", "data", "expressions", "visualizations"],
6+
"requiredPlugins": ["charts", "data", "expressions", "visualizations", "usageCollection"],
77
"requiredBundles": ["kibanaUtils", "visDefaultEditor"]
88
}

src/plugins/vis_type_xy/public/editor/components/options/point_series/elastic_charts_options.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@
2020
import React from 'react';
2121

2222
import { i18n } from '@kbn/i18n';
23+
import { METRIC_TYPE } from '@kbn/analytics';
2324

2425
import { SelectOption, SwitchOption } from '../../../../../../vis_default_editor/public';
2526

2627
import { ChartType } from '../../../../../common';
2728
import { VisParams } from '../../../../types';
2829
import { ValidationVisOptionsProps } from '../../common';
30+
import { getTrackUiMetric } from '../../../../services';
2931

3032
export function ElasticChartsOptions(props: ValidationVisOptionsProps<VisParams>) {
33+
const trackUiMetric = getTrackUiMetric();
3134
const { stateParams, setValue, vis, aggs } = props;
3235

3336
const hasLineChart = stateParams.seriesParams.some(
@@ -49,7 +52,12 @@ export function ElasticChartsOptions(props: ValidationVisOptionsProps<VisParams>
4952
})}
5053
paramName="detailedTooltip"
5154
value={stateParams.detailedTooltip}
52-
setValue={setValue}
55+
setValue={(paramName, value) => {
56+
if (trackUiMetric) {
57+
trackUiMetric(METRIC_TYPE.CLICK, 'detailed_tooltip_switched');
58+
}
59+
setValue(paramName, value);
60+
}}
5361
/>
5462

5563
{hasLineChart && (
@@ -61,7 +69,12 @@ export function ElasticChartsOptions(props: ValidationVisOptionsProps<VisParams>
6169
options={vis.type.editorConfig.collections.fittingFunctions}
6270
paramName="fittingFunction"
6371
value={stateParams.fittingFunction}
64-
setValue={setValue}
72+
setValue={(paramName, value) => {
73+
if (trackUiMetric) {
74+
trackUiMetric(METRIC_TYPE.CLICK, 'fitting_function_selected');
75+
}
76+
setValue(paramName, value);
77+
}}
6578
/>
6679
)}
6780
</>

src/plugins/vis_type_xy/public/plugin.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { Plugin as ExpressionsPublicPlugin } from '../../expressions/public';
2222
import { VisualizationsSetup, VisualizationsStart } from '../../visualizations/public';
2323
import { ChartsPluginSetup } from '../../charts/public';
2424
import { DataPublicPluginStart } from '../../data/public';
25+
import { UsageCollectionSetup } from '../../usage_collection/public';
2526

2627
import { createVisTypeXyVisFn } from './xy_vis_fn';
2728
import {
@@ -32,6 +33,7 @@ import {
3233
setTimefilter,
3334
setUISettings,
3435
setDocLinks,
36+
setTrackUiMetric,
3537
} from './services';
3638
import { visTypesDefinitions } from './vis_types';
3739
import { LEGACY_CHARTS_LIBRARY } from '../common';
@@ -47,6 +49,7 @@ export interface VisTypeXyPluginSetupDependencies {
4749
expressions: ReturnType<ExpressionsPublicPlugin['setup']>;
4850
visualizations: VisualizationsSetup;
4951
charts: ChartsPluginSetup;
52+
usageCollection: UsageCollectionSetup;
5053
}
5154

5255
/** @internal */
@@ -69,7 +72,7 @@ export class VisTypeXyPlugin
6972
> {
7073
public async setup(
7174
core: VisTypeXyCoreSetup,
72-
{ expressions, visualizations, charts }: VisTypeXyPluginSetupDependencies
75+
{ expressions, visualizations, charts, usageCollection }: VisTypeXyPluginSetupDependencies
7376
) {
7477
if (!core.uiSettings.get(LEGACY_CHARTS_LIBRARY, false)) {
7578
setUISettings(core.uiSettings);
@@ -81,6 +84,8 @@ export class VisTypeXyPlugin
8184
visTypesDefinitions.forEach(visualizations.createBaseVisualization);
8285
}
8386

87+
setTrackUiMetric(usageCollection?.reportUiCounter.bind(usageCollection, 'vis_type_xy'));
88+
8489
return {};
8590
}
8691

src/plugins/vis_type_xy/public/services.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* under the License.
1818
*/
1919

20+
import { UiCounterMetricType } from '@kbn/analytics';
2021
import { CoreSetup, DocLinksStart } from '../../../core/public';
2122
import { createGetterSetter } from '../../kibana_utils/public';
2223
import { DataPublicPluginStart } from '../../data/public';
@@ -47,3 +48,7 @@ export const [getColorsService, setColorsService] = createGetterSetter<
4748
>('xy charts.color');
4849

4950
export const [getDocLinks, setDocLinks] = createGetterSetter<DocLinksStart>('DocLinks');
51+
52+
export const [getTrackUiMetric, setTrackUiMetric] = createGetterSetter<
53+
(metricType: UiCounterMetricType, eventName: string | string[]) => void
54+
>('trackUiMetric');

x-pack/plugins/apm/public/components/app/RumDashboard/UXMetrics/__tests__/KeyUXMetrics.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('KeyUXMetrics', () => {
2323
<KeyUXMetrics
2424
loading={false}
2525
data={{
26-
cls: '0.01',
26+
cls: 0.01,
2727
fid: 6,
2828
lcp: 1701.1142857142856,
2929
tbt: 270.915,

x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/jobs_list.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
import React from 'react';
87
import {
9-
EuiPanel,
10-
EuiTitle,
11-
EuiText,
12-
EuiSpacer,
138
EuiButton,
149
EuiFlexGroup,
1510
EuiFlexItem,
11+
EuiPanel,
12+
EuiSpacer,
13+
EuiText,
14+
EuiTitle,
1615
} from '@elastic/eui';
1716
import { i18n } from '@kbn/i18n';
1817
import { FormattedMessage } from '@kbn/i18n/react';
18+
import React from 'react';
19+
import { getEnvironmentLabel } from '../../../../../common/environment_filter_values';
1920
import { FETCH_STATUS } from '../../../../hooks/use_fetcher';
20-
import { ITableColumn, ManagedTable } from '../../../shared/ManagedTable';
21-
import { LoadingStatePrompt } from '../../../shared/LoadingStatePrompt';
22-
import { MLSingleMetricLink } from '../../../shared/Links/MachineLearningLinks/MLSingleMetricLink';
21+
import { MLExplorerLink } from '../../../shared/Links/MachineLearningLinks/MLExplorerLink';
2322
import { MLManageJobsLink } from '../../../shared/Links/MachineLearningLinks/MLManageJobsLink';
24-
import { getEnvironmentLabel } from '../../../../../common/environment_filter_values';
25-
import { LegacyJobsCallout } from './legacy_jobs_callout';
23+
import { LoadingStatePrompt } from '../../../shared/LoadingStatePrompt';
24+
import { ITableColumn, ManagedTable } from '../../../shared/ManagedTable';
2625
import { AnomalyDetectionApiResponse } from './index';
26+
import { LegacyJobsCallout } from './legacy_jobs_callout';
2727

2828
type Jobs = AnomalyDetectionApiResponse['jobs'];
2929

@@ -44,14 +44,14 @@ const columns: Array<ITableColumn<Jobs[0]>> = [
4444
{ defaultMessage: 'Action' }
4545
),
4646
render: (jobId: string) => (
47-
<MLSingleMetricLink jobId={jobId}>
47+
<MLExplorerLink jobId={jobId}>
4848
{i18n.translate(
4949
'xpack.apm.settings.anomalyDetection.jobList.mlJobLinkText',
5050
{
5151
defaultMessage: 'View job in ML',
5252
}
5353
)}
54-
</MLSingleMetricLink>
54+
</MLExplorerLink>
5555
),
5656
},
5757
];

0 commit comments

Comments
 (0)