mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-26 16:12:00 +08:00
[Fix]: the loading state based on the time interval (#3755)
* fix: the loading state based on the time interval * fix: failing of query-range api
This commit is contained in:
parent
626da7533e
commit
0400d5378b
@ -1,4 +1,4 @@
|
|||||||
import { Typography } from 'antd';
|
import { Skeleton, Typography } from 'antd';
|
||||||
import { ToggleGraphProps } from 'components/Graph/types';
|
import { ToggleGraphProps } from 'components/Graph/types';
|
||||||
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
||||||
import GridPanelSwitch from 'container/GridPanelSwitch';
|
import GridPanelSwitch from 'container/GridPanelSwitch';
|
||||||
@ -249,20 +249,23 @@ function WidgetGraphComponent({
|
|||||||
isWarning={isWarning}
|
isWarning={isWarning}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<GridPanelSwitch
|
{queryResponse.isLoading && <Skeleton />}
|
||||||
panelType={widget.panelTypes}
|
{queryResponse.isSuccess && (
|
||||||
data={data}
|
<GridPanelSwitch
|
||||||
isStacked={widget.isStacked}
|
panelType={widget.panelTypes}
|
||||||
opacity={widget.opacity}
|
data={data}
|
||||||
title={' '}
|
isStacked={widget.isStacked}
|
||||||
name={name}
|
opacity={widget.opacity}
|
||||||
yAxisUnit={widget.yAxisUnit}
|
title={' '}
|
||||||
onClickHandler={onClickHandler}
|
name={name}
|
||||||
onDragSelect={onDragSelect}
|
yAxisUnit={widget.yAxisUnit}
|
||||||
panelData={queryResponse.data?.payload?.data.newResult.data.result || []}
|
onClickHandler={onClickHandler}
|
||||||
query={widget.query}
|
onDragSelect={onDragSelect}
|
||||||
ref={lineChartRef}
|
panelData={queryResponse.data?.payload?.data.newResult.data.result || []}
|
||||||
/>
|
query={widget.query}
|
||||||
|
ref={lineChartRef}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { Skeleton } from 'antd';
|
|
||||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||||
import { useGetQueryRange } from 'hooks/queryBuilder/useGetQueryRange';
|
import { useGetQueryRange } from 'hooks/queryBuilder/useGetQueryRange';
|
||||||
import { useStepInterval } from 'hooks/queryBuilder/useStepInterval';
|
import { useStepInterval } from 'hooks/queryBuilder/useStepInterval';
|
||||||
@ -99,10 +98,6 @@ function GridCardGraph({
|
|||||||
|
|
||||||
const isEmptyLayout = widget?.id === PANEL_TYPES.EMPTY_WIDGET;
|
const isEmptyLayout = widget?.id === PANEL_TYPES.EMPTY_WIDGET;
|
||||||
|
|
||||||
if (queryResponse.isLoading) {
|
|
||||||
return <Skeleton />;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span ref={graphRef}>
|
<span ref={graphRef}>
|
||||||
<WidgetGraphComponent
|
<WidgetGraphComponent
|
||||||
|
@ -92,8 +92,8 @@ function Application(): JSX.Element {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
data: topLevelOperations,
|
data: topLevelOperations,
|
||||||
isLoading: topLevelOperationsLoading,
|
|
||||||
error: topLevelOperationsError,
|
error: topLevelOperationsError,
|
||||||
|
isLoading: topLevelOperationsIsLoading,
|
||||||
isError: topLevelOperationsIsError,
|
isError: topLevelOperationsIsError,
|
||||||
} = useQuery<ServiceDataProps>({
|
} = useQuery<ServiceDataProps>({
|
||||||
queryKey: [servicename, minTime, maxTime, selectedTags],
|
queryKey: [servicename, minTime, maxTime, selectedTags],
|
||||||
@ -199,7 +199,7 @@ function Application(): JSX.Element {
|
|||||||
selectedTimeStamp={selectedTimeStamp}
|
selectedTimeStamp={selectedTimeStamp}
|
||||||
selectedTraceTags={selectedTraceTags}
|
selectedTraceTags={selectedTraceTags}
|
||||||
topLevelOperationsRoute={topLevelOperationsRoute}
|
topLevelOperationsRoute={topLevelOperationsRoute}
|
||||||
topLevelOperationsLoading={topLevelOperationsLoading}
|
topLevelOperationsIsLoading={topLevelOperationsIsLoading}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
@ -220,11 +220,11 @@ function Application(): JSX.Element {
|
|||||||
handleGraphClick={handleGraphClick}
|
handleGraphClick={handleGraphClick}
|
||||||
onDragSelect={onDragSelect}
|
onDragSelect={onDragSelect}
|
||||||
topLevelOperationsError={topLevelOperationsError}
|
topLevelOperationsError={topLevelOperationsError}
|
||||||
topLevelOperationsLoading={topLevelOperationsLoading}
|
|
||||||
topLevelOperationsIsError={topLevelOperationsIsError}
|
topLevelOperationsIsError={topLevelOperationsIsError}
|
||||||
name="operations_per_sec"
|
name="operations_per_sec"
|
||||||
widget={operationPerSecWidget}
|
widget={operationPerSecWidget}
|
||||||
opName="Rate"
|
opName="Rate"
|
||||||
|
topLevelOperationsIsLoading={topLevelOperationsIsLoading}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
@ -264,11 +264,11 @@ function Application(): JSX.Element {
|
|||||||
handleGraphClick={handleGraphClick}
|
handleGraphClick={handleGraphClick}
|
||||||
onDragSelect={onDragSelect}
|
onDragSelect={onDragSelect}
|
||||||
topLevelOperationsError={topLevelOperationsError}
|
topLevelOperationsError={topLevelOperationsError}
|
||||||
topLevelOperationsLoading={topLevelOperationsLoading}
|
|
||||||
topLevelOperationsIsError={topLevelOperationsIsError}
|
topLevelOperationsIsError={topLevelOperationsIsError}
|
||||||
name="error_percentage_%"
|
name="error_percentage_%"
|
||||||
widget={errorPercentageWidget}
|
widget={errorPercentageWidget}
|
||||||
opName="Error"
|
opName="Error"
|
||||||
|
topLevelOperationsIsLoading={topLevelOperationsIsLoading}
|
||||||
/>
|
/>
|
||||||
</ColErrorContainer>
|
</ColErrorContainer>
|
||||||
</Col>
|
</Col>
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import Spinner from 'components/Spinner';
|
|
||||||
import { FeatureKeys } from 'constants/features';
|
import { FeatureKeys } from 'constants/features';
|
||||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||||
import Graph from 'container/GridCardLayout/GridCard';
|
import Graph from 'container/GridCardLayout/GridCard';
|
||||||
@ -25,7 +24,7 @@ function ServiceOverview({
|
|||||||
selectedTraceTags,
|
selectedTraceTags,
|
||||||
selectedTimeStamp,
|
selectedTimeStamp,
|
||||||
topLevelOperationsRoute,
|
topLevelOperationsRoute,
|
||||||
topLevelOperationsLoading,
|
topLevelOperationsIsLoading,
|
||||||
}: ServiceOverviewProps): JSX.Element {
|
}: ServiceOverviewProps): JSX.Element {
|
||||||
const { servicename } = useParams<IServiceName>();
|
const { servicename } = useParams<IServiceName>();
|
||||||
|
|
||||||
@ -64,15 +63,8 @@ function ServiceOverview({
|
|||||||
[servicename, isSpanMetricEnable, topLevelOperationsRoute, tagFilterItems],
|
[servicename, isSpanMetricEnable, topLevelOperationsRoute, tagFilterItems],
|
||||||
);
|
);
|
||||||
|
|
||||||
const isQueryEnabled = topLevelOperationsRoute.length > 0;
|
const isQueryEnabled =
|
||||||
|
!topLevelOperationsIsLoading && topLevelOperationsRoute.length > 0;
|
||||||
if (topLevelOperationsLoading) {
|
|
||||||
return (
|
|
||||||
<Card>
|
|
||||||
<Spinner height="40vh" tip="Loading..." />
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -109,7 +101,7 @@ interface ServiceOverviewProps {
|
|||||||
onDragSelect: (start: number, end: number) => void;
|
onDragSelect: (start: number, end: number) => void;
|
||||||
handleGraphClick: (type: string) => ClickHandlerType;
|
handleGraphClick: (type: string) => ClickHandlerType;
|
||||||
topLevelOperationsRoute: string[];
|
topLevelOperationsRoute: string[];
|
||||||
topLevelOperationsLoading: boolean;
|
topLevelOperationsIsLoading: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ServiceOverview;
|
export default ServiceOverview;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { Typography } from 'antd';
|
import { Typography } from 'antd';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import Spinner from 'components/Spinner';
|
|
||||||
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
||||||
import Graph from 'container/GridCardLayout/GridCard';
|
import Graph from 'container/GridCardLayout/GridCard';
|
||||||
import { Card, GraphContainer } from 'container/MetricsApplication/styles';
|
import { Card, GraphContainer } from 'container/MetricsApplication/styles';
|
||||||
@ -13,10 +12,10 @@ function TopLevelOperation({
|
|||||||
opName,
|
opName,
|
||||||
topLevelOperationsIsError,
|
topLevelOperationsIsError,
|
||||||
topLevelOperationsError,
|
topLevelOperationsError,
|
||||||
topLevelOperationsLoading,
|
|
||||||
onDragSelect,
|
onDragSelect,
|
||||||
handleGraphClick,
|
handleGraphClick,
|
||||||
widget,
|
widget,
|
||||||
|
topLevelOperationsIsLoading,
|
||||||
}: TopLevelOperationProps): JSX.Element {
|
}: TopLevelOperationProps): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
@ -28,17 +27,13 @@ function TopLevelOperation({
|
|||||||
</Typography>
|
</Typography>
|
||||||
) : (
|
) : (
|
||||||
<GraphContainer>
|
<GraphContainer>
|
||||||
{topLevelOperationsLoading && (
|
<Graph
|
||||||
<Spinner size="large" tip="Loading..." height="40vh" />
|
name={name}
|
||||||
)}
|
widget={widget}
|
||||||
{!topLevelOperationsLoading && (
|
onClickHandler={handleGraphClick(opName)}
|
||||||
<Graph
|
onDragSelect={onDragSelect}
|
||||||
name={name}
|
isQueryEnabled={!topLevelOperationsIsLoading}
|
||||||
widget={widget}
|
/>
|
||||||
onClickHandler={handleGraphClick(opName)}
|
|
||||||
onDragSelect={onDragSelect}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</GraphContainer>
|
</GraphContainer>
|
||||||
)}
|
)}
|
||||||
</Card>
|
</Card>
|
||||||
@ -50,10 +45,10 @@ interface TopLevelOperationProps {
|
|||||||
opName: string;
|
opName: string;
|
||||||
topLevelOperationsIsError: boolean;
|
topLevelOperationsIsError: boolean;
|
||||||
topLevelOperationsError: unknown;
|
topLevelOperationsError: unknown;
|
||||||
topLevelOperationsLoading: boolean;
|
|
||||||
onDragSelect: (start: number, end: number) => void;
|
onDragSelect: (start: number, end: number) => void;
|
||||||
handleGraphClick: (type: string) => ClickHandlerType;
|
handleGraphClick: (type: string) => ClickHandlerType;
|
||||||
widget: Widgets;
|
widget: Widgets;
|
||||||
|
topLevelOperationsIsLoading: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default TopLevelOperation;
|
export default TopLevelOperation;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user