@riil-frontend/component-topology 11.0.25 → 11.0.27

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 (54) hide show
  1. package/build/1.js +1 -1
  2. package/build/index.css +1 -1
  3. package/build/index.js +11 -11
  4. package/es/common/components/ResourceTable/ResourceTable.module.scss +0 -4
  5. package/es/components/BatchAttrMetric/index.js +4 -6
  6. package/es/components/BatchAttrMetric/utils.js +20 -21
  7. package/es/components/BatchAttrMetric2/setting.js +2 -4
  8. package/es/components/BatchAttrMetric2/utils.js +5 -57
  9. package/es/components/Drawer/index.module.scss +0 -2
  10. package/es/components/ModelAttrSelectDrawer/components/MultipleTypeAttributeSelectDrawer.js +2 -2
  11. package/es/components/MultiResourceDrawer/ResourceSelect.js +2 -3
  12. package/es/components/ResourceList/ResourceSelect.module.scss +0 -4
  13. package/es/components/TagSelect/index.js +0 -1
  14. package/es/components/TagSelect/index.scss +0 -2
  15. package/es/components/VerticalIconTab/VerticalIconTab.js +2 -2
  16. package/es/core/components/AlarmListPanel/index.module.scss +0 -13
  17. package/es/core/components/DisplaySettingDrawer/DisplaySetting.js +2 -5
  18. package/es/core/editor/components/BottomFloatTool/HelpIcon.js +5 -3
  19. package/es/core/editor/components/BottomFloatTool/HelpIcon.module.scss +7 -0
  20. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +1 -1
  21. package/es/core/hooks/useCanvasThemeConfig.js +8 -4
  22. package/es/core/hooks/useTopoEdit.js +161 -140
  23. package/es/core/models/Alarm.js +2 -3
  24. package/es/core/models/TopoApp.js +1 -1
  25. package/es/core/models/topoData.js +1 -1
  26. package/es/core/models/utils/linkUtils.js +1 -1
  27. package/es/core/store/models/topoConfig.js +1 -1
  28. package/lib/common/components/ResourceTable/ResourceTable.module.scss +0 -4
  29. package/lib/components/BatchAttrMetric/index.js +4 -6
  30. package/lib/components/BatchAttrMetric/utils.js +18 -19
  31. package/lib/components/BatchAttrMetric2/setting.js +2 -4
  32. package/lib/components/BatchAttrMetric2/utils.js +5 -60
  33. package/lib/components/Drawer/index.module.scss +0 -2
  34. package/lib/components/ModelAttrSelectDrawer/components/MultipleTypeAttributeSelectDrawer.js +2 -2
  35. package/lib/components/MultiResourceDrawer/ResourceSelect.js +1 -2
  36. package/lib/components/ResourceList/ResourceSelect.module.scss +0 -4
  37. package/lib/components/TagSelect/index.js +0 -1
  38. package/lib/components/TagSelect/index.scss +0 -2
  39. package/lib/components/VerticalIconTab/VerticalIconTab.js +2 -2
  40. package/lib/core/components/AlarmListPanel/index.module.scss +0 -13
  41. package/lib/core/components/DisplaySettingDrawer/DisplaySetting.js +2 -5
  42. package/lib/core/editor/components/BottomFloatTool/HelpIcon.js +5 -3
  43. package/lib/core/editor/components/BottomFloatTool/HelpIcon.module.scss +7 -0
  44. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +1 -1
  45. package/lib/core/hooks/useCanvasThemeConfig.js +8 -4
  46. package/lib/core/hooks/useTopoEdit.js +162 -139
  47. package/lib/core/models/Alarm.js +2 -3
  48. package/lib/core/models/TopoApp.js +1 -1
  49. package/lib/core/models/topoData.js +1 -1
  50. package/lib/core/models/utils/linkUtils.js +1 -1
  51. package/lib/core/store/models/topoConfig.js +1 -1
  52. package/package.json +3 -6
  53. package/es/core/components/DisplaySettingDrawer/ResourceDisplay/useElementTagTipConfig.js +0 -127
  54. package/lib/core/components/DisplaySettingDrawer/ResourceDisplay/useElementTagTipConfig.js +0 -132
@@ -5,9 +5,10 @@ exports.__esModule = true;
5
5
  exports["default"] = void 0;
6
6
  var _message = _interopRequireDefault(require("@alifd/next/lib/message"));
7
7
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
+ var _button = _interopRequireDefault(require("@alifd/next/lib/button"));
8
9
  var _dialog = _interopRequireDefault(require("@alifd/next/lib/dialog"));
9
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
- var _react = require("react");
11
+ var _react = _interopRequireWildcard(require("react"));
11
12
  var _lodash = _interopRequireDefault(require("lodash"));
12
13
  var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
13
14
  var _componentTopologyGraph = require("@riil-frontend/component-topology-graph");
@@ -20,6 +21,8 @@ var _htElementDataUtil = require("../../utils/htElementDataUtil");
20
21
  var _clusterUtil = require("../../utils/clusterUtil");
21
22
  var _linkUtils = require("../models/utils/linkUtils");
22
23
  var _exitLinkUtil = require("../../networkTopo/utils/exitLinkUtil");
24
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
26
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(typeof e + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
24
27
  var useTopoEdit = function useTopoEdit(params) {
25
28
  var topo = params.topo,
@@ -180,6 +183,50 @@ var useTopoEdit = function useTopoEdit(params) {
180
183
  });
181
184
  };
182
185
 
186
+ // const deleteGroupFooterBtn = () => {
187
+ // return (
188
+ // <div>
189
+ // <Button type="primary" onClick={doDeleteOnlyGroup()}>
190
+ // 仅删除区域
191
+ // </Button>
192
+ // <Button type="primary" onClick={doDeleteOnlyGroup()}>
193
+ // 确定
194
+ // </Button>
195
+ // </div>
196
+ // );
197
+ // };
198
+
199
+ // const [groupDeleteVisible, setGroupDeleteVisible] = useState(false);
200
+ // function doDeleteOnlyGroup(data,group) {
201
+ // topo.historyManager.beginTransaction();
202
+ // console.log("仅删除区域", topo.view.topoClient, data);
203
+ // const children = getGroupChildren(group);
204
+ // children.map((child) => {
205
+ // child.setParent(null);
206
+ // // var viewRect = topo.getGraphView().getViewRect();
207
+ // // var nodeRect = child.getRect();
208
+ // // child.setPosition(
209
+ // // viewRect.x + nodeRect.width + 2,
210
+ // // viewRect.y + nodeRect.height + 4
211
+ // // ); // 解决集群从区域内移出时,连线位置未更新的问题
212
+
213
+ // setTimeout(function () {
214
+ // child.iv();
215
+ // topo.historyManager.endTransaction();
216
+ // }, 50);
217
+ // });
218
+ // topo.view.topoClient.deleteGroup(data);
219
+ // topo.historyManager.endTransaction();
220
+ // setGroupDeleteVisible(false);
221
+ // // console.log("仅删除区域", children, group);
222
+ // }
223
+ // function doDelete(data) {
224
+ // topo.historyManager.beginTransaction();
225
+
226
+ // // FIXME 。如果命中其他的动态条件,则立即显示
227
+ // topo.view.topoClient.deleteGroup(data);
228
+ // setGroupDeleteVisible(false);
229
+ // }
183
230
  /**
184
231
  * 删除容器。
185
232
  *
@@ -201,59 +248,33 @@ var useTopoEdit = function useTopoEdit(params) {
201
248
  }
202
249
 
203
250
  // 有子节点时需要确认
204
- _dialog["default"].confirm({
251
+ var gdialog = _dialog["default"].show({
205
252
  title: "删除",
206
253
  // content: "若执行相关操作,此区域包含的内容也会一同被删除,确定删除吗?",
207
254
  content: "是否仅删除区域或将区域包含的内容一同删除?",
208
- //footer:()=>{return <><Button type="primary" onClick={doDeleteOnlyGroup}>仅删除区域</Button><Button type="primary" onClick={doDeleteOnlyGroup}>确定</Button></>},
209
- okProps: {
210
- children: "仅删除区域",
211
- type: "normal"
212
- },
213
- cancelProps: {
214
- children: "全部删除"
215
- },
255
+ footer: [/*#__PURE__*/_react["default"].createElement(_button["default"], {
256
+ type: "normal",
257
+ onClick: doDeleteOnlyGroup,
258
+ style: {
259
+ marginRight: "15px"
260
+ }
261
+ }, "\u4EC5\u5220\u9664\u533A\u57DF"), /*#__PURE__*/_react["default"].createElement(_button["default"], {
262
+ type: "normal",
263
+ onClick: doDelete
264
+ }, "\u5168\u90E8\u5220\u9664")],
265
+ // okProps: {
266
+ // children: "仅删除区域",
267
+ // type: "normal",
268
+ // className: "next-btn-normal",
269
+ // },
270
+ // cancelProps: { children: "全部删除" },
216
271
  messageProps: {
217
272
  type: "warning"
218
- },
219
- onOk: function () {
220
- var _onOk2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
221
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
222
- while (1) switch (_context4.prev = _context4.next) {
223
- case 0:
224
- doDeleteOnlyGroup();
225
- case 1:
226
- case "end":
227
- return _context4.stop();
228
- }
229
- }, _callee4);
230
- }));
231
- function onOk() {
232
- return _onOk2.apply(this, arguments);
233
- }
234
- return onOk;
235
- }(),
236
- onCancel: function () {
237
- var _onCancel = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
238
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
239
- while (1) switch (_context5.prev = _context5.next) {
240
- case 0:
241
- doDelete();
242
- case 1:
243
- case "end":
244
- return _context5.stop();
245
- }
246
- }, _callee5);
247
- }));
248
- function onCancel() {
249
- return _onCancel.apply(this, arguments);
250
- }
251
- return onCancel;
252
- }()
273
+ }
253
274
  });
254
275
  function doDeleteOnlyGroup() {
255
276
  topo.historyManager.beginTransaction();
256
- // console.log("仅删除区域", topo.view.topoClient, data);
277
+ console.log("仅删除区域", topo.view.topoClient, data);
257
278
  var children = (0, _htElementUtils.getGroupChildren)(group);
258
279
  children.map(function (child) {
259
280
  child.setParent(null);
@@ -271,6 +292,7 @@ var useTopoEdit = function useTopoEdit(params) {
271
292
  });
272
293
  topo.view.topoClient.deleteGroup(data);
273
294
  topo.historyManager.endTransaction();
295
+ gdialog === null || gdialog === void 0 ? void 0 : gdialog.hide();
274
296
  // console.log("仅删除区域", children, group);
275
297
  }
276
298
 
@@ -279,6 +301,7 @@ var useTopoEdit = function useTopoEdit(params) {
279
301
 
280
302
  // FIXME 。如果命中其他的动态条件,则立即显示
281
303
  topo.view.topoClient.deleteGroup(data);
304
+ gdialog === null || gdialog === void 0 ? void 0 : gdialog.hide();
282
305
  }
283
306
  };
284
307
  var deleteNode = function deleteNode(node) {
@@ -304,16 +327,16 @@ var useTopoEdit = function useTopoEdit(params) {
304
327
 
305
328
  // 删除关联在节点上的出口链路
306
329
  var deleteExLink = /*#__PURE__*/function () {
307
- var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(node) {
330
+ var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(node) {
308
331
  var _node$getEdges$toArra, _node$getEdges;
309
332
  var config, edges, exportLinkIdList;
310
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
311
- while (1) switch (_context6.prev = _context6.next) {
333
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
334
+ while (1) switch (_context4.prev = _context4.next) {
312
335
  case 0:
313
336
  config = resourceConfig.getConfig(); // console.log("删除关联在节点上的出口链路- node, config", node, config);
314
337
  edges = (_node$getEdges$toArra = (_node$getEdges = node.getEdges()) === null || _node$getEdges === void 0 ? void 0 : _node$getEdges.toArray()) !== null && _node$getEdges$toArra !== void 0 ? _node$getEdges$toArra : []; // const exLink = [];
315
338
  if (!(edges.length > 0)) {
316
- _context6.next = 8;
339
+ _context4.next = 8;
317
340
  break;
318
341
  }
319
342
  exportLinkIdList = [].concat(config.exportLinkIdList); //console.log("删除关联在节点上的出口链路- edges", edges,exportLinkIdList);
@@ -325,13 +348,13 @@ var useTopoEdit = function useTopoEdit(params) {
325
348
  }
326
349
  });
327
350
  config.exportLinkIdList = exportLinkIdList;
328
- _context6.next = 8;
351
+ _context4.next = 8;
329
352
  return resourceConfig.updateConfig(config);
330
353
  case 8:
331
354
  case "end":
332
- return _context6.stop();
355
+ return _context4.stop();
333
356
  }
334
- }, _callee6);
357
+ }, _callee4);
335
358
  }));
336
359
  return function deleteExLink(_x3) {
337
360
  return _ref4.apply(this, arguments);
@@ -404,21 +427,21 @@ var useTopoEdit = function useTopoEdit(params) {
404
427
  return _bindGroupResources.apply(this, arguments);
405
428
  }
406
429
  function _bindGroupResources() {
407
- _bindGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(group, resources) {
430
+ _bindGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(group, resources) {
408
431
  var id, tag, _yield$editDispatcher2, elements, nodeElements, newLinkElements, updateElements;
409
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
410
- while (1) switch (_context12.prev = _context12.next) {
432
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
433
+ while (1) switch (_context10.prev = _context10.next) {
411
434
  case 0:
412
435
  id = group.id, tag = group.tag;
413
436
  _rlog["default"].debug("bindGroupResources--id, tag", id, tag);
414
437
  topo.historyManager.beginTransaction();
415
- _context12.next = 5;
438
+ _context10.next = 5;
416
439
  return resourceConfig.updateGroupResources(group, resources);
417
440
  case 5:
418
- _context12.next = 7;
441
+ _context10.next = 7;
419
442
  return editDispatchers.fetchDataByConfig();
420
443
  case 7:
421
- _yield$editDispatcher2 = _context12.sent;
444
+ _yield$editDispatcher2 = _context10.sent;
422
445
  elements = _yield$editDispatcher2.elements;
423
446
  // 区域里的子区域及子区域的节点、新增的链路
424
447
  nodeElements = (0, _topoData.findGroupChildren)(elements, group);
@@ -434,9 +457,9 @@ var useTopoEdit = function useTopoEdit(params) {
434
457
  topo.historyManager.endTransaction();
435
458
  case 14:
436
459
  case "end":
437
- return _context12.stop();
460
+ return _context10.stop();
438
461
  }
439
- }, _callee12);
462
+ }, _callee10);
440
463
  }));
441
464
  return _bindGroupResources.apply(this, arguments);
442
465
  }
@@ -447,10 +470,10 @@ var useTopoEdit = function useTopoEdit(params) {
447
470
  * 关联视图的资源
448
471
  */
449
472
  function _addGroupResources() {
450
- _addGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(group, newResourceIds) {
473
+ _addGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(group, newResourceIds) {
451
474
  var groupConfig, resources, groupData;
452
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
453
- while (1) switch (_context13.prev = _context13.next) {
475
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
476
+ while (1) switch (_context11.prev = _context11.next) {
454
477
  case 0:
455
478
  groupConfig = resourceConfig.getGroupConfigByElement(group);
456
479
  resources = {
@@ -460,13 +483,13 @@ var useTopoEdit = function useTopoEdit(params) {
460
483
  id: group.getTag(),
461
484
  tag: group.a("tag")
462
485
  };
463
- _context13.next = 5;
464
- return bindGroupResources(groupData, resources, newResourceIds);
486
+ _context11.next = 5;
487
+ return bindGroupResources(groupData, resources);
465
488
  case 5:
466
489
  case "end":
467
- return _context13.stop();
490
+ return _context11.stop();
468
491
  }
469
- }, _callee13);
492
+ }, _callee11);
470
493
  }));
471
494
  return _addGroupResources.apply(this, arguments);
472
495
  }
@@ -480,21 +503,21 @@ var useTopoEdit = function useTopoEdit(params) {
480
503
  * @return {Promise<void>}
481
504
  */
482
505
  function _bindViewResources() {
483
- _bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(data) {
506
+ _bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(data) {
484
507
  var config, _yield$editDispatcher3, elements;
485
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
486
- while (1) switch (_context14.prev = _context14.next) {
508
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
509
+ while (1) switch (_context12.prev = _context12.next) {
487
510
  case 0:
488
511
  // console.log("关联视图的资源", data);
489
512
  config = resourceConfig.getConfig();
490
513
  config.resources = data;
491
- _context14.next = 4;
514
+ _context12.next = 4;
492
515
  return resourceConfig.updateConfig(config);
493
516
  case 4:
494
- _context14.next = 6;
517
+ _context12.next = 6;
495
518
  return editDispatchers.fetchDataByConfig();
496
519
  case 6:
497
- _yield$editDispatcher3 = _context14.sent;
520
+ _yield$editDispatcher3 = _context12.sent;
498
521
  elements = _yield$editDispatcher3.elements;
499
522
  saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements);
500
523
  // 临时放这里,仅拓扑中心有
@@ -503,9 +526,9 @@ var useTopoEdit = function useTopoEdit(params) {
503
526
  }
504
527
  case 10:
505
528
  case "end":
506
- return _context14.stop();
529
+ return _context12.stop();
507
530
  }
508
- }, _callee14);
531
+ }, _callee12);
509
532
  }));
510
533
  return _bindViewResources.apply(this, arguments);
511
534
  }
@@ -513,21 +536,21 @@ var useTopoEdit = function useTopoEdit(params) {
513
536
  return _addLayerResources.apply(this, arguments);
514
537
  }
515
538
  function _addLayerResources() {
516
- _addLayerResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(group, newResourceIds) {
539
+ _addLayerResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(group, newResourceIds) {
517
540
  var _yield$editDispatcher4, elements, newElements;
518
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
519
- while (1) switch (_context15.prev = _context15.next) {
541
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
542
+ while (1) switch (_context13.prev = _context13.next) {
520
543
  case 0:
521
544
  topo.historyManager.beginTransaction();
522
545
 
523
546
  // 构造新的配置
524
- _context15.next = 3;
547
+ _context13.next = 3;
525
548
  return resourceConfig.addLayerStaticResources(group, newResourceIds);
526
549
  case 3:
527
- _context15.next = 5;
550
+ _context13.next = 5;
528
551
  return editDispatchers.fetchDataByConfig();
529
552
  case 5:
530
- _yield$editDispatcher4 = _context15.sent;
553
+ _yield$editDispatcher4 = _context13.sent;
531
554
  elements = _yield$editDispatcher4.elements;
532
555
  // 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
533
556
  newElements = findUNExistedElements(elements);
@@ -549,9 +572,9 @@ var useTopoEdit = function useTopoEdit(params) {
549
572
  });
550
573
  case 14:
551
574
  case "end":
552
- return _context15.stop();
575
+ return _context13.stop();
553
576
  }
554
- }, _callee15);
577
+ }, _callee13);
555
578
  }));
556
579
  return _addLayerResources.apply(this, arguments);
557
580
  }
@@ -559,19 +582,19 @@ var useTopoEdit = function useTopoEdit(params) {
559
582
  return _addResourceToFirstLayer.apply(this, arguments);
560
583
  }
561
584
  function _addResourceToFirstLayer() {
562
- _addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(data) {
585
+ _addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(data) {
563
586
  var group;
564
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
565
- while (1) switch (_context16.prev = _context16.next) {
587
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
588
+ while (1) switch (_context14.prev = _context14.next) {
566
589
  case 0:
567
590
  group = resourceConfig.getGroups()[0];
568
- _context16.next = 3;
591
+ _context14.next = 3;
569
592
  return addLayerResources(group, data);
570
593
  case 3:
571
594
  case "end":
572
- return _context16.stop();
595
+ return _context14.stop();
573
596
  }
574
- }, _callee16);
597
+ }, _callee14);
575
598
  }));
576
599
  return _addResourceToFirstLayer.apply(this, arguments);
577
600
  }
@@ -598,23 +621,23 @@ var useTopoEdit = function useTopoEdit(params) {
598
621
  * @param {*} data
599
622
  */
600
623
  var onSaveComboRes = /*#__PURE__*/function () {
601
- var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(data) {
602
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
603
- while (1) switch (_context7.prev = _context7.next) {
624
+ var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(data) {
625
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
626
+ while (1) switch (_context5.prev = _context5.next) {
604
627
  case 0:
605
628
  _rlog["default"].debug("关联资源-----onSaveComboRes", data);
606
629
  topo.historyManager.beginTransaction();
607
630
  if (!(getAddResourceType() === "addToFirstLayer")) {
608
- _context7.next = 7;
631
+ _context5.next = 7;
609
632
  break;
610
633
  }
611
- _context7.next = 5;
634
+ _context5.next = 5;
612
635
  return addResourceToFirstLayer(data);
613
636
  case 5:
614
- _context7.next = 9;
637
+ _context5.next = 9;
615
638
  break;
616
639
  case 7:
617
- _context7.next = 9;
640
+ _context5.next = 9;
618
641
  return bindViewResources(data);
619
642
  case 9:
620
643
  topo.historyManager.endTransaction();
@@ -624,30 +647,30 @@ var useTopoEdit = function useTopoEdit(params) {
624
647
  });
625
648
  case 12:
626
649
  case "end":
627
- return _context7.stop();
650
+ return _context5.stop();
628
651
  }
629
- }, _callee7);
652
+ }, _callee5);
630
653
  }));
631
654
  return function onSaveComboRes(_x12) {
632
655
  return _ref5.apply(this, arguments);
633
656
  };
634
657
  }();
635
658
  var onSaveTopo = /*#__PURE__*/function () {
636
- var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(data) {
659
+ var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(data) {
637
660
  var id, config, serialize, _config$layout, template, layout, saveConfig;
638
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
639
- while (1) switch (_context9.prev = _context9.next) {
661
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
662
+ while (1) switch (_context7.prev = _context7.next) {
640
663
  case 0:
641
664
  id = data.id, config = data.config, serialize = data.serialize;
642
665
  _config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
643
666
  if (onSave) {
644
667
  // 自定义保存
645
668
  saveConfig = /*#__PURE__*/function () {
646
- var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
647
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
648
- while (1) switch (_context8.prev = _context8.next) {
669
+ var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
670
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
671
+ while (1) switch (_context6.prev = _context6.next) {
649
672
  case 0:
650
- _context8.next = 2;
673
+ _context6.next = 2;
651
674
  return editDispatchers.saveTopo({
652
675
  id: id,
653
676
  layout: layout,
@@ -655,9 +678,9 @@ var useTopoEdit = function useTopoEdit(params) {
655
678
  });
656
679
  case 2:
657
680
  case "end":
658
- return _context8.stop();
681
+ return _context6.stop();
659
682
  }
660
- }, _callee8);
683
+ }, _callee6);
661
684
  }));
662
685
  return function saveConfig() {
663
686
  return _ref7.apply(this, arguments);
@@ -671,9 +694,9 @@ var useTopoEdit = function useTopoEdit(params) {
671
694
  }
672
695
  case 3:
673
696
  case "end":
674
- return _context9.stop();
697
+ return _context7.stop();
675
698
  }
676
- }, _callee9);
699
+ }, _callee7);
677
700
  }));
678
701
  return function onSaveTopo(_x13) {
679
702
  return _ref6.apply(this, arguments);
@@ -700,10 +723,10 @@ var useTopoEdit = function useTopoEdit(params) {
700
723
  * 重新关联到已有区域里的节点
701
724
  */
702
725
  var bindNodeResource = /*#__PURE__*/function () {
703
- var _ref8 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
726
+ var _ref8 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
704
727
  var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
705
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
706
- while (1) switch (_context11.prev = _context11.next) {
728
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
729
+ while (1) switch (_context9.prev = _context9.next) {
707
730
  case 0:
708
731
  replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
709
732
  return (0, _extends2["default"])({}, resources, {
@@ -713,10 +736,10 @@ var useTopoEdit = function useTopoEdit(params) {
713
736
  });
714
737
  };
715
738
  _doBind = function _doBind3() {
716
- _doBind = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
739
+ _doBind = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
717
740
  var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
718
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
719
- while (1) switch (_context10.prev = _context10.next) {
741
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
742
+ while (1) switch (_context8.prev = _context8.next) {
720
743
  case 0:
721
744
  dm = htTopo.getGraphView().dm(); // 创建
722
745
  newLinkElements = findUNExistedLinkElements(elements);
@@ -783,7 +806,7 @@ var useTopoEdit = function useTopoEdit(params) {
783
806
  // node.a("customName", null);
784
807
 
785
808
  // 删除关联在节点上的出口链路
786
- _context10.next = 12;
809
+ _context8.next = 12;
787
810
  return deleteExLink(node);
788
811
  case 12:
789
812
  // 临时放这里,仅拓扑中心有
@@ -792,9 +815,9 @@ var useTopoEdit = function useTopoEdit(params) {
792
815
  }
793
816
  case 13:
794
817
  case "end":
795
- return _context10.stop();
818
+ return _context8.stop();
796
819
  }
797
- }, _callee10);
820
+ }, _callee8);
798
821
  }));
799
822
  return _doBind.apply(this, arguments);
800
823
  };
@@ -826,35 +849,35 @@ var useTopoEdit = function useTopoEdit(params) {
826
849
  // 在画布上
827
850
  config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
828
851
  }
829
- _context11.next = 13;
852
+ _context9.next = 13;
830
853
  return resourceConfig.updateConfig(config);
831
854
  case 13:
832
- _context11.next = 15;
855
+ _context9.next = 15;
833
856
  return editDispatchers.fetchDataByConfig();
834
857
  case 15:
835
- _yield$editDispatcher = _context11.sent;
858
+ _yield$editDispatcher = _context9.sent;
836
859
  elements = _yield$editDispatcher.elements;
837
860
  newData = elements.find(function (item) {
838
861
  return item.id === newResId;
839
862
  });
840
863
  if (newData) {
841
- _context11.next = 23;
864
+ _context9.next = 23;
842
865
  break;
843
866
  }
844
867
  _message["default"].error("关联资源失败");
845
868
  _rlog["default"].warn("关联资源失败");
846
869
  topo.historyManager.endTransaction();
847
- return _context11.abrupt("return", false);
870
+ return _context9.abrupt("return", false);
848
871
  case 23:
849
- _context11.next = 25;
872
+ _context9.next = 25;
850
873
  return doBind();
851
874
  case 25:
852
875
  topo.historyManager.endTransaction();
853
876
  case 26:
854
877
  case "end":
855
- return _context11.stop();
878
+ return _context9.stop();
856
879
  }
857
- }, _callee11);
880
+ }, _callee9);
858
881
  }));
859
882
  return function bindNodeResource(_x14) {
860
883
  return _ref8.apply(this, arguments);
@@ -868,16 +891,16 @@ var useTopoEdit = function useTopoEdit(params) {
868
891
  return _relateNodeIp.apply(this, arguments);
869
892
  }
870
893
  function _relateNodeIp() {
871
- _relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(txtValue, nodeElement) {
894
+ _relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(txtValue, nodeElement) {
872
895
  var dm, isUnique, ip, configObj, configData, _elements, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
873
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
874
- while (1) switch (_context17.prev = _context17.next) {
896
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
897
+ while (1) switch (_context15.prev = _context15.next) {
875
898
  case 0:
876
899
  if (txtValue) {
877
- _context17.next = 2;
900
+ _context15.next = 2;
878
901
  break;
879
902
  }
880
- return _context17.abrupt("return");
903
+ return _context15.abrupt("return");
881
904
  case 2:
882
905
  // if (txtValue === nodeElement.a('bindIp')) {
883
906
  // return;
@@ -886,11 +909,11 @@ var useTopoEdit = function useTopoEdit(params) {
886
909
  dm = topo.getDataModel(); // 执行唯一性验证
887
910
  isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
888
911
  if (!isUnique) {
889
- _context17.next = 23;
912
+ _context15.next = 23;
890
913
  break;
891
914
  }
892
915
  ip = (0, _exitLinkUtil.buildIpNode)(txtValue);
893
- _context17.next = 8;
916
+ _context15.next = 8;
894
917
  return deleteExLink(nodeElement);
895
918
  case 8:
896
919
  nodeElement.a(ip);
@@ -898,13 +921,13 @@ var useTopoEdit = function useTopoEdit(params) {
898
921
  nodeElement.setTag("ip:" + txtValue);
899
922
  // 获取配置
900
923
  configObj = topo.resourceConfig.getConfig();
901
- _context17.next = 14;
924
+ _context15.next = 14;
902
925
  return resourceConfig.updateConfig(configObj);
903
926
  case 14:
904
- _context17.next = 16;
927
+ _context15.next = 16;
905
928
  return editDispatchers.fetchDataByConfig();
906
929
  case 16:
907
- configData = _context17.sent;
930
+ configData = _context15.sent;
908
931
  // console.log("configData",configObj, configData);
909
932
  _elements = configData.elements;
910
933
  newLinkElements = findUNExistedLinkElements(_elements); // console.log("configData", configData, newLinkElements);
@@ -927,9 +950,9 @@ var useTopoEdit = function useTopoEdit(params) {
927
950
  }
928
951
  case 23:
929
952
  case "end":
930
- return _context17.stop();
953
+ return _context15.stop();
931
954
  }
932
- }, _callee17);
955
+ }, _callee15);
933
956
  }));
934
957
  return _relateNodeIp.apply(this, arguments);
935
958
  }