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

fix(plugin-chart-echarts): [feature-parity] apply button of annotation layer doesn't work as expected #19761

Merged
merged 3 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const annotationLayers = [];
export const annotationsAndLayersControls: ControlPanelSectionConfig = {
label: t('Annotations and Layers'),
expanded: false,
tabOverride: 'data',
controlSetRows: [
[
{
Expand All @@ -33,6 +34,7 @@ export const annotationsAndLayersControls: ControlPanelSectionConfig = {
label: '',
default: annotationLayers,
description: t('Annotation Layers'),
renderTrigger: true,
Copy link
Member

Choose a reason for hiding this comment

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

@stephenLYZ the renderTrigger == ture means that client rerenders and doesn't send a query, but here is an exception. add a comment here. Thanks!

},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import { legendSection, richTooltipSection, xAxisControl } from '../controls';

const {
area,
annotationLayers,
logAxis,
markerEnabled,
markerSize,
Expand Down Expand Up @@ -289,23 +288,7 @@ const config: ControlPanelConfig = {
createAdvancedAnalyticsSection(t('Advanced analytics Query A'), ''),
createQuerySection(t('Query B'), '_b'),
createAdvancedAnalyticsSection(t('Advanced analytics Query B'), '_b'),
{
label: t('Annotations and Layers'),
expanded: false,
controlSetRows: [
[
{
name: 'annotation_layers',
config: {
type: 'AnnotationLayerControl',
label: '',
default: annotationLayers,
description: t('Annotation Layers'),
},
},
],
],
},
sections.annotationsAndLayersControls,
sections.titleControls,
{
label: t('Chart Options'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ export default function transformProps(
filterState,
datasource,
theme,
annotationData = {},
} = chartProps;
const { annotation_data: annotationData_ } = queriesData[0];
const annotationData = annotationData_ || {};
const { verboseMap = {} } = datasource;
const data1 = (queriesData[0].data || []) as TimeseriesDataRecord[];
const data2 = (queriesData[1].data || []) as TimeseriesDataRecord[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,12 @@ export default function transformProps(
queriesData,
datasource,
theme,
annotationData = {},
} = chartProps;
const { verboseMap = {} } = datasource;
const [queryData] = queriesData;
const { annotation_data: annotationData_, data = [] } =
queryData as TimeseriesChartDataResponseResult;
const { data = [] } = queryData as TimeseriesChartDataResponseResult;
const dataTypes = getColtypesMapping(queryData);
const annotationData = annotationData_ || {};

const {
area,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,54 +180,54 @@ describe('EchartsTimeseries transformProps', () => {
...formData,
annotationLayers: [event, interval, timeseries],
},
queriesData: [
{
...queriesData[0],
annotation_data: {
'My Event': {
columns: [
'start_dttm',
'end_dttm',
'short_descr',
'long_descr',
'json_metadata',
],
records: [
{
start_dttm: 0,
end_dttm: 1000,
short_descr: '',
long_descr: '',
json_metadata: null,
},
],
annotationData: {
'My Event': {
columns: [
'start_dttm',
'end_dttm',
'short_descr',
'long_descr',
'json_metadata',
],
records: [
{
start_dttm: 0,
end_dttm: 1000,
short_descr: '',
long_descr: '',
json_metadata: null,
},
'My Interval': {
columns: ['start', 'end', 'title'],
records: [
{
start: 2000,
end: 3000,
title: 'My Title',
},
],
],
},
'My Interval': {
columns: ['start', 'end', 'title'],
records: [
{
start: 2000,
end: 3000,
title: 'My Title',
},
'My Timeseries': [
],
},
'My Timeseries': [
{
key: 'My Line',
values: [
{
x: 10000,
y: 11000,
},
{
key: 'My Line',
values: [
{
x: 10000,
y: 11000,
},
{
x: 20000,
y: 21000,
},
],
x: 20000,
y: 21000,
},
],
},
],
},
queriesData: [
{
...queriesData[0],
},
],
});
Expand Down