@riil-frontend/component-topology 2.14.2-alpha.2 → 2.14.2-alpha.6

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 (84) hide show
  1. package/build/1.js +2 -2
  2. package/build/2.js +1 -1
  3. package/build/index.css +1 -1
  4. package/build/index.js +22 -22
  5. package/demo/1/345/237/272/346/234/254//350/207/252/345/256/232/344/271/211/345/261/236/346/200/247/345/222/214/346/214/207/346/240/207.md +1 -1
  6. package/demo/API//346/250/241/345/236/213.md +29 -0
  7. package/es/components/BatchAttrMetric/constant.js +4 -0
  8. package/es/components/BatchAttrMetric/index.js +8 -10
  9. package/es/components/BatchAttrMetric/setting.js +6 -4
  10. package/es/components/BatchAttrMetric/utils.js +39 -32
  11. package/es/constants/ResourceTypeLimit.js +1 -1
  12. package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +6 -5
  13. package/es/core/components/DisplaySettingDrawer/LinkTag.js +8 -6
  14. package/es/core/components/DisplaySettingDrawer/LinkTip.js +9 -7
  15. package/es/core/components/DisplaySettingDrawer/NodeTag.js +2 -0
  16. package/es/core/components/DisplaySettingDrawer/NodeTip.js +2 -0
  17. package/es/core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig.js +30 -9
  18. package/es/core/components/ResourceViewAttributeSetting/Setting.js +123 -0
  19. package/es/core/editor/components/EditorPlugin.js +4 -3
  20. package/es/core/editor/components/settings/propertyViews/view/GlobalTootipSetting.js +3 -1
  21. package/es/core/editor/components/settings/propertyViews/view/ViewPropertyView.js +0 -5
  22. package/es/core/models/AttributeMetricDisplay.js +181 -66
  23. package/es/core/models/TopoApp.js +18 -16
  24. package/es/core/models/attributeFormatter/index.js +33 -8
  25. package/es/core/models/common/Alarm.js +45 -31
  26. package/es/core/models/utils/linkUtils.js +14 -2
  27. package/es/core/utils/exportData.js +33 -0
  28. package/es/core/utils/linkPollingAttributesAdapter.js +3 -0
  29. package/es/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.js +264 -0
  30. package/es/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.module.scss +73 -0
  31. package/es/core/viewer/components/plugins/BaseInfo/index.js +127 -0
  32. package/es/core/viewer/components/plugins/BaseInfo/index.module.scss +24 -0
  33. package/es/core/viewer/components/plugins/ViewerPlugin.js +2 -1
  34. package/es/core/viewer/components/titlebar/widgets/MoreButtonMenu.js +5 -0
  35. package/es/getStoreModels.js +3 -1
  36. package/es/hooks/useAlarm.js +1 -1
  37. package/es/hooks/usePolling.js +2 -1
  38. package/es/models/topoAlarm.js +43 -17
  39. package/es/models/topoBaseInfoOverview.js +43 -0
  40. package/es/models/topoBizMod.js +0 -70
  41. package/es/style.js +8 -7
  42. package/es/utils/topoData.js +266 -155
  43. package/lib/components/BatchAttrMetric/constant.js +4 -0
  44. package/lib/components/BatchAttrMetric/index.js +8 -10
  45. package/lib/components/BatchAttrMetric/setting.js +8 -5
  46. package/lib/components/BatchAttrMetric/utils.js +39 -35
  47. package/lib/constants/ResourceTypeLimit.js +1 -1
  48. package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +6 -5
  49. package/lib/core/components/DisplaySettingDrawer/LinkTag.js +8 -6
  50. package/lib/core/components/DisplaySettingDrawer/LinkTip.js +9 -7
  51. package/lib/core/components/DisplaySettingDrawer/NodeTag.js +2 -0
  52. package/lib/core/components/DisplaySettingDrawer/NodeTip.js +2 -0
  53. package/lib/core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig.js +32 -8
  54. package/lib/core/{editor/components → components}/ResourceViewAttributeSetting/Setting.js +77 -71
  55. package/lib/core/editor/components/EditorPlugin.js +3 -3
  56. package/lib/core/editor/components/settings/propertyViews/view/GlobalTootipSetting.js +3 -1
  57. package/lib/core/editor/components/settings/propertyViews/view/ViewPropertyView.js +0 -5
  58. package/lib/core/models/AttributeMetricDisplay.js +181 -66
  59. package/lib/core/models/TopoApp.js +18 -17
  60. package/lib/core/models/attributeFormatter/index.js +34 -8
  61. package/lib/core/models/common/Alarm.js +46 -33
  62. package/lib/core/models/utils/linkUtils.js +12 -2
  63. package/lib/core/utils/exportData.js +44 -0
  64. package/lib/core/utils/linkPollingAttributesAdapter.js +10 -0
  65. package/lib/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.js +284 -0
  66. package/lib/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.module.scss +73 -0
  67. package/lib/core/viewer/components/plugins/BaseInfo/index.js +146 -0
  68. package/lib/core/viewer/components/plugins/BaseInfo/index.module.scss +24 -0
  69. package/lib/core/viewer/components/plugins/ViewerPlugin.js +3 -1
  70. package/lib/core/viewer/components/titlebar/widgets/MoreButtonMenu.js +6 -0
  71. package/lib/getStoreModels.js +4 -1
  72. package/lib/hooks/useAlarm.js +1 -1
  73. package/lib/hooks/usePolling.js +2 -1
  74. package/lib/models/topoAlarm.js +43 -17
  75. package/lib/models/topoBaseInfoOverview.js +55 -0
  76. package/lib/models/topoBizMod.js +0 -70
  77. package/lib/style.js +8 -7
  78. package/lib/utils/topoData.js +267 -151
  79. package/package.json +2 -2
  80. package/es/core/editor/components/ResourceViewAttributeSetting/ResourceViewAttributeSettingPlugin.js +0 -57
  81. package/es/core/editor/components/ResourceViewAttributeSetting/Setting.js +0 -114
  82. package/es/core/models/attrAndMetric.js +0 -131
  83. package/lib/core/editor/components/ResourceViewAttributeSetting/ResourceViewAttributeSettingPlugin.js +0 -73
  84. package/lib/core/models/attrAndMetric.js +0 -148
@@ -1,16 +1,23 @@
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 topoServer from '@riil-frontend/component-topology-common/es/services/topo';
5
5
  import rlog from '@riil-frontend/component-topology-utils/es/rlog';
6
- import { DEFAULT_NODE_TAG_COMMON_CONFIG, DEFAULT_TIP_COMMON_CONFIG } from "../../constants/ResourceInfoDisplay";
6
+ import { DEFAULT_NODE_TAG_COMMON_CONFIG, DEFAULT_TAG_COMMON_CONFIG, DEFAULT_TIP_COMMON_CONFIG } from "../../constants/ResourceInfoDisplay";
7
7
  import { findItem } from "../../utils/topoData";
8
8
  import AttributeFormatter from "./attributeFormatter";
9
9
  import DictCache from "./cache/DictCache";
10
+
11
+ function filterUnExistedFields(fields, ciTypeMeta) {
12
+ return fields.filter(function (item) {
13
+ return item.type !== 'graph' && (item.type === 'attribute' && ciTypeMeta.attributeMap[item.code] || item.type === 'metric' && ciTypeMeta.metricMap[item.code] || item.type !== 'attribute' && item.type !== 'metric');
14
+ });
15
+ }
10
16
  /**
11
17
  * 资源标注、悬浮框数据
12
18
  */
13
19
 
20
+
14
21
  var AttributeMetricDisplay = /*#__PURE__*/function () {
15
22
  function AttributeMetricDisplay(topo) {
16
23
  this.topo = topo;
@@ -21,11 +28,15 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
21
28
  _proto.getConfig = function getConfig(config) {
22
29
  var _ref = config || this.topo.store.getModelState('displayConfig'),
23
30
  nodeTag = _ref.nodeTag,
24
- nodeTip = _ref.nodeTip;
31
+ nodeTip = _ref.nodeTip,
32
+ linkTag = _ref.linkTag,
33
+ linkTip = _ref.linkTip;
25
34
 
26
35
  return {
27
36
  nodeTag: nodeTag,
28
- nodeTip: nodeTip
37
+ nodeTip: nodeTip,
38
+ linkTag: linkTag,
39
+ linkTip: linkTip
29
40
  };
30
41
  }
31
42
  /**
@@ -49,41 +60,13 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
49
60
  data = cfg.data;
50
61
  var items = isCustom ? data[ciType] : data; // TODO 过滤类型不存在的属性和指标、图上名称
51
62
 
52
- return items.filter(function (item) {
53
- return item.type !== 'graph' && (item.type === 'attribute' && ciTypeMeta.attributeMap[item.code] || item.type === 'metric' && ciTypeMeta.metricMap[item.code] || item.type !== 'attribute' && item.type !== 'metric');
54
- });
63
+ return filterUnExistedFields(items, ciTypeMeta);
55
64
  }
56
65
 
57
66
  return {
58
67
  tags: getItems(nodeTag || DEFAULT_NODE_TAG_COMMON_CONFIG),
59
68
  tips: getItems(nodeTip || DEFAULT_TIP_COMMON_CONFIG)
60
69
  };
61
- } // 获取资源节点是否显示名称配置
62
- ;
63
-
64
- _proto.getNodeNameVisibleConfig = function getNodeNameVisibleConfig(config) {
65
- var nodes = this.topo.store.getModelState('topoMod').data.nodes;
66
-
67
- var _this$getConfig2 = this.getConfig(config),
68
- nodeTag = _this$getConfig2.nodeTag;
69
-
70
- return nodes.map(function (node) {
71
- var visible = true;
72
-
73
- if (nodeTag) {
74
- var isCustom = nodeTag.isCustom,
75
- data = nodeTag.data;
76
- var items = isCustom ? data[node.ciType] : data;
77
- visible = !!items.filter(function (item) {
78
- return item.type === 'graph';
79
- }).length;
80
- }
81
-
82
- return {
83
- id: node.id,
84
- visible: visible
85
- };
86
- });
87
70
  }
88
71
  /**
89
72
  * 按链路类型获取对应的属性、指标配置
@@ -94,31 +77,44 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
94
77
  ;
95
78
 
96
79
  _proto.getNetworkLinkConfig = function getNetworkLinkConfig(link, config) {
97
- var _this$getConfig3 = this.getConfig(config),
98
- linkTag = _this$getConfig3.linkTag,
99
- linkTip = _this$getConfig3.linkTip;
80
+ var _this$getConfig2 = this.getConfig(config),
81
+ linkTag = _this$getConfig2.linkTag,
82
+ linkTip = _this$getConfig2.linkTip;
100
83
 
101
84
  var linkConnectType = link.detail.attributes['network_link.connect_type'];
102
- var ciTypeModel = this.topo.ciTyeCache.getNetworkLinkCiType(linkConnectType);
85
+ var ciTypeMeta = this.topo.ciTyeCache.getNetworkLinkCiType(linkConnectType);
103
86
 
104
87
  function getItems(cfg, connectType) {
88
+ if (!ciTypeMeta) {
89
+ return [];
90
+ }
91
+
105
92
  var isCustom = cfg.isCustom,
106
93
  data = cfg.data;
107
- var items = isCustom ? data[connectType.id] : data;
108
- var arr = [];
109
- items.forEach(function (item) {
94
+ var configItems = (isCustom ? data[connectType.id] : data) || [];
95
+ var items = [];
96
+ configItems.forEach(function (item) {
110
97
  if (item.type === 'metric') {
111
- if (ciTypeModel.metricMap[item.code]) {
112
- arr.push(item);
113
- } else if (ciTypeModel.metricMap[item.code]) {}
98
+ var finalCode = null;
99
+ var code = item.code;
100
+
101
+ if (ciTypeMeta.metricMap[code]) {
102
+ finalCode = code;
103
+ } else if (ciTypeMeta.metricMap["" + connectType.metricPprefix + code]) {
104
+ finalCode = "" + connectType.metricPprefix + code;
105
+ }
106
+
107
+ if (finalCode) {
108
+ items.push(_extends({}, item, {
109
+ code: finalCode
110
+ }));
111
+ }
114
112
  } else {
115
- arr.push(item);
113
+ items.push(item);
116
114
  }
117
- }); // TODO 过滤不存在的,图上名称、IP地址 如果不存在需要过滤
115
+ }); // 过滤不存在的
118
116
 
119
- return items.filter(function (item) {
120
- return item.type !== 'graph';
121
- });
117
+ return filterUnExistedFields(items, ciTypeMeta);
122
118
  }
123
119
 
124
120
  var linkConfig = {};
@@ -130,8 +126,8 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
130
126
  metricPprefix: 'agg_link.'
131
127
  }].forEach(function (connectType) {
132
128
  linkConfig[connectType.id] = {
133
- tags: getItems(linkTag, connectType),
134
- tips: getItems(linkTip, connectType)
129
+ tags: getItems(linkTag || DEFAULT_TAG_COMMON_CONFIG, connectType),
130
+ tips: getItems(linkTip || DEFAULT_TIP_COMMON_CONFIG, connectType)
135
131
  };
136
132
  });
137
133
  return linkConfig[link.detail.attributes['network_link.connect_type']] || {
@@ -151,9 +147,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
151
147
  _proto.getResourceTagTipConfig = function getResourceTagTipConfig(data, config) {
152
148
  var _this = this;
153
149
 
154
- var _ref2 = data || this.topo.store.getModelState('topoMod').data,
150
+ // 获得图上业务节点、业务连线
151
+ var _ref2 = data || this.topo.getData(),
155
152
  nodes = _ref2.nodes,
156
- links = _ref2.links; // 无权限不显示标注、悬浮框
153
+ lines = _ref2.lines; // 无权限不显示标注、悬浮框
157
154
 
158
155
 
159
156
  var filterByPermission = function filterByPermission(resource, items) {
@@ -171,11 +168,26 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
171
168
  tags: filterByPermission(node, ciTypeConfig.tags),
172
169
  tips: filterByPermission(node, ciTypeConfig.tips)
173
170
  };
171
+ }), lines.filter(function (link) {
172
+ return link.ciType === 'network_link';
173
+ }).map(function (link) {
174
+ var ciType = link.ciType;
175
+
176
+ var ciTypeConfig = _this.getNetworkLinkConfig(link, config);
177
+
178
+ return {
179
+ code: link.id,
180
+ ciType: ciType,
181
+ tags: filterByPermission(link, ciTypeConfig.tags),
182
+ tips: filterByPermission(link, ciTypeConfig.tips)
183
+ };
174
184
  }));
175
185
  } // 获取资源属性、指标配置(不包含显示名称)
176
186
  ;
177
187
 
178
188
  _proto.getResourceFields = function getResourceFields() {
189
+ var _this2 = this;
190
+
179
191
  return this.getResourceTagTipConfig().map(function (ciConfig) {
180
192
  // 非标注需要的属性往这里添加。例如动态改变带宽需要链路带宽
181
193
  var fields = {
@@ -191,7 +203,18 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
191
203
  if (Array.isArray(arr) && arr.indexOf(code) === -1) {
192
204
  arr.push(code);
193
205
  }
194
- });
206
+ }); // 增加概览需要的指标字段
207
+
208
+ var overviewState = _this2.topo.store.getModelState('topoBaseInfoOverview');
209
+
210
+ if (overviewState.id === fields.id) {
211
+ overviewState.metricCodes.forEach(function (code) {
212
+ if (fields.metrics.indexOf(code) === -1) {
213
+ fields.metrics.push(code);
214
+ }
215
+ });
216
+ }
217
+
195
218
  return fields;
196
219
  });
197
220
  }
@@ -213,6 +236,54 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
213
236
  });
214
237
  return metricCodes;
215
238
  }
239
+ /**
240
+ * 从配置获得节点名称是否显示
241
+ * @param {*} node
242
+ * @returns
243
+ */
244
+ ;
245
+
246
+ _proto.getNodeNameVisible = function getNodeNameVisible(node) {
247
+ var _this$getConfig3 = this.getConfig(),
248
+ nodeTag = _this$getConfig3.nodeTag;
249
+
250
+ var visible = true;
251
+
252
+ if (nodeTag) {
253
+ var isCustom = nodeTag.isCustom,
254
+ data = nodeTag.data;
255
+ var items = isCustom ? data[node.ciType] : data;
256
+ visible = !!items.filter(function (item) {
257
+ return item.type === 'graph';
258
+ }).length;
259
+ }
260
+
261
+ return visible;
262
+ }
263
+ /**
264
+ * 根据配置执行节点名称显示隐藏
265
+ */
266
+ ;
267
+
268
+ _proto.updateNodesNameVisible = function updateNodesNameVisible() {
269
+ var _this3 = this;
270
+
271
+ var dm = this.topo.getDataModel();
272
+
273
+ var _this$topo$getData = this.topo.getData(),
274
+ nodes = _this$topo$getData.nodes;
275
+
276
+ nodes.map(function (node) {
277
+ return {
278
+ id: node.id,
279
+ visible: _this3.getNodeNameVisible(node)
280
+ };
281
+ }).forEach(function (_ref3) {
282
+ var id = _ref3.id,
283
+ visible = _ref3.visible;
284
+ dm.getDataByTag(id).a('isShowName', visible);
285
+ });
286
+ }
216
287
  /**
217
288
  * 查询拓扑图资源的属性指标
218
289
  *
@@ -224,27 +295,48 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
224
295
  /*#__PURE__*/
225
296
  function () {
226
297
  var _getData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
227
- var _this$topo$store$getS, resIdsList, nodeIdsList, linkIdsList, codes, param;
298
+ var _this4 = this;
299
+
300
+ var _this$topo$store$getS, resIdsList, nodeIdsList, linkIdsList, codes, param, linkAdapter, result;
228
301
 
229
302
  return _regeneratorRuntime.wrap(function _callee$(_context) {
230
303
  while (1) {
231
304
  switch (_context.prev = _context.next) {
232
305
  case 0:
306
+ linkAdapter = function _linkAdapter(data, topo) {
307
+ var links = topo.store.getModelState('topoMod').data.links;
308
+ var link = findItem(links, 'id', data.id);
309
+
310
+ if (!link) {
311
+ return data;
312
+ }
313
+
314
+ var attributeMap = data.attributeMap;
315
+
316
+ if (!Object.keys(attributeMap).length) {
317
+ attributeMap = _extends({}, link.attributes || {});
318
+ }
319
+
320
+ return _extends({}, data, {
321
+ attributeMap: attributeMap
322
+ });
323
+ };
324
+
233
325
  _this$topo$store$getS = this.topo.store.getState().topoBizMod.resAndMetrics, resIdsList = _this$topo$store$getS.resIdsList, nodeIdsList = _this$topo$store$getS.nodeIdsList, linkIdsList = _this$topo$store$getS.linkIdsList; // rlog.debug('根据ci的id获取属性的值-getCiArrByIds', resIdsList, metrics);
234
326
  // 无资源,不查询
235
327
 
236
328
  if (resIdsList.length) {
237
- _context.next = 3;
329
+ _context.next = 4;
238
330
  break;
239
331
  }
240
332
 
241
333
  return _context.abrupt("return", []);
242
334
 
243
- case 3:
244
- _context.next = 5;
335
+ case 4:
336
+ _context.next = 6;
245
337
  return DictCache.init();
246
338
 
247
- case 5:
339
+ case 6:
248
340
  // 需要查询的指标列表
249
341
  codes = this.getResourceMetricCodes(); // if (!codes.length) {
250
342
  // return [];
@@ -254,15 +346,35 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
254
346
  ciId: nodeIdsList,
255
347
  codes: codes,
256
348
  relationId: linkIdsList
257
- }; // rlog.debug('AttributeMetricDisplay.getMetrics', param);
258
-
259
- _context.next = 9;
349
+ };
350
+ /**
351
+ * 链路属性适配
352
+ * @param {*} data
353
+ * @param {*} topo
354
+ * @returns
355
+ */
356
+
357
+ _context.next = 10;
260
358
  return topoServer.ciInfo.batchQueryCiInfo(param);
261
359
 
262
- case 9:
263
- return _context.abrupt("return", _context.sent);
264
-
265
360
  case 10:
361
+ result = _context.sent;
362
+ return _context.abrupt("return", result.map(function (data) {
363
+ var list2map = function list2map(list) {
364
+ var map = {};
365
+ (list || []).forEach(function (item) {
366
+ map[item.code] = item.value;
367
+ });
368
+ return map;
369
+ };
370
+
371
+ return linkAdapter(_extends({}, data, {
372
+ attributeMap: list2map(data.attributes),
373
+ metricMap: list2map(data.metrics)
374
+ }), _this4.topo);
375
+ }));
376
+
377
+ case 12:
266
378
  case "end":
267
379
  return _context.stop();
268
380
  }
@@ -300,7 +412,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
300
412
 
301
413
  case 4:
302
414
  // 获取标注、悬浮框配置
303
- ciConfigs = topo.attributeMetricDisplay.getResourceTagTipConfig();
415
+ ciConfigs = this.getResourceTagTipConfig();
304
416
  formatter = new AttributeFormatter(this.topo);
305
417
  tagAndTip = ciConfigs.map(function (ciConfig) {
306
418
  // 获取ci数据
@@ -315,7 +427,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
315
427
  };
316
428
  }); // 刷新标注、浮层
317
429
 
318
- rlog.debug('TopoView:sendAttributesData', tagAndTip);
430
+ rlog.debug('属性指标:loadAttributeAndMetric', {
431
+ tagAndTip: tagAndTip,
432
+ ciConfigs: ciConfigs
433
+ });
319
434
  topo.getHtTopo().loadTagAndTip(tagAndTip);
320
435
 
321
436
  case 9:
@@ -12,7 +12,6 @@ import buildProvider from "../components/buildProvider";
12
12
  import { getEdgeDatas, getGroupDatas, getNodeDatas } from "../../utils/htElementUtils";
13
13
  import Test from "../test/Test";
14
14
  import { formatGroups } from "../../utils/topoData";
15
- import { updateAttrsAndMetrics } from "./attrAndMetric";
16
15
  import DictCache from "./cache/DictCache";
17
16
  import AttributeMetricDisplay from "./AttributeMetricDisplay";
18
17
  import TopoDataModel from "./TopoDataModel";
@@ -38,6 +37,7 @@ var TopoApp = /*#__PURE__*/function () {
38
37
  this.store = void 0;
39
38
  this.serverApi = topoService;
40
39
  this.ciTyeCache = CiTyeCache;
40
+ this.dictCache = DictCache;
41
41
  this.test = void 0;
42
42
  this.options = _extends({
43
43
  enableDefaultAlarmLoader: true,
@@ -597,9 +597,15 @@ var TopoApp = /*#__PURE__*/function () {
597
597
  }
598
598
 
599
599
  return exitEditMode;
600
- }();
600
+ }()
601
+ /**
602
+ * 后续待优化,移除该接口,由ht提供原子接口获取相关数据
603
+ */
604
+ ;
601
605
 
602
- _proto.triggerSaveEvent = /*#__PURE__*/function () {
606
+ _proto.triggerSaveEvent =
607
+ /*#__PURE__*/
608
+ function () {
603
609
  var _triggerSaveEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
604
610
  return _regeneratorRuntime.wrap(function _callee14$(_context14) {
605
611
  while (1) {
@@ -620,9 +626,15 @@ var TopoApp = /*#__PURE__*/function () {
620
626
  }
621
627
 
622
628
  return triggerSaveEvent;
623
- }();
629
+ }()
630
+ /**
631
+ * 后续待优化,移除该接口,由ht提供原子接口获取相关数据
632
+ */
633
+ ;
624
634
 
625
- _proto.save = /*#__PURE__*/function () {
635
+ _proto.save =
636
+ /*#__PURE__*/
637
+ function () {
626
638
  var _save = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
627
639
  return _regeneratorRuntime.wrap(function _callee15$(_context15) {
628
640
  while (1) {
@@ -700,21 +712,11 @@ var TopoApp = /*#__PURE__*/function () {
700
712
  while (1) {
701
713
  switch (_context17.prev = _context17.next) {
702
714
  case 0:
703
- _context17.next = 2;
704
- return DictCache.init();
705
-
706
- case 2:
707
- updateAttrsAndMetrics({
708
- topo: this,
709
- data: data
710
- });
711
-
712
- case 3:
713
715
  case "end":
714
716
  return _context17.stop();
715
717
  }
716
718
  }
717
- }, _callee17, this);
719
+ }, _callee17);
718
720
  }));
719
721
 
720
722
  function loadAttrsAndMetrics(_x11) {
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import { metricValueFormat } from '@riil-frontend/utils';
2
3
  import { findItem } from "../../../utils/topoData";
3
4
  import DictCache from "../cache/DictCache";
@@ -23,6 +24,33 @@ function formatMetric(val, metricInfo) {
23
24
  return "" + val;
24
25
  }
25
26
  }
27
+
28
+ function addLinkMetricUnderlineArrow(metricCode) {
29
+ var map = {
30
+ // 总流速和总带宽利用率:双向箭头
31
+ 'link.total_flow_rate': 'both',
32
+ 'link.bandwidth_utilization': 'both',
33
+ // 发送速率和发送带宽利用率:背向取值端口的箭头 指向目的
34
+ 'link.out_rate': 'to',
35
+ 'link.out_bandwidth_utilization': 'to',
36
+ // 接收速率和接收带宽利用率:指向取值端口的箭头 指向源
37
+ 'link.in_rate': 'from',
38
+ 'link.in_bandwidth_utilization': 'from'
39
+ };
40
+ var codes = Object.keys(map);
41
+
42
+ for (var i = 0; i < codes.length; i++) {
43
+ var code = codes[i];
44
+
45
+ if (metricCode.endsWith(code)) {
46
+ return {
47
+ underlineArrow: map[code]
48
+ };
49
+ }
50
+ }
51
+
52
+ return {};
53
+ }
26
54
  /**
27
55
  * 标注值格式化
28
56
  */
@@ -34,9 +62,7 @@ var AttributeFormatter = /*#__PURE__*/function () {
34
62
  this.transformMap = {
35
63
  attribute: this.attributeTransform.bind(this),
36
64
  metric: this.metricTransform.bind(this),
37
- ciType: this.ciTypeAttrTransform.bind(this),
38
- linkMetric: null // TODO 链路自定义转换
39
-
65
+ ciType: this.ciTypeAttrTransform.bind(this)
40
66
  };
41
67
  }
42
68
 
@@ -59,16 +85,15 @@ var AttributeFormatter = /*#__PURE__*/function () {
59
85
 
60
86
  var attrCode = item.code;
61
87
  var metricMeta = this.topo.ciTyeCache.getCiType(ciData.ciType)[attrType + "Map"][attrCode];
62
- var metricValue = (_findItem = findItem(ciData[attrType + "s"], 'code', attrCode)) === null || _findItem === void 0 ? void 0 : _findItem.value;
63
- return {
88
+ var metricValue = ciData[attrType + "Map"][attrCode] || ((_findItem = findItem(ciData[attrType + "s"], 'code', attrCode)) === null || _findItem === void 0 ? void 0 : _findItem.value);
89
+ return _extends({
64
90
  type: item.type,
65
91
  code: item.code,
66
92
  // 属性code
67
93
  name: (metricMeta === null || metricMeta === void 0 ? void 0 : metricMeta.name) || '',
68
94
  // 属性名称
69
- value: formatMetric(metricValue, metricMeta) // 属性数值
70
-
71
- };
95
+ value: formatMetric(metricValue, metricMeta)
96
+ }, addLinkMetricUnderlineArrow(attrCode));
72
97
  };
73
98
 
74
99
  _proto.attributeTransform = function attributeTransform(item, ciData) {