@riil-frontend/component-topology 2.15.35 → 2.15.38

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.
@@ -718,8 +718,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
718
718
  }, // 带宽利用率
719
719
  {
720
720
  code: 'bandwidth_utilization',
721
- calcType: 'avg',
722
- showWhenSameSource: true
721
+ calcType: 'avg'
723
722
  }, // 发送带宽利用率
724
723
  {
725
724
  code: 'out_bandwidth_utilization',
@@ -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.35" === 'string' ? "2.15.35" : null;
23
+ var version = typeof "2.15.38" === 'string' ? "2.15.38" : null;
24
24
  console.info("\u62D3\u6251\u7248\u672C: " + version);
25
25
  /**
26
26
  * 拓扑显示和编辑
@@ -70,13 +70,14 @@ function AddLinkDrawer(props) {
70
70
 
71
71
  portsDoc = {};
72
72
  ports = result.map(function (item) {
73
- portsDoc[item.id] = item;
74
- return {
73
+ var obj = {
75
74
  value: item.id,
76
75
  label: item.name,
77
- type: item.typa,
78
- ratedBandwidth: item.ratedBandwidth
76
+ type: item.type,
77
+ ratedBandwidth: parseInt(item.ratedBandwidth, 10)
79
78
  };
79
+ portsDoc[item.id] = obj;
80
+ return obj;
80
81
  });
81
82
  return _context.abrupt("return", {
82
83
  ports: ports,
@@ -221,6 +222,8 @@ function AddLinkDrawer(props) {
221
222
  }();
222
223
 
223
224
  useEffect(function () {
225
+ rlog.debug("useEffect-----currentLink", currentLink);
226
+
224
227
  if (currentLink) {
225
228
  setIsAddMode(false);
226
229
  initEditLineData();
@@ -57,27 +57,9 @@ export default function EditLinkInfo(props) {
57
57
  setTarget = _useState3[1];
58
58
 
59
59
  var fieldOnChange = function fieldOnChange(name, value) {
60
- if (name === "source_id" || name === "destination_id") {
61
- var _parseInt, _sourceValue$portsDoc, _parseInt2, _targetValue$portsDoc;
62
-
63
- var nowValues = field.getValues();
64
- var sourceId = nowValues["source_id"];
65
- var targetId = nowValues["destination_id"];
66
- var sourceRb = (_parseInt = parseInt((_sourceValue$portsDoc = sourceValue.portsDoc[sourceId]) === null || _sourceValue$portsDoc === void 0 ? void 0 : _sourceValue$portsDoc.ratedBandwidth, 10)) !== null && _parseInt !== void 0 ? _parseInt : 0;
67
- var targetRb = (_parseInt2 = parseInt((_targetValue$portsDoc = targetValue.portsDoc[targetId]) === null || _targetValue$portsDoc === void 0 ? void 0 : _targetValue$portsDoc.ratedBandwidth, 10)) !== null && _parseInt2 !== void 0 ? _parseInt2 : null;
68
-
69
- if (sourceRb && targetRb) {
70
- field.setValue("network_link.actual_bandwidth", Math.min(sourceRb, targetRb));
71
- } else {
72
- field.setValue("network_link.actual_bandwidth", sourceRb || targetRb);
73
- }
74
- }
75
-
76
60
  var newValues = field.getValues();
77
61
  rlog.debug("Field-onChange", newValues, name, value);
78
- setValus(newValues); // if (values[name] !== value) {
79
- // onChange(name, value, newValues);
80
- // }
62
+ setValus(newValues);
81
63
  };
82
64
 
83
65
  var field = _Field.useField({
@@ -88,11 +70,11 @@ export default function EditLinkInfo(props) {
88
70
 
89
71
  useEffect(function () {
90
72
  setValus(attributes);
91
- rlog.debug("useEffect", source, target);
73
+ rlog.debug("useEffect", source, target, attributes);
92
74
  setSource(source);
93
75
  setTarget(target);
94
76
  field.setValues(attributes);
95
- }, [addLinkIsOpen]); // const [editState, editDispatchers] = store.useModel("topoCreateMod");
77
+ }, [source, target, field, attributes]); // const [editState, editDispatchers] = store.useModel("topoCreateMod");
96
78
 
97
79
  var labelAlign = "top";
98
80
  var formItemLayout = {
@@ -120,20 +102,38 @@ export default function EditLinkInfo(props) {
120
102
  };
121
103
  };
122
104
 
123
- var portsHandleChange = function portsHandleChange() {};
105
+ var portsHandleChange = function portsHandleChange(type, value) {
106
+ var _sourceValue$portsDoc, _sourceValue$portsDoc2, _targetValue$portsDoc, _targetValue$portsDoc2;
107
+
108
+ var nowValues = field.getValues();
109
+ var sourceId = nowValues["source_id"];
110
+ var targetId = nowValues["destination_id"];
111
+ var sourceRb = (_sourceValue$portsDoc = (_sourceValue$portsDoc2 = sourceValue.portsDoc[sourceId]) === null || _sourceValue$portsDoc2 === void 0 ? void 0 : _sourceValue$portsDoc2.ratedBandwidth) !== null && _sourceValue$portsDoc !== void 0 ? _sourceValue$portsDoc : 0;
112
+ var targetRb = (_targetValue$portsDoc = (_targetValue$portsDoc2 = targetValue.portsDoc[targetId]) === null || _targetValue$portsDoc2 === void 0 ? void 0 : _targetValue$portsDoc2.ratedBandwidth) !== null && _targetValue$portsDoc !== void 0 ? _targetValue$portsDoc : 0;
113
+ var actualBandwidth = 0;
114
+
115
+ if (sourceRb && targetRb) {
116
+ actualBandwidth = Math.min(sourceRb, targetRb);
117
+ } else {
118
+ actualBandwidth = sourceRb || targetRb;
119
+ }
120
+
121
+ rlog.debug("network_link.actual_bandwidth", actualBandwidth);
122
+ field.setValue("network_link.actual_bandwidth", actualBandwidth);
123
+ };
124
124
 
125
125
  var saveHandleChange = function saveHandleChange() {
126
126
  field.validate(function (errors, values) {
127
127
  if (errors) {
128
128
  rlog.debug("saveHandleChange-error", errors, values);
129
129
  } else {
130
- var _sourceValue$portsDoc2, _sourceValue$portsDoc3, _targetValue$portsDoc2, _targetValue$portsDoc3, _sourceValue$ipAddres, _targetValue$ipAddres;
130
+ var _sourceValue$portsDoc3, _sourceValue$portsDoc4, _targetValue$portsDoc3, _targetValue$portsDoc4, _sourceValue$ipAddres, _targetValue$ipAddres;
131
131
 
132
132
  rlog.debug("saveHandleChange", valus, source, target);
133
133
  var sourceId = valus["source_id"];
134
134
  var destinationId = valus["destination_id"];
135
- var sourceType = (_sourceValue$portsDoc2 = (_sourceValue$portsDoc3 = sourceValue.portsDoc[sourceId]) === null || _sourceValue$portsDoc3 === void 0 ? void 0 : _sourceValue$portsDoc3.type) !== null && _sourceValue$portsDoc2 !== void 0 ? _sourceValue$portsDoc2 : "";
136
- var destinationType = (_targetValue$portsDoc2 = (_targetValue$portsDoc3 = targetValue.portsDoc[destinationId]) === null || _targetValue$portsDoc3 === void 0 ? void 0 : _targetValue$portsDoc3.type) !== null && _targetValue$portsDoc2 !== void 0 ? _targetValue$portsDoc2 : "";
135
+ var sourceType = (_sourceValue$portsDoc3 = (_sourceValue$portsDoc4 = sourceValue.portsDoc[sourceId]) === null || _sourceValue$portsDoc4 === void 0 ? void 0 : _sourceValue$portsDoc4.type) !== null && _sourceValue$portsDoc3 !== void 0 ? _sourceValue$portsDoc3 : "";
136
+ var destinationType = (_targetValue$portsDoc3 = (_targetValue$portsDoc4 = targetValue.portsDoc[destinationId]) === null || _targetValue$portsDoc4 === void 0 ? void 0 : _targetValue$portsDoc4.type) !== null && _targetValue$portsDoc3 !== void 0 ? _targetValue$portsDoc3 : "";
137
137
  var typeJudge = linkTypeJudge(sourceType, destinationType);
138
138
  var obj = {
139
139
  display_name: valus["display_name"],
@@ -264,7 +264,9 @@ export default function EditLinkInfo(props) {
264
264
  name: "source_id",
265
265
  disabled: sourceValue.ports.length === 0,
266
266
  className: styles.selectList,
267
- onChange: portsHandleChange,
267
+ onChange: function onChange(v) {
268
+ portsHandleChange("source_id", v);
269
+ },
268
270
  dataSource: sourceValue.ports
269
271
  }) : "-")), /*#__PURE__*/React.createElement(Col, {
270
272
  span: "12"
@@ -277,7 +279,9 @@ export default function EditLinkInfo(props) {
277
279
  name: "destination_id",
278
280
  disabled: targetValue.ports.length === 0,
279
281
  className: styles.selectList,
280
- onChange: portsHandleChange,
282
+ onChange: function onChange(v) {
283
+ portsHandleChange("destination_id", v);
284
+ },
281
285
  dataSource: targetValue.ports
282
286
  }) : "-"))), /*#__PURE__*/React.createElement(Row, {
283
287
  gutter: "4"
@@ -180,9 +180,14 @@ var ciModfilter = function ciModfilter(ciTypeObj, globalSetting, type, code) {
180
180
  (_tags$data$code = tags.data[code]) === null || _tags$data$code === void 0 ? void 0 : _tags$data$code.map(function (item) {
181
181
  tagArr.push(item.code + "-" + item.type);
182
182
  });
183
- }
183
+ } // rlog.debug(
184
+ // "过滤ci元数据中的属性和指标,用于属性和指标显示设置",
185
+ // globalSetting,
186
+ // tipArr,
187
+ // tagArr
188
+ // );
189
+
184
190
 
185
- rlog.debug("过滤ci元数据中的属性和指标,用于属性和指标显示设置", globalSetting, tipArr, tagArr);
186
191
  var custom = [];
187
192
 
188
193
  if (type === "node") {
@@ -737,8 +737,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
737
737
  }, // 带宽利用率
738
738
  {
739
739
  code: 'bandwidth_utilization',
740
- calcType: 'avg',
741
- showWhenSameSource: true
740
+ calcType: 'avg'
742
741
  }, // 发送带宽利用率
743
742
  {
744
743
  code: 'out_bandwidth_utilization',
@@ -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.35" === 'string' ? "2.15.35" : null;
51
+ var version = typeof "2.15.38" === 'string' ? "2.15.38" : null;
52
52
  console.info("\u62D3\u6251\u7248\u672C: " + version);
53
53
  /**
54
54
  * 拓扑显示和编辑
@@ -99,13 +99,14 @@ function AddLinkDrawer(props) {
99
99
 
100
100
  portsDoc = {};
101
101
  ports = result.map(function (item) {
102
- portsDoc[item.id] = item;
103
- return {
102
+ var obj = {
104
103
  value: item.id,
105
104
  label: item.name,
106
- type: item.typa,
107
- ratedBandwidth: item.ratedBandwidth
105
+ type: item.type,
106
+ ratedBandwidth: parseInt(item.ratedBandwidth, 10)
108
107
  };
108
+ portsDoc[item.id] = obj;
109
+ return obj;
109
110
  });
110
111
  return _context.abrupt("return", {
111
112
  ports: ports,
@@ -253,6 +254,8 @@ function AddLinkDrawer(props) {
253
254
  }();
254
255
 
255
256
  (0, _react.useEffect)(function () {
257
+ _rlog["default"].debug("useEffect-----currentLink", currentLink);
258
+
256
259
  if (currentLink) {
257
260
  setIsAddMode(false);
258
261
  initEditLineData();
@@ -81,29 +81,11 @@ function EditLinkInfo(props) {
81
81
  setTarget = _useState3[1];
82
82
 
83
83
  var fieldOnChange = function fieldOnChange(name, value) {
84
- if (name === "source_id" || name === "destination_id") {
85
- var _parseInt, _sourceValue$portsDoc, _parseInt2, _targetValue$portsDoc;
86
-
87
- var nowValues = field.getValues();
88
- var sourceId = nowValues["source_id"];
89
- var targetId = nowValues["destination_id"];
90
- var sourceRb = (_parseInt = parseInt((_sourceValue$portsDoc = sourceValue.portsDoc[sourceId]) === null || _sourceValue$portsDoc === void 0 ? void 0 : _sourceValue$portsDoc.ratedBandwidth, 10)) !== null && _parseInt !== void 0 ? _parseInt : 0;
91
- var targetRb = (_parseInt2 = parseInt((_targetValue$portsDoc = targetValue.portsDoc[targetId]) === null || _targetValue$portsDoc === void 0 ? void 0 : _targetValue$portsDoc.ratedBandwidth, 10)) !== null && _parseInt2 !== void 0 ? _parseInt2 : null;
92
-
93
- if (sourceRb && targetRb) {
94
- field.setValue("network_link.actual_bandwidth", Math.min(sourceRb, targetRb));
95
- } else {
96
- field.setValue("network_link.actual_bandwidth", sourceRb || targetRb);
97
- }
98
- }
99
-
100
84
  var newValues = field.getValues();
101
85
 
102
86
  _rlog["default"].debug("Field-onChange", newValues, name, value);
103
87
 
104
- setValus(newValues); // if (values[name] !== value) {
105
- // onChange(name, value, newValues);
106
- // }
88
+ setValus(newValues);
107
89
  };
108
90
 
109
91
  var field = _field["default"].useField({
@@ -115,12 +97,12 @@ function EditLinkInfo(props) {
115
97
  (0, _react.useEffect)(function () {
116
98
  setValus(attributes);
117
99
 
118
- _rlog["default"].debug("useEffect", source, target);
100
+ _rlog["default"].debug("useEffect", source, target, attributes);
119
101
 
120
102
  setSource(source);
121
103
  setTarget(target);
122
104
  field.setValues(attributes);
123
- }, [addLinkIsOpen]); // const [editState, editDispatchers] = store.useModel("topoCreateMod");
105
+ }, [source, target, field, attributes]); // const [editState, editDispatchers] = store.useModel("topoCreateMod");
124
106
 
125
107
  var labelAlign = "top";
126
108
  var formItemLayout = {
@@ -148,21 +130,40 @@ function EditLinkInfo(props) {
148
130
  };
149
131
  };
150
132
 
151
- var portsHandleChange = function portsHandleChange() {};
133
+ var portsHandleChange = function portsHandleChange(type, value) {
134
+ var _sourceValue$portsDoc, _sourceValue$portsDoc2, _targetValue$portsDoc, _targetValue$portsDoc2;
135
+
136
+ var nowValues = field.getValues();
137
+ var sourceId = nowValues["source_id"];
138
+ var targetId = nowValues["destination_id"];
139
+ var sourceRb = (_sourceValue$portsDoc = (_sourceValue$portsDoc2 = sourceValue.portsDoc[sourceId]) === null || _sourceValue$portsDoc2 === void 0 ? void 0 : _sourceValue$portsDoc2.ratedBandwidth) !== null && _sourceValue$portsDoc !== void 0 ? _sourceValue$portsDoc : 0;
140
+ var targetRb = (_targetValue$portsDoc = (_targetValue$portsDoc2 = targetValue.portsDoc[targetId]) === null || _targetValue$portsDoc2 === void 0 ? void 0 : _targetValue$portsDoc2.ratedBandwidth) !== null && _targetValue$portsDoc !== void 0 ? _targetValue$portsDoc : 0;
141
+ var actualBandwidth = 0;
142
+
143
+ if (sourceRb && targetRb) {
144
+ actualBandwidth = Math.min(sourceRb, targetRb);
145
+ } else {
146
+ actualBandwidth = sourceRb || targetRb;
147
+ }
148
+
149
+ _rlog["default"].debug("network_link.actual_bandwidth", actualBandwidth);
150
+
151
+ field.setValue("network_link.actual_bandwidth", actualBandwidth);
152
+ };
152
153
 
153
154
  var saveHandleChange = function saveHandleChange() {
154
155
  field.validate(function (errors, values) {
155
156
  if (errors) {
156
157
  _rlog["default"].debug("saveHandleChange-error", errors, values);
157
158
  } else {
158
- var _sourceValue$portsDoc2, _sourceValue$portsDoc3, _targetValue$portsDoc2, _targetValue$portsDoc3, _sourceValue$ipAddres, _targetValue$ipAddres;
159
+ var _sourceValue$portsDoc3, _sourceValue$portsDoc4, _targetValue$portsDoc3, _targetValue$portsDoc4, _sourceValue$ipAddres, _targetValue$ipAddres;
159
160
 
160
161
  _rlog["default"].debug("saveHandleChange", valus, source, target);
161
162
 
162
163
  var sourceId = valus["source_id"];
163
164
  var destinationId = valus["destination_id"];
164
- var sourceType = (_sourceValue$portsDoc2 = (_sourceValue$portsDoc3 = sourceValue.portsDoc[sourceId]) === null || _sourceValue$portsDoc3 === void 0 ? void 0 : _sourceValue$portsDoc3.type) !== null && _sourceValue$portsDoc2 !== void 0 ? _sourceValue$portsDoc2 : "";
165
- var destinationType = (_targetValue$portsDoc2 = (_targetValue$portsDoc3 = targetValue.portsDoc[destinationId]) === null || _targetValue$portsDoc3 === void 0 ? void 0 : _targetValue$portsDoc3.type) !== null && _targetValue$portsDoc2 !== void 0 ? _targetValue$portsDoc2 : "";
165
+ var sourceType = (_sourceValue$portsDoc3 = (_sourceValue$portsDoc4 = sourceValue.portsDoc[sourceId]) === null || _sourceValue$portsDoc4 === void 0 ? void 0 : _sourceValue$portsDoc4.type) !== null && _sourceValue$portsDoc3 !== void 0 ? _sourceValue$portsDoc3 : "";
166
+ var destinationType = (_targetValue$portsDoc3 = (_targetValue$portsDoc4 = targetValue.portsDoc[destinationId]) === null || _targetValue$portsDoc4 === void 0 ? void 0 : _targetValue$portsDoc4.type) !== null && _targetValue$portsDoc3 !== void 0 ? _targetValue$portsDoc3 : "";
166
167
  var typeJudge = linkTypeJudge(sourceType, destinationType);
167
168
  var obj = {
168
169
  display_name: valus["display_name"],
@@ -293,7 +294,9 @@ function EditLinkInfo(props) {
293
294
  name: "source_id",
294
295
  disabled: sourceValue.ports.length === 0,
295
296
  className: _indexModule["default"].selectList,
296
- onChange: portsHandleChange,
297
+ onChange: function onChange(v) {
298
+ portsHandleChange("source_id", v);
299
+ },
297
300
  dataSource: sourceValue.ports
298
301
  }) : "-")), /*#__PURE__*/_react["default"].createElement(Col, {
299
302
  span: "12"
@@ -306,7 +309,9 @@ function EditLinkInfo(props) {
306
309
  name: "destination_id",
307
310
  disabled: targetValue.ports.length === 0,
308
311
  className: _indexModule["default"].selectList,
309
- onChange: portsHandleChange,
312
+ onChange: function onChange(v) {
313
+ portsHandleChange("destination_id", v);
314
+ },
310
315
  dataSource: targetValue.ports
311
316
  }) : "-"))), /*#__PURE__*/_react["default"].createElement(Row, {
312
317
  gutter: "4"
@@ -219,9 +219,13 @@ var ciModfilter = function ciModfilter(ciTypeObj, globalSetting, type, code) {
219
219
  (_tags$data$code = tags.data[code]) === null || _tags$data$code === void 0 ? void 0 : _tags$data$code.map(function (item) {
220
220
  tagArr.push(item.code + "-" + item.type);
221
221
  });
222
- }
222
+ } // rlog.debug(
223
+ // "过滤ci元数据中的属性和指标,用于属性和指标显示设置",
224
+ // globalSetting,
225
+ // tipArr,
226
+ // tagArr
227
+ // );
223
228
 
224
- _rlog["default"].debug("过滤ci元数据中的属性和指标,用于属性和指标显示设置", globalSetting, tipArr, tagArr);
225
229
 
226
230
  var custom = [];
227
231
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "2.15.35",
3
+ "version": "2.15.38",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -41,7 +41,7 @@
41
41
  "@ahooksjs/use-tree-plugin": "^0.2.1",
42
42
  "@alifd/biz-anchor": "^1.1.7",
43
43
  "@ice/store": "^1.4.2",
44
- "@riil-frontend/component-topo-icon-select": "^1.0.10",
44
+ "@riil-frontend/component-topo-icon-select": "^1.0.11",
45
45
  "@riil-frontend/component-topology-utils": "^2.0.20-alpha.0",
46
46
  "classnames": "^2.2.3",
47
47
  "prop-types": "^15.5.8",
@@ -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.35/build/index.html",
113
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@2.15.38/build/index.html",
114
114
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
115
115
  }