Skip to content

Commit 885891d

Browse files
authored
fix(StreamingQueryInfo): loading state (#3124)
1 parent 2bfed80 commit 885891d

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

src/containers/Tenant/Diagnostics/Overview/Overview.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ function Overview({type, path, database, databaseFullPath}: OverviewProps) {
3030

3131
const {currentData, isFetching, error} = overviewApi.useGetOverviewQuery(
3232
{path, database, databaseFullPath},
33-
{pollingInterval: autoRefreshInterval},
33+
//overview is not supported for streaming query, data request is inside StreamingQueryInfo
34+
{pollingInterval: autoRefreshInterval, skip: type === EPathType.EPathTypeStreamingQuery},
3435
);
3536

3637
const loading = isFetching && currentData === undefined;
@@ -79,7 +80,7 @@ function Overview({type, path, database, databaseFullPath}: OverviewProps) {
7980
/>
8081
),
8182
[EPathType.EPathTypeStreamingQuery]: () => (
82-
<StreamingQueryInfo data={data} path={path} database={database} />
83+
<StreamingQueryInfo path={path} database={database} />
8384
),
8485
};
8586

src/containers/Tenant/Diagnostics/Overview/StreamingQueryInfo/StreamingQueryInfo.tsx

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import React from 'react';
22

33
import {Label} from '@gravity-ui/uikit';
44

5+
import {LoaderWrapper} from '../../../../../components/LoaderWrapper/LoaderWrapper';
56
import {YDBSyntaxHighlighter} from '../../../../../components/SyntaxHighlighter/YDBSyntaxHighlighter';
67
import {YDBDefinitionList} from '../../../../../components/YDBDefinitionList/YDBDefinitionList';
78
import type {YDBDefinitionListItem} from '../../../../../components/YDBDefinitionList/YDBDefinitionList';
89
import {streamingQueriesApi} from '../../../../../store/reducers/streamingQuery/streamingQuery';
910
import type {ErrorResponse} from '../../../../../types/api/query';
10-
import type {TEvDescribeSchemeResult} from '../../../../../types/api/schema';
11+
import {EPathType} from '../../../../../types/api/schema';
1112
import type {IQueryResult} from '../../../../../types/store/query';
1213
import {
1314
getStringifiedData,
@@ -21,31 +22,25 @@ import {getEntityName} from '../../../utils';
2122
import i18n from './i18n';
2223

2324
interface StreamingQueryProps {
24-
data?: TEvDescribeSchemeResult;
2525
database: string;
2626
path: string;
2727
}
2828

29-
/** Displays overview for StreamingQuery EPathType */
30-
export function StreamingQueryInfo({data, database, path}: StreamingQueryProps) {
31-
const entityName = getEntityName(data?.PathDescription);
29+
export function StreamingQueryInfo({database, path}: StreamingQueryProps) {
30+
const entityName = getEntityName({Self: {PathType: EPathType.EPathTypeStreamingQuery}});
3231

33-
if (!data) {
34-
return (
35-
<div className="error">
36-
{i18n('alert_no-data')} {entityName}
37-
</div>
38-
);
39-
}
40-
41-
const {data: sysData} = streamingQueriesApi.useGetStreamingQueryInfoQuery(
32+
const {data: sysData, isFetching} = streamingQueriesApi.useGetStreamingQueryInfoQuery(
4233
{database, path},
4334
{skip: !database || !path},
4435
);
4536

4637
const items = prepareStreamingQueryItems(sysData);
4738

48-
return <YDBDefinitionList title={entityName} items={items} />;
39+
return (
40+
<LoaderWrapper loading={isFetching}>
41+
<YDBDefinitionList title={entityName} items={items} />
42+
</LoaderWrapper>
43+
);
4944
}
5045

5146
const STATE_THEME_MAP: Record<string, React.ComponentProps<typeof Label>['theme']> = {

src/containers/Tenant/Diagnostics/Overview/StreamingQueryInfo/i18n/en.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"alert_no-data": "No data for entity:",
32
"field_query-state": "State",
43
"field_query-error": "Error",
54
"field_query-text": "Text"

0 commit comments

Comments
 (0)