Skip to content

Commit 7bc0844

Browse files
committedJan 27, 2025
feat: multipart response
1 parent 3d81b36 commit 7bc0844

File tree

25 files changed

+559
-539
lines changed

25 files changed

+559
-539
lines changed
 

‎public/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
window.systemSettings = {};
2424
window.userSettings = {};
2525
window.web_version = !'%REACT_APP_BACKEND%';
26-
window.custom_backend = 'http://localhost:8765';
26+
window.custom_backend = '%NODE_ENV%' === 'development' && '%REACT_APP_BACKEND%';
2727
window.meta_backend = '%REACT_APP_META_BACKEND%'
2828
</script>
2929
</head>

‎src/components/QueryResultTable/QueryResultTable.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type {Column, Settings} from '@gravity-ui/react-data-table';
66
import type {ColumnType, KeyValueRow} from '../../types/api/query';
77
import {cn} from '../../utils/cn';
88
import {DEFAULT_TABLE_SETTINGS} from '../../utils/constants';
9-
import {getColumnType, prepareQueryResponse} from '../../utils/query';
9+
import {getColumnType} from '../../utils/query';
1010
import {isNumeric} from '../../utils/utils';
1111
import type {ResizeableDataTableProps} from '../ResizeableDataTable/ResizeableDataTable';
1212
import {ResizeableDataTable} from '../ResizeableDataTable/ResizeableDataTable';
@@ -80,16 +80,18 @@ interface QueryResultTableProps
8080
}
8181

8282
export const QueryResultTable = (props: QueryResultTableProps) => {
83-
const {columns: rawColumns, data: rawData, ...restProps} = props;
83+
const {columns: rawColumns, data, ...restProps} = props;
8484

85-
const data = React.useMemo(() => prepareQueryResponse(rawData), [rawData]);
8685
const columns = React.useMemo(() => {
86+
if (!data?.length) {
87+
return [];
88+
}
8789
return rawColumns ? prepareTypedColumns(rawColumns, data) : prepareGenericColumns(data);
8890
}, [data, rawColumns]);
8991

9092
// empty data is expected to be be an empty array
9193
// undefined data is not rendered at all
92-
if (!Array.isArray(rawData)) {
94+
if (!Array.isArray(data)) {
9395
return null;
9496
}
9597

‎src/containers/App/Content.tsx

-8
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import type {RawBreadcrumbItem} from '../Header/breadcrumbs';
2525
import {
2626
ClusterSlot,
2727
ClustersSlot,
28-
MultipartTestSlot,
2928
NodeSlot,
3029
PDiskPageSlot,
3130
RedirectSlot,
@@ -48,14 +47,7 @@ type RouteSlot = {
4847
wrapper?: React.ComponentType<any>;
4948
exact?: boolean;
5049
};
51-
5250
const routesSlots: RouteSlot[] = [
53-
{
54-
path: routes.multipartTest,
55-
slot: MultipartTestSlot,
56-
component: lazyComponent(() => import('../MultipartTest/MultipartTest'), 'MultipartTest'),
57-
exact: true,
58-
},
5951
{
6052
path: routes.cluster,
6153
slot: ClusterSlot,

‎src/containers/App/appSlots.tsx

+8-22
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type {RedirectProps, RouteComponentProps} from 'react-router-dom';
33
import {createSlot} from '../../components/slots';
44
import type {Cluster} from '../Cluster/Cluster';
55
import type {Clusters} from '../Clusters/Clusters';
6-
import type {MultipartTest} from '../MultipartTest/MultipartTest';
76
import type {Node} from '../Node/Node';
87
import type {PDiskPage} from '../PDiskPage/PDiskPage';
98
import type {StorageGroupPage} from '../StorageGroupPage/StorageGroupPage';
@@ -12,58 +11,45 @@ import type {Tenant} from '../Tenant/Tenant';
1211
import type {VDiskPage} from '../VDiskPage/VDiskPage';
1312

1413
export const ClustersSlot = createSlot<{
15-
children?:
14+
children:
1615
| React.ReactNode
1716
| ((props: {component: typeof Clusters} & RouteComponentProps) => React.ReactNode);
1817
}>('clusters');
19-
2018
export const ClusterSlot = createSlot<{
21-
children?:
19+
children:
2220
| React.ReactNode
2321
| ((props: {component: typeof Cluster} & RouteComponentProps) => React.ReactNode);
2422
}>('cluster');
25-
2623
export const TenantSlot = createSlot<{
27-
children?:
24+
children:
2825
| React.ReactNode
2926
| ((props: {component: typeof Tenant} & RouteComponentProps) => React.ReactNode);
3027
}>('tenant');
31-
3228
export const NodeSlot = createSlot<{
33-
children?:
29+
children:
3430
| React.ReactNode
3531
| ((props: {component: typeof Node} & RouteComponentProps) => React.ReactNode);
3632
}>('node');
37-
3833
export const PDiskPageSlot = createSlot<{
39-
children?:
34+
children:
4035
| React.ReactNode
4136
| ((props: {component: typeof PDiskPage} & RouteComponentProps) => React.ReactNode);
4237
}>('pDisk');
43-
4438
export const VDiskPageSlot = createSlot<{
45-
children?:
39+
children:
4640
| React.ReactNode
4741
| ((props: {component: typeof VDiskPage} & RouteComponentProps) => React.ReactNode);
4842
}>('vDisk');
49-
5043
export const StorageGroupSlot = createSlot<{
51-
children?:
44+
children:
5245
| React.ReactNode
5346
| ((props: {component: typeof StorageGroupPage} & RouteComponentProps) => React.ReactNode);
5447
}>('storageGroup');
55-
5648
export const TabletSlot = createSlot<{
57-
children?:
49+
children:
5850
| React.ReactNode
5951
| ((props: {component: typeof Tablet} & RouteComponentProps) => React.ReactNode);
6052
}>('tablet');
6153

62-
export const MultipartTestSlot = createSlot<{
63-
children?:
64-
| React.ReactNode
65-
| ((props: {component: typeof MultipartTest} & RouteComponentProps) => React.ReactNode);
66-
}>('multipartTest');
67-
6854
export const RoutesSlot = createSlot<{children: React.ReactNode}>('routes');
6955
export const RedirectSlot = createSlot<RedirectProps>('redirect');

‎src/containers/MultipartTest/MultipartTest.tsx

-198
This file was deleted.

‎src/containers/Tenant/Query/CancelQueryButton/CancelQueryButton.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@ const b = cn('cancel-query-button');
1414
interface CancelQueryButtonProps {
1515
queryId: string;
1616
tenantName: string;
17+
onClick?: VoidFunction;
1718
}
1819

19-
export function CancelQueryButton({queryId, tenantName}: CancelQueryButtonProps) {
20+
export function CancelQueryButton({queryId, tenantName, onClick}: CancelQueryButtonProps) {
2021
const [sendCancelQuery, cancelQueryResponse] = cancelQueryApi.useCancelQueryMutation();
2122

2223
const onStopButtonClick = React.useCallback(() => {
2324
sendCancelQuery({queryId, database: tenantName});
24-
}, [queryId, sendCancelQuery, tenantName]);
25+
onClick?.();
26+
}, [onClick, queryId, sendCancelQuery, tenantName]);
2527

2628
return (
2729
<Button

0 commit comments

Comments
 (0)