@riil-frontend/component-topology 2.15.23 → 2.15.26

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.
@@ -5,8 +5,9 @@
5
5
  // box-shadow: 0px 0px 6px 1px #F2F7FD;
6
6
  width: 360px !important;
7
7
  box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.16);
8
- border-radius: 4px;
9
- border: 1px solid #DCDEE3;
8
+ border-radius: 4px;
9
+ background-color: #FFF;
10
+ border: 1px solid #DCDEE3;
10
11
 
11
12
  .listTitle {
12
13
  color: #4D6277;
@@ -27,22 +28,25 @@ border: 1px solid #DCDEE3;
27
28
  .#{$css-prefix}dialog-body {
28
29
  padding: 0px;
29
30
  }
30
-
31
+
31
32
 
32
33
  .#{$css-prefix}list-header {
33
- padding: 8px 16px 12px 16px !important;
34
+ padding: 8px 16px 12px 16px !important;
34
35
  border-bottom: none;
35
- height:44px;
36
+ height: 44px;
36
37
  box-shadow: 0px 1px 0px 0px #E4E9EE;
37
38
  }
38
- .#{$css-prefix}list-empty{
39
+
40
+ .#{$css-prefix}list-empty {
39
41
  padding: 1px;
40
-
42
+
41
43
  }
44
+
42
45
  .#{$css-prefix}list-items {
43
46
  max-height: 230px;
44
47
  overflow-y: scroll;
45
48
  }
49
+
46
50
  .#{$css-prefix}list-item {
47
51
  border-bottom: none !important;
48
52
  padding: 12px 16px !important;
@@ -70,11 +74,13 @@ border: 1px solid #DCDEE3;
70
74
  margin-top: 6px;
71
75
  }
72
76
  }
73
- .emptyContent{
74
- height: 224px;
75
- color: #586477;
76
- font-size: 14px;
77
- }
77
+
78
+ .emptyContent {
79
+ height: 224px;
80
+ color: #586477;
81
+ font-size: 14px;
82
+ }
83
+
78
84
  //告警级别颜色
79
85
  .alarm-color {
80
86
 
@@ -54,10 +54,12 @@
54
54
  }
55
55
  }
56
56
 
57
- .#{$css-prefix}collapse-panel-content {
57
+ .#{$css-prefix}collapse-panel-content,
58
+ .#{$css-prefix}collapse-panel-expanded>.#{$css-prefix}collapse-panel-content {
58
59
  padding-left: 32px;
59
60
  padding-top: 8px;
60
61
  }
62
+
61
63
  }
62
64
 
63
65
  .header {
@@ -24,7 +24,12 @@ function filterUnExistedFields(fields, ciTypeMeta) {
24
24
  return fields.filter(function (item) {
25
25
  return isFieldExisted(item, ciTypeMeta);
26
26
  });
27
- }
27
+ } // 无权限不显示标注、悬浮框
28
+
29
+
30
+ var filterByPermission = function filterByPermission(resource, items) {
31
+ return resource.operation ? items : [];
32
+ };
28
33
  /**
29
34
  * 资源标注、悬浮框数据
30
35
  */
@@ -152,6 +157,31 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
152
157
  tips: []
153
158
  };
154
159
  }
160
+ /**
161
+ * 查询需要查询数据的连线
162
+ * @param {*} data
163
+ * @returns
164
+ */
165
+ ;
166
+
167
+ _proto.getEdges = function getEdges(data) {
168
+ // 获得图上业务节点、业务连线
169
+ var _ref2 = data || this.topo.dataModel.getData(),
170
+ links = _ref2.links,
171
+ linkGroups = _ref2.linkGroups;
172
+
173
+ return [].concat(links.map(function (link) {
174
+ return _extends({}, link, {
175
+ type: 'edge'
176
+ });
177
+ }), linkGroups.map(function (link) {
178
+ return _extends({}, link, {
179
+ type: 'edgeGroup'
180
+ });
181
+ })).filter(function (link) {
182
+ return link.ciType === 'network_link';
183
+ });
184
+ }
155
185
  /**
156
186
  * 获取资源的标注、悬浮框配置,只包含属性和指标字段。无权限的资源无配置
157
187
  *
@@ -165,15 +195,8 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
165
195
  var _this = this;
166
196
 
167
197
  // 获得图上业务节点、业务连线
168
- var _ref2 = data || this.topo.store.getModelState('topoMod').data,
169
- nodes = _ref2.nodes,
170
- links = _ref2.links,
171
- linkGroups = _ref2.linkGroups; // 无权限不显示标注、悬浮框
172
-
173
-
174
- var filterByPermission = function filterByPermission(resource, items) {
175
- return resource.operation ? items : [];
176
- };
198
+ var _ref3 = data || this.topo.dataModel.getData(),
199
+ nodes = _ref3.nodes;
177
200
 
178
201
  return [].concat(nodes.filter(function (node) {
179
202
  return !!node.ciType;
@@ -189,29 +212,13 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
189
212
  tags: filterByPermission(node, ciTypeConfig.tags),
190
213
  tips: filterByPermission(node, ciTypeConfig.tips)
191
214
  };
192
- }), links.filter(function (link) {
193
- return link.ciType === 'network_link';
194
- }).map(function (link) {
195
- var ciType = link.ciType;
196
-
197
- var ciTypeConfig = _this.getNetworkLinkConfig(link, config);
198
-
199
- return {
200
- type: 'edge',
201
- id: link.id,
202
- ciType: ciType,
203
- tags: filterByPermission(link, ciTypeConfig.tags),
204
- tips: filterByPermission(link, ciTypeConfig.tips)
205
- };
206
- }), linkGroups.filter(function (link) {
207
- return link.ciType === 'network_link';
208
- }).map(function (link) {
215
+ }), this.getEdges().map(function (link) {
209
216
  var ciType = link.ciType;
210
217
 
211
218
  var ciTypeConfig = _this.getNetworkLinkConfig(link, config);
212
219
 
213
220
  return {
214
- type: 'edgeGroup',
221
+ type: link.type,
215
222
  id: link.id,
216
223
  ciType: ciType,
217
224
  tags: filterByPermission(link, ciTypeConfig.tags),
@@ -226,6 +233,8 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
226
233
 
227
234
  return this.getResourceTagTipConfig().map(function (ciConfig) {
228
235
  var fields = {
236
+ ciType: ciConfig.ciType,
237
+ type: ciConfig.type,
229
238
  id: ciConfig.id,
230
239
  attributes: [],
231
240
  metrics: []
@@ -299,7 +308,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
299
308
  _proto.getNodesNameVisible = function getNodesNameVisible() {
300
309
  var _this3 = this;
301
310
 
302
- var nodes = this.topo.store.getModelState('topoMod').data.nodes;
311
+ var nodes = this.topo.dataModel.getNodes();
303
312
  return nodes.map(function (node) {
304
313
  return {
305
314
  id: node.id,
@@ -314,9 +323,9 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
314
323
 
315
324
  _proto.updateNodesNameVisible = function updateNodesNameVisible() {
316
325
  var dm = this.topo.getDataModel();
317
- this.getNodesNameVisible().forEach(function (_ref3) {
318
- var id = _ref3.id,
319
- visible = _ref3.visible;
326
+ this.getNodesNameVisible().forEach(function (_ref4) {
327
+ var id = _ref4.id,
328
+ visible = _ref4.visible;
320
329
  dm.getDataByTag(id).a('isShowName', visible);
321
330
  });
322
331
  }
@@ -333,14 +342,14 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
333
342
  var _fetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
334
343
  var _this4 = this;
335
344
 
336
- var _this$topo$store$getS, resIdsList, nodeIdsList, linkIdsList, _this$topo$store$getM, links, linkGroups, codes, param, linkAdapter, result;
345
+ var topo, _topo$store$getState$, resIdsList, nodeIdsList, codes, param, linkAdapter, result;
337
346
 
338
347
  return _regeneratorRuntime.wrap(function _callee$(_context) {
339
348
  while (1) {
340
349
  switch (_context.prev = _context.next) {
341
350
  case 0:
342
351
  linkAdapter = function _linkAdapter(data) {
343
- var link = findItem([].concat(links, linkGroups), 'id', data.id);
352
+ var link = topo.dataModel.getDataById(data.id);
344
353
 
345
354
  if (!link) {
346
355
  return data;
@@ -353,9 +362,9 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
353
362
  });
354
363
  };
355
364
 
356
- _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);
357
-
358
- _this$topo$store$getM = this.topo.store.getModelState('topoMod').data, links = _this$topo$store$getM.links, linkGroups = _this$topo$store$getM.linkGroups; // 无资源,不查询
365
+ topo = this.topo;
366
+ _topo$store$getState$ = topo.store.getState().topoBizMod.resAndMetrics, resIdsList = _topo$store$getState$.resIdsList, nodeIdsList = _topo$store$getState$.nodeIdsList; // rlog.debug('根据ci的id获取属性的值-getCiArrByIds', resIdsList, metrics);
367
+ // 无资源,不查询
359
368
 
360
369
  if (resIdsList.length) {
361
370
  _context.next = 5;
@@ -370,14 +379,17 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
370
379
 
371
380
  case 7:
372
381
  // 需要查询的指标列表
373
- codes = this.getResourceMetricCodes(); // if (!codes.length) {
374
- // return [];
375
- // }
376
-
382
+ codes = this.getResourceMetricCodes();
377
383
  param = {
378
384
  ciId: nodeIdsList,
379
385
  codes: codes,
380
- relationId: linkIdsList
386
+ // 过滤掉不需要查询的
387
+ relationId: this.getEdges().map(function (edge) {
388
+ return {
389
+ ciId: edge.id,
390
+ operation: edge.operation
391
+ };
392
+ })
381
393
  };
382
394
  /**
383
395
  * 链路属性适配
@@ -668,9 +680,9 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
668
680
  var _this6 = this;
669
681
 
670
682
  // 查询没有关联链路的连线组及对应子链路列表
671
- var _this$topo$store$getM2 = this.topo.store.getModelState('topoMod').data,
672
- links = _this$topo$store$getM2.links,
673
- linkGroups = _this$topo$store$getM2.linkGroups;
683
+ var _this$topo$dataModel$ = this.topo.dataModel.getData(),
684
+ links = _this$topo$dataModel$.links,
685
+ linkGroups = _this$topo$dataModel$.linkGroups;
674
686
 
675
687
  var getLinkUId = function getLinkUId(link) {
676
688
  return [link.source, link.target].sort().join('-');
@@ -698,19 +710,24 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
698
710
  calcType: 'sum'
699
711
  }, {
700
712
  code: 'bandwidth_utilization',
701
- calcType: 'avg'
702
- }, {
703
- code: 'out_rate',
704
- calcType: 'avg'
713
+ calcType: 'avg',
714
+ showWhenSameSource: true
705
715
  }, {
706
716
  code: 'out_bandwidth_utilization',
707
- calcType: 'avg'
708
- }, {
709
- code: 'in_rate',
710
- calcType: 'avg'
717
+ calcType: 'avg',
718
+ showWhenSameSource: true
711
719
  }, {
712
720
  code: 'in_bandwidth_utilization',
713
- calcType: 'avg'
721
+ calcType: 'avg',
722
+ showWhenSameSource: true
723
+ }, {
724
+ code: 'out_rate',
725
+ calcType: 'avg',
726
+ showWhenSameSource: true
727
+ }, {
728
+ code: 'in_rate',
729
+ calcType: 'avg',
730
+ showWhenSameSource: true
714
731
  }];
715
732
  var connectTypePrefixMap = {
716
733
  phy: 'physical_link.',
@@ -718,17 +735,44 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
718
735
  };
719
736
  var calcFnMap = {
720
737
  sum: function sum(values) {
721
- return values.reduce(function (val, total) {
722
- return total + parseInt(val, 10);
738
+ return values.reduce(function (total, val) {
739
+ return total + parseInt(val || 0, 10);
723
740
  }, 0);
724
741
  },
725
742
  avg: function avg(values) {
726
- return values.reduce(function (val, total) {
727
- return total + parseFloat(val, 10);
743
+ return values.reduce(function (total, val) {
744
+ return total + parseFloat(val || 0, 10);
728
745
  }, 0) / values.length;
729
746
  }
747
+ };
748
+
749
+ var filterField = function filterField(item, linkChildren) {
750
+ var fieldConfig = metrics.find(function (m) {
751
+ return item.code.endsWith(m.code);
752
+ });
753
+
754
+ if (item.type !== 'metric' || !fieldConfig) {
755
+ return false;
756
+ } // 如果需要校验取值接口,如果取值接口为不同设备的接口,则不显示这四个指标
757
+
758
+
759
+ if (fieldConfig.showWhenSameSource) {
760
+ var sources = [];
761
+ linkChildren.forEach(function (link) {
762
+ if (sources.indexOf(link.source) !== -1) {
763
+ sources.push(link.source);
764
+ }
765
+ });
766
+
767
+ if (sources.length > 1) {
768
+ return false;
769
+ }
770
+ }
771
+
772
+ return true;
730
773
  }; // 计算标注和指标
731
774
 
775
+
732
776
  var edgeGroupsTagsTips = Object.keys(groupMap) // 过滤非连线组
733
777
  .filter(function (groupId) {
734
778
  var linkChildren = groupMap[groupId];
@@ -742,14 +786,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
742
786
  });
743
787
  config = _extends({}, config, {
744
788
  tags: config.tags.filter(function (item) {
745
- return item.type === 'metric' && !!metrics.find(function (m) {
746
- return item.code.endsWith(m.code);
747
- });
789
+ return filterField(item, linkChildren);
748
790
  }),
749
791
  tips: config.tips.filter(function (item) {
750
- return item.type === 'metric' && !!metrics.find(function (m) {
751
- return item.code.endsWith(m.code);
752
- });
792
+ return filterField(item, linkChildren);
753
793
  })
754
794
  }); // 构造数据,计算指标值
755
795
 
@@ -20,7 +20,7 @@ import { updateEdgeExpanded } from "../utils/edgeUtil";
20
20
  import PluginManager from "./PluginManager";
21
21
  import topoFactory from "./topoFactory"; // eslint-disable-next-line no-undef
22
22
 
23
- var version = typeof "2.15.23" === 'string' ? "2.15.23" : null;
23
+ var version = typeof "2.15.26" === 'string' ? "2.15.26" : null;
24
24
  console.info("\u62D3\u6251\u7248\u672C: " + version);
25
25
  /**
26
26
  * 拓扑显示和编辑
@@ -41,6 +41,8 @@ export default function AlarmListShowButton(props) {
41
41
  })),
42
42
  cache: true,
43
43
  defaultVisible: true,
44
+ canCloseByOutSideClick: false,
45
+ canCloseByTrigger: false,
44
46
  visible: alarmPanelIsOpen,
45
47
  onVisibleChange: onVisibleChange,
46
48
  offset: [112, 5],
@@ -33,9 +33,11 @@ var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
33
33
  var _this = this;
34
34
 
35
35
  var topo = this.topo;
36
- var _topo$store$getModelS = topo.store.getModelState('topoMod').data,
37
- links = _topo$store$getModelS.links,
38
- linkGroups = _topo$store$getModelS.linkGroups;
36
+
37
+ var _topo$dataModel$getDa = topo.dataModel.getData(),
38
+ links = _topo$dataModel$getDa.links,
39
+ linkGroups = _topo$dataModel$getDa.linkGroups;
40
+
39
41
  var dataModel = this.topo.getDataModel(); // 1、如果连线可见,设置线宽
40
42
 
41
43
  links.forEach(function (link) {
@@ -5,8 +5,9 @@
5
5
  // box-shadow: 0px 0px 6px 1px #F2F7FD;
6
6
  width: 360px !important;
7
7
  box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.16);
8
- border-radius: 4px;
9
- border: 1px solid #DCDEE3;
8
+ border-radius: 4px;
9
+ background-color: #FFF;
10
+ border: 1px solid #DCDEE3;
10
11
 
11
12
  .listTitle {
12
13
  color: #4D6277;
@@ -27,22 +28,25 @@ border: 1px solid #DCDEE3;
27
28
  .#{$css-prefix}dialog-body {
28
29
  padding: 0px;
29
30
  }
30
-
31
+
31
32
 
32
33
  .#{$css-prefix}list-header {
33
- padding: 8px 16px 12px 16px !important;
34
+ padding: 8px 16px 12px 16px !important;
34
35
  border-bottom: none;
35
- height:44px;
36
+ height: 44px;
36
37
  box-shadow: 0px 1px 0px 0px #E4E9EE;
37
38
  }
38
- .#{$css-prefix}list-empty{
39
+
40
+ .#{$css-prefix}list-empty {
39
41
  padding: 1px;
40
-
42
+
41
43
  }
44
+
42
45
  .#{$css-prefix}list-items {
43
46
  max-height: 230px;
44
47
  overflow-y: scroll;
45
48
  }
49
+
46
50
  .#{$css-prefix}list-item {
47
51
  border-bottom: none !important;
48
52
  padding: 12px 16px !important;
@@ -70,11 +74,13 @@ border: 1px solid #DCDEE3;
70
74
  margin-top: 6px;
71
75
  }
72
76
  }
73
- .emptyContent{
74
- height: 224px;
75
- color: #586477;
76
- font-size: 14px;
77
- }
77
+
78
+ .emptyContent {
79
+ height: 224px;
80
+ color: #586477;
81
+ font-size: 14px;
82
+ }
83
+
78
84
  //告警级别颜色
79
85
  .alarm-color {
80
86
 
@@ -54,10 +54,12 @@
54
54
  }
55
55
  }
56
56
 
57
- .#{$css-prefix}collapse-panel-content {
57
+ .#{$css-prefix}collapse-panel-content,
58
+ .#{$css-prefix}collapse-panel-expanded>.#{$css-prefix}collapse-panel-content {
58
59
  padding-left: 32px;
59
60
  padding-top: 8px;
60
61
  }
62
+
61
63
  }
62
64
 
63
65
  .header {