@riil-frontend/component-topology 9.0.1 → 9.0.2

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.
@@ -302,31 +302,28 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
302
302
  ;
303
303
 
304
304
  _proto.getNodeNameVisible = function getNodeNameVisible(node) {
305
- if (!this.topo.isViewMode()) {
306
- return true;
307
- }
308
-
305
+ // if (!this.topo.isViewMode()) {
306
+ // return true;
307
+ // }
309
308
  var _this$getConfig3 = this.getConfig(),
310
309
  nodeTag = _this$getConfig3.nodeTag;
311
310
 
312
311
  var visible = true;
313
312
 
314
313
  if (nodeTag) {
315
- var _nodeTag$data;
316
-
317
314
  var isCustom = nodeTag.isCustom,
318
315
  data = nodeTag.data;
319
316
  var items = (isCustom ? data[node.ciType] : data) || [];
320
317
  visible = !!items.filter(function (item) {
321
318
  return item.type === "graph";
322
- }).length;
323
- console.log("getNodeNameVisible--xxx", nodeTag);
324
- var hasIpv4 = Array.isArray(nodeTag.data) && (nodeTag === null || nodeTag === void 0 ? void 0 : (_nodeTag$data = nodeTag.data) === null || _nodeTag$data === void 0 ? void 0 : _nodeTag$data.find(function (item) {
325
- return item.code === "ipv4_address";
326
- }));
319
+ }).length; // ipNode逻辑
327
320
 
328
- if (node.bindType === "ip" && !hasIpv4) {
321
+ if (isCustom) {
329
322
  return true;
323
+ } else {
324
+ return !!(data || []).filter(function (item) {
325
+ return item.type === "graph";
326
+ }).length;
330
327
  }
331
328
  }
332
329
 
@@ -24,7 +24,7 @@ import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
24
24
  import SelectionModel from "./SelectionModel";
25
25
  import CiCache from "./cache/CiCache"; // eslint-disable-next-line no-undef
26
26
 
27
- var version = typeof "9.0.1" === 'string' ? "9.0.1" : null;
27
+ var version = typeof "9.0.2" === 'string' ? "9.0.2" : null;
28
28
  console.info("\u62D3\u6251\u7248\u672C: " + version);
29
29
  /**
30
30
  * 拓扑显示和编辑
@@ -70,40 +70,91 @@ var IpNodeTagsTipsBuilder = /*#__PURE__*/function () {
70
70
  var dm = this.topo.getDataModel();
71
71
  var config = topo.attributeMetricDisplay.getConfig();
72
72
  console.log("getIpNodeTagsAndTips", config, ipNodes);
73
+ var tagDatas = config.nodeTag && !config.nodeTag.isCustom ? config.nodeTag.data : [];
74
+ var tipDatas = config.nodeTip && !config.nodeTip.isCustom ? config.nodeTip.data : [];
75
+ var tagHasIpv4 = tagDatas.filter(function (item) {
76
+ return item.code === "ipv4_address";
77
+ }).length > 0;
78
+ var tagHasName = tagDatas.filter(function (item) {
79
+ return item.code === "display_name";
80
+ }).length > 0;
81
+ var tipHasIpv4 = tipDatas.filter(function (item) {
82
+ return item.code === "ipv4_address";
83
+ }).length > 0;
84
+ var tipHasName = tipDatas.filter(function (item) {
85
+ return item.code === "display_name";
86
+ }).length > 0;
87
+ ipNodes.map(function (node) {
88
+ var tags = [];
73
89
 
74
- if (config.nodeTag && !config.nodeTag.isCustom) {
75
- var tagDatas = config.nodeTag.data;
76
- var hasIpv4 = tagDatas.filter(function (item) {
77
- return item.code === "ipv4_address";
78
- }).length > 0;
79
- ipNodes.map(function (node) {
80
- if (hasIpv4) {
81
- tts.push({
82
- type: node,
83
- id: node.id,
84
- tags: [{
85
- type: "attribute",
86
- code: "ipv4_address",
87
- // 属性code
88
- name: "IPv4地址",
89
- // 属性名称
90
- value: node.bindIp,
91
- // 属性值
92
- originValue: node.bindIp
93
- }],
94
- tips: []
95
- });
96
- } else {
97
- tts.push({
98
- type: node,
99
- id: node.id,
100
- tags: [],
101
- tips: []
102
- });
103
- }
104
- });
105
- }
90
+ if (tagHasName) {
91
+ var _element$a, _element$a2;
92
+
93
+ var element = dm.getDataByTag(node.id);
94
+ tags.push({
95
+ type: "attribute",
96
+ code: "display_name",
97
+ // 属性code
98
+ name: "显示名称",
99
+ // 属性名称
100
+ value: (_element$a = element.a("customName")) !== null && _element$a !== void 0 ? _element$a : node.name,
101
+ // 属性值
102
+ originValue: (_element$a2 = element.a("customName")) !== null && _element$a2 !== void 0 ? _element$a2 : node.name
103
+ });
104
+ }
105
+
106
+ if (tagHasIpv4) {
107
+ tags.push({
108
+ type: "attribute",
109
+ code: "ipv4_address",
110
+ // 属性code
111
+ name: "IPv4地址",
112
+ // 属性名称
113
+ value: node.bindIp,
114
+ // 属性值
115
+ originValue: node.bindIp
116
+ });
117
+ }
118
+
119
+ var tips = [];
120
+
121
+ if (tipHasName) {
122
+ var _element$a3, _element$a4;
106
123
 
124
+ var _element = dm.getDataByTag(node.id);
125
+
126
+ tips.push({
127
+ type: "attribute",
128
+ code: "display_name",
129
+ // 属性code
130
+ name: "显示名称",
131
+ // 属性名称
132
+ value: (_element$a3 = _element.a("customName")) !== null && _element$a3 !== void 0 ? _element$a3 : node.name,
133
+ // 属性值
134
+ originValue: (_element$a4 = _element.a("customName")) !== null && _element$a4 !== void 0 ? _element$a4 : node.name
135
+ });
136
+ }
137
+
138
+ if (tipHasIpv4) {
139
+ tips.push({
140
+ type: "attribute",
141
+ code: "ipv4_address",
142
+ // 属性code
143
+ name: "IPv4地址",
144
+ // 属性名称
145
+ value: node.bindIp,
146
+ // 属性值
147
+ originValue: node.bindIp
148
+ });
149
+ }
150
+
151
+ tts.push({
152
+ type: node,
153
+ id: node.id,
154
+ tags: tags,
155
+ tips: tips
156
+ });
157
+ });
107
158
  return tts;
108
159
  };
109
160
 
@@ -320,31 +320,28 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
320
320
  ;
321
321
 
322
322
  _proto.getNodeNameVisible = function getNodeNameVisible(node) {
323
- if (!this.topo.isViewMode()) {
324
- return true;
325
- }
326
-
323
+ // if (!this.topo.isViewMode()) {
324
+ // return true;
325
+ // }
327
326
  var _this$getConfig3 = this.getConfig(),
328
327
  nodeTag = _this$getConfig3.nodeTag;
329
328
 
330
329
  var visible = true;
331
330
 
332
331
  if (nodeTag) {
333
- var _nodeTag$data;
334
-
335
332
  var isCustom = nodeTag.isCustom,
336
333
  data = nodeTag.data;
337
334
  var items = (isCustom ? data[node.ciType] : data) || [];
338
335
  visible = !!items.filter(function (item) {
339
336
  return item.type === "graph";
340
- }).length;
341
- console.log("getNodeNameVisible--xxx", nodeTag);
342
- var hasIpv4 = Array.isArray(nodeTag.data) && (nodeTag === null || nodeTag === void 0 ? void 0 : (_nodeTag$data = nodeTag.data) === null || _nodeTag$data === void 0 ? void 0 : _nodeTag$data.find(function (item) {
343
- return item.code === "ipv4_address";
344
- }));
337
+ }).length; // ipNode逻辑
345
338
 
346
- if (node.bindType === "ip" && !hasIpv4) {
339
+ if (isCustom) {
347
340
  return true;
341
+ } else {
342
+ return !!(data || []).filter(function (item) {
343
+ return item.type === "graph";
344
+ }).length;
348
345
  }
349
346
  }
350
347
 
@@ -56,7 +56,7 @@ var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
56
56
  var _CiCache = _interopRequireDefault(require("./cache/CiCache"));
57
57
 
58
58
  // eslint-disable-next-line no-undef
59
- var version = typeof "9.0.1" === 'string' ? "9.0.1" : null;
59
+ var version = typeof "9.0.2" === 'string' ? "9.0.2" : null;
60
60
  console.info("\u62D3\u6251\u7248\u672C: " + version);
61
61
  /**
62
62
  * 拓扑显示和编辑
@@ -80,40 +80,91 @@ var IpNodeTagsTipsBuilder = /*#__PURE__*/function () {
80
80
  var dm = this.topo.getDataModel();
81
81
  var config = topo.attributeMetricDisplay.getConfig();
82
82
  console.log("getIpNodeTagsAndTips", config, ipNodes);
83
+ var tagDatas = config.nodeTag && !config.nodeTag.isCustom ? config.nodeTag.data : [];
84
+ var tipDatas = config.nodeTip && !config.nodeTip.isCustom ? config.nodeTip.data : [];
85
+ var tagHasIpv4 = tagDatas.filter(function (item) {
86
+ return item.code === "ipv4_address";
87
+ }).length > 0;
88
+ var tagHasName = tagDatas.filter(function (item) {
89
+ return item.code === "display_name";
90
+ }).length > 0;
91
+ var tipHasIpv4 = tipDatas.filter(function (item) {
92
+ return item.code === "ipv4_address";
93
+ }).length > 0;
94
+ var tipHasName = tipDatas.filter(function (item) {
95
+ return item.code === "display_name";
96
+ }).length > 0;
97
+ ipNodes.map(function (node) {
98
+ var tags = [];
83
99
 
84
- if (config.nodeTag && !config.nodeTag.isCustom) {
85
- var tagDatas = config.nodeTag.data;
86
- var hasIpv4 = tagDatas.filter(function (item) {
87
- return item.code === "ipv4_address";
88
- }).length > 0;
89
- ipNodes.map(function (node) {
90
- if (hasIpv4) {
91
- tts.push({
92
- type: node,
93
- id: node.id,
94
- tags: [{
95
- type: "attribute",
96
- code: "ipv4_address",
97
- // 属性code
98
- name: "IPv4地址",
99
- // 属性名称
100
- value: node.bindIp,
101
- // 属性值
102
- originValue: node.bindIp
103
- }],
104
- tips: []
105
- });
106
- } else {
107
- tts.push({
108
- type: node,
109
- id: node.id,
110
- tags: [],
111
- tips: []
112
- });
113
- }
114
- });
115
- }
100
+ if (tagHasName) {
101
+ var _element$a, _element$a2;
102
+
103
+ var element = dm.getDataByTag(node.id);
104
+ tags.push({
105
+ type: "attribute",
106
+ code: "display_name",
107
+ // 属性code
108
+ name: "显示名称",
109
+ // 属性名称
110
+ value: (_element$a = element.a("customName")) !== null && _element$a !== void 0 ? _element$a : node.name,
111
+ // 属性值
112
+ originValue: (_element$a2 = element.a("customName")) !== null && _element$a2 !== void 0 ? _element$a2 : node.name
113
+ });
114
+ }
115
+
116
+ if (tagHasIpv4) {
117
+ tags.push({
118
+ type: "attribute",
119
+ code: "ipv4_address",
120
+ // 属性code
121
+ name: "IPv4地址",
122
+ // 属性名称
123
+ value: node.bindIp,
124
+ // 属性值
125
+ originValue: node.bindIp
126
+ });
127
+ }
128
+
129
+ var tips = [];
130
+
131
+ if (tipHasName) {
132
+ var _element$a3, _element$a4;
116
133
 
134
+ var _element = dm.getDataByTag(node.id);
135
+
136
+ tips.push({
137
+ type: "attribute",
138
+ code: "display_name",
139
+ // 属性code
140
+ name: "显示名称",
141
+ // 属性名称
142
+ value: (_element$a3 = _element.a("customName")) !== null && _element$a3 !== void 0 ? _element$a3 : node.name,
143
+ // 属性值
144
+ originValue: (_element$a4 = _element.a("customName")) !== null && _element$a4 !== void 0 ? _element$a4 : node.name
145
+ });
146
+ }
147
+
148
+ if (tipHasIpv4) {
149
+ tips.push({
150
+ type: "attribute",
151
+ code: "ipv4_address",
152
+ // 属性code
153
+ name: "IPv4地址",
154
+ // 属性名称
155
+ value: node.bindIp,
156
+ // 属性值
157
+ originValue: node.bindIp
158
+ });
159
+ }
160
+
161
+ tts.push({
162
+ type: node,
163
+ id: node.id,
164
+ tags: tags,
165
+ tips: tips
166
+ });
167
+ });
117
168
  return tts;
118
169
  };
119
170
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "9.0.1",
3
+ "version": "9.0.2",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -116,6 +116,6 @@
116
116
  "access": "public"
117
117
  },
118
118
  "license": "MIT",
119
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@9.0.1/build/index.html",
119
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@9.0.2/build/index.html",
120
120
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
121
121
  }