@riil-frontend/component-topology 2.15.25 → 2.15.28

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
- overflow-y: scroll;
47
+ overflow-y: auto;
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 {
@@ -308,7 +308,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
308
308
  _proto.getNodesNameVisible = function getNodesNameVisible() {
309
309
  var _this3 = this;
310
310
 
311
- var nodes = this.topo.store.getModelState('topoMod').data.nodes;
311
+ var nodes = this.topo.dataModel.getNodes();
312
312
  return nodes.map(function (node) {
313
313
  return {
314
314
  id: node.id,
@@ -680,9 +680,9 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
680
680
  var _this6 = this;
681
681
 
682
682
  // 查询没有关联链路的连线组及对应子链路列表
683
- var _this$topo$store$getM = this.topo.store.getModelState('topoMod').data,
684
- links = _this$topo$store$getM.links,
685
- linkGroups = _this$topo$store$getM.linkGroups;
683
+ var _this$topo$dataModel$ = this.topo.dataModel.getData(),
684
+ links = _this$topo$dataModel$.links,
685
+ linkGroups = _this$topo$dataModel$.linkGroups;
686
686
 
687
687
  var getLinkUId = function getLinkUId(link) {
688
688
  return [link.source, link.target].sort().join('-');
@@ -710,19 +710,24 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
710
710
  calcType: 'sum'
711
711
  }, {
712
712
  code: 'bandwidth_utilization',
713
- calcType: 'avg'
714
- }, {
715
- code: 'out_rate',
716
- calcType: 'avg'
713
+ calcType: 'avg',
714
+ showWhenSameSource: true
717
715
  }, {
718
716
  code: 'out_bandwidth_utilization',
719
- calcType: 'avg'
720
- }, {
721
- code: 'in_rate',
722
- calcType: 'avg'
717
+ calcType: 'avg',
718
+ showWhenSameSource: true
723
719
  }, {
724
720
  code: 'in_bandwidth_utilization',
725
- 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
726
731
  }];
727
732
  var connectTypePrefixMap = {
728
733
  phy: 'physical_link.',
@@ -730,17 +735,44 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
730
735
  };
731
736
  var calcFnMap = {
732
737
  sum: function sum(values) {
733
- return values.reduce(function (val, total) {
734
- return total + parseInt(val, 10);
738
+ return values.reduce(function (total, val) {
739
+ return total + parseInt(val || 0, 10);
735
740
  }, 0);
736
741
  },
737
742
  avg: function avg(values) {
738
- return values.reduce(function (val, total) {
739
- return total + parseFloat(val, 10);
743
+ return values.reduce(function (total, val) {
744
+ return total + parseFloat(val || 0, 10);
740
745
  }, 0) / values.length;
741
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;
742
773
  }; // 计算标注和指标
743
774
 
775
+
744
776
  var edgeGroupsTagsTips = Object.keys(groupMap) // 过滤非连线组
745
777
  .filter(function (groupId) {
746
778
  var linkChildren = groupMap[groupId];
@@ -754,14 +786,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
754
786
  });
755
787
  config = _extends({}, config, {
756
788
  tags: config.tags.filter(function (item) {
757
- return item.type === 'metric' && !!metrics.find(function (m) {
758
- return item.code.endsWith(m.code);
759
- });
789
+ return filterField(item, linkChildren);
760
790
  }),
761
791
  tips: config.tips.filter(function (item) {
762
- return item.type === 'metric' && !!metrics.find(function (m) {
763
- return item.code.endsWith(m.code);
764
- });
792
+ return filterField(item, linkChildren);
765
793
  })
766
794
  }); // 构造数据,计算指标值
767
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.25" === 'string' ? "2.15.25" : null;
23
+ var version = typeof "2.15.28" === 'string' ? "2.15.28" : 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],
@@ -14,6 +14,7 @@ import EditLinkInfo from "./components/editLinkInfo";
14
14
  import styles from "./index.module.scss";
15
15
  import service from "./server";
16
16
  import { clone } from "../../../../../../utils/copyUtil";
17
+ import { getEdgesBetweenNodes } from "../../../../../../utils/htElementUtils";
17
18
  var CollapsePanel = _Collapse.Panel;
18
19
 
19
20
  function AddLinkDrawer(props) {
@@ -326,7 +327,7 @@ function AddLinkDrawer(props) {
326
327
 
327
328
  try {
328
329
  // 获取两个节点间的连线数据列表
329
- var edgesInNodes = htTopo.getEdgeDatasInNodes(source, target);
330
+ var edgesInNodes = getEdgesBetweenNodes(source, target);
330
331
 
331
332
  if (isAgg) {
332
333
  // 聚合链路
@@ -340,8 +341,10 @@ function AddLinkDrawer(props) {
340
341
  htTopo.toggleEdgeGroup(source, target, false);
341
342
  } else {
342
343
  // 物理、出口链路
343
- if (edgesInNodes.length === 1 && !htTopo.getEdgeData(edgesInNodes[0])) {
344
- htTopo.setEdgeData(htTopo.getEdgeData(edgesInNodes[0], linkData));
344
+ var firstEdge = edgesInNodes[0];
345
+
346
+ if (edgesInNodes.length === 1 && !htTopo.getEdgeData(firstEdge)) {
347
+ htTopo.setEdgeData(firstEdge, linkData);
345
348
  } else {
346
349
  htTopo.createEdge(source, target, linkData);
347
350
  }
@@ -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
- overflow-y: scroll;
47
+ overflow-y: auto;
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 {
@@ -327,7 +327,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
327
327
  _proto.getNodesNameVisible = function getNodesNameVisible() {
328
328
  var _this3 = this;
329
329
 
330
- var nodes = this.topo.store.getModelState('topoMod').data.nodes;
330
+ var nodes = this.topo.dataModel.getNodes();
331
331
  return nodes.map(function (node) {
332
332
  return {
333
333
  id: node.id,
@@ -700,9 +700,9 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
700
700
  var _this6 = this;
701
701
 
702
702
  // 查询没有关联链路的连线组及对应子链路列表
703
- var _this$topo$store$getM = this.topo.store.getModelState('topoMod').data,
704
- links = _this$topo$store$getM.links,
705
- linkGroups = _this$topo$store$getM.linkGroups;
703
+ var _this$topo$dataModel$ = this.topo.dataModel.getData(),
704
+ links = _this$topo$dataModel$.links,
705
+ linkGroups = _this$topo$dataModel$.linkGroups;
706
706
 
707
707
  var getLinkUId = function getLinkUId(link) {
708
708
  return [link.source, link.target].sort().join('-');
@@ -730,19 +730,24 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
730
730
  calcType: 'sum'
731
731
  }, {
732
732
  code: 'bandwidth_utilization',
733
- calcType: 'avg'
734
- }, {
735
- code: 'out_rate',
736
- calcType: 'avg'
733
+ calcType: 'avg',
734
+ showWhenSameSource: true
737
735
  }, {
738
736
  code: 'out_bandwidth_utilization',
739
- calcType: 'avg'
740
- }, {
741
- code: 'in_rate',
742
- calcType: 'avg'
737
+ calcType: 'avg',
738
+ showWhenSameSource: true
743
739
  }, {
744
740
  code: 'in_bandwidth_utilization',
745
- calcType: 'avg'
741
+ calcType: 'avg',
742
+ showWhenSameSource: true
743
+ }, {
744
+ code: 'out_rate',
745
+ calcType: 'avg',
746
+ showWhenSameSource: true
747
+ }, {
748
+ code: 'in_rate',
749
+ calcType: 'avg',
750
+ showWhenSameSource: true
746
751
  }];
747
752
  var connectTypePrefixMap = {
748
753
  phy: 'physical_link.',
@@ -750,17 +755,44 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
750
755
  };
751
756
  var calcFnMap = {
752
757
  sum: function sum(values) {
753
- return values.reduce(function (val, total) {
754
- return total + parseInt(val, 10);
758
+ return values.reduce(function (total, val) {
759
+ return total + parseInt(val || 0, 10);
755
760
  }, 0);
756
761
  },
757
762
  avg: function avg(values) {
758
- return values.reduce(function (val, total) {
759
- return total + parseFloat(val, 10);
763
+ return values.reduce(function (total, val) {
764
+ return total + parseFloat(val || 0, 10);
760
765
  }, 0) / values.length;
761
766
  }
767
+ };
768
+
769
+ var filterField = function filterField(item, linkChildren) {
770
+ var fieldConfig = metrics.find(function (m) {
771
+ return item.code.endsWith(m.code);
772
+ });
773
+
774
+ if (item.type !== 'metric' || !fieldConfig) {
775
+ return false;
776
+ } // 如果需要校验取值接口,如果取值接口为不同设备的接口,则不显示这四个指标
777
+
778
+
779
+ if (fieldConfig.showWhenSameSource) {
780
+ var sources = [];
781
+ linkChildren.forEach(function (link) {
782
+ if (sources.indexOf(link.source) !== -1) {
783
+ sources.push(link.source);
784
+ }
785
+ });
786
+
787
+ if (sources.length > 1) {
788
+ return false;
789
+ }
790
+ }
791
+
792
+ return true;
762
793
  }; // 计算标注和指标
763
794
 
795
+
764
796
  var edgeGroupsTagsTips = Object.keys(groupMap) // 过滤非连线组
765
797
  .filter(function (groupId) {
766
798
  var linkChildren = groupMap[groupId];
@@ -774,14 +806,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
774
806
  });
775
807
  config = (0, _extends2["default"])({}, config, {
776
808
  tags: config.tags.filter(function (item) {
777
- return item.type === 'metric' && !!metrics.find(function (m) {
778
- return item.code.endsWith(m.code);
779
- });
809
+ return filterField(item, linkChildren);
780
810
  }),
781
811
  tips: config.tips.filter(function (item) {
782
- return item.type === 'metric' && !!metrics.find(function (m) {
783
- return item.code.endsWith(m.code);
784
- });
812
+ return filterField(item, linkChildren);
785
813
  })
786
814
  }); // 构造数据,计算指标值
787
815
 
@@ -48,7 +48,7 @@ var _PluginManager = _interopRequireDefault(require("./PluginManager"));
48
48
  var _topoFactory = _interopRequireDefault(require("./topoFactory"));
49
49
 
50
50
  // eslint-disable-next-line no-undef
51
- var version = typeof "2.15.25" === 'string' ? "2.15.25" : null;
51
+ var version = typeof "2.15.28" === 'string' ? "2.15.28" : null;
52
52
  console.info("\u62D3\u6251\u7248\u672C: " + version);
53
53
  /**
54
54
  * 拓扑显示和编辑
@@ -58,6 +58,8 @@ function AlarmListShowButton(props) {
58
58
  })),
59
59
  cache: true,
60
60
  defaultVisible: true,
61
+ canCloseByOutSideClick: false,
62
+ canCloseByTrigger: false,
61
63
  visible: alarmPanelIsOpen,
62
64
  onVisibleChange: onVisibleChange,
63
65
  offset: [112, 5],
@@ -35,6 +35,8 @@ var _server = _interopRequireDefault(require("./server"));
35
35
 
36
36
  var _copyUtil = require("../../../../../../utils/copyUtil");
37
37
 
38
+ var _htElementUtils = require("../../../../../../utils/htElementUtils");
39
+
38
40
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
39
41
 
40
42
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -366,7 +368,7 @@ function AddLinkDrawer(props) {
366
368
 
367
369
  try {
368
370
  // 获取两个节点间的连线数据列表
369
- var edgesInNodes = htTopo.getEdgeDatasInNodes(source, target);
371
+ var edgesInNodes = (0, _htElementUtils.getEdgesBetweenNodes)(source, target);
370
372
 
371
373
  if (isAgg) {
372
374
  // 聚合链路
@@ -380,8 +382,10 @@ function AddLinkDrawer(props) {
380
382
  htTopo.toggleEdgeGroup(source, target, false);
381
383
  } else {
382
384
  // 物理、出口链路
383
- if (edgesInNodes.length === 1 && !htTopo.getEdgeData(edgesInNodes[0])) {
384
- htTopo.setEdgeData(htTopo.getEdgeData(edgesInNodes[0], linkData));
385
+ var firstEdge = edgesInNodes[0];
386
+
387
+ if (edgesInNodes.length === 1 && !htTopo.getEdgeData(firstEdge)) {
388
+ htTopo.setEdgeData(firstEdge, linkData);
385
389
  } else {
386
390
  htTopo.createEdge(source, target, linkData);
387
391
  }
@@ -43,9 +43,11 @@ var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
43
43
  var _this = this;
44
44
 
45
45
  var topo = this.topo;
46
- var _topo$store$getModelS = topo.store.getModelState('topoMod').data,
47
- links = _topo$store$getModelS.links,
48
- linkGroups = _topo$store$getModelS.linkGroups;
46
+
47
+ var _topo$dataModel$getDa = topo.dataModel.getData(),
48
+ links = _topo$dataModel$getDa.links,
49
+ linkGroups = _topo$dataModel$getDa.linkGroups;
50
+
49
51
  var dataModel = this.topo.getDataModel(); // 1、如果连线可见,设置线宽
50
52
 
51
53
  links.forEach(function (link) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "2.15.25",
3
+ "version": "2.15.28",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -110,6 +110,6 @@
110
110
  "access": "public"
111
111
  },
112
112
  "license": "MIT",
113
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@2.15.25/build/index.html",
113
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@2.15.28/build/index.html",
114
114
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
115
115
  }