@riil-frontend/component-topology 9.0.0-a.30 → 9.0.0-a.31

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.
@@ -973,13 +973,22 @@ var useTopoEdit = function useTopoEdit(params) {
973
973
 
974
974
  function _relateNodeIp() {
975
975
  _relateNodeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(txtValue, nodeElement) {
976
- var dm, htTopo, elementNodes, isUnique, ip, configObj, configData, _elements, newLinkElements, createElementsData;
976
+ var dm, htTopo, elementNodes, isUnique, ip, configObj, configData, _elements, newLinkElements, newLink, newLinkGroup, createElementsData;
977
977
 
978
978
  return _regeneratorRuntime.wrap(function _callee16$(_context16) {
979
979
  while (1) {
980
980
  switch (_context16.prev = _context16.next) {
981
981
  case 0:
982
- // console.log("bindIPtoNode", txtValue, nodeElement);
982
+ console.log("bindIPtoNode", txtValue, nodeElement);
983
+
984
+ if (txtValue) {
985
+ _context16.next = 3;
986
+ break;
987
+ }
988
+
989
+ return _context16.abrupt("return");
990
+
991
+ case 3:
983
992
  // 根据配置查询拓扑数据
984
993
  dm = topo.getDataModel();
985
994
  htTopo = topo.getHtTopo();
@@ -989,42 +998,49 @@ var useTopoEdit = function useTopoEdit(params) {
989
998
  ip = buildIpNode(txtValue); // 获取关联链路
990
999
 
991
1000
  if (!isUnique) {
992
- _context16.next = 21;
1001
+ _context16.next = 26;
993
1002
  break;
994
1003
  }
995
1004
 
996
- deleteExLink(nodeElement);
1005
+ // deleteExLink(nodeElement);
997
1006
  nodeElement.a(ip);
998
1007
  nodeElement.setName(txtValue);
999
1008
  nodeElement.setTag("ip:" + txtValue); // 获取配置
1000
1009
 
1001
1010
  configObj = topo.resourceConfig.getConfig();
1002
- _context16.next = 13;
1011
+ _context16.next = 15;
1003
1012
  return resourceConfig.updateConfig(configObj);
1004
1013
 
1005
- case 13:
1006
- _context16.next = 15;
1014
+ case 15:
1015
+ _context16.next = 17;
1007
1016
  return editDispatchers.fetchDataByConfig();
1008
1017
 
1009
- case 15:
1018
+ case 17:
1010
1019
  configData = _context16.sent;
1011
1020
  // console.log("configData", configData);
1012
1021
  _elements = configData.elements;
1013
1022
  newLinkElements = findUNExistedLinkElements(_elements);
1023
+ newLink = newLinkElements.filter(function (item) {
1024
+ return item.type === "link";
1025
+ });
1026
+ newLinkGroup = newLinkElements.filter(function (item) {
1027
+ return item.type === "linkGroup";
1028
+ }); // const newData = elements.find((item) => item.id === `ip:${txtValue}`);
1029
+
1030
+ console.log("newData", newLink);
1014
1031
  createElementsData = {
1015
1032
  groups: [],
1016
1033
  nodes: [],
1017
- links: newLinkElements.filter(function (item) {
1018
- return item.type === "link";
1019
- }),
1020
- linkGroups: newLinkElements.filter(function (item) {
1021
- return item.type === "linkGroup";
1022
- })
1034
+ links: newLink,
1035
+ linkGroups: newLinkGroup
1023
1036
  };
1024
1037
  console.log("createElementsData", createElementsData);
1025
- htTopo.createElements(createElementsData);
1026
1038
 
1027
- case 21:
1039
+ if ([].concat(newLink, newLinkGroup).length > 0) {
1040
+ htTopo.createElements(createElementsData);
1041
+ }
1042
+
1043
+ case 26:
1028
1044
  case "end":
1029
1045
  return _context16.stop();
1030
1046
  }
@@ -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.0-a.30" === 'string' ? "9.0.0-a.30" : null;
27
+ var version = typeof "9.0.0-a.31" === 'string' ? "9.0.0-a.31" : null;
28
28
  console.info("\u62D3\u6251\u7248\u672C: " + version);
29
29
  /**
30
30
  * 拓扑显示和编辑
@@ -29,6 +29,7 @@ export function buildIpNode(ip) {
29
29
  // 'attributes': [],
30
30
  // 'metrics': [],
31
31
  type: "node",
32
+ isbinding: true,
32
33
  // 'dtype': 'device'
33
34
  operation: "delete"
34
35
  };
@@ -128,7 +129,9 @@ export function processExitLink(topoData) {
128
129
  // 根据链路序列化数据找目的端节点
129
130
  // eslint-disable-next-line no-underscore-dangle
130
131
  var targetNodeSerialize = serialize.d.find(function (item) {
131
- return item.i === linkSerialize.p.target.__i;
132
+ var _linkSerialize$p$targ;
133
+
134
+ return item.i === (linkSerialize === null || linkSerialize === void 0 ? void 0 : (_linkSerialize$p$targ = linkSerialize.p.target) === null || _linkSerialize$p$targ === void 0 ? void 0 : _linkSerialize$p$targ.__i);
132
135
  });
133
136
 
134
137
  if (targetNodeSerialize) {
@@ -184,10 +187,12 @@ export function processExitLink(topoData) {
184
187
  // 根据链路序列化数据找目的端节点
185
188
  // eslint-disable-next-line no-underscore-dangle
186
189
  var targetNodeSerialize = serialize.d.find(function (item) {
187
- return item.i === linkSerialize.p.target.__i;
190
+ var _linkSerialize$p$targ2;
191
+
192
+ return item.i === (linkSerialize === null || linkSerialize === void 0 ? void 0 : (_linkSerialize$p$targ2 = linkSerialize.p.target) === null || _linkSerialize$p$targ2 === void 0 ? void 0 : _linkSerialize$p$targ2.__i);
188
193
  });
189
194
 
190
- if (!targetNodeSerialize.p.tag) {
195
+ if (targetNodeSerialize && !targetNodeSerialize.p.tag) {
191
196
  targetNodeSerialize.a = _extends({}, targetNodeSerialize.a, buildIpNode(destinationIp), {
192
197
  isbinding: true
193
198
  });
@@ -1014,13 +1014,22 @@ var useTopoEdit = function useTopoEdit(params) {
1014
1014
 
1015
1015
  function _relateNodeIp() {
1016
1016
  _relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(txtValue, nodeElement) {
1017
- var dm, htTopo, elementNodes, isUnique, ip, configObj, configData, _elements, newLinkElements, createElementsData;
1017
+ var dm, htTopo, elementNodes, isUnique, ip, configObj, configData, _elements, newLinkElements, newLink, newLinkGroup, createElementsData;
1018
1018
 
1019
1019
  return _regenerator["default"].wrap(function _callee16$(_context16) {
1020
1020
  while (1) {
1021
1021
  switch (_context16.prev = _context16.next) {
1022
1022
  case 0:
1023
- // console.log("bindIPtoNode", txtValue, nodeElement);
1023
+ console.log("bindIPtoNode", txtValue, nodeElement);
1024
+
1025
+ if (txtValue) {
1026
+ _context16.next = 3;
1027
+ break;
1028
+ }
1029
+
1030
+ return _context16.abrupt("return");
1031
+
1032
+ case 3:
1024
1033
  // 根据配置查询拓扑数据
1025
1034
  dm = topo.getDataModel();
1026
1035
  htTopo = topo.getHtTopo();
@@ -1030,42 +1039,49 @@ var useTopoEdit = function useTopoEdit(params) {
1030
1039
  ip = (0, _exitLinkUtil.buildIpNode)(txtValue); // 获取关联链路
1031
1040
 
1032
1041
  if (!isUnique) {
1033
- _context16.next = 21;
1042
+ _context16.next = 26;
1034
1043
  break;
1035
1044
  }
1036
1045
 
1037
- deleteExLink(nodeElement);
1046
+ // deleteExLink(nodeElement);
1038
1047
  nodeElement.a(ip);
1039
1048
  nodeElement.setName(txtValue);
1040
1049
  nodeElement.setTag("ip:" + txtValue); // 获取配置
1041
1050
 
1042
1051
  configObj = topo.resourceConfig.getConfig();
1043
- _context16.next = 13;
1052
+ _context16.next = 15;
1044
1053
  return resourceConfig.updateConfig(configObj);
1045
1054
 
1046
- case 13:
1047
- _context16.next = 15;
1055
+ case 15:
1056
+ _context16.next = 17;
1048
1057
  return editDispatchers.fetchDataByConfig();
1049
1058
 
1050
- case 15:
1059
+ case 17:
1051
1060
  configData = _context16.sent;
1052
1061
  // console.log("configData", configData);
1053
1062
  _elements = configData.elements;
1054
1063
  newLinkElements = findUNExistedLinkElements(_elements);
1064
+ newLink = newLinkElements.filter(function (item) {
1065
+ return item.type === "link";
1066
+ });
1067
+ newLinkGroup = newLinkElements.filter(function (item) {
1068
+ return item.type === "linkGroup";
1069
+ }); // const newData = elements.find((item) => item.id === `ip:${txtValue}`);
1070
+
1071
+ console.log("newData", newLink);
1055
1072
  createElementsData = {
1056
1073
  groups: [],
1057
1074
  nodes: [],
1058
- links: newLinkElements.filter(function (item) {
1059
- return item.type === "link";
1060
- }),
1061
- linkGroups: newLinkElements.filter(function (item) {
1062
- return item.type === "linkGroup";
1063
- })
1075
+ links: newLink,
1076
+ linkGroups: newLinkGroup
1064
1077
  };
1065
1078
  console.log("createElementsData", createElementsData);
1066
- htTopo.createElements(createElementsData);
1067
1079
 
1068
- case 21:
1080
+ if ([].concat(newLink, newLinkGroup).length > 0) {
1081
+ htTopo.createElements(createElementsData);
1082
+ }
1083
+
1084
+ case 26:
1069
1085
  case "end":
1070
1086
  return _context16.stop();
1071
1087
  }
@@ -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.0-a.30" === 'string' ? "9.0.0-a.30" : null;
59
+ var version = typeof "9.0.0-a.31" === 'string' ? "9.0.0-a.31" : null;
60
60
  console.info("\u62D3\u6251\u7248\u672C: " + version);
61
61
  /**
62
62
  * 拓扑显示和编辑
@@ -40,6 +40,7 @@ function buildIpNode(ip) {
40
40
  // 'attributes': [],
41
41
  // 'metrics': [],
42
42
  type: "node",
43
+ isbinding: true,
43
44
  // 'dtype': 'device'
44
45
  operation: "delete"
45
46
  };
@@ -139,7 +140,9 @@ function processExitLink(topoData) {
139
140
  // 根据链路序列化数据找目的端节点
140
141
  // eslint-disable-next-line no-underscore-dangle
141
142
  var targetNodeSerialize = serialize.d.find(function (item) {
142
- return item.i === linkSerialize.p.target.__i;
143
+ var _linkSerialize$p$targ;
144
+
145
+ return item.i === (linkSerialize === null || linkSerialize === void 0 ? void 0 : (_linkSerialize$p$targ = linkSerialize.p.target) === null || _linkSerialize$p$targ === void 0 ? void 0 : _linkSerialize$p$targ.__i);
143
146
  });
144
147
 
145
148
  if (targetNodeSerialize) {
@@ -195,10 +198,12 @@ function processExitLink(topoData) {
195
198
  // 根据链路序列化数据找目的端节点
196
199
  // eslint-disable-next-line no-underscore-dangle
197
200
  var targetNodeSerialize = serialize.d.find(function (item) {
198
- return item.i === linkSerialize.p.target.__i;
201
+ var _linkSerialize$p$targ2;
202
+
203
+ return item.i === (linkSerialize === null || linkSerialize === void 0 ? void 0 : (_linkSerialize$p$targ2 = linkSerialize.p.target) === null || _linkSerialize$p$targ2 === void 0 ? void 0 : _linkSerialize$p$targ2.__i);
199
204
  });
200
205
 
201
- if (!targetNodeSerialize.p.tag) {
206
+ if (targetNodeSerialize && !targetNodeSerialize.p.tag) {
202
207
  targetNodeSerialize.a = (0, _extends2["default"])({}, targetNodeSerialize.a, buildIpNode(destinationIp), {
203
208
  isbinding: true
204
209
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "9.0.0-a.30",
3
+ "version": "9.0.0-a.31",
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.0-a.30/build/index.html",
119
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@9.0.0-a.31/build/index.html",
120
120
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
121
121
  }