diff --git a/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx b/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx index c011ca2471..a9e669c213 100644 --- a/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx +++ b/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx @@ -1,4 +1,4 @@ -import { Typography } from 'antd'; +import { Skeleton, Typography } from 'antd'; import { ToggleGraphProps } from 'components/Graph/types'; import { SOMETHING_WENT_WRONG } from 'constants/api'; import GridPanelSwitch from 'container/GridPanelSwitch'; @@ -249,20 +249,23 @@ function WidgetGraphComponent({ isWarning={isWarning} /> - + {queryResponse.isLoading && } + {queryResponse.isSuccess && ( + + )} ); } diff --git a/frontend/src/container/GridCardLayout/GridCard/index.tsx b/frontend/src/container/GridCardLayout/GridCard/index.tsx index 7ebcc65e5c..0d30cea491 100644 --- a/frontend/src/container/GridCardLayout/GridCard/index.tsx +++ b/frontend/src/container/GridCardLayout/GridCard/index.tsx @@ -1,4 +1,3 @@ -import { Skeleton } from 'antd'; import { PANEL_TYPES } from 'constants/queryBuilder'; import { useGetQueryRange } from 'hooks/queryBuilder/useGetQueryRange'; import { useStepInterval } from 'hooks/queryBuilder/useStepInterval'; @@ -99,10 +98,6 @@ function GridCardGraph({ const isEmptyLayout = widget?.id === PANEL_TYPES.EMPTY_WIDGET; - if (queryResponse.isLoading) { - return ; - } - return ( ({ queryKey: [servicename, minTime, maxTime, selectedTags], @@ -199,7 +199,7 @@ function Application(): JSX.Element { selectedTimeStamp={selectedTimeStamp} selectedTraceTags={selectedTraceTags} topLevelOperationsRoute={topLevelOperationsRoute} - topLevelOperationsLoading={topLevelOperationsLoading} + topLevelOperationsIsLoading={topLevelOperationsIsLoading} /> @@ -220,11 +220,11 @@ function Application(): JSX.Element { handleGraphClick={handleGraphClick} onDragSelect={onDragSelect} topLevelOperationsError={topLevelOperationsError} - topLevelOperationsLoading={topLevelOperationsLoading} topLevelOperationsIsError={topLevelOperationsIsError} name="operations_per_sec" widget={operationPerSecWidget} opName="Rate" + topLevelOperationsIsLoading={topLevelOperationsIsLoading} /> @@ -264,11 +264,11 @@ function Application(): JSX.Element { handleGraphClick={handleGraphClick} onDragSelect={onDragSelect} topLevelOperationsError={topLevelOperationsError} - topLevelOperationsLoading={topLevelOperationsLoading} topLevelOperationsIsError={topLevelOperationsIsError} name="error_percentage_%" widget={errorPercentageWidget} opName="Error" + topLevelOperationsIsLoading={topLevelOperationsIsLoading} /> diff --git a/frontend/src/container/MetricsApplication/Tabs/Overview/ServiceOverview.tsx b/frontend/src/container/MetricsApplication/Tabs/Overview/ServiceOverview.tsx index cb124f545a..047fb9c4c4 100644 --- a/frontend/src/container/MetricsApplication/Tabs/Overview/ServiceOverview.tsx +++ b/frontend/src/container/MetricsApplication/Tabs/Overview/ServiceOverview.tsx @@ -1,4 +1,3 @@ -import Spinner from 'components/Spinner'; import { FeatureKeys } from 'constants/features'; import { PANEL_TYPES } from 'constants/queryBuilder'; import Graph from 'container/GridCardLayout/GridCard'; @@ -25,7 +24,7 @@ function ServiceOverview({ selectedTraceTags, selectedTimeStamp, topLevelOperationsRoute, - topLevelOperationsLoading, + topLevelOperationsIsLoading, }: ServiceOverviewProps): JSX.Element { const { servicename } = useParams(); @@ -64,15 +63,8 @@ function ServiceOverview({ [servicename, isSpanMetricEnable, topLevelOperationsRoute, tagFilterItems], ); - const isQueryEnabled = topLevelOperationsRoute.length > 0; - - if (topLevelOperationsLoading) { - return ( - - - - ); - } + const isQueryEnabled = + !topLevelOperationsIsLoading && topLevelOperationsRoute.length > 0; return ( <> @@ -109,7 +101,7 @@ interface ServiceOverviewProps { onDragSelect: (start: number, end: number) => void; handleGraphClick: (type: string) => ClickHandlerType; topLevelOperationsRoute: string[]; - topLevelOperationsLoading: boolean; + topLevelOperationsIsLoading: boolean; } export default ServiceOverview; diff --git a/frontend/src/container/MetricsApplication/Tabs/Overview/TopLevelOperations.tsx b/frontend/src/container/MetricsApplication/Tabs/Overview/TopLevelOperations.tsx index f71a0f7301..2bc02ee13c 100644 --- a/frontend/src/container/MetricsApplication/Tabs/Overview/TopLevelOperations.tsx +++ b/frontend/src/container/MetricsApplication/Tabs/Overview/TopLevelOperations.tsx @@ -1,6 +1,5 @@ import { Typography } from 'antd'; import axios from 'axios'; -import Spinner from 'components/Spinner'; import { SOMETHING_WENT_WRONG } from 'constants/api'; import Graph from 'container/GridCardLayout/GridCard'; import { Card, GraphContainer } from 'container/MetricsApplication/styles'; @@ -13,10 +12,10 @@ function TopLevelOperation({ opName, topLevelOperationsIsError, topLevelOperationsError, - topLevelOperationsLoading, onDragSelect, handleGraphClick, widget, + topLevelOperationsIsLoading, }: TopLevelOperationProps): JSX.Element { return ( @@ -28,17 +27,13 @@ function TopLevelOperation({ ) : ( - {topLevelOperationsLoading && ( - - )} - {!topLevelOperationsLoading && ( - - )} + )} @@ -50,10 +45,10 @@ interface TopLevelOperationProps { opName: string; topLevelOperationsIsError: boolean; topLevelOperationsError: unknown; - topLevelOperationsLoading: boolean; onDragSelect: (start: number, end: number) => void; handleGraphClick: (type: string) => ClickHandlerType; widget: Widgets; + topLevelOperationsIsLoading: boolean; } export default TopLevelOperation;