@riil-frontend/component-topology 11.0.35 → 12.0.0-dev.1
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/build/1.js +2 -2
- package/build/2.js +1 -1
- package/build/index.js +45 -29
- package/es/components/BatchAttrMetric/setting.js +1 -1
- package/es/components/MultiResourceDrawer/index.js +8 -6
- package/es/components/ResourceList/ResourceSelect.js +8 -7
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +8 -6
- package/es/components/SingleResourceDrawer/SelectDrawer.js +8 -6
- package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +8 -6
- package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +24 -14
- package/es/core/editor/components/BackgroundView/index.js +73 -54
- package/es/core/editor/components/CustomIconPlugin/RenameDialog.js +8 -6
- package/es/core/editor/components/CustomIconPlugin/utils/svgToShape.js +7 -5
- package/es/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +8 -6
- package/es/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +15 -8
- package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +16 -10
- package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +16 -10
- package/es/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +8 -6
- package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +8 -6
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +8 -6
- package/es/core/editor/components/settings/propertyViews/view/BackgroundSize.js +8 -6
- package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +28 -16
- package/es/core/editor/hooks/useKeyboardShortcut.js +36 -32
- package/es/core/editor/utils/copyElementUtil.js +171 -0
- package/es/core/hooks/usePolling.js +21 -13
- package/es/core/hooks/useResourceConfig.js +37 -21
- package/es/core/hooks/useTopoEdit.js +202 -139
- package/es/core/models/Alarm.js +104 -38
- package/es/core/models/AttributeMetricDisplay.js +36 -14
- package/es/core/models/TopoApp.js +197 -75
- package/es/core/models/TopoGraphView.js +20 -10
- package/es/core/models/cache/CiCache.js +12 -6
- package/es/core/models/cache/CiTypeCache.js +20 -10
- package/es/core/models/cache/DictCache.js +10 -6
- package/es/core/models/graph/Background.js +9 -6
- package/es/core/models/plugins/resourceWebControllUrl.js +21 -8
- package/es/core/models/tagstips/ElementTagTipConfig.js +20 -10
- package/es/core/models/topoData.js +7 -5
- package/es/core/models/utils/linkUtils.js +8 -5
- package/es/core/services/cmdb/metric.js +7 -5
- package/es/core/services/cmdb.js +9 -5
- package/es/core/services/index.js +23 -9
- package/es/core/services/topo/tagtip.js +7 -5
- package/es/core/store/models/customIcon.js +11 -6
- package/es/core/utils/imageUtil.js +7 -5
- package/es/core/utils/metricUtil.js +5 -0
- package/es/core/utils/saveSerialize.js +7 -5
- package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +8 -6
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +8 -5
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +57 -25
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +47 -34
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +9 -5
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +74 -34
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +9 -6
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +9 -6
- package/es/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +31 -26
- package/es/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +15 -7
- package/es/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +7 -4
- package/es/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +8 -6
- package/es/networkTopo/components/Link/hook.js +21 -14
- package/es/networkTopo/components/Link/index.js +32 -18
- package/es/networkTopo/components/Link/setting.js +8 -6
- package/es/networkTopo/getTopoData.js +23 -10
- package/es/networkTopo/hooks/viewer/useRelateTopo.js +7 -4
- package/es/networkTopo/models/TopoCenter.js +24 -10
- package/es/networkTopo/services/cmdb.js +333 -233
- package/es/networkTopo/services/mdc.js +24 -15
- package/es/networkTopo/services/metric.js +16 -11
- package/es/networkTopo/services/model.js +412 -283
- package/es/networkTopo/utils/exportData.js +7 -5
- package/lib/components/BatchAttrMetric/setting.js +1 -1
- package/lib/components/MultiResourceDrawer/index.js +8 -6
- package/lib/components/ResourceList/ResourceSelect.js +8 -6
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +8 -6
- package/lib/components/SingleResourceDrawer/SelectDrawer.js +8 -6
- package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +8 -6
- package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +24 -14
- package/lib/core/editor/components/BackgroundView/index.js +74 -55
- package/lib/core/editor/components/CustomIconPlugin/RenameDialog.js +8 -6
- package/lib/core/editor/components/CustomIconPlugin/utils/svgToShape.js +7 -4
- package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +8 -6
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +15 -8
- package/lib/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +16 -10
- package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +16 -10
- package/lib/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +8 -6
- package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +8 -6
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +8 -6
- package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +8 -6
- package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +28 -16
- package/lib/core/editor/hooks/useKeyboardShortcut.js +37 -34
- package/lib/core/editor/utils/copyElementUtil.js +182 -0
- package/lib/core/hooks/usePolling.js +21 -13
- package/lib/core/hooks/useResourceConfig.js +37 -21
- package/lib/core/hooks/useTopoEdit.js +202 -139
- package/lib/core/models/Alarm.js +104 -38
- package/lib/core/models/AttributeMetricDisplay.js +36 -14
- package/lib/core/models/TopoApp.js +197 -75
- package/lib/core/models/TopoGraphView.js +20 -10
- package/lib/core/models/cache/CiCache.js +12 -6
- package/lib/core/models/cache/CiTypeCache.js +20 -10
- package/lib/core/models/cache/DictCache.js +10 -6
- package/lib/core/models/graph/Background.js +9 -6
- package/lib/core/models/plugins/resourceWebControllUrl.js +21 -8
- package/lib/core/models/tagstips/ElementTagTipConfig.js +20 -10
- package/lib/core/models/topoData.js +7 -4
- package/lib/core/models/utils/linkUtils.js +8 -4
- package/lib/core/services/cmdb/metric.js +7 -4
- package/lib/core/services/cmdb.js +9 -4
- package/lib/core/services/index.js +21 -8
- package/lib/core/services/topo/tagtip.js +7 -4
- package/lib/core/store/models/customIcon.js +11 -6
- package/lib/core/utils/imageUtil.js +7 -4
- package/lib/core/utils/metricUtil.js +5 -0
- package/lib/core/utils/saveSerialize.js +7 -4
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +8 -6
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +9 -6
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +57 -25
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +49 -36
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +9 -5
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +73 -35
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +9 -6
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +9 -6
- package/lib/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +31 -25
- package/lib/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +14 -6
- package/lib/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +7 -4
- package/lib/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +8 -6
- package/lib/networkTopo/components/Link/hook.js +23 -15
- package/lib/networkTopo/components/Link/index.js +32 -18
- package/lib/networkTopo/components/Link/setting.js +8 -6
- package/lib/networkTopo/getTopoData.js +23 -10
- package/lib/networkTopo/hooks/viewer/useRelateTopo.js +7 -4
- package/lib/networkTopo/models/TopoCenter.js +24 -10
- package/lib/networkTopo/services/cmdb.js +336 -235
- package/lib/networkTopo/services/mdc.js +24 -14
- package/lib/networkTopo/services/metric.js +16 -10
- package/lib/networkTopo/services/model.js +414 -284
- package/lib/networkTopo/utils/exportData.js +7 -4
- package/lib/utils/htElementDataUtil.js +4 -2
- package/package.json +3 -2
package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js
CHANGED
@@ -7,8 +7,6 @@ import ColorPanel from "../../../../../../components/ColorPanel";
|
|
7
7
|
import FontColorRange from "../../../../../../components/ColorPanel/components/FontColorRange";
|
8
8
|
|
9
9
|
function BoxBackgroundSetting(props) {
|
10
|
-
var _ref, _ref2;
|
11
|
-
|
12
10
|
var topo = props.topo,
|
13
11
|
fieldProps = props.fieldProps,
|
14
12
|
setStyle = props.setStyle,
|
@@ -36,8 +34,8 @@ function BoxBackgroundSetting(props) {
|
|
36
34
|
topo.historyManager.endTransaction();
|
37
35
|
};
|
38
36
|
|
39
|
-
var backgroundChang = function
|
40
|
-
|
37
|
+
var backgroundChang = /*#__PURE__*/function () {
|
38
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value, type) {
|
41
39
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
42
40
|
while (1) switch (_context.prev = _context.next) {
|
43
41
|
case 0:
|
@@ -67,8 +65,12 @@ function BoxBackgroundSetting(props) {
|
|
67
65
|
return _context.stop();
|
68
66
|
}
|
69
67
|
}, _callee);
|
70
|
-
}))
|
71
|
-
|
68
|
+
}));
|
69
|
+
|
70
|
+
return function backgroundChang(_x, _x2) {
|
71
|
+
return _ref.apply(this, arguments);
|
72
|
+
};
|
73
|
+
}();
|
72
74
|
|
73
75
|
var borderOpacityChange = function borderOpacityChange(value) {
|
74
76
|
topo.historyManager.beginTransaction();
|
@@ -86,8 +88,8 @@ function BoxBackgroundSetting(props) {
|
|
86
88
|
topo.historyManager.endTransaction();
|
87
89
|
};
|
88
90
|
|
89
|
-
var borderColorChang = function
|
90
|
-
|
91
|
+
var borderColorChang = /*#__PURE__*/function () {
|
92
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(value, type) {
|
91
93
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
92
94
|
while (1) switch (_context2.prev = _context2.next) {
|
93
95
|
case 0:
|
@@ -117,8 +119,12 @@ function BoxBackgroundSetting(props) {
|
|
117
119
|
return _context2.stop();
|
118
120
|
}
|
119
121
|
}, _callee2);
|
120
|
-
}))
|
121
|
-
|
122
|
+
}));
|
123
|
+
|
124
|
+
return function borderColorChang(_x3, _x4) {
|
125
|
+
return _ref2.apply(this, arguments);
|
126
|
+
};
|
127
|
+
}();
|
122
128
|
|
123
129
|
var leftInputChange = function leftInputChange(val) {
|
124
130
|
setLeftInputVal(val);
|
@@ -11,8 +11,6 @@ import styles from "./FontColorButton.module.scss";
|
|
11
11
|
import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter.js";
|
12
12
|
|
13
13
|
function FontColorDropdown(props) {
|
14
|
-
var _ref, _ref2;
|
15
|
-
|
16
14
|
var color = props.color,
|
17
15
|
onChange = props.onChange,
|
18
16
|
topo = props.topo,
|
@@ -37,8 +35,8 @@ function FontColorDropdown(props) {
|
|
37
35
|
topo.historyManager.endTransaction();
|
38
36
|
};
|
39
37
|
|
40
|
-
var colorChang = function
|
41
|
-
|
38
|
+
var colorChang = /*#__PURE__*/function () {
|
39
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value, type) {
|
42
40
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
43
41
|
while (1) switch (_context.prev = _context.next) {
|
44
42
|
case 0:
|
@@ -68,11 +66,15 @@ function FontColorDropdown(props) {
|
|
68
66
|
return _context.stop();
|
69
67
|
}
|
70
68
|
}, _callee);
|
71
|
-
}))
|
72
|
-
|
69
|
+
}));
|
70
|
+
|
71
|
+
return function colorChang(_x, _x2) {
|
72
|
+
return _ref.apply(this, arguments);
|
73
|
+
};
|
74
|
+
}();
|
73
75
|
|
74
|
-
var backgroundChang = function
|
75
|
-
|
76
|
+
var backgroundChang = /*#__PURE__*/function () {
|
77
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(value, type) {
|
76
78
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
77
79
|
while (1) switch (_context2.prev = _context2.next) {
|
78
80
|
case 0:
|
@@ -102,8 +104,12 @@ function FontColorDropdown(props) {
|
|
102
104
|
return _context2.stop();
|
103
105
|
}
|
104
106
|
}, _callee2);
|
105
|
-
}))
|
106
|
-
|
107
|
+
}));
|
108
|
+
|
109
|
+
return function backgroundChang(_x3, _x4) {
|
110
|
+
return _ref2.apply(this, arguments);
|
111
|
+
};
|
112
|
+
}();
|
107
113
|
|
108
114
|
var onFocus = function onFocus() {// topo.historyManager.beginTransaction();
|
109
115
|
};
|
@@ -4,16 +4,14 @@ import React, { useState, useEffect } from 'react';
|
|
4
4
|
import ResourceSelectDrawer from "../../../../../../../components/NetworkTopoResourceSelectDrawer";
|
5
5
|
|
6
6
|
var LayerAddResourceDrawer = function LayerAddResourceDrawer(props) {
|
7
|
-
var _ref;
|
8
|
-
|
9
7
|
var visible = props.visible,
|
10
8
|
layer = props.layer,
|
11
9
|
topo = props.topo,
|
12
10
|
topoEdit = props.topoEdit,
|
13
11
|
onClose = props.onClose;
|
14
12
|
|
15
|
-
var onOk = function
|
16
|
-
|
13
|
+
var onOk = /*#__PURE__*/function () {
|
14
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(selected) {
|
17
15
|
var layerData;
|
18
16
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
19
17
|
while (1) switch (_context.prev = _context.next) {
|
@@ -30,8 +28,12 @@ var LayerAddResourceDrawer = function LayerAddResourceDrawer(props) {
|
|
30
28
|
return _context.stop();
|
31
29
|
}
|
32
30
|
}, _callee);
|
33
|
-
}))
|
34
|
-
|
31
|
+
}));
|
32
|
+
|
33
|
+
return function onOk(_x) {
|
34
|
+
return _ref.apply(this, arguments);
|
35
|
+
};
|
36
|
+
}();
|
35
37
|
|
36
38
|
return /*#__PURE__*/React.createElement(ResourceSelectDrawer, {
|
37
39
|
visible: visible,
|
@@ -11,16 +11,14 @@ import ResourceSelectDrawer from "../../../../../../../components/NetworkTopoRes
|
|
11
11
|
*/
|
12
12
|
|
13
13
|
var BindResourceDrawer = function BindResourceDrawer(props) {
|
14
|
-
var _ref;
|
15
|
-
|
16
14
|
var visible = props.visible,
|
17
15
|
topoEditApi = props.topoEditApi,
|
18
16
|
node = props.node,
|
19
17
|
currentResId = props.currentResId,
|
20
18
|
onClose = props.onClose;
|
21
19
|
|
22
|
-
var handleSave = function
|
23
|
-
|
20
|
+
var handleSave = /*#__PURE__*/function () {
|
21
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(selected) {
|
24
22
|
var result;
|
25
23
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
26
24
|
while (1) switch (_context.prev = _context.next) {
|
@@ -51,8 +49,12 @@ var BindResourceDrawer = function BindResourceDrawer(props) {
|
|
51
49
|
return _context.stop();
|
52
50
|
}
|
53
51
|
}, _callee);
|
54
|
-
}))
|
55
|
-
|
52
|
+
}));
|
53
|
+
|
54
|
+
return function handleSave(_x) {
|
55
|
+
return _ref.apply(this, arguments);
|
56
|
+
};
|
57
|
+
}();
|
56
58
|
|
57
59
|
return /*#__PURE__*/React.createElement(ResourceSelectDrawer, {
|
58
60
|
visible: visible,
|
@@ -34,8 +34,6 @@ function getBindType(values) {
|
|
34
34
|
}
|
35
35
|
|
36
36
|
export default function Data(props) {
|
37
|
-
var _ref;
|
38
|
-
|
39
37
|
var node = props.node,
|
40
38
|
topo = props.topo,
|
41
39
|
topoEditApi = props.topoEditApi,
|
@@ -74,8 +72,8 @@ export default function Data(props) {
|
|
74
72
|
}
|
75
73
|
};
|
76
74
|
|
77
|
-
var handleBindTopoChange = function
|
78
|
-
|
75
|
+
var handleBindTopoChange = /*#__PURE__*/function () {
|
76
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value, data) {
|
79
77
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
80
78
|
while (1) switch (_context.prev = _context.next) {
|
81
79
|
case 0:
|
@@ -94,8 +92,12 @@ export default function Data(props) {
|
|
94
92
|
return _context.stop();
|
95
93
|
}
|
96
94
|
}, _callee);
|
97
|
-
}))
|
98
|
-
|
95
|
+
}));
|
96
|
+
|
97
|
+
return function handleBindTopoChange(_x, _x2) {
|
98
|
+
return _ref.apply(this, arguments);
|
99
|
+
};
|
100
|
+
}();
|
99
101
|
|
100
102
|
var RelateTopoTree = editorProps === null || editorProps === void 0 ? void 0 : editorProps.relateTopoTree;
|
101
103
|
return /*#__PURE__*/React.createElement(_Collapse, {
|
@@ -4,8 +4,6 @@ import React from 'react';
|
|
4
4
|
import NodeSizeInput from "../../common/NodeSizeInput/NodeSizeInput";
|
5
5
|
import useBackgroundSizeConfig from "./hooks/useBackgroundSizeConfig";
|
6
6
|
export default function BackgroundSize(props) {
|
7
|
-
var _ref;
|
8
|
-
|
9
7
|
var topo = props.topo,
|
10
8
|
backgroundConfig = props.backgroundConfig,
|
11
9
|
settingRuntimeState = props.settingRuntimeState;
|
@@ -14,8 +12,8 @@ export default function BackgroundSize(props) {
|
|
14
12
|
current: backgroundConfig.current
|
15
13
|
});
|
16
14
|
|
17
|
-
var setSize = function
|
18
|
-
|
15
|
+
var setSize = /*#__PURE__*/function () {
|
16
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(size) {
|
19
17
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
20
18
|
while (1) switch (_context.prev = _context.next) {
|
21
19
|
case 0:
|
@@ -31,8 +29,12 @@ export default function BackgroundSize(props) {
|
|
31
29
|
return _context.stop();
|
32
30
|
}
|
33
31
|
}, _callee);
|
34
|
-
}))
|
35
|
-
|
32
|
+
}));
|
33
|
+
|
34
|
+
return function setSize(_x) {
|
35
|
+
return _ref.apply(this, arguments);
|
36
|
+
};
|
37
|
+
}();
|
36
38
|
|
37
39
|
return /*#__PURE__*/React.createElement(NodeSizeInput, {
|
38
40
|
nodeId: backgroundSizeConfig.nodeId,
|
@@ -11,8 +11,6 @@ import styles from "../../../components/titlebar/TitleBar.module.scss";
|
|
11
11
|
import DebugTools from "./widgets/DebugTools";
|
12
12
|
import SettingButtonWidget from "../../../viewer/components/titlebar/widgets/SettingButtonWidget";
|
13
13
|
export default function TopoEditorTitleBar(props) {
|
14
|
-
var _ref;
|
15
|
-
|
16
14
|
var topo = props.topo,
|
17
15
|
topoEditApi = props.topoEditApi;
|
18
16
|
var store = topo.store;
|
@@ -27,8 +25,8 @@ export default function TopoEditorTitleBar(props) {
|
|
27
25
|
exitFlag = _useState[0],
|
28
26
|
setExitFlag = _useState[1];
|
29
27
|
|
30
|
-
var saveAndExit = function
|
31
|
-
|
28
|
+
var saveAndExit = /*#__PURE__*/function () {
|
29
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
32
30
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
33
31
|
while (1) switch (_context.prev = _context.next) {
|
34
32
|
case 0:
|
@@ -43,8 +41,12 @@ export default function TopoEditorTitleBar(props) {
|
|
43
41
|
return _context.stop();
|
44
42
|
}
|
45
43
|
}, _callee);
|
46
|
-
}))
|
47
|
-
|
44
|
+
}));
|
45
|
+
|
46
|
+
return function saveAndExit() {
|
47
|
+
return _ref.apply(this, arguments);
|
48
|
+
};
|
49
|
+
}();
|
48
50
|
|
49
51
|
useEffect(function () {
|
50
52
|
if (!saving && exitFlag) {
|
@@ -73,13 +75,11 @@ export default function TopoEditorTitleBar(props) {
|
|
73
75
|
}, "\u4FDD\u5B58"), /*#__PURE__*/React.createElement(_Button, {
|
74
76
|
className: styles.button,
|
75
77
|
onClick: function onClick() {
|
76
|
-
var _onOk, _onCancel;
|
77
|
-
|
78
78
|
_Dialog.confirm({
|
79
79
|
title: '提示',
|
80
80
|
content: '若直接退出,图上修改的内容将不会保存!',
|
81
|
-
onOk: function
|
82
|
-
|
81
|
+
onOk: function () {
|
82
|
+
var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
83
83
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
84
84
|
while (1) switch (_context2.prev = _context2.next) {
|
85
85
|
case 0:
|
@@ -90,10 +90,16 @@ export default function TopoEditorTitleBar(props) {
|
|
90
90
|
return _context2.stop();
|
91
91
|
}
|
92
92
|
}, _callee2);
|
93
|
-
}))
|
94
|
-
|
95
|
-
|
96
|
-
|
93
|
+
}));
|
94
|
+
|
95
|
+
function onOk() {
|
96
|
+
return _onOk.apply(this, arguments);
|
97
|
+
}
|
98
|
+
|
99
|
+
return onOk;
|
100
|
+
}(),
|
101
|
+
onCancel: function () {
|
102
|
+
var _onCancel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
97
103
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
98
104
|
while (1) switch (_context3.prev = _context3.next) {
|
99
105
|
case 0:
|
@@ -104,8 +110,14 @@ export default function TopoEditorTitleBar(props) {
|
|
104
110
|
return _context3.stop();
|
105
111
|
}
|
106
112
|
}, _callee3);
|
107
|
-
}))
|
108
|
-
|
113
|
+
}));
|
114
|
+
|
115
|
+
function onCancel() {
|
116
|
+
return _onCancel.apply(this, arguments);
|
117
|
+
}
|
118
|
+
|
119
|
+
return onCancel;
|
120
|
+
}(),
|
109
121
|
cancelProps: {
|
110
122
|
children: '退出'
|
111
123
|
},
|
@@ -1,39 +1,43 @@
|
|
1
|
-
import
|
2
|
-
|
1
|
+
import hotkeys from 'hotkeys-js';
|
2
|
+
import { useEffect } from 'react';
|
3
|
+
import { handleCopyHotkey, handlePasteHotkey } from "../utils/copyElementUtil";
|
3
4
|
|
4
|
-
|
5
|
+
function initKeyboardShortcuts(props) {
|
5
6
|
var topo = props.topo,
|
6
|
-
topoEdit = props.topoEdit;
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
// this.redo();
|
21
|
-
// }
|
22
|
-
|
23
|
-
}
|
24
|
-
|
25
|
-
if (e.keyCode === 32 && e.target.nodeName !== 'TEXTAREA') {
|
26
|
-
// 空格
|
27
|
-
var _topo$store$getModelS2 = topo.store.getModelState('topoEdit'),
|
28
|
-
viewMouseMode = _topo$store$getModelS2.viewMouseMode;
|
29
|
-
|
30
|
-
topoEdit.setViewMouseMode(viewMouseMode === 'select' ? 'move' : 'select');
|
31
|
-
}
|
32
|
-
};
|
7
|
+
topoEdit = props.topoEdit; // 撤销
|
8
|
+
|
9
|
+
hotkeys('ctrl+z, command+z', function (event) {
|
10
|
+
topo.historyManager.undo();
|
11
|
+
}); // 重做
|
12
|
+
|
13
|
+
hotkeys('ctrl+y, command+y', function (event) {}); // 空格:切换选择/移动
|
14
|
+
|
15
|
+
hotkeys('space', function (event) {
|
16
|
+
var _topo$store$getModelS = topo.store.getModelState('topoEdit'),
|
17
|
+
viewMouseMode = _topo$store$getModelS.viewMouseMode;
|
18
|
+
|
19
|
+
topoEdit.setViewMouseMode(viewMouseMode === 'select' ? 'move' : 'select');
|
20
|
+
}); // 复制
|
33
21
|
|
34
|
-
|
22
|
+
hotkeys('ctrl+c, command+c', function (event) {
|
23
|
+
return handleCopyHotkey(event, props);
|
24
|
+
}); // 粘贴
|
25
|
+
|
26
|
+
hotkeys('ctrl+v, command+v', function (event) {
|
27
|
+
return handlePasteHotkey(event, props);
|
28
|
+
});
|
29
|
+
}
|
30
|
+
|
31
|
+
function unbindKeyboardShortcuts(props) {
|
32
|
+
hotkeys.unbind();
|
33
|
+
} // 快捷键
|
34
|
+
|
35
|
+
|
36
|
+
export default function useKeyboardShortcut(props) {
|
37
|
+
useEffect(function () {
|
38
|
+
initKeyboardShortcuts(props);
|
35
39
|
return function () {
|
36
|
-
|
40
|
+
unbindKeyboardShortcuts(props);
|
37
41
|
};
|
38
42
|
}, []);
|
39
43
|
}
|
@@ -0,0 +1,171 @@
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
3
|
+
export function handleCopyHotkey(event, options) {
|
4
|
+
var target = event.target || event.srcElement;
|
5
|
+
var tagName = target.tagName;
|
6
|
+
|
7
|
+
if (tagName !== 'BODY') {
|
8
|
+
copy(options);
|
9
|
+
}
|
10
|
+
}
|
11
|
+
export function handlePasteHotkey(event, options) {
|
12
|
+
var target = event.target || event.srcElement;
|
13
|
+
var tagName = target.tagName;
|
14
|
+
|
15
|
+
if (tagName !== 'BODY') {
|
16
|
+
paste(options);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
function copy(options) {
|
21
|
+
var topo = options.topo;
|
22
|
+
var gv = topo.getHtTopo().getGraphView();
|
23
|
+
var dm = gv.dm();
|
24
|
+
var sm = dm.sm();
|
25
|
+
var serializer = new ht.JSONSerializer(dm);
|
26
|
+
|
27
|
+
serializer.isSerializable = function (data) {
|
28
|
+
//可在此设置要选中的数据或者在copy处
|
29
|
+
// if(sm.co(data)){
|
30
|
+
// if(data instanceof ht.Group){
|
31
|
+
// sm.as(data.getChildren());
|
32
|
+
// }
|
33
|
+
// }
|
34
|
+
return sm.co(data);
|
35
|
+
};
|
36
|
+
|
37
|
+
var copyData = {
|
38
|
+
copyTopoElements: true,
|
39
|
+
source: {
|
40
|
+
id: topo.id,
|
41
|
+
topoType: topo.viewProps.topoType
|
42
|
+
},
|
43
|
+
data: serializer.toJSON()
|
44
|
+
};
|
45
|
+
writeClipboard(JSON.stringify(copyData, null, 0));
|
46
|
+
}
|
47
|
+
|
48
|
+
function paste(_x) {
|
49
|
+
return _paste.apply(this, arguments);
|
50
|
+
}
|
51
|
+
|
52
|
+
function _paste() {
|
53
|
+
_paste = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
|
54
|
+
var topo, clipboardText, copyData;
|
55
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
56
|
+
while (1) switch (_context.prev = _context.next) {
|
57
|
+
case 0:
|
58
|
+
topo = options.topo;
|
59
|
+
_context.next = 3;
|
60
|
+
return readClipboard();
|
61
|
+
|
62
|
+
case 3:
|
63
|
+
clipboardText = _context.sent;
|
64
|
+
copyData = parseCopyData(clipboardText, topo);
|
65
|
+
|
66
|
+
if (copyData) {
|
67
|
+
topo.historyManager.beginTransaction();
|
68
|
+
doPaste(topo, copyData.data);
|
69
|
+
topo.historyManager.endTransaction();
|
70
|
+
}
|
71
|
+
|
72
|
+
case 6:
|
73
|
+
case "end":
|
74
|
+
return _context.stop();
|
75
|
+
}
|
76
|
+
}, _callee);
|
77
|
+
}));
|
78
|
+
return _paste.apply(this, arguments);
|
79
|
+
}
|
80
|
+
|
81
|
+
function parseCopyData(clipboardText, topo) {
|
82
|
+
var copyData = null;
|
83
|
+
|
84
|
+
try {
|
85
|
+
copyData = JSON.parse(clipboardText); // 网络拓扑和业务拓扑之间不支持复制粘贴
|
86
|
+
|
87
|
+
if (!copyData.copyTopoElements || copyData.topoType !== topo.topoType) {
|
88
|
+
copyData = null;
|
89
|
+
}
|
90
|
+
} catch (error) {}
|
91
|
+
|
92
|
+
return copyData;
|
93
|
+
}
|
94
|
+
|
95
|
+
function validateTopoCopyText(clipboardText) {
|
96
|
+
// TODO
|
97
|
+
return true;
|
98
|
+
}
|
99
|
+
|
100
|
+
function doPaste(topo, clipboardText) {
|
101
|
+
// 解析剪切板内容
|
102
|
+
var parseDm = new ht.DataModel();
|
103
|
+
var parseSerializer = new ht.JSONSerializer(parseDm);
|
104
|
+
parseSerializer.deserialize(clipboardText);
|
105
|
+
var elements = parseDm.getDatas().toArray(); // 添加到拓扑图
|
106
|
+
|
107
|
+
var gv = topo.getHtTopo().getGraphView();
|
108
|
+
var dm = gv.dm();
|
109
|
+
elements.forEach(function (d) {
|
110
|
+
dm.add(d);
|
111
|
+
});
|
112
|
+
parseDm.clear(); // 粘贴之后进行处理
|
113
|
+
|
114
|
+
var sm = dm.sm();
|
115
|
+
sm.cs();
|
116
|
+
sm.as(elements); // 粘贴位置处理
|
117
|
+
|
118
|
+
if (isPasetToOriginTopo()) {
|
119
|
+
gv.moveSelection(60, 60);
|
120
|
+
} else {// 从拓扑图A复制到拓扑图B时,粘贴到拓扑图可视区域中心位置居中粘贴
|
121
|
+
// TODO
|
122
|
+
} // 若用户粘贴后的位置超出现有位置后,将视野拉到可视范围内
|
123
|
+
// TODO
|
124
|
+
// gv.translate(-60, -60)
|
125
|
+
|
126
|
+
}
|
127
|
+
|
128
|
+
function isPasetToOriginTopo() {
|
129
|
+
// TODO
|
130
|
+
return true;
|
131
|
+
}
|
132
|
+
|
133
|
+
function writeClipboard(_x2) {
|
134
|
+
return _writeClipboard.apply(this, arguments);
|
135
|
+
}
|
136
|
+
|
137
|
+
function _writeClipboard() {
|
138
|
+
_writeClipboard = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(text) {
|
139
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
140
|
+
while (1) switch (_context2.prev = _context2.next) {
|
141
|
+
case 0:
|
142
|
+
navigator.clipboard.writeText(text);
|
143
|
+
|
144
|
+
case 1:
|
145
|
+
case "end":
|
146
|
+
return _context2.stop();
|
147
|
+
}
|
148
|
+
}, _callee2);
|
149
|
+
}));
|
150
|
+
return _writeClipboard.apply(this, arguments);
|
151
|
+
}
|
152
|
+
|
153
|
+
function readClipboard() {
|
154
|
+
return _readClipboard.apply(this, arguments);
|
155
|
+
}
|
156
|
+
|
157
|
+
function _readClipboard() {
|
158
|
+
_readClipboard = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
159
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
160
|
+
while (1) switch (_context3.prev = _context3.next) {
|
161
|
+
case 0:
|
162
|
+
return _context3.abrupt("return", navigator.clipboard.readText());
|
163
|
+
|
164
|
+
case 1:
|
165
|
+
case "end":
|
166
|
+
return _context3.stop();
|
167
|
+
}
|
168
|
+
}, _callee3);
|
169
|
+
}));
|
170
|
+
return _readClipboard.apply(this, arguments);
|
171
|
+
}
|
@@ -15,8 +15,6 @@ import useHtDataPropertyChangeListener from "./ht/useHtDataPropertyChangeListene
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
var usePolling = function usePolling(props) {
|
18
|
-
var _fetchData, _refresh;
|
19
|
-
|
20
18
|
var topo = props.topo;
|
21
19
|
var store = topo.store;
|
22
20
|
useCiAttributeChange({
|
@@ -35,7 +33,16 @@ var usePolling = function usePolling(props) {
|
|
35
33
|
*/
|
36
34
|
|
37
35
|
function fetchData() {
|
38
|
-
return
|
36
|
+
return _fetchData.apply(this, arguments);
|
37
|
+
}
|
38
|
+
/**
|
39
|
+
*
|
40
|
+
* @returns {{id, attributes: object[], metrics: object[]}[]} 属性和指标
|
41
|
+
*/
|
42
|
+
|
43
|
+
|
44
|
+
function _fetchData() {
|
45
|
+
_fetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
39
46
|
var _topo$store$getModelS, resIdsList, nodeIdsList, codes, param, _yield$Promise$all, ciMetricsResult, mergeData, transformLinkData, adapterIpv6;
|
40
47
|
|
41
48
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
@@ -145,16 +152,17 @@ var usePolling = function usePolling(props) {
|
|
145
152
|
return _context.stop();
|
146
153
|
}
|
147
154
|
}, _callee);
|
148
|
-
}))
|
155
|
+
}));
|
156
|
+
return _fetchData.apply(this, arguments);
|
149
157
|
}
|
150
|
-
/**
|
151
|
-
*
|
152
|
-
* @returns {{id, attributes: object[], metrics: object[]}[]} 属性和指标
|
153
|
-
*/
|
154
|
-
|
155
158
|
|
156
159
|
function refresh() {
|
157
|
-
return
|
160
|
+
return _refresh.apply(this, arguments);
|
161
|
+
} // 轮询hooks
|
162
|
+
|
163
|
+
|
164
|
+
function _refresh() {
|
165
|
+
_refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
158
166
|
var data;
|
159
167
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
160
168
|
while (1) switch (_context2.prev = _context2.next) {
|
@@ -179,9 +187,9 @@ var usePolling = function usePolling(props) {
|
|
179
187
|
return _context2.stop();
|
180
188
|
}
|
181
189
|
}, _callee2);
|
182
|
-
}))
|
183
|
-
|
184
|
-
|
190
|
+
}));
|
191
|
+
return _refresh.apply(this, arguments);
|
192
|
+
}
|
185
193
|
|
186
194
|
var _useRequest = useRequest(refresh, {
|
187
195
|
pollingInterval: 60 * 1000,
|