@riil-frontend/component-topology 7.0.7 → 8.0.0-a.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 (42) hide show
  1. package/build/index.js +1 -1
  2. package/es/components/BatchAttrMetric/setting.js +0 -2
  3. package/es/core/common/icons/basicIcons.js +57 -0
  4. package/es/core/common/icons/icon.js +3 -9
  5. package/es/core/components/ResourceViewAttributeSetting/Setting.js +5 -11
  6. package/es/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +121 -0
  7. package/es/core/components/TopoView/GraphViewPanel.js +1 -2
  8. package/es/core/components/TopoView/topoView.js +3 -1
  9. package/es/core/hooks/useTopoEdit.js +35 -127
  10. package/es/core/models/AttributeMetricDisplay.js +4 -4
  11. package/es/core/models/TopoApp.js +1 -1
  12. package/es/core/models/tagstips/ElementTagTipConfig.js +17 -9
  13. package/es/core/models/utils/linkUtils.js +30 -36
  14. package/es/core/store/models/topoBizMod.js +1 -11
  15. package/es/core/store/models/topoConfig.js +6 -7
  16. package/es/core/store/models/topoMod.js +74 -50
  17. package/es/networkTopo/getTopoData.js +72 -64
  18. package/es/networkTopo/models/TopoCenter.js +14 -94
  19. package/es/networkTopo/services/topo/basic.js +26 -8
  20. package/es/networkTopo/utils/resourcePermissionUtil.js +2 -2
  21. package/es/utils/topoData.js +4 -169
  22. package/lib/components/BatchAttrMetric/setting.js +0 -4
  23. package/lib/core/common/icons/basicIcons.js +62 -0
  24. package/lib/core/common/icons/icon.js +4 -10
  25. package/lib/core/components/ResourceViewAttributeSetting/Setting.js +6 -11
  26. package/lib/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +127 -0
  27. package/lib/core/components/TopoView/GraphViewPanel.js +1 -2
  28. package/lib/core/components/TopoView/topoView.js +4 -1
  29. package/lib/core/hooks/useTopoEdit.js +35 -129
  30. package/lib/core/models/AttributeMetricDisplay.js +4 -4
  31. package/lib/core/models/TopoApp.js +1 -1
  32. package/lib/core/models/tagstips/ElementTagTipConfig.js +17 -9
  33. package/lib/core/models/utils/linkUtils.js +27 -33
  34. package/lib/core/store/models/topoBizMod.js +1 -11
  35. package/lib/core/store/models/topoConfig.js +5 -6
  36. package/lib/core/store/models/topoMod.js +71 -48
  37. package/lib/networkTopo/getTopoData.js +73 -65
  38. package/lib/networkTopo/models/TopoCenter.js +14 -94
  39. package/lib/networkTopo/services/topo/basic.js +26 -8
  40. package/lib/networkTopo/utils/resourcePermissionUtil.js +2 -2
  41. package/lib/utils/topoData.js +6 -172
  42. package/package.json +2 -2
@@ -27,8 +27,6 @@ var Setting = function Setting(_ref) {
27
27
  var limit = props.limit,
28
28
  saveCb = props.saveCb,
29
29
  elementType = props.elementType;
30
- rlog.debug("Setting-resAndMetrics-allCiSet-elementType", showType, props, elementType);
31
- rlog.debug("Setting----allCiSet", allCiSet);
32
30
 
33
31
  var _useState = useState(Object.keys(allCiSet)[0]),
34
32
  ciType = _useState[0],
@@ -0,0 +1,57 @@
1
+ export default [{
2
+ 'id': 'system.防火墙2.5D',
3
+ 'name': '防火墙',
4
+ 'url': '/img/topo/basicIcon/防火墙2.5D.svg'
5
+ }, {
6
+ 'id': 'system.云2.5D',
7
+ 'name': '云',
8
+ 'url': '/img/topo/basicIcon/云2.5D.svg'
9
+ }, {
10
+ 'id': 'system.五角星2.5D',
11
+ 'name': '五角星',
12
+ 'url': '/img/topo/basicIcon/五角星2.5D.svg'
13
+ }, {
14
+ 'id': 'system.旗帜2.5D',
15
+ 'name': '旗帜',
16
+ 'url': '/img/topo/basicIcon/旗帜2.5D.svg'
17
+ }, {
18
+ 'id': 'system.人员',
19
+ 'name': '人员',
20
+ 'url': '/img/topo/basicIcon/人员平面.svg'
21
+ }, {
22
+ 'id': 'system.building',
23
+ 'name': '楼宇',
24
+ 'url': '/img/topo/basicIcon/楼宇平面.svg'
25
+ }, {
26
+ 'id': 'system.黑客',
27
+ 'name': '黑客',
28
+ 'url': '/img/topo/basicIcon/黑客平面.svg'
29
+ }, {
30
+ 'id': 'system.摄像头',
31
+ 'name': '摄像头',
32
+ 'url': '/img/topo/basicIcon/摄像头平面.svg'
33
+ }, {
34
+ 'id': 'system.蓝色云端',
35
+ 'name': '蓝色云端',
36
+ 'url': '/img/topo/basicIcon/云平面.svg'
37
+ }, {
38
+ 'id': 'system.五角星平面',
39
+ 'name': '五角星',
40
+ 'url': '/img/topo/basicIcon/五角星平面.svg'
41
+ }, {
42
+ 'id': 'system.旗帜平面',
43
+ 'name': '旗帜',
44
+ 'url': '/img/topo/basicIcon/旗帜平面.svg'
45
+ }, {
46
+ 'id': 'system.防火墙平面',
47
+ 'name': '防火墙',
48
+ 'url': '/img/topo/basicIcon/防火墙平面.svg'
49
+ }, {
50
+ 'id': 'system.线路平面',
51
+ 'name': '线路',
52
+ 'url': '/img/topo/basicIcon/线路平面.svg'
53
+ }, {
54
+ 'id': 'system.打印机平面',
55
+ 'name': '打印机',
56
+ 'url': '/img/topo/basicIcon/打印机平面.svg'
57
+ }];
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import topoManager from '@riil-frontend/component-topology-graph/es/manager';
3
3
  import { getCiModels } from "../../../constants/ResourceTypeLimit";
4
+ import basicIcons from "./basicIcons";
4
5
  /**
5
6
  * 获取默认图标
6
7
  * @param {*} topo
@@ -36,18 +37,11 @@ export function getResourceIcons(topo) {
36
37
  */
37
38
 
38
39
  export function getBasicIcons(topo, containsGroupIcon) {
39
- var icons = topoManager.iconLibManager.getIcons();
40
- icons = icons.filter(function (icon) {
41
- return !icon.ciType;
42
- });
43
-
44
40
  if (containsGroupIcon === false) {
45
- icons = icons.filter(function (icon) {
46
- return icon.type !== 'group';
47
- });
41
+ return basicIcons;
48
42
  }
49
43
 
50
- return icons;
44
+ return [topoManager.iconLibManager.getGroupIcon()].concat(basicIcons);
51
45
  }
52
46
  export function getGroupDefaultIcons(topo) {
53
47
  return [].concat(topoManager.iconLibManager.getIcons());
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useState, useEffect, useRef, useCallback, useImperativeHandle, forwardRef, useMemo } from "react";
3
3
  import rlog from "@riil-frontend/component-topology-utils/es/rlog";
4
4
  import BatchAttrMetricDrawer from "../../../components/BatchAttrMetric";
5
+ import { getNodeCiModSet } from "./nodeCiTypeAttrUtil";
5
6
  /**
6
7
  * 资源显示属性、指标配置
7
8
  */
@@ -20,22 +21,15 @@ var ResourceDiplayInfoSetting = /*#__PURE__*/forwardRef(function (props, ref) {
20
21
  markData = _useState[0],
21
22
  setMarkarkData = _useState[1];
22
23
 
23
- var _topo$store$useModel = topo.store.useModel("topoBizMod"),
24
- bizState = _topo$store$useModel[0],
25
- bizDispatchers = _topo$store$useModel[1]; // rlog.debug('TopoView---income', topoId, viewState);
26
-
27
-
28
- var resAndMetrics = bizState.resAndMetrics;
29
- var allCiModSet = resAndMetrics.allCiModSet,
30
- allLinkModSet = resAndMetrics.allLinkModSet;
31
-
32
24
  var openMarkSetting = function openMarkSetting(parm) {
33
- rlog.debug("openMarkSetting", parm, elementType, showType, allCiModSet, allLinkModSet);
25
+ rlog.debug("openMarkSetting", parm, elementType, showType);
34
26
 
35
27
  if (queryData) {
36
28
  setMarkarkData(queryData());
37
29
  } else {
38
- setMarkarkData(elementType === "node" ? allCiModSet : allLinkModSet);
30
+ setMarkarkData(elementType === "node" ? getNodeCiModSet({
31
+ topo: topo
32
+ }) : undefined);
39
33
  }
40
34
 
41
35
  batchAttrMetric.current.show({
@@ -0,0 +1,121 @@
1
+ import { getCiTypesFromCiElements } from "../../../utils/topoData"; // 资源类型含有属性和指标集合
2
+
3
+ export function getNodeCiModSet(params) {
4
+ var topo = params.topo;
5
+ var data = topo.store.getModelState('topoMod').data;
6
+ var globalConfig = data.global.extraConfig;
7
+ var ciTypeMap = topo.ciTyeCache.ciTypes;
8
+
9
+ function getNodeModSet() {
10
+ var ciTypes = getCiTypesFromCiElements(data.nodes);
11
+ return getModSet(ciTypes);
12
+ }
13
+ /**
14
+ *
15
+ * @param {array} ciTypeCodes
16
+ * @returns
17
+ */
18
+
19
+
20
+ function getModSet(ciTypeCodes) {
21
+ var modSet = {};
22
+ Object.keys(ciTypeMap).filter(function (item) {
23
+ return ciTypeCodes.includes(item);
24
+ }).forEach(function (key) {
25
+ var ciTypeObj = ciTypeMap[key];
26
+ modSet[key] = {
27
+ name: ciTypeObj.displayName,
28
+ code: ciTypeObj.code,
29
+ icon: ciTypeObj.icon,
30
+ list: ciModfilter(ciTypeObj, globalConfig, 'node', ciTypeObj.code)
31
+ };
32
+ }); // console.log("modSet--------------------", modSet);
33
+
34
+ return modSet;
35
+ }
36
+ /**
37
+ * 过滤ci元数据中的属性和指标,用于属性和指标显示设置
38
+ * @param {} ciTypeObj
39
+ * @returns
40
+ */
41
+
42
+
43
+ function ciModfilter(ciTypeObj, globalSetting, type, code) {
44
+ var tips = globalSetting[type + "Tip"];
45
+ var tags = globalSetting[type + "Tag"];
46
+ var tipArr = [];
47
+ var tagArr = [];
48
+
49
+ if (tips !== null && tips !== void 0 && tips.isCustom) {
50
+ var _tips$data$code;
51
+
52
+ (_tips$data$code = tips.data[code]) === null || _tips$data$code === void 0 ? void 0 : _tips$data$code.map(function (item) {
53
+ tipArr.push(item.code + "-" + item.type);
54
+ });
55
+ }
56
+
57
+ if (tags !== null && tags !== void 0 && tags.isCustom) {
58
+ var _tags$data$code;
59
+
60
+ (_tags$data$code = tags.data[code]) === null || _tags$data$code === void 0 ? void 0 : _tags$data$code.map(function (item) {
61
+ tagArr.push(item.code + "-" + item.type);
62
+ });
63
+ } // rlog.debug(
64
+ // "过滤ci元数据中的属性和指标,用于属性和指标显示设置",
65
+ // globalSetting,
66
+ // tipArr,
67
+ // tagArr
68
+ // );
69
+
70
+
71
+ var custom = [];
72
+
73
+ if (type === 'node') {
74
+ custom.push({
75
+ id: 'name-graph',
76
+ code: 'name',
77
+ name: '图片名称',
78
+ type: 'custom',
79
+ tag: tagArr.indexOf('name-graph') >= 0,
80
+ tip: tipArr.indexOf('name-graph') >= 0
81
+ });
82
+ custom.push({
83
+ id: 'display_name-ciType',
84
+ code: 'ciType',
85
+ name: '资源类型',
86
+ type: 'custom',
87
+ tag: tagArr.indexOf('display_name-ciType') >= 0,
88
+ tip: tipArr.indexOf('display_name-ciType') >= 0
89
+ });
90
+ }
91
+
92
+ var attributes = ciTypeObj.attributes.filter(function (attr) {
93
+ return !!attr.userVisible;
94
+ }).map(function (item) {
95
+ var aid = item.code + "-attribute";
96
+ return {
97
+ id: aid,
98
+ code: item.code,
99
+ name: item.name,
100
+ type: 'attribute',
101
+ tag: tagArr.indexOf(aid) >= 0,
102
+ tip: tipArr.indexOf(aid) >= 0
103
+ };
104
+ });
105
+ var metrics = ciTypeObj.metrics.map(function (item) {
106
+ var mid = item.code + "-metric";
107
+ return {
108
+ id: mid,
109
+ code: item.code,
110
+ name: item.name,
111
+ type: 'metric',
112
+ tag: tagArr.indexOf(mid) >= 0,
113
+ tip: tipArr.indexOf(mid) >= 0
114
+ };
115
+ });
116
+ return [].concat(custom, attributes, metrics);
117
+ }
118
+
119
+ ;
120
+ return getNodeModSet();
121
+ }
@@ -33,7 +33,6 @@ export default function GraphViewPanel(props) {
33
33
  style: {
34
34
  background: canvasColor
35
35
  },
36
- onFocus: onFocus,
37
- on: true
36
+ onFocus: onFocus
38
37
  }, props.children);
39
38
  }
@@ -24,6 +24,7 @@ import Sidebar from "../../editor/components/Sidebar/Sidebar";
24
24
  import PropertyView from "../../editor/components/settings/PropertyView";
25
25
  import HistoryManager from "../../models/HistoryManager";
26
26
  import editorStyles from "./editor.module.scss";
27
+ import basicIcons from "../../common/icons/basicIcons";
27
28
 
28
29
  var Topology = function Topology(props) {
29
30
  var _classnames;
@@ -74,7 +75,7 @@ var Topology = function Topology(props) {
74
75
  topo: topo,
75
76
  topoId: topoId,
76
77
  isEditing: isEditMode,
77
- onSave: onSave,
78
+ onSave: editorProps.onSave || onSave,
78
79
  nodeDeleteable: nodeDeleteable,
79
80
  onNodeDelete: onNodeDelete,
80
81
  onLineDelete: onLineDelete,
@@ -236,6 +237,7 @@ var Topology = function Topology(props) {
236
237
  }),
237
238
  data: tData,
238
239
  defaultEnterEditMode: defaultEnterEditMode,
240
+ icons: [].concat(graphViewProps.icons || [], basicIcons),
239
241
  onCreate: onGraphCreated,
240
242
  onLoaded: handleGraphLoaded,
241
243
  onDataLoaded: handleGraphDataLoaded,
@@ -692,58 +692,9 @@ var useTopoEdit = function useTopoEdit(params) {
692
692
  };
693
693
  }();
694
694
 
695
- function checkSavePermission(_x13) {
696
- return _checkSavePermission.apply(this, arguments);
697
- }
698
-
699
- function _checkSavePermission() {
700
- _checkSavePermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(id) {
701
- var permission;
702
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
703
- while (1) {
704
- switch (_context16.prev = _context16.next) {
705
- case 0:
706
- _context16.next = 2;
707
- return topoDispatchers.getTopoPermission({
708
- id: id,
709
- update: false
710
- });
711
-
712
- case 2:
713
- permission = _context16.sent;
714
-
715
- if (!topoPermissonUtil.isEditable(permission)) {
716
- _context16.next = 5;
717
- break;
718
- }
719
-
720
- return _context16.abrupt("return", true);
721
-
722
- case 5:
723
- _Dialog.alert({
724
- title: "没有权限进行此操作",
725
- content: "您的权限发生了变化,请联系相关管理员。",
726
- okProps: {
727
- children: "确定"
728
- },
729
- onOk: function onOk() {}
730
- });
731
-
732
- return _context16.abrupt("return", false);
733
-
734
- case 7:
735
- case "end":
736
- return _context16.stop();
737
- }
738
- }
739
- }, _callee16);
740
- }));
741
- return _checkSavePermission.apply(this, arguments);
742
- }
743
-
744
695
  var onSaveTopo = /*#__PURE__*/function () {
745
696
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(data) {
746
- var id, config, serialize, _config$layout, template, layout, saveConfig, valid, saveData;
697
+ var id, config, serialize, _config$layout, template, layout, saveConfig;
747
698
 
748
699
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
749
700
  while (1) {
@@ -752,85 +703,42 @@ var useTopoEdit = function useTopoEdit(params) {
752
703
  id = data.id, config = data.config, serialize = data.serialize;
753
704
  _config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
754
705
 
755
- if (!onSave) {
756
- _context8.next = 6;
757
- break;
758
- }
706
+ if (onSave) {
707
+ // 自定义保存
708
+ saveConfig = /*#__PURE__*/function () {
709
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
710
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
711
+ while (1) {
712
+ switch (_context7.prev = _context7.next) {
713
+ case 0:
714
+ _context7.next = 2;
715
+ return editDispatchers.saveTopo({
716
+ id: id,
717
+ layout: layout,
718
+ serialize: serialize
719
+ });
759
720
 
760
- // 自定义保存
761
- saveConfig = /*#__PURE__*/function () {
762
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
763
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
764
- while (1) {
765
- switch (_context7.prev = _context7.next) {
766
- case 0:
767
- _context7.next = 2;
768
- return editDispatchers.saveTopo({
769
- id: id,
770
- layout: layout,
771
- serialize: serialize
772
- });
773
-
774
- case 2:
775
- case "end":
776
- return _context7.stop();
721
+ case 2:
722
+ case "end":
723
+ return _context7.stop();
724
+ }
777
725
  }
778
- }
779
- }, _callee7);
780
- }));
781
-
782
- return function saveConfig() {
783
- return _ref7.apply(this, arguments);
784
- };
785
- }();
786
-
787
- onSave({
788
- data: data,
789
- saveConfig: saveConfig
790
- });
791
- return _context8.abrupt("return");
792
-
793
- case 6:
794
- // TODO 以下逻辑移到拓扑中心
795
- topoEditDispatchers.update({
796
- saving: true
797
- }); // 检查权限
798
-
799
- _context8.next = 9;
800
- return checkSavePermission(id);
801
-
802
- case 9:
803
- valid = _context8.sent;
804
-
805
- if (valid) {
806
- _context8.next = 13;
807
- break;
726
+ }, _callee7);
727
+ }));
728
+
729
+ return function saveConfig() {
730
+ return _ref7.apply(this, arguments);
731
+ };
732
+ }();
733
+
734
+ onSave({
735
+ topo: topo,
736
+ data: data,
737
+ saveConfig: saveConfig
738
+ });
808
739
  }
809
740
 
810
- topoEditDispatchers.update({
811
- saving: false
812
- });
813
- return _context8.abrupt("return");
814
-
815
- case 13:
816
- // 保存
817
- saveData = _extends({
818
- id: id,
819
- layout: layout,
820
- serialize: serialize
821
- }, resourceConfig.getConfig());
822
- rlog.info("保存", saveData);
823
- _context8.next = 17;
824
- return editDispatchers.saveTopo(saveData);
825
-
826
- case 17:
827
- topoEditDispatchers.update({
828
- saving: false
829
- });
830
-
831
- _Message.success("保存成功!");
832
-
833
- case 19:
741
+ case 3:
834
742
  case "end":
835
743
  return _context8.stop();
836
744
  }
@@ -838,7 +746,7 @@ var useTopoEdit = function useTopoEdit(params) {
838
746
  }, _callee8);
839
747
  }));
840
748
 
841
- return function onSaveTopo(_x14) {
749
+ return function onSaveTopo(_x13) {
842
750
  return _ref6.apply(this, arguments);
843
751
  };
844
752
  }();
@@ -1048,7 +956,7 @@ var useTopoEdit = function useTopoEdit(params) {
1048
956
  }, _callee10);
1049
957
  }));
1050
958
 
1051
- return function bindNodeResource(_x15) {
959
+ return function bindNodeResource(_x14) {
1052
960
  return _ref8.apply(this, arguments);
1053
961
  };
1054
962
  }();
@@ -356,7 +356,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
356
356
  /*#__PURE__*/
357
357
  function () {
358
358
  var _fetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
359
- var topo, _topo$store$getState$, resIdsList, nodeIdsList, codes, param, transformLinkData, result;
359
+ var topo, _topo$store$getModelS, resIdsList, nodeIdsList, codes, param, transformLinkData, result;
360
360
 
361
361
  return _regeneratorRuntime.wrap(function _callee$(_context) {
362
362
  while (1) {
@@ -383,7 +383,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
383
383
  };
384
384
 
385
385
  topo = this.topo;
386
- _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);
386
+ _topo$store$getModelS = topo.store.getModelState('topoBizMod').resAndMetrics, resIdsList = _topo$store$getModelS.resIdsList, nodeIdsList = _topo$store$getModelS.nodeIdsList; // rlog.debug('根据ci的id获取属性的值-getCiArrByIds', resIdsList, metrics);
387
387
  // 无资源,不查询
388
388
 
389
389
  if (resIdsList.length) {
@@ -636,8 +636,8 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
636
636
 
637
637
  var elementTagsAndTips = this.buildTagsTips() // 开锁状态下禁用悬停展示悬浮框
638
638
  .map(function (item) {
639
- var _topo$store$getModelS = topo.store.getModelState('lock'),
640
- lock = _topo$store$getModelS.lock;
639
+ var _topo$store$getModelS2 = topo.store.getModelState('lock'),
640
+ lock = _topo$store$getModelS2.lock;
641
641
 
642
642
  return lock ? item : _extends({}, item, {
643
643
  tips: []
@@ -23,7 +23,7 @@ import topoFactory from "./topoFactory";
23
23
  import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
24
24
  import SelectionModel from "./SelectionModel"; // eslint-disable-next-line no-undef
25
25
 
26
- var version = typeof "7.0.7" === 'string' ? "7.0.7" : null;
26
+ var version = typeof "8.0.0-a.1" === 'string' ? "8.0.0-a.1" : null;
27
27
  console.info("\u62D3\u6251\u7248\u672C: " + version);
28
28
  /**
29
29
  * 拓扑显示和编辑
@@ -9,7 +9,7 @@ var ElementTagTipConfig = /*#__PURE__*/function () {
9
9
  function ElementTagTipConfig(topo) {
10
10
  this.topoData = void 0;
11
11
  this.mtCodes = void 0;
12
- this.mtMetricsMap = void 0;
12
+ this.mtMetricsMap = {};
13
13
  this.mtCiTypeMap = void 0;
14
14
  this.topo = topo;
15
15
  }
@@ -25,28 +25,36 @@ var ElementTagTipConfig = /*#__PURE__*/function () {
25
25
  this.topoData = topoData;
26
26
  this.mtCodes = getMonitorTemplateCodesFromTopoData(topoData);
27
27
  _context.prev = 2;
28
- _context.next = 5;
28
+
29
+ if (!this.mtCodes.length) {
30
+ _context.next = 7;
31
+ break;
32
+ }
33
+
34
+ _context.next = 6;
29
35
  return getMetricsByMonitorTemplateCodes(this.mtCodes);
30
36
 
31
- case 5:
37
+ case 6:
32
38
  this.mtMetricsMap = _context.sent;
33
- _context.next = 11;
39
+
40
+ case 7:
41
+ _context.next = 12;
34
42
  break;
35
43
 
36
- case 8:
37
- _context.prev = 8;
44
+ case 9:
45
+ _context.prev = 9;
38
46
  _context.t0 = _context["catch"](2);
39
47
  rlog.error('查询监控模板指标失败', _context.t0);
40
48
 
41
- case 11:
49
+ case 12:
42
50
  this.mtCiTypeMap = getMtCodeCiTypeMap(topoData);
43
51
 
44
- case 12:
52
+ case 13:
45
53
  case "end":
46
54
  return _context.stop();
47
55
  }
48
56
  }
49
- }, _callee, this, [[2, 8]]);
57
+ }, _callee, this, [[2, 9]]);
50
58
  }));
51
59
 
52
60
  function init(_x) {