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 */
|
/* eslint-disable sonarjs/no-duplicate-string */
|
||||||
|
import { initialQueriesMap } from 'constants/queryBuilder';
|
||||||
import { getUPlotChartOptions } from 'lib/uPlotLib/getUplotChartOptions';
|
import { getUPlotChartOptions } from 'lib/uPlotLib/getUplotChartOptions';
|
||||||
import { LegendPosition } from 'types/api/dashboard/getAll';
|
import { LegendPosition } from 'types/api/dashboard/getAll';
|
||||||
|
|
||||||
@@ -62,6 +63,7 @@ const baseOptions = {
|
|||||||
legendPosition: LegendPosition.BOTTOM,
|
legendPosition: LegendPosition.BOTTOM,
|
||||||
softMin: null,
|
softMin: null,
|
||||||
softMax: null,
|
softMax: null,
|
||||||
|
query: initialQueriesMap.metrics,
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('Legend Scroll Position Preservation', () => {
|
describe('Legend Scroll Position Preservation', () => {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import { prepareQueryRangePayload } from './prepareQueryRangePayload';
|
|||||||
import { QueryData } from 'types/api/widgets/getQuery';
|
import { QueryData } from 'types/api/widgets/getQuery';
|
||||||
import { createAggregation } from 'api/v5/queryRange/prepareQueryRangePayloadV5';
|
import { createAggregation } from 'api/v5/queryRange/prepareQueryRangePayloadV5';
|
||||||
import { IDashboardVariable } from 'types/api/dashboard/getAll';
|
import { IDashboardVariable } from 'types/api/dashboard/getAll';
|
||||||
|
import { EQueryType } from 'types/common/dashboard';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates if metric name is available for METRICS data source
|
* Validates if metric name is available for METRICS data source
|
||||||
@@ -142,6 +143,11 @@ export const getLegend = (
|
|||||||
payloadQuery: Query,
|
payloadQuery: Query,
|
||||||
labelName: string,
|
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(
|
const aggregationPerQuery = payloadQuery?.builder?.queryData.reduce(
|
||||||
(acc, query) => {
|
(acc, query) => {
|
||||||
if (query.queryName === queryData.queryName) {
|
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';
|
import { GetUPlotChartOptions } from 'lib/uPlotLib/getUplotChartOptions';
|
||||||
|
|
||||||
export const inputPropsTimeSeries = {
|
export const inputPropsTimeSeries = {
|
||||||
@@ -204,6 +204,7 @@ export const inputPropsTimeSeries = {
|
|||||||
softMax: null,
|
softMax: null,
|
||||||
softMin: null,
|
softMin: null,
|
||||||
panelType: PANEL_TYPES.TIME_SERIES,
|
panelType: PANEL_TYPES.TIME_SERIES,
|
||||||
|
query: initialQueriesMap.metrics,
|
||||||
} as GetUPlotChartOptions;
|
} as GetUPlotChartOptions;
|
||||||
|
|
||||||
export const inputPropsBar = {
|
export const inputPropsBar = {
|
||||||
|
|||||||
Reference in New Issue
Block a user