feat: limit is updated (#3730)

This commit is contained in:
Palash Gupta 2023-10-12 18:43:08 +05:30 committed by GitHub
parent d5df9a1f7f
commit 1588d3a199
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 9 deletions

View File

@ -1,4 +1,5 @@
import { themeColors } from 'constants/theme'; import { themeColors } from 'constants/theme';
import { limit } from 'lib/getChartData';
import { CSSProperties } from 'react'; import { CSSProperties } from 'react';
const positionCss: CSSProperties['position'] = 'absolute'; const positionCss: CSSProperties['position'] = 'absolute';
@ -26,5 +27,4 @@ export const overlayStyles: CSSProperties = {
position: 'absolute', position: 'absolute',
}; };
export const WARNING_MESSAGE = export const WARNING_MESSAGE = `Too many timeseries in the result. UI has restricted to showing the top ${limit}. Please check the query if this is needed and contact support@signoz.io if you need to show >${limit} timeseries in the panel`;
'Too many timeseries in the result. UI has restricted to showing the top 20. Please check the query if this is needed and contact support@signoz.io if you need to show >20 timeseries in the panel';

View File

@ -5,6 +5,8 @@ import { QueryData } from 'types/api/widgets/getQuery';
import convertIntoEpoc from './covertIntoEpoc'; import convertIntoEpoc from './covertIntoEpoc';
import { colors } from './getRandomColor'; import { colors } from './getRandomColor';
export const limit = 30;
const getChartData = ({ const getChartData = ({
queryData, queryData,
createDataset, createDataset,
@ -14,10 +16,6 @@ const getChartData = ({
isWarning: boolean; isWarning: boolean;
// eslint-disable-next-line sonarjs/cognitive-complexity // eslint-disable-next-line sonarjs/cognitive-complexity
} => { } => {
const limit = process.env.FRONTEND_CHART_LIMIT
? +process.env.FRONTEND_CHART_LIMIT
: 20;
const uniqueTimeLabels = new Set<number>(); const uniqueTimeLabels = new Set<number>();
queryData.forEach((data) => { queryData.forEach((data) => {
data.queryData.forEach((query) => { data.queryData.forEach((query) => {
@ -118,7 +116,7 @@ const getChartData = ({
return { return {
data: updatedData, data: updatedData,
isWarning: isWarningLimit && (updatedDataSet?.length || 0) > limit, isWarning: isWarningLimit && (allLabels?.length || 0) > limit,
}; };
}; };

View File

@ -33,7 +33,6 @@ const plugins = [
INTERCOM_APP_ID: process.env.INTERCOM_APP_ID, INTERCOM_APP_ID: process.env.INTERCOM_APP_ID,
SEGMENT_ID: process.env.SEGMENT_ID, SEGMENT_ID: process.env.SEGMENT_ID,
CLARITY_PROJECT_ID: process.env.CLARITY_PROJECT_ID, CLARITY_PROJECT_ID: process.env.CLARITY_PROJECT_ID,
FRONTEND_CHART_LIMIT: process.env.FRONTEND_CHART_LIMIT,
}), }),
}), }),
]; ];

View File

@ -42,7 +42,6 @@ const plugins = [
INTERCOM_APP_ID: process.env.INTERCOM_APP_ID, INTERCOM_APP_ID: process.env.INTERCOM_APP_ID,
SEGMENT_ID: process.env.SEGMENT_ID, SEGMENT_ID: process.env.SEGMENT_ID,
CLARITY_PROJECT_ID: process.env.CLARITY_PROJECT_ID, CLARITY_PROJECT_ID: process.env.CLARITY_PROJECT_ID,
FRONTEND_CHART_LIMIT: process.env.FRONTEND_CHART_LIMIT,
}), }),
}), }),
new MiniCssExtractPlugin(), new MiniCssExtractPlugin(),