chore: fix legends representation in non-metric non-qb queries (#9351)
This commit is contained in:
committed by
GitHub
parent
1793026c78
commit
b8cf0a3041
@@ -1,4 +1,5 @@
|
||||
/* eslint-disable sonarjs/no-duplicate-string */
|
||||
import { initialQueriesMap } from 'constants/queryBuilder';
|
||||
import { getUPlotChartOptions } from 'lib/uPlotLib/getUplotChartOptions';
|
||||
import { LegendPosition } from 'types/api/dashboard/getAll';
|
||||
|
||||
@@ -62,6 +63,7 @@ const baseOptions = {
|
||||
legendPosition: LegendPosition.BOTTOM,
|
||||
softMin: null,
|
||||
softMax: null,
|
||||
query: initialQueriesMap.metrics,
|
||||
};
|
||||
|
||||
describe('Legend Scroll Position Preservation', () => {
|
||||
|
||||
@@ -28,6 +28,7 @@ import { prepareQueryRangePayload } from './prepareQueryRangePayload';
|
||||
import { QueryData } from 'types/api/widgets/getQuery';
|
||||
import { createAggregation } from 'api/v5/queryRange/prepareQueryRangePayloadV5';
|
||||
import { IDashboardVariable } from 'types/api/dashboard/getAll';
|
||||
import { EQueryType } from 'types/common/dashboard';
|
||||
|
||||
/**
|
||||
* Validates if metric name is available for METRICS data source
|
||||
@@ -142,6 +143,11 @@ export const getLegend = (
|
||||
payloadQuery: Query,
|
||||
labelName: string,
|
||||
) => {
|
||||
// For non-query builder queries, return the label name directly
|
||||
if (payloadQuery.queryType !== EQueryType.QUERY_BUILDER) {
|
||||
return labelName;
|
||||
}
|
||||
|
||||
const aggregationPerQuery = payloadQuery?.builder?.queryData.reduce(
|
||||
(acc, query) => {
|
||||
if (query.queryName === queryData.queryName) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { GetUPlotChartOptions } from 'lib/uPlotLib/getUplotChartOptions';
|
||||
|
||||
export const inputPropsTimeSeries = {
|
||||
@@ -204,6 +204,7 @@ export const inputPropsTimeSeries = {
|
||||
softMax: null,
|
||||
softMin: null,
|
||||
panelType: PANEL_TYPES.TIME_SERIES,
|
||||
query: initialQueriesMap.metrics,
|
||||
} as GetUPlotChartOptions;
|
||||
|
||||
export const inputPropsBar = {
|
||||
|
||||
Reference in New Issue
Block a user