@riil-frontend/component-topology 5.0.0-alpha.9 → 5.0.2
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.css +1 -1
- package/build/index.js +20 -20
- package/es/common/components/ColorPicker/ColorPicker.js +5 -3
- package/es/components/BatchAttrMetric/setting.js +3 -5
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +2 -1
- package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +2 -1
- package/es/core/components/DisplaySettingDrawer/LinkTip.js +5 -1
- package/es/core/components/DisplaySettingDrawer/demo/Demo.js +63 -0
- package/es/core/components/ResourceViewAttributeSetting/Setting.js +9 -48
- package/es/core/components/TopoView/TopoView.module.scss +1 -1
- package/es/core/components/TopoView/topoView.js +31 -22
- package/es/core/editor/components/BackgroundView/index.js +74 -35
- package/es/core/editor/components/settings/common/LineType/index.js +7 -1
- package/es/core/editor/components/settings/common/text/FontStyleCheckbox.js +3 -3
- package/es/core/editor/components/settings/common/text/TextStyle.js +21 -6
- package/es/core/editor/components/settings/common/text/fontStyleUtil.js +0 -1
- package/es/core/editor/components/settings/propertyViews/box/BoxPropertyView.js +12 -1
- package/es/core/editor/components/settings/propertyViews/box/NameInput.js +9 -1
- package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +15 -1
- package/es/core/editor/components/settings/propertyViews/group/DataTab/GroupNodeList.js +2 -0
- package/es/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandSetting.js +9 -5
- package/es/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandStatus.js +10 -2
- package/es/core/editor/components/settings/propertyViews/group/SettingTab/Setting.js +12 -1
- package/es/core/editor/components/settings/propertyViews/layer/SettingTab/Setting.js +13 -3
- package/es/core/editor/components/settings/propertyViews/layer/SettingTab/Setting_bak.js +0 -1
- package/es/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeIcon.js +2 -0
- package/es/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeSize/BatchSetNodeSize.js +2 -0
- package/es/core/editor/components/settings/propertyViews/multipleElements/MultipleElementPropertyView.js +4 -1
- package/es/core/editor/components/settings/propertyViews/node/Setting/Setting.js +4 -0
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +34 -6
- package/es/core/editor/components/settings/propertyViews/text/TextPropertyView.js +9 -2
- package/es/core/editor/components/settings/propertyViews/view/BackgroundSize.js +30 -1
- package/es/core/editor/components/settings/propertyViews/view/GlobalLayout.js +2 -0
- package/es/core/editor/components/settings/propertyViews/view/GlobalNodeLabelStyle.js +15 -1
- package/es/core/editor/components/settings/propertyViews/view/hooks/useBackgroundSizeConfig.js +0 -1
- package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +4 -1
- package/es/core/editor/components/titlebar/widgets/DebugTools.js +29 -0
- package/es/core/hooks/useAlarm.js +18 -0
- package/es/core/hooks/useGraphAlarmDisplay.js +25 -3
- package/es/core/hooks/useResourceConfig.js +2 -1
- package/es/core/hooks/useRouterAdapter.js +7 -1
- package/es/core/hooks/useTopoEdit.js +220 -163
- package/es/core/models/AttributeMetricDisplay.js +31 -73
- package/es/core/models/HistoryManager.js +100 -50
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/cache/CiTypeCache.js +10 -44
- package/es/core/models/cache/DictCache.js +2 -1
- package/es/core/models/graph/Background.js +31 -14
- package/es/core/models/tagstips/ElementTagTipConfig.js +46 -12
- package/es/core/models/tagstips/utils.js +1 -1
- package/es/core/models/topoData.js +7 -3
- package/es/core/models/utils/linkUtils.js +18 -0
- package/es/core/store/models/topoAlarm.js +5 -1
- package/es/core/store/models/topoMod.js +6 -31
- package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +51 -249
- package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawer.js +218 -0
- package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailPlugin.js +2 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +1 -1
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfoBlock.js +0 -1
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +79 -43
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +2 -3
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +2 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +23 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.module.scss +11 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +34 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/constants.js +6 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +62 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +188 -0
- package/es/core/viewer/components/titlebar/BasicTools.js +1 -1
- package/es/core/viewer/components/titlebar/widgets/NodesDragSwitchWrapper.js +18 -0
- package/es/core/viewer/components/titlebar/widgets/SettingButton.js +11 -1
- package/es/networkTopo/components/TopoView.js +2 -1
- package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +164 -225
- package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/NetworkLinkForm.js +4 -0
- package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +161 -137
- package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/hooks/useAddLink.js +104 -0
- package/es/networkTopo/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +17 -7
- package/es/networkTopo/components/editor/propertyViews/edge/link/LinkInfoPreview.js +8 -9
- package/es/networkTopo/components/viewer/displaySetting/LinkAttrCustomSettingDrawer.js +59 -0
- package/es/networkTopo/components/viewer/displaySetting/LinkTagV2.js +10 -4
- package/es/networkTopo/getTopoData.js +11 -14
- package/es/networkTopo/hooks/editor/useDeleteEdges.js +11 -8
- package/es/networkTopo/hooks/viewer/useRelateTopo.js +1 -1
- package/es/networkTopo/models/LinkDynamicStyleExecutor.js +2 -0
- package/es/networkTopo/models/TopoCenter.js +1 -1
- package/es/networkTopo/services/index.js +6 -4
- package/es/networkTopo/services/link.js +2 -2
- package/es/networkTopo/store/topoCenter.js +5 -2
- package/es/networkTopo/store/topoTreeMod.js +84 -43
- package/es/networkTopo/utils/__tests__/resourcePermissionUtil.test.js +135 -0
- package/es/networkTopo/utils/resourcePermissionUtil.js +10 -6
- package/es/style.js +2 -1
- package/es/utils/ResourceConfigUtil.js +79 -39
- package/es/utils/clusterUtil.js +1 -1
- package/es/utils/htElementUtils.js +0 -1
- package/es/utils/topoData.js +24 -63
- package/es/utils/tree.js +1 -3
- package/lib/common/components/ColorPicker/ColorPicker.js +6 -3
- package/lib/components/BatchAttrMetric/setting.js +3 -6
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +4 -1
- package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +4 -1
- package/lib/core/components/DisplaySettingDrawer/LinkTip.js +6 -1
- package/lib/core/components/DisplaySettingDrawer/demo/Demo.js +71 -0
- package/lib/core/components/ResourceViewAttributeSetting/Setting.js +8 -48
- package/lib/core/components/TopoView/TopoView.module.scss +1 -1
- package/lib/core/components/TopoView/topoView.js +26 -17
- package/lib/core/editor/components/BackgroundView/index.js +75 -35
- package/lib/core/editor/components/settings/common/LineType/index.js +7 -1
- package/lib/core/editor/components/settings/common/text/FontStyleCheckbox.js +5 -4
- package/lib/core/editor/components/settings/common/text/TextStyle.js +23 -7
- package/lib/core/editor/components/settings/common/text/fontStyleUtil.js +0 -1
- package/lib/core/editor/components/settings/propertyViews/box/BoxPropertyView.js +13 -1
- package/lib/core/editor/components/settings/propertyViews/box/NameInput.js +9 -1
- package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +15 -1
- package/lib/core/editor/components/settings/propertyViews/group/DataTab/GroupNodeList.js +2 -0
- package/lib/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandSetting.js +9 -5
- package/lib/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandStatus.js +10 -2
- package/lib/core/editor/components/settings/propertyViews/group/SettingTab/Setting.js +12 -1
- package/lib/core/editor/components/settings/propertyViews/layer/SettingTab/Setting.js +17 -3
- package/lib/core/editor/components/settings/propertyViews/layer/SettingTab/Setting_bak.js +0 -1
- package/lib/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeIcon.js +2 -0
- package/lib/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeSize/BatchSetNodeSize.js +2 -0
- package/lib/core/editor/components/settings/propertyViews/multipleElements/MultipleElementPropertyView.js +4 -1
- package/lib/core/editor/components/settings/propertyViews/node/Setting/Setting.js +4 -0
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +36 -6
- package/lib/core/editor/components/settings/propertyViews/text/TextPropertyView.js +9 -2
- package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +32 -1
- package/lib/core/editor/components/settings/propertyViews/view/GlobalLayout.js +2 -0
- package/lib/core/editor/components/settings/propertyViews/view/GlobalNodeLabelStyle.js +15 -1
- package/lib/core/editor/components/settings/propertyViews/view/hooks/useBackgroundSizeConfig.js +0 -1
- package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +5 -1
- package/lib/core/editor/components/titlebar/widgets/DebugTools.js +38 -0
- package/lib/core/hooks/useAlarm.js +19 -0
- package/lib/core/hooks/useGraphAlarmDisplay.js +27 -3
- package/lib/core/hooks/useResourceConfig.js +2 -1
- package/lib/core/hooks/useRouterAdapter.js +8 -1
- package/lib/core/hooks/useTopoEdit.js +219 -162
- package/lib/core/models/AttributeMetricDisplay.js +31 -73
- package/lib/core/models/HistoryManager.js +105 -51
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/cache/CiTypeCache.js +12 -44
- package/lib/core/models/cache/DictCache.js +4 -1
- package/lib/core/models/graph/Background.js +36 -16
- package/lib/core/models/tagstips/ElementTagTipConfig.js +49 -12
- package/lib/core/models/tagstips/utils.js +1 -1
- package/lib/core/models/topoData.js +7 -3
- package/lib/core/models/utils/linkUtils.js +22 -0
- package/lib/core/store/models/topoAlarm.js +5 -1
- package/lib/core/store/models/topoMod.js +7 -32
- package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +51 -261
- package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawer.js +245 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailPlugin.js +2 -2
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +1 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfoBlock.js +0 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +79 -42
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +2 -3
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +2 -2
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +36 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.module.scss +11 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +45 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/constants.js +11 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +77 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +214 -0
- package/lib/core/viewer/components/titlebar/BasicTools.js +2 -2
- package/lib/core/viewer/components/titlebar/widgets/NodesDragSwitchWrapper.js +28 -0
- package/lib/core/viewer/components/titlebar/widgets/SettingButton.js +10 -0
- package/lib/networkTopo/components/TopoView.js +3 -2
- package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +160 -223
- package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/NetworkLinkForm.js +12 -0
- package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +161 -137
- package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/hooks/useAddLink.js +120 -0
- package/lib/networkTopo/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +19 -7
- package/lib/networkTopo/components/editor/propertyViews/edge/link/LinkInfoPreview.js +8 -9
- package/lib/networkTopo/components/viewer/displaySetting/LinkAttrCustomSettingDrawer.js +76 -0
- package/lib/networkTopo/components/viewer/displaySetting/LinkTagV2.js +10 -4
- package/lib/networkTopo/getTopoData.js +10 -13
- package/lib/networkTopo/hooks/editor/useDeleteEdges.js +11 -8
- package/lib/networkTopo/hooks/viewer/useRelateTopo.js +2 -1
- package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +2 -0
- package/lib/networkTopo/models/TopoCenter.js +2 -2
- package/lib/networkTopo/services/index.js +6 -4
- package/lib/networkTopo/services/link.js +2 -2
- package/lib/networkTopo/store/topoCenter.js +5 -2
- package/lib/networkTopo/store/topoTreeMod.js +84 -43
- package/lib/networkTopo/utils/__tests__/resourcePermissionUtil.test.js +137 -0
- package/lib/networkTopo/utils/resourcePermissionUtil.js +11 -6
- package/lib/style.js +2 -1
- package/lib/utils/ResourceConfigUtil.js +78 -37
- package/lib/utils/clusterUtil.js +1 -1
- package/lib/utils/htElementUtils.js +0 -1
- package/lib/utils/topoData.js +25 -64
- package/lib/utils/tree.js +1 -3
- package/package.json +3 -2
|
@@ -4,10 +4,9 @@ import _Message from "@alifd/next/es/message";
|
|
|
4
4
|
import _extends from "@babel/runtime/helpers/extends";
|
|
5
5
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
6
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
-
import React, { useState, useEffect, useRef } from
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
7
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
8
|
+
import _ from 'lodash';
|
|
9
|
+
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
|
11
10
|
import TopoCenterEvent from "../../../../../event";
|
|
12
11
|
import EditLinkInfo from "./components/editLinkInfo";
|
|
13
12
|
import styles from "./index.module.scss";
|
|
@@ -15,25 +14,21 @@ import service from "./server";
|
|
|
15
14
|
import { clone } from "../../../../../../utils/copyUtil";
|
|
16
15
|
import { getInterfaceObject } from "../../../../../../core/models/utils/linkUtils";
|
|
17
16
|
import { getEdgesBetweenNodes, getNodes, isGroup } from "../../../../../../utils/htElementUtils";
|
|
18
|
-
import
|
|
17
|
+
import useAddLink from "./hooks/useAddLink";
|
|
19
18
|
|
|
20
19
|
function AddLinkDrawer(props) {
|
|
21
20
|
var topo = props.topo,
|
|
22
21
|
lineData = props.lineData;
|
|
23
22
|
var store = topo.store;
|
|
24
23
|
|
|
25
|
-
var _topo$store$useModel = topo.store.useModel(
|
|
24
|
+
var _topo$store$useModel = topo.store.useModel('topoMod'),
|
|
26
25
|
topoState = _topo$store$useModel[0],
|
|
27
26
|
topoDispatchers = _topo$store$useModel[1];
|
|
28
27
|
|
|
29
|
-
var _store$useModel = store.useModel(
|
|
28
|
+
var _store$useModel = store.useModel('topoConfig'),
|
|
30
29
|
editState = _store$useModel[0],
|
|
31
30
|
editDispatchers = _store$useModel[1];
|
|
32
31
|
|
|
33
|
-
var _store$useModel2 = store.useModel("topoLinkMod"),
|
|
34
|
-
linkState = _store$useModel2[0],
|
|
35
|
-
linkDispatchers = _store$useModel2[1];
|
|
36
|
-
|
|
37
32
|
var addLinkIsOpen = editState.addLinkIsOpen,
|
|
38
33
|
currentLink = editState.currentLink;
|
|
39
34
|
|
|
@@ -50,28 +45,27 @@ function AddLinkDrawer(props) {
|
|
|
50
45
|
setLoading = _useState3[1];
|
|
51
46
|
|
|
52
47
|
var _useState4 = useState(false),
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
loadingFormData = _useState4[0],
|
|
49
|
+
setLoadingFormData = _useState4[1];
|
|
55
50
|
|
|
56
|
-
var _useState5 = useState(
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
var _useState5 = useState(),
|
|
52
|
+
sourceIFDoc = _useState5[0],
|
|
53
|
+
setSourceIFDoc = _useState5[1];
|
|
59
54
|
|
|
60
55
|
var _useState6 = useState(),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
var _useState7 = useState(),
|
|
65
|
-
targetIFDoc = _useState7[0],
|
|
66
|
-
setTargetIFDoc = _useState7[1]; // 保存后更新拓扑图状态
|
|
56
|
+
targetIFDoc = _useState6[0],
|
|
57
|
+
setTargetIFDoc = _useState6[1]; // 保存后更新拓扑图状态
|
|
67
58
|
|
|
68
59
|
|
|
69
|
-
var _useState8 = useState([]),
|
|
70
|
-
ciIdsConnectable = _useState8[0],
|
|
71
|
-
setCiIdsConnectable = _useState8[1];
|
|
72
|
-
|
|
73
60
|
var linkNodesRef = useRef();
|
|
74
61
|
|
|
62
|
+
var _useAddLink = useAddLink({
|
|
63
|
+
topo: topo
|
|
64
|
+
}),
|
|
65
|
+
enterAddLinkMode = _useAddLink.enterAddLinkMode,
|
|
66
|
+
resetConnectableNodes = _useAddLink.resetConnectableNodes,
|
|
67
|
+
loadingConnectableNodes = _useAddLink.loadingConnectableNodes;
|
|
68
|
+
|
|
75
69
|
var getPortsById = /*#__PURE__*/function () {
|
|
76
70
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(id, currentLink) {
|
|
77
71
|
var result, links, ifTypes, ifDoc, usedPorts, portsDoc, ports;
|
|
@@ -79,7 +73,7 @@ function AddLinkDrawer(props) {
|
|
|
79
73
|
while (1) {
|
|
80
74
|
switch (_context.prev = _context.next) {
|
|
81
75
|
case 0:
|
|
82
|
-
console.log(
|
|
76
|
+
console.log('getPortsById', id, currentLink);
|
|
83
77
|
|
|
84
78
|
if (id) {
|
|
85
79
|
_context.next = 3;
|
|
@@ -131,12 +125,14 @@ function AddLinkDrawer(props) {
|
|
|
131
125
|
value: item.id,
|
|
132
126
|
label: item.name,
|
|
133
127
|
type: item.type,
|
|
134
|
-
typeName: (_ifDoc$item$type$disp = (_ifDoc$item$type = ifDoc[item.type]) === null || _ifDoc$item$type === void 0 ? void 0 : _ifDoc$item$type.displayName) !== null && _ifDoc$item$type$disp !== void 0 ? _ifDoc$item$type$disp :
|
|
128
|
+
typeName: (_ifDoc$item$type$disp = (_ifDoc$item$type = ifDoc[item.type]) === null || _ifDoc$item$type === void 0 ? void 0 : _ifDoc$item$type.displayName) !== null && _ifDoc$item$type$disp !== void 0 ? _ifDoc$item$type$disp : '',
|
|
135
129
|
disabled: usedPorts.indexOf(item.id) >= 0,
|
|
136
130
|
ratedBandwidth: parseInt(item.ratedBandwidth, 10)
|
|
137
131
|
};
|
|
138
132
|
portsDoc[item.id] = obj;
|
|
139
133
|
return obj;
|
|
134
|
+
}).filter(function (item) {
|
|
135
|
+
return !item.disabled;
|
|
140
136
|
});
|
|
141
137
|
return _context.abrupt("return", {
|
|
142
138
|
ports: ports,
|
|
@@ -161,96 +157,93 @@ function AddLinkDrawer(props) {
|
|
|
161
157
|
*/
|
|
162
158
|
|
|
163
159
|
|
|
164
|
-
var
|
|
160
|
+
var handleSelectTargetNodeEvent = /*#__PURE__*/function () {
|
|
165
161
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(e) {
|
|
166
|
-
var sourcePorts, targetPorts, source, target
|
|
162
|
+
var sourcePorts, targetPorts, source, target;
|
|
167
163
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
168
164
|
while (1) {
|
|
169
165
|
switch (_context2.prev = _context2.next) {
|
|
170
166
|
case 0:
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
rlog.debug(
|
|
174
|
-
setIsAddMode(true);
|
|
175
|
-
|
|
167
|
+
resetConnectableNodes();
|
|
168
|
+
linkNodesRef.current = e;
|
|
169
|
+
rlog.debug('接到打开创建链路抽屉信息', e);
|
|
170
|
+
setIsAddMode(true);
|
|
176
171
|
setLoadingFormData(true);
|
|
177
|
-
_context2.prev =
|
|
178
|
-
_context2.next =
|
|
172
|
+
_context2.prev = 5;
|
|
173
|
+
_context2.next = 8;
|
|
179
174
|
return getPortsById(e.source._attrObject.id);
|
|
180
175
|
|
|
181
|
-
case
|
|
176
|
+
case 8:
|
|
182
177
|
sourcePorts = _context2.sent;
|
|
183
|
-
_context2.next =
|
|
178
|
+
_context2.next = 11;
|
|
184
179
|
return getPortsById(e.target._attrObject.id);
|
|
185
180
|
|
|
186
|
-
case
|
|
181
|
+
case 11:
|
|
187
182
|
targetPorts = _context2.sent;
|
|
188
183
|
setSourceIFDoc(sourcePorts.portsDoc);
|
|
189
184
|
setTargetIFDoc(targetPorts.portsDoc);
|
|
190
185
|
source = translationNode(e.source, sourcePorts);
|
|
191
186
|
target = translationNode(e.target, targetPorts);
|
|
192
|
-
targetDisableCreatePhyAggLink = !target.ciData || !(target.ciData.permission.writeable || target.ciData.permission.deleteable);
|
|
193
187
|
editDispatchers.update({
|
|
194
188
|
addLinkIsOpen: true,
|
|
195
189
|
currentLink: null
|
|
196
190
|
});
|
|
197
|
-
connect_type = target.ciType !== "customNode" && target.ipAddress && targetPorts.ports.length > 0 && !targetDisableCreatePhyAggLink ? "phy" : "exit";
|
|
198
191
|
setLink({
|
|
199
192
|
source: source,
|
|
200
193
|
target: target,
|
|
201
194
|
attributes: {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
connect_type: connect_type
|
|
195
|
+
display_name: '',
|
|
196
|
+
name: '',
|
|
197
|
+
source_id: '',
|
|
198
|
+
source_type: '',
|
|
199
|
+
'network_link.source_device_id': source.id,
|
|
200
|
+
'network_link.source_device_ipv4': source.ipAddress,
|
|
201
|
+
destination_id: '',
|
|
202
|
+
destination_type: '',
|
|
203
|
+
'network_link.destination_device_id': target.id,
|
|
204
|
+
'network_link.destination_device_ipv4': target.ipAddress,
|
|
205
|
+
'network_link.actual_bandwidth': null
|
|
214
206
|
}
|
|
215
207
|
});
|
|
216
|
-
_context2.next =
|
|
208
|
+
_context2.next = 23;
|
|
217
209
|
break;
|
|
218
210
|
|
|
219
|
-
case
|
|
220
|
-
_context2.prev =
|
|
221
|
-
_context2.t0 = _context2["catch"](
|
|
222
|
-
rlog.error(
|
|
211
|
+
case 20:
|
|
212
|
+
_context2.prev = 20;
|
|
213
|
+
_context2.t0 = _context2["catch"](5);
|
|
214
|
+
rlog.error('出现异常', _context2.t0);
|
|
223
215
|
|
|
224
|
-
case
|
|
216
|
+
case 23:
|
|
225
217
|
setLoadingFormData(false);
|
|
226
218
|
|
|
227
|
-
case
|
|
219
|
+
case 24:
|
|
228
220
|
case "end":
|
|
229
221
|
return _context2.stop();
|
|
230
222
|
}
|
|
231
223
|
}
|
|
232
|
-
}, _callee2, null, [[
|
|
224
|
+
}, _callee2, null, [[5, 20]]);
|
|
233
225
|
}));
|
|
234
226
|
|
|
235
|
-
return function
|
|
227
|
+
return function handleSelectTargetNodeEvent(_x3) {
|
|
236
228
|
return _ref2.apply(this, arguments);
|
|
237
229
|
};
|
|
238
230
|
}();
|
|
239
231
|
|
|
240
|
-
var
|
|
232
|
+
var handleSelectSourceNodeEvent = function handleSelectSourceNodeEvent(e) {
|
|
241
233
|
// rlog.debug("设置了起始节点", e);
|
|
242
|
-
|
|
234
|
+
topo.historyManager.setDisabled(true);
|
|
243
235
|
var enableNodes = getNodes(topo.getDataModel());
|
|
244
|
-
topo.view.topoClient.emitEvent(
|
|
236
|
+
topo.view.topoClient.emitEvent('topo_link_set_connectable_nodes', enableNodes.filter(function (ele) {
|
|
245
237
|
return !(isGroup(ele) && !ele.a('ciType'));
|
|
246
238
|
}));
|
|
239
|
+
topo.historyManager.setDisabled(false);
|
|
247
240
|
};
|
|
248
241
|
|
|
249
242
|
var initEditLineData = /*#__PURE__*/function () {
|
|
250
243
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
251
244
|
var _currentLink$attribut, _sourcePorts$ports, _currentLink$attribut2, _targetPorts$ports;
|
|
252
245
|
|
|
253
|
-
var sourcePorts, targetPorts
|
|
246
|
+
var sourcePorts, targetPorts;
|
|
254
247
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
255
248
|
while (1) {
|
|
256
249
|
switch (_context3.prev = _context3.next) {
|
|
@@ -267,14 +260,12 @@ function AddLinkDrawer(props) {
|
|
|
267
260
|
targetPorts = _context3.sent;
|
|
268
261
|
setSourceIFDoc(sourcePorts.portsDoc);
|
|
269
262
|
setTargetIFDoc(targetPorts.portsDoc);
|
|
270
|
-
connect_type = currentLink.attributes["network_link.connect_type"] === "exit" ? "exit" : "phy";
|
|
271
263
|
setLink({
|
|
272
264
|
source: {
|
|
273
265
|
ciData: topo.dataModel.getDataById(currentLink.source),
|
|
274
266
|
id: currentLink.source,
|
|
275
|
-
name: currentLink.attributes[
|
|
276
|
-
ciId: currentLink.attributes[
|
|
277
|
-
ipAddress: currentLink.attributes["network_link.source_ipv4"],
|
|
267
|
+
name: currentLink.attributes['network_link.source_device_id_object'].displayName,
|
|
268
|
+
ciId: currentLink.attributes['network_link.source_device_id'],
|
|
278
269
|
ciName: (_currentLink$attribut = currentLink.attributes.source_type_object) === null || _currentLink$attribut === void 0 ? void 0 : _currentLink$attribut.displayName,
|
|
279
270
|
ciType: currentLink.attributes.source_type,
|
|
280
271
|
interfaceSource: currentLink.interfaceSource,
|
|
@@ -284,22 +275,20 @@ function AddLinkDrawer(props) {
|
|
|
284
275
|
target: {
|
|
285
276
|
ciData: topo.dataModel.getDataById(currentLink.target),
|
|
286
277
|
id: currentLink.target,
|
|
287
|
-
name: currentLink.attributes[
|
|
288
|
-
ciId: currentLink.attributes[
|
|
289
|
-
ipAddress: currentLink.attributes["network_link.destination_ipv4"],
|
|
278
|
+
name: currentLink.attributes['network_link.destination_device_id_object'].displayName,
|
|
279
|
+
ciId: currentLink.attributes['network_link.destination_device_id'],
|
|
290
280
|
ciName: (_currentLink$attribut2 = currentLink.attributes.destination_type_object) === null || _currentLink$attribut2 === void 0 ? void 0 : _currentLink$attribut2.displayName,
|
|
291
|
-
ciType: currentLink.target !==
|
|
281
|
+
ciType: currentLink.target !== '' ? currentLink.attributes.destination_type : 'customNode',
|
|
292
282
|
interfaceTarget: currentLink.interfaceTarget,
|
|
293
283
|
ports: (_targetPorts$ports = targetPorts.ports) !== null && _targetPorts$ports !== void 0 ? _targetPorts$ports : [],
|
|
294
284
|
portsDoc: targetPorts.portsDoc
|
|
295
285
|
},
|
|
296
286
|
attributes: _extends({}, currentLink.attributes, {
|
|
297
|
-
linkId: currentLink.id
|
|
298
|
-
connect_type: connect_type
|
|
287
|
+
linkId: currentLink.id
|
|
299
288
|
})
|
|
300
289
|
});
|
|
301
290
|
|
|
302
|
-
case
|
|
291
|
+
case 9:
|
|
303
292
|
case "end":
|
|
304
293
|
return _context3.stop();
|
|
305
294
|
}
|
|
@@ -323,89 +312,22 @@ function AddLinkDrawer(props) {
|
|
|
323
312
|
if (!addLinkIsOpen) {
|
|
324
313
|
setLink(null);
|
|
325
314
|
}
|
|
326
|
-
}, [addLinkIsOpen]);
|
|
327
|
-
|
|
328
|
-
var getCiTypesConnectable = /*#__PURE__*/function () {
|
|
329
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
330
|
-
var ciNodes, ciTypes, ciTypesConnectable, nodes, ciIds, isWriteable;
|
|
331
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
332
|
-
while (1) {
|
|
333
|
-
switch (_context4.prev = _context4.next) {
|
|
334
|
-
case 0:
|
|
335
|
-
ciNodes = [];
|
|
336
|
-
setLoadingConnectableNodes(true);
|
|
337
|
-
_context4.prev = 2;
|
|
338
|
-
ciTypes = getCiTypes(topo.dataModel.getData());
|
|
339
|
-
_context4.next = 6;
|
|
340
|
-
return topoService.networkLink.getCiTypesConnectable(ciTypes);
|
|
341
|
-
|
|
342
|
-
case 6:
|
|
343
|
-
ciTypesConnectable = _context4.sent;
|
|
344
|
-
nodes = getNodes(topo.getDataModel());
|
|
345
|
-
ciIds = [];
|
|
346
|
-
|
|
347
|
-
isWriteable = function isWriteable(node) {
|
|
348
|
-
var _node$a;
|
|
349
|
-
|
|
350
|
-
return ["delete", "write"].indexOf(node.a("operation")) >= 0 || ((_node$a = node.a('permission')) === null || _node$a === void 0 ? void 0 : _node$a.writeable);
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
nodes.forEach(function (node) {
|
|
354
|
-
// rlog.debug("过滤属性", node.a("operation"));
|
|
355
|
-
if (ciTypesConnectable[node.a("ciType")] && isWriteable(node)) {
|
|
356
|
-
ciIds.push(node.id);
|
|
357
|
-
ciNodes.push(node);
|
|
358
|
-
}
|
|
359
|
-
});
|
|
360
|
-
linkDispatchers.update({
|
|
361
|
-
ciConnectable: ciIds
|
|
362
|
-
});
|
|
363
|
-
setCiIdsConnectable(ciIds);
|
|
364
|
-
_context4.next = 18;
|
|
365
|
-
break;
|
|
366
|
-
|
|
367
|
-
case 15:
|
|
368
|
-
_context4.prev = 15;
|
|
369
|
-
_context4.t0 = _context4["catch"](2);
|
|
370
|
-
rlog.error('查询可创建链路节点失败', _context4.t0);
|
|
371
|
-
|
|
372
|
-
case 18:
|
|
373
|
-
setLoadingConnectableNodes(false);
|
|
374
|
-
return _context4.abrupt("return", ciNodes);
|
|
375
|
-
|
|
376
|
-
case 20:
|
|
377
|
-
case "end":
|
|
378
|
-
return _context4.stop();
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
}, _callee4, null, [[2, 15]]);
|
|
382
|
-
}));
|
|
383
|
-
|
|
384
|
-
return function getCiTypesConnectable() {
|
|
385
|
-
return _ref4.apply(this, arguments);
|
|
386
|
-
};
|
|
387
|
-
}(); // 注册事件
|
|
388
|
-
|
|
315
|
+
}, [addLinkIsOpen]); // 注册事件
|
|
389
316
|
|
|
390
317
|
useEffect(function () {
|
|
391
318
|
var notifier = topo.view.topoClient.notifier; // rlog.debug("注册事件");
|
|
392
|
-
//
|
|
319
|
+
// 进入链路模式
|
|
393
320
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
topo.view.topoClient.emitEvent("topo_link_set_connectable_nodes", ciNodes);
|
|
398
|
-
});
|
|
399
|
-
};
|
|
321
|
+
notifier.on(TopoCenterEvent.TOPO_LINK_ENTER_CREATE_MODE, enterAddLinkMode); // 选择第一个节点
|
|
322
|
+
|
|
323
|
+
notifier.on(TopoCenterEvent.TOPO_LINK_SELECT_SOURCE_NODE, handleSelectSourceNodeEvent); // 选择第二个节点
|
|
400
324
|
|
|
401
|
-
notifier.on(TopoCenterEvent.
|
|
402
|
-
notifier.on(TopoCenterEvent.TOPO_LINK_CREATED, handleEvent);
|
|
403
|
-
notifier.on(TopoCenterEvent.TOPO_LINK_SELECT_SOURCE_NODE, selectedSourceNodeHandleEvent);
|
|
325
|
+
notifier.on(TopoCenterEvent.TOPO_LINK_CREATED, handleSelectTargetNodeEvent);
|
|
404
326
|
return function () {
|
|
405
327
|
// 取消注册事件
|
|
406
328
|
// rlog.debug("取消注册事件");
|
|
407
|
-
notifier.off(TopoCenterEvent.TOPO_LINK_ENTER_CREATE_MODE,
|
|
408
|
-
notifier.off(TopoCenterEvent.TOPO_LINK_CREATED,
|
|
329
|
+
notifier.off(TopoCenterEvent.TOPO_LINK_ENTER_CREATE_MODE, enterAddLinkMode);
|
|
330
|
+
notifier.off(TopoCenterEvent.TOPO_LINK_CREATED, handleSelectTargetNodeEvent);
|
|
409
331
|
};
|
|
410
332
|
}, []);
|
|
411
333
|
|
|
@@ -420,7 +342,7 @@ function AddLinkDrawer(props) {
|
|
|
420
342
|
ciId: attrObject.id,
|
|
421
343
|
ipAddress: attrObject.ipAddress,
|
|
422
344
|
ciName: (_topo$ciTyeCache$getC = (_topo$ciTyeCache$getC2 = topo.ciTyeCache.getCiType(attrObject.ciType)) === null || _topo$ciTyeCache$getC2 === void 0 ? void 0 : _topo$ciTyeCache$getC2.displayName) !== null && _topo$ciTyeCache$getC !== void 0 ? _topo$ciTyeCache$getC : attrObject.customName,
|
|
423
|
-
ciType: (_attrObject$ciType = attrObject.ciType) !== null && _attrObject$ciType !== void 0 ? _attrObject$ciType :
|
|
345
|
+
ciType: (_attrObject$ciType = attrObject.ciType) !== null && _attrObject$ciType !== void 0 ? _attrObject$ciType : 'customNode',
|
|
424
346
|
ports: (_Ports$ports = Ports.ports) !== null && _Ports$ports !== void 0 ? _Ports$ports : [],
|
|
425
347
|
portsDoc: Ports.portsDoc
|
|
426
348
|
};
|
|
@@ -435,10 +357,10 @@ function AddLinkDrawer(props) {
|
|
|
435
357
|
});
|
|
436
358
|
};
|
|
437
359
|
|
|
438
|
-
var addLinkToGraph = function addLinkToGraph(
|
|
439
|
-
var linkData =
|
|
440
|
-
|
|
441
|
-
targetName =
|
|
360
|
+
var addLinkToGraph = function addLinkToGraph(_ref4) {
|
|
361
|
+
var linkData = _ref4.linkData,
|
|
362
|
+
isExportLink = _ref4.isExportLink,
|
|
363
|
+
targetName = _ref4.targetName;
|
|
442
364
|
var htTopo = topo.getHtTopo();
|
|
443
365
|
var _linkNodesRef$current = linkNodesRef.current,
|
|
444
366
|
source = _linkNodesRef$current.source,
|
|
@@ -447,8 +369,9 @@ function AddLinkDrawer(props) {
|
|
|
447
369
|
try {
|
|
448
370
|
// 获取两个节点间的连线数据列表
|
|
449
371
|
var edgesInNodes = getEdgesBetweenNodes(source, target);
|
|
372
|
+
var _isGroup = false; // linkType === "agg"
|
|
450
373
|
|
|
451
|
-
if (
|
|
374
|
+
if (_isGroup) {
|
|
452
375
|
// 聚合链路
|
|
453
376
|
if (edgesInNodes.length === 0) {
|
|
454
377
|
htTopo.createEdge(source, target, linkData);
|
|
@@ -462,9 +385,9 @@ function AddLinkDrawer(props) {
|
|
|
462
385
|
// 有连线组无子连线时,设置连线数据,切换到连线并选中
|
|
463
386
|
var edge = htTopo.createEdge(source, target, linkData);
|
|
464
387
|
|
|
465
|
-
if (
|
|
388
|
+
if (isExportLink && target.getTag() === undefined) {
|
|
466
389
|
// rlog.debug("addLinkToGraph-export-target", target, target.getTag());
|
|
467
|
-
target.a(
|
|
390
|
+
target.a('name', targetName);
|
|
468
391
|
}
|
|
469
392
|
|
|
470
393
|
htTopo.toggleEdgeGroup(source, target, true);
|
|
@@ -472,30 +395,30 @@ function AddLinkDrawer(props) {
|
|
|
472
395
|
|
|
473
396
|
topo.getGraphView().dm().sm().ss(topo.getDataModel().getDataByTag(linkData.id));
|
|
474
397
|
} catch (error) {
|
|
475
|
-
rlog.error(
|
|
398
|
+
rlog.error('addLinkToGraph', error);
|
|
476
399
|
}
|
|
477
400
|
};
|
|
478
401
|
|
|
479
|
-
var mergeExportLinkData = function mergeExportLinkData(data, attributes) {
|
|
402
|
+
var mergeExportLinkData = function mergeExportLinkData(data, attributes, linkFormAttributes) {
|
|
480
403
|
var _sourceIFDoc$data$sou, _targetIFDoc$data$des;
|
|
481
404
|
|
|
482
405
|
// console.log("mergeExportLinkData", data, attributes);
|
|
483
406
|
return _extends({}, attributes, {
|
|
484
407
|
id: data.id,
|
|
485
408
|
name: data.name,
|
|
486
|
-
source: data[
|
|
487
|
-
target: data[
|
|
409
|
+
source: data['network_link.source_device_id'],
|
|
410
|
+
target: data['network_link.destination_device_id'],
|
|
488
411
|
operation: data.operation,
|
|
489
|
-
interfaceSource: data[
|
|
490
|
-
interfaceTarget: data[
|
|
412
|
+
interfaceSource: data['source_id'],
|
|
413
|
+
interfaceTarget: data['destination_id'],
|
|
491
414
|
ciType: data.ciType,
|
|
492
|
-
attributes: _extends({}, attributes.attributes, {
|
|
415
|
+
attributes: _extends({}, attributes.attributes, linkFormAttributes, {
|
|
493
416
|
display_name: data.display_name,
|
|
494
417
|
name: data.name,
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
418
|
+
'network_link.actual_bandwidth': data['network_link.actual_bandwidth'],
|
|
419
|
+
'network_link.connect_type': data['network_link.connect_type'],
|
|
420
|
+
'network_link.destination_ipv4': data['network_link.destination_ipv4'],
|
|
421
|
+
'network_link.source_device_id': data['network_link.source_device_id'],
|
|
499
422
|
source_id: data.source_id,
|
|
500
423
|
support_templates: data.support_templates,
|
|
501
424
|
use: data.use,
|
|
@@ -510,12 +433,12 @@ function AddLinkDrawer(props) {
|
|
|
510
433
|
};
|
|
511
434
|
|
|
512
435
|
var onSave = /*#__PURE__*/function () {
|
|
513
|
-
var
|
|
514
|
-
var parm, result,
|
|
436
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
|
|
437
|
+
var parm, result, config, isExportLink, exportLinkIdList, _yield$editDispatcher, elements, linkData, edge, aobj, target, links, linkAttrKey, newLinkData, newLinks, newData, _config, _yield$editDispatcher2, _elements;
|
|
515
438
|
|
|
516
|
-
return _regeneratorRuntime.wrap(function
|
|
439
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
517
440
|
while (1) {
|
|
518
|
-
switch (
|
|
441
|
+
switch (_context4.prev = _context4.next) {
|
|
519
442
|
case 0:
|
|
520
443
|
//editDispatchers.update({ addLinkIsOpen: false });
|
|
521
444
|
// console.log("保存链路信息", isAddMode, data);
|
|
@@ -526,77 +449,80 @@ function AddLinkDrawer(props) {
|
|
|
526
449
|
result = null;
|
|
527
450
|
|
|
528
451
|
if (!isAddMode) {
|
|
529
|
-
|
|
452
|
+
_context4.next = 9;
|
|
530
453
|
break;
|
|
531
454
|
}
|
|
532
455
|
|
|
533
|
-
|
|
456
|
+
_context4.next = 6;
|
|
534
457
|
return service.addLink(parm);
|
|
535
458
|
|
|
536
459
|
case 6:
|
|
537
|
-
result =
|
|
538
|
-
|
|
460
|
+
result = _context4.sent;
|
|
461
|
+
_context4.next = 13;
|
|
539
462
|
break;
|
|
540
463
|
|
|
541
464
|
case 9:
|
|
542
465
|
parm.id = currentLink.id;
|
|
543
|
-
|
|
466
|
+
_context4.next = 12;
|
|
544
467
|
return service.editLink(parm);
|
|
545
468
|
|
|
546
469
|
case 12:
|
|
547
|
-
result =
|
|
470
|
+
result = _context4.sent;
|
|
548
471
|
|
|
549
472
|
case 13:
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
_context5.prev = 15;
|
|
473
|
+
topo.historyManager.setDisabled(true, '保存链路');
|
|
474
|
+
_context4.prev = 14;
|
|
553
475
|
|
|
554
476
|
if (!result) {
|
|
555
|
-
|
|
477
|
+
_context4.next = 59;
|
|
556
478
|
break;
|
|
557
479
|
}
|
|
558
480
|
|
|
559
|
-
config = topo.resourceConfig.getConfigFromHt();
|
|
481
|
+
config = topo.resourceConfig.getConfigFromHt();
|
|
482
|
+
isExportLink = !data['network_link.destination_device_id']; // 新建后显示到图上
|
|
560
483
|
|
|
561
484
|
if (!isAddMode) {
|
|
562
|
-
|
|
485
|
+
_context4.next = 33;
|
|
563
486
|
break;
|
|
564
487
|
}
|
|
565
488
|
|
|
566
489
|
exportLinkIdList = config.exportLinkIdList;
|
|
567
490
|
|
|
568
|
-
if (
|
|
491
|
+
if (isExportLink) {
|
|
569
492
|
exportLinkIdList.push(result);
|
|
570
493
|
}
|
|
571
494
|
|
|
572
|
-
|
|
495
|
+
_context4.next = 23;
|
|
496
|
+
return topo.resourceConfig.updateConfig(_extends({}, config, {
|
|
573
497
|
exportLinkIdList: exportLinkIdList
|
|
574
|
-
}));
|
|
498
|
+
}));
|
|
575
499
|
|
|
576
|
-
|
|
500
|
+
case 23:
|
|
501
|
+
_context4.next = 25;
|
|
577
502
|
return editDispatchers.fetchDataByConfig();
|
|
578
503
|
|
|
579
|
-
case
|
|
580
|
-
_yield$editDispatcher =
|
|
504
|
+
case 25:
|
|
505
|
+
_yield$editDispatcher = _context4.sent;
|
|
581
506
|
elements = _yield$editDispatcher.elements;
|
|
582
507
|
linkData = elements.find(function (element) {
|
|
583
508
|
return element.id === result;
|
|
584
509
|
}); // console.log("创建成功-parm,linkData", parm, linkData);
|
|
585
510
|
|
|
511
|
+
topo.historyManager.setDisabled(true, '保存链路');
|
|
586
512
|
addLinkToGraph({
|
|
587
513
|
linkData: clone(linkData),
|
|
588
|
-
|
|
589
|
-
targetName: data[
|
|
514
|
+
isExportLink: isExportLink,
|
|
515
|
+
targetName: data['network_link.destination_ipv4']
|
|
590
516
|
});
|
|
591
517
|
|
|
592
|
-
_Message.success(
|
|
518
|
+
_Message.success('创建成功');
|
|
593
519
|
|
|
594
|
-
|
|
520
|
+
_context4.next = 56;
|
|
595
521
|
break;
|
|
596
522
|
|
|
597
|
-
case
|
|
598
|
-
if (!
|
|
599
|
-
|
|
523
|
+
case 33:
|
|
524
|
+
if (!isExportLink) {
|
|
525
|
+
_context4.next = 49;
|
|
600
526
|
break;
|
|
601
527
|
}
|
|
602
528
|
|
|
@@ -606,64 +532,77 @@ function AddLinkDrawer(props) {
|
|
|
606
532
|
target = edge.getTarget();
|
|
607
533
|
|
|
608
534
|
if (target.getTag() === undefined) {
|
|
609
|
-
target.a(
|
|
535
|
+
target.a('name', data['network_link.destination_ipv4']);
|
|
610
536
|
}
|
|
611
537
|
|
|
612
538
|
links = topoState.data.links;
|
|
613
539
|
linkAttrKey = links.findIndex(function (item) {
|
|
614
540
|
return item.id === aobj.id;
|
|
615
541
|
});
|
|
616
|
-
newLinkData = mergeExportLinkData(edge.getAttrObject(), links[linkAttrKey]);
|
|
542
|
+
newLinkData = mergeExportLinkData(edge.getAttrObject(), links[linkAttrKey], data);
|
|
617
543
|
newLinks = clone(links);
|
|
618
544
|
newLinks.splice(linkAttrKey, 1, newLinkData);
|
|
619
545
|
newData = _extends({}, topoState.data, {
|
|
620
546
|
links: newLinks
|
|
621
547
|
});
|
|
622
|
-
|
|
548
|
+
_context4.next = 47;
|
|
549
|
+
return topoDispatchers.update({
|
|
623
550
|
data: newData
|
|
624
551
|
});
|
|
625
|
-
|
|
552
|
+
|
|
553
|
+
case 47:
|
|
554
|
+
_context4.next = 55;
|
|
626
555
|
break;
|
|
627
556
|
|
|
628
|
-
case
|
|
557
|
+
case 49:
|
|
629
558
|
_config = topo.resourceConfig.getConfigFromHt();
|
|
630
559
|
topo.resourceConfig.updateConfig(_config);
|
|
631
|
-
|
|
560
|
+
_context4.next = 53;
|
|
632
561
|
return editDispatchers.fetchDataByConfig();
|
|
633
562
|
|
|
634
|
-
case
|
|
635
|
-
_yield$editDispatcher2 =
|
|
563
|
+
case 53:
|
|
564
|
+
_yield$editDispatcher2 = _context4.sent;
|
|
636
565
|
_elements = _yield$editDispatcher2.elements;
|
|
637
566
|
|
|
638
|
-
case
|
|
639
|
-
_Message.success(
|
|
567
|
+
case 55:
|
|
568
|
+
_Message.success('保存成功');
|
|
640
569
|
|
|
641
|
-
case
|
|
642
|
-
|
|
570
|
+
case 56:
|
|
571
|
+
_context4.next = 58;
|
|
572
|
+
return editDispatchers.update({
|
|
643
573
|
addLinkIsOpen: false,
|
|
644
574
|
currentLink: null
|
|
645
575
|
});
|
|
576
|
+
|
|
577
|
+
case 58:
|
|
646
578
|
topo.linkDynamicStyleExecutor.execute();
|
|
647
579
|
|
|
648
|
-
case
|
|
649
|
-
|
|
580
|
+
case 59:
|
|
581
|
+
_context4.next = 65;
|
|
650
582
|
break;
|
|
651
583
|
|
|
652
|
-
case
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
584
|
+
case 61:
|
|
585
|
+
_context4.prev = 61;
|
|
586
|
+
_context4.t0 = _context4["catch"](14);
|
|
587
|
+
|
|
588
|
+
_Message.error('保存失败');
|
|
589
|
+
|
|
590
|
+
rlog.error('保存链路信息异常', _context4.t0);
|
|
656
591
|
|
|
657
|
-
case
|
|
592
|
+
case 65:
|
|
593
|
+
setLoading(false);
|
|
594
|
+
topo.historyManager.setDisabled(false, '保存链路');
|
|
595
|
+
|
|
596
|
+
case 67:
|
|
658
597
|
case "end":
|
|
659
|
-
return
|
|
598
|
+
return _context4.stop();
|
|
660
599
|
}
|
|
661
600
|
}
|
|
662
|
-
},
|
|
601
|
+
}, _callee4, null, [[14, 61]]);
|
|
663
602
|
}));
|
|
664
603
|
|
|
665
604
|
return function onSave(_x4) {
|
|
666
|
-
return
|
|
605
|
+
return _ref5.apply(this, arguments);
|
|
667
606
|
};
|
|
668
607
|
}();
|
|
669
608
|
|
|
@@ -674,10 +613,10 @@ function AddLinkDrawer(props) {
|
|
|
674
613
|
visible: loadingFormData,
|
|
675
614
|
fullScreen: true
|
|
676
615
|
}), /*#__PURE__*/React.createElement(_Drawer, {
|
|
677
|
-
closeMode: [
|
|
616
|
+
closeMode: ['close', 'esc'],
|
|
678
617
|
visible: addLinkIsOpen,
|
|
679
618
|
onClose: closeDrawer,
|
|
680
|
-
title: isAddMode ?
|
|
619
|
+
title: isAddMode ? '添加链路' : '编辑链路',
|
|
681
620
|
className: styles.drawer
|
|
682
621
|
}, addLinkIsOpen && link && /*#__PURE__*/React.createElement(EditLinkInfo, {
|
|
683
622
|
lineData: link,
|