@riil-frontend/component-topology 3.1.5 → 3.1.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.
@@ -76,6 +76,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
76
76
  var ciTypeMeta = this.topo.ciTyeCache.getCiType(ciType);
77
77
 
78
78
  function getItems(cfg) {
79
+ if (!ciTypeMeta || !cfg) {
80
+ return [];
81
+ }
82
+
79
83
  var isCustom = cfg.isCustom,
80
84
  data = cfg.data;
81
85
  var items = (isCustom ? data[ciType] : data) || []; // 过滤类型不存在的属性和指标、图片名称
@@ -90,94 +94,6 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
90
94
  tips: getItems(nodeTip || DEFAULT_TIP_COMMON_CONFIG)
91
95
  };
92
96
  }
93
- /**
94
- * 按链路类型获取对应的属性、指标配置
95
- * @param {*} link
96
- * @param {*} config
97
- * @returns
98
- */
99
- ;
100
-
101
- _proto.getNetworkLinkConfig = function getNetworkLinkConfig(link, config) {
102
- var _this$getConfig2 = this.getConfig(config),
103
- linkTag = _this$getConfig2.linkTag,
104
- linkTip = _this$getConfig2.linkTip;
105
-
106
- var linkConnectType = link.attributes['network_link.connect_type'];
107
- var ciTypeMeta = this.topo.ciTyeCache.getNetworkLinkCiType(linkConnectType);
108
-
109
- var getMetricCode = function getMetricCode(code) {
110
- var _connectTypeMap$linkC;
111
-
112
- var connectTypeMap = {
113
- phy: {
114
- id: 'phy',
115
- metricPrefix: 'physical_link.'
116
- },
117
- agg: {
118
- id: 'agg',
119
- metricPrefix: 'agg_link.'
120
- },
121
- exit: {
122
- id: 'exit',
123
- metricPrefix: 'export_link.'
124
- }
125
- };
126
- var metricPrefix = (_connectTypeMap$linkC = connectTypeMap[linkConnectType]) === null || _connectTypeMap$linkC === void 0 ? void 0 : _connectTypeMap$linkC.metricPrefix;
127
-
128
- if (!metricPrefix) {
129
- return null;
130
- }
131
-
132
- var finalCode = null;
133
-
134
- if (ciTypeMeta.metricMap[code]) {
135
- finalCode = code;
136
- } else if (ciTypeMeta.metricMap["" + metricPrefix + code]) {
137
- finalCode = "" + metricPrefix + code;
138
- }
139
-
140
- return finalCode;
141
- };
142
-
143
- var formatItems = function formatItems(items) {
144
- var newItems = [];
145
- items.forEach(function (item) {
146
- if (item.type === 'metric') {
147
- var code = item.code;
148
- var finalCode = getMetricCode(code);
149
-
150
- if (finalCode) {
151
- newItems.push(_extends({}, item, {
152
- code: finalCode
153
- }));
154
- }
155
- } else {
156
- newItems.push(item);
157
- }
158
- });
159
- return newItems;
160
- };
161
-
162
- function getItems(cfg) {
163
- if (!ciTypeMeta || !cfg) {
164
- return [];
165
- }
166
-
167
- var isCustom = cfg.isCustom,
168
- data = cfg.data;
169
- var configItems = (isCustom ? data[linkConnectType] : data) || [];
170
- var items = formatItems(configItems); // 过滤不存在的
171
-
172
- return filterUnExistedFields(items, ciTypeMeta);
173
- }
174
-
175
- var defaultLinkTagTipConfig = this.topo.options.defaultLinkTagTipConfig;
176
- return {
177
- tags: getItems(linkTag || (defaultLinkTagTipConfig === null || defaultLinkTagTipConfig === void 0 ? void 0 : defaultLinkTagTipConfig.tag)),
178
- tips: getItems(linkTip || (defaultLinkTagTipConfig === null || defaultLinkTagTipConfig === void 0 ? void 0 : defaultLinkTagTipConfig.tip))
179
- };
180
- }
181
97
  /**
182
98
  * 查询需要查询数据的连线
183
99
  *
@@ -203,10 +119,6 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
203
119
  }));
204
120
  };
205
121
 
206
- _proto.getLinkTagTipConfig = function getLinkTagTipConfig(link) {
207
- return this.getNetworkLinkConfig(link);
208
- };
209
-
210
122
  _proto.getNodesTagTipConfig = function getNodesTagTipConfig() {
211
123
  var _this = this;
212
124
 
@@ -228,6 +140,107 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
228
140
  tips: filterByPermission(node, ciTypeConfig.tips)
229
141
  };
230
142
  });
143
+ }
144
+ /**
145
+ * 按链路类型获取对应的属性、指标配置
146
+ * @param {*} link
147
+ * @returns
148
+ */
149
+ ;
150
+
151
+ _proto.getLinkTagTipConfig = function getLinkTagTipConfig(link) {
152
+ var _this$getConfig2 = this.getConfig(),
153
+ linkTag = _this$getConfig2.linkTag,
154
+ linkTip = _this$getConfig2.linkTip;
155
+
156
+ var ciTypeMeta;
157
+ var isNetworkLink = link.ciType === 'network_link';
158
+
159
+ if (isNetworkLink) {
160
+ var linkConnectType = link.attributes['network_link.connect_type'];
161
+ ciTypeMeta = this.topo.ciTyeCache.getNetworkLinkCiType(linkConnectType);
162
+ } else {
163
+ ciTypeMeta = this.topo.ciTyeCache.getCiType(link.ciType);
164
+ }
165
+
166
+ var dataType = isNetworkLink ? link.attributes['network_link.connect_type'] : link.ciType;
167
+
168
+ function getNetworkFieldItems(configItems) {
169
+ var getMetricCode = function getMetricCode(code) {
170
+ var _connectTypeMap$linkC;
171
+
172
+ var linkConnectType = link.attributes['network_link.connect_type'];
173
+ var connectTypeMap = {
174
+ phy: {
175
+ id: 'phy',
176
+ metricPrefix: 'physical_link.'
177
+ },
178
+ agg: {
179
+ id: 'agg',
180
+ metricPrefix: 'agg_link.'
181
+ },
182
+ exit: {
183
+ id: 'exit',
184
+ metricPrefix: 'export_link.'
185
+ }
186
+ };
187
+ var metricPrefix = (_connectTypeMap$linkC = connectTypeMap[linkConnectType]) === null || _connectTypeMap$linkC === void 0 ? void 0 : _connectTypeMap$linkC.metricPrefix;
188
+
189
+ if (!metricPrefix) {
190
+ return null;
191
+ }
192
+
193
+ var finalCode = null;
194
+
195
+ if (ciTypeMeta.metricMap[code]) {
196
+ finalCode = code;
197
+ } else if (ciTypeMeta.metricMap["" + metricPrefix + code]) {
198
+ finalCode = "" + metricPrefix + code;
199
+ }
200
+
201
+ return finalCode;
202
+ };
203
+
204
+ var formatItems = function formatItems(items) {
205
+ var newItems = [];
206
+ items.forEach(function (item) {
207
+ if (item.type === 'metric') {
208
+ var code = item.code;
209
+ var finalCode = getMetricCode(code);
210
+
211
+ if (finalCode) {
212
+ newItems.push(_extends({}, item, {
213
+ code: finalCode
214
+ }));
215
+ }
216
+ } else {
217
+ newItems.push(item);
218
+ }
219
+ });
220
+ return newItems;
221
+ };
222
+
223
+ return formatItems(configItems);
224
+ }
225
+
226
+ function getItems(cfg) {
227
+ if (!ciTypeMeta || !cfg) {
228
+ return [];
229
+ }
230
+
231
+ var isCustom = cfg.isCustom,
232
+ data = cfg.data;
233
+ var configItems = (isCustom ? data[dataType] : data) || [];
234
+ var items = isNetworkLink ? getNetworkFieldItems(configItems) : configItems; // 过滤不存在的
235
+
236
+ return filterUnExistedFields(items, ciTypeMeta);
237
+ }
238
+
239
+ var defaultLinkTagTipConfig = this.topo.options.defaultLinkTagTipConfig;
240
+ return {
241
+ tags: getItems(linkTag || (defaultLinkTagTipConfig === null || defaultLinkTagTipConfig === void 0 ? void 0 : defaultLinkTagTipConfig.tag)),
242
+ tips: getItems(linkTip || (defaultLinkTagTipConfig === null || defaultLinkTagTipConfig === void 0 ? void 0 : defaultLinkTagTipConfig.tip))
243
+ };
231
244
  };
232
245
 
233
246
  _proto.getLinksTagTipConfig = function getLinksTagTipConfig() {
@@ -580,10 +593,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
580
593
  });
581
594
  });
582
595
  } else {
583
- rlog.warn('推送属性指标数据:未查询到ciType', {
584
- ciData: ciData,
585
- ciType: ciType
586
- });
596
+ rlog.warn("\u63A8\u9001\u5C5E\u6027\u6307\u6807\u6570\u636E\uFF1A\u672A\u67E5\u8BE2\u5230ciType " + ciType, ciData);
587
597
  }
588
598
  });
589
599
  refIds = Object.keys(refIdMap);
@@ -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 "3.1.5" === 'string' ? "3.1.5" : null;
23
+ var version = typeof "3.1.6" === 'string' ? "3.1.6" : null;
24
24
  console.info("\u62D3\u6251\u7248\u672C: " + version);
25
25
  /**
26
26
  * 拓扑显示和编辑
@@ -93,6 +93,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
93
93
  var ciTypeMeta = this.topo.ciTyeCache.getCiType(ciType);
94
94
 
95
95
  function getItems(cfg) {
96
+ if (!ciTypeMeta || !cfg) {
97
+ return [];
98
+ }
99
+
96
100
  var isCustom = cfg.isCustom,
97
101
  data = cfg.data;
98
102
  var items = (isCustom ? data[ciType] : data) || []; // 过滤类型不存在的属性和指标、图片名称
@@ -107,94 +111,6 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
107
111
  tips: getItems(nodeTip || _ResourceInfoDisplay.DEFAULT_TIP_COMMON_CONFIG)
108
112
  };
109
113
  }
110
- /**
111
- * 按链路类型获取对应的属性、指标配置
112
- * @param {*} link
113
- * @param {*} config
114
- * @returns
115
- */
116
- ;
117
-
118
- _proto.getNetworkLinkConfig = function getNetworkLinkConfig(link, config) {
119
- var _this$getConfig2 = this.getConfig(config),
120
- linkTag = _this$getConfig2.linkTag,
121
- linkTip = _this$getConfig2.linkTip;
122
-
123
- var linkConnectType = link.attributes['network_link.connect_type'];
124
- var ciTypeMeta = this.topo.ciTyeCache.getNetworkLinkCiType(linkConnectType);
125
-
126
- var getMetricCode = function getMetricCode(code) {
127
- var _connectTypeMap$linkC;
128
-
129
- var connectTypeMap = {
130
- phy: {
131
- id: 'phy',
132
- metricPrefix: 'physical_link.'
133
- },
134
- agg: {
135
- id: 'agg',
136
- metricPrefix: 'agg_link.'
137
- },
138
- exit: {
139
- id: 'exit',
140
- metricPrefix: 'export_link.'
141
- }
142
- };
143
- var metricPrefix = (_connectTypeMap$linkC = connectTypeMap[linkConnectType]) === null || _connectTypeMap$linkC === void 0 ? void 0 : _connectTypeMap$linkC.metricPrefix;
144
-
145
- if (!metricPrefix) {
146
- return null;
147
- }
148
-
149
- var finalCode = null;
150
-
151
- if (ciTypeMeta.metricMap[code]) {
152
- finalCode = code;
153
- } else if (ciTypeMeta.metricMap["" + metricPrefix + code]) {
154
- finalCode = "" + metricPrefix + code;
155
- }
156
-
157
- return finalCode;
158
- };
159
-
160
- var formatItems = function formatItems(items) {
161
- var newItems = [];
162
- items.forEach(function (item) {
163
- if (item.type === 'metric') {
164
- var code = item.code;
165
- var finalCode = getMetricCode(code);
166
-
167
- if (finalCode) {
168
- newItems.push((0, _extends2["default"])({}, item, {
169
- code: finalCode
170
- }));
171
- }
172
- } else {
173
- newItems.push(item);
174
- }
175
- });
176
- return newItems;
177
- };
178
-
179
- function getItems(cfg) {
180
- if (!ciTypeMeta || !cfg) {
181
- return [];
182
- }
183
-
184
- var isCustom = cfg.isCustom,
185
- data = cfg.data;
186
- var configItems = (isCustom ? data[linkConnectType] : data) || [];
187
- var items = formatItems(configItems); // 过滤不存在的
188
-
189
- return filterUnExistedFields(items, ciTypeMeta);
190
- }
191
-
192
- var defaultLinkTagTipConfig = this.topo.options.defaultLinkTagTipConfig;
193
- return {
194
- tags: getItems(linkTag || (defaultLinkTagTipConfig === null || defaultLinkTagTipConfig === void 0 ? void 0 : defaultLinkTagTipConfig.tag)),
195
- tips: getItems(linkTip || (defaultLinkTagTipConfig === null || defaultLinkTagTipConfig === void 0 ? void 0 : defaultLinkTagTipConfig.tip))
196
- };
197
- }
198
114
  /**
199
115
  * 查询需要查询数据的连线
200
116
  *
@@ -220,10 +136,6 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
220
136
  }));
221
137
  };
222
138
 
223
- _proto.getLinkTagTipConfig = function getLinkTagTipConfig(link) {
224
- return this.getNetworkLinkConfig(link);
225
- };
226
-
227
139
  _proto.getNodesTagTipConfig = function getNodesTagTipConfig() {
228
140
  var _this = this;
229
141
 
@@ -245,6 +157,107 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
245
157
  tips: filterByPermission(node, ciTypeConfig.tips)
246
158
  };
247
159
  });
160
+ }
161
+ /**
162
+ * 按链路类型获取对应的属性、指标配置
163
+ * @param {*} link
164
+ * @returns
165
+ */
166
+ ;
167
+
168
+ _proto.getLinkTagTipConfig = function getLinkTagTipConfig(link) {
169
+ var _this$getConfig2 = this.getConfig(),
170
+ linkTag = _this$getConfig2.linkTag,
171
+ linkTip = _this$getConfig2.linkTip;
172
+
173
+ var ciTypeMeta;
174
+ var isNetworkLink = link.ciType === 'network_link';
175
+
176
+ if (isNetworkLink) {
177
+ var linkConnectType = link.attributes['network_link.connect_type'];
178
+ ciTypeMeta = this.topo.ciTyeCache.getNetworkLinkCiType(linkConnectType);
179
+ } else {
180
+ ciTypeMeta = this.topo.ciTyeCache.getCiType(link.ciType);
181
+ }
182
+
183
+ var dataType = isNetworkLink ? link.attributes['network_link.connect_type'] : link.ciType;
184
+
185
+ function getNetworkFieldItems(configItems) {
186
+ var getMetricCode = function getMetricCode(code) {
187
+ var _connectTypeMap$linkC;
188
+
189
+ var linkConnectType = link.attributes['network_link.connect_type'];
190
+ var connectTypeMap = {
191
+ phy: {
192
+ id: 'phy',
193
+ metricPrefix: 'physical_link.'
194
+ },
195
+ agg: {
196
+ id: 'agg',
197
+ metricPrefix: 'agg_link.'
198
+ },
199
+ exit: {
200
+ id: 'exit',
201
+ metricPrefix: 'export_link.'
202
+ }
203
+ };
204
+ var metricPrefix = (_connectTypeMap$linkC = connectTypeMap[linkConnectType]) === null || _connectTypeMap$linkC === void 0 ? void 0 : _connectTypeMap$linkC.metricPrefix;
205
+
206
+ if (!metricPrefix) {
207
+ return null;
208
+ }
209
+
210
+ var finalCode = null;
211
+
212
+ if (ciTypeMeta.metricMap[code]) {
213
+ finalCode = code;
214
+ } else if (ciTypeMeta.metricMap["" + metricPrefix + code]) {
215
+ finalCode = "" + metricPrefix + code;
216
+ }
217
+
218
+ return finalCode;
219
+ };
220
+
221
+ var formatItems = function formatItems(items) {
222
+ var newItems = [];
223
+ items.forEach(function (item) {
224
+ if (item.type === 'metric') {
225
+ var code = item.code;
226
+ var finalCode = getMetricCode(code);
227
+
228
+ if (finalCode) {
229
+ newItems.push((0, _extends2["default"])({}, item, {
230
+ code: finalCode
231
+ }));
232
+ }
233
+ } else {
234
+ newItems.push(item);
235
+ }
236
+ });
237
+ return newItems;
238
+ };
239
+
240
+ return formatItems(configItems);
241
+ }
242
+
243
+ function getItems(cfg) {
244
+ if (!ciTypeMeta || !cfg) {
245
+ return [];
246
+ }
247
+
248
+ var isCustom = cfg.isCustom,
249
+ data = cfg.data;
250
+ var configItems = (isCustom ? data[dataType] : data) || [];
251
+ var items = isNetworkLink ? getNetworkFieldItems(configItems) : configItems; // 过滤不存在的
252
+
253
+ return filterUnExistedFields(items, ciTypeMeta);
254
+ }
255
+
256
+ var defaultLinkTagTipConfig = this.topo.options.defaultLinkTagTipConfig;
257
+ return {
258
+ tags: getItems(linkTag || (defaultLinkTagTipConfig === null || defaultLinkTagTipConfig === void 0 ? void 0 : defaultLinkTagTipConfig.tag)),
259
+ tips: getItems(linkTip || (defaultLinkTagTipConfig === null || defaultLinkTagTipConfig === void 0 ? void 0 : defaultLinkTagTipConfig.tip))
260
+ };
248
261
  };
249
262
 
250
263
  _proto.getLinksTagTipConfig = function getLinksTagTipConfig() {
@@ -596,10 +609,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
596
609
  });
597
610
  });
598
611
  } else {
599
- _rlog["default"].warn('推送属性指标数据:未查询到ciType', {
600
- ciData: ciData,
601
- ciType: ciType
602
- });
612
+ _rlog["default"].warn("\u63A8\u9001\u5C5E\u6027\u6307\u6807\u6570\u636E\uFF1A\u672A\u67E5\u8BE2\u5230ciType " + ciType, ciData);
603
613
  }
604
614
  });
605
615
  refIds = Object.keys(refIdMap);
@@ -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 "3.1.5" === 'string' ? "3.1.5" : null;
51
+ var version = typeof "3.1.6" === 'string' ? "3.1.6" : null;
52
52
  console.info("\u62D3\u6251\u7248\u672C: " + version);
53
53
  /**
54
54
  * 拓扑显示和编辑
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "3.1.5",
3
+ "version": "3.1.6",
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@3.1.5/build/index.html",
113
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@3.1.6/build/index.html",
114
114
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
115
115
  }