ydb-embedded-ui 6.12.0 → 6.13.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/AutoRefreshControl/i18n/index.d.ts +1 -1
- package/dist/components/ButtonWithConfirmDialog/ButtonWithConfirmDialog.d.ts +3 -2
- package/dist/components/ButtonWithConfirmDialog/ButtonWithConfirmDialog.js +9 -5
- package/dist/components/CriticalActionDialog/CriticalActionDialog.d.ts +5 -3
- package/dist/components/CriticalActionDialog/CriticalActionDialog.js +8 -7
- package/dist/components/CriticalActionDialog/CriticalActionDialog.scss +1 -1
- package/dist/components/CriticalActionDialog/i18n/en.json +1 -0
- package/dist/components/CriticalActionDialog/i18n/index.d.ts +1 -1
- package/dist/components/Errors/PageError/PageError.d.ts +11 -0
- package/dist/components/Errors/PageError/PageError.js +19 -0
- package/dist/components/Errors/i18n/en.json +2 -1
- package/dist/components/Errors/i18n/index.d.ts +1 -1
- package/dist/components/Errors/i18n/ru.json +2 -1
- package/dist/components/Fullscreen/Fullscreen.d.ts +1 -1
- package/dist/components/Fullscreen/Fullscreen.js +34 -27
- package/dist/components/Fullscreen/Fullscreen.scss +16 -8
- package/dist/components/Graph/Graph.d.ts +13 -0
- package/dist/components/Graph/Graph.js +41 -0
- package/dist/components/LabelWithPopover/LabelWithPopover.d.ts +4 -1
- package/dist/components/LabelWithPopover/LabelWithPopover.js +1 -1
- package/dist/components/Loader/Loader.d.ts +2 -1
- package/dist/components/Loader/Loader.js +6 -1
- package/dist/components/LoaderWrapper/LoaderWrapper.d.ts +10 -0
- package/dist/components/LoaderWrapper/LoaderWrapper.js +8 -0
- package/dist/components/MetricChart/reducer.d.ts +2 -2
- package/dist/components/PDiskInfo/PDiskInfo.d.ts +2 -2
- package/dist/components/PDiskInfo/PDiskInfo.js +9 -6
- package/dist/components/PDiskInfo/i18n/index.d.ts +1 -1
- package/dist/components/ProgressViewer/ProgressViewer.js +3 -0
- package/dist/components/QueryExecutionStatus/QueryExecutionStatus.js +13 -3
- package/dist/components/QueryExecutionStatus/QueryExecutionStatus.scss +4 -0
- package/dist/components/QuerySettingsDescription/QuerySettingsDescription.d.ts +7 -0
- package/dist/components/QuerySettingsDescription/QuerySettingsDescription.js +8 -0
- package/dist/components/QuerySettingsDescription/QuerySettingsDescription.scss +8 -0
- package/dist/components/QuerySettingsDescription/index.d.ts +1 -0
- package/dist/components/QuerySettingsDescription/index.js +1 -0
- package/dist/components/VDisk/VDisk.js +3 -4
- package/dist/components/VDiskInfo/VDiskInfo.d.ts +2 -2
- package/dist/components/VDiskInfo/VDiskInfo.js +4 -2
- package/dist/containers/App/Content.js +15 -19
- package/dist/containers/AsideNavigation/AsideNavigation.js +2 -1
- package/dist/containers/AsideNavigation/YdbInternalUser/YdbInternalUser.js +4 -4
- package/dist/containers/Authentication/Authentication.js +8 -10
- package/dist/containers/Authentication/utils.d.ts +8 -0
- package/dist/containers/Authentication/utils.js +15 -0
- package/dist/containers/Cluster/ClusterInfo/ClusterInfo.js +6 -6
- package/dist/containers/Clusters/constants.d.ts +1 -1
- package/dist/containers/Heatmap/Heatmap.js +5 -4
- package/dist/containers/Node/Node.js +5 -7
- package/dist/containers/Node/Node.scss +4 -0
- package/dist/containers/Node/NodeStructure/NodeStructure.js +4 -4
- package/dist/containers/Node/NodeStructure/NodeStructure.scss +4 -0
- package/dist/containers/Node/NodeStructure/Pdisk.js +2 -2
- package/dist/containers/Nodes/Nodes.js +6 -8
- package/dist/containers/Nodes/getNodesColumns.js +6 -21
- package/dist/containers/PDiskPage/PDiskPage.js +19 -8
- package/dist/containers/PDiskPage/i18n/en.json +1 -0
- package/dist/containers/PDiskPage/i18n/index.d.ts +1 -1
- package/dist/containers/Storage/PDisk/PDisk.js +3 -4
- package/dist/containers/Storage/Storage.js +4 -6
- package/dist/containers/Tablet/Tablet.js +2 -2
- package/dist/containers/Tablet/TabletControls/TabletControls.js +2 -1
- package/dist/containers/Tablets/Tablets.js +3 -5
- package/dist/containers/Tenant/Diagnostics/Consumers/Consumers.js +2 -5
- package/dist/containers/Tenant/Diagnostics/Describe/Describe.js +10 -13
- package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.scss +1 -0
- package/dist/containers/Tenant/Diagnostics/Network/Network.js +8 -11
- package/dist/containers/Tenant/Diagnostics/Network/Network.scss +1 -0
- package/dist/containers/Tenant/Diagnostics/Overview/Overview.d.ts +1 -2
- package/dist/containers/Tenant/Diagnostics/Overview/Overview.js +3 -5
- package/dist/containers/Tenant/Diagnostics/Overview/TopicStats/TopicStats.js +3 -4
- package/dist/containers/Tenant/Diagnostics/Partitions/Partitions.js +1 -4
- package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverviewTableLayout.js +3 -3
- package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/index.d.ts +1 -1
- package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.js +4 -3
- package/dist/containers/Tenant/Diagnostics/TopShards/TopShards.js +4 -3
- package/dist/containers/Tenant/Query/ExecuteResult/ExecuteResult.d.ts +2 -2
- package/dist/containers/Tenant/Query/ExecuteResult/ExecuteResult.js +56 -20
- package/dist/containers/Tenant/Query/ExecuteResult/ExecuteResult.scss +10 -6
- package/dist/containers/Tenant/Query/ExecuteResult/i18n/en.json +7 -0
- package/dist/containers/Tenant/Query/ExecuteResult/i18n/index.d.ts +2 -0
- package/dist/containers/Tenant/Query/ExecuteResult/i18n/index.js +4 -0
- package/dist/containers/Tenant/Query/ExecuteResult/utils.d.ts +18 -0
- package/dist/containers/Tenant/Query/ExecuteResult/utils.js +36 -0
- package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.d.ts +23 -1
- package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.js +56 -111
- package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.scss +1 -30
- package/dist/containers/Tenant/Query/ExplainResult/components/Ast/Ast.d.ts +7 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/Ast/Ast.js +18 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/Ast/Ast.scss +8 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/Graph/Graph.d.ts +8 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/Graph/Graph.js +14 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/Graph/Graph.scss +14 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/MetricsCell.d.ts +6 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/MetricsCell.js +11 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationCell.d.ts +13 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationCell.js +48 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationParams.d.ts +6 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationParams.js +66 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/SimplifiedPlan.d.ts +7 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/SimplifiedPlan.js +100 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/SimplifiedPlan.scss +128 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/types.d.ts +5 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/utils.d.ts +5 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/utils.js +59 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/TextExplain/TextExplain.d.ts +8 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/TextExplain/TextExplain.js +11 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/TextExplain/TextExplain.scss +14 -0
- package/dist/containers/Tenant/Query/ExplainResult/i18n/en.json +8 -0
- package/dist/containers/Tenant/Query/ExplainResult/i18n/index.d.ts +2 -0
- package/dist/containers/Tenant/Query/ExplainResult/i18n/index.js +4 -0
- package/dist/containers/Tenant/Query/Preview/Preview.js +2 -3
- package/dist/containers/Tenant/Query/QueriesHistory/QueriesHistory.js +1 -19
- package/dist/containers/Tenant/Query/QueryDuration/QueryDuration.js +1 -1
- package/dist/containers/Tenant/Query/QueryDuration/QueryDuration.scss +11 -0
- package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.d.ts +1 -1
- package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.js +91 -95
- package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.d.ts +4 -6
- package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.js +18 -49
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettings.d.ts +2 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettings.js +5 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettings.test.d.ts +1 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettings.test.js +42 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettingsDescription.d.ts +5 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettingsDescription.js +19 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettingsDescription.test.d.ts +1 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettingsDescription.test.js +56 -0
- package/dist/containers/Tenant/Query/QuerySettingsBanner/QuerySettingsBanner.d.ts +2 -0
- package/dist/containers/Tenant/Query/QuerySettingsBanner/QuerySettingsBanner.js +12 -0
- package/dist/containers/Tenant/Query/QuerySettingsBanner/QuerySettingsBanner.scss +3 -0
- package/dist/containers/Tenant/Query/QuerySettingsDialog/QuerySettingsDialog.js +20 -23
- package/dist/containers/Tenant/Query/QuerySettingsDialog/constants.d.ts +123 -7
- package/dist/containers/Tenant/Query/QuerySettingsDialog/constants.js +32 -10
- package/dist/containers/Tenant/Query/i18n/en.json +3 -1
- package/dist/containers/Tenant/Query/i18n/index.d.ts +1 -1
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.js +6 -6
- package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.js +5 -2
- package/dist/containers/Tenant/Schema/SchemaViewer/columns.d.ts +2 -1
- package/dist/containers/Tenant/Schema/SchemaViewer/columns.js +13 -1
- package/dist/containers/Tenant/Schema/SchemaViewer/i18n/en.json +1 -0
- package/dist/containers/Tenant/Schema/SchemaViewer/i18n/index.d.ts +1 -1
- package/dist/containers/Tenant/Schema/SchemaViewer/prepareData.js +3 -2
- package/dist/containers/Tenant/Schema/SchemaViewer/types.d.ts +1 -0
- package/dist/containers/Tenant/Tenant.js +4 -8
- package/dist/containers/Tenant/utils/schemaActions.d.ts +2 -2
- package/dist/containers/Tenant/utils/schemaActions.js +2 -2
- package/dist/containers/Tenants/Tenants.js +4 -7
- package/dist/containers/UserSettings/i18n/en.json +3 -5
- package/dist/containers/UserSettings/i18n/index.d.ts +1 -1
- package/dist/containers/UserSettings/settings.d.ts +2 -3
- package/dist/containers/UserSettings/settings.js +17 -23
- package/dist/containers/VDiskPage/VDiskPage.js +27 -13
- package/dist/containers/VDiskPage/i18n/en.json +1 -0
- package/dist/containers/VDiskPage/i18n/index.d.ts +1 -1
- package/dist/services/api.d.ts +21 -8
- package/dist/services/api.js +29 -42
- package/dist/services/settings.d.ts +11 -4
- package/dist/services/settings.js +7 -6
- package/dist/store/configureStore.d.ts +7 -7
- package/dist/store/defaultStore.d.ts +3 -3
- package/dist/store/reducers/api.d.ts +1 -1
- package/dist/store/reducers/api.js +1 -1
- package/dist/store/reducers/authentication/authentication.d.ts +37 -24
- package/dist/store/reducers/authentication/authentication.js +77 -57
- package/dist/store/reducers/authentication/types.d.ts +0 -8
- package/dist/store/reducers/capabilities/capabilities.d.ts +106 -0
- package/dist/store/reducers/capabilities/capabilities.js +22 -0
- package/dist/store/reducers/capabilities/hooks.d.ts +2 -0
- package/dist/store/reducers/capabilities/hooks.js +13 -0
- 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 +2 -2
- package/dist/store/reducers/executeQuery.d.ts +7 -14
- package/dist/store/reducers/executeQuery.js +19 -14
- package/dist/store/reducers/executeTopQueries/executeTopQueries.d.ts +2 -2
- package/dist/store/reducers/explainQuery/explainQuery.d.ts +5 -4
- package/dist/store/reducers/explainQuery/explainQuery.js +14 -4
- package/dist/store/reducers/explainQuery/types.d.ts +13 -1
- package/dist/store/reducers/explainQuery/utils.js +7 -2
- package/dist/store/reducers/healthcheckInfo/healthcheckInfo.d.ts +58 -58
- package/dist/store/reducers/heatmap.d.ts +2 -2
- package/dist/store/reducers/hotKeys/hotKeys.d.ts +2 -2
- package/dist/store/reducers/index.d.ts +6 -6
- package/dist/store/reducers/network/network.d.ts +2 -2
- package/dist/store/reducers/node/node.d.ts +3 -3
- package/dist/store/reducers/node/selectors.d.ts +1 -1
- 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 +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/preview.d.ts +2 -2
- package/dist/store/reducers/schema/schema.d.ts +3 -3
- package/dist/store/reducers/schema/schema.js +10 -3
- package/dist/store/reducers/schemaAcl/schemaAcl.d.ts +2 -2
- package/dist/store/reducers/shardsWorkload/shardsWorkload.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/topNodes/topNodes.d.ts +2 -2
- package/dist/store/reducers/tenantOverview/topShards/tenantOverviewTopShards.d.ts +2 -2
- package/dist/store/reducers/tenantOverview/topStorageGroups/topStorageGroups.d.ts +2 -2
- package/dist/store/reducers/tenants/selectors.d.ts +31 -30
- package/dist/store/reducers/tenants/selectors.js +8 -2
- 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/viewSchema/viewSchema.d.ts +2 -2
- package/dist/styles/mixins.scss +2 -0
- package/dist/types/api/capabilities.d.ts +7 -0
- package/dist/types/api/capabilities.js +1 -0
- package/dist/types/api/modifyDisk.d.ts +8 -0
- package/dist/types/api/modifyDisk.js +1 -0
- package/dist/types/api/query.d.ts +39 -3
- package/dist/types/api/query.js +9 -1
- package/dist/types/api/schema/shared.d.ts +8 -0
- package/dist/types/store/query.d.ts +7 -0
- package/dist/utils/__test__/prepareQueryExplain.test.d.ts +1 -0
- package/dist/utils/__test__/prepareQueryExplain.test.js +115 -0
- package/dist/utils/constants.d.ts +13 -4
- package/dist/utils/constants.js +15 -4
- package/dist/utils/dataFormatters/dataFormatters.d.ts +0 -1
- package/dist/utils/dataFormatters/dataFormatters.js +1 -4
- package/dist/utils/hooks/index.d.ts +2 -1
- package/dist/utils/hooks/index.js +2 -1
- package/dist/utils/hooks/useChangedQuerySettings.d.ts +10 -0
- package/dist/utils/hooks/useChangedQuerySettings.js +46 -0
- package/dist/utils/hooks/useDelayed.d.ts +1 -0
- package/dist/utils/hooks/useDelayed.js +13 -0
- package/dist/utils/hooks/useEventHandler.d.ts +6 -0
- package/dist/utils/hooks/useEventHandler.js +17 -0
- package/dist/utils/hooks/useLastQueryExecutionSettings.d.ts +2 -0
- package/dist/utils/hooks/useLastQueryExecutionSettings.js +5 -0
- package/dist/utils/hooks/useQueryExecutionSettings.d.ts +8 -0
- package/dist/utils/hooks/useQueryExecutionSettings.js +15 -0
- package/dist/utils/prepareQueryExplain.d.ts +3 -1
- package/dist/utils/prepareQueryExplain.js +54 -2
- package/dist/utils/query.js +1 -0
- package/dist/utils/query.test.js +3 -0
- package/dist/utils/utils.d.ts +8 -7
- package/dist/utils/utils.js +23 -11
- package/package.json +4 -2
- package/dist/containers/Tenant/Query/ExplainResult/utils.d.ts +0 -2
- package/dist/containers/Tenant/Query/ExplainResult/utils.js +0 -4
- package/dist/store/utils.d.ts +0 -23
- package/dist/store/utils.js +0 -49
- package/dist/types/api/restartPDisk.d.ts +0 -4
- package/dist/utils/hooks/useQueryModes.d.ts +0 -2
- package/dist/utils/hooks/useQueryModes.js +0 -5
- /package/dist/{types/api/restartPDisk.js → containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/types.js} +0 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
import { explainVersions } from '../../../../store/reducers/explainQuery/utils';
|
2
|
+
import { preparePlan, prepareSimplifiedPlan } from '../../../../utils/prepareQueryExplain';
|
3
|
+
import { parseQueryExplainPlan } from '../../../../utils/query';
|
4
|
+
export function getPlan(data) {
|
5
|
+
var _a, _b, _c;
|
6
|
+
if (!data) {
|
7
|
+
return {};
|
8
|
+
}
|
9
|
+
const { plan } = data;
|
10
|
+
if (plan) {
|
11
|
+
const queryPlan = parseQueryExplainPlan(plan);
|
12
|
+
const isSupportedVersion = queryPlan.meta.version === explainVersions.v2;
|
13
|
+
if (!isSupportedVersion) {
|
14
|
+
return {};
|
15
|
+
}
|
16
|
+
const { Plan: planWithStats, SimplifiedPlan: simplifiedPlan } = queryPlan;
|
17
|
+
return {
|
18
|
+
plan: planWithStats
|
19
|
+
? { ...preparePlan(planWithStats), tables: queryPlan.tables }
|
20
|
+
: undefined,
|
21
|
+
simplifiedPlan: simplifiedPlan ? prepareSimplifiedPlan([simplifiedPlan]) : undefined,
|
22
|
+
};
|
23
|
+
}
|
24
|
+
const { stats } = data;
|
25
|
+
const planFromStats = (_c = (_b = (_a = stats === null || stats === void 0 ? void 0 : stats.Executions) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.TxPlansWithStats) === null || _c === void 0 ? void 0 : _c[0];
|
26
|
+
if (!planFromStats) {
|
27
|
+
return {};
|
28
|
+
}
|
29
|
+
try {
|
30
|
+
const planWithStats = JSON.parse(planFromStats);
|
31
|
+
return { plan: preparePlan(planWithStats) };
|
32
|
+
}
|
33
|
+
catch (e) {
|
34
|
+
return {};
|
35
|
+
}
|
36
|
+
}
|
@@ -1 +1,23 @@
|
|
1
|
-
|
1
|
+
import type { PreparedExplainResponse } from '../../../../store/reducers/explainQuery/types';
|
2
|
+
import type { ValueOf } from '../../../../types/common';
|
3
|
+
import './ExplainResult.scss';
|
4
|
+
declare const EXPLAIN_OPTIONS_IDS: {
|
5
|
+
readonly schema: "schema";
|
6
|
+
readonly json: "json";
|
7
|
+
readonly ast: "ast";
|
8
|
+
readonly simplified: "simplified";
|
9
|
+
};
|
10
|
+
export type QueryExplainTab = ValueOf<typeof EXPLAIN_OPTIONS_IDS>;
|
11
|
+
interface ExplainResultProps {
|
12
|
+
theme: string;
|
13
|
+
explain?: PreparedExplainResponse['plan'];
|
14
|
+
simplifiedPlan?: PreparedExplainResponse['simplifiedPlan'];
|
15
|
+
ast?: string;
|
16
|
+
loading?: boolean;
|
17
|
+
isResultsCollapsed?: boolean;
|
18
|
+
error: unknown;
|
19
|
+
onCollapseResults: VoidFunction;
|
20
|
+
onExpandResults: VoidFunction;
|
21
|
+
}
|
22
|
+
export declare function ExplainResult({ explain, ast, theme, error, loading, onCollapseResults, onExpandResults, isResultsCollapsed, simplifiedPlan, }: ExplainResultProps): import("react/jsx-runtime").JSX.Element;
|
23
|
+
export {};
|
@@ -1,149 +1,94 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import React from 'react';
|
3
|
-
import {
|
4
|
-
import { Loader, RadioButton } from '@gravity-ui/uikit';
|
5
|
-
import JSONTree from 'react-json-inspector';
|
3
|
+
import { RadioButton } from '@gravity-ui/uikit';
|
6
4
|
import Divider from '../../../../components/Divider/Divider';
|
7
5
|
import EnableFullscreenButton from '../../../../components/EnableFullscreenButton/EnableFullscreenButton';
|
8
6
|
import Fullscreen from '../../../../components/Fullscreen/Fullscreen';
|
9
|
-
import {
|
7
|
+
import { LoaderWrapper } from '../../../../components/LoaderWrapper/LoaderWrapper';
|
10
8
|
import { QueryExecutionStatus } from '../../../../components/QueryExecutionStatus';
|
11
|
-
import { explainVersions } from '../../../../store/reducers/explainQuery/utils';
|
12
9
|
import { disableFullscreen } from '../../../../store/reducers/fullscreen';
|
13
10
|
import { cn } from '../../../../utils/cn';
|
14
|
-
import { useTypedDispatch
|
15
|
-
import { S_EXPRESSION_LANGUAGE_ID } from '../../../../utils/monaco/constats';
|
11
|
+
import { useTypedDispatch } from '../../../../utils/hooks';
|
16
12
|
import { parseQueryErrorToString } from '../../../../utils/query';
|
17
13
|
import { PaneVisibilityToggleButtons } from '../../utils/paneVisibilityToggleHelpers';
|
18
|
-
import {
|
14
|
+
import { QuerySettingsBanner } from '../QuerySettingsBanner/QuerySettingsBanner';
|
15
|
+
import { Ast } from './components/Ast/Ast';
|
16
|
+
import { Graph } from './components/Graph/Graph';
|
17
|
+
import { SimplifiedPlan } from './components/SimplifiedPlan/SimplifiedPlan';
|
18
|
+
import { TextExplain } from './components/TextExplain/TextExplain';
|
19
|
+
import i18n from './i18n';
|
19
20
|
import './ExplainResult.scss';
|
20
|
-
import 'react-json-inspector/json-inspector.css';
|
21
21
|
const b = cn('ydb-query-explain-result');
|
22
|
-
const
|
23
|
-
automaticLayout: true,
|
24
|
-
selectOnLineNumbers: true,
|
25
|
-
readOnly: true,
|
26
|
-
minimap: {
|
27
|
-
enabled: false,
|
28
|
-
},
|
29
|
-
wrappingIndent: 'indent',
|
30
|
-
};
|
31
|
-
const ExplainOptionIds = {
|
22
|
+
const EXPLAIN_OPTIONS_IDS = {
|
32
23
|
schema: 'schema',
|
33
24
|
json: 'json',
|
34
25
|
ast: 'ast',
|
26
|
+
simplified: 'simplified',
|
27
|
+
};
|
28
|
+
const EXPLAIN_OPTIONS_NAMES = {
|
29
|
+
[EXPLAIN_OPTIONS_IDS.schema]: i18n('action.schema'),
|
30
|
+
[EXPLAIN_OPTIONS_IDS.json]: i18n('action.json'),
|
31
|
+
[EXPLAIN_OPTIONS_IDS.ast]: i18n('action.ast'),
|
32
|
+
[EXPLAIN_OPTIONS_IDS.simplified]: i18n('action.explain-plan'),
|
35
33
|
};
|
36
34
|
const explainOptions = [
|
37
|
-
{ value:
|
38
|
-
{
|
39
|
-
|
35
|
+
{ value: EXPLAIN_OPTIONS_IDS.schema, content: EXPLAIN_OPTIONS_NAMES[EXPLAIN_OPTIONS_IDS.schema] },
|
36
|
+
{
|
37
|
+
value: EXPLAIN_OPTIONS_IDS.simplified,
|
38
|
+
content: EXPLAIN_OPTIONS_NAMES[EXPLAIN_OPTIONS_IDS.simplified],
|
39
|
+
},
|
40
|
+
{ value: EXPLAIN_OPTIONS_IDS.json, content: EXPLAIN_OPTIONS_NAMES[EXPLAIN_OPTIONS_IDS.json] },
|
41
|
+
{ value: EXPLAIN_OPTIONS_IDS.ast, content: EXPLAIN_OPTIONS_NAMES[EXPLAIN_OPTIONS_IDS.ast] },
|
40
42
|
];
|
41
|
-
function
|
42
|
-
const paranoid = React.useRef();
|
43
|
-
const { data, opts, shapes, theme } = props;
|
44
|
-
React.useEffect(() => {
|
45
|
-
const graphRoot = document.getElementById('graphRoot');
|
46
|
-
if (!graphRoot) {
|
47
|
-
throw new Error("Can't find element with id #graphRoot");
|
48
|
-
}
|
49
|
-
graphRoot.innerHTML = '';
|
50
|
-
paranoid.current = getTopology('graphRoot', data, opts, shapes);
|
51
|
-
paranoid.current.render();
|
52
|
-
return () => {
|
53
|
-
paranoid.current = undefined;
|
54
|
-
};
|
55
|
-
}, [theme]);
|
56
|
-
React.useEffect(() => {
|
57
|
-
var _a, _b;
|
58
|
-
(_b = (_a = paranoid.current) === null || _a === void 0 ? void 0 : _a.updateData) === null || _b === void 0 ? void 0 : _b.call(_a, props.data);
|
59
|
-
}, [props.data]);
|
60
|
-
return _jsx("div", { id: "graphRoot", style: { height: '100vh' } });
|
61
|
-
}
|
62
|
-
export function ExplainResult(props) {
|
43
|
+
export function ExplainResult({ explain, ast, theme, error, loading, onCollapseResults, onExpandResults, isResultsCollapsed, simplifiedPlan, }) {
|
63
44
|
const dispatch = useTypedDispatch();
|
64
|
-
const [activeOption, setActiveOption] = React.useState(
|
65
|
-
const
|
45
|
+
const [activeOption, setActiveOption] = React.useState(EXPLAIN_OPTIONS_IDS.schema);
|
46
|
+
const [isPending, startTransition] = React.useTransition();
|
66
47
|
React.useEffect(() => {
|
67
48
|
return () => {
|
68
49
|
dispatch(disableFullscreen());
|
69
50
|
};
|
70
51
|
}, [dispatch]);
|
71
|
-
const onSelectOption = (tabId) => {
|
72
|
-
setActiveOption(tabId);
|
73
|
-
};
|
74
|
-
const renderLoader = () => {
|
75
|
-
return (_jsx("div", { className: b('loader'), children: _jsx(Loader, { size: "m" }) }));
|
76
|
-
};
|
77
52
|
const renderStub = () => {
|
78
|
-
return (_jsx("div", { className: b('text-message'), children:
|
79
|
-
|
80
|
-
|
81
|
-
var _a, _b;
|
82
|
-
switch (activeOption) {
|
83
|
-
case ExplainOptionIds.schema:
|
84
|
-
return Boolean((_b = (_a = props.explain) === null || _a === void 0 ? void 0 : _a.nodes) === null || _b === void 0 ? void 0 : _b.length);
|
85
|
-
case ExplainOptionIds.json:
|
86
|
-
return Boolean(props.explain);
|
87
|
-
case ExplainOptionIds.ast:
|
88
|
-
return Boolean(props.ast);
|
89
|
-
default:
|
90
|
-
return false;
|
91
|
-
}
|
92
|
-
};
|
93
|
-
const renderTextExplain = () => {
|
94
|
-
var _a;
|
95
|
-
const content = (_jsx(JSONTree, { data: (_a = props.explain) === null || _a === void 0 ? void 0 : _a.pristine, isExpanded: () => true, className: b('inspector'), searchOptions: {
|
96
|
-
debounceTime: 300,
|
97
|
-
} }));
|
98
|
-
return (_jsxs(React.Fragment, { children: [content, isFullscreen && _jsx(Fullscreen, { children: content })] }));
|
99
|
-
};
|
100
|
-
const renderAstExplain = () => {
|
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
|
-
return (_jsxs(React.Fragment, { children: [content, isFullscreen && _jsx(Fullscreen, { children: content })] }));
|
103
|
-
};
|
104
|
-
const renderGraph = () => {
|
105
|
-
const { explain = {}, theme } = props;
|
106
|
-
const { links, nodes, version } = explain;
|
107
|
-
const isSupportedVersion = version === explainVersions.v2;
|
108
|
-
const isEnoughDataForGraph = links && nodes && nodes.length;
|
109
|
-
const content = isSupportedVersion && isEnoughDataForGraph ? (_jsx("div", { className: b('explain-canvas-container', {
|
110
|
-
hidden: activeOption !== ExplainOptionIds.schema,
|
111
|
-
}), children: _jsx(GraphRoot, { theme: theme, data: { links, nodes }, opts: {
|
112
|
-
renderNodeTitle: renderExplainNode,
|
113
|
-
textOverflow: 'normal',
|
114
|
-
initialZoomFitsCanvas: true,
|
115
|
-
}, shapes: {
|
116
|
-
node: getYdbPlanNodeShape,
|
117
|
-
} }) })) : null;
|
118
|
-
return (_jsxs(React.Fragment, { children: [!isFullscreen && content, isFullscreen && _jsx(Fullscreen, { children: content })] }));
|
119
|
-
};
|
120
|
-
const renderError = () => {
|
121
|
-
return _jsx("div", { className: b('text-message'), children: parseQueryErrorToString(props.error) });
|
53
|
+
return (_jsx("div", { className: b('text-message'), children: i18n('description.empty-result', {
|
54
|
+
activeOption: EXPLAIN_OPTIONS_NAMES[activeOption],
|
55
|
+
}) }));
|
122
56
|
};
|
123
57
|
const renderContent = () => {
|
124
|
-
|
125
|
-
if (loading) {
|
126
|
-
return renderLoader();
|
127
|
-
}
|
58
|
+
var _a;
|
128
59
|
if (error) {
|
129
|
-
return
|
130
|
-
}
|
131
|
-
if (!hasContent()) {
|
132
|
-
return renderStub();
|
60
|
+
return _jsx("div", { className: b('text-message'), children: parseQueryErrorToString(error) });
|
133
61
|
}
|
134
62
|
switch (activeOption) {
|
135
|
-
case
|
136
|
-
|
63
|
+
case EXPLAIN_OPTIONS_IDS.json: {
|
64
|
+
if (!(explain === null || explain === void 0 ? void 0 : explain.pristine)) {
|
65
|
+
return renderStub();
|
66
|
+
}
|
67
|
+
return _jsx(TextExplain, { explain: explain.pristine });
|
68
|
+
}
|
69
|
+
case EXPLAIN_OPTIONS_IDS.ast: {
|
70
|
+
if (!ast) {
|
71
|
+
return renderStub();
|
72
|
+
}
|
73
|
+
return _jsx(Ast, { ast: ast, theme: theme });
|
137
74
|
}
|
138
|
-
case
|
139
|
-
|
75
|
+
case EXPLAIN_OPTIONS_IDS.schema: {
|
76
|
+
if (!((_a = explain === null || explain === void 0 ? void 0 : explain.nodes) === null || _a === void 0 ? void 0 : _a.length)) {
|
77
|
+
return renderStub();
|
78
|
+
}
|
79
|
+
return _jsx(Graph, { theme: theme, explain: explain });
|
140
80
|
}
|
141
|
-
case
|
142
|
-
|
81
|
+
case EXPLAIN_OPTIONS_IDS.simplified: {
|
82
|
+
if (!(simplifiedPlan === null || simplifiedPlan === void 0 ? void 0 : simplifiedPlan.length)) {
|
83
|
+
return renderStub();
|
84
|
+
}
|
85
|
+
return _jsx(SimplifiedPlan, { plan: simplifiedPlan });
|
143
86
|
}
|
144
87
|
default:
|
145
88
|
return null;
|
146
89
|
}
|
147
90
|
};
|
148
|
-
return (_jsxs(React.Fragment, { children: [_jsx("div", { className: b('controls'), children: !
|
91
|
+
return (_jsxs(React.Fragment, { children: [_jsx("div", { className: b('controls'), children: !loading && (_jsxs(React.Fragment, { children: [_jsxs("div", { className: b('controls-right'), children: [_jsx(QueryExecutionStatus, { error: error }), !error && (_jsxs(React.Fragment, { children: [_jsx(Divider, {}), _jsx(RadioButton, { options: explainOptions, value: activeOption, onUpdate: (tabId) => {
|
92
|
+
startTransition(() => setActiveOption(tabId));
|
93
|
+
} })] }))] }), _jsxs("div", { className: b('controls-left'), children: [_jsx(EnableFullscreenButton, { disabled: Boolean(error) }), _jsx(PaneVisibilityToggleButtons, { onCollapse: onCollapseResults, onExpand: onExpandResults, isCollapsed: isResultsCollapsed, initialDirection: "bottom" })] })] })) }), _jsx(QuerySettingsBanner, {}), _jsx(LoaderWrapper, { loading: loading || isPending, children: _jsx(Fullscreen, { className: b('result'), children: renderContent() }) })] }));
|
149
94
|
}
|
@@ -1,5 +1,3 @@
|
|
1
|
-
@import '../../../../styles/mixins.scss';
|
2
|
-
|
3
1
|
.ydb-query-explain-result {
|
4
2
|
&__result {
|
5
3
|
display: flex;
|
@@ -10,6 +8,7 @@
|
|
10
8
|
&__text-message {
|
11
9
|
padding: 15px 20px;
|
12
10
|
}
|
11
|
+
|
13
12
|
&__controls {
|
14
13
|
position: sticky;
|
15
14
|
z-index: 2;
|
@@ -35,34 +34,6 @@
|
|
35
34
|
display: flex;
|
36
35
|
gap: 4px;
|
37
36
|
}
|
38
|
-
&__explain-canvas-container {
|
39
|
-
overflow-y: auto;
|
40
|
-
|
41
|
-
width: 100%;
|
42
|
-
height: 100%;
|
43
|
-
&_hidden {
|
44
|
-
display: none;
|
45
|
-
}
|
46
|
-
}
|
47
|
-
&__inspector {
|
48
|
-
overflow-y: auto;
|
49
|
-
|
50
|
-
padding: 15px 20px;
|
51
|
-
@include json-tree-styles();
|
52
|
-
|
53
|
-
&_fullscreen {
|
54
|
-
padding: 10px;
|
55
|
-
}
|
56
|
-
}
|
57
|
-
|
58
|
-
&__ast {
|
59
|
-
overflow: hidden;
|
60
|
-
|
61
|
-
width: 100%;
|
62
|
-
height: 100%;
|
63
|
-
|
64
|
-
white-space: pre-wrap;
|
65
|
-
}
|
66
37
|
&__loader {
|
67
38
|
display: flex;
|
68
39
|
justify-content: center;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import MonacoEditor from 'react-monaco-editor';
|
3
|
+
import { cn } from '../../../../../../utils/cn';
|
4
|
+
import { S_EXPRESSION_LANGUAGE_ID } from '../../../../../../utils/monaco/constats';
|
5
|
+
import './Ast.scss';
|
6
|
+
const b = cn('ydb-query-explain-ast');
|
7
|
+
const EDITOR_OPTIONS = {
|
8
|
+
automaticLayout: true,
|
9
|
+
selectOnLineNumbers: true,
|
10
|
+
readOnly: true,
|
11
|
+
minimap: {
|
12
|
+
enabled: false,
|
13
|
+
},
|
14
|
+
wrappingIndent: 'indent',
|
15
|
+
};
|
16
|
+
export function Ast({ ast, theme }) {
|
17
|
+
return (_jsx("div", { className: b(), children: _jsx(MonacoEditor, { language: S_EXPRESSION_LANGUAGE_ID, value: ast, options: EDITOR_OPTIONS, theme: `vs-${theme}` }) }));
|
18
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { PreparedExplainResponse } from '../../../../../../store/reducers/explainQuery/types';
|
2
|
+
import './Graph.scss';
|
3
|
+
interface GraphProps {
|
4
|
+
explain: PreparedExplainResponse['plan'];
|
5
|
+
theme: string;
|
6
|
+
}
|
7
|
+
export declare function Graph({ explain, theme }: GraphProps): import("react/jsx-runtime").JSX.Element;
|
8
|
+
export {};
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { YDBGraph } from '../../../../../../components/Graph/Graph';
|
3
|
+
import { explainVersions } from '../../../../../../store/reducers/explainQuery/utils';
|
4
|
+
import { cn } from '../../../../../../utils/cn';
|
5
|
+
import i18n from '../../i18n';
|
6
|
+
import './Graph.scss';
|
7
|
+
const b = cn('ydb-query-explain-graph');
|
8
|
+
export function Graph({ explain, theme }) {
|
9
|
+
const { links, nodes, version } = explain !== null && explain !== void 0 ? explain : {};
|
10
|
+
const isSupportedVersion = version === explainVersions.v2;
|
11
|
+
const isEnoughDataForGraph = links && nodes && nodes.length;
|
12
|
+
const content = isSupportedVersion && isEnoughDataForGraph ? (_jsx("div", { className: b('canvas-container'), children: _jsx(YDBGraph, { data: { links, nodes } }, theme) })) : (_jsx("div", { className: b('text-message'), children: i18n('description.graph-is-not-supported') }));
|
13
|
+
return content;
|
14
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { isNumeric } from '../../../../../../utils/utils';
|
3
|
+
import { block } from './utils';
|
4
|
+
export function MetricsCell({ value, formatter }) {
|
5
|
+
if (!isNumeric(value)) {
|
6
|
+
return undefined;
|
7
|
+
}
|
8
|
+
const numberValue = Number(value);
|
9
|
+
const content = formatter(numberValue);
|
10
|
+
return _jsx("div", { className: block('metrics-cell'), children: content });
|
11
|
+
}
|
package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationCell.d.ts
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
import type { Row } from '@tanstack/react-table';
|
2
|
+
import type { SimlifiedPlanOperatorOtherParams } from '../../../../../../types/api/query';
|
3
|
+
interface OperationCellProps<TData> {
|
4
|
+
row: Row<TData>;
|
5
|
+
depth?: number;
|
6
|
+
params: {
|
7
|
+
name: string;
|
8
|
+
operationParams?: SimlifiedPlanOperatorOtherParams;
|
9
|
+
lines?: string;
|
10
|
+
};
|
11
|
+
}
|
12
|
+
export declare function OperationCell<TData>({ row, depth, params }: OperationCellProps<TData>): import("react/jsx-runtime").JSX.Element;
|
13
|
+
export {};
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import React from 'react';
|
3
|
+
import { ArrowToggle, Button, Flex } from '@gravity-ui/uikit';
|
4
|
+
import { OperationParams } from './OperationParams';
|
5
|
+
import { block } from './utils';
|
6
|
+
const LEVEL_PADDING = 25;
|
7
|
+
const FIRST_PADDING = 9;
|
8
|
+
function Divider({ modifiers, left }) {
|
9
|
+
return (_jsx("div", { className: block('divider', modifiers), style: {
|
10
|
+
left,
|
11
|
+
} }));
|
12
|
+
}
|
13
|
+
function getDividers(lines, hasLeafs) {
|
14
|
+
const linesArray = lines.split('.').map(Number);
|
15
|
+
const dividers = [];
|
16
|
+
for (let i = 0; i < linesArray.length; i++) {
|
17
|
+
//logic for calculating left coordinate: FIRST_PADDING - is a padding from start of a level to the middle of toggle button
|
18
|
+
// LEVEL_PADDING is a difference between levels
|
19
|
+
// (i-1): in `lines` we have digits that point, should we paint a line for previous levels or not
|
20
|
+
if (i === linesArray.length - 1 && i !== 0) {
|
21
|
+
if (linesArray[i]) {
|
22
|
+
//horizontal pointer to the node (├)
|
23
|
+
dividers.push(_jsx(Divider, { modifiers: { horizontal: true }, left: FIRST_PADDING + 1 + LEVEL_PADDING * (i - 1) }, 'last'));
|
24
|
+
}
|
25
|
+
else {
|
26
|
+
//pointer to the last child in the branch (└)
|
27
|
+
dividers.push(_jsx(Divider, { modifiers: { last: true }, left: FIRST_PADDING + LEVEL_PADDING * (i - 1) }, 'last'));
|
28
|
+
}
|
29
|
+
}
|
30
|
+
if (i === linesArray.length - 1 && hasLeafs) {
|
31
|
+
//starting vertical line if node has leafs
|
32
|
+
dividers.push(_jsx(Divider, { modifiers: { first: true }, left: FIRST_PADDING + LEVEL_PADDING * i }, 'first'));
|
33
|
+
}
|
34
|
+
if (linesArray[i]) {
|
35
|
+
//vertical line indicating level
|
36
|
+
dividers.push(_jsx(Divider, { left: FIRST_PADDING + LEVEL_PADDING * (i - 1) }, i));
|
37
|
+
}
|
38
|
+
}
|
39
|
+
return dividers;
|
40
|
+
}
|
41
|
+
export function OperationCell({ row, depth = 0, params }) {
|
42
|
+
const { name, operationParams, lines = '' } = params;
|
43
|
+
const hasLeafs = row.getLeafRows().length > 0;
|
44
|
+
const dividers = React.useMemo(() => getDividers(lines, hasLeafs), [lines, hasLeafs]);
|
45
|
+
return (_jsxs("div", { style: {
|
46
|
+
paddingLeft: LEVEL_PADDING * depth,
|
47
|
+
}, className: block('operation-name'), children: [dividers, _jsxs(Flex, { gap: 1, alignItems: "flex-start", className: block('operation-content'), children: [row.getCanExpand() && (_jsx(Button, { view: "flat", size: "xs", onClick: row.getToggleExpandedHandler(), children: _jsx(Button.Icon, { children: _jsx(ArrowToggle, { direction: row.getIsExpanded() ? 'bottom' : 'right', size: 14 }) }) })), _jsx("div", { className: block('operation-name-content'), children: _jsxs("div", { children: [name, "\u00A0", _jsx(OperationParams, { params: operationParams })] }) })] })] }));
|
48
|
+
}
|
package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationParams.d.ts
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
import type { SimlifiedPlanOperatorOtherParams } from '../../../../../../types/api/query';
|
2
|
+
interface OperationParamsProps {
|
3
|
+
params?: SimlifiedPlanOperatorOtherParams;
|
4
|
+
}
|
5
|
+
export declare function OperationParams({ params }: OperationParamsProps): import("react/jsx-runtime").JSX.Element | null;
|
6
|
+
export {};
|
package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationParams.js
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { block } from './utils';
|
3
|
+
const operatorPropertyToColor = {
|
4
|
+
Table: 'var(--g-color-text-info)',
|
5
|
+
Predicate: 'var(--g-color-text-positive)',
|
6
|
+
Condition: 'var(--g-color-text-utility)',
|
7
|
+
};
|
8
|
+
function getOperatorPropertyColor(property) {
|
9
|
+
if (property in operatorPropertyToColor) {
|
10
|
+
return operatorPropertyToColor[property];
|
11
|
+
}
|
12
|
+
return 'var(--g-color-text-secondary)';
|
13
|
+
}
|
14
|
+
function prepareValue(value) {
|
15
|
+
if (value === undefined) {
|
16
|
+
return '';
|
17
|
+
}
|
18
|
+
if (typeof value === 'object') {
|
19
|
+
return JSON.stringify(value);
|
20
|
+
}
|
21
|
+
else {
|
22
|
+
return value.toString();
|
23
|
+
}
|
24
|
+
}
|
25
|
+
function reorderParamsEntries(params) {
|
26
|
+
const reordered = [];
|
27
|
+
const { Table, Predicate, Condition, ...rest } = params;
|
28
|
+
if (Table) {
|
29
|
+
reordered.push(['Table', Table]);
|
30
|
+
}
|
31
|
+
if (Predicate) {
|
32
|
+
reordered.push(['Predicate', Predicate]);
|
33
|
+
}
|
34
|
+
if (Condition) {
|
35
|
+
reordered.push(['Condition', Condition]);
|
36
|
+
}
|
37
|
+
return reordered.concat(Object.entries(rest));
|
38
|
+
}
|
39
|
+
function getOperationParams(params = {}) {
|
40
|
+
const result = [];
|
41
|
+
const paramsEntries = Object.entries(params);
|
42
|
+
if (paramsEntries.length === 1) {
|
43
|
+
const value = paramsEntries[0][1];
|
44
|
+
const color = getOperatorPropertyColor(paramsEntries[0][0]);
|
45
|
+
// if there is only one param, display value without key
|
46
|
+
result.push(_jsx("span", { style: { color }, children: prepareValue(value) }, "param"));
|
47
|
+
}
|
48
|
+
else {
|
49
|
+
const reorderedParamsEntries = reorderParamsEntries(params);
|
50
|
+
for (let i = 0; i < reorderedParamsEntries.length; i++) {
|
51
|
+
const [key, value] = reorderedParamsEntries[i];
|
52
|
+
const color = getOperatorPropertyColor(key);
|
53
|
+
if (i > 0) {
|
54
|
+
result.push(', ');
|
55
|
+
}
|
56
|
+
result.push(_jsxs("span", { style: { color }, children: [key, ": ", prepareValue(value)] }, i));
|
57
|
+
}
|
58
|
+
}
|
59
|
+
return result;
|
60
|
+
}
|
61
|
+
export function OperationParams({ params }) {
|
62
|
+
if (!params) {
|
63
|
+
return null;
|
64
|
+
}
|
65
|
+
return _jsxs("span", { className: block('operation-params'), children: ["(", getOperationParams(params), ")"] });
|
66
|
+
}
|
package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/SimplifiedPlan.d.ts
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { SimplifiedPlanItem } from '../../../../../../store/reducers/explainQuery/types';
|
2
|
+
import './SimplifiedPlan.scss';
|
3
|
+
interface SimplifiedPlanProps {
|
4
|
+
plan: SimplifiedPlanItem[];
|
5
|
+
}
|
6
|
+
export declare function SimplifiedPlan({ plan }: SimplifiedPlanProps): import("react/jsx-runtime").JSX.Element;
|
7
|
+
export {};
|