@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.
- package/build/1.js +1 -1
- package/build/index.css +1 -1
- package/build/index.js +11 -11
- package/es/common/components/ResourceTable/ResourceTable.module.scss +0 -4
- package/es/components/BatchAttrMetric/index.js +4 -6
- package/es/components/BatchAttrMetric/utils.js +20 -21
- package/es/components/BatchAttrMetric2/setting.js +2 -4
- package/es/components/BatchAttrMetric2/utils.js +5 -57
- package/es/components/Drawer/index.module.scss +0 -2
- package/es/components/ModelAttrSelectDrawer/components/MultipleTypeAttributeSelectDrawer.js +2 -2
- package/es/components/MultiResourceDrawer/ResourceSelect.js +2 -3
- package/es/components/ResourceList/ResourceSelect.module.scss +0 -4
- package/es/components/TagSelect/index.js +0 -1
- package/es/components/TagSelect/index.scss +0 -2
- package/es/components/VerticalIconTab/VerticalIconTab.js +2 -2
- package/es/core/components/AlarmListPanel/index.module.scss +0 -13
- package/es/core/components/DisplaySettingDrawer/DisplaySetting.js +2 -5
- package/es/core/editor/components/BottomFloatTool/HelpIcon.js +5 -3
- package/es/core/editor/components/BottomFloatTool/HelpIcon.module.scss +7 -0
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +1 -1
- package/es/core/hooks/useCanvasThemeConfig.js +8 -4
- package/es/core/hooks/useTopoEdit.js +161 -140
- package/es/core/models/Alarm.js +2 -3
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/topoData.js +1 -1
- package/es/core/models/utils/linkUtils.js +1 -1
- package/es/core/store/models/topoConfig.js +1 -1
- package/lib/common/components/ResourceTable/ResourceTable.module.scss +0 -4
- package/lib/components/BatchAttrMetric/index.js +4 -6
- package/lib/components/BatchAttrMetric/utils.js +18 -19
- package/lib/components/BatchAttrMetric2/setting.js +2 -4
- package/lib/components/BatchAttrMetric2/utils.js +5 -60
- package/lib/components/Drawer/index.module.scss +0 -2
- package/lib/components/ModelAttrSelectDrawer/components/MultipleTypeAttributeSelectDrawer.js +2 -2
- package/lib/components/MultiResourceDrawer/ResourceSelect.js +1 -2
- package/lib/components/ResourceList/ResourceSelect.module.scss +0 -4
- package/lib/components/TagSelect/index.js +0 -1
- package/lib/components/TagSelect/index.scss +0 -2
- package/lib/components/VerticalIconTab/VerticalIconTab.js +2 -2
- package/lib/core/components/AlarmListPanel/index.module.scss +0 -13
- package/lib/core/components/DisplaySettingDrawer/DisplaySetting.js +2 -5
- package/lib/core/editor/components/BottomFloatTool/HelpIcon.js +5 -3
- package/lib/core/editor/components/BottomFloatTool/HelpIcon.module.scss +7 -0
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +1 -1
- package/lib/core/hooks/useCanvasThemeConfig.js +8 -4
- package/lib/core/hooks/useTopoEdit.js +162 -139
- package/lib/core/models/Alarm.js +2 -3
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/topoData.js +1 -1
- package/lib/core/models/utils/linkUtils.js +1 -1
- package/lib/core/store/models/topoConfig.js +1 -1
- package/package.json +3 -6
- package/es/core/components/DisplaySettingDrawer/ResourceDisplay/useElementTagTipConfig.js +0 -127
- package/lib/core/components/DisplaySettingDrawer/ResourceDisplay/useElementTagTipConfig.js +0 -132
@@ -1,14 +1,15 @@
|
|
1
1
|
import _Message from "@alifd/next/es/message";
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
3
|
+
import _Button from "@alifd/next/es/button";
|
3
4
|
import _Dialog from "@alifd/next/es/dialog";
|
4
5
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
5
6
|
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; }
|
6
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
7
|
+
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
7
8
|
import _ from "lodash";
|
8
9
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
9
10
|
import { TopoEvent } from "@riil-frontend/component-topology-graph";
|
10
11
|
import { TPL_BLANK, TPL_TREE } from "../../utils/template";
|
11
|
-
import { getGroupElementByTag, isEdge, isExistedElement, isGroup, isLayer, isNode,
|
12
|
+
import { getGroupElementByTag, isEdge, isExistedElement, isGroup, isLayer, isNode, getGroupChildren } from "../../utils/htElementUtils";
|
12
13
|
import useResourceConfig from "./useResourceConfig";
|
13
14
|
import useGroupAddResource from "./useGroupAddResource";
|
14
15
|
import { findGroupChildren } from "../../utils/topoData";
|
@@ -175,6 +176,50 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
175
176
|
});
|
176
177
|
};
|
177
178
|
|
179
|
+
// const deleteGroupFooterBtn = () => {
|
180
|
+
// return (
|
181
|
+
// <div>
|
182
|
+
// <Button type="primary" onClick={doDeleteOnlyGroup()}>
|
183
|
+
// 仅删除区域
|
184
|
+
// </Button>
|
185
|
+
// <Button type="primary" onClick={doDeleteOnlyGroup()}>
|
186
|
+
// 确定
|
187
|
+
// </Button>
|
188
|
+
// </div>
|
189
|
+
// );
|
190
|
+
// };
|
191
|
+
|
192
|
+
// const [groupDeleteVisible, setGroupDeleteVisible] = useState(false);
|
193
|
+
// function doDeleteOnlyGroup(data,group) {
|
194
|
+
// topo.historyManager.beginTransaction();
|
195
|
+
// console.log("仅删除区域", topo.view.topoClient, data);
|
196
|
+
// const children = getGroupChildren(group);
|
197
|
+
// children.map((child) => {
|
198
|
+
// child.setParent(null);
|
199
|
+
// // var viewRect = topo.getGraphView().getViewRect();
|
200
|
+
// // var nodeRect = child.getRect();
|
201
|
+
// // child.setPosition(
|
202
|
+
// // viewRect.x + nodeRect.width + 2,
|
203
|
+
// // viewRect.y + nodeRect.height + 4
|
204
|
+
// // ); // 解决集群从区域内移出时,连线位置未更新的问题
|
205
|
+
|
206
|
+
// setTimeout(function () {
|
207
|
+
// child.iv();
|
208
|
+
// topo.historyManager.endTransaction();
|
209
|
+
// }, 50);
|
210
|
+
// });
|
211
|
+
// topo.view.topoClient.deleteGroup(data);
|
212
|
+
// topo.historyManager.endTransaction();
|
213
|
+
// setGroupDeleteVisible(false);
|
214
|
+
// // console.log("仅删除区域", children, group);
|
215
|
+
// }
|
216
|
+
// function doDelete(data) {
|
217
|
+
// topo.historyManager.beginTransaction();
|
218
|
+
|
219
|
+
// // FIXME 。如果命中其他的动态条件,则立即显示
|
220
|
+
// topo.view.topoClient.deleteGroup(data);
|
221
|
+
// setGroupDeleteVisible(false);
|
222
|
+
// }
|
178
223
|
/**
|
179
224
|
* 删除容器。
|
180
225
|
*
|
@@ -196,59 +241,33 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
196
241
|
}
|
197
242
|
|
198
243
|
// 有子节点时需要确认
|
199
|
-
_Dialog.
|
244
|
+
var gdialog = _Dialog.show({
|
200
245
|
title: "删除",
|
201
246
|
// content: "若执行相关操作,此区域包含的内容也会一同被删除,确定删除吗?",
|
202
247
|
content: "是否仅删除区域或将区域包含的内容一同删除?",
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
248
|
+
footer: [/*#__PURE__*/React.createElement(_Button, {
|
249
|
+
type: "normal",
|
250
|
+
onClick: doDeleteOnlyGroup,
|
251
|
+
style: {
|
252
|
+
marginRight: "15px"
|
253
|
+
}
|
254
|
+
}, "\u4EC5\u5220\u9664\u533A\u57DF"), /*#__PURE__*/React.createElement(_Button, {
|
255
|
+
type: "normal",
|
256
|
+
onClick: doDelete
|
257
|
+
}, "\u5168\u90E8\u5220\u9664")],
|
258
|
+
// okProps: {
|
259
|
+
// children: "仅删除区域",
|
260
|
+
// type: "normal",
|
261
|
+
// className: "next-btn-normal",
|
262
|
+
// },
|
263
|
+
// cancelProps: { children: "全部删除" },
|
211
264
|
messageProps: {
|
212
265
|
type: "warning"
|
213
|
-
}
|
214
|
-
onOk: function () {
|
215
|
-
var _onOk2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
216
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
217
|
-
while (1) switch (_context4.prev = _context4.next) {
|
218
|
-
case 0:
|
219
|
-
doDeleteOnlyGroup();
|
220
|
-
case 1:
|
221
|
-
case "end":
|
222
|
-
return _context4.stop();
|
223
|
-
}
|
224
|
-
}, _callee4);
|
225
|
-
}));
|
226
|
-
function onOk() {
|
227
|
-
return _onOk2.apply(this, arguments);
|
228
|
-
}
|
229
|
-
return onOk;
|
230
|
-
}(),
|
231
|
-
onCancel: function () {
|
232
|
-
var _onCancel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
233
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
234
|
-
while (1) switch (_context5.prev = _context5.next) {
|
235
|
-
case 0:
|
236
|
-
doDelete();
|
237
|
-
case 1:
|
238
|
-
case "end":
|
239
|
-
return _context5.stop();
|
240
|
-
}
|
241
|
-
}, _callee5);
|
242
|
-
}));
|
243
|
-
function onCancel() {
|
244
|
-
return _onCancel.apply(this, arguments);
|
245
|
-
}
|
246
|
-
return onCancel;
|
247
|
-
}()
|
266
|
+
}
|
248
267
|
});
|
249
268
|
function doDeleteOnlyGroup() {
|
250
269
|
topo.historyManager.beginTransaction();
|
251
|
-
|
270
|
+
console.log("仅删除区域", topo.view.topoClient, data);
|
252
271
|
var children = getGroupChildren(group);
|
253
272
|
children.map(function (child) {
|
254
273
|
child.setParent(null);
|
@@ -266,6 +285,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
266
285
|
});
|
267
286
|
topo.view.topoClient.deleteGroup(data);
|
268
287
|
topo.historyManager.endTransaction();
|
288
|
+
gdialog === null || gdialog === void 0 ? void 0 : gdialog.hide();
|
269
289
|
// console.log("仅删除区域", children, group);
|
270
290
|
}
|
271
291
|
|
@@ -274,6 +294,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
274
294
|
|
275
295
|
// FIXME 。如果命中其他的动态条件,则立即显示
|
276
296
|
topo.view.topoClient.deleteGroup(data);
|
297
|
+
gdialog === null || gdialog === void 0 ? void 0 : gdialog.hide();
|
277
298
|
}
|
278
299
|
};
|
279
300
|
var deleteNode = function deleteNode(node) {
|
@@ -299,16 +320,16 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
299
320
|
|
300
321
|
// 删除关联在节点上的出口链路
|
301
322
|
var deleteExLink = /*#__PURE__*/function () {
|
302
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
323
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(node) {
|
303
324
|
var _node$getEdges$toArra, _node$getEdges;
|
304
325
|
var config, edges, exportLinkIdList;
|
305
|
-
return _regeneratorRuntime().wrap(function
|
306
|
-
while (1) switch (
|
326
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
327
|
+
while (1) switch (_context4.prev = _context4.next) {
|
307
328
|
case 0:
|
308
329
|
config = resourceConfig.getConfig(); // console.log("删除关联在节点上的出口链路- node, config", node, config);
|
309
330
|
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 = [];
|
310
331
|
if (!(edges.length > 0)) {
|
311
|
-
|
332
|
+
_context4.next = 8;
|
312
333
|
break;
|
313
334
|
}
|
314
335
|
exportLinkIdList = [].concat(config.exportLinkIdList); //console.log("删除关联在节点上的出口链路- edges", edges,exportLinkIdList);
|
@@ -320,13 +341,13 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
320
341
|
}
|
321
342
|
});
|
322
343
|
config.exportLinkIdList = exportLinkIdList;
|
323
|
-
|
344
|
+
_context4.next = 8;
|
324
345
|
return resourceConfig.updateConfig(config);
|
325
346
|
case 8:
|
326
347
|
case "end":
|
327
|
-
return
|
348
|
+
return _context4.stop();
|
328
349
|
}
|
329
|
-
},
|
350
|
+
}, _callee4);
|
330
351
|
}));
|
331
352
|
return function deleteExLink(_x3) {
|
332
353
|
return _ref4.apply(this, arguments);
|
@@ -399,21 +420,21 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
399
420
|
return _bindGroupResources.apply(this, arguments);
|
400
421
|
}
|
401
422
|
function _bindGroupResources() {
|
402
|
-
_bindGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
423
|
+
_bindGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(group, resources) {
|
403
424
|
var id, tag, _yield$editDispatcher2, elements, nodeElements, newLinkElements, updateElements;
|
404
|
-
return _regeneratorRuntime().wrap(function
|
405
|
-
while (1) switch (
|
425
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
426
|
+
while (1) switch (_context10.prev = _context10.next) {
|
406
427
|
case 0:
|
407
428
|
id = group.id, tag = group.tag;
|
408
429
|
rlog.debug("bindGroupResources--id, tag", id, tag);
|
409
430
|
topo.historyManager.beginTransaction();
|
410
|
-
|
431
|
+
_context10.next = 5;
|
411
432
|
return resourceConfig.updateGroupResources(group, resources);
|
412
433
|
case 5:
|
413
|
-
|
434
|
+
_context10.next = 7;
|
414
435
|
return editDispatchers.fetchDataByConfig();
|
415
436
|
case 7:
|
416
|
-
_yield$editDispatcher2 =
|
437
|
+
_yield$editDispatcher2 = _context10.sent;
|
417
438
|
elements = _yield$editDispatcher2.elements;
|
418
439
|
// 区域里的子区域及子区域的节点、新增的链路
|
419
440
|
nodeElements = findGroupChildren(elements, group);
|
@@ -429,9 +450,9 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
429
450
|
topo.historyManager.endTransaction();
|
430
451
|
case 14:
|
431
452
|
case "end":
|
432
|
-
return
|
453
|
+
return _context10.stop();
|
433
454
|
}
|
434
|
-
},
|
455
|
+
}, _callee10);
|
435
456
|
}));
|
436
457
|
return _bindGroupResources.apply(this, arguments);
|
437
458
|
}
|
@@ -442,10 +463,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
442
463
|
* 关联视图的资源
|
443
464
|
*/
|
444
465
|
function _addGroupResources() {
|
445
|
-
_addGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
466
|
+
_addGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(group, newResourceIds) {
|
446
467
|
var groupConfig, resources, groupData;
|
447
|
-
return _regeneratorRuntime().wrap(function
|
448
|
-
while (1) switch (
|
468
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
469
|
+
while (1) switch (_context11.prev = _context11.next) {
|
449
470
|
case 0:
|
450
471
|
groupConfig = resourceConfig.getGroupConfigByElement(group);
|
451
472
|
resources = {
|
@@ -455,13 +476,13 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
455
476
|
id: group.getTag(),
|
456
477
|
tag: group.a("tag")
|
457
478
|
};
|
458
|
-
|
459
|
-
return bindGroupResources(groupData, resources
|
479
|
+
_context11.next = 5;
|
480
|
+
return bindGroupResources(groupData, resources);
|
460
481
|
case 5:
|
461
482
|
case "end":
|
462
|
-
return
|
483
|
+
return _context11.stop();
|
463
484
|
}
|
464
|
-
},
|
485
|
+
}, _callee11);
|
465
486
|
}));
|
466
487
|
return _addGroupResources.apply(this, arguments);
|
467
488
|
}
|
@@ -475,21 +496,21 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
475
496
|
* @return {Promise<void>}
|
476
497
|
*/
|
477
498
|
function _bindViewResources() {
|
478
|
-
_bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
499
|
+
_bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(data) {
|
479
500
|
var config, _yield$editDispatcher3, elements;
|
480
|
-
return _regeneratorRuntime().wrap(function
|
481
|
-
while (1) switch (
|
501
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
502
|
+
while (1) switch (_context12.prev = _context12.next) {
|
482
503
|
case 0:
|
483
504
|
// console.log("关联视图的资源", data);
|
484
505
|
config = resourceConfig.getConfig();
|
485
506
|
config.resources = data;
|
486
|
-
|
507
|
+
_context12.next = 4;
|
487
508
|
return resourceConfig.updateConfig(config);
|
488
509
|
case 4:
|
489
|
-
|
510
|
+
_context12.next = 6;
|
490
511
|
return editDispatchers.fetchDataByConfig();
|
491
512
|
case 6:
|
492
|
-
_yield$editDispatcher3 =
|
513
|
+
_yield$editDispatcher3 = _context12.sent;
|
493
514
|
elements = _yield$editDispatcher3.elements;
|
494
515
|
saveBind(TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements);
|
495
516
|
// 临时放这里,仅拓扑中心有
|
@@ -498,9 +519,9 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
498
519
|
}
|
499
520
|
case 10:
|
500
521
|
case "end":
|
501
|
-
return
|
522
|
+
return _context12.stop();
|
502
523
|
}
|
503
|
-
},
|
524
|
+
}, _callee12);
|
504
525
|
}));
|
505
526
|
return _bindViewResources.apply(this, arguments);
|
506
527
|
}
|
@@ -508,21 +529,21 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
508
529
|
return _addLayerResources.apply(this, arguments);
|
509
530
|
}
|
510
531
|
function _addLayerResources() {
|
511
|
-
_addLayerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
532
|
+
_addLayerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(group, newResourceIds) {
|
512
533
|
var _yield$editDispatcher4, elements, newElements;
|
513
|
-
return _regeneratorRuntime().wrap(function
|
514
|
-
while (1) switch (
|
534
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
535
|
+
while (1) switch (_context13.prev = _context13.next) {
|
515
536
|
case 0:
|
516
537
|
topo.historyManager.beginTransaction();
|
517
538
|
|
518
539
|
// 构造新的配置
|
519
|
-
|
540
|
+
_context13.next = 3;
|
520
541
|
return resourceConfig.addLayerStaticResources(group, newResourceIds);
|
521
542
|
case 3:
|
522
|
-
|
543
|
+
_context13.next = 5;
|
523
544
|
return editDispatchers.fetchDataByConfig();
|
524
545
|
case 5:
|
525
|
-
_yield$editDispatcher4 =
|
546
|
+
_yield$editDispatcher4 = _context13.sent;
|
526
547
|
elements = _yield$editDispatcher4.elements;
|
527
548
|
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
528
549
|
newElements = findUNExistedElements(elements);
|
@@ -544,9 +565,9 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
544
565
|
});
|
545
566
|
case 14:
|
546
567
|
case "end":
|
547
|
-
return
|
568
|
+
return _context13.stop();
|
548
569
|
}
|
549
|
-
},
|
570
|
+
}, _callee13);
|
550
571
|
}));
|
551
572
|
return _addLayerResources.apply(this, arguments);
|
552
573
|
}
|
@@ -554,19 +575,19 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
554
575
|
return _addResourceToFirstLayer.apply(this, arguments);
|
555
576
|
}
|
556
577
|
function _addResourceToFirstLayer() {
|
557
|
-
_addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
578
|
+
_addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(data) {
|
558
579
|
var group;
|
559
|
-
return _regeneratorRuntime().wrap(function
|
560
|
-
while (1) switch (
|
580
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
581
|
+
while (1) switch (_context14.prev = _context14.next) {
|
561
582
|
case 0:
|
562
583
|
group = resourceConfig.getGroups()[0];
|
563
|
-
|
584
|
+
_context14.next = 3;
|
564
585
|
return addLayerResources(group, data);
|
565
586
|
case 3:
|
566
587
|
case "end":
|
567
|
-
return
|
588
|
+
return _context14.stop();
|
568
589
|
}
|
569
|
-
},
|
590
|
+
}, _callee14);
|
570
591
|
}));
|
571
592
|
return _addResourceToFirstLayer.apply(this, arguments);
|
572
593
|
}
|
@@ -593,23 +614,23 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
593
614
|
* @param {*} data
|
594
615
|
*/
|
595
616
|
var onSaveComboRes = /*#__PURE__*/function () {
|
596
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
597
|
-
return _regeneratorRuntime().wrap(function
|
598
|
-
while (1) switch (
|
617
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(data) {
|
618
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
619
|
+
while (1) switch (_context5.prev = _context5.next) {
|
599
620
|
case 0:
|
600
621
|
rlog.debug("关联资源-----onSaveComboRes", data);
|
601
622
|
topo.historyManager.beginTransaction();
|
602
623
|
if (!(getAddResourceType() === "addToFirstLayer")) {
|
603
|
-
|
624
|
+
_context5.next = 7;
|
604
625
|
break;
|
605
626
|
}
|
606
|
-
|
627
|
+
_context5.next = 5;
|
607
628
|
return addResourceToFirstLayer(data);
|
608
629
|
case 5:
|
609
|
-
|
630
|
+
_context5.next = 9;
|
610
631
|
break;
|
611
632
|
case 7:
|
612
|
-
|
633
|
+
_context5.next = 9;
|
613
634
|
return bindViewResources(data);
|
614
635
|
case 9:
|
615
636
|
topo.historyManager.endTransaction();
|
@@ -619,30 +640,30 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
619
640
|
});
|
620
641
|
case 12:
|
621
642
|
case "end":
|
622
|
-
return
|
643
|
+
return _context5.stop();
|
623
644
|
}
|
624
|
-
},
|
645
|
+
}, _callee5);
|
625
646
|
}));
|
626
647
|
return function onSaveComboRes(_x12) {
|
627
648
|
return _ref5.apply(this, arguments);
|
628
649
|
};
|
629
650
|
}();
|
630
651
|
var onSaveTopo = /*#__PURE__*/function () {
|
631
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
652
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(data) {
|
632
653
|
var id, config, serialize, _config$layout, template, layout, saveConfig;
|
633
|
-
return _regeneratorRuntime().wrap(function
|
634
|
-
while (1) switch (
|
654
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
655
|
+
while (1) switch (_context7.prev = _context7.next) {
|
635
656
|
case 0:
|
636
657
|
id = data.id, config = data.config, serialize = data.serialize;
|
637
658
|
_config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
|
638
659
|
if (onSave) {
|
639
660
|
// 自定义保存
|
640
661
|
saveConfig = /*#__PURE__*/function () {
|
641
|
-
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
642
|
-
return _regeneratorRuntime().wrap(function
|
643
|
-
while (1) switch (
|
662
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
663
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
664
|
+
while (1) switch (_context6.prev = _context6.next) {
|
644
665
|
case 0:
|
645
|
-
|
666
|
+
_context6.next = 2;
|
646
667
|
return editDispatchers.saveTopo({
|
647
668
|
id: id,
|
648
669
|
layout: layout,
|
@@ -650,9 +671,9 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
650
671
|
});
|
651
672
|
case 2:
|
652
673
|
case "end":
|
653
|
-
return
|
674
|
+
return _context6.stop();
|
654
675
|
}
|
655
|
-
},
|
676
|
+
}, _callee6);
|
656
677
|
}));
|
657
678
|
return function saveConfig() {
|
658
679
|
return _ref7.apply(this, arguments);
|
@@ -666,9 +687,9 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
666
687
|
}
|
667
688
|
case 3:
|
668
689
|
case "end":
|
669
|
-
return
|
690
|
+
return _context7.stop();
|
670
691
|
}
|
671
|
-
},
|
692
|
+
}, _callee7);
|
672
693
|
}));
|
673
694
|
return function onSaveTopo(_x13) {
|
674
695
|
return _ref6.apply(this, arguments);
|
@@ -695,10 +716,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
695
716
|
* 重新关联到已有区域里的节点
|
696
717
|
*/
|
697
718
|
var bindNodeResource = /*#__PURE__*/function () {
|
698
|
-
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
719
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
|
699
720
|
var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
|
700
|
-
return _regeneratorRuntime().wrap(function
|
701
|
-
while (1) switch (
|
721
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
722
|
+
while (1) switch (_context9.prev = _context9.next) {
|
702
723
|
case 0:
|
703
724
|
replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
|
704
725
|
return _extends({}, resources, {
|
@@ -708,10 +729,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
708
729
|
});
|
709
730
|
};
|
710
731
|
_doBind = function _doBind3() {
|
711
|
-
_doBind = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
732
|
+
_doBind = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
712
733
|
var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
|
713
|
-
return _regeneratorRuntime().wrap(function
|
714
|
-
while (1) switch (
|
734
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
735
|
+
while (1) switch (_context8.prev = _context8.next) {
|
715
736
|
case 0:
|
716
737
|
dm = htTopo.getGraphView().dm(); // 创建
|
717
738
|
newLinkElements = findUNExistedLinkElements(elements);
|
@@ -778,7 +799,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
778
799
|
// node.a("customName", null);
|
779
800
|
|
780
801
|
// 删除关联在节点上的出口链路
|
781
|
-
|
802
|
+
_context8.next = 12;
|
782
803
|
return deleteExLink(node);
|
783
804
|
case 12:
|
784
805
|
// 临时放这里,仅拓扑中心有
|
@@ -787,9 +808,9 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
787
808
|
}
|
788
809
|
case 13:
|
789
810
|
case "end":
|
790
|
-
return
|
811
|
+
return _context8.stop();
|
791
812
|
}
|
792
|
-
},
|
813
|
+
}, _callee8);
|
793
814
|
}));
|
794
815
|
return _doBind.apply(this, arguments);
|
795
816
|
};
|
@@ -821,35 +842,35 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
821
842
|
// 在画布上
|
822
843
|
config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
|
823
844
|
}
|
824
|
-
|
845
|
+
_context9.next = 13;
|
825
846
|
return resourceConfig.updateConfig(config);
|
826
847
|
case 13:
|
827
|
-
|
848
|
+
_context9.next = 15;
|
828
849
|
return editDispatchers.fetchDataByConfig();
|
829
850
|
case 15:
|
830
|
-
_yield$editDispatcher =
|
851
|
+
_yield$editDispatcher = _context9.sent;
|
831
852
|
elements = _yield$editDispatcher.elements;
|
832
853
|
newData = elements.find(function (item) {
|
833
854
|
return item.id === newResId;
|
834
855
|
});
|
835
856
|
if (newData) {
|
836
|
-
|
857
|
+
_context9.next = 23;
|
837
858
|
break;
|
838
859
|
}
|
839
860
|
_Message.error("关联资源失败");
|
840
861
|
rlog.warn("关联资源失败");
|
841
862
|
topo.historyManager.endTransaction();
|
842
|
-
return
|
863
|
+
return _context9.abrupt("return", false);
|
843
864
|
case 23:
|
844
|
-
|
865
|
+
_context9.next = 25;
|
845
866
|
return doBind();
|
846
867
|
case 25:
|
847
868
|
topo.historyManager.endTransaction();
|
848
869
|
case 26:
|
849
870
|
case "end":
|
850
|
-
return
|
871
|
+
return _context9.stop();
|
851
872
|
}
|
852
|
-
},
|
873
|
+
}, _callee9);
|
853
874
|
}));
|
854
875
|
return function bindNodeResource(_x14) {
|
855
876
|
return _ref8.apply(this, arguments);
|
@@ -863,16 +884,16 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
863
884
|
return _relateNodeIp.apply(this, arguments);
|
864
885
|
}
|
865
886
|
function _relateNodeIp() {
|
866
|
-
_relateNodeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
887
|
+
_relateNodeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(txtValue, nodeElement) {
|
867
888
|
var dm, isUnique, ip, configObj, configData, _elements, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
868
|
-
return _regeneratorRuntime().wrap(function
|
869
|
-
while (1) switch (
|
889
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
890
|
+
while (1) switch (_context15.prev = _context15.next) {
|
870
891
|
case 0:
|
871
892
|
if (txtValue) {
|
872
|
-
|
893
|
+
_context15.next = 2;
|
873
894
|
break;
|
874
895
|
}
|
875
|
-
return
|
896
|
+
return _context15.abrupt("return");
|
876
897
|
case 2:
|
877
898
|
// if (txtValue === nodeElement.a('bindIp')) {
|
878
899
|
// return;
|
@@ -881,11 +902,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
881
902
|
dm = topo.getDataModel(); // 执行唯一性验证
|
882
903
|
isUnique = isUniqueIp(dm, txtValue, nodeElement); // 获取关联链路
|
883
904
|
if (!isUnique) {
|
884
|
-
|
905
|
+
_context15.next = 23;
|
885
906
|
break;
|
886
907
|
}
|
887
908
|
ip = buildIpNode(txtValue);
|
888
|
-
|
909
|
+
_context15.next = 8;
|
889
910
|
return deleteExLink(nodeElement);
|
890
911
|
case 8:
|
891
912
|
nodeElement.a(ip);
|
@@ -893,13 +914,13 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
893
914
|
nodeElement.setTag("ip:" + txtValue);
|
894
915
|
// 获取配置
|
895
916
|
configObj = topo.resourceConfig.getConfig();
|
896
|
-
|
917
|
+
_context15.next = 14;
|
897
918
|
return resourceConfig.updateConfig(configObj);
|
898
919
|
case 14:
|
899
|
-
|
920
|
+
_context15.next = 16;
|
900
921
|
return editDispatchers.fetchDataByConfig();
|
901
922
|
case 16:
|
902
|
-
configData =
|
923
|
+
configData = _context15.sent;
|
903
924
|
// console.log("configData",configObj, configData);
|
904
925
|
_elements = configData.elements;
|
905
926
|
newLinkElements = findUNExistedLinkElements(_elements); // console.log("configData", configData, newLinkElements);
|
@@ -922,9 +943,9 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
922
943
|
}
|
923
944
|
case 23:
|
924
945
|
case "end":
|
925
|
-
return
|
946
|
+
return _context15.stop();
|
926
947
|
}
|
927
|
-
},
|
948
|
+
}, _callee15);
|
928
949
|
}));
|
929
950
|
return _relateNodeIp.apply(this, arguments);
|
930
951
|
}
|