ydb-embedded-ui 6.10.3 → 6.12.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/DateRange/DateRange.d.ts +4 -4
- package/dist/components/DateRange/DateRange.js +23 -26
- package/dist/components/DateRange/DateRange.scss +14 -13
- package/dist/components/DateRange/__test__/fromDateRangeValues.test.d.ts +1 -0
- package/dist/components/DateRange/__test__/fromDateRangeValues.test.js +80 -0
- package/dist/components/DateRange/__test__/getdatePickerSize.test.d.ts +1 -0
- package/dist/components/DateRange/__test__/getdatePickerSize.test.js +56 -0
- package/dist/components/DateRange/__test__/toDateRangeValues.test.d.ts +1 -0
- package/dist/components/DateRange/__test__/toDateRangeValues.test.js +80 -0
- package/dist/components/DateRange/i18n/en.json +4 -0
- package/dist/components/DateRange/i18n/index.d.ts +2 -0
- package/dist/components/DateRange/i18n/index.js +5 -0
- package/dist/components/DateRange/i18n/ru.json +4 -0
- package/dist/components/DateRange/utils.d.ts +5 -0
- package/dist/components/DateRange/utils.js +41 -0
- package/dist/components/DeveloperUILinkButton/DeveloperUILinkButton.d.ts +8 -0
- package/dist/components/DeveloperUILinkButton/DeveloperUILinkButton.js +9 -0
- package/dist/components/DeveloperUILinkButton/DeveloperUILinkButton.scss +12 -0
- package/dist/components/DiskStateProgressBar/DiskStateProgressBar.d.ts +6 -1
- package/dist/components/DiskStateProgressBar/DiskStateProgressBar.js +22 -12
- package/dist/components/DiskStateProgressBar/DiskStateProgressBar.scss +45 -45
- package/dist/components/EntityStatus/EntityStatus.js +1 -1
- package/dist/components/EntityStatus/EntityStatus.scss +6 -2
- package/dist/components/MetricChart/reducer.d.ts +2 -2
- package/dist/components/MonacoEditor/MonacoEditor.js +0 -2
- package/dist/components/NodeHostWrapper/NodeHostWrapper.d.ts +0 -1
- package/dist/components/NodeHostWrapper/NodeHostWrapper.js +11 -7
- package/dist/components/PDiskInfo/PDiskInfo.d.ts +7 -4
- package/dist/components/PDiskInfo/PDiskInfo.js +73 -26
- package/dist/components/PDiskInfo/PDiskInfo.scss +15 -1
- package/dist/components/PDiskInfo/i18n/en.json +11 -5
- package/dist/components/PDiskInfo/i18n/index.d.ts +1 -1
- package/dist/components/PDiskPopup/PDiskPopup.js +8 -2
- package/dist/components/VDiskInfo/VDiskInfo.d.ts +3 -2
- package/dist/components/VDiskInfo/VDiskInfo.js +9 -4
- package/dist/components/VDiskInfo/VDiskInfo.scss +7 -1
- package/dist/components/VDiskInfo/i18n/en.json +2 -1
- package/dist/components/VDiskInfo/i18n/index.d.ts +1 -1
- package/dist/containers/Cluster/Cluster.scss +1 -4
- package/dist/containers/Cluster/ClusterInfo/ClusterInfo.scss +1 -1
- package/dist/containers/Heatmap/Heatmap.d.ts +2 -1
- package/dist/containers/Heatmap/Heatmap.js +2 -2
- package/dist/containers/Node/Node.scss +1 -4
- package/dist/containers/Node/NodeStructure/NodeStructure.scss +0 -20
- package/dist/containers/Node/NodeStructure/Pdisk.js +2 -2
- package/dist/containers/PDiskPage/PDiskGroups/PDiskGroups.d.ts +6 -0
- package/dist/containers/PDiskPage/PDiskGroups/PDiskGroups.js +24 -0
- package/dist/containers/PDiskPage/PDiskPage.js +62 -24
- package/dist/containers/PDiskPage/PDiskPage.scss +8 -5
- package/dist/containers/PDiskPage/PDiskSpaceDistribution/PDiskSpaceDistribution.d.ts +7 -0
- package/dist/containers/PDiskPage/PDiskSpaceDistribution/PDiskSpaceDistribution.js +93 -0
- package/dist/containers/PDiskPage/PDiskSpaceDistribution/PDiskSpaceDistribution.scss +52 -0
- package/dist/containers/PDiskPage/PDiskSpaceDistribution/utils.d.ts +4 -0
- package/dist/containers/PDiskPage/PDiskSpaceDistribution/utils.js +9 -0
- package/dist/containers/PDiskPage/i18n/en.json +8 -1
- package/dist/containers/PDiskPage/i18n/index.d.ts +1 -1
- package/dist/containers/Storage/StorageGroups/getStorageGroupsColumns.js +16 -6
- package/dist/containers/Tablets/Tablets.js +12 -5
- package/dist/containers/Tenant/Acl/Acl.d.ts +2 -1
- package/dist/containers/Tenant/Acl/Acl.js +10 -8
- package/dist/containers/Tenant/Acl/Acl.scss +8 -8
- package/dist/containers/Tenant/Acl/i18n/en.json +6 -0
- package/dist/containers/Tenant/Acl/i18n/index.d.ts +2 -0
- package/dist/containers/Tenant/Acl/i18n/index.js +4 -0
- package/dist/containers/Tenant/Diagnostics/Describe/Describe.d.ts +2 -1
- package/dist/containers/Tenant/Diagnostics/Describe/Describe.js +4 -4
- package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.js +1 -1
- package/dist/containers/Tenant/Diagnostics/Diagnostics.js +3 -3
- package/dist/containers/Tenant/Diagnostics/Diagnostics.scss +3 -1
- package/dist/containers/Tenant/Diagnostics/HotKeys/HotKeys.d.ts +2 -1
- package/dist/containers/Tenant/Diagnostics/HotKeys/HotKeys.js +3 -3
- package/dist/containers/Tenant/Diagnostics/Overview/Overview.d.ts +2 -1
- package/dist/containers/Tenant/Diagnostics/Overview/Overview.js +6 -18
- package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/TableInfo.d.ts +1 -3
- package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/TableInfo.js +2 -2
- package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/i18n/en.json +14 -1
- package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/i18n/index.d.ts +1 -1
- package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/i18n/index.js +1 -2
- package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/prepareTableInfo.d.ts +2 -3
- package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/prepareTableInfo.js +64 -76
- package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopQueries.js +8 -5
- package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.js +28 -3
- package/dist/containers/Tenant/Diagnostics/TenantOverview/getSectionTitle.d.ts +2 -1
- package/dist/containers/Tenant/Diagnostics/TenantOverview/getSectionTitle.js +2 -2
- package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/en.json +3 -2
- package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/index.d.ts +1 -1
- package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.js +2 -2
- package/dist/containers/Tenant/Diagnostics/TopQueries/getTopQueriesColumns.d.ts +2 -2
- package/dist/containers/Tenant/Diagnostics/TopQueries/getTopQueriesColumns.js +19 -28
- package/dist/containers/Tenant/Diagnostics/TopShards/TopShards.js +7 -17
- package/dist/containers/Tenant/Diagnostics/TopShards/getTopShardsColumns.js +6 -2
- package/dist/containers/Tenant/ObjectSummary/ObjectSummary.js +31 -18
- package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.js +2 -2
- package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.js +8 -3
- package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.d.ts +2 -1
- package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.js +9 -7
- package/dist/containers/Tenant/Query/QuerySettingsDialog/QuerySettingsDialog.d.ts +2 -0
- package/dist/containers/Tenant/Query/QuerySettingsDialog/QuerySettingsDialog.js +38 -0
- package/dist/containers/Tenant/Query/QuerySettingsDialog/QuerySettingsDialog.scss +63 -0
- package/dist/containers/Tenant/Query/QuerySettingsDialog/QuerySettingsSelect.d.ts +15 -0
- package/dist/containers/Tenant/Query/QuerySettingsDialog/QuerySettingsSelect.js +14 -0
- package/dist/containers/Tenant/Query/QuerySettingsDialog/QuerySettingsSelect.scss +19 -0
- package/dist/containers/Tenant/Query/QuerySettingsDialog/constants.d.ts +99 -0
- package/dist/containers/Tenant/Query/QuerySettingsDialog/constants.js +109 -0
- package/dist/containers/Tenant/Query/QuerySettingsDialog/i18n/en.json +13 -0
- package/dist/containers/Tenant/Query/QuerySettingsDialog/i18n/index.d.ts +2 -0
- package/dist/containers/Tenant/Query/QuerySettingsDialog/i18n/index.js +5 -0
- package/dist/containers/Tenant/Query/QuerySettingsDialog/i18n/ru.json +13 -0
- package/dist/containers/Tenant/Query/i18n/en.json +14 -0
- package/dist/containers/Tenant/Query/i18n/index.d.ts +1 -1
- package/dist/containers/Tenant/Schema/CreateDirectoryDialog/CreateDirectoryDialog.d.ts +3 -2
- package/dist/containers/Tenant/Schema/CreateDirectoryDialog/CreateDirectoryDialog.js +2 -2
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.js +2 -2
- package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.js +1 -1
- package/dist/containers/Tenant/Tenant.js +1 -1
- package/dist/containers/Tenant/TenantPages.d.ts +12 -1
- package/dist/containers/Tenant/TenantPages.js +1 -1
- package/dist/containers/Tenant/i18n/en.json +2 -2
- package/dist/containers/Tenant/i18n/index.d.ts +1 -1
- package/dist/containers/Tenant/utils/schema.js +1 -1
- package/dist/containers/Tenants/Tenants.js +1 -1
- package/dist/containers/Tenants/Tenants.scss +0 -4
- package/dist/containers/UserSettings/i18n/en.json +2 -0
- package/dist/containers/UserSettings/i18n/index.d.ts +1 -1
- package/dist/containers/UserSettings/settings.d.ts +1 -0
- package/dist/containers/UserSettings/settings.js +6 -1
- package/dist/routes.js +2 -2
- package/dist/services/api.d.ts +39 -21
- package/dist/services/api.js +45 -56
- package/dist/services/settings.d.ts +1 -0
- package/dist/services/settings.js +2 -1
- package/dist/store/configureStore.d.ts +4 -4
- package/dist/store/defaultStore.d.ts +2 -2
- package/dist/store/reducers/api.d.ts +1 -1
- package/dist/store/reducers/api.js +1 -1
- package/dist/store/reducers/cluster/cluster.d.ts +2 -2
- package/dist/store/reducers/clusterNodes/clusterNodes.d.ts +2 -2
- package/dist/store/reducers/clusters/clusters.d.ts +2 -2
- package/dist/store/reducers/describe.d.ts +5 -2
- package/dist/store/reducers/describe.js +2 -2
- package/dist/store/reducers/executeQuery.d.ts +2 -2
- package/dist/store/reducers/executeTopQueries/executeTopQueries.d.ts +2 -2
- package/dist/store/reducers/executeTopQueries/executeTopQueries.js +20 -14
- package/dist/store/reducers/executeTopQueries/types.d.ts +2 -2
- package/dist/store/reducers/executeTopQueries/utils.js +11 -7
- package/dist/store/reducers/explainQuery/explainQuery.d.ts +2 -2
- package/dist/store/reducers/explainQuery/explainQuery.js +6 -1
- package/dist/store/reducers/healthcheckInfo/healthcheckInfo.d.ts +58 -58
- package/dist/store/reducers/heatmap.d.ts +2 -2
- package/dist/store/reducers/heatmap.js +3 -3
- package/dist/store/reducers/hotKeys/hotKeys.d.ts +3 -2
- package/dist/store/reducers/hotKeys/hotKeys.js +3 -3
- package/dist/store/reducers/index.d.ts +3 -3
- package/dist/store/reducers/network/network.d.ts +2 -2
- package/dist/store/reducers/network/network.js +1 -1
- package/dist/store/reducers/node/node.d.ts +3 -3
- package/dist/store/reducers/node/selectors.d.ts +1 -1
- package/dist/store/reducers/node/selectors.js +2 -2
- package/dist/store/reducers/nodes/nodes.d.ts +3 -3
- package/dist/store/reducers/nodesList.d.ts +3 -3
- package/dist/store/reducers/overview/overview.d.ts +5 -2
- package/dist/store/reducers/overview/overview.js +2 -2
- package/dist/store/reducers/partitions/partitions.d.ts +2 -2
- package/dist/store/reducers/pdisk/pdisk.d.ts +3 -3
- package/dist/store/reducers/pdisk/pdisk.js +15 -2
- package/dist/store/reducers/pdisk/types.d.ts +17 -1
- package/dist/store/reducers/pdisk/utils.d.ts +2 -2
- package/dist/store/reducers/pdisk/utils.js +68 -8
- package/dist/store/reducers/preview.d.ts +2 -2
- package/dist/store/reducers/preview.js +1 -1
- package/dist/store/reducers/queryActions/types.d.ts +1 -1
- package/dist/store/reducers/schema/schema.d.ts +28 -10
- package/dist/store/reducers/schema/schema.js +11 -12
- package/dist/store/reducers/schemaAcl/schemaAcl.d.ts +4 -2
- package/dist/store/reducers/schemaAcl/schemaAcl.js +9 -3
- package/dist/store/reducers/shardsWorkload/shardsWorkload.d.ts +2 -2
- package/dist/store/reducers/shardsWorkload/shardsWorkload.js +22 -6
- package/dist/store/reducers/shardsWorkload/types.d.ts +2 -2
- package/dist/store/reducers/storage/storage.d.ts +3 -3
- package/dist/store/reducers/tablet.d.ts +3 -3
- package/dist/store/reducers/tablets.d.ts +13 -13
- package/dist/store/reducers/tabletsFilters.d.ts +1 -1
- package/dist/store/reducers/tenant/tenant.d.ts +2 -2
- package/dist/store/reducers/tenantOverview/executeTopTables/executeTopTables.d.ts +2 -2
- package/dist/store/reducers/tenantOverview/executeTopTables/executeTopTables.js +1 -1
- package/dist/store/reducers/tenantOverview/topNodes/topNodes.d.ts +2 -2
- package/dist/store/reducers/tenantOverview/topShards/tenantOverviewTopShards.d.ts +2 -2
- package/dist/store/reducers/tenantOverview/topShards/tenantOverviewTopShards.js +1 -1
- package/dist/store/reducers/tenantOverview/topStorageGroups/topStorageGroups.d.ts +2 -2
- package/dist/store/reducers/tenants/selectors.d.ts +27 -27
- package/dist/store/reducers/tenants/tenants.d.ts +2 -2
- package/dist/store/reducers/topic.d.ts +44 -44
- package/dist/store/reducers/vdisk/vdisk.d.ts +2 -2
- package/dist/store/reducers/vdisk/vdisk.js +1 -1
- package/dist/store/reducers/viewSchema/viewSchema.d.ts +2 -2
- package/dist/store/reducers/viewSchema/viewSchema.js +1 -1
- package/dist/store/state-url-mapping.d.ts +70 -0
- package/dist/store/state-url-mapping.js +1 -5
- package/dist/styles/mixins.scss +11 -0
- package/dist/types/api/acl.d.ts +1 -0
- package/dist/types/api/pdisk.d.ts +65 -2
- package/dist/types/api/schema/schema.d.ts +21 -0
- package/dist/types/api/vdisk.d.ts +33 -2
- package/dist/types/common.d.ts +3 -0
- package/dist/types/store/heatmap.d.ts +1 -0
- package/dist/types/store/query.d.ts +4 -1
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.js +1 -0
- package/dist/utils/dataFormatters/dataFormatters.d.ts +0 -4
- package/dist/utils/dataFormatters/dataFormatters.js +2 -8
- package/dist/utils/developerUI/developerUI.d.ts +1 -0
- package/dist/utils/developerUI/developerUI.js +3 -0
- package/dist/utils/diagnostics.d.ts +21 -17
- package/dist/utils/diagnostics.js +28 -7
- package/dist/utils/disks/getPDiskType.d.ts +3 -3
- package/dist/utils/disks/helpers.d.ts +1 -0
- package/dist/utils/disks/helpers.js +3 -0
- package/dist/utils/disks/prepareDisks.d.ts +2 -2
- package/dist/utils/disks/prepareDisks.js +17 -22
- package/dist/utils/disks/types.d.ts +7 -5
- package/dist/utils/monaco/constats.d.ts +2 -0
- package/dist/utils/monaco/constats.js +2 -0
- package/dist/utils/monaco/yql/constants.d.ts +0 -1
- package/dist/utils/monaco/yql/constants.js +0 -1
- package/dist/utils/monaco/yql/yql.completionItemProvider.js +3 -3
- package/dist/utils/query.d.ts +24 -1
- package/dist/utils/query.js +40 -0
- package/package.json +5 -1
- package/dist/components/NodeHostWrapper/NodeHostWrapper.scss +0 -15
- package/dist/containers/Node/NodeStructure/Vdisk.d.ts +0 -6
- package/dist/containers/Node/NodeStructure/Vdisk.js +0 -13
- package/dist/containers/PDiskPage/PDiskGroups.d.ts +0 -9
- package/dist/containers/PDiskPage/PDiskGroups.js +0 -20
- package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/i18n/ru.json +0 -5
- package/dist/store/reducers/olapStats.d.ts +0 -5
- package/dist/store/reducers/olapStats.js +0 -31
- package/dist/store/reducers/tenantOverview/topQueries/tenantOverviewTopQueries.d.ts +0 -5
- package/dist/store/reducers/tenantOverview/topQueries/tenantOverviewTopQueries.js +0 -38
- package/dist/utils/monaco/index.d.ts +0 -1
- package/dist/utils/monaco/index.js +0 -6
- package/dist/utils/monaco/s-expression/constants.d.ts +0 -1
- package/dist/utils/monaco/s-expression/constants.js +0 -1
- package/dist/utils/monaco/s-expression/registerLanguage.d.ts +0 -1
- package/dist/utils/monaco/s-expression/registerLanguage.js +0 -59
- package/dist/utils/monaco/yql/registerLanguage.d.ts +0 -1
- package/dist/utils/monaco/yql/registerLanguage.js +0 -8
- package/dist/utils/monaco/yql/yql.d.ts +0 -7
- package/dist/utils/monaco/yql/yql.js +0 -180
- package/dist/utils/monaco/yql/yql.keywords.d.ts +0 -3
- package/dist/utils/monaco/yql/yql.keywords.js +0 -3
@@ -3,26 +3,17 @@ import DataTable from '@gravity-ui/react-data-table';
|
|
3
3
|
import { OneLineQueryWithPopover, TruncatedQuery, } from '../../../../components/TruncatedQuery/TruncatedQuery';
|
4
4
|
import { cn } from '../../../../utils/cn';
|
5
5
|
import { formatDateTime, formatNumber } from '../../../../utils/dataFormatters/dataFormatters';
|
6
|
+
import { TOP_QUERIES_COLUMNS_IDS } from '../../../../utils/diagnostics';
|
6
7
|
import { generateHash } from '../../../../utils/generateHash';
|
7
|
-
import { parseUsToMs } from '../../../../utils/timeParsers';
|
8
|
+
import { formatToMs, parseUsToMs } from '../../../../utils/timeParsers';
|
8
9
|
import { MAX_QUERY_HEIGHT } from '../../utils/constants';
|
9
10
|
import './TopQueries.scss';
|
10
11
|
const b = cn('kv-top-queries');
|
11
12
|
export const TOP_QUERIES_COLUMNS_WIDTH_LS_KEY = 'topQueriesColumnsWidth';
|
12
|
-
const TOP_QUERIES_COLUMNS_IDS = {
|
13
|
-
CPUTimeUs: 'CPUTimeUs',
|
14
|
-
QueryText: 'QueryText',
|
15
|
-
EndTime: 'EndTime',
|
16
|
-
ReadRows: 'ReadRows',
|
17
|
-
ReadBytes: 'ReadBytes',
|
18
|
-
UserSID: 'UserSID',
|
19
|
-
OneLineQueryText: 'OneLineQueryText',
|
20
|
-
QueryHash: 'QueryHash',
|
21
|
-
Duration: 'Duration',
|
22
|
-
};
|
23
13
|
const cpuTimeUsColumn = {
|
24
14
|
name: TOP_QUERIES_COLUMNS_IDS.CPUTimeUs,
|
25
15
|
sortAccessor: (row) => Number(row.CPUTimeUs),
|
16
|
+
render: ({ row }) => { var _a; return formatToMs(parseUsToMs((_a = row.CPUTimeUs) !== null && _a !== void 0 ? _a : undefined)); },
|
26
17
|
width: 120,
|
27
18
|
align: DataTable.RIGHT,
|
28
19
|
sortable: false,
|
@@ -78,23 +69,23 @@ const queryHashColumn = {
|
|
78
69
|
};
|
79
70
|
const durationColumn = {
|
80
71
|
name: TOP_QUERIES_COLUMNS_IDS.Duration,
|
81
|
-
header: 'Duration
|
82
|
-
render: ({ row }) => { var _a; return
|
72
|
+
header: 'Duration',
|
73
|
+
render: ({ row }) => { var _a; return formatToMs(parseUsToMs((_a = row.Duration) !== null && _a !== void 0 ? _a : undefined)); },
|
83
74
|
sortAccessor: (row) => Number(row.Duration),
|
84
75
|
align: DataTable.RIGHT,
|
85
76
|
width: 150,
|
86
77
|
};
|
87
|
-
export const
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
78
|
+
export const TOP_QUERIES_COLUMNS = [
|
79
|
+
cpuTimeUsColumn,
|
80
|
+
queryTextColumn,
|
81
|
+
endTimeColumn,
|
82
|
+
durationColumn,
|
83
|
+
readRowsColumn,
|
84
|
+
readBytesColumn,
|
85
|
+
userSIDColumn,
|
86
|
+
];
|
87
|
+
export const TENANT_OVERVIEW_TOP_QUERUES_COLUMNS = [
|
88
|
+
queryHashColumn,
|
89
|
+
oneLineQueryTextColumn,
|
90
|
+
cpuTimeUsColumn,
|
91
|
+
];
|
@@ -7,9 +7,9 @@ import { TableWithControlsLayout } from '../../../../components/TableWithControl
|
|
7
7
|
import { setShardsQueryFilters, shardApi, } from '../../../../store/reducers/shardsWorkload/shardsWorkload';
|
8
8
|
import { EShardsWorkloadMode } from '../../../../store/reducers/shardsWorkload/types';
|
9
9
|
import { cn } from '../../../../utils/cn';
|
10
|
-
import { DEFAULT_TABLE_SETTINGS
|
10
|
+
import { DEFAULT_TABLE_SETTINGS } from '../../../../utils/constants';
|
11
11
|
import { formatDateTime } from '../../../../utils/dataFormatters/dataFormatters';
|
12
|
-
import { isSortableTopShardsProperty } from '../../../../utils/diagnostics';
|
12
|
+
import { TOP_SHARD_COLUMNS_IDS, isSortableTopShardsProperty } from '../../../../utils/diagnostics';
|
13
13
|
import { useAutoRefreshInterval, useTypedDispatch, useTypedSelector } from '../../../../utils/hooks';
|
14
14
|
import { parseQueryErrorToString } from '../../../../utils/query';
|
15
15
|
import { isColumnEntityType } from '../../utils/schema';
|
@@ -25,16 +25,6 @@ const TABLE_SETTINGS = {
|
|
25
25
|
disableSortReset: true,
|
26
26
|
defaultOrder: DataTable.DESCENDING,
|
27
27
|
};
|
28
|
-
const tableColumnsNames = {
|
29
|
-
TabletId: 'TabletId',
|
30
|
-
CPUCores: 'CPUCores',
|
31
|
-
DataSize: 'DataSize',
|
32
|
-
Path: 'Path',
|
33
|
-
NodeId: 'NodeId',
|
34
|
-
PeakTime: 'PeakTime',
|
35
|
-
InFlightTxCount: 'InFlightTxCount',
|
36
|
-
IntervalEnd: 'IntervalEnd',
|
37
|
-
};
|
38
28
|
function prepareDateTimeValue(value) {
|
39
29
|
if (!value) {
|
40
30
|
return '–';
|
@@ -62,8 +52,8 @@ function dataTableToStringSortOrder(value = []) {
|
|
62
52
|
return sortOrders.map(({ columnId }) => columnId).join(',');
|
63
53
|
}
|
64
54
|
function fillDateRangeFor(value) {
|
65
|
-
value.to =
|
66
|
-
value.from =
|
55
|
+
value.to = 'now';
|
56
|
+
value.from = 'now-1h';
|
67
57
|
return value;
|
68
58
|
}
|
69
59
|
export const TopShards = ({ tenantName, path, type }) => {
|
@@ -83,7 +73,7 @@ export const TopShards = ({ tenantName, path, type }) => {
|
|
83
73
|
}
|
84
74
|
return defaultValue;
|
85
75
|
});
|
86
|
-
const [sortOrder, setSortOrder] = React.useState(
|
76
|
+
const [sortOrder, setSortOrder] = React.useState(TOP_SHARD_COLUMNS_IDS.CPUCores);
|
87
77
|
const { data: result, isFetching, error, } = shardApi.useSendShardQueryQuery({
|
88
78
|
database: tenantName,
|
89
79
|
path: path,
|
@@ -124,14 +114,14 @@ export const TopShards = ({ tenantName, path, type }) => {
|
|
124
114
|
if (filters.mode === EShardsWorkloadMode.History) {
|
125
115
|
// after NodeId
|
126
116
|
columns.splice(5, 0, {
|
127
|
-
name:
|
117
|
+
name: TOP_SHARD_COLUMNS_IDS.PeakTime,
|
128
118
|
render: ({ row }) => {
|
129
119
|
return prepareDateTimeValue(row.PeakTime);
|
130
120
|
},
|
131
121
|
sortable: false,
|
132
122
|
});
|
133
123
|
columns.push({
|
134
|
-
name:
|
124
|
+
name: TOP_SHARD_COLUMNS_IDS.IntervalEnd,
|
135
125
|
render: ({ row }) => {
|
136
126
|
return prepareDateTimeValue(row.IntervalEnd);
|
137
127
|
},
|
@@ -1,11 +1,14 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import DataTable from '@gravity-ui/react-data-table';
|
3
|
+
import { DeveloperUILinkButton } from '../../../../components/DeveloperUILinkButton/DeveloperUILinkButton';
|
4
|
+
import { EntityStatus } from '../../../../components/EntityStatus/EntityStatus';
|
3
5
|
import { InternalLink } from '../../../../components/InternalLink';
|
4
6
|
import { LinkToSchemaObject } from '../../../../components/LinkToSchemaObject/LinkToSchemaObject';
|
5
7
|
import { UsageLabel } from '../../../../components/UsageLabel/UsageLabel';
|
6
8
|
import routes, { createHref } from '../../../../routes';
|
7
9
|
import { getLoadSeverityForShard } from '../../../../store/reducers/tenantOverview/topShards/utils';
|
8
10
|
import { formatNumber, roundToPrecision } from '../../../../utils/dataFormatters/dataFormatters';
|
11
|
+
import { createTabletDeveloperUIHref } from '../../../../utils/developerUI/developerUI';
|
9
12
|
import { getDefaultNodePath } from '../../../Node/NodePages';
|
10
13
|
export const TOP_SHARDS_COLUMNS_WIDTH_LS_KEY = 'topShardsColumnsWidth';
|
11
14
|
const TOP_SHARDS_COLUMNS_IDS = {
|
@@ -61,13 +64,14 @@ const tabletIdColumn = {
|
|
61
64
|
name: TOP_SHARDS_COLUMNS_IDS.TabletId,
|
62
65
|
header: tableColumnsNames[TOP_SHARDS_COLUMNS_IDS.TabletId],
|
63
66
|
render: ({ row }) => {
|
67
|
+
var _a;
|
64
68
|
if (!row.TabletId) {
|
65
69
|
return '–';
|
66
70
|
}
|
67
|
-
return (_jsx(
|
71
|
+
return (_jsx(EntityStatus, { name: (_a = row.TabletId) === null || _a === void 0 ? void 0 : _a.toString(), path: createHref(routes.tablet, { id: row.TabletId }), hasClipboardButton: true, showStatus: false, additionalControls: _jsx(DeveloperUILinkButton, { href: createTabletDeveloperUIHref(row.TabletId) }) }));
|
68
72
|
},
|
69
73
|
sortable: false,
|
70
|
-
width:
|
74
|
+
width: 220,
|
71
75
|
};
|
72
76
|
const nodeIdColumn = {
|
73
77
|
name: TOP_SHARDS_COLUMNS_IDS.NodeId,
|
@@ -8,6 +8,7 @@ import { Link, useLocation } from 'react-router-dom';
|
|
8
8
|
import { StringParam, useQueryParam } from 'use-query-params';
|
9
9
|
import { AsyncReplicationState } from '../../../components/AsyncReplicationState';
|
10
10
|
import { ClipboardButton } from '../../../components/ClipboardButton';
|
11
|
+
import { toFormattedSize } from '../../../components/FormattedBytes/utils';
|
11
12
|
import InfoViewer from '../../../components/InfoViewer/InfoViewer';
|
12
13
|
import { LinkWithIcon } from '../../../components/LinkWithIcon/LinkWithIcon';
|
13
14
|
import { Loader } from '../../../components/Loader';
|
@@ -19,7 +20,7 @@ import { setQueryTab, setSummaryTab, setTenantPage } from '../../../store/reduce
|
|
19
20
|
import { EPathSubType, EPathType } from '../../../types/api/schema';
|
20
21
|
import { cn } from '../../../utils/cn';
|
21
22
|
import { DEFAULT_IS_TENANT_COMMON_INFO_COLLAPSED, DEFAULT_SIZE_TENANT_SUMMARY_KEY, } from '../../../utils/constants';
|
22
|
-
import { formatDateTime, formatSecondsToHours } from '../../../utils/dataFormatters/dataFormatters';
|
23
|
+
import { formatDateTime, formatNumber, formatSecondsToHours, } from '../../../utils/dataFormatters/dataFormatters';
|
23
24
|
import { useTypedDispatch, useTypedSelector } from '../../../utils/hooks';
|
24
25
|
import { Acl } from '../Acl/Acl';
|
25
26
|
import { EntityTitle } from '../EntityTitle/EntityTitle';
|
@@ -48,7 +49,7 @@ export function ObjectSummary({ type, subType, tenantName, path, onCollapseSumma
|
|
48
49
|
const queryParams = qs.parse(location.search, {
|
49
50
|
ignoreQueryPrefix: true,
|
50
51
|
});
|
51
|
-
const { data: currentObjectData } = useGetSchemaQuery({ path });
|
52
|
+
const { data: currentObjectData } = useGetSchemaQuery({ path, database: tenantName });
|
52
53
|
const currentSchemaData = (_a = currentObjectData === null || currentObjectData === void 0 ? void 0 : currentObjectData.PathDescription) === null || _a === void 0 ? void 0 : _a.Self;
|
53
54
|
React.useEffect(() => {
|
54
55
|
const isTable = isTableType(type);
|
@@ -86,10 +87,33 @@ export function ObjectSummary({ type, subType, tenantName, path, onCollapseSumma
|
|
86
87
|
overview.push({ label: i18n('summary.version'), value: PathVersion });
|
87
88
|
overview.push({
|
88
89
|
label: i18n('summary.created'),
|
89
|
-
value: formatDateTime(CreateStep
|
90
|
+
value: formatDateTime(CreateStep),
|
90
91
|
});
|
91
92
|
const { PathDescription } = currentObjectData;
|
93
|
+
if (PathDescription === null || PathDescription === void 0 ? void 0 : PathDescription.TableStats) {
|
94
|
+
const { DataSize, RowCount } = PathDescription.TableStats;
|
95
|
+
overview.push({
|
96
|
+
label: i18n('summary.data-size'),
|
97
|
+
value: toFormattedSize(DataSize),
|
98
|
+
}, {
|
99
|
+
label: i18n('summary.row-count'),
|
100
|
+
value: formatNumber(RowCount),
|
101
|
+
});
|
102
|
+
}
|
92
103
|
const title = _jsx(EntityTitle, { data: PathDescription });
|
104
|
+
const getDatabaseOverview = () => {
|
105
|
+
var _a, _b;
|
106
|
+
return [
|
107
|
+
{
|
108
|
+
label: i18n('summary.paths'),
|
109
|
+
value: (_a = PathDescription === null || PathDescription === void 0 ? void 0 : PathDescription.DomainDescription) === null || _a === void 0 ? void 0 : _a.PathsInside,
|
110
|
+
},
|
111
|
+
{
|
112
|
+
label: i18n('summary.shards'),
|
113
|
+
value: (_b = PathDescription === null || PathDescription === void 0 ? void 0 : PathDescription.DomainDescription) === null || _b === void 0 ? void 0 : _b.ShardsInside,
|
114
|
+
},
|
115
|
+
];
|
116
|
+
};
|
93
117
|
const getPathTypeOverview = {
|
94
118
|
[EPathType.EPathTypeInvalid]: undefined,
|
95
119
|
[EPathType.EPathTypeDir]: undefined,
|
@@ -102,21 +126,9 @@ export function ObjectSummary({ type, subType, tenantName, path, onCollapseSumma
|
|
102
126
|
},
|
103
127
|
];
|
104
128
|
},
|
105
|
-
[EPathType.EPathTypeSubDomain]:
|
129
|
+
[EPathType.EPathTypeSubDomain]: getDatabaseOverview,
|
106
130
|
[EPathType.EPathTypeTableIndex]: undefined,
|
107
|
-
[EPathType.EPathTypeExtSubDomain]:
|
108
|
-
var _a, _b;
|
109
|
-
return [
|
110
|
-
{
|
111
|
-
label: i18n('summary.paths'),
|
112
|
-
value: (_a = PathDescription === null || PathDescription === void 0 ? void 0 : PathDescription.DomainDescription) === null || _a === void 0 ? void 0 : _a.PathsInside,
|
113
|
-
},
|
114
|
-
{
|
115
|
-
label: i18n('summary.shards'),
|
116
|
-
value: (_b = PathDescription === null || PathDescription === void 0 ? void 0 : PathDescription.DomainDescription) === null || _b === void 0 ? void 0 : _b.ShardsInside,
|
117
|
-
},
|
118
|
-
];
|
119
|
-
},
|
131
|
+
[EPathType.EPathTypeExtSubDomain]: getDatabaseOverview,
|
120
132
|
[EPathType.EPathTypeColumnStore]: () => {
|
121
133
|
var _a, _b;
|
122
134
|
return [
|
@@ -212,7 +224,7 @@ export function ObjectSummary({ type, subType, tenantName, path, onCollapseSumma
|
|
212
224
|
const renderTabContent = () => {
|
213
225
|
switch (summaryTab) {
|
214
226
|
case TENANT_SUMMARY_TABS_IDS.acl: {
|
215
|
-
return _jsx(Acl, { path: path });
|
227
|
+
return _jsx(Acl, { path: path, database: tenantName });
|
216
228
|
}
|
217
229
|
case TENANT_SUMMARY_TABS_IDS.schema: {
|
218
230
|
return _jsx(SchemaViewer, { type: type, path: path, tenantName: tenantName });
|
@@ -257,6 +269,7 @@ function ObjectTree({ tenantName, path }) {
|
|
257
269
|
var _a;
|
258
270
|
const { data: tenantData = {}, isLoading } = useGetSchemaQuery({
|
259
271
|
path: tenantName,
|
272
|
+
database: tenantName,
|
260
273
|
});
|
261
274
|
const pathData = (_a = tenantData === null || tenantData === void 0 ? void 0 : tenantData.PathDescription) === null || _a === void 0 ? void 0 : _a.Self;
|
262
275
|
const [, setCurrentPath] = useQueryParam('schema', StringParam);
|
@@ -12,7 +12,7 @@ import { explainVersions } from '../../../../store/reducers/explainQuery/utils';
|
|
12
12
|
import { disableFullscreen } from '../../../../store/reducers/fullscreen';
|
13
13
|
import { cn } from '../../../../utils/cn';
|
14
14
|
import { useTypedDispatch, useTypedSelector } from '../../../../utils/hooks';
|
15
|
-
import {
|
15
|
+
import { S_EXPRESSION_LANGUAGE_ID } from '../../../../utils/monaco/constats';
|
16
16
|
import { parseQueryErrorToString } from '../../../../utils/query';
|
17
17
|
import { PaneVisibilityToggleButtons } from '../../utils/paneVisibilityToggleHelpers';
|
18
18
|
import { renderExplainNode } from './utils';
|
@@ -98,7 +98,7 @@ export function ExplainResult(props) {
|
|
98
98
|
return (_jsxs(React.Fragment, { children: [content, isFullscreen && _jsx(Fullscreen, { children: content })] }));
|
99
99
|
};
|
100
100
|
const renderAstExplain = () => {
|
101
|
-
const content = (_jsx("div", { className: b('ast'), children: _jsx(MonacoEditor, { language:
|
101
|
+
const content = (_jsx("div", { className: b('ast'), children: _jsx(MonacoEditor, { language: S_EXPRESSION_LANGUAGE_ID, value: props.ast, options: EDITOR_OPTIONS, wrappingIndent: "indent", theme: `vs-${props.theme}` }) }));
|
102
102
|
return (_jsxs(React.Fragment, { children: [content, isFullscreen && _jsx(Fullscreen, { children: content })] }));
|
103
103
|
};
|
104
104
|
const renderGraph = () => {
|
@@ -11,13 +11,14 @@ import { setShowPreview } from '../../../../store/reducers/schema/schema';
|
|
11
11
|
import { cn } from '../../../../utils/cn';
|
12
12
|
import { DEFAULT_IS_QUERY_RESULT_COLLAPSED, DEFAULT_SIZE_RESULT_PANE_KEY, LAST_USED_QUERY_ACTION_KEY, QUERY_USE_MULTI_SCHEMA_KEY, } from '../../../../utils/constants';
|
13
13
|
import { useQueryModes, useSetting } from '../../../../utils/hooks';
|
14
|
-
import {
|
14
|
+
import { YQL_LANGUAGE_ID } from '../../../../utils/monaco/constats';
|
15
15
|
import { QUERY_ACTIONS } from '../../../../utils/query';
|
16
16
|
import { PaneVisibilityActionTypes, paneVisibilityToggleReducerCreator, } from '../../utils/paneVisibilityToggleHelpers';
|
17
17
|
import { ExecuteResult } from '../ExecuteResult/ExecuteResult';
|
18
18
|
import { ExplainResult } from '../ExplainResult/ExplainResult';
|
19
19
|
import { Preview } from '../Preview/Preview';
|
20
20
|
import { QueryEditorControls } from '../QueryEditorControls/QueryEditorControls';
|
21
|
+
import { QuerySettingsDialog } from '../QuerySettingsDialog/QuerySettingsDialog';
|
21
22
|
import { SaveQueryDialog } from '../SaveQuery/SaveQuery';
|
22
23
|
import i18n from '../i18n';
|
23
24
|
import { useEditorOptions } from './helpers';
|
@@ -133,6 +134,10 @@ function QueryEditor(props) {
|
|
133
134
|
}
|
134
135
|
dispatchResultVisibilityState(PaneVisibilityActionTypes.triggerExpand);
|
135
136
|
};
|
137
|
+
const handleSettingsClick = () => {
|
138
|
+
setQueryAction('settings');
|
139
|
+
props.setShowPreview(false);
|
140
|
+
};
|
136
141
|
const handleGetExplainQueryClick = (mode) => {
|
137
142
|
const { input } = executeQuery;
|
138
143
|
setLastUsedQueryAction(QUERY_ACTIONS.explain);
|
@@ -255,11 +260,11 @@ function QueryEditor(props) {
|
|
255
260
|
dispatchResultVisibilityState(PaneVisibilityActionTypes.clear);
|
256
261
|
};
|
257
262
|
const renderControls = () => {
|
258
|
-
return (_jsx(QueryEditorControls, { onRunButtonClick: handleSendExecuteClick, runIsLoading: executeQueryResult.isLoading, onExplainButtonClick: handleGetExplainQueryClick, explainIsLoading: explainQueryResult.isLoading, disabled: !executeQuery.input, onUpdateQueryMode: setQueryMode, queryMode: queryMode, highlightedAction: lastUsedQueryAction }));
|
263
|
+
return (_jsx(QueryEditorControls, { onRunButtonClick: handleSendExecuteClick, onSettingsButtonClick: handleSettingsClick, runIsLoading: executeQueryResult.isLoading, onExplainButtonClick: handleGetExplainQueryClick, explainIsLoading: explainQueryResult.isLoading, disabled: !executeQuery.input, onUpdateQueryMode: setQueryMode, queryMode: queryMode, highlightedAction: lastUsedQueryAction }));
|
259
264
|
};
|
260
265
|
return (_jsxs("div", { className: b(), children: [_jsxs(SplitPane, { direction: "vertical", defaultSizePaneKey: DEFAULT_SIZE_RESULT_PANE_KEY, triggerCollapse: resultVisibilityState.triggerCollapse, triggerExpand: resultVisibilityState.triggerExpand, minSize: [0, 52], collapsedSizes: [100, 0], onSplitStartDragAdditional: onSplitStartDragAdditional, children: [_jsxs("div", { className: b('pane-wrapper', {
|
261
266
|
top: true,
|
262
|
-
}), children: [_jsx("div", { className: b('monaco-wrapper'), children: _jsx("div", { className: b('monaco'), children: _jsx(MonacoEditor, { language:
|
267
|
+
}), children: [_jsx("div", { className: b('monaco-wrapper'), children: _jsx("div", { className: b('monaco'), children: _jsx(MonacoEditor, { language: YQL_LANGUAGE_ID, value: executeQuery.input, options: editorOptions, onChange: onChange, editorDidMount: editorDidMount, theme: `vs-${theme}` }) }) }), renderControls()] }), _jsx("div", { className: b('pane-wrapper'), children: _jsx(Result, { executeQueryData: executeQueryResult.data, executeQueryError: executeQueryResult.error, explainQueryData: explainQueryResult.data, explainQueryError: explainQueryResult.error, explainQueryLoading: explainQueryResult.isLoading, resultVisibilityState: resultVisibilityState, onExpandResultHandler: onExpandResultHandler, onCollapseResultHandler: onCollapseResultHandler, type: type, theme: theme, resultType: resultType, tenantName: tenantName, path: path, showPreview: showPreview }) })] }), _jsx(SaveQueryDialog, {}), _jsx(QuerySettingsDialog, {})] }));
|
263
268
|
}
|
264
269
|
const mapStateToProps = (state) => {
|
265
270
|
return {
|
@@ -2,6 +2,7 @@ import type { QueryAction, QueryMode } from '../../../../types/store/query';
|
|
2
2
|
import './QueryEditorControls.scss';
|
3
3
|
interface QueryEditorControlsProps {
|
4
4
|
onRunButtonClick: (mode?: QueryMode) => void;
|
5
|
+
onSettingsButtonClick: () => void;
|
5
6
|
runIsLoading: boolean;
|
6
7
|
onExplainButtonClick: (mode?: QueryMode) => void;
|
7
8
|
explainIsLoading: boolean;
|
@@ -10,5 +11,5 @@ interface QueryEditorControlsProps {
|
|
10
11
|
queryMode: QueryMode;
|
11
12
|
highlightedAction: QueryAction;
|
12
13
|
}
|
13
|
-
export declare const QueryEditorControls: ({ onRunButtonClick, runIsLoading, onExplainButtonClick, explainIsLoading, disabled,
|
14
|
+
export declare const QueryEditorControls: ({ onRunButtonClick, onSettingsButtonClick, onUpdateQueryMode, runIsLoading, onExplainButtonClick, explainIsLoading, disabled, queryMode, highlightedAction, }: QueryEditorControlsProps) => import("react/jsx-runtime").JSX.Element;
|
14
15
|
export {};
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import React from 'react';
|
3
|
-
import { ChevronDown, PlayFill } from '@gravity-ui/icons';
|
3
|
+
import { ChevronDown, Gear, PlayFill } from '@gravity-ui/icons';
|
4
4
|
import { Button, DropdownMenu, Icon } from '@gravity-ui/uikit';
|
5
5
|
import { LabelWithPopover } from '../../../../components/LabelWithPopover';
|
6
|
+
import { QUERY_SETTINGS, useSetting } from '../../../../lib';
|
6
7
|
import { cn } from '../../../../utils/cn';
|
7
8
|
import { QUERY_MODES, QUERY_MODES_TITLES } from '../../../../utils/query';
|
8
9
|
import { SaveQuery } from '../SaveQuery/SaveQuery';
|
@@ -33,7 +34,10 @@ const QueryModeSelectorOptions = {
|
|
33
34
|
description: i18n('method-description.pg'),
|
34
35
|
},
|
35
36
|
};
|
36
|
-
export const QueryEditorControls = ({ onRunButtonClick, runIsLoading, onExplainButtonClick, explainIsLoading, disabled,
|
37
|
+
export const QueryEditorControls = ({ onRunButtonClick, onSettingsButtonClick, onUpdateQueryMode, runIsLoading, onExplainButtonClick, explainIsLoading, disabled, queryMode, highlightedAction, }) => {
|
38
|
+
const [useQuerySettings] = useSetting(QUERY_SETTINGS);
|
39
|
+
const runView = highlightedAction === 'execute' ? 'action' : undefined;
|
40
|
+
const explainView = highlightedAction === 'explain' ? 'action' : undefined;
|
37
41
|
const querySelectorMenuItems = React.useMemo(() => {
|
38
42
|
return Object.entries(QueryModeSelectorOptions).map(([mode, { title, description }]) => {
|
39
43
|
return {
|
@@ -44,14 +48,12 @@ export const QueryEditorControls = ({ onRunButtonClick, runIsLoading, onExplainB
|
|
44
48
|
};
|
45
49
|
});
|
46
50
|
}, [onUpdateQueryMode]);
|
47
|
-
const runView = highlightedAction === 'execute' ? 'action' : undefined;
|
48
|
-
const explainView = highlightedAction === 'explain' ? 'action' : undefined;
|
49
51
|
return (_jsxs("div", { className: b(), children: [_jsxs("div", { className: b('left'), children: [_jsxs(Button, { onClick: () => {
|
50
52
|
onRunButtonClick(queryMode);
|
51
|
-
}, disabled: disabled, loading: runIsLoading, view: runView, children: [_jsx(Icon, { data: PlayFill, size: 14 }), 'Run'] }), _jsx(Button, { onClick: () => {
|
53
|
+
}, disabled: disabled, loading: runIsLoading, view: runView, className: b('run-button'), children: [_jsx(Icon, { data: PlayFill, size: 14 }), 'Run'] }), _jsx(Button, { onClick: () => {
|
52
54
|
onExplainButtonClick(queryMode);
|
53
|
-
}, disabled: disabled, loading: explainIsLoading, view: explainView, children: "Explain" }), _jsx("div", { className: b('mode-selector'), children: _jsx(DropdownMenu, { items: querySelectorMenuItems, popupProps: {
|
55
|
+
}, disabled: disabled, loading: explainIsLoading, view: explainView, children: "Explain" }), useQuerySettings ? (_jsx(Button, { onClick: onSettingsButtonClick, loading: runIsLoading, className: b('gear-button'), children: _jsx(Icon, { data: Gear, size: 16 }) })) : (_jsx("div", { className: b('mode-selector'), children: _jsx(DropdownMenu, { items: querySelectorMenuItems, popupProps: {
|
54
56
|
className: b('mode-selector__popup'),
|
55
57
|
qa: queryModeSelectorPopupQa,
|
56
|
-
}, switcher: _jsx(Button, { className: b('mode-selector__button'), qa: queryModeSelectorQa, children: _jsxs("span", { className: b('mode-selector__button-content'), children: [`${i18n('controls.query-mode-selector_type')} ${QueryModeSelectorOptions[queryMode].title}`, _jsx(Icon, { data: ChevronDown })] }) }) }) })] }), _jsx(SaveQuery, { isSaveButtonDisabled: disabled })] }));
|
58
|
+
}, switcher: _jsx(Button, { className: b('mode-selector__button'), qa: queryModeSelectorQa, children: _jsxs("span", { className: b('mode-selector__button-content'), children: [`${i18n('controls.query-mode-selector_type')} ${QueryModeSelectorOptions[queryMode].title}`, _jsx(Icon, { data: ChevronDown })] }) }) }) }))] }), _jsx(SaveQuery, { isSaveButtonDisabled: disabled })] }));
|
57
59
|
};
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import React from 'react';
|
3
|
+
import { Dialog, Link as ExternalLink, Flex, TextInput } from '@gravity-ui/uikit';
|
4
|
+
import { Controller, useForm } from 'react-hook-form';
|
5
|
+
import { selectQueryAction, setQueryAction, } from '../../../../store/reducers/queryActions/queryActions';
|
6
|
+
import { cn } from '../../../../utils/cn';
|
7
|
+
import { useTypedDispatch, useTypedSelector } from '../../../../utils/hooks';
|
8
|
+
import { ISOLATION_LEVELS, QUERY_MODES, STATISTICS_MODES, TRACING_LEVELS, } from '../../../../utils/query';
|
9
|
+
import { QuerySettingsSelect } from './QuerySettingsSelect';
|
10
|
+
import { ISOLATION_LEVEL_SELECT_OPTIONS, QUERY_MODE_SELECT_OPTIONS, STATISTICS_MODE_SELECT_OPTIONS, TRACING_LEVEL_SELECT_OPTIONS, } from './constants';
|
11
|
+
import i18n from './i18n';
|
12
|
+
import './QuerySettingsDialog.scss';
|
13
|
+
const b = cn('ydb-query-settings-dialog');
|
14
|
+
export function QuerySettingsDialog() {
|
15
|
+
const dispatch = useTypedDispatch();
|
16
|
+
const queryAction = useTypedSelector(selectQueryAction);
|
17
|
+
const { control, handleSubmit, reset } = useForm({
|
18
|
+
defaultValues: {
|
19
|
+
queryMode: QUERY_MODES.script,
|
20
|
+
timeout: '60',
|
21
|
+
isolationLevel: ISOLATION_LEVELS.serializable,
|
22
|
+
statisticsMode: STATISTICS_MODES.none,
|
23
|
+
tracingLevel: TRACING_LEVELS.detailed,
|
24
|
+
},
|
25
|
+
});
|
26
|
+
const onCloseDialog = () => {
|
27
|
+
dispatch(setQueryAction('idle'));
|
28
|
+
reset();
|
29
|
+
};
|
30
|
+
const onSaveClick = (data) => {
|
31
|
+
console.log('Form Data:', data);
|
32
|
+
// dispatch(saveQuerySettings(data));
|
33
|
+
onCloseDialog();
|
34
|
+
};
|
35
|
+
return (_jsxs(Dialog, { open: queryAction === 'settings', size: "s", onClose: onCloseDialog, className: b(), hasCloseButton: false, children: [_jsx(Dialog.Header, { caption: i18n('action.settings') }), _jsxs("form", { onSubmit: handleSubmit(onSaveClick), children: [_jsxs(Dialog.Body, { className: b('dialog-body'), children: [_jsxs(Flex, { direction: "row", alignItems: "flex-start", className: b('dialog-row'), children: [_jsx("label", { htmlFor: "queryMode", className: b('field-title'), children: i18n('form.query-mode') }), _jsx("div", { className: b('control-wrapper'), children: _jsx(Controller, { name: "queryMode", control: control, render: ({ field }) => (_jsx(QuerySettingsSelect, { setting: field.value, onUpdateSetting: field.onChange, settingOptions: QUERY_MODE_SELECT_OPTIONS })) }) })] }), _jsxs(Flex, { direction: "row", alignItems: "flex-start", className: b('dialog-row'), children: [_jsx("label", { htmlFor: "timeout", className: b('field-title'), children: i18n('form.timeout') }), _jsx("div", { className: b('control-wrapper'), children: _jsx(Controller, { name: "timeout", control: control, render: ({ field }) => (_jsxs(React.Fragment, { children: [_jsx(TextInput, { type: "number", ...field, className: b('timeout'), placeholder: "60" }), _jsx("span", { className: b('timeout-suffix'), children: i18n('form.timeout.seconds') })] })) }) })] }), _jsxs(Flex, { direction: "row", alignItems: "flex-start", className: b('dialog-row'), children: [_jsx("label", { htmlFor: "tracingLevel", className: b('field-title'), children: i18n('form.tracing-level') }), _jsx("div", { className: b('control-wrapper'), children: _jsx(Controller, { name: "tracingLevel", control: control, render: ({ field }) => (_jsx(QuerySettingsSelect, { setting: field.value, onUpdateSetting: field.onChange, settingOptions: TRACING_LEVEL_SELECT_OPTIONS })) }) })] }), _jsxs(Flex, { direction: "row", alignItems: "flex-start", className: b('dialog-row'), children: [_jsx("label", { htmlFor: "isolationLevel", className: b('field-title'), children: i18n('form.isolation-level') }), _jsx("div", { className: b('control-wrapper'), children: _jsx(Controller, { name: "isolationLevel", control: control, render: ({ field }) => (_jsx(QuerySettingsSelect, { setting: field.value, onUpdateSetting: field.onChange, settingOptions: ISOLATION_LEVEL_SELECT_OPTIONS })) }) })] }), _jsxs(Flex, { direction: "row", alignItems: "flex-start", className: b('dialog-row'), children: [_jsx("label", { htmlFor: "statisticsMode", className: b('field-title'), children: i18n('form.statistics-mode') }), _jsx("div", { className: b('control-wrapper'), children: _jsx(Controller, { name: "statisticsMode", control: control, render: ({ field }) => (_jsx(QuerySettingsSelect, { setting: field.value, onUpdateSetting: field.onChange, settingOptions: STATISTICS_MODE_SELECT_OPTIONS })) }) })] })] }), _jsx(Dialog.Footer, { textButtonApply: i18n('button-done'), textButtonCancel: i18n('button-cancel'), onClickButtonCancel: onCloseDialog, propsButtonApply: {
|
36
|
+
type: 'submit',
|
37
|
+
}, renderButtons: (buttonApply, buttonCancel) => (_jsxs("div", { className: b('buttons-container'), children: [_jsx(ExternalLink, { href: "https://ydb.tech/docs/ru/concepts/transactions", target: "_blank", className: b('documentation-link'), children: i18n('docs') }), _jsxs("div", { className: b('main-buttons'), children: [buttonCancel, buttonApply] })] })) })] })] }));
|
38
|
+
}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
.ydb-query-settings-dialog {
|
2
|
+
&__dialog-row {
|
3
|
+
& + & {
|
4
|
+
margin-top: var(--g-text-body-1-line-height);
|
5
|
+
}
|
6
|
+
}
|
7
|
+
|
8
|
+
&__field-title {
|
9
|
+
flex: 4;
|
10
|
+
|
11
|
+
margin-right: var(--g-spacing-3);
|
12
|
+
|
13
|
+
font-weight: 500;
|
14
|
+
line-height: var(--g-text-header-2-line-height);
|
15
|
+
white-space: nowrap;
|
16
|
+
}
|
17
|
+
|
18
|
+
.g-dialog-footer__bts-wrapper {
|
19
|
+
width: 100%;
|
20
|
+
}
|
21
|
+
|
22
|
+
&__dialog-body {
|
23
|
+
padding-top: var(--g-spacing-6);
|
24
|
+
}
|
25
|
+
|
26
|
+
&__control-wrapper {
|
27
|
+
display: flex;
|
28
|
+
flex: 6;
|
29
|
+
}
|
30
|
+
|
31
|
+
&__timeout {
|
32
|
+
width: 33.3%;
|
33
|
+
margin-right: var(--g-spacing-2);
|
34
|
+
}
|
35
|
+
|
36
|
+
&__timeout-suffix {
|
37
|
+
display: flex;
|
38
|
+
align-items: center;
|
39
|
+
|
40
|
+
color: var(--g-color-text-secondary);
|
41
|
+
}
|
42
|
+
|
43
|
+
&__documentation-link {
|
44
|
+
display: flex;
|
45
|
+
align-items: center;
|
46
|
+
|
47
|
+
margin-left: var(--g-spacing-4);
|
48
|
+
|
49
|
+
color: var(--g-color-text-secondary);
|
50
|
+
}
|
51
|
+
|
52
|
+
&__buttons-container {
|
53
|
+
display: flex;
|
54
|
+
justify-content: space-between;
|
55
|
+
|
56
|
+
width: 100%;
|
57
|
+
}
|
58
|
+
|
59
|
+
&__main-buttons {
|
60
|
+
display: flex;
|
61
|
+
gap: 10px;
|
62
|
+
}
|
63
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { SelectOption } from '@gravity-ui/uikit';
|
2
|
+
import type { IsolationLevel, QueryMode, StatisticsMode, TracingLevel } from '../../../../types/store/query';
|
3
|
+
import './QuerySettingsSelect.scss';
|
4
|
+
export declare const getOptionHeight: () => number;
|
5
|
+
type SelectType = QueryMode | IsolationLevel | StatisticsMode | TracingLevel;
|
6
|
+
type QuerySettingSelectOption<T> = SelectOption<T> & {
|
7
|
+
isDefault?: boolean;
|
8
|
+
};
|
9
|
+
interface QuerySettingsSelectProps<T extends SelectType> {
|
10
|
+
setting: T;
|
11
|
+
settingOptions: QuerySettingSelectOption<T>[];
|
12
|
+
onUpdateSetting: (mode: T) => void;
|
13
|
+
}
|
14
|
+
export declare function QuerySettingsSelect<T extends SelectType>(props: QuerySettingsSelectProps<T>): import("react/jsx-runtime").JSX.Element;
|
15
|
+
export {};
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { Select } from '@gravity-ui/uikit';
|
3
|
+
import { cn } from '../../../../utils/cn';
|
4
|
+
import i18n from './i18n';
|
5
|
+
import './QuerySettingsSelect.scss';
|
6
|
+
// Make option height dynamic.
|
7
|
+
// By default it has static height.
|
8
|
+
export const getOptionHeight = () => -1;
|
9
|
+
const b = cn('ydb-query-settings-select');
|
10
|
+
export function QuerySettingsSelect(props) {
|
11
|
+
return (_jsx("div", { className: b('selector'), children: _jsx(Select, { options: props.settingOptions, value: [props.setting], onUpdate: (value) => {
|
12
|
+
props.onUpdateSetting(value[0]);
|
13
|
+
}, getOptionHeight: getOptionHeight, popupClassName: b('popup'), renderOption: (option) => (_jsxs("div", { className: b('item'), children: [_jsxs("div", { className: b('item-title'), children: [option.content, option.isDefault ? i18n('description.default') : ''] }), option.text && (_jsx("span", { className: b('item-description'), children: option.text }))] })), width: "max" }) }));
|
14
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
.ydb-query-settings-select {
|
2
|
+
&__selector {
|
3
|
+
width: 100%;
|
4
|
+
}
|
5
|
+
|
6
|
+
&__popup {
|
7
|
+
max-width: 320px;
|
8
|
+
}
|
9
|
+
|
10
|
+
&__item-description {
|
11
|
+
white-space: pre-wrap;
|
12
|
+
|
13
|
+
color: var(--g-color-text-secondary);
|
14
|
+
}
|
15
|
+
|
16
|
+
&__item {
|
17
|
+
padding: var(--g-spacing-1) 0;
|
18
|
+
}
|
19
|
+
}
|