fix: page breaking when query range response is null for table panel … (#5139)

* fix: page breaking when query range response is null for table panel type

* fix: page breaking when query range response is null for table panel type

* fix: page breaking when query range response is null for table panel type
This commit is contained in:
Vikrant Gupta 2024-06-04 00:15:37 +05:30 committed by GitHub
parent 03838f5fcc
commit be9c3f0697
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 22 additions and 20 deletions

View File

@ -135,7 +135,7 @@ export function BillingUsageGraph(props: BillingUsageGraphProps): JSX.Element {
},
y: {
...getYAxisScale({
series: graphCompatibleData?.data.newResult.data.result,
series: graphCompatibleData?.data?.newResult?.data?.result,
yAxisUnit: '',
softMax: null,
softMin: null,

View File

@ -262,7 +262,9 @@ function ChartPreview({
panelType={graphType}
data={chartData}
name={name || 'Chart Preview'}
panelData={queryResponse.data?.payload.data.newResult.data.result || []}
panelData={
queryResponse.data?.payload?.data?.newResult?.data?.result || []
}
query={query || initialQueriesMap.metrics}
yAxisUnit={yAxisUnit}
/>

View File

@ -215,7 +215,7 @@ function WidgetGraphComponent({
const {
graphVisibilityStates: localStoredVisibilityState,
} = getLocalStorageGraphVisibilityState({
apiResponse: queryResponse.data.payload.data.result,
apiResponse: queryResponse.data?.payload?.data?.result,
name: widget.id,
});
setGraphVisibility(localStoredVisibilityState);

View File

@ -84,7 +84,7 @@ export const useContextLogData = ({
const handleSuccess = useCallback(
(data: SuccessResponse<MetricRangePayloadProps, unknown>) => {
const currentData = data?.payload.data.newResult.data.result || [];
const currentData = data?.payload?.data?.newResult?.data?.result || [];
if (currentData.length > 0 && currentData[0].list) {
const currentLogs: ILog[] = currentData[0].list.map((item) => ({

View File

@ -84,7 +84,7 @@ function LogsContextList({
const handleSuccess = useCallback(
(data: SuccessResponse<MetricRangePayloadProps, unknown>) => {
const currentData = data?.payload.data.newResult.data.result || [];
const currentData = data?.payload?.data?.newResult?.data?.result || [];
if (currentData.length > 0 && currentData[0].list) {
const currentLogs: ILog[] = currentData[0].list.map((item) => ({

View File

@ -409,7 +409,7 @@ function LogsExplorerViews({
useEffect(() => {
const currentParams = data?.params as Omit<LogTimeRange, 'pageSize'>;
const currentData = data?.payload.data.newResult.data.result || [];
const currentData = data?.payload?.data?.newResult?.data?.result || [];
if (currentData.length > 0 && currentData[0].list) {
const currentLogs: ILog[] = currentData[0].list.map((item) => ({
...item.data,
@ -650,7 +650,7 @@ function LogsExplorerViews({
{selectedPanelType === PANEL_TYPES.TABLE && (
<LogsExplorerTable
data={data?.payload.data.newResult.data.result || []}
data={data?.payload?.data?.newResult?.data?.result || []}
isLoading={isLoading || isFetching}
isError={isError}
/>

View File

@ -85,7 +85,7 @@ function LogsPanelComponent({
const [lastLog, setLastLog] = useState<ILog>();
const { logs } = useLogsData({
result: queryResponse.data?.payload.data.newResult.data.result,
result: queryResponse.data?.payload?.data?.newResult?.data?.result,
panelType: PANEL_TYPES.LIST,
stagedQuery: widget.query,
});

View File

@ -56,7 +56,7 @@ function LogsTopNav(): JSX.Element {
: [],
listQueryPayload:
listQuery && listQuery[1]
? listQuery[1].payload?.data.newResult.data.result || []
? listQuery[1].payload?.data?.newResult?.data?.result || []
: [],
};
}

View File

@ -87,7 +87,7 @@ function TopOperationMetrics(): JSX.Element {
},
);
const queryTableData = data?.payload.data.newResult.data.result || [];
const queryTableData = data?.payload?.data?.newResult?.data?.result || [];
const renderColumnCell = useMemo(
() =>

View File

@ -50,7 +50,7 @@ function WidgetGraphContainer({
}
if (
selectedGraph === PANEL_TYPES.LIST &&
queryResponse.data?.payload.data.newResult?.data?.result?.length === 0
queryResponse.data?.payload?.data?.newResult?.data?.result?.length === 0
) {
return (
<NotFoundContainer>

View File

@ -117,7 +117,7 @@ export default function LogsConnectionStatus(): JSX.Element {
}
}
const currentData = data?.payload.data.newResult.data.result || [];
const currentData = data?.payload?.data?.newResult?.data?.result || [];
if (currentData.length > 0 && currentData[0].list) {
const currentLogs: ILog[] = currentData[0].list.map((item) => ({
...item.data,

View File

@ -39,7 +39,7 @@ function PiePanelWrapper({
});
const panelData =
queryResponse.data?.payload?.data.newResult.data.result || [];
queryResponse.data?.payload?.data?.newResult?.data?.result || [];
const isDarkMode = useIsDarkMode();

View File

@ -9,7 +9,7 @@ function TablePanelWrapper({
tableProcessedDataRef,
}: PanelWrapperProps): JSX.Element {
const panelData =
queryResponse.data?.payload?.data.newResult.data.result || [];
queryResponse.data?.payload?.data?.newResult?.data?.result || [];
const { thresholds } = widget;
return (
<GridTableComponent

View File

@ -81,7 +81,7 @@ export const getServiceListFromQuery = ({
services.push(serviceData);
}
if (query.data) {
const queryArray = query.data.payload.data.newResult.data.result;
const queryArray = query.data?.payload?.data?.newResult?.data?.result;
const serviceData: ServicesList = {
serviceName: topLevelOperations[index][0].toString(),
p99: parseFloat(getSeriesValue(queryArray, 'A')),

View File

@ -169,7 +169,7 @@ function DateTimeSelection({
: [],
listQueryPayload:
listQuery && listQuery[1]
? listQuery[1].payload?.data.newResult.data.result || []
? listQuery[1].payload?.data?.newResult?.data?.result || []
: [],
};
}

View File

@ -86,7 +86,7 @@ function ListView(): JSX.Element {
data?.payload?.data?.newResult?.data?.result[0]?.list?.length;
const totalCount = useMemo(() => dataLength || 0, [dataLength]);
const queryTableDataResult = data?.payload.data.newResult.data.result;
const queryTableDataResult = data?.payload?.data?.newResult?.data?.result;
const queryTableData = useMemo(() => queryTableDataResult || [], [
queryTableDataResult,
]);

View File

@ -45,7 +45,7 @@ function TableView(): JSX.Element {
<Space.Compact block direction="vertical">
<QueryTable
query={stagedQuery || initialQueriesMap.traces}
queryTableData={data?.payload.data.newResult.data.result || []}
queryTableData={data?.payload?.data?.newResult?.data?.result || []}
loading={isLoading}
/>
</Space.Compact>

View File

@ -54,7 +54,7 @@ function TracesTableComponent({
const totalCount = useMemo(() => dataLength || 0, [dataLength]);
const queryTableDataResult =
queryResponse.data?.payload.data.newResult.data.result;
queryResponse.data?.payload?.data?.newResult?.data?.result;
const queryTableData = useMemo(() => queryTableDataResult || [], [
queryTableDataResult,
]);

View File

@ -145,7 +145,7 @@ export const useLogsData = ({
useEffect(() => {
const currentParams = data?.params as Omit<LogTimeRange, 'pageSize'>;
const currentData = data?.payload.data.newResult.data.result || [];
const currentData = data?.payload?.data?.newResult?.data?.result || [];
if (currentData.length > 0 && currentData[0].list) {
const currentLogs: ILog[] = currentData[0].list.map((item) => ({
...item.data,