@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
|
@@ -19,8 +19,6 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
19
19
|
|
|
20
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
21
|
|
|
22
|
-
var _topo = _interopRequireDefault(require("@riil-frontend/component-topology-common/es/services/topo"));
|
|
23
|
-
|
|
24
22
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
25
23
|
|
|
26
24
|
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
|
|
@@ -39,7 +37,7 @@ var _linkUtils = require("../../../../../../core/models/utils/linkUtils");
|
|
|
39
37
|
|
|
40
38
|
var _htElementUtils = require("../../../../../../utils/htElementUtils");
|
|
41
39
|
|
|
42
|
-
var
|
|
40
|
+
var _useAddLink2 = _interopRequireDefault(require("./hooks/useAddLink"));
|
|
43
41
|
|
|
44
42
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
45
43
|
|
|
@@ -50,18 +48,14 @@ function AddLinkDrawer(props) {
|
|
|
50
48
|
lineData = props.lineData;
|
|
51
49
|
var store = topo.store;
|
|
52
50
|
|
|
53
|
-
var _topo$store$useModel = topo.store.useModel(
|
|
51
|
+
var _topo$store$useModel = topo.store.useModel('topoMod'),
|
|
54
52
|
topoState = _topo$store$useModel[0],
|
|
55
53
|
topoDispatchers = _topo$store$useModel[1];
|
|
56
54
|
|
|
57
|
-
var _store$useModel = store.useModel(
|
|
55
|
+
var _store$useModel = store.useModel('topoConfig'),
|
|
58
56
|
editState = _store$useModel[0],
|
|
59
57
|
editDispatchers = _store$useModel[1];
|
|
60
58
|
|
|
61
|
-
var _store$useModel2 = store.useModel("topoLinkMod"),
|
|
62
|
-
linkState = _store$useModel2[0],
|
|
63
|
-
linkDispatchers = _store$useModel2[1];
|
|
64
|
-
|
|
65
59
|
var addLinkIsOpen = editState.addLinkIsOpen,
|
|
66
60
|
currentLink = editState.currentLink;
|
|
67
61
|
|
|
@@ -78,28 +72,27 @@ function AddLinkDrawer(props) {
|
|
|
78
72
|
setLoading = _useState3[1];
|
|
79
73
|
|
|
80
74
|
var _useState4 = (0, _react.useState)(false),
|
|
81
|
-
|
|
82
|
-
|
|
75
|
+
loadingFormData = _useState4[0],
|
|
76
|
+
setLoadingFormData = _useState4[1];
|
|
83
77
|
|
|
84
|
-
var _useState5 = (0, _react.useState)(
|
|
85
|
-
|
|
86
|
-
|
|
78
|
+
var _useState5 = (0, _react.useState)(),
|
|
79
|
+
sourceIFDoc = _useState5[0],
|
|
80
|
+
setSourceIFDoc = _useState5[1];
|
|
87
81
|
|
|
88
82
|
var _useState6 = (0, _react.useState)(),
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
var _useState7 = (0, _react.useState)(),
|
|
93
|
-
targetIFDoc = _useState7[0],
|
|
94
|
-
setTargetIFDoc = _useState7[1]; // 保存后更新拓扑图状态
|
|
95
|
-
|
|
83
|
+
targetIFDoc = _useState6[0],
|
|
84
|
+
setTargetIFDoc = _useState6[1]; // 保存后更新拓扑图状态
|
|
96
85
|
|
|
97
|
-
var _useState8 = (0, _react.useState)([]),
|
|
98
|
-
ciIdsConnectable = _useState8[0],
|
|
99
|
-
setCiIdsConnectable = _useState8[1];
|
|
100
86
|
|
|
101
87
|
var linkNodesRef = (0, _react.useRef)();
|
|
102
88
|
|
|
89
|
+
var _useAddLink = (0, _useAddLink2["default"])({
|
|
90
|
+
topo: topo
|
|
91
|
+
}),
|
|
92
|
+
enterAddLinkMode = _useAddLink.enterAddLinkMode,
|
|
93
|
+
resetConnectableNodes = _useAddLink.resetConnectableNodes,
|
|
94
|
+
loadingConnectableNodes = _useAddLink.loadingConnectableNodes;
|
|
95
|
+
|
|
103
96
|
var getPortsById = /*#__PURE__*/function () {
|
|
104
97
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(id, currentLink) {
|
|
105
98
|
var result, links, ifTypes, ifDoc, usedPorts, portsDoc, ports;
|
|
@@ -107,7 +100,7 @@ function AddLinkDrawer(props) {
|
|
|
107
100
|
while (1) {
|
|
108
101
|
switch (_context.prev = _context.next) {
|
|
109
102
|
case 0:
|
|
110
|
-
console.log(
|
|
103
|
+
console.log('getPortsById', id, currentLink);
|
|
111
104
|
|
|
112
105
|
if (id) {
|
|
113
106
|
_context.next = 3;
|
|
@@ -159,12 +152,14 @@ function AddLinkDrawer(props) {
|
|
|
159
152
|
value: item.id,
|
|
160
153
|
label: item.name,
|
|
161
154
|
type: item.type,
|
|
162
|
-
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 :
|
|
155
|
+
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 : '',
|
|
163
156
|
disabled: usedPorts.indexOf(item.id) >= 0,
|
|
164
157
|
ratedBandwidth: parseInt(item.ratedBandwidth, 10)
|
|
165
158
|
};
|
|
166
159
|
portsDoc[item.id] = obj;
|
|
167
160
|
return obj;
|
|
161
|
+
}).filter(function (item) {
|
|
162
|
+
return !item.disabled;
|
|
168
163
|
});
|
|
169
164
|
return _context.abrupt("return", {
|
|
170
165
|
ports: ports,
|
|
@@ -189,98 +184,96 @@ function AddLinkDrawer(props) {
|
|
|
189
184
|
*/
|
|
190
185
|
|
|
191
186
|
|
|
192
|
-
var
|
|
187
|
+
var handleSelectTargetNodeEvent = /*#__PURE__*/function () {
|
|
193
188
|
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(e) {
|
|
194
|
-
var sourcePorts, targetPorts, source, target
|
|
189
|
+
var sourcePorts, targetPorts, source, target;
|
|
195
190
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
196
191
|
while (1) {
|
|
197
192
|
switch (_context2.prev = _context2.next) {
|
|
198
193
|
case 0:
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
_rlog["default"].debug("接到打开创建链路抽屉信息", e);
|
|
194
|
+
resetConnectableNodes();
|
|
195
|
+
linkNodesRef.current = e;
|
|
202
196
|
|
|
203
|
-
|
|
197
|
+
_rlog["default"].debug('接到打开创建链路抽屉信息', e);
|
|
204
198
|
|
|
199
|
+
setIsAddMode(true);
|
|
205
200
|
setLoadingFormData(true);
|
|
206
|
-
_context2.prev =
|
|
207
|
-
_context2.next =
|
|
201
|
+
_context2.prev = 5;
|
|
202
|
+
_context2.next = 8;
|
|
208
203
|
return getPortsById(e.source._attrObject.id);
|
|
209
204
|
|
|
210
|
-
case
|
|
205
|
+
case 8:
|
|
211
206
|
sourcePorts = _context2.sent;
|
|
212
|
-
_context2.next =
|
|
207
|
+
_context2.next = 11;
|
|
213
208
|
return getPortsById(e.target._attrObject.id);
|
|
214
209
|
|
|
215
|
-
case
|
|
210
|
+
case 11:
|
|
216
211
|
targetPorts = _context2.sent;
|
|
217
212
|
setSourceIFDoc(sourcePorts.portsDoc);
|
|
218
213
|
setTargetIFDoc(targetPorts.portsDoc);
|
|
219
214
|
source = translationNode(e.source, sourcePorts);
|
|
220
215
|
target = translationNode(e.target, targetPorts);
|
|
221
|
-
targetDisableCreatePhyAggLink = !target.ciData || !(target.ciData.permission.writeable || target.ciData.permission.deleteable);
|
|
222
216
|
editDispatchers.update({
|
|
223
217
|
addLinkIsOpen: true,
|
|
224
218
|
currentLink: null
|
|
225
219
|
});
|
|
226
|
-
connect_type = target.ciType !== "customNode" && target.ipAddress && targetPorts.ports.length > 0 && !targetDisableCreatePhyAggLink ? "phy" : "exit";
|
|
227
220
|
setLink({
|
|
228
221
|
source: source,
|
|
229
222
|
target: target,
|
|
230
223
|
attributes: {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
connect_type: connect_type
|
|
224
|
+
display_name: '',
|
|
225
|
+
name: '',
|
|
226
|
+
source_id: '',
|
|
227
|
+
source_type: '',
|
|
228
|
+
'network_link.source_device_id': source.id,
|
|
229
|
+
'network_link.source_device_ipv4': source.ipAddress,
|
|
230
|
+
destination_id: '',
|
|
231
|
+
destination_type: '',
|
|
232
|
+
'network_link.destination_device_id': target.id,
|
|
233
|
+
'network_link.destination_device_ipv4': target.ipAddress,
|
|
234
|
+
'network_link.actual_bandwidth': null
|
|
243
235
|
}
|
|
244
236
|
});
|
|
245
|
-
_context2.next =
|
|
237
|
+
_context2.next = 23;
|
|
246
238
|
break;
|
|
247
239
|
|
|
248
|
-
case
|
|
249
|
-
_context2.prev =
|
|
250
|
-
_context2.t0 = _context2["catch"](
|
|
240
|
+
case 20:
|
|
241
|
+
_context2.prev = 20;
|
|
242
|
+
_context2.t0 = _context2["catch"](5);
|
|
251
243
|
|
|
252
|
-
_rlog["default"].error(
|
|
244
|
+
_rlog["default"].error('出现异常', _context2.t0);
|
|
253
245
|
|
|
254
|
-
case
|
|
246
|
+
case 23:
|
|
255
247
|
setLoadingFormData(false);
|
|
256
248
|
|
|
257
|
-
case
|
|
249
|
+
case 24:
|
|
258
250
|
case "end":
|
|
259
251
|
return _context2.stop();
|
|
260
252
|
}
|
|
261
253
|
}
|
|
262
|
-
}, _callee2, null, [[
|
|
254
|
+
}, _callee2, null, [[5, 20]]);
|
|
263
255
|
}));
|
|
264
256
|
|
|
265
|
-
return function
|
|
257
|
+
return function handleSelectTargetNodeEvent(_x3) {
|
|
266
258
|
return _ref2.apply(this, arguments);
|
|
267
259
|
};
|
|
268
260
|
}();
|
|
269
261
|
|
|
270
|
-
var
|
|
262
|
+
var handleSelectSourceNodeEvent = function handleSelectSourceNodeEvent(e) {
|
|
271
263
|
// rlog.debug("设置了起始节点", e);
|
|
272
|
-
|
|
264
|
+
topo.historyManager.setDisabled(true);
|
|
273
265
|
var enableNodes = (0, _htElementUtils.getNodes)(topo.getDataModel());
|
|
274
|
-
topo.view.topoClient.emitEvent(
|
|
266
|
+
topo.view.topoClient.emitEvent('topo_link_set_connectable_nodes', enableNodes.filter(function (ele) {
|
|
275
267
|
return !((0, _htElementUtils.isGroup)(ele) && !ele.a('ciType'));
|
|
276
268
|
}));
|
|
269
|
+
topo.historyManager.setDisabled(false);
|
|
277
270
|
};
|
|
278
271
|
|
|
279
272
|
var initEditLineData = /*#__PURE__*/function () {
|
|
280
273
|
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
281
274
|
var _currentLink$attribut, _sourcePorts$ports, _currentLink$attribut2, _targetPorts$ports;
|
|
282
275
|
|
|
283
|
-
var sourcePorts, targetPorts
|
|
276
|
+
var sourcePorts, targetPorts;
|
|
284
277
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
285
278
|
while (1) {
|
|
286
279
|
switch (_context3.prev = _context3.next) {
|
|
@@ -297,14 +290,12 @@ function AddLinkDrawer(props) {
|
|
|
297
290
|
targetPorts = _context3.sent;
|
|
298
291
|
setSourceIFDoc(sourcePorts.portsDoc);
|
|
299
292
|
setTargetIFDoc(targetPorts.portsDoc);
|
|
300
|
-
connect_type = currentLink.attributes["network_link.connect_type"] === "exit" ? "exit" : "phy";
|
|
301
293
|
setLink({
|
|
302
294
|
source: {
|
|
303
295
|
ciData: topo.dataModel.getDataById(currentLink.source),
|
|
304
296
|
id: currentLink.source,
|
|
305
|
-
name: currentLink.attributes[
|
|
306
|
-
ciId: currentLink.attributes[
|
|
307
|
-
ipAddress: currentLink.attributes["network_link.source_ipv4"],
|
|
297
|
+
name: currentLink.attributes['network_link.source_device_id_object'].displayName,
|
|
298
|
+
ciId: currentLink.attributes['network_link.source_device_id'],
|
|
308
299
|
ciName: (_currentLink$attribut = currentLink.attributes.source_type_object) === null || _currentLink$attribut === void 0 ? void 0 : _currentLink$attribut.displayName,
|
|
309
300
|
ciType: currentLink.attributes.source_type,
|
|
310
301
|
interfaceSource: currentLink.interfaceSource,
|
|
@@ -314,22 +305,20 @@ function AddLinkDrawer(props) {
|
|
|
314
305
|
target: {
|
|
315
306
|
ciData: topo.dataModel.getDataById(currentLink.target),
|
|
316
307
|
id: currentLink.target,
|
|
317
|
-
name: currentLink.attributes[
|
|
318
|
-
ciId: currentLink.attributes[
|
|
319
|
-
ipAddress: currentLink.attributes["network_link.destination_ipv4"],
|
|
308
|
+
name: currentLink.attributes['network_link.destination_device_id_object'].displayName,
|
|
309
|
+
ciId: currentLink.attributes['network_link.destination_device_id'],
|
|
320
310
|
ciName: (_currentLink$attribut2 = currentLink.attributes.destination_type_object) === null || _currentLink$attribut2 === void 0 ? void 0 : _currentLink$attribut2.displayName,
|
|
321
|
-
ciType: currentLink.target !==
|
|
311
|
+
ciType: currentLink.target !== '' ? currentLink.attributes.destination_type : 'customNode',
|
|
322
312
|
interfaceTarget: currentLink.interfaceTarget,
|
|
323
313
|
ports: (_targetPorts$ports = targetPorts.ports) !== null && _targetPorts$ports !== void 0 ? _targetPorts$ports : [],
|
|
324
314
|
portsDoc: targetPorts.portsDoc
|
|
325
315
|
},
|
|
326
316
|
attributes: (0, _extends2["default"])({}, currentLink.attributes, {
|
|
327
|
-
linkId: currentLink.id
|
|
328
|
-
connect_type: connect_type
|
|
317
|
+
linkId: currentLink.id
|
|
329
318
|
})
|
|
330
319
|
});
|
|
331
320
|
|
|
332
|
-
case
|
|
321
|
+
case 9:
|
|
333
322
|
case "end":
|
|
334
323
|
return _context3.stop();
|
|
335
324
|
}
|
|
@@ -353,90 +342,22 @@ function AddLinkDrawer(props) {
|
|
|
353
342
|
if (!addLinkIsOpen) {
|
|
354
343
|
setLink(null);
|
|
355
344
|
}
|
|
356
|
-
}, [addLinkIsOpen]);
|
|
357
|
-
|
|
358
|
-
var getCiTypesConnectable = /*#__PURE__*/function () {
|
|
359
|
-
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
360
|
-
var ciNodes, ciTypes, ciTypesConnectable, nodes, ciIds, isWriteable;
|
|
361
|
-
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
362
|
-
while (1) {
|
|
363
|
-
switch (_context4.prev = _context4.next) {
|
|
364
|
-
case 0:
|
|
365
|
-
ciNodes = [];
|
|
366
|
-
setLoadingConnectableNodes(true);
|
|
367
|
-
_context4.prev = 2;
|
|
368
|
-
ciTypes = (0, _topoData.getCiTypes)(topo.dataModel.getData());
|
|
369
|
-
_context4.next = 6;
|
|
370
|
-
return _topo["default"].networkLink.getCiTypesConnectable(ciTypes);
|
|
371
|
-
|
|
372
|
-
case 6:
|
|
373
|
-
ciTypesConnectable = _context4.sent;
|
|
374
|
-
nodes = (0, _htElementUtils.getNodes)(topo.getDataModel());
|
|
375
|
-
ciIds = [];
|
|
376
|
-
|
|
377
|
-
isWriteable = function isWriteable(node) {
|
|
378
|
-
var _node$a;
|
|
379
|
-
|
|
380
|
-
return ["delete", "write"].indexOf(node.a("operation")) >= 0 || ((_node$a = node.a('permission')) === null || _node$a === void 0 ? void 0 : _node$a.writeable);
|
|
381
|
-
};
|
|
382
|
-
|
|
383
|
-
nodes.forEach(function (node) {
|
|
384
|
-
// rlog.debug("过滤属性", node.a("operation"));
|
|
385
|
-
if (ciTypesConnectable[node.a("ciType")] && isWriteable(node)) {
|
|
386
|
-
ciIds.push(node.id);
|
|
387
|
-
ciNodes.push(node);
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
linkDispatchers.update({
|
|
391
|
-
ciConnectable: ciIds
|
|
392
|
-
});
|
|
393
|
-
setCiIdsConnectable(ciIds);
|
|
394
|
-
_context4.next = 18;
|
|
395
|
-
break;
|
|
396
|
-
|
|
397
|
-
case 15:
|
|
398
|
-
_context4.prev = 15;
|
|
399
|
-
_context4.t0 = _context4["catch"](2);
|
|
400
|
-
|
|
401
|
-
_rlog["default"].error('查询可创建链路节点失败', _context4.t0);
|
|
402
|
-
|
|
403
|
-
case 18:
|
|
404
|
-
setLoadingConnectableNodes(false);
|
|
405
|
-
return _context4.abrupt("return", ciNodes);
|
|
406
|
-
|
|
407
|
-
case 20:
|
|
408
|
-
case "end":
|
|
409
|
-
return _context4.stop();
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
}, _callee4, null, [[2, 15]]);
|
|
413
|
-
}));
|
|
414
|
-
|
|
415
|
-
return function getCiTypesConnectable() {
|
|
416
|
-
return _ref4.apply(this, arguments);
|
|
417
|
-
};
|
|
418
|
-
}(); // 注册事件
|
|
419
|
-
|
|
345
|
+
}, [addLinkIsOpen]); // 注册事件
|
|
420
346
|
|
|
421
347
|
(0, _react.useEffect)(function () {
|
|
422
348
|
var notifier = topo.view.topoClient.notifier; // rlog.debug("注册事件");
|
|
423
|
-
//
|
|
349
|
+
// 进入链路模式
|
|
424
350
|
|
|
425
|
-
|
|
426
|
-
getCiTypesConnectable().then(function (ciNodes) {
|
|
427
|
-
// rlog.debug("设置可连线节点", ciIdsConnectable, ciNodes);
|
|
428
|
-
topo.view.topoClient.emitEvent("topo_link_set_connectable_nodes", ciNodes);
|
|
429
|
-
});
|
|
430
|
-
};
|
|
351
|
+
notifier.on(_event["default"].TOPO_LINK_ENTER_CREATE_MODE, enterAddLinkMode); // 选择第一个节点
|
|
431
352
|
|
|
432
|
-
notifier.on(_event["default"].
|
|
433
|
-
|
|
434
|
-
notifier.on(_event["default"].
|
|
353
|
+
notifier.on(_event["default"].TOPO_LINK_SELECT_SOURCE_NODE, handleSelectSourceNodeEvent); // 选择第二个节点
|
|
354
|
+
|
|
355
|
+
notifier.on(_event["default"].TOPO_LINK_CREATED, handleSelectTargetNodeEvent);
|
|
435
356
|
return function () {
|
|
436
357
|
// 取消注册事件
|
|
437
358
|
// rlog.debug("取消注册事件");
|
|
438
|
-
notifier.off(_event["default"].TOPO_LINK_ENTER_CREATE_MODE,
|
|
439
|
-
notifier.off(_event["default"].TOPO_LINK_CREATED,
|
|
359
|
+
notifier.off(_event["default"].TOPO_LINK_ENTER_CREATE_MODE, enterAddLinkMode);
|
|
360
|
+
notifier.off(_event["default"].TOPO_LINK_CREATED, handleSelectTargetNodeEvent);
|
|
440
361
|
};
|
|
441
362
|
}, []);
|
|
442
363
|
|
|
@@ -451,7 +372,7 @@ function AddLinkDrawer(props) {
|
|
|
451
372
|
ciId: attrObject.id,
|
|
452
373
|
ipAddress: attrObject.ipAddress,
|
|
453
374
|
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,
|
|
454
|
-
ciType: (_attrObject$ciType = attrObject.ciType) !== null && _attrObject$ciType !== void 0 ? _attrObject$ciType :
|
|
375
|
+
ciType: (_attrObject$ciType = attrObject.ciType) !== null && _attrObject$ciType !== void 0 ? _attrObject$ciType : 'customNode',
|
|
455
376
|
ports: (_Ports$ports = Ports.ports) !== null && _Ports$ports !== void 0 ? _Ports$ports : [],
|
|
456
377
|
portsDoc: Ports.portsDoc
|
|
457
378
|
};
|
|
@@ -466,10 +387,10 @@ function AddLinkDrawer(props) {
|
|
|
466
387
|
});
|
|
467
388
|
};
|
|
468
389
|
|
|
469
|
-
var addLinkToGraph = function addLinkToGraph(
|
|
470
|
-
var linkData =
|
|
471
|
-
|
|
472
|
-
targetName =
|
|
390
|
+
var addLinkToGraph = function addLinkToGraph(_ref4) {
|
|
391
|
+
var linkData = _ref4.linkData,
|
|
392
|
+
isExportLink = _ref4.isExportLink,
|
|
393
|
+
targetName = _ref4.targetName;
|
|
473
394
|
var htTopo = topo.getHtTopo();
|
|
474
395
|
var _linkNodesRef$current = linkNodesRef.current,
|
|
475
396
|
source = _linkNodesRef$current.source,
|
|
@@ -478,8 +399,9 @@ function AddLinkDrawer(props) {
|
|
|
478
399
|
try {
|
|
479
400
|
// 获取两个节点间的连线数据列表
|
|
480
401
|
var edgesInNodes = (0, _htElementUtils.getEdgesBetweenNodes)(source, target);
|
|
402
|
+
var _isGroup = false; // linkType === "agg"
|
|
481
403
|
|
|
482
|
-
if (
|
|
404
|
+
if (_isGroup) {
|
|
483
405
|
// 聚合链路
|
|
484
406
|
if (edgesInNodes.length === 0) {
|
|
485
407
|
htTopo.createEdge(source, target, linkData);
|
|
@@ -493,9 +415,9 @@ function AddLinkDrawer(props) {
|
|
|
493
415
|
// 有连线组无子连线时,设置连线数据,切换到连线并选中
|
|
494
416
|
var edge = htTopo.createEdge(source, target, linkData);
|
|
495
417
|
|
|
496
|
-
if (
|
|
418
|
+
if (isExportLink && target.getTag() === undefined) {
|
|
497
419
|
// rlog.debug("addLinkToGraph-export-target", target, target.getTag());
|
|
498
|
-
target.a(
|
|
420
|
+
target.a('name', targetName);
|
|
499
421
|
}
|
|
500
422
|
|
|
501
423
|
htTopo.toggleEdgeGroup(source, target, true);
|
|
@@ -503,30 +425,30 @@ function AddLinkDrawer(props) {
|
|
|
503
425
|
|
|
504
426
|
topo.getGraphView().dm().sm().ss(topo.getDataModel().getDataByTag(linkData.id));
|
|
505
427
|
} catch (error) {
|
|
506
|
-
_rlog["default"].error(
|
|
428
|
+
_rlog["default"].error('addLinkToGraph', error);
|
|
507
429
|
}
|
|
508
430
|
};
|
|
509
431
|
|
|
510
|
-
var mergeExportLinkData = function mergeExportLinkData(data, attributes) {
|
|
432
|
+
var mergeExportLinkData = function mergeExportLinkData(data, attributes, linkFormAttributes) {
|
|
511
433
|
var _sourceIFDoc$data$sou, _targetIFDoc$data$des;
|
|
512
434
|
|
|
513
435
|
// console.log("mergeExportLinkData", data, attributes);
|
|
514
436
|
return (0, _extends2["default"])({}, attributes, {
|
|
515
437
|
id: data.id,
|
|
516
438
|
name: data.name,
|
|
517
|
-
source: data[
|
|
518
|
-
target: data[
|
|
439
|
+
source: data['network_link.source_device_id'],
|
|
440
|
+
target: data['network_link.destination_device_id'],
|
|
519
441
|
operation: data.operation,
|
|
520
|
-
interfaceSource: data[
|
|
521
|
-
interfaceTarget: data[
|
|
442
|
+
interfaceSource: data['source_id'],
|
|
443
|
+
interfaceTarget: data['destination_id'],
|
|
522
444
|
ciType: data.ciType,
|
|
523
|
-
attributes: (0, _extends2["default"])({}, attributes.attributes, {
|
|
445
|
+
attributes: (0, _extends2["default"])({}, attributes.attributes, linkFormAttributes, {
|
|
524
446
|
display_name: data.display_name,
|
|
525
447
|
name: data.name,
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
448
|
+
'network_link.actual_bandwidth': data['network_link.actual_bandwidth'],
|
|
449
|
+
'network_link.connect_type': data['network_link.connect_type'],
|
|
450
|
+
'network_link.destination_ipv4': data['network_link.destination_ipv4'],
|
|
451
|
+
'network_link.source_device_id': data['network_link.source_device_id'],
|
|
530
452
|
source_id: data.source_id,
|
|
531
453
|
support_templates: data.support_templates,
|
|
532
454
|
use: data.use,
|
|
@@ -541,12 +463,12 @@ function AddLinkDrawer(props) {
|
|
|
541
463
|
};
|
|
542
464
|
|
|
543
465
|
var onSave = /*#__PURE__*/function () {
|
|
544
|
-
var
|
|
545
|
-
var parm, result,
|
|
466
|
+
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(data) {
|
|
467
|
+
var parm, result, config, isExportLink, exportLinkIdList, _yield$editDispatcher, elements, linkData, edge, aobj, target, links, linkAttrKey, newLinkData, newLinks, newData, _config, _yield$editDispatcher2, _elements;
|
|
546
468
|
|
|
547
|
-
return _regenerator["default"].wrap(function
|
|
469
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
548
470
|
while (1) {
|
|
549
|
-
switch (
|
|
471
|
+
switch (_context4.prev = _context4.next) {
|
|
550
472
|
case 0:
|
|
551
473
|
//editDispatchers.update({ addLinkIsOpen: false });
|
|
552
474
|
// console.log("保存链路信息", isAddMode, data);
|
|
@@ -557,77 +479,80 @@ function AddLinkDrawer(props) {
|
|
|
557
479
|
result = null;
|
|
558
480
|
|
|
559
481
|
if (!isAddMode) {
|
|
560
|
-
|
|
482
|
+
_context4.next = 9;
|
|
561
483
|
break;
|
|
562
484
|
}
|
|
563
485
|
|
|
564
|
-
|
|
486
|
+
_context4.next = 6;
|
|
565
487
|
return _server["default"].addLink(parm);
|
|
566
488
|
|
|
567
489
|
case 6:
|
|
568
|
-
result =
|
|
569
|
-
|
|
490
|
+
result = _context4.sent;
|
|
491
|
+
_context4.next = 13;
|
|
570
492
|
break;
|
|
571
493
|
|
|
572
494
|
case 9:
|
|
573
495
|
parm.id = currentLink.id;
|
|
574
|
-
|
|
496
|
+
_context4.next = 12;
|
|
575
497
|
return _server["default"].editLink(parm);
|
|
576
498
|
|
|
577
499
|
case 12:
|
|
578
|
-
result =
|
|
500
|
+
result = _context4.sent;
|
|
579
501
|
|
|
580
502
|
case 13:
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
_context5.prev = 15;
|
|
503
|
+
topo.historyManager.setDisabled(true, '保存链路');
|
|
504
|
+
_context4.prev = 14;
|
|
584
505
|
|
|
585
506
|
if (!result) {
|
|
586
|
-
|
|
507
|
+
_context4.next = 59;
|
|
587
508
|
break;
|
|
588
509
|
}
|
|
589
510
|
|
|
590
|
-
config = topo.resourceConfig.getConfigFromHt();
|
|
511
|
+
config = topo.resourceConfig.getConfigFromHt();
|
|
512
|
+
isExportLink = !data['network_link.destination_device_id']; // 新建后显示到图上
|
|
591
513
|
|
|
592
514
|
if (!isAddMode) {
|
|
593
|
-
|
|
515
|
+
_context4.next = 33;
|
|
594
516
|
break;
|
|
595
517
|
}
|
|
596
518
|
|
|
597
519
|
exportLinkIdList = config.exportLinkIdList;
|
|
598
520
|
|
|
599
|
-
if (
|
|
521
|
+
if (isExportLink) {
|
|
600
522
|
exportLinkIdList.push(result);
|
|
601
523
|
}
|
|
602
524
|
|
|
603
|
-
|
|
525
|
+
_context4.next = 23;
|
|
526
|
+
return topo.resourceConfig.updateConfig((0, _extends2["default"])({}, config, {
|
|
604
527
|
exportLinkIdList: exportLinkIdList
|
|
605
|
-
}));
|
|
528
|
+
}));
|
|
606
529
|
|
|
607
|
-
|
|
530
|
+
case 23:
|
|
531
|
+
_context4.next = 25;
|
|
608
532
|
return editDispatchers.fetchDataByConfig();
|
|
609
533
|
|
|
610
|
-
case
|
|
611
|
-
_yield$editDispatcher =
|
|
534
|
+
case 25:
|
|
535
|
+
_yield$editDispatcher = _context4.sent;
|
|
612
536
|
elements = _yield$editDispatcher.elements;
|
|
613
537
|
linkData = elements.find(function (element) {
|
|
614
538
|
return element.id === result;
|
|
615
539
|
}); // console.log("创建成功-parm,linkData", parm, linkData);
|
|
616
540
|
|
|
541
|
+
topo.historyManager.setDisabled(true, '保存链路');
|
|
617
542
|
addLinkToGraph({
|
|
618
543
|
linkData: (0, _copyUtil.clone)(linkData),
|
|
619
|
-
|
|
620
|
-
targetName: data[
|
|
544
|
+
isExportLink: isExportLink,
|
|
545
|
+
targetName: data['network_link.destination_ipv4']
|
|
621
546
|
});
|
|
622
547
|
|
|
623
|
-
_message["default"].success(
|
|
548
|
+
_message["default"].success('创建成功');
|
|
624
549
|
|
|
625
|
-
|
|
550
|
+
_context4.next = 56;
|
|
626
551
|
break;
|
|
627
552
|
|
|
628
|
-
case
|
|
629
|
-
if (!
|
|
630
|
-
|
|
553
|
+
case 33:
|
|
554
|
+
if (!isExportLink) {
|
|
555
|
+
_context4.next = 49;
|
|
631
556
|
break;
|
|
632
557
|
}
|
|
633
558
|
|
|
@@ -637,65 +562,77 @@ function AddLinkDrawer(props) {
|
|
|
637
562
|
target = edge.getTarget();
|
|
638
563
|
|
|
639
564
|
if (target.getTag() === undefined) {
|
|
640
|
-
target.a(
|
|
565
|
+
target.a('name', data['network_link.destination_ipv4']);
|
|
641
566
|
}
|
|
642
567
|
|
|
643
568
|
links = topoState.data.links;
|
|
644
569
|
linkAttrKey = links.findIndex(function (item) {
|
|
645
570
|
return item.id === aobj.id;
|
|
646
571
|
});
|
|
647
|
-
newLinkData = mergeExportLinkData(edge.getAttrObject(), links[linkAttrKey]);
|
|
572
|
+
newLinkData = mergeExportLinkData(edge.getAttrObject(), links[linkAttrKey], data);
|
|
648
573
|
newLinks = (0, _copyUtil.clone)(links);
|
|
649
574
|
newLinks.splice(linkAttrKey, 1, newLinkData);
|
|
650
575
|
newData = (0, _extends2["default"])({}, topoState.data, {
|
|
651
576
|
links: newLinks
|
|
652
577
|
});
|
|
653
|
-
|
|
578
|
+
_context4.next = 47;
|
|
579
|
+
return topoDispatchers.update({
|
|
654
580
|
data: newData
|
|
655
581
|
});
|
|
656
|
-
|
|
582
|
+
|
|
583
|
+
case 47:
|
|
584
|
+
_context4.next = 55;
|
|
657
585
|
break;
|
|
658
586
|
|
|
659
|
-
case
|
|
587
|
+
case 49:
|
|
660
588
|
_config = topo.resourceConfig.getConfigFromHt();
|
|
661
589
|
topo.resourceConfig.updateConfig(_config);
|
|
662
|
-
|
|
590
|
+
_context4.next = 53;
|
|
663
591
|
return editDispatchers.fetchDataByConfig();
|
|
664
592
|
|
|
665
|
-
case
|
|
666
|
-
_yield$editDispatcher2 =
|
|
593
|
+
case 53:
|
|
594
|
+
_yield$editDispatcher2 = _context4.sent;
|
|
667
595
|
_elements = _yield$editDispatcher2.elements;
|
|
668
596
|
|
|
669
|
-
case
|
|
670
|
-
_message["default"].success(
|
|
597
|
+
case 55:
|
|
598
|
+
_message["default"].success('保存成功');
|
|
671
599
|
|
|
672
|
-
case
|
|
673
|
-
|
|
600
|
+
case 56:
|
|
601
|
+
_context4.next = 58;
|
|
602
|
+
return editDispatchers.update({
|
|
674
603
|
addLinkIsOpen: false,
|
|
675
604
|
currentLink: null
|
|
676
605
|
});
|
|
606
|
+
|
|
607
|
+
case 58:
|
|
677
608
|
topo.linkDynamicStyleExecutor.execute();
|
|
678
609
|
|
|
679
|
-
case
|
|
680
|
-
|
|
610
|
+
case 59:
|
|
611
|
+
_context4.next = 65;
|
|
681
612
|
break;
|
|
682
613
|
|
|
683
|
-
case
|
|
684
|
-
|
|
685
|
-
|
|
614
|
+
case 61:
|
|
615
|
+
_context4.prev = 61;
|
|
616
|
+
_context4.t0 = _context4["catch"](14);
|
|
617
|
+
|
|
618
|
+
_message["default"].error('保存失败');
|
|
686
619
|
|
|
687
|
-
_rlog["default"].
|
|
620
|
+
_rlog["default"].error('保存链路信息异常', _context4.t0);
|
|
688
621
|
|
|
689
|
-
case
|
|
622
|
+
case 65:
|
|
623
|
+
setLoading(false);
|
|
624
|
+
topo.historyManager.setDisabled(false, '保存链路');
|
|
625
|
+
|
|
626
|
+
case 67:
|
|
690
627
|
case "end":
|
|
691
|
-
return
|
|
628
|
+
return _context4.stop();
|
|
692
629
|
}
|
|
693
630
|
}
|
|
694
|
-
},
|
|
631
|
+
}, _callee4, null, [[14, 61]]);
|
|
695
632
|
}));
|
|
696
633
|
|
|
697
634
|
return function onSave(_x4) {
|
|
698
|
-
return
|
|
635
|
+
return _ref5.apply(this, arguments);
|
|
699
636
|
};
|
|
700
637
|
}();
|
|
701
638
|
|
|
@@ -706,10 +643,10 @@ function AddLinkDrawer(props) {
|
|
|
706
643
|
visible: loadingFormData,
|
|
707
644
|
fullScreen: true
|
|
708
645
|
}), /*#__PURE__*/_react["default"].createElement(_drawer["default"], {
|
|
709
|
-
closeMode: [
|
|
646
|
+
closeMode: ['close', 'esc'],
|
|
710
647
|
visible: addLinkIsOpen,
|
|
711
648
|
onClose: closeDrawer,
|
|
712
|
-
title: isAddMode ?
|
|
649
|
+
title: isAddMode ? '添加链路' : '编辑链路',
|
|
713
650
|
className: _indexModule["default"].drawer
|
|
714
651
|
}, addLinkIsOpen && link && /*#__PURE__*/_react["default"].createElement(_editLinkInfo["default"], {
|
|
715
652
|
lineData: link,
|