@riil-frontend/component-topology 7.0.9 → 8.0.0-a.10
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 +13 -13
- package/es/components/BatchAttrMetric/setting.js +0 -2
- package/es/core/common/icons/basicIcons.js +57 -0
- package/es/core/common/icons/icon.js +4 -6
- package/es/core/components/ResourceViewAttributeSetting/Setting.js +5 -11
- package/es/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +121 -0
- package/es/core/components/TopoView/GraphViewPanel.js +1 -2
- package/es/core/components/TopoView/topoView.js +3 -1
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +42 -24
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +7 -2
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +4 -0
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -0
- package/es/core/editor/utils/edgeTypeStyleUtil.js +2 -3
- package/es/core/hooks/useTopoEdit.js +35 -127
- package/es/core/models/AttributeMetricDisplay.js +4 -4
- package/es/core/models/TopoApp.js +2 -2
- package/es/core/models/tagstips/ElementTagTipConfig.js +18 -10
- package/es/core/models/topoData.js +9 -1
- package/es/core/models/utils/linkUtils.js +53 -91
- package/es/core/services/topo/basic.js +34 -0
- package/es/core/services/topo/constants.js +1 -0
- package/es/core/services/topo/index.js +4 -0
- package/es/core/store/models/topoBizMod.js +1 -11
- package/es/core/store/models/topoConfig.js +6 -7
- package/es/core/store/models/topoMod.js +74 -50
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +1 -1
- package/es/core/viewer/components/titlebar/widgets/SearchWidget.js +4 -0
- package/es/networkTopo/getTopoData.js +72 -64
- package/es/networkTopo/models/TopoCenter.js +14 -94
- package/es/networkTopo/services/topo/basic.js +30 -10
- package/es/networkTopo/store/linkManager.js +0 -1
- package/es/networkTopo/store/topoCenter.js +0 -1
- package/es/networkTopo/store/topoLinkMod.js +0 -1
- package/es/networkTopo/utils/resourcePermissionUtil.js +2 -2
- package/es/utils/topoData.js +4 -169
- package/lib/components/BatchAttrMetric/setting.js +0 -4
- package/lib/core/common/icons/basicIcons.js +62 -0
- package/lib/core/common/icons/icon.js +5 -7
- package/lib/core/components/ResourceViewAttributeSetting/Setting.js +6 -11
- package/lib/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +127 -0
- package/lib/core/components/TopoView/GraphViewPanel.js +1 -2
- package/lib/core/components/TopoView/topoView.js +4 -1
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +43 -24
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +8 -2
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +4 -0
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -0
- package/lib/core/editor/utils/edgeTypeStyleUtil.js +2 -3
- package/lib/core/hooks/useTopoEdit.js +35 -129
- package/lib/core/models/AttributeMetricDisplay.js +4 -4
- package/lib/core/models/TopoApp.js +3 -3
- package/lib/core/models/tagstips/ElementTagTipConfig.js +19 -11
- package/lib/core/models/topoData.js +9 -1
- package/lib/core/models/utils/linkUtils.js +52 -93
- package/lib/core/services/topo/basic.js +46 -0
- package/lib/core/services/topo/constants.js +6 -0
- package/lib/core/services/topo/index.js +16 -0
- package/lib/core/store/models/topoBizMod.js +1 -11
- package/lib/core/store/models/topoConfig.js +5 -6
- package/lib/core/store/models/topoMod.js +71 -48
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +1 -1
- package/lib/core/viewer/components/titlebar/widgets/SearchWidget.js +4 -0
- package/lib/networkTopo/getTopoData.js +73 -65
- package/lib/networkTopo/models/TopoCenter.js +14 -94
- package/lib/networkTopo/services/topo/basic.js +30 -10
- package/lib/networkTopo/store/linkManager.js +0 -2
- package/lib/networkTopo/store/topoCenter.js +0 -2
- package/lib/networkTopo/store/topoLinkMod.js +0 -2
- package/lib/networkTopo/utils/resourcePermissionUtil.js +2 -2
- package/lib/utils/topoData.js +6 -172
- package/package.json +2 -2
- /package/es/core/services/{topo.js → topo/tagtip.js} +0 -0
- /package/lib/core/services/{topo.js → topo/tagtip.js} +0 -0
@@ -23,12 +23,14 @@ var _tree = require("../../../utils/tree");
|
|
23
23
|
|
24
24
|
var _topoPermissionUtil = _interopRequireDefault(require("../../../utils/topoPermissionUtil"));
|
25
25
|
|
26
|
+
var _getTopoData = require("../../../networkTopo/getTopoData");
|
27
|
+
|
26
28
|
// const clone = (data) => JSON.parse(JSON.stringify(data));
|
27
29
|
function _default(topoApp) {
|
28
30
|
return {
|
29
31
|
state: {
|
30
32
|
loading: true,
|
31
|
-
viewState:
|
33
|
+
viewState: 'view',
|
32
34
|
// view, create, 2种模式
|
33
35
|
graphLoaded: false,
|
34
36
|
graphLoaded2: false,
|
@@ -37,7 +39,7 @@ function _default(topoApp) {
|
|
37
39
|
initParams: {},
|
38
40
|
topoLoadError: false,
|
39
41
|
id: undefined,
|
40
|
-
topoId:
|
42
|
+
topoId: '',
|
41
43
|
type: undefined,
|
42
44
|
// 拓扑类型
|
43
45
|
currentTopo: undefined,
|
@@ -81,8 +83,8 @@ function _default(topoApp) {
|
|
81
83
|
|
82
84
|
topoModState = rootState.topoMod; // 处理URL参数
|
83
85
|
|
84
|
-
type = params.type ||
|
85
|
-
id = params.id || topoModState.topoId ||
|
86
|
+
type = params.type || 'view';
|
87
|
+
id = params.id || topoModState.topoId || '';
|
86
88
|
|
87
89
|
_rlog["default"].debug("topoMod.init \u521D\u59CB\u5316(" + id + ")...", {
|
88
90
|
params: params,
|
@@ -116,7 +118,7 @@ function _default(topoApp) {
|
|
116
118
|
loading: false
|
117
119
|
});
|
118
120
|
|
119
|
-
_rlog["default"].debug(
|
121
|
+
_rlog["default"].debug('topoMod.initTopoCenter 初始化完成', {
|
120
122
|
rootState: rootState
|
121
123
|
});
|
122
124
|
|
@@ -161,7 +163,7 @@ function _default(topoApp) {
|
|
161
163
|
switch (_context2.prev = _context2.next) {
|
162
164
|
case 0:
|
163
165
|
id = playload.id, data = playload.data, linkTo = playload.linkTo;
|
164
|
-
viewState = playload.mode || playload.viewState ||
|
166
|
+
viewState = playload.mode || playload.viewState || 'view';
|
165
167
|
topoId = id || data.config.id;
|
166
168
|
|
167
169
|
_this2.update({
|
@@ -181,7 +183,7 @@ function _default(topoApp) {
|
|
181
183
|
});
|
182
184
|
|
183
185
|
case 6:
|
184
|
-
if (viewState ===
|
186
|
+
if (viewState === 'edit') {
|
185
187
|
// TODO 待优化进入编辑模式方式
|
186
188
|
_this2.enterEditMode();
|
187
189
|
}
|
@@ -208,7 +210,7 @@ function _default(topoApp) {
|
|
208
210
|
this.update({
|
209
211
|
graphLoaded: false,
|
210
212
|
graphLoaded2: false,
|
211
|
-
topoId:
|
213
|
+
topoId: '',
|
212
214
|
topoData: null,
|
213
215
|
currentTopo: undefined,
|
214
216
|
data: null,
|
@@ -218,7 +220,7 @@ function _default(topoApp) {
|
|
218
220
|
},
|
219
221
|
switchToViewMode: function switchToViewMode(playload, rootState) {
|
220
222
|
this.update({
|
221
|
-
viewState:
|
223
|
+
viewState: 'view'
|
222
224
|
});
|
223
225
|
},
|
224
226
|
enterEditMode: function enterEditMode(playload, rootState) {
|
@@ -242,7 +244,7 @@ function _default(topoApp) {
|
|
242
244
|
if (!topoId) {
|
243
245
|
// 查找第一个
|
244
246
|
treeData = rootState.topoTreeMod.treeData;
|
245
|
-
(0, _tree.loopTreeByKey)(treeData,
|
247
|
+
(0, _tree.loopTreeByKey)(treeData, 'type', 1, function (item, index, arr) {
|
246
248
|
if (!topoId) {
|
247
249
|
topoId = item.id;
|
248
250
|
}
|
@@ -319,7 +321,7 @@ function _default(topoApp) {
|
|
319
321
|
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
320
322
|
var _result$config;
|
321
323
|
|
322
|
-
var startTime, topoId, data, linkToData, refresh, clear, linkTo, startState, permission, result, graphConfig, topoConfig, _yield$Promise$all, ciTypeMap, customIcons, xxx, extraConfig, _combTopoData, topoData, resAndMetrics, endTime;
|
324
|
+
var startTime, topoId, data, linkToData, refresh, clear, linkTo, startState, permission, result, graphConfig, topoConfig, _yield$Promise$all, ciTypeMap, customIcons, xxx, extraConfig, _combTopoData, topoData, resAndMetrics, _yield$Promise$all2, newData, endTime;
|
323
325
|
|
324
326
|
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
325
327
|
while (1) {
|
@@ -352,25 +354,28 @@ function _default(topoApp) {
|
|
352
354
|
|
353
355
|
_this5.update(startState);
|
354
356
|
|
357
|
+
dispatch.topoBizMod.update({
|
358
|
+
pollingSwitch: false
|
359
|
+
});
|
355
360
|
topoApp.options.onLoadStart(); // TODO 待移到拓扑中心
|
356
361
|
|
357
|
-
permission =
|
362
|
+
permission = 'write';
|
358
363
|
|
359
364
|
if (!topoApp.options.usePermission) {
|
360
|
-
_context6.next =
|
365
|
+
_context6.next = 19;
|
361
366
|
break;
|
362
367
|
}
|
363
368
|
|
364
|
-
_context6.next =
|
369
|
+
_context6.next = 14;
|
365
370
|
return _this5.getTopoPermission({
|
366
371
|
id: topoId
|
367
372
|
});
|
368
373
|
|
369
|
-
case
|
374
|
+
case 14:
|
370
375
|
permission = _context6.sent;
|
371
376
|
|
372
377
|
if (_topoPermissionUtil["default"].isReadable(permission)) {
|
373
|
-
_context6.next =
|
378
|
+
_context6.next = 19;
|
374
379
|
break;
|
375
380
|
}
|
376
381
|
|
@@ -385,23 +390,23 @@ function _default(topoApp) {
|
|
385
390
|
topoApp.options.onLoad();
|
386
391
|
return _context6.abrupt("return");
|
387
392
|
|
388
|
-
case
|
393
|
+
case 19:
|
389
394
|
if (!data) {
|
390
|
-
_context6.next =
|
395
|
+
_context6.next = 30;
|
391
396
|
break;
|
392
397
|
}
|
393
398
|
|
394
399
|
graphConfig = {};
|
395
400
|
|
396
401
|
if (!topoId) {
|
397
|
-
_context6.next =
|
402
|
+
_context6.next = 27;
|
398
403
|
break;
|
399
404
|
}
|
400
405
|
|
401
|
-
_context6.next =
|
406
|
+
_context6.next = 24;
|
402
407
|
return _topo["default"].getTopoData(topoId);
|
403
408
|
|
404
|
-
case
|
409
|
+
case 24:
|
405
410
|
topoConfig = _context6.sent;
|
406
411
|
if (!topoConfig) _rlog["default"].error("\u672A\u67E5\u8BE2\u5230\u62D3\u6251id " + topoId + " \u7684\u6570\u636E\uFF0C\u8BF7\u68C0\u67E5");
|
407
412
|
graphConfig = {
|
@@ -410,21 +415,21 @@ function _default(topoApp) {
|
|
410
415
|
serialize: topoConfig === null || topoConfig === void 0 ? void 0 : topoConfig.serialize
|
411
416
|
};
|
412
417
|
|
413
|
-
case
|
418
|
+
case 27:
|
414
419
|
result = (0, _extends2["default"])({}, data, graphConfig);
|
415
|
-
_context6.next =
|
420
|
+
_context6.next = 33;
|
416
421
|
break;
|
417
422
|
|
418
|
-
case
|
419
|
-
_context6.next =
|
423
|
+
case 30:
|
424
|
+
_context6.next = 32;
|
420
425
|
return topoApp.options.loadData(topoId, topoApp.serverApi);
|
421
426
|
|
422
|
-
case
|
427
|
+
case 32:
|
423
428
|
result = _context6.sent;
|
424
429
|
|
425
|
-
case
|
430
|
+
case 33:
|
426
431
|
if (result) {
|
427
|
-
_context6.next =
|
432
|
+
_context6.next = 37;
|
428
433
|
break;
|
429
434
|
}
|
430
435
|
|
@@ -439,23 +444,21 @@ function _default(topoApp) {
|
|
439
444
|
topoApp.options.onLoad();
|
440
445
|
return _context6.abrupt("return");
|
441
446
|
|
442
|
-
case
|
447
|
+
case 37:
|
443
448
|
result = (0, _topoData.parseTopoData)(result);
|
444
449
|
|
445
|
-
_rlog["default"].debug(
|
450
|
+
_rlog["default"].debug('topoMod.initTopoData 查询数据完成', topoId, linkTo, result);
|
446
451
|
|
447
|
-
_context6.next =
|
448
|
-
return Promise.all([topoApp.ciTyeCache.getCiTypeMap(
|
452
|
+
_context6.next = 41;
|
453
|
+
return Promise.all([// topoApp.ciTyeCache.getCiTypeMap(getCiTypes(result)),
|
454
|
+
dispatch.customIcon.loadCustomIcons() // topoApp.elementTagTipConfig.init(result), // 暂停新配置开发
|
449
455
|
]);
|
450
456
|
|
451
|
-
case
|
457
|
+
case 41:
|
452
458
|
_yield$Promise$all = _context6.sent;
|
453
459
|
ciTypeMap = _yield$Promise$all[0];
|
454
460
|
customIcons = _yield$Promise$all[1];
|
455
461
|
xxx = _yield$Promise$all[2];
|
456
|
-
|
457
|
-
_rlog["default"].debug("topoMod.initTopoData Ci属性指标元数据", ciTypeMap);
|
458
|
-
|
459
462
|
extraConfig = result.global.extraConfig;
|
460
463
|
_context6.next = 48;
|
461
464
|
return dispatch.displayConfig.setConfig((0, _extends2["default"])({}, extraConfig, {
|
@@ -468,13 +471,11 @@ function _default(topoApp) {
|
|
468
471
|
engine: topoApp,
|
469
472
|
data: result,
|
470
473
|
linkTo: linkTo,
|
471
|
-
globalConfig: extraConfig
|
472
|
-
ciTypeMap: ciTypeMap,
|
473
|
-
permission: permission
|
474
|
+
globalConfig: extraConfig
|
474
475
|
}), topoData = _combTopoData.topoData, resAndMetrics = _combTopoData.resAndMetrics; // rlog.debug("topoMod.initTopoData combTopoData", { topoData, resAndMetrics, });
|
475
476
|
|
476
|
-
|
477
|
-
|
477
|
+
_context6.next = 51;
|
478
|
+
return _this5.update({
|
478
479
|
currentTopo: topoData.config,
|
479
480
|
data: result,
|
480
481
|
globalConfig: extraConfig,
|
@@ -483,18 +484,40 @@ function _default(topoApp) {
|
|
483
484
|
resAndMetrics: resAndMetrics
|
484
485
|
});
|
485
486
|
|
487
|
+
case 51:
|
486
488
|
dispatch.topoBizMod.combBatchCiInfo(resAndMetrics);
|
487
489
|
dispatch.background.init(extraConfig); // TODO 优化打开拓扑图显示告警速度:打开拓扑图立即请求告警
|
488
490
|
|
489
|
-
topoApp.alarm.open();
|
491
|
+
topoApp.alarm.open(); // 加载标注悬浮框数据
|
492
|
+
|
493
|
+
_context6.next = 56;
|
494
|
+
return Promise.all([(0, _getTopoData.addLinkData)(result), topoApp.ciTyeCache.getCiTypeMap((0, _topoData.getCiTypes)(result)), topoApp.elementTagTipConfig.init(result) // 暂停新配置开发
|
495
|
+
]);
|
496
|
+
|
497
|
+
case 56:
|
498
|
+
_yield$Promise$all2 = _context6.sent;
|
499
|
+
newData = _yield$Promise$all2[0];
|
500
|
+
_context6.next = 60;
|
501
|
+
return _this5.update({
|
502
|
+
data: newData
|
503
|
+
});
|
504
|
+
|
505
|
+
case 60:
|
506
|
+
dispatch.topoBizMod.update({
|
507
|
+
pollingSwitch: true
|
508
|
+
});
|
490
509
|
topoApp.onTopoDataLoaded(topoData);
|
491
510
|
endTime = (0, _moment["default"])();
|
492
511
|
|
493
|
-
_rlog["default"].info(
|
512
|
+
_rlog["default"].info('topoMod.initTopoData 初始化拓扑图数据完成. 耗时: ', endTime.diff(startTime, 'seconds', true));
|
494
513
|
|
495
514
|
topoApp.options.onLoad();
|
496
515
|
|
497
|
-
|
516
|
+
_this5.update({
|
517
|
+
loading: false
|
518
|
+
});
|
519
|
+
|
520
|
+
case 66:
|
498
521
|
case "end":
|
499
522
|
return _context6.stop();
|
500
523
|
}
|
@@ -550,13 +573,13 @@ function _default(topoApp) {
|
|
550
573
|
}
|
551
574
|
|
552
575
|
if (conditions.id === state.topoMod.topoId) {
|
553
|
-
if (conditions.type ===
|
576
|
+
if (conditions.type === 'delete') {
|
554
577
|
_this7.update({
|
555
578
|
topoId: conditions.defId
|
556
579
|
});
|
557
580
|
}
|
558
581
|
|
559
|
-
if (conditions.type ===
|
582
|
+
if (conditions.type === 'rename') {
|
560
583
|
td = (0, _extends2["default"])({}, state.topoMod.topoData, {
|
561
584
|
config: (0, _extends2["default"])({}, state.topoMod.topoData.config, {
|
562
585
|
name: conditions.name
|
@@ -600,10 +623,10 @@ function _default(topoApp) {
|
|
600
623
|
switch (_context10.prev = _context10.next) {
|
601
624
|
case 0:
|
602
625
|
if (conditions === void 0) {
|
603
|
-
conditions =
|
626
|
+
conditions = '';
|
604
627
|
}
|
605
628
|
|
606
|
-
_rlog["default"].debug(
|
629
|
+
_rlog["default"].debug('updateDelId', conditions);
|
607
630
|
|
608
631
|
case 2:
|
609
632
|
case "end":
|
@@ -65,6 +65,10 @@ function SearchWidget(props) {
|
|
65
65
|
|
66
66
|
var onChange = function onChange(value) {
|
67
67
|
setSearchValue(value);
|
68
|
+
|
69
|
+
if (!value) {
|
70
|
+
topo.searchElements(searchType, value);
|
71
|
+
}
|
68
72
|
};
|
69
73
|
|
70
74
|
return /*#__PURE__*/_react["default"].createElement(_search["default"], {
|
@@ -9,17 +9,31 @@ exports["default"] = getTopoData;
|
|
9
9
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
11
11
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13
|
-
|
14
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
15
13
|
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
15
|
+
|
16
16
|
var _linkUtils = require("../core/models/utils/linkUtils");
|
17
17
|
|
18
18
|
var _resourcePermissionUtil = require("./utils/resourcePermissionUtil");
|
19
19
|
|
20
20
|
// import "./utils/__tests__/resourcePermissionUtil.test";
|
21
|
-
|
22
|
-
|
21
|
+
// 过滤掉无两端节点数据的链路
|
22
|
+
function filterLinkNoSourceTarget(data) {
|
23
|
+
var links = (data.links || []).filter(function (link) {
|
24
|
+
var sourceNode = (data.nodes || []).find(function (node) {
|
25
|
+
return node.id === link.source;
|
26
|
+
});
|
27
|
+
|
28
|
+
if (link.source && !sourceNode) {
|
29
|
+
return false;
|
30
|
+
}
|
31
|
+
|
32
|
+
return true;
|
33
|
+
});
|
34
|
+
return (0, _extends2["default"])({}, data, {
|
35
|
+
links: links
|
36
|
+
});
|
23
37
|
}
|
24
38
|
/**
|
25
39
|
* 修正告警配置。因为:接口返回值没有全局告警配置时,返回null,代表开启
|
@@ -28,42 +42,65 @@ function addLinkData(_x, _x2) {
|
|
28
42
|
*/
|
29
43
|
|
30
44
|
|
45
|
+
function fixAlarmConfig(data) {
|
46
|
+
var _data$global = data.global,
|
47
|
+
alarmSwitch = _data$global.alarmSwitch,
|
48
|
+
alarmListDefaultOpen = _data$global.alarmListDefaultOpen;
|
49
|
+
return (0, _extends2["default"])({}, data, {
|
50
|
+
global: (0, _extends2["default"])({}, data.global, {
|
51
|
+
alarmSwitch: alarmSwitch === null ? true : alarmSwitch,
|
52
|
+
alarmListDefaultOpen: alarmListDefaultOpen === null ? true : alarmListDefaultOpen
|
53
|
+
})
|
54
|
+
});
|
55
|
+
} // 修正容器找不到时groupId设为空
|
56
|
+
|
57
|
+
|
58
|
+
function fixNodeGroupId(data) {
|
59
|
+
var nodes = (data.nodes || [] // 修正容器找不到时groupId设为空
|
60
|
+
).map(function (node) {
|
61
|
+
var groupExisted = !!(data.groups || []).filter(function (g) {
|
62
|
+
return g.id === node.groupId;
|
63
|
+
}).length;
|
64
|
+
return (0, _extends2["default"])({}, node, {
|
65
|
+
groupId: groupExisted ? node.groupId : null
|
66
|
+
});
|
67
|
+
});
|
68
|
+
return (0, _extends2["default"])({}, data, {
|
69
|
+
nodes: nodes
|
70
|
+
});
|
71
|
+
}
|
72
|
+
|
73
|
+
function addLinkData(_x) {
|
74
|
+
return _addLinkData.apply(this, arguments);
|
75
|
+
} // FIXME 业务拓扑不需要链路相关逻辑
|
76
|
+
|
77
|
+
|
31
78
|
function _addLinkData() {
|
32
|
-
_addLinkData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(
|
33
|
-
var links, networkLinks, otherLinks;
|
79
|
+
_addLinkData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(data) {
|
80
|
+
var links, nodes, networkLinks, otherLinks;
|
34
81
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
35
82
|
while (1) {
|
36
83
|
switch (_context.prev = _context.next) {
|
37
84
|
case 0:
|
38
|
-
|
39
|
-
|
40
|
-
var sourceNode = nodes.find(function (node) {
|
41
|
-
return node.id === link.source;
|
42
|
-
});
|
43
|
-
|
44
|
-
if (link.source && !sourceNode) {
|
45
|
-
return false;
|
46
|
-
}
|
47
|
-
|
48
|
-
return true;
|
49
|
-
}); // 如果是网络链路,补充详情信息
|
85
|
+
links = data.links || [];
|
86
|
+
nodes = data.nodes || []; // 如果是网络链路,补充详情信息
|
50
87
|
|
51
|
-
_context.next =
|
88
|
+
_context.next = 4;
|
52
89
|
return (0, _linkUtils.getLinksDetail)(links.filter(function (link) {
|
53
|
-
return
|
90
|
+
return link.ciType === 'network_link';
|
54
91
|
}), nodes);
|
55
92
|
|
56
|
-
case
|
93
|
+
case 4:
|
57
94
|
networkLinks = _context.sent;
|
58
95
|
otherLinks = links.filter(function (link) {
|
59
|
-
return
|
96
|
+
return link.ciType !== 'network_link';
|
60
97
|
});
|
61
|
-
return _context.abrupt("return", {
|
98
|
+
return _context.abrupt("return", (0, _extends2["default"])({}, data, {
|
62
99
|
links: [].concat(networkLinks, otherLinks),
|
63
100
|
linkGroups: []
|
64
|
-
});
|
101
|
+
}));
|
65
102
|
|
66
|
-
case
|
103
|
+
case 7:
|
67
104
|
case "end":
|
68
105
|
return _context.stop();
|
69
106
|
}
|
@@ -73,54 +110,25 @@ function _addLinkData() {
|
|
73
110
|
return _addLinkData.apply(this, arguments);
|
74
111
|
}
|
75
112
|
|
76
|
-
function
|
77
|
-
var _data$global = data.global,
|
78
|
-
alarmSwitch = _data$global.alarmSwitch,
|
79
|
-
alarmListDefaultOpen = _data$global.alarmListDefaultOpen;
|
80
|
-
return (0, _extends2["default"])({}, data, {
|
81
|
-
global: (0, _extends2["default"])({}, data.global, {
|
82
|
-
alarmSwitch: alarmSwitch === null ? true : alarmSwitch,
|
83
|
-
alarmListDefaultOpen: alarmListDefaultOpen === null ? true : alarmListDefaultOpen
|
84
|
-
})
|
85
|
-
});
|
86
|
-
} // FIXME 业务拓扑不需要链路相关逻辑
|
87
|
-
|
88
|
-
|
89
|
-
function buildData(_x3) {
|
113
|
+
function buildData(_x2) {
|
90
114
|
return _buildData.apply(this, arguments);
|
91
115
|
}
|
92
116
|
|
93
117
|
function _buildData() {
|
94
|
-
_buildData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(
|
95
|
-
var
|
96
|
-
|
118
|
+
_buildData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(oldData) {
|
119
|
+
var data;
|
97
120
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
98
121
|
while (1) {
|
99
122
|
switch (_context2.prev = _context2.next) {
|
100
123
|
case 0:
|
101
|
-
|
102
|
-
|
103
|
-
)
|
104
|
-
var groupExisted = !!(data.groups || []).filter(function (g) {
|
105
|
-
return g.id === node.groupId;
|
106
|
-
}).length;
|
107
|
-
return (0, _extends2["default"])({}, node, {
|
108
|
-
groupId: groupExisted ? node.groupId : null
|
109
|
-
});
|
110
|
-
});
|
111
|
-
_context2.next = 4;
|
112
|
-
return Promise.all([addLinkData(data.links || [], nodes)]);
|
124
|
+
data = oldData;
|
125
|
+
data = fixNodeGroupId(data);
|
126
|
+
data = filterLinkNoSourceTarget(data); // data = await addLinkData(data)
|
113
127
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
nodes: nodes
|
119
|
-
}, linkData);
|
120
|
-
newData = (0, _resourcePermissionUtil.addTopoDataResourcePermission)(newData);
|
121
|
-
return _context2.abrupt("return", newData);
|
122
|
-
|
123
|
-
case 9:
|
128
|
+
data = (0, _resourcePermissionUtil.addTopoDataResourcePermission)(data);
|
129
|
+
return _context2.abrupt("return", data);
|
130
|
+
|
131
|
+
case 5:
|
124
132
|
case "end":
|
125
133
|
return _context2.stop();
|
126
134
|
}
|
@@ -130,7 +138,7 @@ function _buildData() {
|
|
130
138
|
return _buildData.apply(this, arguments);
|
131
139
|
}
|
132
140
|
|
133
|
-
function getTopoData(
|
141
|
+
function getTopoData(_x3, _x4) {
|
134
142
|
return _getTopoData.apply(this, arguments);
|
135
143
|
}
|
136
144
|
|
@@ -48,87 +48,7 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
|
|
48
48
|
return _ResourceInfoDisplay.DEFAULT_TIP_COMMON_CONFIG;
|
49
49
|
} // ExtElementTagTipBuilder: LinkTagsTipsBuilder,
|
50
50
|
|
51
|
-
}
|
52
|
-
onSwitchToEditModeBegin: function () {
|
53
|
-
var _onSwitchToEditModeBegin = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(topo) {
|
54
|
-
var topoDispatchers;
|
55
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
56
|
-
while (1) {
|
57
|
-
switch (_context.prev = _context.next) {
|
58
|
-
case 0:
|
59
|
-
topoDispatchers = topo.store.getModelDispatchers('topoMod'); // topoDispatchers.update({ topoData: null });
|
60
|
-
|
61
|
-
_context.next = 3;
|
62
|
-
return topoDispatchers.refreshTopo();
|
63
|
-
|
64
|
-
case 3:
|
65
|
-
case "end":
|
66
|
-
return _context.stop();
|
67
|
-
}
|
68
|
-
}
|
69
|
-
}, _callee);
|
70
|
-
}));
|
71
|
-
|
72
|
-
function onSwitchToEditModeBegin(_x) {
|
73
|
-
return _onSwitchToEditModeBegin.apply(this, arguments);
|
74
|
-
}
|
75
|
-
|
76
|
-
return onSwitchToEditModeBegin;
|
77
|
-
}(),
|
78
|
-
onSwitchToEditMode: function () {
|
79
|
-
var _onSwitchToEditMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(topo) {
|
80
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
81
|
-
while (1) {
|
82
|
-
switch (_context2.prev = _context2.next) {
|
83
|
-
case 0:
|
84
|
-
_context2.next = 2;
|
85
|
-
return topo.resourceConfig.loadConfig();
|
86
|
-
|
87
|
-
case 2:
|
88
|
-
case "end":
|
89
|
-
return _context2.stop();
|
90
|
-
}
|
91
|
-
}
|
92
|
-
}, _callee2);
|
93
|
-
}));
|
94
|
-
|
95
|
-
function onSwitchToEditMode(_x2) {
|
96
|
-
return _onSwitchToEditMode.apply(this, arguments);
|
97
|
-
}
|
98
|
-
|
99
|
-
return onSwitchToEditMode;
|
100
|
-
}(),
|
101
|
-
onSwitchToViewMode: function () {
|
102
|
-
var _onSwitchToViewMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(topo) {
|
103
|
-
var topoModDispatchers;
|
104
|
-
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
105
|
-
while (1) {
|
106
|
-
switch (_context3.prev = _context3.next) {
|
107
|
-
case 0:
|
108
|
-
topoModDispatchers = topo.store.getModelDispatchers('topoMod');
|
109
|
-
_context3.next = 3;
|
110
|
-
return topoModDispatchers.openTopoPage({
|
111
|
-
id: topo.id
|
112
|
-
});
|
113
|
-
|
114
|
-
case 3:
|
115
|
-
_context3.next = 5;
|
116
|
-
return topoModDispatchers.refreshTopoTree();
|
117
|
-
|
118
|
-
case 5:
|
119
|
-
case "end":
|
120
|
-
return _context3.stop();
|
121
|
-
}
|
122
|
-
}
|
123
|
-
}, _callee3);
|
124
|
-
}));
|
125
|
-
|
126
|
-
function onSwitchToViewMode(_x3) {
|
127
|
-
return _onSwitchToViewMode.apply(this, arguments);
|
128
|
-
}
|
129
|
-
|
130
|
-
return onSwitchToViewMode;
|
131
|
-
}()
|
51
|
+
}
|
132
52
|
})) || this;
|
133
53
|
_this.resourceConfig = null;
|
134
54
|
var menuCommands = (0, _createMenuCommands["default"])((0, _assertThisInitialized2["default"])(_this));
|
@@ -149,25 +69,25 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
|
|
149
69
|
_proto.initData =
|
150
70
|
/*#__PURE__*/
|
151
71
|
function () {
|
152
|
-
var _initData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
72
|
+
var _initData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(params) {
|
153
73
|
var topoDispatchers;
|
154
|
-
return _regenerator["default"].wrap(function
|
74
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
155
75
|
while (1) {
|
156
|
-
switch (
|
76
|
+
switch (_context.prev = _context.next) {
|
157
77
|
case 0:
|
158
78
|
topoDispatchers = this.store.getModelDispatchers('topoCenter');
|
159
|
-
|
79
|
+
_context.next = 3;
|
160
80
|
return topoDispatchers.initData(params);
|
161
81
|
|
162
82
|
case 3:
|
163
83
|
case "end":
|
164
|
-
return
|
84
|
+
return _context.stop();
|
165
85
|
}
|
166
86
|
}
|
167
|
-
},
|
87
|
+
}, _callee, this);
|
168
88
|
}));
|
169
89
|
|
170
|
-
function initData(
|
90
|
+
function initData(_x) {
|
171
91
|
return _initData.apply(this, arguments);
|
172
92
|
}
|
173
93
|
|
@@ -186,22 +106,22 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
|
|
186
106
|
_proto.exit =
|
187
107
|
/*#__PURE__*/
|
188
108
|
function () {
|
189
|
-
var _exit = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
109
|
+
var _exit = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
190
110
|
var topoDispatchers;
|
191
|
-
return _regenerator["default"].wrap(function
|
111
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
192
112
|
while (1) {
|
193
|
-
switch (
|
113
|
+
switch (_context2.prev = _context2.next) {
|
194
114
|
case 0:
|
195
115
|
topoDispatchers = this.store.getModelDispatchers('topoCenter');
|
196
|
-
|
116
|
+
_context2.next = 3;
|
197
117
|
return topoDispatchers.exit();
|
198
118
|
|
199
119
|
case 3:
|
200
120
|
case "end":
|
201
|
-
return
|
121
|
+
return _context2.stop();
|
202
122
|
}
|
203
123
|
}
|
204
|
-
},
|
124
|
+
}, _callee2, this);
|
205
125
|
}));
|
206
126
|
|
207
127
|
function exit() {
|