mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 20:15:54 +08:00
fix: [SIG-567]: prevented stage-&-run API on legend change (#4720)
* fix: prevented stage-&-run API on legend change * fix: code refactor --------- Co-authored-by: Sagar Rajput <sagarrajput@192.168.1.2>
This commit is contained in:
parent
63f0ae1c7c
commit
0df86454ce
@ -133,6 +133,7 @@ function WidgetGraph({
|
||||
softMax,
|
||||
softMin,
|
||||
panelType: selectedGraph,
|
||||
currentQuery,
|
||||
}),
|
||||
[
|
||||
widgetId,
|
||||
@ -148,6 +149,7 @@ function WidgetGraph({
|
||||
softMax,
|
||||
softMin,
|
||||
selectedGraph,
|
||||
currentQuery,
|
||||
],
|
||||
);
|
||||
|
||||
|
@ -12,6 +12,7 @@ import { Dimensions } from 'hooks/useDimensions';
|
||||
import { convertValue } from 'lib/getConvertedValue';
|
||||
import _noop from 'lodash-es/noop';
|
||||
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
|
||||
import { Query } from 'types/api/queryBuilder/queryBuilderData';
|
||||
import uPlot from 'uplot';
|
||||
|
||||
import onClickPlugin, { OnClickPluginOpts } from './plugins/onClickPlugin';
|
||||
@ -40,6 +41,7 @@ export interface GetUPlotChartOptions {
|
||||
maxTimeScale?: number;
|
||||
softMin: number | null;
|
||||
softMax: number | null;
|
||||
currentQuery?: Query;
|
||||
}
|
||||
|
||||
export const getUPlotChartOptions = ({
|
||||
@ -59,6 +61,7 @@ export const getUPlotChartOptions = ({
|
||||
softMax,
|
||||
softMin,
|
||||
panelType,
|
||||
currentQuery,
|
||||
}: GetUPlotChartOptions): uPlot.Options => {
|
||||
const timeScaleProps = getXAxisScale(minTimeScale, maxTimeScale);
|
||||
|
||||
@ -223,6 +226,7 @@ export const getUPlotChartOptions = ({
|
||||
widgetMetaData: apiResponse?.data.result,
|
||||
graphsVisibilityStates,
|
||||
panelType,
|
||||
currentQuery,
|
||||
}),
|
||||
axes: getAxes(isDarkMode, yAxisUnit),
|
||||
};
|
||||
|
@ -3,6 +3,7 @@ import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { themeColors } from 'constants/theme';
|
||||
import getLabelName from 'lib/getLabelName';
|
||||
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
|
||||
import { Query } from 'types/api/queryBuilder/queryBuilderData';
|
||||
import { QueryData } from 'types/api/widgets/getQuery';
|
||||
|
||||
import { drawStyles, lineInterpolations } from './constants';
|
||||
@ -31,6 +32,7 @@ const getSeries = ({
|
||||
widgetMetaData,
|
||||
graphsVisibilityStates,
|
||||
panelType,
|
||||
currentQuery,
|
||||
}: GetSeriesProps): uPlot.Options['series'] => {
|
||||
const configurations: uPlot.Series[] = [
|
||||
{ label: 'Timestamp', stroke: 'purple' },
|
||||
@ -40,13 +42,15 @@ const getSeries = ({
|
||||
const newGraphVisibilityStates = graphsVisibilityStates?.slice(1);
|
||||
|
||||
for (let i = 0; i < seriesList?.length; i += 1) {
|
||||
const { metric = {}, queryName = '', legend = '' } = widgetMetaData[i] || {};
|
||||
const { metric = {}, queryName = '', legend: lgd } = widgetMetaData[i] || {};
|
||||
|
||||
const label = getLabelName(
|
||||
metric,
|
||||
queryName || '', // query
|
||||
legend || '',
|
||||
);
|
||||
const newLegend =
|
||||
currentQuery?.builder.queryData.find((item) => item.queryName === queryName)
|
||||
?.legend || '';
|
||||
|
||||
const legend = newLegend || lgd || '';
|
||||
|
||||
const label = getLabelName(metric, queryName || '', legend);
|
||||
|
||||
const color = generateColor(label, themeColors.chartcolors);
|
||||
|
||||
@ -87,6 +91,7 @@ export type GetSeriesProps = {
|
||||
widgetMetaData: QueryData[];
|
||||
graphsVisibilityStates?: boolean[];
|
||||
panelType?: PANEL_TYPES;
|
||||
currentQuery?: Query;
|
||||
};
|
||||
|
||||
export default getSeries;
|
||||
|
Loading…
x
Reference in New Issue
Block a user