@riil-frontend/component-topology 3.5.4 → 3.5.7
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/index.css +1 -1
- package/build/index.js +1 -1
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +30 -34
- package/es/hooks/useTopoEdit.js +7 -7
- package/es/models/topoMod.js +19 -17
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +82 -62
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +11 -10
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/index.module.scss +9 -0
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +30 -34
- package/lib/hooks/useTopoEdit.js +7 -7
- package/lib/models/topoMod.js +19 -17
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +83 -64
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +11 -10
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/index.module.scss +9 -0
- package/package.json +2 -2
|
@@ -20,7 +20,7 @@ import { updateEdgeExpanded } from "../utils/edgeUtil";
|
|
|
20
20
|
import PluginManager from "./PluginManager";
|
|
21
21
|
import topoFactory from "./topoFactory"; // eslint-disable-next-line no-undef
|
|
22
22
|
|
|
23
|
-
var version = typeof "3.5.
|
|
23
|
+
var version = typeof "3.5.7" === 'string' ? "3.5.7" : null;
|
|
24
24
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
|
25
25
|
/**
|
|
26
26
|
* 拓扑显示和编辑
|
|
@@ -127,6 +127,9 @@ export default function ResourceOverview(props) {
|
|
|
127
127
|
monitorMetricModels = _useMetricModels.metricModels,
|
|
128
128
|
metricInitLoading = _useMetricModels.initLoading;
|
|
129
129
|
|
|
130
|
+
topo.resourceOverviewDrawer = {
|
|
131
|
+
refreshData: init
|
|
132
|
+
};
|
|
130
133
|
useEffect(function () {
|
|
131
134
|
if (monitorMetricModels) {
|
|
132
135
|
init();
|
|
@@ -141,14 +144,13 @@ export default function ResourceOverview(props) {
|
|
|
141
144
|
_init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
142
145
|
var _topo$options$resourc, _modelAttributeMap$ow, _modelAttributeMap$, _modelAttributeMap$2, _modelAttributeMap$3, _modelAttributeMap$di, _modelAttributeMap$ip, _modelAttributeMap$as, _modelAttributeMap$5, _modelAttributeMap$6, _modelAttributeMap$so, _attributeMap$source_, _modelAttributeMap$de, _attributeMap$destina, _modelAttributeMap$ne;
|
|
143
146
|
|
|
144
|
-
var
|
|
147
|
+
var ciName, modelAttributeMap, domain, isAppTopoFlag, attributeMap, metrics, res_address, _attributeMap$, rated_bandwidth, _modelAttributeMap$4, connect_type;
|
|
145
148
|
|
|
146
149
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
147
150
|
while (1) {
|
|
148
151
|
switch (_context.prev = _context.next) {
|
|
149
152
|
case 0:
|
|
150
|
-
console.log('初始化/更新概览 props', props);
|
|
151
|
-
displayMetricModels = monitorMetricModels; // 指标模型
|
|
153
|
+
console.log('初始化/更新概览 props', props); // 指标模型
|
|
152
154
|
|
|
153
155
|
ciName = ciTypeMeta.displayName, modelAttributeMap = ciTypeMeta.attributeMap, domain = ciTypeMeta.domain; // 应用拓扑处理
|
|
154
156
|
|
|
@@ -157,14 +159,14 @@ export default function ResourceOverview(props) {
|
|
|
157
159
|
setIsAppTopo(isAppTopoFlag);
|
|
158
160
|
|
|
159
161
|
if (!isAppTopoFlag) {
|
|
160
|
-
_context.next =
|
|
162
|
+
_context.next = 8;
|
|
161
163
|
break;
|
|
162
164
|
}
|
|
163
165
|
|
|
164
|
-
initAppTopo(
|
|
166
|
+
initAppTopo(monitorMetricModels, modelAttributeMap, ciName, domain);
|
|
165
167
|
return _context.abrupt("return");
|
|
166
168
|
|
|
167
|
-
case
|
|
169
|
+
case 8:
|
|
168
170
|
// 拓扑(默认) ---------------------------
|
|
169
171
|
// 基本信息
|
|
170
172
|
attributeMap = ciAttrAndMetricData.attributeMap, metrics = ciAttrAndMetricData.metrics;
|
|
@@ -174,24 +176,24 @@ export default function ResourceOverview(props) {
|
|
|
174
176
|
res_address = false;
|
|
175
177
|
|
|
176
178
|
if (!((_modelAttributeMap$ow = modelAttributeMap.owned_computer_room) !== null && _modelAttributeMap$ow !== void 0 && _modelAttributeMap$ow.userVisible)) {
|
|
177
|
-
_context.next =
|
|
179
|
+
_context.next = 17;
|
|
178
180
|
break;
|
|
179
181
|
}
|
|
180
182
|
|
|
181
|
-
_context.next =
|
|
183
|
+
_context.next = 14;
|
|
182
184
|
return getAddressFormat(attributeMap);
|
|
183
185
|
|
|
184
|
-
case
|
|
186
|
+
case 14:
|
|
185
187
|
res_address = _context.sent;
|
|
186
|
-
_context.next =
|
|
188
|
+
_context.next = 18;
|
|
187
189
|
break;
|
|
188
190
|
|
|
189
|
-
case
|
|
191
|
+
case 17:
|
|
190
192
|
if ((_modelAttributeMap$ = modelAttributeMap[ciType + ".computer_room"]) !== null && _modelAttributeMap$ !== void 0 && _modelAttributeMap$.userVisible || (_modelAttributeMap$2 = modelAttributeMap[ciType + ".area"]) !== null && _modelAttributeMap$2 !== void 0 && _modelAttributeMap$2.userVisible) {
|
|
191
193
|
res_address = attributeMap[ciType + ".computer_room "] || attributeMap[ciType + ".area"] ? " " + (((_attributeMap$ = attributeMap[ciType + ".area_object"]) === null || _attributeMap$ === void 0 ? void 0 : _attributeMap$.displayName) || '') + " " + (attributeMap[ciType + ".computer_room"] || '') : false;
|
|
192
194
|
}
|
|
193
195
|
|
|
194
|
-
case
|
|
196
|
+
case 18:
|
|
195
197
|
// 链路带宽(取实际带宽)
|
|
196
198
|
rated_bandwidth = false;
|
|
197
199
|
|
|
@@ -223,7 +225,7 @@ export default function ResourceOverview(props) {
|
|
|
223
225
|
'network_link.connect_type': (_modelAttributeMap$ne = modelAttributeMap['network_link.connect_type']) !== null && _modelAttributeMap$ne !== void 0 && _modelAttributeMap$ne.userVisible ? connect_type : false
|
|
224
226
|
}); // 资源/链路-关键指标 数据 metrics,模型 topo.ciTyeCache.getCiType(ciType)
|
|
225
227
|
|
|
226
|
-
setIndicator(
|
|
228
|
+
setIndicator(monitorMetricModels.map(function (item) {
|
|
227
229
|
var _findItem;
|
|
228
230
|
|
|
229
231
|
return _extends({}, item, {
|
|
@@ -233,7 +235,7 @@ export default function ResourceOverview(props) {
|
|
|
233
235
|
|
|
234
236
|
getAlarmRiskData(id);
|
|
235
237
|
|
|
236
|
-
case
|
|
238
|
+
case 24:
|
|
237
239
|
case "end":
|
|
238
240
|
return _context.stop();
|
|
239
241
|
}
|
|
@@ -258,49 +260,44 @@ export default function ResourceOverview(props) {
|
|
|
258
260
|
while (1) {
|
|
259
261
|
switch (_context2.prev = _context2.next) {
|
|
260
262
|
case 0:
|
|
261
|
-
|
|
262
|
-
refreshData: function refreshData() {
|
|
263
|
-
init();
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
_context2.next = 3;
|
|
263
|
+
_context2.next = 2;
|
|
267
264
|
return (_topo$options$resourc2 = topo.options.resourceOverviewDrawer) === null || _topo$options$resourc2 === void 0 ? void 0 : _topo$options$resourc2.getData({
|
|
268
265
|
id: id,
|
|
269
266
|
metrics: topModelMetrics
|
|
270
267
|
});
|
|
271
268
|
|
|
272
|
-
case
|
|
269
|
+
case 2:
|
|
273
270
|
_yield$topo$options$r = _context2.sent;
|
|
274
271
|
metrics = _yield$topo$options$r.metrics;
|
|
275
272
|
alarmList = _yield$topo$options$r.alarms;
|
|
276
273
|
console.log('应用拓扑 参数获取', metrics, alarmList);
|
|
277
|
-
_context2.next =
|
|
274
|
+
_context2.next = 8;
|
|
278
275
|
return getAttribute(id);
|
|
279
276
|
|
|
280
|
-
case
|
|
277
|
+
case 8:
|
|
281
278
|
attributeMap = _context2.sent;
|
|
282
279
|
// 位置
|
|
283
280
|
res_address = false;
|
|
284
281
|
|
|
285
282
|
if (!((_modelAttributeMap$ow2 = modelAttributeMap.owned_computer_room) !== null && _modelAttributeMap$ow2 !== void 0 && _modelAttributeMap$ow2.userVisible)) {
|
|
286
|
-
_context2.next =
|
|
283
|
+
_context2.next = 16;
|
|
287
284
|
break;
|
|
288
285
|
}
|
|
289
286
|
|
|
290
|
-
_context2.next =
|
|
287
|
+
_context2.next = 13;
|
|
291
288
|
return getAddressFormat(attributeMap);
|
|
292
289
|
|
|
293
|
-
case
|
|
290
|
+
case 13:
|
|
294
291
|
res_address = _context2.sent;
|
|
295
|
-
_context2.next =
|
|
292
|
+
_context2.next = 17;
|
|
296
293
|
break;
|
|
297
294
|
|
|
298
|
-
case
|
|
295
|
+
case 16:
|
|
299
296
|
if ((_modelAttributeMap$7 = modelAttributeMap[ciType + ".computer_room"]) !== null && _modelAttributeMap$7 !== void 0 && _modelAttributeMap$7.userVisible || (_modelAttributeMap$8 = modelAttributeMap[ciType + ".area"]) !== null && _modelAttributeMap$8 !== void 0 && _modelAttributeMap$8.userVisible) {
|
|
300
297
|
res_address = attributeMap[ciType + ".computer_room "] || attributeMap[ciType + ".area"] ? " " + (((_attributeMap$2 = attributeMap[ciType + ".area_object"]) === null || _attributeMap$2 === void 0 ? void 0 : _attributeMap$2.displayName) || '') + " " + (attributeMap[ciType + ".computer_room"] || '') : false;
|
|
301
298
|
}
|
|
302
299
|
|
|
303
|
-
case
|
|
300
|
+
case 17:
|
|
304
301
|
setBaseInfo({
|
|
305
302
|
// 资源
|
|
306
303
|
// display_name: modelAttributeMap['display_name'] ? attributeMap.display_name : false,
|
|
@@ -340,7 +337,7 @@ export default function ResourceOverview(props) {
|
|
|
340
337
|
})) || [];
|
|
341
338
|
setAlarmRiskList(alarmList);
|
|
342
339
|
|
|
343
|
-
case
|
|
340
|
+
case 21:
|
|
344
341
|
case "end":
|
|
345
342
|
return _context2.stop();
|
|
346
343
|
}
|
|
@@ -584,7 +581,7 @@ export default function ResourceOverview(props) {
|
|
|
584
581
|
|
|
585
582
|
function _alarmRiskOperation() {
|
|
586
583
|
_alarmRiskOperation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(type, params) {
|
|
587
|
-
var res, _topo$ciTyeCache$getC,
|
|
584
|
+
var res, _topo$ciTyeCache$getC, ciName, modelAttributeMap, domain;
|
|
588
585
|
|
|
589
586
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
590
587
|
while (1) {
|
|
@@ -604,9 +601,8 @@ export default function ResourceOverview(props) {
|
|
|
604
601
|
_Message.success('受理成功');
|
|
605
602
|
|
|
606
603
|
if (isAppTopo) {
|
|
607
|
-
_topo$ciTyeCache$getC = topo.ciTyeCache.getCiType(ciType),
|
|
608
|
-
|
|
609
|
-
initAppTopo(topModelMetrics, modelAttributeMap, ciName, domain);
|
|
604
|
+
_topo$ciTyeCache$getC = topo.ciTyeCache.getCiType(ciType), ciName = _topo$ciTyeCache$getC.displayName, modelAttributeMap = _topo$ciTyeCache$getC.attributeMap, domain = _topo$ciTyeCache$getC.domain;
|
|
605
|
+
initAppTopo(monitorMetricModels, modelAttributeMap, ciName, domain);
|
|
610
606
|
} else {
|
|
611
607
|
getAlarmRiskData(id);
|
|
612
608
|
}
|
package/es/hooks/useTopoEdit.js
CHANGED
|
@@ -321,24 +321,24 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
321
321
|
edges = (_node$getEdges$toArra = (_node$getEdges = node.getEdges()) === null || _node$getEdges === void 0 ? void 0 : _node$getEdges.toArray()) !== null && _node$getEdges$toArra !== void 0 ? _node$getEdges$toArra : []; // const exLink = [];
|
|
322
322
|
|
|
323
323
|
if (!(edges.length > 0)) {
|
|
324
|
-
_context4.next =
|
|
324
|
+
_context4.next = 8;
|
|
325
325
|
break;
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
-
exportLinkIdList = [].concat(config.exportLinkIdList);
|
|
329
|
-
|
|
328
|
+
exportLinkIdList = [].concat(config.exportLinkIdList); //console.log("删除关联在节点上的出口链路- edges", edges,exportLinkIdList);
|
|
329
|
+
|
|
330
330
|
edges.map(function (edge) {
|
|
331
|
-
if (edge.a("
|
|
332
|
-
// exLink.push(edge);
|
|
331
|
+
if (edge.a("dtype") === "link" && exportLinkIdList.indexOf(edge.getTag()) >= 0) {
|
|
332
|
+
// exLink.push(edge);
|
|
333
333
|
topo.getGraphView().dm().remove(edge);
|
|
334
334
|
exportLinkIdList.splice(config.exportLinkIdList.indexOf(edge.getTag()), 1);
|
|
335
335
|
}
|
|
336
336
|
});
|
|
337
337
|
config.exportLinkIdList = exportLinkIdList;
|
|
338
|
-
_context4.next =
|
|
338
|
+
_context4.next = 8;
|
|
339
339
|
return resourceConfig.updateConfig(config);
|
|
340
340
|
|
|
341
|
-
case
|
|
341
|
+
case 8:
|
|
342
342
|
case "end":
|
|
343
343
|
return _context4.stop();
|
|
344
344
|
}
|
package/es/models/topoMod.js
CHANGED
|
@@ -365,12 +365,12 @@ export default function (topoApp) {
|
|
|
365
365
|
|
|
366
366
|
case 18:
|
|
367
367
|
if (!data) {
|
|
368
|
-
_context6.next =
|
|
368
|
+
_context6.next = 30;
|
|
369
369
|
break;
|
|
370
370
|
}
|
|
371
371
|
|
|
372
372
|
if (!topoId) {
|
|
373
|
-
_context6.next =
|
|
373
|
+
_context6.next = 27;
|
|
374
374
|
break;
|
|
375
375
|
}
|
|
376
376
|
|
|
@@ -379,31 +379,33 @@ export default function (topoApp) {
|
|
|
379
379
|
|
|
380
380
|
case 22:
|
|
381
381
|
topoConfig = _context6.sent;
|
|
382
|
+
console.log("topoMod.initTopoData 查询数据-topoConfig", topoConfig);
|
|
382
383
|
result = _extends({}, data, {
|
|
383
384
|
global: topoConfig.global,
|
|
384
385
|
customGlobal: data.global,
|
|
385
386
|
serialize: topoConfig.serialize
|
|
386
387
|
});
|
|
387
|
-
_context6.next =
|
|
388
|
+
_context6.next = 28;
|
|
388
389
|
break;
|
|
389
390
|
|
|
390
|
-
case
|
|
391
|
+
case 27:
|
|
391
392
|
result = _extends({}, data);
|
|
392
393
|
|
|
393
|
-
case
|
|
394
|
-
_context6.next =
|
|
394
|
+
case 28:
|
|
395
|
+
_context6.next = 34;
|
|
395
396
|
break;
|
|
396
397
|
|
|
397
|
-
case
|
|
398
|
-
_context6.next =
|
|
398
|
+
case 30:
|
|
399
|
+
_context6.next = 32;
|
|
399
400
|
return topoApp.options.loadData(topoId);
|
|
400
401
|
|
|
401
|
-
case
|
|
402
|
+
case 32:
|
|
402
403
|
result = _context6.sent;
|
|
404
|
+
console.log("topoMod.initTopoData 查询数据-topoConfig", result);
|
|
403
405
|
|
|
404
|
-
case
|
|
406
|
+
case 34:
|
|
405
407
|
if (result) {
|
|
406
|
-
_context6.next =
|
|
408
|
+
_context6.next = 38;
|
|
407
409
|
break;
|
|
408
410
|
}
|
|
409
411
|
|
|
@@ -418,22 +420,22 @@ export default function (topoApp) {
|
|
|
418
420
|
topoApp.options.onLoad();
|
|
419
421
|
return _context6.abrupt("return");
|
|
420
422
|
|
|
421
|
-
case
|
|
423
|
+
case 38:
|
|
422
424
|
result = parseTopoData(result);
|
|
423
425
|
rlog.debug("topoMod.initTopoData 查询数据完成", topoId, linkTo, result);
|
|
424
|
-
_context6.next =
|
|
426
|
+
_context6.next = 42;
|
|
425
427
|
return Promise.all([topoApp.ciTyeCache.getCiTypeMap(getCiTypes(result)), dispatch.customIcon.loadCustomIcons()]);
|
|
426
428
|
|
|
427
|
-
case
|
|
429
|
+
case 42:
|
|
428
430
|
_yield$Promise$all = _context6.sent;
|
|
429
431
|
ciTypeMap = _yield$Promise$all[0];
|
|
430
432
|
customIcons = _yield$Promise$all[1];
|
|
431
433
|
rlog.debug("topoMod.initTopoData Ci属性指标元数据", ciTypeMap);
|
|
432
434
|
extraConfig = result.global.extraConfig;
|
|
433
|
-
_context6.next =
|
|
435
|
+
_context6.next = 49;
|
|
434
436
|
return dispatch.displayConfig.setConfig(extraConfig);
|
|
435
437
|
|
|
436
|
-
case
|
|
438
|
+
case 49:
|
|
437
439
|
_combTopoData = combTopoData({
|
|
438
440
|
engine: topoApp,
|
|
439
441
|
data: result,
|
|
@@ -462,7 +464,7 @@ export default function (topoApp) {
|
|
|
462
464
|
rlog.info("topoMod.initTopoData 初始化拓扑图数据完成. 耗时: ", endTime.diff(startTime, "seconds", true));
|
|
463
465
|
topoApp.options.onLoad();
|
|
464
466
|
|
|
465
|
-
case
|
|
467
|
+
case 58:
|
|
466
468
|
case "end":
|
|
467
469
|
return _context6.stop();
|
|
468
470
|
}
|
|
@@ -66,7 +66,7 @@ function AddLinkDrawer(props) {
|
|
|
66
66
|
var linkNodesRef = useRef();
|
|
67
67
|
|
|
68
68
|
var getPortsById = /*#__PURE__*/function () {
|
|
69
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(id) {
|
|
69
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(id, currentLink) {
|
|
70
70
|
var result, links, ifTypes, ifDoc, usedPorts, portsDoc, ports;
|
|
71
71
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
72
72
|
while (1) {
|
|
@@ -84,21 +84,24 @@ function AddLinkDrawer(props) {
|
|
|
84
84
|
links = _context.sent;
|
|
85
85
|
ifTypes = result.map(function (item) {
|
|
86
86
|
return item.type;
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
_context.next =
|
|
87
|
+
}); // console.log("端口类型列表", ifTypes);
|
|
88
|
+
|
|
89
|
+
_context.next = 9;
|
|
90
90
|
return getInterfaceObject(ifTypes);
|
|
91
91
|
|
|
92
|
-
case
|
|
92
|
+
case 9:
|
|
93
93
|
ifDoc = _context.sent;
|
|
94
|
-
console.log("端口类型字典", ifDoc);
|
|
94
|
+
// console.log("端口类型字典", ifDoc);
|
|
95
95
|
usedPorts = [];
|
|
96
96
|
links.data.map(function (link) {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
// console.log("getPortsById-去重", links, id);
|
|
98
|
+
if (link.id !== (currentLink === null || currentLink === void 0 ? void 0 : currentLink.id)) {
|
|
99
|
+
usedPorts.push(link.attributes.destination_id);
|
|
100
|
+
usedPorts.push(link.attributes.source_id);
|
|
101
|
+
}
|
|
99
102
|
});
|
|
100
|
-
usedPorts = _.uniq(usedPorts);
|
|
101
|
-
|
|
103
|
+
usedPorts = _.uniq(usedPorts); // rlog.debug("端口列表", result, links);
|
|
104
|
+
//const list = result[id];
|
|
102
105
|
|
|
103
106
|
portsDoc = {};
|
|
104
107
|
ports = result.map(function (item) {
|
|
@@ -120,7 +123,7 @@ function AddLinkDrawer(props) {
|
|
|
120
123
|
portsDoc: portsDoc
|
|
121
124
|
});
|
|
122
125
|
|
|
123
|
-
case
|
|
126
|
+
case 16:
|
|
124
127
|
case "end":
|
|
125
128
|
return _context.stop();
|
|
126
129
|
}
|
|
@@ -128,7 +131,7 @@ function AddLinkDrawer(props) {
|
|
|
128
131
|
}, _callee);
|
|
129
132
|
}));
|
|
130
133
|
|
|
131
|
-
return function getPortsById(_x) {
|
|
134
|
+
return function getPortsById(_x, _x2) {
|
|
132
135
|
return _ref.apply(this, arguments);
|
|
133
136
|
};
|
|
134
137
|
}();
|
|
@@ -199,7 +202,7 @@ function AddLinkDrawer(props) {
|
|
|
199
202
|
}, _callee2, null, [[3, 19]]);
|
|
200
203
|
}));
|
|
201
204
|
|
|
202
|
-
return function handleEvent(
|
|
205
|
+
return function handleEvent(_x3) {
|
|
203
206
|
return _ref2.apply(this, arguments);
|
|
204
207
|
};
|
|
205
208
|
}();
|
|
@@ -220,16 +223,15 @@ function AddLinkDrawer(props) {
|
|
|
220
223
|
while (1) {
|
|
221
224
|
switch (_context3.prev = _context3.next) {
|
|
222
225
|
case 0:
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
return getPortsById(currentLink.source);
|
|
226
|
+
_context3.next = 2;
|
|
227
|
+
return getPortsById(currentLink.source, currentLink);
|
|
226
228
|
|
|
227
|
-
case
|
|
229
|
+
case 2:
|
|
228
230
|
sourcePorts = _context3.sent;
|
|
229
|
-
_context3.next =
|
|
230
|
-
return getPortsById(currentLink.target);
|
|
231
|
+
_context3.next = 5;
|
|
232
|
+
return getPortsById(currentLink.target, currentLink);
|
|
231
233
|
|
|
232
|
-
case
|
|
234
|
+
case 5:
|
|
233
235
|
targetPorts = _context3.sent;
|
|
234
236
|
setSourceIFDoc(sourcePorts.portsDoc);
|
|
235
237
|
setTargetIFDoc(targetPorts.portsDoc);
|
|
@@ -263,7 +265,7 @@ function AddLinkDrawer(props) {
|
|
|
263
265
|
})
|
|
264
266
|
});
|
|
265
267
|
|
|
266
|
-
case
|
|
268
|
+
case 10:
|
|
267
269
|
case "end":
|
|
268
270
|
return _context3.stop();
|
|
269
271
|
}
|
|
@@ -414,7 +416,9 @@ function AddLinkDrawer(props) {
|
|
|
414
416
|
};
|
|
415
417
|
|
|
416
418
|
var mergeExportLinkData = function mergeExportLinkData(data, attributes) {
|
|
417
|
-
|
|
419
|
+
var _sourceIFDoc$data$sou, _targetIFDoc$data$des;
|
|
420
|
+
|
|
421
|
+
// console.log("mergeExportLinkData", data, attributes);
|
|
418
422
|
return _extends({}, attributes, {
|
|
419
423
|
id: data.id,
|
|
420
424
|
name: data.name,
|
|
@@ -435,10 +439,10 @@ function AddLinkDrawer(props) {
|
|
|
435
439
|
support_templates: data.support_templates,
|
|
436
440
|
use: data.use,
|
|
437
441
|
source_id_object: {
|
|
438
|
-
displayName: sourceIFDoc[data.source_id].label
|
|
442
|
+
displayName: (_sourceIFDoc$data$sou = sourceIFDoc[data.source_id]) === null || _sourceIFDoc$data$sou === void 0 ? void 0 : _sourceIFDoc$data$sou.label
|
|
439
443
|
},
|
|
440
444
|
destination_id_object: {
|
|
441
|
-
displayName: targetIFDoc[data.destination_id].label
|
|
445
|
+
displayName: (_targetIFDoc$data$des = targetIFDoc[data.destination_id]) === null || _targetIFDoc$data$des === void 0 ? void 0 : _targetIFDoc$data$des.label
|
|
442
446
|
}
|
|
443
447
|
})
|
|
444
448
|
});
|
|
@@ -446,14 +450,14 @@ function AddLinkDrawer(props) {
|
|
|
446
450
|
|
|
447
451
|
var onSave = /*#__PURE__*/function () {
|
|
448
452
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
|
|
449
|
-
var parm, result, linkType, config, exportLinkIdList, _yield$editDispatcher, elements, linkData, edge, aobj, target, links, linkAttrKey, newLinkData, newLinks, newData;
|
|
453
|
+
var parm, result, linkType, config, exportLinkIdList, _yield$editDispatcher, elements, linkData, edge, aobj, target, links, linkAttrKey, newLinkData, newLinks, newData, _config, _yield$editDispatcher2, _elements;
|
|
450
454
|
|
|
451
455
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
452
456
|
while (1) {
|
|
453
457
|
switch (_context5.prev = _context5.next) {
|
|
454
458
|
case 0:
|
|
455
459
|
//editDispatchers.update({ addLinkIsOpen: false });
|
|
456
|
-
//
|
|
460
|
+
// console.log("保存链路信息", isAddMode, data);
|
|
457
461
|
setLoading(true);
|
|
458
462
|
parm = {
|
|
459
463
|
attributes: data
|
|
@@ -487,14 +491,14 @@ function AddLinkDrawer(props) {
|
|
|
487
491
|
_context5.prev = 15;
|
|
488
492
|
|
|
489
493
|
if (!result) {
|
|
490
|
-
_context5.next =
|
|
494
|
+
_context5.next = 55;
|
|
491
495
|
break;
|
|
492
496
|
}
|
|
493
497
|
|
|
494
498
|
config = topo.resourceConfig.getConfigFromHt(); // 新建后显示到图上
|
|
495
499
|
|
|
496
500
|
if (!isAddMode) {
|
|
497
|
-
_context5.next =
|
|
501
|
+
_context5.next = 31;
|
|
498
502
|
break;
|
|
499
503
|
}
|
|
500
504
|
|
|
@@ -516,8 +520,8 @@ function AddLinkDrawer(props) {
|
|
|
516
520
|
elements = _yield$editDispatcher.elements;
|
|
517
521
|
linkData = elements.find(function (element) {
|
|
518
522
|
return element.id === result;
|
|
519
|
-
});
|
|
520
|
-
|
|
523
|
+
}); // console.log("创建成功-parm,linkData", parm, linkData);
|
|
524
|
+
|
|
521
525
|
addLinkToGraph({
|
|
522
526
|
linkData: clone(linkData),
|
|
523
527
|
linkType: linkType,
|
|
@@ -526,62 +530,78 @@ function AddLinkDrawer(props) {
|
|
|
526
530
|
|
|
527
531
|
_Message.success("创建成功");
|
|
528
532
|
|
|
529
|
-
_context5.next =
|
|
533
|
+
_context5.next = 53;
|
|
530
534
|
break;
|
|
531
535
|
|
|
532
|
-
case
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
edge.setAttrObject(_extends({}, aobj, data));
|
|
538
|
-
target = edge.getTarget();
|
|
536
|
+
case 31:
|
|
537
|
+
if (!(linkType === "exit")) {
|
|
538
|
+
_context5.next = 46;
|
|
539
|
+
break;
|
|
540
|
+
}
|
|
539
541
|
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
542
|
+
edge = topo.getGraphView().dm().sm().ld();
|
|
543
|
+
aobj = edge.getAttrObject();
|
|
544
|
+
edge.setAttrObject(_extends({}, aobj, data));
|
|
545
|
+
target = edge.getTarget();
|
|
543
546
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
return item.id === aobj.id;
|
|
547
|
-
});
|
|
548
|
-
newLinkData = mergeExportLinkData(edge.getAttrObject(), links[linkAttrKey]);
|
|
549
|
-
newLinks = clone(links);
|
|
550
|
-
newLinks.splice(linkAttrKey, 1, newLinkData);
|
|
551
|
-
newData = _extends({}, topoState.data, {
|
|
552
|
-
links: newLinks
|
|
553
|
-
});
|
|
554
|
-
topoDispatchers.update({
|
|
555
|
-
data: newData
|
|
556
|
-
});
|
|
547
|
+
if (target.getTag() === undefined) {
|
|
548
|
+
target.a("name", data["network_link.destination_ipv4"]);
|
|
557
549
|
}
|
|
558
550
|
|
|
551
|
+
links = topoState.data.links;
|
|
552
|
+
linkAttrKey = links.findIndex(function (item) {
|
|
553
|
+
return item.id === aobj.id;
|
|
554
|
+
});
|
|
555
|
+
newLinkData = mergeExportLinkData(edge.getAttrObject(), links[linkAttrKey]);
|
|
556
|
+
newLinks = clone(links);
|
|
557
|
+
newLinks.splice(linkAttrKey, 1, newLinkData);
|
|
558
|
+
newData = _extends({}, topoState.data, {
|
|
559
|
+
links: newLinks
|
|
560
|
+
});
|
|
561
|
+
topoDispatchers.update({
|
|
562
|
+
data: newData
|
|
563
|
+
});
|
|
564
|
+
_context5.next = 52;
|
|
565
|
+
break;
|
|
566
|
+
|
|
567
|
+
case 46:
|
|
568
|
+
_config = topo.resourceConfig.getConfigFromHt();
|
|
569
|
+
topo.resourceConfig.updateConfig(_config);
|
|
570
|
+
_context5.next = 50;
|
|
571
|
+
return editDispatchers.fetchDataByConfig();
|
|
572
|
+
|
|
573
|
+
case 50:
|
|
574
|
+
_yield$editDispatcher2 = _context5.sent;
|
|
575
|
+
_elements = _yield$editDispatcher2.elements;
|
|
576
|
+
|
|
577
|
+
case 52:
|
|
559
578
|
_Message.success("保存成功");
|
|
560
579
|
|
|
561
|
-
case
|
|
580
|
+
case 53:
|
|
562
581
|
editDispatchers.update({
|
|
563
582
|
addLinkIsOpen: false,
|
|
564
583
|
currentLink: null
|
|
565
584
|
});
|
|
566
585
|
topo.linkDynamicStyleExecutor.execute();
|
|
567
586
|
|
|
568
|
-
case
|
|
569
|
-
_context5.next =
|
|
587
|
+
case 55:
|
|
588
|
+
_context5.next = 60;
|
|
570
589
|
break;
|
|
571
590
|
|
|
572
|
-
case
|
|
573
|
-
_context5.prev =
|
|
591
|
+
case 57:
|
|
592
|
+
_context5.prev = 57;
|
|
574
593
|
_context5.t0 = _context5["catch"](15);
|
|
594
|
+
rlog.debug("保存链路信息异常", _context5.t0);
|
|
575
595
|
|
|
576
|
-
case
|
|
596
|
+
case 60:
|
|
577
597
|
case "end":
|
|
578
598
|
return _context5.stop();
|
|
579
599
|
}
|
|
580
600
|
}
|
|
581
|
-
}, _callee5, null, [[15,
|
|
601
|
+
}, _callee5, null, [[15, 57]]);
|
|
582
602
|
}));
|
|
583
603
|
|
|
584
|
-
return function onSave(
|
|
604
|
+
return function onSave(_x4) {
|
|
585
605
|
return _ref6.apply(this, arguments);
|
|
586
606
|
};
|
|
587
607
|
}();
|
package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js
CHANGED
|
@@ -80,7 +80,7 @@ export default function EditLinkInfo(props) {
|
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
var linkTypeJudge = function linkTypeJudge(sourceType, destinationType, type) {
|
|
83
|
-
console.log("linkTypeJudge", sourceType, destinationType, type);
|
|
83
|
+
// console.log("linkTypeJudge", sourceType, destinationType, type);
|
|
84
84
|
var connect = "phy";
|
|
85
85
|
var support = "m.physical_link";
|
|
86
86
|
|
|
@@ -100,9 +100,8 @@ export default function EditLinkInfo(props) {
|
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
var connectHandleChange = function connectHandleChange(v) {
|
|
104
|
-
field.
|
|
105
|
-
field.reset("destination_id");
|
|
103
|
+
var connectHandleChange = function connectHandleChange(v) {// field.setValue("connect_type", v);
|
|
104
|
+
// field.reset("destination_id");
|
|
106
105
|
};
|
|
107
106
|
|
|
108
107
|
var getRatedBandwidth = function getRatedBandwidth() {};
|
|
@@ -134,16 +133,15 @@ export default function EditLinkInfo(props) {
|
|
|
134
133
|
var links = topo.getEdges();
|
|
135
134
|
var usedNames = [];
|
|
136
135
|
links.map(function (link) {
|
|
137
|
-
console.log('checkName',
|
|
138
|
-
|
|
136
|
+
// console.log('checkName',link.id,lineData)
|
|
139
137
|
if (link.dtype === "link" && link.name && link.id !== lineData.attributes.linkId) {
|
|
140
138
|
usedNames.push(link.name);
|
|
141
139
|
}
|
|
142
140
|
});
|
|
143
141
|
|
|
144
142
|
if (usedNames.indexOf(displayName) >= 0) {
|
|
145
|
-
console.log("setError", checkName, usedNames, displayName);
|
|
146
|
-
|
|
143
|
+
// console.log("setError", checkName, usedNames, displayName);
|
|
144
|
+
// field.setError("display_name", "链路名称重复");
|
|
147
145
|
return callback("链路名称重复");
|
|
148
146
|
} else {
|
|
149
147
|
return callback();
|
|
@@ -372,13 +370,16 @@ export default function EditLinkInfo(props) {
|
|
|
372
370
|
label: "\u94FE\u63A5\u65B9\u5F0F"
|
|
373
371
|
}), /*#__PURE__*/React.createElement(RadioGroup, {
|
|
374
372
|
name: "connect_type",
|
|
373
|
+
disabled: true,
|
|
375
374
|
onChange: function onChange(v) {
|
|
376
375
|
connectHandleChange(v);
|
|
377
376
|
}
|
|
378
377
|
}, /*#__PURE__*/React.createElement(_Radio, {
|
|
379
378
|
id: "phy",
|
|
380
|
-
value: "phy"
|
|
381
|
-
|
|
379
|
+
value: "phy" // disabled={
|
|
380
|
+
// target.ciType === "customNode" || !targetValue.ipAddress||targetValue.ports.length === 0
|
|
381
|
+
// }
|
|
382
|
+
|
|
382
383
|
}, "\u7269\u7406/\u805A\u5408"), /*#__PURE__*/React.createElement(_Radio, {
|
|
383
384
|
id: "exit",
|
|
384
385
|
value: "exit"
|