@riil-frontend/component-topology 7.0.0-dev.10 → 7.0.0-dev.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/build/1.js +2 -2
  2. package/build/2.js +1 -1
  3. package/build/index.css +1 -1
  4. package/build/index.js +31 -31
  5. package/es/core/models/TopoApp.js +1 -1
  6. package/es/networkTopo/components/editor/useEditorProps.js +4 -5
  7. package/lib/core/models/TopoApp.js +1 -1
  8. package/lib/networkTopo/components/editor/useEditorProps.js +4 -6
  9. package/package.json +2 -2
  10. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +0 -630
  11. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/NetworkLinkForm.js +0 -4
  12. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +0 -458
  13. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/index.module.scss +0 -34
  14. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/hooks/useAddLink.js +0 -104
  15. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/index.module.scss +0 -12
  16. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/mock.js +0 -55
  17. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/server.js +0 -187
  18. package/es/networkTopo/event/index.js +0 -6
  19. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +0 -661
  20. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/NetworkLinkForm.js +0 -12
  21. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +0 -486
  22. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/index.module.scss +0 -34
  23. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/hooks/useAddLink.js +0 -120
  24. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/index.module.scss +0 -12
  25. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/mock.js +0 -60
  26. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/server.js +0 -207
  27. package/lib/networkTopo/event/index.js +0 -11
@@ -1,630 +0,0 @@
1
- import _Drawer from "@alifd/next/es/drawer";
2
- import _Loading from "@alifd/next/es/loading";
3
- import _Message from "@alifd/next/es/message";
4
- import _extends from "@babel/runtime/helpers/extends";
5
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
6
- import _regeneratorRuntime from "@babel/runtime/regenerator";
7
- import React, { useState, useEffect, useRef } from 'react';
8
- import _ from 'lodash';
9
- import rlog from '@riil-frontend/component-topology-utils/es/rlog';
10
- import TopoCenterEvent from "../../../../../event";
11
- import EditLinkInfo from "./components/editLinkInfo";
12
- import styles from "./index.module.scss";
13
- import service from "./server";
14
- import { clone } from "../../../../../../utils/copyUtil";
15
- import { getInterfaceObject } from "../../../../../../core/models/utils/linkUtils";
16
- import { getEdgesBetweenNodes, getNodes, isGroup } from "../../../../../../utils/htElementUtils";
17
- import useAddLink from "./hooks/useAddLink";
18
-
19
- function AddLinkDrawer(props) {
20
- var topo = props.topo,
21
- lineData = props.lineData;
22
- var store = topo.store;
23
-
24
- var _topo$store$useModel = topo.store.useModel('topoMod'),
25
- topoState = _topo$store$useModel[0],
26
- topoDispatchers = _topo$store$useModel[1];
27
-
28
- var _store$useModel = store.useModel('topoConfig'),
29
- editState = _store$useModel[0],
30
- editDispatchers = _store$useModel[1];
31
-
32
- var addLinkIsOpen = editState.addLinkIsOpen,
33
- currentLink = editState.currentLink;
34
-
35
- var _useState = useState(),
36
- link = _useState[0],
37
- setLink = _useState[1];
38
-
39
- var _useState2 = useState(true),
40
- isAddMode = _useState2[0],
41
- setIsAddMode = _useState2[1];
42
-
43
- var _useState3 = useState(false),
44
- loading = _useState3[0],
45
- setLoading = _useState3[1];
46
-
47
- var _useState4 = useState(false),
48
- loadingFormData = _useState4[0],
49
- setLoadingFormData = _useState4[1];
50
-
51
- var _useState5 = useState(),
52
- sourceIFDoc = _useState5[0],
53
- setSourceIFDoc = _useState5[1];
54
-
55
- var _useState6 = useState(),
56
- targetIFDoc = _useState6[0],
57
- setTargetIFDoc = _useState6[1]; // 保存后更新拓扑图状态
58
-
59
-
60
- var linkNodesRef = useRef();
61
-
62
- var _useAddLink = useAddLink({
63
- topo: topo
64
- }),
65
- enterAddLinkMode = _useAddLink.enterAddLinkMode,
66
- resetConnectableNodes = _useAddLink.resetConnectableNodes,
67
- loadingConnectableNodes = _useAddLink.loadingConnectableNodes;
68
-
69
- var getPortsById = /*#__PURE__*/function () {
70
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(id, currentLink) {
71
- var result, links, ifTypes, ifDoc, usedPorts, portsDoc, ports;
72
- return _regeneratorRuntime.wrap(function _callee$(_context) {
73
- while (1) {
74
- switch (_context.prev = _context.next) {
75
- case 0:
76
- if (id) {
77
- _context.next = 2;
78
- break;
79
- }
80
-
81
- return _context.abrupt("return", {
82
- ports: [],
83
- portsDoc: {}
84
- });
85
-
86
- case 2:
87
- _context.next = 4;
88
- return service.getPortsById(id);
89
-
90
- case 4:
91
- result = _context.sent;
92
- _context.next = 7;
93
- return service.queryLinksByNodeId(id);
94
-
95
- case 7:
96
- links = _context.sent;
97
- ifTypes = result.map(function (item) {
98
- return item.type;
99
- }); // console.log("端口类型列表", ifTypes);
100
-
101
- _context.next = 11;
102
- return getInterfaceObject(ifTypes);
103
-
104
- case 11:
105
- ifDoc = _context.sent;
106
- // console.log("端口类型字典", ifDoc);
107
- usedPorts = [];
108
- links.data.map(function (link) {
109
- // console.log("getPortsById-去重", links, id);
110
- if (link.id !== (currentLink === null || currentLink === void 0 ? void 0 : currentLink.id)) {
111
- usedPorts.push(link.attributes.destination_id);
112
- usedPorts.push(link.attributes.source_id);
113
- }
114
- });
115
- usedPorts = _.uniq(usedPorts); // rlog.debug("端口列表", result, links);
116
- //const list = result[id];
117
-
118
- portsDoc = {};
119
- ports = result.map(function (item) {
120
- var _ifDoc$item$type$disp, _ifDoc$item$type;
121
-
122
- var obj = {
123
- value: item.id,
124
- label: item.name,
125
- type: item.type,
126
- 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 : '',
127
- disabled: usedPorts.indexOf(item.id) >= 0,
128
- ratedBandwidth: parseInt(item.ratedBandwidth, 10)
129
- };
130
- portsDoc[item.id] = obj;
131
- return obj;
132
- }).filter(function (item) {
133
- return !item.disabled;
134
- });
135
- return _context.abrupt("return", {
136
- ports: ports,
137
- portsDoc: portsDoc
138
- });
139
-
140
- case 18:
141
- case "end":
142
- return _context.stop();
143
- }
144
- }
145
- }, _callee);
146
- }));
147
-
148
- return function getPortsById(_x, _x2) {
149
- return _ref.apply(this, arguments);
150
- };
151
- }();
152
- /**
153
- * 连线第二个节点时的处理
154
- * @param {*} e
155
- */
156
-
157
-
158
- var handleSelectTargetNodeEvent = /*#__PURE__*/function () {
159
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(e) {
160
- var sourcePorts, targetPorts, source, target;
161
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
162
- while (1) {
163
- switch (_context2.prev = _context2.next) {
164
- case 0:
165
- resetConnectableNodes();
166
- linkNodesRef.current = e;
167
- rlog.debug('接到打开创建链路抽屉信息', e);
168
- setIsAddMode(true);
169
- setLoadingFormData(true);
170
- _context2.prev = 5;
171
- _context2.next = 8;
172
- return getPortsById(e.source._attrObject.id);
173
-
174
- case 8:
175
- sourcePorts = _context2.sent;
176
- _context2.next = 11;
177
- return getPortsById(e.target._attrObject.id);
178
-
179
- case 11:
180
- targetPorts = _context2.sent;
181
- setSourceIFDoc(sourcePorts.portsDoc);
182
- setTargetIFDoc(targetPorts.portsDoc);
183
- source = translationNode(e.source, sourcePorts);
184
- target = translationNode(e.target, targetPorts);
185
- editDispatchers.update({
186
- addLinkIsOpen: true,
187
- currentLink: null
188
- });
189
- setLink({
190
- source: source,
191
- target: target,
192
- attributes: {
193
- display_name: '',
194
- name: '',
195
- source_id: '',
196
- source_type: '',
197
- 'network_link.source_device_id': source.id,
198
- 'network_link.source_device_ipv4': source.ipAddress,
199
- destination_id: '',
200
- destination_type: '',
201
- 'network_link.destination_device_id': target.id,
202
- 'network_link.destination_device_ipv4': target.ipAddress,
203
- 'network_link.actual_bandwidth': null
204
- }
205
- });
206
- _context2.next = 23;
207
- break;
208
-
209
- case 20:
210
- _context2.prev = 20;
211
- _context2.t0 = _context2["catch"](5);
212
- rlog.error('出现异常', _context2.t0);
213
-
214
- case 23:
215
- setLoadingFormData(false);
216
-
217
- case 24:
218
- case "end":
219
- return _context2.stop();
220
- }
221
- }
222
- }, _callee2, null, [[5, 20]]);
223
- }));
224
-
225
- return function handleSelectTargetNodeEvent(_x3) {
226
- return _ref2.apply(this, arguments);
227
- };
228
- }();
229
-
230
- var handleSelectSourceNodeEvent = function handleSelectSourceNodeEvent(e) {
231
- // rlog.debug("设置了起始节点", e);
232
- topo.historyManager.setDisabled(true);
233
- var enableNodes = getNodes(topo.getDataModel());
234
- topo.view.topoClient.emitEvent('topo_link_set_connectable_nodes', enableNodes.filter(function (ele) {
235
- return !(isGroup(ele) && !ele.a('ciType'));
236
- }));
237
- topo.historyManager.setDisabled(false);
238
- };
239
-
240
- var initEditLineData = /*#__PURE__*/function () {
241
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
242
- var _currentLink$attribut, _sourcePorts$ports, _currentLink$attribut2, _targetPorts$ports;
243
-
244
- var sourcePorts, targetPorts;
245
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
246
- while (1) {
247
- switch (_context3.prev = _context3.next) {
248
- case 0:
249
- _context3.next = 2;
250
- return getPortsById(currentLink.source, currentLink);
251
-
252
- case 2:
253
- sourcePorts = _context3.sent;
254
- _context3.next = 5;
255
- return getPortsById(currentLink.target, currentLink);
256
-
257
- case 5:
258
- targetPorts = _context3.sent;
259
- setSourceIFDoc(sourcePorts.portsDoc);
260
- setTargetIFDoc(targetPorts.portsDoc);
261
- setLink({
262
- source: {
263
- ciData: topo.dataModel.getDataById(currentLink.source),
264
- id: currentLink.source,
265
- name: currentLink.attributes['network_link.source_device_id_object'].displayName,
266
- ciId: currentLink.attributes['network_link.source_device_id'],
267
- ciName: (_currentLink$attribut = currentLink.attributes.source_type_object) === null || _currentLink$attribut === void 0 ? void 0 : _currentLink$attribut.displayName,
268
- ciType: currentLink.attributes.source_type,
269
- interfaceSource: currentLink.interfaceSource,
270
- ports: (_sourcePorts$ports = sourcePorts.ports) !== null && _sourcePorts$ports !== void 0 ? _sourcePorts$ports : [],
271
- portsDoc: sourcePorts.portsDoc
272
- },
273
- target: {
274
- ciData: topo.dataModel.getDataById(currentLink.target),
275
- id: currentLink.target,
276
- name: currentLink.attributes['network_link.destination_device_id_object'].displayName,
277
- ciId: currentLink.attributes['network_link.destination_device_id'],
278
- ciName: (_currentLink$attribut2 = currentLink.attributes.destination_type_object) === null || _currentLink$attribut2 === void 0 ? void 0 : _currentLink$attribut2.displayName,
279
- ciType: currentLink.target !== '' ? currentLink.attributes.destination_type : 'customNode',
280
- interfaceTarget: currentLink.interfaceTarget,
281
- ports: (_targetPorts$ports = targetPorts.ports) !== null && _targetPorts$ports !== void 0 ? _targetPorts$ports : [],
282
- portsDoc: targetPorts.portsDoc
283
- },
284
- attributes: _extends({}, currentLink.attributes, {
285
- linkId: currentLink.id
286
- })
287
- });
288
-
289
- case 9:
290
- case "end":
291
- return _context3.stop();
292
- }
293
- }
294
- }, _callee3);
295
- }));
296
-
297
- return function initEditLineData() {
298
- return _ref3.apply(this, arguments);
299
- };
300
- }();
301
-
302
- useEffect(function () {
303
- // rlog.debug("useEffect-----currentLink", currentLink);
304
- if (currentLink) {
305
- setIsAddMode(false);
306
- initEditLineData();
307
- }
308
- }, [addLinkIsOpen]);
309
- useEffect(function () {
310
- if (!addLinkIsOpen) {
311
- setLink(null);
312
- }
313
- }, [addLinkIsOpen]); // 注册事件
314
-
315
- useEffect(function () {
316
- var notifier = topo.view.topoClient.notifier; // rlog.debug("注册事件");
317
- // 进入链路模式
318
-
319
- notifier.on(TopoCenterEvent.TOPO_LINK_ENTER_CREATE_MODE, enterAddLinkMode); // 选择第一个节点
320
-
321
- notifier.on(TopoCenterEvent.TOPO_LINK_SELECT_SOURCE_NODE, handleSelectSourceNodeEvent); // 选择第二个节点
322
-
323
- notifier.on(TopoCenterEvent.TOPO_LINK_CREATED, handleSelectTargetNodeEvent);
324
- return function () {
325
- // 取消注册事件
326
- // rlog.debug("取消注册事件");
327
- notifier.off(TopoCenterEvent.TOPO_LINK_ENTER_CREATE_MODE, enterAddLinkMode);
328
- notifier.off(TopoCenterEvent.TOPO_LINK_CREATED, handleSelectTargetNodeEvent);
329
- };
330
- }, []);
331
-
332
- var translationNode = function translationNode(node, Ports) {
333
- var _topo$ciTyeCache$getC, _topo$ciTyeCache$getC2, _attrObject$ciType, _Ports$ports;
334
-
335
- var attrObject = node._attrObject;
336
- return {
337
- ciData: topo.dataModel.getDataById(attrObject.id),
338
- id: attrObject.id,
339
- name: attrObject.name,
340
- ciId: attrObject.id,
341
- ipAddress: attrObject.ipAddress,
342
- 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,
343
- ciType: (_attrObject$ciType = attrObject.ciType) !== null && _attrObject$ciType !== void 0 ? _attrObject$ciType : 'customNode',
344
- ports: (_Ports$ports = Ports.ports) !== null && _Ports$ports !== void 0 ? _Ports$ports : [],
345
- portsDoc: Ports.portsDoc
346
- };
347
- };
348
-
349
- var closeDrawer = function closeDrawer() {
350
- //editDispatchers.update({ addLinkIsOpen: false });
351
- // rlog.debug("关闭");
352
- editDispatchers.update({
353
- addLinkIsOpen: false,
354
- currentLink: null
355
- });
356
- };
357
-
358
- var addLinkToGraph = function addLinkToGraph(_ref4) {
359
- var linkData = _ref4.linkData,
360
- isExportLink = _ref4.isExportLink,
361
- targetName = _ref4.targetName;
362
- var htTopo = topo.getHtTopo();
363
- var _linkNodesRef$current = linkNodesRef.current,
364
- source = _linkNodesRef$current.source,
365
- target = _linkNodesRef$current.target;
366
-
367
- try {
368
- // 获取两个节点间的连线数据列表
369
- var edgesInNodes = getEdgesBetweenNodes(source, target);
370
- var _isGroup = false; // linkType === "agg"
371
-
372
- if (_isGroup) {
373
- // 聚合链路
374
- if (edgesInNodes.length === 0) {
375
- htTopo.createEdge(source, target, linkData);
376
- } else {
377
- htTopo.setEdgeGroupData(source, target, linkData);
378
- } // 切换到连线组状态
379
-
380
-
381
- htTopo.toggleEdgeGroup(source, target, false);
382
- } else {
383
- // 有连线组无子连线时,设置连线数据,切换到连线并选中
384
- var edge = htTopo.createEdge(source, target, linkData);
385
-
386
- if (isExportLink && target.getTag() === undefined) {
387
- // rlog.debug("addLinkToGraph-export-target", target, target.getTag());
388
- target.a('name', targetName);
389
- }
390
-
391
- htTopo.toggleEdgeGroup(source, target, true);
392
- }
393
-
394
- topo.getGraphView().dm().sm().ss(topo.getDataModel().getDataByTag(linkData.id));
395
- } catch (error) {
396
- rlog.error('addLinkToGraph', error);
397
- }
398
- };
399
-
400
- var mergeExportLinkData = function mergeExportLinkData(data, attributes, linkFormAttributes) {
401
- var _sourceIFDoc$data$sou, _targetIFDoc$data$des;
402
-
403
- // console.log("mergeExportLinkData", data, attributes);
404
- return _extends({}, attributes, {
405
- id: data.id,
406
- name: data.name,
407
- source: data['network_link.source_device_id'],
408
- target: data['network_link.destination_device_id'],
409
- operation: data.operation,
410
- interfaceSource: data['source_id'],
411
- interfaceTarget: data['destination_id'],
412
- ciType: data.ciType,
413
- attributes: _extends({}, attributes.attributes, linkFormAttributes, {
414
- display_name: data.display_name,
415
- name: data.name,
416
- 'network_link.actual_bandwidth': data['network_link.actual_bandwidth'],
417
- 'network_link.connect_type': data['network_link.connect_type'],
418
- 'network_link.destination_ipv4': data['network_link.destination_ipv4'],
419
- 'network_link.source_device_id': data['network_link.source_device_id'],
420
- source_id: data.source_id,
421
- support_templates: data.support_templates,
422
- use: data.use,
423
- source_id_object: {
424
- displayName: (_sourceIFDoc$data$sou = sourceIFDoc[data.source_id]) === null || _sourceIFDoc$data$sou === void 0 ? void 0 : _sourceIFDoc$data$sou.label
425
- },
426
- destination_id_object: {
427
- displayName: (_targetIFDoc$data$des = targetIFDoc[data.destination_id]) === null || _targetIFDoc$data$des === void 0 ? void 0 : _targetIFDoc$data$des.label
428
- }
429
- })
430
- });
431
- };
432
-
433
- var onSave = /*#__PURE__*/function () {
434
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
435
- var parm, result, config, isExportLink, exportLinkIdList, _yield$editDispatcher, elements, linkData, edge, aobj, target, links, linkAttrKey, newLinkData, newLinks, newData, _config, _yield$editDispatcher2, _elements;
436
-
437
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
438
- while (1) {
439
- switch (_context4.prev = _context4.next) {
440
- case 0:
441
- //editDispatchers.update({ addLinkIsOpen: false });
442
- // console.log("保存链路信息", isAddMode, data);
443
- setLoading(true);
444
- parm = {
445
- attributes: data
446
- };
447
- result = null;
448
-
449
- if (!isAddMode) {
450
- _context4.next = 9;
451
- break;
452
- }
453
-
454
- _context4.next = 6;
455
- return service.addLink(parm);
456
-
457
- case 6:
458
- result = _context4.sent;
459
- _context4.next = 13;
460
- break;
461
-
462
- case 9:
463
- parm.id = currentLink.id;
464
- _context4.next = 12;
465
- return service.editLink(parm);
466
-
467
- case 12:
468
- result = _context4.sent;
469
-
470
- case 13:
471
- topo.historyManager.setDisabled(true, '保存链路');
472
- _context4.prev = 14;
473
-
474
- if (!result) {
475
- _context4.next = 59;
476
- break;
477
- }
478
-
479
- config = topo.resourceConfig.getConfigFromHt();
480
- isExportLink = !data['network_link.destination_device_id']; // 新建后显示到图上
481
-
482
- if (!isAddMode) {
483
- _context4.next = 33;
484
- break;
485
- }
486
-
487
- exportLinkIdList = config.exportLinkIdList;
488
-
489
- if (isExportLink) {
490
- exportLinkIdList.push(result);
491
- }
492
-
493
- _context4.next = 23;
494
- return topo.resourceConfig.updateConfig(_extends({}, config, {
495
- exportLinkIdList: exportLinkIdList
496
- }));
497
-
498
- case 23:
499
- _context4.next = 25;
500
- return editDispatchers.fetchDataByConfig();
501
-
502
- case 25:
503
- _yield$editDispatcher = _context4.sent;
504
- elements = _yield$editDispatcher.elements;
505
- linkData = elements.find(function (element) {
506
- return element.id === result;
507
- }); // console.log("创建成功-parm,linkData", parm, linkData);
508
-
509
- topo.historyManager.setDisabled(true, '保存链路');
510
- addLinkToGraph({
511
- linkData: clone(linkData),
512
- isExportLink: isExportLink,
513
- targetName: data['network_link.destination_ipv4']
514
- });
515
-
516
- _Message.success('创建成功');
517
-
518
- _context4.next = 56;
519
- break;
520
-
521
- case 33:
522
- if (!isExportLink) {
523
- _context4.next = 49;
524
- break;
525
- }
526
-
527
- edge = topo.getGraphView().dm().sm().ld();
528
- aobj = edge.getAttrObject();
529
- edge.setAttrObject(_extends({}, aobj, data));
530
- target = edge.getTarget();
531
-
532
- if (target.getTag() === undefined) {
533
- target.a('name', data['network_link.destination_ipv4']);
534
- }
535
-
536
- links = topoState.data.links;
537
- linkAttrKey = links.findIndex(function (item) {
538
- return item.id === aobj.id;
539
- });
540
- newLinkData = mergeExportLinkData(edge.getAttrObject(), links[linkAttrKey], data);
541
- newLinks = clone(links);
542
- newLinks.splice(linkAttrKey, 1, newLinkData);
543
- newData = _extends({}, topoState.data, {
544
- links: newLinks
545
- });
546
- _context4.next = 47;
547
- return topoDispatchers.update({
548
- data: newData
549
- });
550
-
551
- case 47:
552
- _context4.next = 55;
553
- break;
554
-
555
- case 49:
556
- _config = topo.resourceConfig.getConfigFromHt();
557
- topo.resourceConfig.updateConfig(_config);
558
- _context4.next = 53;
559
- return editDispatchers.fetchDataByConfig();
560
-
561
- case 53:
562
- _yield$editDispatcher2 = _context4.sent;
563
- _elements = _yield$editDispatcher2.elements;
564
-
565
- case 55:
566
- _Message.success('保存成功');
567
-
568
- case 56:
569
- _context4.next = 58;
570
- return editDispatchers.update({
571
- addLinkIsOpen: false,
572
- currentLink: null
573
- });
574
-
575
- case 58:
576
- topo.linkDynamicStyleExecutor.execute();
577
-
578
- case 59:
579
- _context4.next = 65;
580
- break;
581
-
582
- case 61:
583
- _context4.prev = 61;
584
- _context4.t0 = _context4["catch"](14);
585
-
586
- _Message.error('保存失败');
587
-
588
- rlog.error('保存链路信息异常', _context4.t0);
589
-
590
- case 65:
591
- setLoading(false);
592
- topo.historyManager.setDisabled(false, '保存链路');
593
-
594
- case 67:
595
- case "end":
596
- return _context4.stop();
597
- }
598
- }
599
- }, _callee4, null, [[14, 61]]);
600
- }));
601
-
602
- return function onSave(_x4) {
603
- return _ref5.apply(this, arguments);
604
- };
605
- }();
606
-
607
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Loading, {
608
- visible: loadingConnectableNodes,
609
- fullScreen: true
610
- }), /*#__PURE__*/React.createElement(_Loading, {
611
- visible: loadingFormData,
612
- fullScreen: true
613
- }), /*#__PURE__*/React.createElement(_Drawer, {
614
- closeMode: ['close', 'esc'],
615
- visible: addLinkIsOpen,
616
- onClose: closeDrawer,
617
- title: isAddMode ? '添加链路' : '编辑链路',
618
- className: styles.drawer
619
- }, addLinkIsOpen && link && /*#__PURE__*/React.createElement(EditLinkInfo, {
620
- lineData: link,
621
- topo: topo,
622
- onClose: closeDrawer,
623
- addLinkIsOpen: addLinkIsOpen,
624
- onSave: onSave,
625
- loading: loading,
626
- isAdd: isAddMode
627
- })));
628
- }
629
-
630
- export default AddLinkDrawer;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- export default function NetworkLinkForm(props) {
3
- return /*#__PURE__*/React.createElement("div", null, "LinkForm");
4
- }