ydb-embedded-ui 20.4.0 → 21.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/README.md +41 -0
  2. package/dist/components/AutoRefreshControl/i18n/index.d.ts +1 -1
  3. package/dist/components/FullNodeViewer/i18n/index.d.ts +1 -1
  4. package/dist/components/Graph/BlockComponents/ConnectionBlockComponent.d.ts +7 -0
  5. package/dist/components/Graph/BlockComponents/ConnectionBlockComponent.js +30 -0
  6. package/dist/components/Graph/BlockComponents/ConnectionBlockComponent.js.map +1 -0
  7. package/dist/components/Graph/BlockComponents/QueryBlockComponent.d.ts +5 -0
  8. package/dist/components/Graph/BlockComponents/QueryBlockComponent.js +5 -0
  9. package/dist/components/Graph/BlockComponents/QueryBlockComponent.js.map +1 -0
  10. package/dist/components/Graph/BlockComponents/ResultBlockComponent.d.ts +7 -0
  11. package/dist/components/Graph/BlockComponents/ResultBlockComponent.js +5 -0
  12. package/dist/components/Graph/BlockComponents/ResultBlockComponent.js.map +1 -0
  13. package/dist/components/Graph/BlockComponents/StageBlockComponent.d.ts +7 -0
  14. package/dist/components/Graph/BlockComponents/StageBlockComponent.js +17 -0
  15. package/dist/components/Graph/BlockComponents/StageBlockComponent.js.map +1 -0
  16. package/dist/components/Graph/FullViewportBackground.d.ts +2 -0
  17. package/dist/components/Graph/FullViewportBackground.js +67 -0
  18. package/dist/components/Graph/FullViewportBackground.js.map +1 -0
  19. package/dist/components/Graph/GraphControls.d.ts +6 -0
  20. package/dist/components/Graph/GraphControls.js +24 -0
  21. package/dist/components/Graph/GraphControls.js.map +1 -0
  22. package/dist/components/Graph/GravityGraph.d.ts +9 -0
  23. package/dist/components/Graph/GravityGraph.js +122 -0
  24. package/dist/components/Graph/GravityGraph.js.map +1 -0
  25. package/dist/components/Graph/GravityGraph.scss +131 -0
  26. package/dist/components/Graph/NonSelectableConnection.d.ts +9 -0
  27. package/dist/components/Graph/NonSelectableConnection.js +16 -0
  28. package/dist/components/Graph/NonSelectableConnection.js.map +1 -0
  29. package/dist/components/Graph/TooltipComponent.d.ts +8 -0
  30. package/dist/components/Graph/TooltipComponent.js +63 -0
  31. package/dist/components/Graph/TooltipComponent.js.map +1 -0
  32. package/dist/components/Graph/colorsConfig.d.ts +19 -0
  33. package/dist/components/Graph/colorsConfig.js +20 -0
  34. package/dist/components/Graph/colorsConfig.js.map +1 -0
  35. package/dist/components/Graph/i18n/en.json +5 -0
  36. package/dist/components/Graph/i18n/index.d.ts +2 -0
  37. package/dist/components/Graph/i18n/index.js +5 -0
  38. package/dist/components/Graph/i18n/index.js.map +1 -0
  39. package/dist/components/Graph/runTreeLayout.d.ts +12 -0
  40. package/dist/components/Graph/runTreeLayout.js +75 -0
  41. package/dist/components/Graph/runTreeLayout.js.map +1 -0
  42. package/dist/components/Graph/treeLayout.d.ts +2 -0
  43. package/dist/components/Graph/treeLayout.js +284 -0
  44. package/dist/components/Graph/treeLayout.js.map +1 -0
  45. package/dist/components/Graph/types.d.ts +52 -0
  46. package/dist/components/Graph/types.js +2 -0
  47. package/dist/components/Graph/types.js.map +1 -0
  48. package/dist/components/Graph/utils.d.ts +6 -0
  49. package/dist/components/Graph/utils.js +88 -0
  50. package/dist/components/Graph/utils.js.map +1 -0
  51. package/dist/components/InfoViewer/formatters/pqGroup.d.ts +5 -1
  52. package/dist/components/InfoViewer/formatters/pqGroup.js +24 -2
  53. package/dist/components/InfoViewer/formatters/pqGroup.js.map +1 -1
  54. package/dist/components/InfoViewer/i18n/en.json +8 -1
  55. package/dist/components/InfoViewer/i18n/index.d.ts +1 -1
  56. package/dist/components/PDiskInfo/i18n/index.d.ts +1 -1
  57. package/dist/components/VDiskInfo/i18n/index.d.ts +1 -1
  58. package/dist/containers/App/Content.js +9 -2
  59. package/dist/containers/App/Content.js.map +1 -1
  60. package/dist/containers/App/clusterRouteGuard.d.ts +5 -0
  61. package/dist/containers/App/clusterRouteGuard.js +13 -0
  62. package/dist/containers/App/clusterRouteGuard.js.map +1 -0
  63. package/dist/containers/Clusters/constants.d.ts +1 -1
  64. package/dist/containers/Nodes/i18n/index.d.ts +1 -1
  65. package/dist/containers/Operations/constants.d.ts +1 -1
  66. package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/i18n/index.d.ts +1 -1
  67. package/dist/containers/Tenant/Diagnostics/Overview/TransferInfo/Credentials.d.ts +1 -1
  68. package/dist/containers/Tenant/Diagnostics/Overview/utils/prepareTopicSchemaInfo.js +17 -3
  69. package/dist/containers/Tenant/Diagnostics/Overview/utils/prepareTopicSchemaInfo.js.map +1 -1
  70. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/useTenantStorageNewData.d.ts +2 -2
  71. package/dist/containers/Tenant/Query/QueryResult/components/Graph/Graph.js +9 -4
  72. package/dist/containers/Tenant/Query/QueryResult/components/Graph/Graph.js.map +1 -1
  73. package/dist/containers/Tenant/Query/QueryResult/components/Graph/Graph.scss +2 -0
  74. package/dist/containers/Tenant/TenantNavigation/useTenantNavigation.d.ts +1 -1
  75. package/dist/graphLayout.worker.d.ts +1 -0
  76. package/dist/graphLayout.worker.js +17 -0
  77. package/dist/graphLayout.worker.js.map +1 -0
  78. package/dist/lib.d.ts +1 -1
  79. package/dist/lib.js.map +1 -1
  80. package/dist/store/reducers/query/parsers/preparePlanData.js.map +1 -1
  81. package/dist/store/reducers/query/types.d.ts +38 -1
  82. package/dist/store/reducers/settings/utils.d.ts +2 -2
  83. package/dist/types/api/schema/persQueueGroup.d.ts +16 -0
  84. package/dist/types/api/schema/persQueueGroup.js +7 -0
  85. package/dist/types/api/schema/persQueueGroup.js.map +1 -1
  86. package/dist/uiFactory/types.d.ts +3 -0
  87. package/dist/utils/disks/helpers.d.ts +2 -2
  88. package/dist/utils/hooks/useChangedQuerySettings.d.ts +2 -2
  89. package/dist/utils/hooks/useLastQueryExecutionSettings.d.ts +2 -2
  90. package/dist/utils/hooks/useQueryExecutionSettings.d.ts +2 -2
  91. package/dist/utils/prepareQueryExplain.d.ts +1 -2
  92. package/dist/utils/prepareQueryExplain.js +10 -2
  93. package/dist/utils/prepareQueryExplain.js.map +1 -1
  94. package/dist/utils/query.d.ts +1 -1
  95. package/package.json +3 -3
  96. package/src/components/Graph/BlockComponents/ConnectionBlockComponent.tsx +49 -0
  97. package/src/components/Graph/BlockComponents/QueryBlockComponent.tsx +7 -0
  98. package/src/components/Graph/BlockComponents/ResultBlockComponent.tsx +10 -0
  99. package/src/components/Graph/BlockComponents/StageBlockComponent.tsx +35 -0
  100. package/src/components/Graph/FullViewportBackground.ts +122 -0
  101. package/src/components/Graph/GraphControls.tsx +49 -0
  102. package/src/components/Graph/GravityGraph.scss +131 -0
  103. package/src/components/Graph/GravityGraph.tsx +174 -0
  104. package/src/components/Graph/NonSelectableConnection.tsx +14 -0
  105. package/src/components/Graph/TooltipComponent.tsx +114 -0
  106. package/src/components/Graph/colorsConfig.ts +21 -0
  107. package/src/components/Graph/i18n/en.json +5 -0
  108. package/src/components/Graph/i18n/index.ts +7 -0
  109. package/src/components/Graph/runTreeLayout.ts +105 -0
  110. package/src/components/Graph/treeLayout.ts +378 -0
  111. package/src/components/Graph/types.ts +56 -0
  112. package/src/components/Graph/utils.ts +112 -0
  113. package/src/components/InfoViewer/formatters/pqGroup.ts +30 -2
  114. package/src/components/InfoViewer/i18n/en.json +8 -1
  115. package/src/containers/App/Content.tsx +9 -1
  116. package/src/containers/App/clusterRouteGuard.ts +24 -0
  117. package/src/containers/Tenant/Diagnostics/Overview/utils/prepareTopicSchemaInfo.ts +23 -2
  118. package/src/containers/Tenant/Query/QueryResult/components/Graph/Graph.scss +2 -0
  119. package/src/containers/Tenant/Query/QueryResult/components/Graph/Graph.tsx +13 -7
  120. package/src/graphLayout.worker.ts +21 -0
  121. package/src/lib.ts +1 -0
  122. package/src/store/reducers/query/parsers/preparePlanData.ts +1 -3
  123. package/src/store/reducers/query/types.ts +42 -2
  124. package/src/types/api/schema/persQueueGroup.ts +19 -0
  125. package/src/uiFactory/types.ts +4 -0
  126. package/src/utils/prepareQueryExplain.ts +13 -5
  127. package/dist/components/Graph/Graph.d.ts +0 -12
  128. package/dist/components/Graph/Graph.js +0 -44
  129. package/dist/components/Graph/Graph.js.map +0 -1
  130. package/dist/components/Graph/colors.d.ts +0 -10
  131. package/dist/components/Graph/colors.js +0 -53
  132. package/dist/components/Graph/colors.js.map +0 -1
  133. package/src/components/Graph/Graph.tsx +0 -70
  134. package/src/components/Graph/colors.ts +0 -75
@@ -0,0 +1,63 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { Popover, Tab, TabList, TabPanel, TabProvider } from '@gravity-ui/uikit';
4
+ import { cn } from '../../utils/cn';
5
+ const b = cn('ydb-gravity-graph');
6
+ const getStatsContent = (stat) => {
7
+ var _a;
8
+ if ('value' in stat) {
9
+ return (_jsxs("p", { className: b('tooltip-stat-row'), children: [_jsxs("span", { children: [stat.name, ":"] }), _jsx("span", { children: stat.value })] }, stat.name));
10
+ }
11
+ return (_jsxs("section", { className: b('tooltip-stat-group'), children: [_jsxs("div", { className: b('tooltip-stat-group-name'), children: [stat.name, ":"] }), (_a = stat.items) === null || _a === void 0 ? void 0 : _a.map(({ name, value }) => (_jsxs("p", { className: b('tooltip-stat-row'), children: [_jsxs("span", { children: [name, ":"] }), _jsx("span", { children: value })] }, name)))] }, stat.name));
12
+ };
13
+ const useTooltipContent = (block) => {
14
+ var _a, _b, _c;
15
+ const firstTab = ((_b = (_a = block === null || block === void 0 ? void 0 : block.stats) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.group) || '';
16
+ const [activeTab, setActiveTab] = React.useState(firstTab);
17
+ const validatedActiveTab = ((_c = block.stats) === null || _c === void 0 ? void 0 : _c.some(({ group }) => group === activeTab))
18
+ ? activeTab
19
+ : firstTab;
20
+ React.useEffect(() => {
21
+ if (activeTab !== validatedActiveTab) {
22
+ setActiveTab(validatedActiveTab);
23
+ }
24
+ }, [activeTab, validatedActiveTab]);
25
+ return React.useMemo(() => {
26
+ var _a, _b;
27
+ return (_jsxs(TabProvider, { value: validatedActiveTab, onUpdate: setActiveTab, children: [_jsx(TabList, { className: b('tooltip-tabs'), children: (_a = block === null || block === void 0 ? void 0 : block.stats) === null || _a === void 0 ? void 0 : _a.map((item) => (_jsx(Tab, { value: item.group, children: item.group }, item.group))) }), (_b = block === null || block === void 0 ? void 0 : block.stats) === null || _b === void 0 ? void 0 : _b.map((item) => {
28
+ var _a;
29
+ return (_jsx(TabPanel, { value: item.group, children: (_a = item.stats) === null || _a === void 0 ? void 0 : _a.map(getStatsContent) }, item.group));
30
+ })] }));
31
+ }, [block === null || block === void 0 ? void 0 : block.stats, validatedActiveTab]);
32
+ };
33
+ export const TooltipComponent = ({ block, children }) => {
34
+ var _a, _b;
35
+ const content = useTooltipContent(block);
36
+ const trigger = React.cloneElement(children, {
37
+ role: (_a = children.props.role) !== null && _a !== void 0 ? _a : 'button',
38
+ tabIndex: (_b = children.props.tabIndex) !== null && _b !== void 0 ? _b : 0,
39
+ onKeyDown: (event) => {
40
+ var _a, _b;
41
+ (_b = (_a = children.props).onKeyDown) === null || _b === void 0 ? void 0 : _b.call(_a, event);
42
+ if (event.defaultPrevented) {
43
+ return;
44
+ }
45
+ if (event.key === 'Enter') {
46
+ event.preventDefault();
47
+ event.currentTarget.click();
48
+ }
49
+ else if (event.key === ' ') {
50
+ event.preventDefault();
51
+ }
52
+ },
53
+ onKeyUp: (event) => {
54
+ var _a, _b;
55
+ (_b = (_a = children.props).onKeyUp) === null || _b === void 0 ? void 0 : _b.call(_a, event);
56
+ if (!event.defaultPrevented && event.key === ' ') {
57
+ event.currentTarget.click();
58
+ }
59
+ },
60
+ });
61
+ return (_jsx(Popover, { content: content, hasArrow: true, trigger: "click", placement: "right-start", className: "ydb-gravity-graph__tooltip-content", strategy: "fixed", children: trigger }));
62
+ };
63
+ //# sourceMappingURL=TooltipComponent.js.map
@@ -0,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O,CACH,KAAC,OAAO,IACJ,OAAO,EAAE,OAAO,EAChB,QAAQ,QACR,OAAO,EAAC,OAAO,EACf,SAAS,EAAC,aAAa,EACvB,SAAS,EAAC,oCAAoC,EAC9C,QAAQ,EAAC,OAAO,YAEf,OAAO,GACF,CACb,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ export type AbstractGraphColorsConfig = Partial<Record<string, Partial<Record<string, string>>>>;
2
+ export declare const graphColorsConfig: {
3
+ readonly canvas: {
4
+ readonly belowLayerBackground: "#0000";
5
+ readonly border: "#0000";
6
+ readonly dots: "var(--g-color-line-generic)";
7
+ readonly layerBackground: "var(--g-color-base-background)";
8
+ };
9
+ readonly block: {
10
+ readonly text: "var(--g-color-text-primary)";
11
+ readonly background: "var(--g-color-base-float)";
12
+ readonly border: "var(--g-color-line-generic-solid)";
13
+ };
14
+ readonly connection: {
15
+ readonly background: "var(--g-color-line-generic-solid)";
16
+ readonly hoverBackground: "var(--g-color-line-generic-solid)";
17
+ readonly selectedBackground: "var(--g-color-line-generic-solid)";
18
+ };
19
+ };
@@ -0,0 +1,20 @@
1
+ export const graphColorsConfig = {
2
+ // Default @gravity-ui/graph colors
3
+ canvas: {
4
+ belowLayerBackground: '#0000',
5
+ border: '#0000',
6
+ dots: 'var(--g-color-line-generic)',
7
+ layerBackground: 'var(--g-color-base-background)',
8
+ },
9
+ block: {
10
+ text: 'var(--g-color-text-primary)',
11
+ background: 'var(--g-color-base-float)',
12
+ border: 'var(--g-color-line-generic-solid)',
13
+ },
14
+ connection: {
15
+ background: 'var(--g-color-line-generic-solid)',
16
+ hoverBackground: 'var(--g-color-line-generic-solid)',
17
+ selectedBackground: 'var(--g-color-line-generic-solid)',
18
+ },
19
+ };
20
+ //# sourceMappingURL=colorsConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorsConfig.js","sourceRoot":"","sources":["../../../src/components/Graph/colorsConfig.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC7B,mCAAmC;IACnC,MAAM,EAAE;QACJ,oBAAoB,EAAE,OAAO;QAC7B,MAAM,EAAE,OAAO;QACf,IAAI,EAAE,6BAA6B;QACnC,eAAe,EAAE,gCAAgC;KACpD;IACD,KAAK,EAAE;QACH,IAAI,EAAE,6BAA6B;QACnC,UAAU,EAAE,2BAA2B;QACvC,MAAM,EAAE,mCAAmC;KAC9C;IACD,UAAU,EAAE;QACR,UAAU,EAAE,mCAAmC;QAC/C,eAAe,EAAE,mCAAmC;QACpD,kBAAkB,EAAE,mCAAmC;KAC1D;CACyC,CAAC"}
@@ -0,0 +1,5 @@
1
+ {
2
+ "action_zoom-in": "Zoom in",
3
+ "action_zoom-out": "Zoom out",
4
+ "label_tables": "Tables"
5
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (key: "action_zoom-in" | "action_zoom-out" | "label_tables", params?: import("@gravity-ui/i18n").Params) => string;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { registerKeysets } from '../../../utils/i18n';
2
+ import en from './en.json';
3
+ const COMPONENT = 'ydb-gravity-graph';
4
+ export default registerKeysets(COMPONENT, { en });
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Graph/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,MAAM,WAAW,CAAC;AAE3B,MAAM,SAAS,GAAG,mBAAmB,CAAC;AAEtC,eAAe,eAAe,CAAC,SAAS,EAAE,EAAC,EAAE,EAAC,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { TreeLayoutRequest, TreeLayoutResult } from './types';
2
+ type Schedule = (callback: () => void) => () => void;
3
+ interface RunTreeLayoutOptions {
4
+ request: TreeLayoutRequest;
5
+ createWorker: () => Worker;
6
+ calculateLayout?: () => TreeLayoutResult;
7
+ onResult: (result: TreeLayoutResult) => void;
8
+ onError: (error: Error) => void;
9
+ schedule?: Schedule;
10
+ }
11
+ export declare function runTreeLayout({ request, createWorker, calculateLayout, onResult, onError, schedule, }: RunTreeLayoutOptions): () => void;
12
+ export {};
@@ -0,0 +1,75 @@
1
+ import { prepareTreeLayout } from './treeLayout';
2
+ const scheduleOnMainThread = (callback) => {
3
+ const timeoutId = globalThis.setTimeout(callback, 0);
4
+ return () => globalThis.clearTimeout(timeoutId);
5
+ };
6
+ const normalizeError = (error) => {
7
+ return error instanceof Error ? error : new Error(String(error));
8
+ };
9
+ export function runTreeLayout({ request, createWorker, calculateLayout = () => prepareTreeLayout(request), onResult, onError, schedule = scheduleOnMainThread, }) {
10
+ let worker;
11
+ let cancelFallback;
12
+ let cancelled = false;
13
+ let settled = false;
14
+ const terminateWorker = () => {
15
+ worker === null || worker === void 0 ? void 0 : worker.terminate();
16
+ worker = undefined;
17
+ };
18
+ const reportError = (error) => {
19
+ if (cancelled || settled) {
20
+ return;
21
+ }
22
+ settled = true;
23
+ terminateWorker();
24
+ onError(normalizeError(error));
25
+ };
26
+ const complete = (result) => {
27
+ if (cancelled || settled) {
28
+ return;
29
+ }
30
+ settled = true;
31
+ terminateWorker();
32
+ onResult(result);
33
+ };
34
+ const scheduleFallback = () => {
35
+ if (cancelled || settled || cancelFallback) {
36
+ return;
37
+ }
38
+ terminateWorker();
39
+ cancelFallback = schedule(() => {
40
+ cancelFallback = undefined;
41
+ if (cancelled || settled) {
42
+ return;
43
+ }
44
+ try {
45
+ complete(calculateLayout());
46
+ }
47
+ catch (error) {
48
+ reportError(error);
49
+ }
50
+ });
51
+ };
52
+ try {
53
+ worker = createWorker();
54
+ worker.onmessage = ({ data }) => {
55
+ if (data.type === 'success') {
56
+ complete(data.result);
57
+ }
58
+ else {
59
+ reportError(new Error(data.error));
60
+ }
61
+ };
62
+ worker.onerror = scheduleFallback;
63
+ worker.onmessageerror = scheduleFallback;
64
+ worker.postMessage(request);
65
+ }
66
+ catch (_a) {
67
+ scheduleFallback();
68
+ }
69
+ return () => {
70
+ cancelled = true;
71
+ cancelFallback === null || cancelFallback === void 0 ? void 0 : cancelFallback();
72
+ terminateWorker();
73
+ };
74
+ }
75
+ //# sourceMappingURL=runTreeLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runTreeLayout.js","sourceRoot":"","sources":["../../../src/components/Graph/runTreeLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAc/C,MAAM,oBAAoB,GAAa,CAAC,QAAQ,EAAE,EAAE;IAChD,MAAM,SAAS,GAAG,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAErD,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,KAAc,EAAE,EAAE;IACtC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACrE,CAAC,CAAC;AAEF,MAAM,UAAU,aAAa,CAAC,EAC1B,OAAO,EACP,YAAY,EACZ,eAAe,GAAG,GAAG,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAClD,QAAQ,EACR,OAAO,EACP,QAAQ,GAAG,oBAAoB,GACZ;IACnB,IAAI,MAA0B,CAAC;IAC/B,IAAI,cAAwC,CAAC;IAC7C,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,OAAO,GAAG,KAAK,CAAC;IAEpB,MAAM,eAAe,GAAG,GAAG,EAAE;QACzB,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,EAAE,CAAC;QACpB,MAAM,GAAG,SAAS,CAAC;IACvB,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,KAAc,EAAE,EAAE;QACnC,I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QACF,MAAM,CAAC,OAAO,GAAG,gBAAgB,CAAC;QAClC,MAAM,CAAC,cAAc,GAAG,gBAAgB,CAAC;QACzC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAAC,WAAM,CAAC;QACL,gBAAgB,EAAE,CAAC;IACvB,CAAC;IAED,OAAO,GAAG,EAAE;QACR,SAAS,GAAG,IAAI,CAAC;QACjB,cAAc,aAAd,cAAc,uBAAd,cAAc,EAAI,CAAC;QACnB,eAAe,EAAE,CAAC;IACtB,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { TreeLayoutRequest, TreeLayoutResult } from './types';
2
+ export declare function prepareTreeLayout({ nodes, links }: TreeLayoutRequest): TreeLayoutResult;
@@ -0,0 +1,284 @@
1
+ import { prepareBlocks, prepareConnections } from './utils';
2
+ class TreeLayoutEngine {
3
+ constructor(blocks, connections, options = {}) {
4
+ this.blocks = new Map(blocks.map((block) => [block.id, { ...block }]));
5
+ this.connections = connections;
6
+ // Layout settings
7
+ this.options = {
8
+ horizontalSpacing: options.horizontalSpacing || 40, // horizontal distance between blocks
9
+ padding: 12,
10
+ verticalSpacing: options.verticalSpacing || 20, // vertical distance between levels
11
+ ...options,
12
+ };
13
+ this.tree = null;
14
+ this.levels = [];
15
+ }
16
+ // Building a tree structure
17
+ buildTree() {
18
+ const childrenMap = new Map();
19
+ const parentMap = new Map();
20
+ for (const block of this.blocks.values()) {
21
+ childrenMap.set(block.id, []);
22
+ }
23
+ // Setting connections
24
+ for (const connection of this.connections) {
25
+ const parent = connection.sourceBlockId;
26
+ const child = connection.targetBlockId;
27
+ childrenMap.get(parent).push(child);
28
+ parentMap.set(child, parent);
29
+ }
30
+ // Find root (a node without a parent)
31
+ const rootId = Array.from(this.blocks.keys()).find((id) => !parentMap.has(id));
32
+ if (!rootId) {
33
+ throw new Error('Root node not found');
34
+ }
35
+ // Recursively building a tree
36
+ const buildNode = (nodeId, level = 0) => {
37
+ const block = this.blocks.get(nodeId);
38
+ const children = childrenMap
39
+ .get(nodeId)
40
+ .map((childId) => buildNode(childId, level + 1));
41
+ return {
42
+ id: nodeId,
43
+ block: block,
44
+ children: children,
45
+ level: level,
46
+ x: 0,
47
+ y: 0,
48
+ subtreeWidth: 0,
49
+ };
50
+ };
51
+ this.tree = buildNode(rootId);
52
+ return this.tree;
53
+ }
54
+ // Grouping nodes by levels
55
+ groupByLevels(node = this.tree, levels = []) {
56
+ if (!node) {
57
+ return levels;
58
+ }
59
+ if (!levels[node.level]) {
60
+ levels[node.level] = [];
61
+ }
62
+ levels[node.level].push(node);
63
+ for (const child of node.children) {
64
+ this.groupByLevels(child, levels);
65
+ }
66
+ this.levels = levels;
67
+ return levels;
68
+ }
69
+ // Calculating the width of the subtree for each node
70
+ calculateSubtreeWidths(node = this.tree) {
71
+ if (node.children.length === 0) {
72
+ // Leaf node - width is equal to the width of the block
73
+ node.subtreeWidth = node.block.width;
74
+ }
75
+ else {
76
+ // Recursively calculating the width for children
77
+ for (const child of node.children) {
78
+ this.calculateSubtreeWidths(child);
79
+ }
80
+ // Subtree width = sum of the widths of the children's subtrees + the margins between them
81
+ const childrenWidth = node.children.reduce((sum, child) => sum + child.subtreeWidth, 0);
82
+ const spacingWidth = (node.children.length - 1) * this.options.horizontalSpacing;
83
+ const totalChildrenWidth = childrenWidth + spacingWidth;
84
+ // Subtree width = the maximum of the width of the node itself and the total width of the children
85
+ node.subtreeWidth = Math.max(node.block.width, totalChildrenWidth);
86
+ }
87
+ return node.subtreeWidth;
88
+ }
89
+ // Placement of nodes by position
90
+ positionNodes() {
91
+ if (!this.tree) {
92
+ return;
93
+ }
94
+ // Calculating the Y coordinates for each level
95
+ let currentY = 0;
96
+ const levelY = [];
97
+ for (let level = 0; level < this.levels.length; level++) {
98
+ levelY[level] = currentY;
99
+ // We find the maximum height of the blocks at this level
100
+ const maxHeight = Math.max(...this.levels[level].map((node) => node.block.height));
101
+ currentY += maxHeight + this.options.verticalSpacing;
102
+ }
103
+ // Recursively placing nodes
104
+ const positionNode = (node, leftX) => {
105
+ // Setting the Y coordinate
106
+ node.y = levelY[node.level];
107
+ if (node.children.length === 0) {
108
+ // The leaf node is placed in the current position.
109
+ node.x = leftX;
110
+ }
111
+ else {
112
+ // Place children
113
+ let childX = leftX;
114
+ // If the node width is greater than the total width of the children, add an indentation.
115
+ const childrenWidth = node.children.reduce((sum, child) => sum + child.subtreeWidth, 0);
116
+ const spacingWidth = (node.children.length - 1) * this.options.horizontalSpacing;
117
+ const totalChildrenWidth = childrenWidth + spacingWidth;
118
+ if (node.block.width > totalChildrenWidth) {
119
+ const extraSpace = (node.block.width - totalChildrenWidth) / 2;
120
+ childX += extraSpace;
121
+ }
122
+ // Place each child
123
+ for (const child of node.children) {
124
+ positionNode(child, childX);
125
+ childX += child.subtreeWidth + this.options.horizontalSpacing;
126
+ }
127
+ // Center the parent node relative to the children
128
+ const firstChild = node.children[0];
129
+ const lastChild = node.children[node.children.length - 1];
130
+ const childrenCenter = (firstChild.x + lastChild.x + lastChild.block.width) / 2;
131
+ node.x = childrenCenter - node.block.width / 2;
132
+ }
133
+ };
134
+ positionNode(this.tree, 0);
135
+ }
136
+ // Normalization of coordinates with padding from the canvas edges
137
+ normalizeCoordinates() {
138
+ if (!this.tree) {
139
+ return;
140
+ }
141
+ const allNodes = [];
142
+ const collectNodes = (node) => {
143
+ allNodes.push(node);
144
+ for (const child of node.children) {
145
+ collectNodes(child);
146
+ }
147
+ };
148
+ collectNodes(this.tree);
149
+ const minX = Math.min(...allNodes.map((node) => node.x));
150
+ const minY = Math.min(...allNodes.map((node) => node.y));
151
+ const offsetX = this.options.padding - minX;
152
+ const offsetY = this.options.padding - minY;
153
+ for (const node of allNodes) {
154
+ node.x += offsetX;
155
+ node.y += offsetY;
156
+ }
157
+ }
158
+ // Main method of composition
159
+ layout() {
160
+ this.buildTree();
161
+ this.groupByLevels();
162
+ this.calculateSubtreeWidths();
163
+ this.positionNodes();
164
+ this.normalizeCoordinates();
165
+ return this.getLayoutResult();
166
+ }
167
+ // Getting the result of composition
168
+ getLayoutResult() {
169
+ if (!this.tree) {
170
+ return [];
171
+ }
172
+ const result = [];
173
+ const collectResults = (node) => {
174
+ result.push({
175
+ id: node.id,
176
+ x: node.x,
177
+ y: node.y,
178
+ width: node.block.width,
179
+ height: node.block.height,
180
+ level: node.level,
181
+ ...node.block,
182
+ });
183
+ for (const child of node.children) {
184
+ collectResults(child);
185
+ }
186
+ };
187
+ collectResults(this.tree);
188
+ return result;
189
+ }
190
+ }
191
+ // Function for using the algorithm
192
+ function calculateTreeLayout(blocks, connections, options = {}) {
193
+ const engine = new TreeLayoutEngine(blocks, connections, options);
194
+ return engine.layout();
195
+ }
196
+ function calculateTreeEdges(layoutResult, connections) {
197
+ // Create a position map for convenience of search
198
+ const positionMap = new Map(layoutResult.map((item) => [item.id, item]));
199
+ // Group connections by parent block
200
+ const connectionsByParent = new Map();
201
+ for (const connection of connections) {
202
+ const parentId = connection.sourceBlockId;
203
+ if (!connectionsByParent.has(parentId)) {
204
+ connectionsByParent.set(parentId, []);
205
+ }
206
+ connectionsByParent.get(parentId).push(connection);
207
+ }
208
+ const connectionPaths = [];
209
+ // For each parent block, we calculate the paths to the children
210
+ for (const [parentId, parentConnections] of connectionsByParent) {
211
+ const parent = positionMap.get(parentId);
212
+ if (!parent) {
213
+ continue;
214
+ }
215
+ // Coordinates of the initial point (center of the lower part of the parent)
216
+ const startX = parent.x + parent.width / 2;
217
+ const startY = parent.y + parent.height;
218
+ if (parentConnections.length === 1) {
219
+ // One child block - simple straight line
220
+ const connection = parentConnections[0];
221
+ const child = positionMap.get(connection.targetBlockId);
222
+ if (child) {
223
+ const endX = child.x + child.width / 2;
224
+ const endY = child.y;
225
+ connectionPaths.push({
226
+ connectionId: connection.id,
227
+ sourceBlockId: connection.sourceBlockId,
228
+ targetBlockId: connection.targetBlockId,
229
+ points: [
230
+ { x: startX, y: startY },
231
+ { x: endX, y: endY },
232
+ ],
233
+ });
234
+ }
235
+ }
236
+ else {
237
+ // Several child blocks - broken lines
238
+ // We find the vertical distance between the parent and the nearest child
239
+ const children = parentConnections
240
+ .map((conn) => positionMap.get(conn.targetBlockId))
241
+ .filter((child) => child !== undefined);
242
+ if (children.length === 0) {
243
+ continue;
244
+ }
245
+ // We find the minimum distance to the children by Y
246
+ const minChildY = Math.min(...children.map((child) => child.y));
247
+ // The point of branching - in the middle between the parent and the children
248
+ const branchY = startY + (minChildY - startY) / 2;
249
+ // For each child block, we create a broken line
250
+ for (const connection of parentConnections) {
251
+ const child = positionMap.get(connection.targetBlockId);
252
+ if (!child) {
253
+ continue;
254
+ }
255
+ const endX = child.x + child.width / 2;
256
+ const endY = child.y;
257
+ const points = [
258
+ { x: startX, y: startY }, // Start - center of the lower part of the parent
259
+ { x: startX, y: branchY }, // Vertically down to the point of branching
260
+ { x: endX, y: branchY }, // Horizontally to the center of the child block
261
+ { x: endX, y: endY }, // Vertically down to the center of the upper part of the child block
262
+ ];
263
+ connectionPaths.push({
264
+ connectionId: connection.id,
265
+ sourceBlockId: connection.sourceBlockId,
266
+ targetBlockId: connection.targetBlockId,
267
+ points: points,
268
+ });
269
+ }
270
+ }
271
+ }
272
+ return connectionPaths;
273
+ }
274
+ export function prepareTreeLayout({ nodes, links }) {
275
+ const blocks = prepareBlocks(nodes);
276
+ const connections = prepareConnections(links);
277
+ const layout = calculateTreeLayout(blocks, connections);
278
+ const edges = calculateTreeEdges(layout, connections);
279
+ return {
280
+ layout,
281
+ edges,
282
+ };
283
+ }
284
+ //# sourceMappingURL=treeLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"treeLayout.js","sourceRoot":"","sources":["../../../src/components/Graph/treeLayout.ts"],"names":[],"mappings":"AAWA,OAAO,EAAC,aAAa,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAC;AAE1D,MAAM,gBAAgB;IAOlB,YAAY,MAAa,EAAE,WAA6B,EAAE,UAAyB,EAAE;QACjF,IAAI,CAAC,MA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AC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAC,EAAE,qEAAqE;iBAC5F,CAAC;gBAEF,eAAe,CAAC,IAAI,CAAC;oBACjB,YAAY,EAAE,UAAU,CAAC,EAAE;oBAC3B,aAAa,EAAE,UAAU,CAAC,aAAa;oBACvC,aAAa,EAAE,UAAU,CAAC,aAAa;oBACvC,MAAM,EAAE,MAAM;iBACjB,CAAC,CAAC;YACP,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,eAAe,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,EAAC,KAAK,EAAE,KAAK,EAAoB;IAC/D,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACpC,MAAM,WAAW,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,mBAAmB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,kBAAkB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAEtD,OAAO;QACH,MAAM;QACN,KAAK;KACR,CAAC;AACN,CAAC"}
@@ -0,0 +1,52 @@
1
+ import type { TBlock, TBlockId, TConnection, TMultipointConnection } from '@gravity-ui/graph';
2
+ import type { GraphNode, Link, TopologyNodeDataStats } from '../../store/reducers/query/types';
3
+ export interface ExtendedTBlock extends TBlock {
4
+ planNodeId?: number;
5
+ stats?: TopologyNodeDataStats[];
6
+ operators?: string[];
7
+ tables?: string[];
8
+ }
9
+ export type LinkType = 'arrow' | 'line';
10
+ export interface Data<TData = any> {
11
+ links: Link[];
12
+ nodes: GraphNode<TData>[];
13
+ }
14
+ export interface LayoutOptions {
15
+ horizontalSpacing?: number;
16
+ padding?: number;
17
+ verticalSpacing?: number;
18
+ }
19
+ export interface TreeNode {
20
+ id: string;
21
+ level: number;
22
+ block: any;
23
+ children: TreeNode[];
24
+ subtreeWidth: number;
25
+ x: number;
26
+ y: number;
27
+ }
28
+ export type EdgeResult = TMultipointConnection & {
29
+ connectionId: string | undefined;
30
+ points: Array<{
31
+ x: number;
32
+ y: number;
33
+ }>;
34
+ sourceBlockId: TBlockId;
35
+ targetBlockId: TBlockId;
36
+ };
37
+ export type TreeLayoutRequest = Pick<Data, 'links' | 'nodes'>;
38
+ export interface TreeLayoutResult {
39
+ layout: ExtendedTBlock[];
40
+ edges: EdgeResult[];
41
+ }
42
+ export type TreeLayoutWorkerResponse = {
43
+ type: 'success';
44
+ result: TreeLayoutResult;
45
+ } | {
46
+ type: 'error';
47
+ error: string;
48
+ };
49
+ export type TreeConnection = TConnection & {
50
+ sourceBlockId: TBlockId;
51
+ targetBlockId: TBlockId;
52
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Graph/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import type { TBlock } from '@gravity-ui/graph';
2
+ import type { AbstractGraphColorsConfig } from './colorsConfig';
3
+ import type { Data, TreeConnection } from './types';
4
+ export declare const prepareBlocks: (nodes: Data["nodes"]) => TBlock[];
5
+ export declare const prepareConnections: (links: Data["links"]) => TreeConnection[];
6
+ export declare function parseCustomPropertyValue<T extends AbstractGraphColorsConfig>(colors: T, block?: HTMLElement): T;