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.
- package/README.md +41 -0
- package/dist/components/AutoRefreshControl/i18n/index.d.ts +1 -1
- package/dist/components/FullNodeViewer/i18n/index.d.ts +1 -1
- package/dist/components/Graph/BlockComponents/ConnectionBlockComponent.d.ts +7 -0
- package/dist/components/Graph/BlockComponents/ConnectionBlockComponent.js +30 -0
- package/dist/components/Graph/BlockComponents/ConnectionBlockComponent.js.map +1 -0
- package/dist/components/Graph/BlockComponents/QueryBlockComponent.d.ts +5 -0
- package/dist/components/Graph/BlockComponents/QueryBlockComponent.js +5 -0
- package/dist/components/Graph/BlockComponents/QueryBlockComponent.js.map +1 -0
- package/dist/components/Graph/BlockComponents/ResultBlockComponent.d.ts +7 -0
- package/dist/components/Graph/BlockComponents/ResultBlockComponent.js +5 -0
- package/dist/components/Graph/BlockComponents/ResultBlockComponent.js.map +1 -0
- package/dist/components/Graph/BlockComponents/StageBlockComponent.d.ts +7 -0
- package/dist/components/Graph/BlockComponents/StageBlockComponent.js +17 -0
- package/dist/components/Graph/BlockComponents/StageBlockComponent.js.map +1 -0
- package/dist/components/Graph/FullViewportBackground.d.ts +2 -0
- package/dist/components/Graph/FullViewportBackground.js +67 -0
- package/dist/components/Graph/FullViewportBackground.js.map +1 -0
- package/dist/components/Graph/GraphControls.d.ts +6 -0
- package/dist/components/Graph/GraphControls.js +24 -0
- package/dist/components/Graph/GraphControls.js.map +1 -0
- package/dist/components/Graph/GravityGraph.d.ts +9 -0
- package/dist/components/Graph/GravityGraph.js +122 -0
- package/dist/components/Graph/GravityGraph.js.map +1 -0
- package/dist/components/Graph/GravityGraph.scss +131 -0
- package/dist/components/Graph/NonSelectableConnection.d.ts +9 -0
- package/dist/components/Graph/NonSelectableConnection.js +16 -0
- package/dist/components/Graph/NonSelectableConnection.js.map +1 -0
- package/dist/components/Graph/TooltipComponent.d.ts +8 -0
- package/dist/components/Graph/TooltipComponent.js +63 -0
- package/dist/components/Graph/TooltipComponent.js.map +1 -0
- package/dist/components/Graph/colorsConfig.d.ts +19 -0
- package/dist/components/Graph/colorsConfig.js +20 -0
- package/dist/components/Graph/colorsConfig.js.map +1 -0
- package/dist/components/Graph/i18n/en.json +5 -0
- package/dist/components/Graph/i18n/index.d.ts +2 -0
- package/dist/components/Graph/i18n/index.js +5 -0
- package/dist/components/Graph/i18n/index.js.map +1 -0
- package/dist/components/Graph/runTreeLayout.d.ts +12 -0
- package/dist/components/Graph/runTreeLayout.js +75 -0
- package/dist/components/Graph/runTreeLayout.js.map +1 -0
- package/dist/components/Graph/treeLayout.d.ts +2 -0
- package/dist/components/Graph/treeLayout.js +284 -0
- package/dist/components/Graph/treeLayout.js.map +1 -0
- package/dist/components/Graph/types.d.ts +52 -0
- package/dist/components/Graph/types.js +2 -0
- package/dist/components/Graph/types.js.map +1 -0
- package/dist/components/Graph/utils.d.ts +6 -0
- package/dist/components/Graph/utils.js +88 -0
- package/dist/components/Graph/utils.js.map +1 -0
- package/dist/components/InfoViewer/formatters/pqGroup.d.ts +5 -1
- package/dist/components/InfoViewer/formatters/pqGroup.js +24 -2
- package/dist/components/InfoViewer/formatters/pqGroup.js.map +1 -1
- package/dist/components/InfoViewer/i18n/en.json +8 -1
- package/dist/components/InfoViewer/i18n/index.d.ts +1 -1
- package/dist/components/PDiskInfo/i18n/index.d.ts +1 -1
- package/dist/components/VDiskInfo/i18n/index.d.ts +1 -1
- package/dist/containers/App/Content.js +9 -2
- package/dist/containers/App/Content.js.map +1 -1
- package/dist/containers/App/clusterRouteGuard.d.ts +5 -0
- package/dist/containers/App/clusterRouteGuard.js +13 -0
- package/dist/containers/App/clusterRouteGuard.js.map +1 -0
- package/dist/containers/Clusters/constants.d.ts +1 -1
- package/dist/containers/Nodes/i18n/index.d.ts +1 -1
- package/dist/containers/Operations/constants.d.ts +1 -1
- package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/i18n/index.d.ts +1 -1
- package/dist/containers/Tenant/Diagnostics/Overview/TransferInfo/Credentials.d.ts +1 -1
- package/dist/containers/Tenant/Diagnostics/Overview/utils/prepareTopicSchemaInfo.js +17 -3
- package/dist/containers/Tenant/Diagnostics/Overview/utils/prepareTopicSchemaInfo.js.map +1 -1
- package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/useTenantStorageNewData.d.ts +2 -2
- package/dist/containers/Tenant/Query/QueryResult/components/Graph/Graph.js +9 -4
- package/dist/containers/Tenant/Query/QueryResult/components/Graph/Graph.js.map +1 -1
- package/dist/containers/Tenant/Query/QueryResult/components/Graph/Graph.scss +2 -0
- package/dist/containers/Tenant/TenantNavigation/useTenantNavigation.d.ts +1 -1
- package/dist/graphLayout.worker.d.ts +1 -0
- package/dist/graphLayout.worker.js +17 -0
- package/dist/graphLayout.worker.js.map +1 -0
- package/dist/lib.d.ts +1 -1
- package/dist/lib.js.map +1 -1
- package/dist/store/reducers/query/parsers/preparePlanData.js.map +1 -1
- package/dist/store/reducers/query/types.d.ts +38 -1
- package/dist/store/reducers/settings/utils.d.ts +2 -2
- package/dist/types/api/schema/persQueueGroup.d.ts +16 -0
- package/dist/types/api/schema/persQueueGroup.js +7 -0
- package/dist/types/api/schema/persQueueGroup.js.map +1 -1
- package/dist/uiFactory/types.d.ts +3 -0
- package/dist/utils/disks/helpers.d.ts +2 -2
- package/dist/utils/hooks/useChangedQuerySettings.d.ts +2 -2
- package/dist/utils/hooks/useLastQueryExecutionSettings.d.ts +2 -2
- package/dist/utils/hooks/useQueryExecutionSettings.d.ts +2 -2
- package/dist/utils/prepareQueryExplain.d.ts +1 -2
- package/dist/utils/prepareQueryExplain.js +10 -2
- package/dist/utils/prepareQueryExplain.js.map +1 -1
- package/dist/utils/query.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/Graph/BlockComponents/ConnectionBlockComponent.tsx +49 -0
- package/src/components/Graph/BlockComponents/QueryBlockComponent.tsx +7 -0
- package/src/components/Graph/BlockComponents/ResultBlockComponent.tsx +10 -0
- package/src/components/Graph/BlockComponents/StageBlockComponent.tsx +35 -0
- package/src/components/Graph/FullViewportBackground.ts +122 -0
- package/src/components/Graph/GraphControls.tsx +49 -0
- package/src/components/Graph/GravityGraph.scss +131 -0
- package/src/components/Graph/GravityGraph.tsx +174 -0
- package/src/components/Graph/NonSelectableConnection.tsx +14 -0
- package/src/components/Graph/TooltipComponent.tsx +114 -0
- package/src/components/Graph/colorsConfig.ts +21 -0
- package/src/components/Graph/i18n/en.json +5 -0
- package/src/components/Graph/i18n/index.ts +7 -0
- package/src/components/Graph/runTreeLayout.ts +105 -0
- package/src/components/Graph/treeLayout.ts +378 -0
- package/src/components/Graph/types.ts +56 -0
- package/src/components/Graph/utils.ts +112 -0
- package/src/components/InfoViewer/formatters/pqGroup.ts +30 -2
- package/src/components/InfoViewer/i18n/en.json +8 -1
- package/src/containers/App/Content.tsx +9 -1
- package/src/containers/App/clusterRouteGuard.ts +24 -0
- package/src/containers/Tenant/Diagnostics/Overview/utils/prepareTopicSchemaInfo.ts +23 -2
- package/src/containers/Tenant/Query/QueryResult/components/Graph/Graph.scss +2 -0
- package/src/containers/Tenant/Query/QueryResult/components/Graph/Graph.tsx +13 -7
- package/src/graphLayout.worker.ts +21 -0
- package/src/lib.ts +1 -0
- package/src/store/reducers/query/parsers/preparePlanData.ts +1 -3
- package/src/store/reducers/query/types.ts +42 -2
- package/src/types/api/schema/persQueueGroup.ts +19 -0
- package/src/uiFactory/types.ts +4 -0
- package/src/utils/prepareQueryExplain.ts +13 -5
- package/dist/components/Graph/Graph.d.ts +0 -12
- package/dist/components/Graph/Graph.js +0 -44
- package/dist/components/Graph/Graph.js.map +0 -1
- package/dist/components/Graph/colors.d.ts +0 -10
- package/dist/components/Graph/colors.js +0 -53
- package/dist/components/Graph/colors.js.map +0 -1
- package/src/components/Graph/Graph.tsx +0 -70
- package/src/components/Graph/colors.ts +0 -75
package/README.md
CHANGED
|
@@ -147,6 +147,47 @@ E2E tests are run in CI in the `e2e_tests` job. Each shard starts `ghcr.io/ydb-p
|
|
|
147
147
|
|
|
148
148
|
## Making a production bundle.
|
|
149
149
|
|
|
150
|
+
### Web Workers for package consumers
|
|
151
|
+
|
|
152
|
+
The computation graph calculates its layout in a Web Worker. By default, the package uses the native bundler pattern:
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
new Worker(new URL('./graphLayout.worker', import.meta.url));
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Bundlers that support this pattern, including Rsbuild and Rspack, emit the worker as a separate asset automatically. The emitted worker script must be deployed with the application, served from the application origin, and allowed by the application's Content Security Policy:
|
|
159
|
+
|
|
160
|
+
```http
|
|
161
|
+
Content-Security-Policy: worker-src 'self'
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
If application chunks are loaded from a CDN, configure the bundler to keep native worker scripts on the application origin. For example, with Rspack:
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
export default {
|
|
168
|
+
output: {
|
|
169
|
+
workerPublicPath: '/build/',
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Consumers that need to resolve the worker URL at runtime can provide a worker factory before rendering `SingleClusterApp` or `MultiClusterApp`. The factory must return a new worker instance on every call:
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
import {configureUIFactory} from 'ydb-embedded-ui';
|
|
178
|
+
|
|
179
|
+
configureUIFactory({
|
|
180
|
+
createGraphLayoutWorker: () =>
|
|
181
|
+
new Worker(window.runtimeConfig.ydbGraphLayoutWorkerUrl, {
|
|
182
|
+
name: 'ydb-graph-layout',
|
|
183
|
+
}),
|
|
184
|
+
});
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Use `ydb-embedded-ui/dist/graphLayout.worker.js` as the worker entry in the consumer build. Process this entry with the consumer's bundler rather than copying it as an unbundled static file. Publish the resulting worker bundle at the URL returned by the runtime configuration.
|
|
188
|
+
|
|
189
|
+
If the browser cannot create or load the worker, the graph retries the layout on the main thread. This fallback preserves functionality, but consumers should configure worker delivery to keep expensive layout work off the UI thread.
|
|
190
|
+
|
|
150
191
|
Base command `npm run build` builds the app for production to the `build` folder.\
|
|
151
192
|
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
152
193
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: (key: "
|
|
1
|
+
declare const _default: (key: "None" | "Refresh" | "15 sec" | "1 min" | "2 min" | "5 min", params?: import("@gravity-ui/i18n").Params) => string;
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: (key: "
|
|
1
|
+
declare const _default: (key: "links" | "version" | "database" | "no-data" | "dc" | "uptime" | "rack" | "la-interval-1m" | "la-interval-5m" | "la-interval-15m" | "developer-ui" | "title.common-info" | "title.endpoints" | "title.roles" | "title.pools" | "title.load-average", params?: import("@gravity-ui/i18n").Params) => string;
|
|
2
2
|
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowsExpandHorizontal, DatabaseFill, GripHorizontal, MapPin, Shuffle, } from '@gravity-ui/icons';
|
|
3
|
+
import { Icon } from '@gravity-ui/uikit';
|
|
4
|
+
import { TooltipComponent } from '../TooltipComponent';
|
|
5
|
+
const getIcon = (name) => {
|
|
6
|
+
switch (name) {
|
|
7
|
+
case 'Merge':
|
|
8
|
+
return DatabaseFill;
|
|
9
|
+
case 'UnionAll':
|
|
10
|
+
return GripHorizontal;
|
|
11
|
+
case 'HashShuffle':
|
|
12
|
+
return Shuffle;
|
|
13
|
+
case 'Map':
|
|
14
|
+
return MapPin;
|
|
15
|
+
case 'Broadcast':
|
|
16
|
+
return ArrowsExpandHorizontal;
|
|
17
|
+
default:
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export const ConnectionBlockComponent = ({ className, block }) => {
|
|
22
|
+
var _a;
|
|
23
|
+
const icon = getIcon(block.name);
|
|
24
|
+
const content = (_jsxs("div", { className: className, children: [icon && _jsx(Icon, { data: icon }), " ", block.name] }));
|
|
25
|
+
if (!((_a = block.stats) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
26
|
+
return content;
|
|
27
|
+
}
|
|
28
|
+
return _jsx(TooltipComponent, { block: block, children: content });
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=ConnectionBlockComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectionBlockComponent.js","sourceRoot":"","sources":["../../../../src/components/Graph/BlockComponents/ConnectionBlockComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,EACH,sBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,MAAM,EACN,OAAO,GACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAGvC,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AAQrD,MAAM,OAAO,GAAG,CAAC,IAAY,EAAwB,EAAE;IACnD,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,OAAO;YACR,OAAO,YAAY,CAAC;QACxB,KAAK,UAAU;YACX,OAAO,cAAc,CAAC;QAC1B,KAAK,aAAa;YACd,OAAO,OAAO,CAAC;QACnB,KAAK,KAAK;YACN,OAAO,MAAM,CAAC;QAClB,KAAK,WAAW;YACZ,OAAO,sBAAsB,CAAC;QAClC;YACI,OAAO,SAAS,CAAC;IACzB,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,EAAC,SAAS,EAAE,KAAK,EAAQ,EAAE,EAAE;;IAClE,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,OAAO,GAAG,CACZ,eAAK,SAAS,EAAE,SAAS,aACpB,IAAI,IAAI,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,GAAI,OAAG,KAAK,CAAC,IAAI,IACxC,CACT,CAAC;IAEF,IAAI,CAAC,CAAA,MAAA,KAAK,CAAC,KAAK,0CAAE,MAAM,CAAA,EAAE,CAAC;QACvB,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,OAAO,KAAC,gBAAgB,IAAC,KAAK,EAAE,KAAK,YAAG,OAAO,GAAoB,CAAC;AACxE,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryBlockComponent.js","sourceRoot":"","sources":["../../../../src/components/Graph/BlockComponents/QueryBlockComponent.tsx"],"names":[],"mappings":";AAIA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAAC,SAAS,EAAQ,EAAE,EAAE;IACtD,OAAO,cAAK,SAAS,EAAE,SAAS,GAAI,CAAC;AACzC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResultBlockComponent.js","sourceRoot":"","sources":["../../../../src/components/Graph/BlockComponents/ResultBlockComponent.tsx"],"names":[],"mappings":";AAOA,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EAAC,SAAS,EAAE,KAAK,EAAQ,EAAE,EAAE;IAC9D,OAAO,cAAK,SAAS,EAAE,SAAS,YAAG,KAAK,CAAC,IAAI,GAAO,CAAC;AACzD,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from '@gravity-ui/uikit';
|
|
3
|
+
import { cn } from '../../../utils/cn';
|
|
4
|
+
import { TooltipComponent } from '../TooltipComponent';
|
|
5
|
+
import i18n from '../i18n';
|
|
6
|
+
const b = cn('ydb-gravity-graph');
|
|
7
|
+
export const StageBlockComponent = ({ className, block }) => {
|
|
8
|
+
var _a, _b, _c;
|
|
9
|
+
const content = (_jsxs("div", { className: className, children: [((_a = block.operators) === null || _a === void 0 ? void 0 : _a.length)
|
|
10
|
+
? block.operators.map((item) => _jsx("div", { children: item }, item))
|
|
11
|
+
: block.name, (_b = block.tables) === null || _b === void 0 ? void 0 : _b.map((table, index) => (_jsxs("div", { className: b('stage-table-row'), title: table, children: [index === 0 ? _jsxs(Text, { color: "secondary", children: [i18n('label_tables'), ": "] }) : null, table] }, `${table}-${index}`)))] }));
|
|
12
|
+
if (!((_c = block.stats) === null || _c === void 0 ? void 0 : _c.length)) {
|
|
13
|
+
return content;
|
|
14
|
+
}
|
|
15
|
+
return _jsx(TooltipComponent, { block: block, children: content });
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=StageBlockComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StageBlockComponent.js","sourceRoot":"","sources":["../../../../src/components/Graph/BlockComponents/StageBlockComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAC,EAAE,EAAC,MAAM,mBAAmB,CAAC;AACrC,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AACrD,OAAO,IAAI,MAAM,SAAS,CAAC;AAG3B,MAAM,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC,CAAC;AAOlC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAAC,SAAS,EAAE,KAAK,EAAQ,EAAE,EAAE;;IAC7D,MAAM,OAAO,GAAG,CACZ,eAAK,SAAS,EAAE,SAAS,aACpB,CAAA,MAAA,KAAK,CAAC,SAAS,0CAAE,MAAM;gBACpB,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,wBAAiB,IAAI,IAAX,IAAI,CAAc,CAAC;gBAC7D,CAAC,CAAC,KAAK,CAAC,IAAI,EACf,MAAA,KAAK,CAAC,MAAM,0CAAE,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CACjC,eAA+B,SAAS,EAAE,CAAC,CAAC,iBAAiB,CAAC,EAAE,KAAK,EAAE,KAAK,aACvE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAC,IAAI,IAAC,KAAK,EAAC,WAAW,aAAE,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,EAC5E,KAAK,KAFA,GAAG,KAAK,IAAI,KAAK,EAAE,CAGvB,CACT,CAAC,IACA,CACT,CAAC;IAEF,IAAI,CAAC,CAAA,MAAA,KAAK,CAAC,KAAK,0CAAE,MAAM,CAAA,EAAE,CAAC;QACvB,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,OAAO,KAAC,gBAAgB,IAAC,KAAK,EAAE,KAAK,YAAG,OAAO,GAAoB,CAAC;AACxE,CAAC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Component } from '@gravity-ui/graph';
|
|
2
|
+
const VIEWPORT_PADDING = 10;
|
|
3
|
+
const DOT_SIZE = 2;
|
|
4
|
+
const LARGE_DOT_MULTIPLIER = 3;
|
|
5
|
+
const PATTERN_GRID_SIZE = 5;
|
|
6
|
+
class FullViewportBackgroundComponent extends Component {
|
|
7
|
+
render() {
|
|
8
|
+
const { camera, colors, constants, ctx } = this.context;
|
|
9
|
+
const cameraState = camera.getCameraState();
|
|
10
|
+
const x = -cameraState.relativeX - VIEWPORT_PADDING;
|
|
11
|
+
const y = -cameraState.relativeY - VIEWPORT_PADDING;
|
|
12
|
+
const width = cameraState.relativeWidth + VIEWPORT_PADDING * 2;
|
|
13
|
+
const height = cameraState.relativeHeight + VIEWPORT_PADDING * 2;
|
|
14
|
+
ctx.fillStyle = colors.canvas.layerBackground;
|
|
15
|
+
ctx.fillRect(x, y, width, height);
|
|
16
|
+
if (cameraState.scale < constants.block.SCALES[0]) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
this.preparePatterns(colors.canvas.dots, constants.system.GRID_SIZE);
|
|
20
|
+
if (!this.patterns) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
ctx.fillStyle =
|
|
24
|
+
cameraState.scale > constants.block.SCALES[2]
|
|
25
|
+
? this.patterns.normal
|
|
26
|
+
: this.patterns.simple;
|
|
27
|
+
ctx.fillRect(x, y, width, height);
|
|
28
|
+
}
|
|
29
|
+
preparePatterns(color, gridSize) {
|
|
30
|
+
if (this.patterns && this.patternsColor === color && this.patternsGridSize === gridSize) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const normal = this.createPattern(color, gridSize, false);
|
|
34
|
+
const simple = this.createPattern(color, gridSize, true);
|
|
35
|
+
if (normal && simple) {
|
|
36
|
+
this.patterns = { normal, simple };
|
|
37
|
+
this.patternsColor = color;
|
|
38
|
+
this.patternsGridSize = gridSize;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
createPattern(color, gridSize, simple) {
|
|
42
|
+
const { ctx } = this.context;
|
|
43
|
+
const patternCanvas = document.createElement('canvas');
|
|
44
|
+
const patternSize = PATTERN_GRID_SIZE * gridSize;
|
|
45
|
+
patternCanvas.width = patternSize;
|
|
46
|
+
patternCanvas.height = patternSize;
|
|
47
|
+
const patternContext = patternCanvas.getContext('2d');
|
|
48
|
+
if (!patternContext) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
patternContext.fillStyle = color;
|
|
52
|
+
for (let row = -1; row <= PATTERN_GRID_SIZE; row += 1) {
|
|
53
|
+
for (let column = -1; column <= PATTERN_GRID_SIZE; column += 1) {
|
|
54
|
+
if (row % PATTERN_GRID_SIZE === 0 && column % PATTERN_GRID_SIZE === 0) {
|
|
55
|
+
const largeDotSize = DOT_SIZE * LARGE_DOT_MULTIPLIER;
|
|
56
|
+
patternContext.fillRect(row * gridSize - largeDotSize / 2, column * gridSize - largeDotSize / 2, largeDotSize, largeDotSize);
|
|
57
|
+
}
|
|
58
|
+
else if (!simple) {
|
|
59
|
+
patternContext.fillRect(row * gridSize - DOT_SIZE / 2, column * gridSize - DOT_SIZE / 2, DOT_SIZE, DOT_SIZE);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return ctx.createPattern(patternCanvas, 'repeat');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export const FullViewportBackground = FullViewportBackgroundComponent;
|
|
67
|
+
//# sourceMappingURL=FullViewportBackground.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FullViewportBackground.js","sourceRoot":"","sources":["../../../src/components/Graph/FullViewportBackground.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AA6B5C,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,QAAQ,GAAG,CAAC,CAAC;AACnB,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B,MAAM,+BAAgC,SAAQ,SAAS;IAKzC,MAAM;QACZ,MAAM,EAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAC,GAAG,IAAI,CAAC,OAAwC,CAAC;QACvF,MAAM,WAAW,GAAG,MAAM,CAAC,cAAc,EAAE,CAAC;QAC5C,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,SAAS,GAAG,gBAAgB,CAAC;QACpD,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,SAAS,GAAG,gBAAgB,CAAC;QACpD,MAAM,KAAK,GAAG,WAAW,CAAC,aAAa,GAAG,gBAAgB,GAAG,CAAC,CAAC;QAC/D,MAAM,MAAM,GAAG,WAAW,CAAC,cAAc,GAAG,gBAAgB,GAAG,CAAC,CAAC;QAEjE,GAAG,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC;QAC9C,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAA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;YACL,CAAC;QACL,CAAC;QAED,OAAO,GAAG,CAAC,aAAa,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,sBAAsB,GAC/B,+BAA8D,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Button, Icon } from '@gravity-ui/uikit';
|
|
4
|
+
import { cn } from '../../utils/cn';
|
|
5
|
+
import i18n from './i18n';
|
|
6
|
+
import MagnifierMinusIcon from '@gravity-ui/icons/svgs/magnifier-minus.svg';
|
|
7
|
+
import MagnifierPlusIcon from '@gravity-ui/icons/svgs/magnifier-plus.svg';
|
|
8
|
+
const b = cn('ydb-gravity-graph');
|
|
9
|
+
const ZOOM_STEP = 1.25;
|
|
10
|
+
export const GraphControls = ({ graph }) => {
|
|
11
|
+
const onZoomInClick = React.useCallback(() => {
|
|
12
|
+
const cameraScale = graph.cameraService.getCameraScale();
|
|
13
|
+
graph.zoom({ scale: cameraScale * ZOOM_STEP });
|
|
14
|
+
}, [graph]);
|
|
15
|
+
const onZoomOutClick = React.useCallback(() => {
|
|
16
|
+
const cameraScale = graph.cameraService.getCameraScale();
|
|
17
|
+
graph.zoom({ scale: cameraScale / ZOOM_STEP });
|
|
18
|
+
}, [graph]);
|
|
19
|
+
const onResetZoomClick = React.useCallback(() => {
|
|
20
|
+
graph.zoom({ scale: 1 });
|
|
21
|
+
}, [graph]);
|
|
22
|
+
return (_jsxs("div", { className: b('zoom-controls'), children: [_jsx(Button, { view: "raised", onClick: onZoomInClick, "aria-label": i18n('action_zoom-in'), children: _jsx(Icon, { data: MagnifierPlusIcon, size: 16 }) }), _jsx(Button, { view: "raised", onClick: onZoomOutClick, "aria-label": i18n('action_zoom-out'), children: _jsx(Icon, { data: MagnifierMinusIcon, size: 16 }) }), _jsx(Button, { view: "raised", onClick: onResetZoomClick, children: "1:1" })] }));
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=GraphControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphControls.js","sourceRoot":"","sources":["../../../src/components/Graph/GraphControls.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAC,MAAM,EAAE,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAC,EAAE,EAAC,MAAM,gBAAgB,CAAC;AAElC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAE1B,OAAO,kBAAkB,MAAM,4CAA4C,CAAC;AAC5E,OAAO,iBAAiB,MAAM,2CAA2C,CAAC;AAE1E,MAAM,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC,CAAC;AAElC,MAAM,SAAS,GAAG,IAAI,CAAC;AAMvB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAC,KAAK,EAAQ,EAAE,EAAE;IAC5C,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACzC,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;QACzD,KAAK,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,WAAW,GAAG,SAAS,EAAC,CAAC,CAAC;IACjD,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAC1C,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;QACzD,KAAK,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,WAAW,GAAG,SAAS,EAAC,CAAC,CAAC;IACjD,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,MAAM,gBAAgB,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAC5C,KAAK,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,CAAC,EAAC,CAAC,CAAC;IAC3B,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CACH,eAAK,SAAS,EAAE,CAAC,CAAC,eAAe,CAAC,aAC9B,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,aAAa,gBAAc,IAAI,CAAC,gBAAgB,CAAC,YAC5E,KAAC,IAAI,IAAC,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,EAAE,GAAI,GACtC,EACT,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,cAAc,gBAAc,IAAI,CAAC,iBAAiB,CAAC,YAC9E,KAAC,IAAI,IAAC,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,GAAI,GACvC,EACT,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,gBAAgB,oBAEtC,IACP,CACT,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Data } from './types';
|
|
2
|
+
import './GravityGraph.scss';
|
|
3
|
+
interface Props<T> {
|
|
4
|
+
data: Data<T>;
|
|
5
|
+
onError: (error: Error) => void;
|
|
6
|
+
theme?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function GravityGraph<T>({ data, onError, theme }: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { GraphState } from '@gravity-ui/graph';
|
|
4
|
+
import { GraphBlock, GraphCanvas, useGraph, useGraphEvent } from '@gravity-ui/graph/react';
|
|
5
|
+
import { uiFactory } from '../../uiFactory/uiFactory';
|
|
6
|
+
import { cn } from '../../utils/cn';
|
|
7
|
+
const b = cn('ydb-gravity-graph');
|
|
8
|
+
const GRAPH_FIT_PADDING = 40;
|
|
9
|
+
import { ConnectionBlockComponent } from './BlockComponents/ConnectionBlockComponent';
|
|
10
|
+
import { QueryBlockComponent } from './BlockComponents/QueryBlockComponent';
|
|
11
|
+
import { ResultBlockComponent } from './BlockComponents/ResultBlockComponent';
|
|
12
|
+
import { StageBlockComponent } from './BlockComponents/StageBlockComponent';
|
|
13
|
+
import { FullViewportBackground } from './FullViewportBackground';
|
|
14
|
+
import { GraphControls } from './GraphControls';
|
|
15
|
+
import { NonSelectableConnection } from './NonSelectableConnection';
|
|
16
|
+
import { graphColorsConfig } from './colorsConfig';
|
|
17
|
+
import { runTreeLayout } from './runTreeLayout';
|
|
18
|
+
import { parseCustomPropertyValue } from './utils';
|
|
19
|
+
import './GravityGraph.scss';
|
|
20
|
+
const config = {
|
|
21
|
+
settings: {
|
|
22
|
+
background: FullViewportBackground,
|
|
23
|
+
connection: NonSelectableConnection,
|
|
24
|
+
showConnectionArrows: false,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
const createGraphLayoutWorker = () => {
|
|
28
|
+
if (uiFactory.createGraphLayoutWorker) {
|
|
29
|
+
return uiFactory.createGraphLayoutWorker();
|
|
30
|
+
}
|
|
31
|
+
return new Worker(new URL('../../graphLayout.worker', import.meta.url));
|
|
32
|
+
};
|
|
33
|
+
const renderBlockFn = (graph, block) => {
|
|
34
|
+
const map = {
|
|
35
|
+
query: QueryBlockComponent,
|
|
36
|
+
result: ResultBlockComponent,
|
|
37
|
+
stage: StageBlockComponent,
|
|
38
|
+
connection: ConnectionBlockComponent,
|
|
39
|
+
};
|
|
40
|
+
const Component = map[block.is];
|
|
41
|
+
return (_jsx(GraphBlock, { graph: graph, block: block, className: b('block'), children: Component ? (_jsxs(React.Fragment, { children: [_jsx(Component, { graph: graph, block: block, className: b('block-content', block.is) }), block.planNodeId !== undefined && block.is !== 'result' && (_jsxs("div", { className: b('block-id'), children: ["#", block.planNodeId] }))] })) : (block.id) }));
|
|
42
|
+
};
|
|
43
|
+
export function GravityGraph({ data, onError, theme }) {
|
|
44
|
+
const { graph, start } = useGraph(config);
|
|
45
|
+
const cameraSizeRef = React.useRef({ width: 0, height: 0 });
|
|
46
|
+
const graphBlockIdsRef = React.useRef([]);
|
|
47
|
+
const fitFrameRef = React.useRef();
|
|
48
|
+
const fitGraphToViewport = React.useCallback(() => {
|
|
49
|
+
const { width, height } = graph.cameraService.getCameraState();
|
|
50
|
+
if (graph.state !== GraphState.READY ||
|
|
51
|
+
width <= 0 ||
|
|
52
|
+
height <= 0 ||
|
|
53
|
+
graphBlockIdsRef.current.length === 0) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
graph.zoomTo(graphBlockIdsRef.current, { padding: GRAPH_FIT_PADDING });
|
|
57
|
+
}, [graph]);
|
|
58
|
+
const scheduleGraphFit = React.useCallback(() => {
|
|
59
|
+
if (fitFrameRef.current !== undefined) {
|
|
60
|
+
globalThis.cancelAnimationFrame(fitFrameRef.current);
|
|
61
|
+
}
|
|
62
|
+
// camera-change is emitted before its new size is committed.
|
|
63
|
+
fitFrameRef.current = globalThis.requestAnimationFrame(() => {
|
|
64
|
+
fitFrameRef.current = undefined;
|
|
65
|
+
fitGraphToViewport();
|
|
66
|
+
});
|
|
67
|
+
}, [fitGraphToViewport]);
|
|
68
|
+
React.useEffect(() => {
|
|
69
|
+
return () => {
|
|
70
|
+
if (fitFrameRef.current !== undefined) {
|
|
71
|
+
globalThis.cancelAnimationFrame(fitFrameRef.current);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}, []);
|
|
75
|
+
React.useEffect(() => {
|
|
76
|
+
return runTreeLayout({
|
|
77
|
+
request: {
|
|
78
|
+
nodes: data.nodes,
|
|
79
|
+
links: data.links,
|
|
80
|
+
},
|
|
81
|
+
createWorker: createGraphLayoutWorker,
|
|
82
|
+
onResult: ({ layout, edges }) => {
|
|
83
|
+
graphBlockIdsRef.current = layout.map(({ id }) => id);
|
|
84
|
+
graph.setEntities({
|
|
85
|
+
blocks: layout,
|
|
86
|
+
connections: edges,
|
|
87
|
+
});
|
|
88
|
+
scheduleGraphFit();
|
|
89
|
+
},
|
|
90
|
+
onError,
|
|
91
|
+
});
|
|
92
|
+
}, [data.nodes, data.links, graph, onError, scheduleGraphFit]);
|
|
93
|
+
React.useEffect(() => {
|
|
94
|
+
graph.setColors(parseCustomPropertyValue(graphColorsConfig));
|
|
95
|
+
}, [graph, theme]);
|
|
96
|
+
useGraphEvent(graph, 'state-change', ({ state }) => {
|
|
97
|
+
if (state === GraphState.ATTACHED) {
|
|
98
|
+
graph.cameraService.set({
|
|
99
|
+
scale: 1,
|
|
100
|
+
scaleMax: 1.5,
|
|
101
|
+
});
|
|
102
|
+
graph.setConstants({
|
|
103
|
+
block: {
|
|
104
|
+
SCALES: [0.125, 0.225, 0.5], // Detailed view stays until zoom = 0.5
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
start();
|
|
108
|
+
}
|
|
109
|
+
else if (state === GraphState.READY) {
|
|
110
|
+
scheduleGraphFit();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
useGraphEvent(graph, 'camera-change', ({ width, height }) => {
|
|
114
|
+
const previousSize = cameraSizeRef.current;
|
|
115
|
+
cameraSizeRef.current = { width, height };
|
|
116
|
+
if (previousSize.width !== width || previousSize.height !== height) {
|
|
117
|
+
scheduleGraphFit();
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
return (_jsxs(React.Fragment, { children: [_jsx(GraphCanvas, { graph: graph, renderBlock: renderBlockFn }), _jsx(GraphControls, { graph: graph })] }));
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=GravityGraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GravityGraph.js","sourceRoot":"","sources":["../../../src/components/Graph/GravityGraph.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,UAAU,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;QACZ,CAAC;aAAM,IAAI,KAAK,KAAK,UAAU,CAAC,KAAK,EAAE,CAAC;YACpC,gBAAgB,EAAE,CAAC;QACvB,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,aAAa,CAAC,KAAK,EAAE,eAAe,EAAE,CAAC,EAAC,KAAK,EAAE,MAAM,EAAC,EAAE,EAAE;QACtD,MAAM,YAAY,GAAG,aAAa,CAAC,OAAO,CAAC;QAC3C,aAAa,CAAC,OAAO,GAAG,EAAC,KAAK,EAAE,MAAM,EAAC,CAAC;QAExC,IAAI,YAAY,CAAC,KAAK,KAAK,KAAK,IAAI,YAAY,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YACjE,gBAAgB,EAAE,CAAC;QACvB,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,CACH,MAAC,KAAK,CAAC,QAAQ,eACX,KAAC,WAAW,IAAC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,GAAI,EACzD,KAAC,aAAa,IAAC,KAAK,EAAE,KAAK,GAAI,IAClB,CACpB,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
.ydb-gravity-graph {
|
|
2
|
+
&__block {
|
|
3
|
+
cursor: auto;
|
|
4
|
+
|
|
5
|
+
border: none;
|
|
6
|
+
background: none;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
&__block-content {
|
|
10
|
+
width: 100%;
|
|
11
|
+
padding: 8px 12px;
|
|
12
|
+
|
|
13
|
+
font-family: var(--g-font-family);
|
|
14
|
+
font-size: var(--g-text-body-short-font-size);
|
|
15
|
+
line-height: var(--g-text-body-short-line-height);
|
|
16
|
+
|
|
17
|
+
border: 1px solid var(--g-color-line-generic);
|
|
18
|
+
background: var(--g-color-base-float);
|
|
19
|
+
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.3);
|
|
20
|
+
|
|
21
|
+
&[aria-haspopup='dialog'] {
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&__block-id {
|
|
27
|
+
position: absolute;
|
|
28
|
+
top: 4px;
|
|
29
|
+
right: 4px;
|
|
30
|
+
|
|
31
|
+
font-size: 10px;
|
|
32
|
+
line-height: 1;
|
|
33
|
+
|
|
34
|
+
color: var(--g-color-text-secondary);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&__block-content.query {
|
|
38
|
+
height: 100%;
|
|
39
|
+
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&__block-content.result {
|
|
44
|
+
display: flex;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
align-items: center;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&__block-content.stage {
|
|
50
|
+
border-radius: 6px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&__stage-table-row {
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
|
|
56
|
+
white-space: nowrap;
|
|
57
|
+
text-overflow: ellipsis;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&__block-content.connection {
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
gap: 4px;
|
|
64
|
+
|
|
65
|
+
color: var(--g-color-text-info-heavy);
|
|
66
|
+
border: 1px solid var(--g-color-line-info);
|
|
67
|
+
border-radius: 6px;
|
|
68
|
+
background: var(--g-color-base-info-light);
|
|
69
|
+
box-shadow: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&__tooltip-content {
|
|
73
|
+
overflow: auto;
|
|
74
|
+
|
|
75
|
+
width: 300px;
|
|
76
|
+
max-height: 90vh;
|
|
77
|
+
padding: 0 8px 8px;
|
|
78
|
+
|
|
79
|
+
font-family: var(--g-font-family);
|
|
80
|
+
font-size: var(--g-text-body-short-font-size);
|
|
81
|
+
line-height: var(--g-text-body-short-line-height);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&__tooltip-tabs {
|
|
85
|
+
margin-bottom: 8px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&__tooltip-stat-row {
|
|
89
|
+
display: grid;
|
|
90
|
+
grid-template-columns: 100px auto;
|
|
91
|
+
gap: 8px;
|
|
92
|
+
|
|
93
|
+
margin: 4px 0 0;
|
|
94
|
+
|
|
95
|
+
span {
|
|
96
|
+
overflow: hidden;
|
|
97
|
+
|
|
98
|
+
text-overflow: ellipsis;
|
|
99
|
+
}
|
|
100
|
+
span:nth-child(1) {
|
|
101
|
+
color: var(--g-color-text-secondary);
|
|
102
|
+
}
|
|
103
|
+
span:nth-child(2) {
|
|
104
|
+
word-wrap: break-word;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&__tooltip-stat-group {
|
|
109
|
+
margin-top: 8px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&__tooltip-stat-group + &__tooltip-stat-group {
|
|
113
|
+
padding-top: 8px;
|
|
114
|
+
|
|
115
|
+
border-top: 1px dotted var(--g-color-line-generic);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&__tooltip-stat-group-name {
|
|
119
|
+
font-weight: bold;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&__zoom-controls {
|
|
123
|
+
position: absolute;
|
|
124
|
+
z-index: 999;
|
|
125
|
+
top: 8px;
|
|
126
|
+
right: 50px;
|
|
127
|
+
|
|
128
|
+
display: flex;
|
|
129
|
+
gap: 2px;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MultipointConnection } from '@gravity-ui/graph/react';
|
|
2
|
+
/**
|
|
3
|
+
* Кастомный класс соединения, который отключает визуальное выделение
|
|
4
|
+
* Наследуется от MultipointConnection и переопределяет поведение
|
|
5
|
+
*/
|
|
6
|
+
export declare class NonSelectableConnection extends MultipointConnection {
|
|
7
|
+
cursor: 'pointer';
|
|
8
|
+
protected handleEvent(event: Event): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MultipointConnection } from '@gravity-ui/graph/react';
|
|
2
|
+
/**
|
|
3
|
+
* Кастомный класс соединения, который отключает визуальное выделение
|
|
4
|
+
* Наследуется от MultipointConnection и переопределяет поведение
|
|
5
|
+
*/
|
|
6
|
+
export class NonSelectableConnection extends MultipointConnection {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.cursor = 'pointer';
|
|
10
|
+
}
|
|
11
|
+
// Переопределяем метод для предотвращения выделения при клике
|
|
12
|
+
handleEvent(event) {
|
|
13
|
+
event.stopPropagation();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=NonSelectableConnection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NonSelectableConnection.js","sourceRoot":"","sources":["../../../src/components/Graph/NonSelectableConnection.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAC;AAE7D;;;GAGG;AACH,MAAM,OAAO,uBAAwB,SAAQ,oBAAoB;IAAjE;;QACa,WAAM,GAAc,SAAS,CAAC;IAM3C,CAAC;IAJG,8DAA8D;IAC3C,WAAW,CAAC,KAAY;QACvC,KAAK,CAAC,eAAe,EAAE,CAAC;IAC5B,CAAC;CACJ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtendedTBlock } from './types';
|
|
3
|
+
type Props = {
|
|
4
|
+
block: ExtendedTBlock;
|
|
5
|
+
children: React.ReactElement<React.HTMLAttributes<HTMLElement>>;
|
|
6
|
+
};
|
|
7
|
+
export declare const TooltipComponent: ({ block, children }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|