@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.
Files changed (73) hide show
  1. package/build/index.css +1 -1
  2. package/build/index.js +13 -13
  3. package/es/components/BatchAttrMetric/setting.js +0 -2
  4. package/es/core/common/icons/basicIcons.js +57 -0
  5. package/es/core/common/icons/icon.js +4 -6
  6. package/es/core/components/ResourceViewAttributeSetting/Setting.js +5 -11
  7. package/es/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +121 -0
  8. package/es/core/components/TopoView/GraphViewPanel.js +1 -2
  9. package/es/core/components/TopoView/topoView.js +3 -1
  10. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +42 -24
  11. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +7 -2
  12. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +4 -0
  13. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -0
  14. package/es/core/editor/utils/edgeTypeStyleUtil.js +2 -3
  15. package/es/core/hooks/useTopoEdit.js +35 -127
  16. package/es/core/models/AttributeMetricDisplay.js +4 -4
  17. package/es/core/models/TopoApp.js +2 -2
  18. package/es/core/models/tagstips/ElementTagTipConfig.js +18 -10
  19. package/es/core/models/topoData.js +9 -1
  20. package/es/core/models/utils/linkUtils.js +53 -91
  21. package/es/core/services/topo/basic.js +34 -0
  22. package/es/core/services/topo/constants.js +1 -0
  23. package/es/core/services/topo/index.js +4 -0
  24. package/es/core/store/models/topoBizMod.js +1 -11
  25. package/es/core/store/models/topoConfig.js +6 -7
  26. package/es/core/store/models/topoMod.js +74 -50
  27. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +1 -1
  28. package/es/core/viewer/components/titlebar/widgets/SearchWidget.js +4 -0
  29. package/es/networkTopo/getTopoData.js +72 -64
  30. package/es/networkTopo/models/TopoCenter.js +14 -94
  31. package/es/networkTopo/services/topo/basic.js +30 -10
  32. package/es/networkTopo/store/linkManager.js +0 -1
  33. package/es/networkTopo/store/topoCenter.js +0 -1
  34. package/es/networkTopo/store/topoLinkMod.js +0 -1
  35. package/es/networkTopo/utils/resourcePermissionUtil.js +2 -2
  36. package/es/utils/topoData.js +4 -169
  37. package/lib/components/BatchAttrMetric/setting.js +0 -4
  38. package/lib/core/common/icons/basicIcons.js +62 -0
  39. package/lib/core/common/icons/icon.js +5 -7
  40. package/lib/core/components/ResourceViewAttributeSetting/Setting.js +6 -11
  41. package/lib/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +127 -0
  42. package/lib/core/components/TopoView/GraphViewPanel.js +1 -2
  43. package/lib/core/components/TopoView/topoView.js +4 -1
  44. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +43 -24
  45. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +8 -2
  46. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +4 -0
  47. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -0
  48. package/lib/core/editor/utils/edgeTypeStyleUtil.js +2 -3
  49. package/lib/core/hooks/useTopoEdit.js +35 -129
  50. package/lib/core/models/AttributeMetricDisplay.js +4 -4
  51. package/lib/core/models/TopoApp.js +3 -3
  52. package/lib/core/models/tagstips/ElementTagTipConfig.js +19 -11
  53. package/lib/core/models/topoData.js +9 -1
  54. package/lib/core/models/utils/linkUtils.js +52 -93
  55. package/lib/core/services/topo/basic.js +46 -0
  56. package/lib/core/services/topo/constants.js +6 -0
  57. package/lib/core/services/topo/index.js +16 -0
  58. package/lib/core/store/models/topoBizMod.js +1 -11
  59. package/lib/core/store/models/topoConfig.js +5 -6
  60. package/lib/core/store/models/topoMod.js +71 -48
  61. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +1 -1
  62. package/lib/core/viewer/components/titlebar/widgets/SearchWidget.js +4 -0
  63. package/lib/networkTopo/getTopoData.js +73 -65
  64. package/lib/networkTopo/models/TopoCenter.js +14 -94
  65. package/lib/networkTopo/services/topo/basic.js +30 -10
  66. package/lib/networkTopo/store/linkManager.js +0 -2
  67. package/lib/networkTopo/store/topoCenter.js +0 -2
  68. package/lib/networkTopo/store/topoLinkMod.js +0 -2
  69. package/lib/networkTopo/utils/resourcePermissionUtil.js +2 -2
  70. package/lib/utils/topoData.js +6 -172
  71. package/package.json +2 -2
  72. /package/es/core/services/{topo.js → topo/tagtip.js} +0 -0
  73. /package/lib/core/services/{topo.js → topo/tagtip.js} +0 -0
@@ -1,18 +1,19 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- import moment from "moment";
5
- import topoService from "@riil-frontend/component-topology-common/es/services/topo";
6
- import rlog from "@riil-frontend/component-topology-utils/es/rlog";
4
+ import moment from 'moment';
5
+ import topoService from '@riil-frontend/component-topology-common/es/services/topo';
6
+ import rlog from '@riil-frontend/component-topology-utils/es/rlog';
7
7
  import { combTopoData, getCiTypes, parseTopoData } from "../../../utils/topoData";
8
8
  import { loopTreeByKey } from "../../../utils/tree";
9
- import topoPermissonUtil from "../../../utils/topoPermissionUtil"; // const clone = (data) => JSON.parse(JSON.stringify(data));
9
+ import topoPermissonUtil from "../../../utils/topoPermissionUtil";
10
+ import { addLinkData } from "../../../networkTopo/getTopoData"; // const clone = (data) => JSON.parse(JSON.stringify(data));
10
11
 
11
12
  export default function (topoApp) {
12
13
  return {
13
14
  state: {
14
15
  loading: true,
15
- viewState: "view",
16
+ viewState: 'view',
16
17
  // view, create, 2种模式
17
18
  graphLoaded: false,
18
19
  graphLoaded2: false,
@@ -21,7 +22,7 @@ export default function (topoApp) {
21
22
  initParams: {},
22
23
  topoLoadError: false,
23
24
  id: undefined,
24
- topoId: "",
25
+ topoId: '',
25
26
  type: undefined,
26
27
  // 拓扑类型
27
28
  currentTopo: undefined,
@@ -65,8 +66,8 @@ export default function (topoApp) {
65
66
 
66
67
  topoModState = rootState.topoMod; // 处理URL参数
67
68
 
68
- type = params.type || "view";
69
- id = params.id || topoModState.topoId || "";
69
+ type = params.type || 'view';
70
+ id = params.id || topoModState.topoId || '';
70
71
  rlog.debug("topoMod.init \u521D\u59CB\u5316(" + id + ")...", {
71
72
  params: params,
72
73
  rootState: rootState
@@ -99,7 +100,7 @@ export default function (topoApp) {
99
100
  loading: false
100
101
  });
101
102
 
102
- rlog.debug("topoMod.initTopoCenter 初始化完成", {
103
+ rlog.debug('topoMod.initTopoCenter 初始化完成', {
103
104
  rootState: rootState
104
105
  });
105
106
 
@@ -144,7 +145,7 @@ export default function (topoApp) {
144
145
  switch (_context2.prev = _context2.next) {
145
146
  case 0:
146
147
  id = playload.id, data = playload.data, linkTo = playload.linkTo;
147
- viewState = playload.mode || playload.viewState || "view";
148
+ viewState = playload.mode || playload.viewState || 'view';
148
149
  topoId = id || data.config.id;
149
150
 
150
151
  _this2.update({
@@ -164,7 +165,7 @@ export default function (topoApp) {
164
165
  });
165
166
 
166
167
  case 6:
167
- if (viewState === "edit") {
168
+ if (viewState === 'edit') {
168
169
  // TODO 待优化进入编辑模式方式
169
170
  _this2.enterEditMode();
170
171
  }
@@ -191,7 +192,7 @@ export default function (topoApp) {
191
192
  this.update({
192
193
  graphLoaded: false,
193
194
  graphLoaded2: false,
194
- topoId: "",
195
+ topoId: '',
195
196
  topoData: null,
196
197
  currentTopo: undefined,
197
198
  data: null,
@@ -201,7 +202,7 @@ export default function (topoApp) {
201
202
  },
202
203
  switchToViewMode: function switchToViewMode(playload, rootState) {
203
204
  this.update({
204
- viewState: "view"
205
+ viewState: 'view'
205
206
  });
206
207
  },
207
208
  enterEditMode: function enterEditMode(playload, rootState) {
@@ -225,7 +226,7 @@ export default function (topoApp) {
225
226
  if (!topoId) {
226
227
  // 查找第一个
227
228
  treeData = rootState.topoTreeMod.treeData;
228
- loopTreeByKey(treeData, "type", 1, function (item, index, arr) {
229
+ loopTreeByKey(treeData, 'type', 1, function (item, index, arr) {
229
230
  if (!topoId) {
230
231
  topoId = item.id;
231
232
  }
@@ -302,7 +303,7 @@ export default function (topoApp) {
302
303
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
303
304
  var _result$config;
304
305
 
305
- var startTime, topoId, data, linkToData, refresh, clear, linkTo, startState, permission, result, graphConfig, topoConfig, _yield$Promise$all, ciTypeMap, customIcons, xxx, extraConfig, _combTopoData, topoData, resAndMetrics, endTime;
306
+ 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;
306
307
 
307
308
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
308
309
  while (1) {
@@ -335,25 +336,28 @@ export default function (topoApp) {
335
336
 
336
337
  _this5.update(startState);
337
338
 
339
+ dispatch.topoBizMod.update({
340
+ pollingSwitch: false
341
+ });
338
342
  topoApp.options.onLoadStart(); // TODO 待移到拓扑中心
339
343
 
340
- permission = "write";
344
+ permission = 'write';
341
345
 
342
346
  if (!topoApp.options.usePermission) {
343
- _context6.next = 18;
347
+ _context6.next = 19;
344
348
  break;
345
349
  }
346
350
 
347
- _context6.next = 13;
351
+ _context6.next = 14;
348
352
  return _this5.getTopoPermission({
349
353
  id: topoId
350
354
  });
351
355
 
352
- case 13:
356
+ case 14:
353
357
  permission = _context6.sent;
354
358
 
355
359
  if (topoPermissonUtil.isReadable(permission)) {
356
- _context6.next = 18;
360
+ _context6.next = 19;
357
361
  break;
358
362
  }
359
363
 
@@ -368,23 +372,23 @@ export default function (topoApp) {
368
372
  topoApp.options.onLoad();
369
373
  return _context6.abrupt("return");
370
374
 
371
- case 18:
375
+ case 19:
372
376
  if (!data) {
373
- _context6.next = 29;
377
+ _context6.next = 30;
374
378
  break;
375
379
  }
376
380
 
377
381
  graphConfig = {};
378
382
 
379
383
  if (!topoId) {
380
- _context6.next = 26;
384
+ _context6.next = 27;
381
385
  break;
382
386
  }
383
387
 
384
- _context6.next = 23;
388
+ _context6.next = 24;
385
389
  return topoService.getTopoData(topoId);
386
390
 
387
- case 23:
391
+ case 24:
388
392
  topoConfig = _context6.sent;
389
393
  if (!topoConfig) rlog.error("\u672A\u67E5\u8BE2\u5230\u62D3\u6251id " + topoId + " \u7684\u6570\u636E\uFF0C\u8BF7\u68C0\u67E5");
390
394
  graphConfig = {
@@ -393,21 +397,21 @@ export default function (topoApp) {
393
397
  serialize: topoConfig === null || topoConfig === void 0 ? void 0 : topoConfig.serialize
394
398
  };
395
399
 
396
- case 26:
400
+ case 27:
397
401
  result = _extends({}, data, graphConfig);
398
- _context6.next = 32;
402
+ _context6.next = 33;
399
403
  break;
400
404
 
401
- case 29:
402
- _context6.next = 31;
405
+ case 30:
406
+ _context6.next = 32;
403
407
  return topoApp.options.loadData(topoId, topoApp.serverApi);
404
408
 
405
- case 31:
409
+ case 32:
406
410
  result = _context6.sent;
407
411
 
408
- case 32:
412
+ case 33:
409
413
  if (result) {
410
- _context6.next = 36;
414
+ _context6.next = 37;
411
415
  break;
412
416
  }
413
417
 
@@ -422,19 +426,19 @@ export default function (topoApp) {
422
426
  topoApp.options.onLoad();
423
427
  return _context6.abrupt("return");
424
428
 
425
- case 36:
429
+ case 37:
426
430
  result = parseTopoData(result);
427
- rlog.debug("topoMod.initTopoData 查询数据完成", topoId, linkTo, result);
428
- _context6.next = 40;
429
- return Promise.all([topoApp.ciTyeCache.getCiTypeMap(getCiTypes(result)), dispatch.customIcon.loadCustomIcons(), topoApp.elementTagTipConfig.init(result) // 暂停新配置开发
431
+ rlog.debug('topoMod.initTopoData 查询数据完成', topoId, linkTo, result);
432
+ _context6.next = 41;
433
+ return Promise.all([// topoApp.ciTyeCache.getCiTypeMap(getCiTypes(result)),
434
+ dispatch.customIcon.loadCustomIcons() // topoApp.elementTagTipConfig.init(result), // 暂停新配置开发
430
435
  ]);
431
436
 
432
- case 40:
437
+ case 41:
433
438
  _yield$Promise$all = _context6.sent;
434
439
  ciTypeMap = _yield$Promise$all[0];
435
440
  customIcons = _yield$Promise$all[1];
436
441
  xxx = _yield$Promise$all[2];
437
- rlog.debug("topoMod.initTopoData Ci属性指标元数据", ciTypeMap);
438
442
  extraConfig = result.global.extraConfig;
439
443
  _context6.next = 48;
440
444
  return dispatch.displayConfig.setConfig(_extends({}, extraConfig, {
@@ -447,13 +451,11 @@ export default function (topoApp) {
447
451
  engine: topoApp,
448
452
  data: result,
449
453
  linkTo: linkTo,
450
- globalConfig: extraConfig,
451
- ciTypeMap: ciTypeMap,
452
- permission: permission
454
+ globalConfig: extraConfig
453
455
  }), topoData = _combTopoData.topoData, resAndMetrics = _combTopoData.resAndMetrics; // rlog.debug("topoMod.initTopoData combTopoData", { topoData, resAndMetrics, });
454
456
 
455
- _this5.update({
456
- loading: false,
457
+ _context6.next = 51;
458
+ return _this5.update({
457
459
  currentTopo: topoData.config,
458
460
  data: result,
459
461
  globalConfig: extraConfig,
@@ -462,16 +464,38 @@ export default function (topoApp) {
462
464
  resAndMetrics: resAndMetrics
463
465
  });
464
466
 
467
+ case 51:
465
468
  dispatch.topoBizMod.combBatchCiInfo(resAndMetrics);
466
469
  dispatch.background.init(extraConfig); // TODO 优化打开拓扑图显示告警速度:打开拓扑图立即请求告警
467
470
 
468
- topoApp.alarm.open();
471
+ topoApp.alarm.open(); // 加载标注悬浮框数据
472
+
473
+ _context6.next = 56;
474
+ return Promise.all([addLinkData(result), topoApp.ciTyeCache.getCiTypeMap(getCiTypes(result)), topoApp.elementTagTipConfig.init(result) // 暂停新配置开发
475
+ ]);
476
+
477
+ case 56:
478
+ _yield$Promise$all2 = _context6.sent;
479
+ newData = _yield$Promise$all2[0];
480
+ _context6.next = 60;
481
+ return _this5.update({
482
+ data: newData
483
+ });
484
+
485
+ case 60:
486
+ dispatch.topoBizMod.update({
487
+ pollingSwitch: true
488
+ });
469
489
  topoApp.onTopoDataLoaded(topoData);
470
490
  endTime = moment();
471
- rlog.info("topoMod.initTopoData 初始化拓扑图数据完成. 耗时: ", endTime.diff(startTime, "seconds", true));
491
+ rlog.info('topoMod.initTopoData 初始化拓扑图数据完成. 耗时: ', endTime.diff(startTime, 'seconds', true));
472
492
  topoApp.options.onLoad();
473
493
 
474
- case 57:
494
+ _this5.update({
495
+ loading: false
496
+ });
497
+
498
+ case 66:
475
499
  case "end":
476
500
  return _context6.stop();
477
501
  }
@@ -527,13 +551,13 @@ export default function (topoApp) {
527
551
  }
528
552
 
529
553
  if (conditions.id === state.topoMod.topoId) {
530
- if (conditions.type === "delete") {
554
+ if (conditions.type === 'delete') {
531
555
  _this7.update({
532
556
  topoId: conditions.defId
533
557
  });
534
558
  }
535
559
 
536
- if (conditions.type === "rename") {
560
+ if (conditions.type === 'rename') {
537
561
  td = _extends({}, state.topoMod.topoData, {
538
562
  config: _extends({}, state.topoMod.topoData.config, {
539
563
  name: conditions.name
@@ -577,10 +601,10 @@ export default function (topoApp) {
577
601
  switch (_context10.prev = _context10.next) {
578
602
  case 0:
579
603
  if (conditions === void 0) {
580
- conditions = "";
604
+ conditions = '';
581
605
  }
582
606
 
583
- rlog.debug("updateDelId", conditions);
607
+ rlog.debug('updateDelId', conditions);
584
608
 
585
609
  case 2:
586
610
  case "end":
@@ -525,7 +525,7 @@ export default function ResourceOverview(props) {
525
525
  ciType: ciType,
526
526
  type: type,
527
527
  // name: '123'
528
- name: props.name
528
+ name: props.name ? props.name : props.resourceData.attributes.name
529
529
  }; // 基本信息设置改变
530
530
 
531
531
  function baseInfoColChange(_x5) {
@@ -50,6 +50,10 @@ function SearchWidget(props) {
50
50
 
51
51
  var onChange = function onChange(value) {
52
52
  setSearchValue(value);
53
+
54
+ if (!value) {
55
+ topo.searchElements(searchType, value);
56
+ }
53
57
  };
54
58
 
55
59
  return /*#__PURE__*/React.createElement(_Search, {
@@ -1,11 +1,25 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import { getLinksDetail } from "../core/models/utils/linkUtils";
5
5
  import { addTopoDataResourcePermission } from "./utils/resourcePermissionUtil"; // import "./utils/__tests__/resourcePermissionUtil.test";
6
+ // 过滤掉无两端节点数据的链路
6
7
 
7
- export function addLinkData(_x, _x2) {
8
- return _addLinkData.apply(this, arguments);
8
+ function filterLinkNoSourceTarget(data) {
9
+ var links = (data.links || []).filter(function (link) {
10
+ var sourceNode = (data.nodes || []).find(function (node) {
11
+ return node.id === link.source;
12
+ });
13
+
14
+ if (link.source && !sourceNode) {
15
+ return false;
16
+ }
17
+
18
+ return true;
19
+ });
20
+ return _extends({}, data, {
21
+ links: links
22
+ });
9
23
  }
10
24
  /**
11
25
  * 修正告警配置。因为:接口返回值没有全局告警配置时,返回null,代表开启
@@ -13,42 +27,65 @@ export function addLinkData(_x, _x2) {
13
27
  * @returns
14
28
  */
15
29
 
30
+
31
+ function fixAlarmConfig(data) {
32
+ var _data$global = data.global,
33
+ alarmSwitch = _data$global.alarmSwitch,
34
+ alarmListDefaultOpen = _data$global.alarmListDefaultOpen;
35
+ return _extends({}, data, {
36
+ global: _extends({}, data.global, {
37
+ alarmSwitch: alarmSwitch === null ? true : alarmSwitch,
38
+ alarmListDefaultOpen: alarmListDefaultOpen === null ? true : alarmListDefaultOpen
39
+ })
40
+ });
41
+ } // 修正容器找不到时groupId设为空
42
+
43
+
44
+ function fixNodeGroupId(data) {
45
+ var nodes = (data.nodes || [] // 修正容器找不到时groupId设为空
46
+ ).map(function (node) {
47
+ var groupExisted = !!(data.groups || []).filter(function (g) {
48
+ return g.id === node.groupId;
49
+ }).length;
50
+ return _extends({}, node, {
51
+ groupId: groupExisted ? node.groupId : null
52
+ });
53
+ });
54
+ return _extends({}, data, {
55
+ nodes: nodes
56
+ });
57
+ }
58
+
59
+ export function addLinkData(_x) {
60
+ return _addLinkData.apply(this, arguments);
61
+ } // FIXME 业务拓扑不需要链路相关逻辑
62
+
16
63
  function _addLinkData() {
17
- _addLinkData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(oldLinks, nodes) {
18
- var links, networkLinks, otherLinks;
64
+ _addLinkData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
65
+ var links, nodes, networkLinks, otherLinks;
19
66
  return _regeneratorRuntime.wrap(function _callee$(_context) {
20
67
  while (1) {
21
68
  switch (_context.prev = _context.next) {
22
69
  case 0:
23
- // 过滤掉无两端节点数据的链路
24
- links = oldLinks.filter(function (link) {
25
- var sourceNode = nodes.find(function (node) {
26
- return node.id === link.source;
27
- });
28
-
29
- if (link.source && !sourceNode) {
30
- return false;
31
- }
32
-
33
- return true;
34
- }); // 如果是网络链路,补充详情信息
70
+ links = data.links || [];
71
+ nodes = data.nodes || []; // 如果是网络链路,补充详情信息
35
72
 
36
- _context.next = 3;
73
+ _context.next = 4;
37
74
  return getLinksDetail(links.filter(function (link) {
38
- return !link.ciType;
75
+ return link.ciType === 'network_link';
39
76
  }), nodes);
40
77
 
41
- case 3:
78
+ case 4:
42
79
  networkLinks = _context.sent;
43
80
  otherLinks = links.filter(function (link) {
44
- return !!link.ciType;
81
+ return link.ciType !== 'network_link';
45
82
  });
46
- return _context.abrupt("return", {
83
+ return _context.abrupt("return", _extends({}, data, {
47
84
  links: [].concat(networkLinks, otherLinks),
48
85
  linkGroups: []
49
- });
86
+ }));
50
87
 
51
- case 6:
88
+ case 7:
52
89
  case "end":
53
90
  return _context.stop();
54
91
  }
@@ -58,54 +95,25 @@ function _addLinkData() {
58
95
  return _addLinkData.apply(this, arguments);
59
96
  }
60
97
 
61
- function fixAlarmConfig(data) {
62
- var _data$global = data.global,
63
- alarmSwitch = _data$global.alarmSwitch,
64
- alarmListDefaultOpen = _data$global.alarmListDefaultOpen;
65
- return _extends({}, data, {
66
- global: _extends({}, data.global, {
67
- alarmSwitch: alarmSwitch === null ? true : alarmSwitch,
68
- alarmListDefaultOpen: alarmListDefaultOpen === null ? true : alarmListDefaultOpen
69
- })
70
- });
71
- } // FIXME 业务拓扑不需要链路相关逻辑
72
-
73
-
74
- export function buildData(_x3) {
98
+ export function buildData(_x2) {
75
99
  return _buildData.apply(this, arguments);
76
100
  }
77
101
 
78
102
  function _buildData() {
79
- _buildData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(data) {
80
- var newData, nodes, _yield$Promise$all, linkData;
81
-
103
+ _buildData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(oldData) {
104
+ var data;
82
105
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
83
106
  while (1) {
84
107
  switch (_context2.prev = _context2.next) {
85
108
  case 0:
86
- newData = _extends({}, data);
87
- nodes = (data.nodes || [] // 修正容器找不到时groupId设为空
88
- ).map(function (node) {
89
- var groupExisted = !!(data.groups || []).filter(function (g) {
90
- return g.id === node.groupId;
91
- }).length;
92
- return _extends({}, node, {
93
- groupId: groupExisted ? node.groupId : null
94
- });
95
- });
96
- _context2.next = 4;
97
- return Promise.all([addLinkData(data.links || [], nodes)]);
109
+ data = oldData;
110
+ data = fixNodeGroupId(data);
111
+ data = filterLinkNoSourceTarget(data); // data = await addLinkData(data)
98
112
 
99
- case 4:
100
- _yield$Promise$all = _context2.sent;
101
- linkData = _yield$Promise$all[0];
102
- newData = _extends({}, newData, {
103
- nodes: nodes
104
- }, linkData);
105
- newData = addTopoDataResourcePermission(newData);
106
- return _context2.abrupt("return", newData);
107
-
108
- case 9:
113
+ data = addTopoDataResourcePermission(data);
114
+ return _context2.abrupt("return", data);
115
+
116
+ case 5:
109
117
  case "end":
110
118
  return _context2.stop();
111
119
  }
@@ -115,7 +123,7 @@ function _buildData() {
115
123
  return _buildData.apply(this, arguments);
116
124
  }
117
125
 
118
- export default function getTopoData(_x4, _x5) {
126
+ export default function getTopoData(_x3, _x4) {
119
127
  return _getTopoData.apply(this, arguments);
120
128
  }
121
129
 
@@ -30,87 +30,7 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
30
30
  return DEFAULT_TIP_COMMON_CONFIG;
31
31
  } // ExtElementTagTipBuilder: LinkTagsTipsBuilder,
32
32
 
33
- },
34
- onSwitchToEditModeBegin: function () {
35
- var _onSwitchToEditModeBegin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(topo) {
36
- var topoDispatchers;
37
- return _regeneratorRuntime.wrap(function _callee$(_context) {
38
- while (1) {
39
- switch (_context.prev = _context.next) {
40
- case 0:
41
- topoDispatchers = topo.store.getModelDispatchers('topoMod'); // topoDispatchers.update({ topoData: null });
42
-
43
- _context.next = 3;
44
- return topoDispatchers.refreshTopo();
45
-
46
- case 3:
47
- case "end":
48
- return _context.stop();
49
- }
50
- }
51
- }, _callee);
52
- }));
53
-
54
- function onSwitchToEditModeBegin(_x) {
55
- return _onSwitchToEditModeBegin.apply(this, arguments);
56
- }
57
-
58
- return onSwitchToEditModeBegin;
59
- }(),
60
- onSwitchToEditMode: function () {
61
- var _onSwitchToEditMode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(topo) {
62
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
63
- while (1) {
64
- switch (_context2.prev = _context2.next) {
65
- case 0:
66
- _context2.next = 2;
67
- return topo.resourceConfig.loadConfig();
68
-
69
- case 2:
70
- case "end":
71
- return _context2.stop();
72
- }
73
- }
74
- }, _callee2);
75
- }));
76
-
77
- function onSwitchToEditMode(_x2) {
78
- return _onSwitchToEditMode.apply(this, arguments);
79
- }
80
-
81
- return onSwitchToEditMode;
82
- }(),
83
- onSwitchToViewMode: function () {
84
- var _onSwitchToViewMode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(topo) {
85
- var topoModDispatchers;
86
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
87
- while (1) {
88
- switch (_context3.prev = _context3.next) {
89
- case 0:
90
- topoModDispatchers = topo.store.getModelDispatchers('topoMod');
91
- _context3.next = 3;
92
- return topoModDispatchers.openTopoPage({
93
- id: topo.id
94
- });
95
-
96
- case 3:
97
- _context3.next = 5;
98
- return topoModDispatchers.refreshTopoTree();
99
-
100
- case 5:
101
- case "end":
102
- return _context3.stop();
103
- }
104
- }
105
- }, _callee3);
106
- }));
107
-
108
- function onSwitchToViewMode(_x3) {
109
- return _onSwitchToViewMode.apply(this, arguments);
110
- }
111
-
112
- return onSwitchToViewMode;
113
- }()
33
+ }
114
34
  })) || this;
115
35
  _this.resourceConfig = null;
116
36
  var menuCommands = createMenuCommands(_assertThisInitialized(_this));
@@ -131,25 +51,25 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
131
51
  _proto.initData =
132
52
  /*#__PURE__*/
133
53
  function () {
134
- var _initData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(params) {
54
+ var _initData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
135
55
  var topoDispatchers;
136
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
56
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
137
57
  while (1) {
138
- switch (_context4.prev = _context4.next) {
58
+ switch (_context.prev = _context.next) {
139
59
  case 0:
140
60
  topoDispatchers = this.store.getModelDispatchers('topoCenter');
141
- _context4.next = 3;
61
+ _context.next = 3;
142
62
  return topoDispatchers.initData(params);
143
63
 
144
64
  case 3:
145
65
  case "end":
146
- return _context4.stop();
66
+ return _context.stop();
147
67
  }
148
68
  }
149
- }, _callee4, this);
69
+ }, _callee, this);
150
70
  }));
151
71
 
152
- function initData(_x4) {
72
+ function initData(_x) {
153
73
  return _initData.apply(this, arguments);
154
74
  }
155
75
 
@@ -168,22 +88,22 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
168
88
  _proto.exit =
169
89
  /*#__PURE__*/
170
90
  function () {
171
- var _exit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
91
+ var _exit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
172
92
  var topoDispatchers;
173
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
93
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
174
94
  while (1) {
175
- switch (_context5.prev = _context5.next) {
95
+ switch (_context2.prev = _context2.next) {
176
96
  case 0:
177
97
  topoDispatchers = this.store.getModelDispatchers('topoCenter');
178
- _context5.next = 3;
98
+ _context2.next = 3;
179
99
  return topoDispatchers.exit();
180
100
 
181
101
  case 3:
182
102
  case "end":
183
- return _context5.stop();
103
+ return _context2.stop();
184
104
  }
185
105
  }
186
- }, _callee5, this);
106
+ }, _callee2, this);
187
107
  }));
188
108
 
189
109
  function exit() {