@riil-frontend/component-topology 12.0.0-dev.8 → 12.1.0-dev.1

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 (98) hide show
  1. package/build/1.js +1 -1
  2. package/build/index.css +1 -1
  3. package/build/index.js +14 -14
  4. package/es/components/TemplateButton/index.module.scss +1 -1
  5. package/es/core/components/AlarmListPanel/components/AlarmListItem.js +58 -3
  6. package/es/core/components/TopoView/topoView.js +5 -1
  7. package/es/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +5 -12
  8. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +27 -10
  9. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +21 -1
  10. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +9 -0
  11. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +2 -2
  12. package/es/core/editor/components/Toolbar/widgets/Layout/index.js +16 -2
  13. package/es/core/editor/hooks/useKeyboardShortcut.js +3 -1
  14. package/es/core/editor/utils/copyElementUtil.js +12 -0
  15. package/es/core/editor/utils/edgeTypeStyleUtil.js +8 -30
  16. package/es/core/hooks/useAlarm.js +131 -81
  17. package/es/core/hooks/useCmpLinkAlarm.js +153 -0
  18. package/es/core/hooks/useEventData.js +1 -2
  19. package/es/core/hooks/useGraphAlarmDisplay.js +91 -56
  20. package/es/core/hooks/useResourceConfig.js +1 -3
  21. package/es/core/hooks/useTopoEdit.js +51 -58
  22. package/es/core/models/Alarm.js +69 -142
  23. package/es/core/models/AttributeMetricDisplay.js +14 -5
  24. package/es/core/models/TopoApp.js +1 -1
  25. package/es/core/models/cache/CiCache.d.ts +1 -1
  26. package/es/core/models/cache/CiCache.js +3 -3
  27. package/es/core/models/cache/CiTypeCache.js +4 -0
  28. package/es/core/models/topoData.js +0 -1
  29. package/es/core/models/utils/linkUtils.js +20 -13
  30. package/es/core/services/index.js +1 -1
  31. package/es/core/services/topo/basic.js +2 -2
  32. package/es/core/store/models/topoConfig.js +7 -10
  33. package/es/core/store/models/topoMod.js +81 -134
  34. package/es/core/utils/edgeUtil.js +8 -0
  35. package/es/core/utils/metricUtil.js +8 -4
  36. package/es/core/utils/showGraphManageStatusUtil.js +3 -2
  37. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +12 -13
  38. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +2 -2
  39. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +20 -18
  40. package/es/core/viewer/components/plugins/ViewerPlugin.js +3 -1
  41. package/es/core/viewer/components/titlebar/widgets/AlarmButton.js +1 -5
  42. package/es/networkTopo/components/TopoView.js +6 -11
  43. package/es/networkTopo/hooks/useEdgeExpand.js +2 -3
  44. package/es/networkTopo/services/topo/basic.js +3 -3
  45. package/es/networkTopo/store/topoCenter.js +260 -223
  46. package/es/style.js +1 -1
  47. package/es/utils/ResourceConfigUtil.js +3 -36
  48. package/es/utils/ciRefAttributeTranslateUtil.d.ts +19 -0
  49. package/es/utils/ciRefAttributeTranslateUtil.js +155 -0
  50. package/es/utils/topoData.js +4 -2
  51. package/lib/components/TemplateButton/index.module.scss +1 -1
  52. package/lib/core/components/AlarmListPanel/components/AlarmListItem.js +60 -3
  53. package/lib/core/components/TopoView/topoView.js +5 -1
  54. package/lib/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +6 -12
  55. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +27 -9
  56. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +21 -1
  57. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +8 -0
  58. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -1
  59. package/lib/core/editor/components/Toolbar/widgets/Layout/index.js +16 -2
  60. package/lib/core/editor/hooks/useKeyboardShortcut.js +2 -0
  61. package/lib/core/editor/utils/copyElementUtil.js +15 -0
  62. package/lib/core/editor/utils/edgeTypeStyleUtil.js +8 -31
  63. package/lib/core/hooks/useAlarm.js +130 -79
  64. package/lib/core/hooks/useCmpLinkAlarm.js +166 -0
  65. package/lib/core/hooks/useEventData.js +1 -2
  66. package/lib/core/hooks/useGraphAlarmDisplay.js +91 -55
  67. package/lib/core/hooks/useResourceConfig.js +1 -3
  68. package/lib/core/hooks/useTopoEdit.js +50 -57
  69. package/lib/core/models/Alarm.js +69 -144
  70. package/lib/core/models/AttributeMetricDisplay.js +16 -4
  71. package/lib/core/models/TopoApp.js +1 -1
  72. package/lib/core/models/cache/CiCache.d.ts +1 -1
  73. package/lib/core/models/cache/CiCache.js +3 -3
  74. package/lib/core/models/cache/CiTypeCache.js +4 -0
  75. package/lib/core/models/topoData.js +0 -1
  76. package/lib/core/models/utils/linkUtils.js +21 -13
  77. package/lib/core/services/index.js +1 -1
  78. package/lib/core/services/topo/basic.js +2 -2
  79. package/lib/core/store/models/topoConfig.js +7 -10
  80. package/lib/core/store/models/topoMod.js +81 -134
  81. package/lib/core/utils/edgeUtil.js +10 -0
  82. package/lib/core/utils/metricUtil.js +8 -4
  83. package/lib/core/utils/showGraphManageStatusUtil.js +3 -2
  84. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +12 -13
  85. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +2 -2
  86. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +20 -18
  87. package/lib/core/viewer/components/plugins/ViewerPlugin.js +3 -1
  88. package/lib/core/viewer/components/titlebar/widgets/AlarmButton.js +1 -5
  89. package/lib/networkTopo/components/TopoView.js +5 -14
  90. package/lib/networkTopo/hooks/useEdgeExpand.js +2 -3
  91. package/lib/networkTopo/services/topo/basic.js +3 -3
  92. package/lib/networkTopo/store/topoCenter.js +262 -225
  93. package/lib/style.js +1 -1
  94. package/lib/utils/ResourceConfigUtil.js +3 -38
  95. package/lib/utils/ciRefAttributeTranslateUtil.d.ts +19 -0
  96. package/lib/utils/ciRefAttributeTranslateUtil.js +168 -0
  97. package/lib/utils/topoData.js +4 -2
  98. package/package.json +3 -3
@@ -7,6 +7,7 @@ import { isMonitoring } from "../utils/manageStatusUtil";
7
7
  import AttributeFormatter from "./attributeFormatter";
8
8
  import DictCache from "./cache/DictCache";
9
9
  import { getNodesNameVisible as _getNodesNameVisible, updateNodesNameVisible as _updateNodesNameVisible } from "./utils/nodeNameVisibleUtil";
10
+ import { translateCisRefAttributeName } from "../../utils/ciRefAttributeTranslateUtil";
10
11
 
11
12
  function isGraphField(item) {
12
13
  return item.type === 'graph';
@@ -331,7 +332,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
331
332
  }); // 翻译引用属性
332
333
 
333
334
  _context.next = 4;
334
- return this.translateRefAttribute(ciDatas);
335
+ return translateCisRefAttributeName(ciDatas);
335
336
 
336
337
  case 4:
337
338
  ciDatas = _context.sent;
@@ -461,8 +462,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
461
462
  var refCi = refCiMap[refAttrs.id];
462
463
 
463
464
  if (refCi) {
465
+ // 引用ci名称获取规则:如果ci是树形结构(例如区域),取 tree_name_path;非树形,取display_name
466
+ var displayName = refCi.attributes.tree_name_path || refCi.attributes.display_name;
464
467
  attributeMap[refAttrs.attrCode + "_object"] = {
465
- displayName: refCi.attributes.display_name
468
+ displayName: displayName
466
469
  };
467
470
  }
468
471
  });
@@ -522,15 +525,21 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
522
525
  return _extends({}, item, {
523
526
  tags: tags
524
527
  });
525
- }); // rlog.debug(`AttributeMetricDisplay.updateTagsTips ${new Date().toLocaleString()}`, elementTagsAndTips);
526
-
528
+ });
529
+ rlog.debug('推送标注 => ht', elementTagsAndTips);
527
530
  var htTopo = topo.getHtTopo();
528
531
 
529
532
  if (htTopo) {
530
533
  var _topo$historyManager, _topo$historyManager2;
531
534
 
532
535
  (_topo$historyManager = topo.historyManager) === null || _topo$historyManager === void 0 ? void 0 : _topo$historyManager.setDisabled(true, '加载标注');
533
- htTopo.loadTagAndTip(JSON.parse(JSON.stringify(elementTagsAndTips)));
536
+
537
+ try {
538
+ htTopo.loadTagAndTip(JSON.parse(JSON.stringify(elementTagsAndTips)));
539
+ } catch (error) {
540
+ rlog.error('推送标注 => ht 失败', error);
541
+ }
542
+
534
543
  (_topo$historyManager2 = topo.historyManager) === null || _topo$historyManager2 === void 0 ? void 0 : _topo$historyManager2.setDisabled(false, '加载标注');
535
544
  }
536
545
  }
@@ -24,7 +24,7 @@ import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
24
24
  import SelectionModel from "./SelectionModel";
25
25
  import CiCache from "./cache/CiCache"; // eslint-disable-next-line no-undef
26
26
 
27
- var version = typeof "12.0.0-dev.8" === 'string' ? "12.0.0-dev.8" : null;
27
+ var version = typeof "12.1.0-dev.1" === 'string' ? "12.1.0-dev.1" : null;
28
28
  console.info("\u62D3\u6251\u7248\u672C: " + version);
29
29
  /**
30
30
  * 拓扑显示和编辑
@@ -11,7 +11,7 @@ declare class CiCache {
11
11
  * @param ids {string[]}
12
12
  * @returns {Promise<Object>}
13
13
  */
14
- load(ids: string[]): Promise<Object>;
14
+ load(ids: string[], refreshCiCache?: boolean): Promise<Object>;
15
15
  getCi(id: string): Object;
16
16
  }
17
17
  declare const _default: CiCache;
@@ -23,14 +23,14 @@ var CiCache = /*#__PURE__*/function () {
23
23
  _proto.load =
24
24
  /*#__PURE__*/
25
25
  function () {
26
- var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(ids) {
26
+ var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(ids, refreshCiCache) {
27
27
  var _this = this;
28
28
 
29
29
  var unloadCiIds, cis, map;
30
30
  return _regeneratorRuntime.wrap(function _callee$(_context) {
31
31
  while (1) switch (_context.prev = _context.next) {
32
32
  case 0:
33
- unloadCiIds = ids.filter(function (id) {
33
+ unloadCiIds = refreshCiCache === true ? ids : ids.filter(function (id) {
34
34
  return !_this.ciMap[id];
35
35
  });
36
36
 
@@ -62,7 +62,7 @@ var CiCache = /*#__PURE__*/function () {
62
62
  }, _callee, this);
63
63
  }));
64
64
 
65
- function load(_x) {
65
+ function load(_x, _x2) {
66
66
  return _load.apply(this, arguments);
67
67
  }
68
68
 
@@ -106,6 +106,10 @@ var CiTypeCache = /*#__PURE__*/function () {
106
106
  this.ciTypeMap = cache;
107
107
  };
108
108
 
109
+ _proto.getCiTypeMap = function getCiTypeMap() {
110
+ return this.ciTypeMap;
111
+ };
112
+
109
113
  _proto.getCiType = function getCiType(typeCode) {
110
114
  return this.ciTypeMap[typeCode];
111
115
  };
@@ -105,7 +105,6 @@ function _saveTopo() {
105
105
  return topoService.bindResourceToTopo(topoId, {
106
106
  groups: groupInfo,
107
107
  linkIps: linkIps,
108
- // exportLinkIdList,
109
108
  relateTopoIdList: relateTopoIdList
110
109
  });
111
110
 
@@ -2,8 +2,7 @@ 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
4
  import keyBy from "lodash/keyBy";
5
- import _ from "lodash";
6
- import { queryCisByIds, queryModelAsset } from "../../services"; // 查询所有连线
5
+ import _ from "lodash"; // 查询所有连线
7
6
 
8
7
  import { getEdges } from "../../../utils/htElementUtils";
9
8
  import CiTypeCache from "../cache/CiTypeCache";
@@ -32,7 +31,20 @@ export function isCrucialLink(link) {
32
31
  */
33
32
 
34
33
  export function isExitLink(link) {
35
- return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes["destination_id"]);
34
+ var _link$attributes;
35
+
36
+ return (link === null || link === void 0 ? void 0 : (_link$attributes = link.attributes) === null || _link$attributes === void 0 ? void 0 : _link$attributes.destination_type) === "ip";
37
+ }
38
+ /**
39
+ * 是否聚合链路
40
+ * @param {*} link
41
+ * @returns
42
+ */
43
+
44
+ export function isAggLink(link) {
45
+ var _link$attributes2, _link$attributes3;
46
+
47
+ return (link === null || link === void 0 ? void 0 : (_link$attributes2 = link.attributes) === null || _link$attributes2 === void 0 ? void 0 : _link$attributes2.destination_type) === "network.agg_interface" && (link === null || link === void 0 ? void 0 : (_link$attributes3 = link.attributes) === null || _link$attributes3 === void 0 ? void 0 : _link$attributes3.source_type) === "network.agg_interface";
36
48
  }
37
49
  export function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc) {
38
50
  var linkCiMap = keyBy(links, "id");
@@ -83,7 +95,7 @@ function _getLinksDetail() {
83
95
  return _regeneratorRuntime.wrap(function _callee$(_context) {
84
96
  while (1) switch (_context.prev = _context.next) {
85
97
  case 0:
86
- if (!(!links || !links.length)) {
98
+ if (links !== null && links !== void 0 && links.length) {
87
99
  _context.next = 2;
88
100
  break;
89
101
  }
@@ -91,9 +103,6 @@ function _getLinksDetail() {
91
103
  return _context.abrupt("return", []);
92
104
 
93
105
  case 2:
94
- // const linkCis = await topoService.relation.batchQueryRelation(
95
- // links.map((link) => link.id)
96
- // );
97
106
  linkCis = links;
98
107
  interfaceIds = [].concat(linkCis.map(function (item) {
99
108
  return item.attributes.source_id;
@@ -171,17 +180,15 @@ export var showLinkByConfig = function showLinkByConfig(props) {
171
180
  if (showType === 1 || showType === true) {
172
181
  // 单链路全部显示
173
182
  // console.log("单链路全部显示", edge);
174
- edge.s("2d.visible", true);
183
+ edge.s("x.visible", true);
175
184
  } else {
176
- var _d$attributes, _d$attributes2;
177
-
178
185
  var d = topo.dataModel.getDataById(edge.getTag()); // 判断是否聚合链路
179
186
 
180
- if ((d === null || d === void 0 ? void 0 : (_d$attributes = d.attributes) === null || _d$attributes === void 0 ? void 0 : _d$attributes.destination_type) === "network.agg_interface" && (d === null || d === void 0 ? void 0 : (_d$attributes2 = d.attributes) === null || _d$attributes2 === void 0 ? void 0 : _d$attributes2.source_type) === "network.agg_interface") {
181
- edge.s("2d.visible", showAgg);
187
+ if (isAggLink(d)) {
188
+ edge.s("x.visible", showAgg);
182
189
  } else {
183
190
  // console.log("edge", edge, d, showAgg);
184
- edge.s("2d.visible", showPhy);
191
+ edge.s("x.visible", showPhy);
185
192
  }
186
193
  }
187
194
  });
@@ -16,7 +16,7 @@ function _queryCisByIds() {
16
16
  return commonQueryCiDataByIds(ids, {
17
17
  orders: [],
18
18
  pageIndex: 1,
19
- pageSize: 100000
19
+ pageSize: 10000
20
20
  });
21
21
 
22
22
  case 2:
@@ -104,7 +104,7 @@ export default {
104
104
  * @param {Array} groups
105
105
  * @returns
106
106
  */
107
- getTopoDataByResource: function getTopoDataByResource(id, resources, groups, exportLinkIdList) {
107
+ getTopoDataByResource: function getTopoDataByResource(id, resources, groups) {
108
108
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
109
109
  var data, obj;
110
110
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -123,7 +123,7 @@ export default {
123
123
  obj = prepareGroupParams(data);
124
124
  _context.next = 5;
125
125
  return request.post(API_ROOT + "/structure/byCondition/" + id, _extends({}, obj, {
126
- exportLinkIdList: exportLinkIdList
126
+ exportLinkIdList: []
127
127
  }));
128
128
 
129
129
  case 5:
@@ -35,7 +35,6 @@ var initialState = {
35
35
  "static": []
36
36
  },
37
37
  groups: [],
38
- exportLinkIdList: [],
39
38
  // config: {
40
39
  // view: null,
41
40
  // groups: [],
@@ -243,18 +242,17 @@ export default function (topoApp) {
243
242
  var _this2 = this;
244
243
 
245
244
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
246
- var editState, resources, _editState$groups, groups, _editState$ipNodes, ipNodes, query, data;
245
+ var editState, resources, _editState$groups, groups, query, data;
247
246
 
248
247
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
249
248
  while (1) switch (_context2.prev = _context2.next) {
250
249
  case 0:
251
250
  editState = rootState.topoConfig;
252
- resources = editState.resources, _editState$groups = editState.groups, groups = _editState$groups === void 0 ? [] : _editState$groups, _editState$ipNodes = editState.ipNodes, ipNodes = _editState$ipNodes === void 0 ? [] : _editState$ipNodes;
251
+ resources = editState.resources, _editState$groups = editState.groups, groups = _editState$groups === void 0 ? [] : _editState$groups;
253
252
  query = {
254
253
  id: rootState.topoMod.topoId,
255
254
  resources: resources,
256
- groups: groups,
257
- ipNodes: ipNodes
255
+ groups: groups
258
256
  };
259
257
  _context2.next = 5;
260
258
  return _this2.getTopoByConditions(query);
@@ -303,13 +301,13 @@ export default function (topoApp) {
303
301
  var _this4 = this;
304
302
 
305
303
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
306
- var topoId, resources, groups, exportLinkIdList, ipNodes, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
304
+ var topoId, resources, groups, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
307
305
 
308
306
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
309
307
  while (1) switch (_context4.prev = _context4.next) {
310
308
  case 0:
311
309
  rlog.debug("getTopoByConditions--------", params);
312
- topoId = params.id, resources = params.resources, groups = params.groups, exportLinkIdList = params.exportLinkIdList, ipNodes = params.ipNodes;
310
+ topoId = params.id, resources = params.resources, groups = params.groups;
313
311
  viewConditions = resToConditions(resources);
314
312
  groupInfo = isAvailableArray(groups) && groups.map(function (group) {
315
313
  return _extends({}, group, {
@@ -319,7 +317,7 @@ export default function (topoApp) {
319
317
  });
320
318
  rlog.debug("getTopoByConditions--------", viewConditions, groupInfo);
321
319
  _context4.next = 7;
322
- return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, exportLinkIdList, ipNodes);
320
+ return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo);
323
321
 
324
322
  case 7:
325
323
  data = _context4.sent;
@@ -458,8 +456,7 @@ export default function (topoApp) {
458
456
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
459
457
  while (1) switch (_context8.prev = _context8.next) {
460
458
  case 0:
461
- ids = data.ids, ip = data.ip; // console.log("queryAllLinkByIp", ids, ip);
462
-
459
+ ids = data.ids, ip = data.ip;
463
460
  _context8.next = 3;
464
461
  return networkLinkServer.queryLinksByIp(ids, ip);
465
462