@riil-frontend/component-topology 13.0.0-dev.1 → 13.0.0-dev.11
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 +29 -29
- package/es/components/ColorPanel/index.js +68 -58
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -1
- package/es/core/components/TopoView/topoView.js +7 -4
- package/es/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +2 -2
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +5 -15
- package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +10 -91
- package/es/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +2 -27
- package/es/core/editor/components/Toolbar/widgets/FontSizeWidget.js +3 -28
- package/es/core/editor/components/Toolbar/widgets/FontStyleButton.js +6 -52
- package/es/core/editor/components/Toolbar/widgets/components/FontColorDropdown.js +120 -0
- package/es/core/editor/components/Toolbar/widgets/components/FontFamilySelect.js +29 -0
- package/es/core/editor/components/Toolbar/widgets/components/FontSizeSelect.js +29 -0
- package/es/core/editor/components/Toolbar/widgets/components/FontStyleSelect.js +77 -0
- package/es/core/editor/components/settings/core/updateElementProperty.js +3 -2
- package/es/core/editor/components/settings/propertyViews/view/GlobalEdgeToggle.js +2 -2
- package/es/core/editor/hooks/useKeyboardShortcut.js +4 -0
- package/es/core/editor/hooks/useNewElementTheme.js +20 -16
- package/es/core/editor/utils/edgeTypeStyleUtil.js +11 -32
- package/es/core/hooks/useGraphAlarmDisplay.js +4 -0
- package/es/core/hooks/usePolling.js +2 -1
- package/es/core/hooks/useResourceConfig.js +1 -2
- package/es/core/hooks/useTopoEdit.js +210 -248
- package/es/core/models/AttributeMetricDisplay.js +4 -3
- package/es/core/models/HistoryManager.js +11 -9
- package/es/core/models/TopoApp.js +39 -45
- package/es/core/models/topoData.js +9 -17
- package/es/core/models/utils/linkUtils.js +65 -52
- package/es/core/store/models/topoConfig.js +7 -11
- package/es/core/utils/edgeUtil.js +7 -10
- package/es/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js +2 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +4 -2
- package/es/networkTopo/models/EdgeGroupTagTipBuilder.js +7 -7
- package/es/networkTopo/models/LinkDynamicStyleExecutor.js +7 -63
- package/es/networkTopo/services/topo/basic.js +27 -17
- package/es/networkTopo/utils/__tests__/relateTopoData.js +205 -0
- package/es/networkTopo/utils/edgeGroupTagUtil.js +2 -2
- package/es/networkTopo/utils/exitLinkUtil.js +25 -13
- package/es/networkTopo/utils/relateTopoDataUtil.js +149 -0
- package/es/style.js +1 -1
- package/es/utils/ResourceConfigUtil.js +1 -16
- package/es/utils/clusterUtil.js +3 -3
- package/es/utils/htElementUtils.js +19 -85
- package/lib/components/ColorPanel/index.js +71 -59
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -1
- package/lib/core/components/TopoView/topoView.js +15 -19
- package/lib/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +2 -2
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +5 -14
- package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +11 -95
- package/lib/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +3 -28
- package/lib/core/editor/components/Toolbar/widgets/FontSizeWidget.js +3 -28
- package/lib/core/editor/components/Toolbar/widgets/FontStyleButton.js +6 -56
- package/lib/core/editor/components/Toolbar/widgets/components/FontColorDropdown.js +136 -0
- package/lib/core/editor/components/Toolbar/widgets/components/FontFamilySelect.js +38 -0
- package/lib/core/editor/components/Toolbar/widgets/components/FontSizeSelect.js +38 -0
- package/lib/core/editor/components/Toolbar/widgets/components/FontStyleSelect.js +89 -0
- package/lib/core/editor/components/settings/core/updateElementProperty.js +7 -2
- package/lib/core/editor/components/settings/propertyViews/view/GlobalEdgeToggle.js +2 -2
- package/lib/core/editor/hooks/useKeyboardShortcut.js +4 -0
- package/lib/core/editor/hooks/useNewElementTheme.js +20 -16
- package/lib/core/editor/utils/edgeTypeStyleUtil.js +10 -33
- package/lib/core/hooks/useGraphAlarmDisplay.js +4 -0
- package/lib/core/hooks/usePolling.js +6 -5
- package/lib/core/hooks/useResourceConfig.js +1 -2
- package/lib/core/hooks/useTopoEdit.js +216 -272
- package/lib/core/models/AttributeMetricDisplay.js +6 -6
- package/lib/core/models/HistoryManager.js +13 -17
- package/lib/core/models/TopoApp.js +39 -43
- package/lib/core/models/topoData.js +9 -17
- package/lib/core/models/utils/linkUtils.js +65 -51
- package/lib/core/store/models/topoConfig.js +13 -25
- package/lib/core/utils/edgeUtil.js +8 -10
- package/lib/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js +3 -2
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +6 -2
- package/lib/networkTopo/models/EdgeGroupTagTipBuilder.js +6 -6
- package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +6 -64
- package/lib/networkTopo/services/topo/basic.js +32 -18
- package/lib/networkTopo/utils/__tests__/relateTopoData.js +210 -0
- package/lib/networkTopo/utils/edgeGroupTagUtil.js +2 -2
- package/lib/networkTopo/utils/exitLinkUtil.js +25 -13
- package/lib/networkTopo/utils/relateTopoDataUtil.js +164 -0
- package/lib/style.js +1 -1
- package/lib/utils/ResourceConfigUtil.js +1 -16
- package/lib/utils/clusterUtil.js +2 -2
- package/lib/utils/htElementUtils.js +22 -94
- package/package.json +2 -2
- package/es/networkTopo/models/LinkTagsTipsBuilder.js +0 -235
- package/lib/networkTopo/models/LinkTagsTipsBuilder.js +0 -245
- /package/es/core/editor/components/Toolbar/widgets/{FontColorButton.module.scss → components/FontColorDropdown.module.scss} +0 -0
- /package/lib/core/editor/components/Toolbar/widgets/{FontColorButton.module.scss → components/FontColorDropdown.module.scss} +0 -0
@@ -17,7 +17,7 @@ var _utils2 = require("@riil-frontend/component-topology-graph/es/utils");
|
|
17
17
|
|
18
18
|
var _topo = require("@riil-frontend/component-topology-common/es/services/topo");
|
19
19
|
|
20
|
-
var
|
20
|
+
var _loglevel = _interopRequireDefault(require("loglevel"));
|
21
21
|
|
22
22
|
var _format = require("../../../utils/format");
|
23
23
|
|
@@ -34,6 +34,8 @@ var _getTopoData = require("../../../networkTopo/getTopoData");
|
|
34
34
|
/**
|
35
35
|
* 拓扑配置
|
36
36
|
*/
|
37
|
+
var rlog = _loglevel["default"].getLogger('topo');
|
38
|
+
|
37
39
|
var newGroupWithUUID = function newGroupWithUUID(group) {
|
38
40
|
if (group === void 0) {
|
39
41
|
group = _template.DEFAULT_GROUP;
|
@@ -96,7 +98,7 @@ function conditionToRes(conditions) {
|
|
96
98
|
}
|
97
99
|
|
98
100
|
function updateGroupData(groups, index, data) {
|
99
|
-
|
101
|
+
rlog.debug("容器侦查-----updateGroupData", groups, index, data);
|
100
102
|
|
101
103
|
if (groups && groups[index]) {
|
102
104
|
var group = (0, _extends2["default"])({}, groups[index], data);
|
@@ -276,15 +278,7 @@ function _default(topoApp) {
|
|
276
278
|
|
277
279
|
case 5:
|
278
280
|
data = _context2.sent;
|
279
|
-
|
280
|
-
_rlog["default"].debug("按配置查询拓扑数据", {
|
281
|
-
config: {
|
282
|
-
resources: resources,
|
283
|
-
groups: groups
|
284
|
-
},
|
285
|
-
data: data
|
286
|
-
});
|
287
|
-
|
281
|
+
rlog.debug("按配置查询拓扑数据. 参数:", query, ", 返回结果: ", data);
|
288
282
|
return _context2.abrupt("return", data);
|
289
283
|
|
290
284
|
case 8:
|
@@ -325,8 +319,7 @@ function _default(topoApp) {
|
|
325
319
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
326
320
|
while (1) switch (_context4.prev = _context4.next) {
|
327
321
|
case 0:
|
328
|
-
|
329
|
-
|
322
|
+
rlog.debug("getTopoByConditions--------", params);
|
330
323
|
topoId = params.id, resources = params.resources, groups = params.groups;
|
331
324
|
viewConditions = (0, _topoData2.resToConditions)(resources);
|
332
325
|
groupInfo = (0, _utils.isAvailableArray)(groups) && groups.map(function (group) {
|
@@ -335,26 +328,23 @@ function _default(topoApp) {
|
|
335
328
|
resources: (0, _topoData2.resToConditions)(group.resources)
|
336
329
|
});
|
337
330
|
});
|
338
|
-
|
339
|
-
_rlog["default"].debug("getTopoByConditions--------", viewConditions, groupInfo);
|
340
|
-
|
331
|
+
rlog.debug("getTopoByConditions--------", viewConditions, groupInfo);
|
341
332
|
_context4.next = 7;
|
342
333
|
return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo);
|
343
334
|
|
344
335
|
case 7:
|
345
336
|
data = _context4.sent;
|
346
|
-
|
347
|
-
_rlog["default"].debug("getTopoByConditions--------data", data);
|
348
|
-
|
337
|
+
rlog.debug("getTopoByConditions--------data", data);
|
349
338
|
_context4.next = 11;
|
350
339
|
return (0, _getTopoData.buildData)(data);
|
351
340
|
|
352
341
|
case 11:
|
353
342
|
data = _context4.sent;
|
354
|
-
|
343
|
+
rlog.debug("getTopoByConditions--------", data, groupInfo);
|
344
|
+
_context4.next = 15;
|
355
345
|
return Promise.all([(0, _getTopoData.addLinkData)(data), topoApp.ciTyeCache.load((0, _topoData.getCiTypes)(data)), dispatch.customIcon.loadCustomIcons()]);
|
356
346
|
|
357
|
-
case
|
347
|
+
case 15:
|
358
348
|
_yield$Promise$all = _context4.sent;
|
359
349
|
dataWithLinkDetail = _yield$Promise$all[0];
|
360
350
|
_combTopoData = (0, _topoData.combTopoData)({
|
@@ -381,7 +371,7 @@ function _default(topoApp) {
|
|
381
371
|
topoDataTrans: topoDataTrans
|
382
372
|
});
|
383
373
|
|
384
|
-
case
|
374
|
+
case 23:
|
385
375
|
case "end":
|
386
376
|
return _context4.stop();
|
387
377
|
}
|
@@ -408,9 +398,7 @@ function _default(topoApp) {
|
|
408
398
|
}].concat(displayConfig.saveHistories || [])
|
409
399
|
}))
|
410
400
|
};
|
411
|
-
|
412
|
-
_rlog["default"].debug("saveGlobalConfig", config);
|
413
|
-
|
401
|
+
rlog.debug("saveGlobalConfig", config);
|
414
402
|
_context5.next = 5;
|
415
403
|
return topoApp.serverApi.saveTopoSettings(topoApp.id, config);
|
416
404
|
|
@@ -10,12 +10,14 @@ var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-ut
|
|
10
10
|
|
11
11
|
var _linkUtils = require("../models/utils/linkUtils");
|
12
12
|
|
13
|
+
var _htElementUtils = require("../../utils/htElementUtils");
|
14
|
+
|
13
15
|
/**
|
14
16
|
* 是否手工连线
|
15
17
|
* @param {*} edge
|
16
18
|
*/
|
17
19
|
function isCustomEdge(edge) {
|
18
|
-
return !
|
20
|
+
return !(0, _htElementUtils.isEdgeGroupAgent)(edge) && (edge.a('type') == 'line' || !edge.a('type'));
|
19
21
|
}
|
20
22
|
/**
|
21
23
|
* 根据配置更新连线展开折叠状态
|
@@ -25,7 +27,7 @@ function isCustomEdge(edge) {
|
|
25
27
|
|
26
28
|
|
27
29
|
var updateEdgeExpanded = function updateEdgeExpanded(topo) {
|
28
|
-
var _topo$historyManager, _topo$historyManager2;
|
30
|
+
var _topo$historyManager, _topo$historyManager2, _topo$linkDynamicStyl;
|
29
31
|
|
30
32
|
var _topo$store$getModelS = topo.store.getModelState("topoMod"),
|
31
33
|
viewState = _topo$store$getModelS.viewState;
|
@@ -38,8 +40,7 @@ var updateEdgeExpanded = function updateEdgeExpanded(topo) {
|
|
38
40
|
}
|
39
41
|
|
40
42
|
var _topo$store$getModelS2 = topo.store.getModelState("displayConfig"),
|
41
|
-
expandAllEdges = _topo$store$getModelS2.expandAllEdges;
|
42
|
-
|
43
|
+
expandAllEdges = _topo$store$getModelS2.expandAllEdges;
|
43
44
|
|
44
45
|
(_topo$historyManager = topo.historyManager) === null || _topo$historyManager === void 0 ? void 0 : _topo$historyManager.setDisabled(true, '连线展开控制');
|
45
46
|
|
@@ -48,11 +49,11 @@ var updateEdgeExpanded = function updateEdgeExpanded(topo) {
|
|
48
49
|
topo: topo,
|
49
50
|
showType: 1
|
50
51
|
});
|
51
|
-
htTopo.
|
52
|
+
htTopo.toggleAllEdgeGroups(false);
|
52
53
|
|
53
54
|
_rlog["default"].debug("updateEdgeExpanded 折叠");
|
54
55
|
} else {
|
55
|
-
htTopo.
|
56
|
+
htTopo.toggleAllEdgeGroups(true);
|
56
57
|
(0, _linkUtils.showLinkByConfig)({
|
57
58
|
topo: topo,
|
58
59
|
showType: expandAllEdges,
|
@@ -63,10 +64,7 @@ var updateEdgeExpanded = function updateEdgeExpanded(topo) {
|
|
63
64
|
}
|
64
65
|
|
65
66
|
(_topo$historyManager2 = topo.historyManager) === null || _topo$historyManager2 === void 0 ? void 0 : _topo$historyManager2.setDisabled(false, '连线展开控制');
|
66
|
-
|
67
|
-
if (topo.linkDynamicStyleExecutor) {
|
68
|
-
topo.linkDynamicStyleExecutor.execute();
|
69
|
-
}
|
67
|
+
(_topo$linkDynamicStyl = topo.linkDynamicStyleExecutor) === null || _topo$linkDynamicStyl === void 0 ? void 0 : _topo$linkDynamicStyl.execute();
|
70
68
|
};
|
71
69
|
|
72
70
|
exports.updateEdgeExpanded = updateEdgeExpanded;
|
package/lib/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js
CHANGED
@@ -9,6 +9,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
10
10
|
var _DefaultDetailContent = _interopRequireDefault(require("../../ResourceDetail/DefaultDetailContent"));
|
11
11
|
|
12
|
+
var _htElementUtils = require("../../../../../../utils/htElementUtils");
|
13
|
+
|
12
14
|
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); }
|
13
15
|
|
14
16
|
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; }
|
@@ -74,9 +76,8 @@ function useElementDetailManager(props) {
|
|
74
76
|
}
|
75
77
|
|
76
78
|
function openByHtElement(htElement) {
|
77
|
-
var isEdgeGroupAgent = htElement instanceof ht.Edge && htElement.isEdgeGroupAgent() && !htElement.s('edge.expanded');
|
78
79
|
open({
|
79
|
-
id: isEdgeGroupAgent || !htElement.getTag() ? "ht:" + htElement.getId() : htElement.getTag(),
|
80
|
+
id: (0, _htElementUtils.isEdgeGroupAgent)(htElement) || !htElement.getTag() ? "ht:" + htElement.getId() : htElement.getTag(),
|
80
81
|
htElement: htElement
|
81
82
|
});
|
82
83
|
}
|
package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js
CHANGED
@@ -29,10 +29,11 @@ var _indexModule = _interopRequireDefault(require("./index.module.scss"));
|
|
29
29
|
|
30
30
|
var _componentTopologyUtils = require("@riil-frontend/component-topology-utils");
|
31
31
|
|
32
|
+
var _loglevel = _interopRequireDefault(require("loglevel"));
|
33
|
+
|
32
34
|
function formatUrl(url) {
|
33
35
|
var _window, _window$location;
|
34
36
|
|
35
|
-
console.log(url);
|
36
37
|
var prefix = '/default/pagecenter';
|
37
38
|
|
38
39
|
if (((_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.pathname.indexOf(prefix)) === 0 && (url === null || url === void 0 ? void 0 : url.indexOf(prefix)) === 0) {
|
@@ -47,11 +48,14 @@ function EventsCard(props) {
|
|
47
48
|
closeDetailDrawer = props.closeDetailDrawer,
|
48
49
|
onHandleAlarm = props.onHandleAlarm;
|
49
50
|
|
51
|
+
var log = _loglevel["default"].getLogger('topo');
|
52
|
+
|
50
53
|
var jumpTo = function jumpTo(url) {
|
51
54
|
closeDetailDrawer();
|
52
55
|
|
53
56
|
if (topo.viewProps.jumpto) {
|
54
|
-
|
57
|
+
log.debug('formatUrl(url)', url);
|
58
|
+
topo.viewProps.jumpto(url);
|
55
59
|
} else {
|
56
60
|
(0, _componentTopologyUtils.getHistory)().push(formatUrl(url));
|
57
61
|
}
|
@@ -22,11 +22,11 @@ var EdgeGroupTagTipBuilder = /*#__PURE__*/function () {
|
|
22
22
|
|
23
23
|
var topo = this.topo;
|
24
24
|
var dm = this.topo.getDataModel();
|
25
|
-
var
|
26
|
-
|
27
|
-
|
28
|
-
var linkId = (0, _edgeGroupTagUtil.getEdgeGroupLinkIdConfig)(
|
29
|
-
var edgeGroupId = [
|
25
|
+
var edgeGroupAgents = (0, _htElementUtils.getEdgeGroupAgents)(dm);
|
26
|
+
var edgeGroupsTagsTips = edgeGroupAgents.map(function (edgeGroupAgent) {
|
27
|
+
// 获取配置的链路
|
28
|
+
var linkId = (0, _edgeGroupTagUtil.getEdgeGroupLinkIdConfig)(edgeGroupAgent, topo);
|
29
|
+
var edgeGroupId = [edgeGroupAgent.getSource().getId(), edgeGroupAgent.getTarget().getId()];
|
30
30
|
var data = {
|
31
31
|
tags: [],
|
32
32
|
tips: []
|
@@ -37,7 +37,7 @@ var EdgeGroupTagTipBuilder = /*#__PURE__*/function () {
|
|
37
37
|
}
|
38
38
|
|
39
39
|
return {
|
40
|
-
htId:
|
40
|
+
htId: edgeGroupAgent.getId(),
|
41
41
|
edgeGroupId: edgeGroupId,
|
42
42
|
tags: data.tags,
|
43
43
|
tips: data.tips,
|
@@ -3,14 +3,10 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports["default"] = void 0;
|
5
5
|
|
6
|
-
var _componentTopologyUtils = require("@riil-frontend/component-topology-utils");
|
7
|
-
|
8
6
|
var _clusterUtil = require("../../utils/clusterUtil");
|
9
7
|
|
10
8
|
var _htElementUtils = require("../../utils/htElementUtils");
|
11
9
|
|
12
|
-
var _linkUtil = require("../utils/linkUtil");
|
13
|
-
|
14
10
|
// network_link.actual_bandwidth
|
15
11
|
function calcEdgeWidth(actualBandwidth) {
|
16
12
|
if (!actualBandwidth) {
|
@@ -61,16 +57,17 @@ var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
|
|
61
57
|
var _proto = LinkDynamicStyleExecutor.prototype;
|
62
58
|
|
63
59
|
_proto.execute = function execute() {
|
64
|
-
var
|
60
|
+
var _topo$historyManager,
|
61
|
+
_this = this,
|
62
|
+
_topo$historyManager2;
|
65
63
|
|
66
64
|
var topo = this.topo;
|
67
65
|
|
68
66
|
var _topo$dataModel$getDa = topo.dataModel.getData(),
|
69
|
-
links = _topo$dataModel$getDa.links
|
70
|
-
linkGroups = _topo$dataModel$getDa.linkGroups;
|
67
|
+
links = _topo$dataModel$getDa.links;
|
71
68
|
|
72
69
|
var dataModel = this.topo.getDataModel();
|
73
|
-
|
70
|
+
(_topo$historyManager = topo.historyManager) === null || _topo$historyManager === void 0 ? void 0 : _topo$historyManager.setDisabled(true, '链路动态粗细'); // 1、如果连线可见,设置线宽
|
74
71
|
|
75
72
|
links.forEach(function (link) {
|
76
73
|
var edge = dataModel.getDataByTag(link.id);
|
@@ -78,63 +75,8 @@ var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
|
|
78
75
|
if (edge) {
|
79
76
|
edge.s('edge.width', _this.calcLinkEdgeWidth(link));
|
80
77
|
}
|
81
|
-
}); // 2、如果连线组关联链路并可见,设置线宽
|
82
|
-
|
83
|
-
linkGroups.forEach(function (link) {
|
84
|
-
// 聚合链路是连线/连线组,并可以查询到
|
85
|
-
var edge = topo.getDataModel().getDataByTag(link.id);
|
86
|
-
|
87
|
-
if (edge) {
|
88
|
-
edge.s('edge.width', _this.calcLinkEdgeWidth(link));
|
89
|
-
return;
|
90
|
-
} // 聚合链路是连线组(编辑模式还未关联业务信息)
|
91
|
-
|
92
|
-
|
93
|
-
var edgeGroup = (0, _htElementUtils.getEdgeGroupByNodeTags)(dataModel, link.source, link.target);
|
94
|
-
|
95
|
-
if (edgeGroup) {
|
96
|
-
var edgeGroupAgent = edgeGroup.getEdgeGroupAgent(); // 判断是显示的连线组元素
|
97
|
-
|
98
|
-
if (edgeGroupAgent) {
|
99
|
-
edgeGroup.getEdgeGroupAgent().s('edge.width', _this.calcLinkEdgeWidth(link));
|
100
|
-
}
|
101
|
-
} else {
|
102
|
-
_componentTopologyUtils.rlog.warn('动态链路样式执行:未找到聚合链路的ht元素', link);
|
103
|
-
}
|
104
|
-
}); // 3、如果连线组未关联链路并可见,设置线宽。
|
105
|
-
|
106
|
-
var edges = (0, _htElementUtils.getEdges)(dataModel);
|
107
|
-
edges.forEach(function (edge) {
|
108
|
-
try {
|
109
|
-
// 获取两端代理节点
|
110
|
-
var sourceAgent = edge.getSourceAgent();
|
111
|
-
var targetAgent = edge.getTargetAgent();
|
112
|
-
var sourceId = sourceAgent.getTag();
|
113
|
-
var targetId = targetAgent.getTag(); // 查询是否有聚合链路
|
114
|
-
|
115
|
-
var aggLink = linkGroups.find(function (link) {
|
116
|
-
return link.source === sourceId && link.target === targetId || link.target === sourceId && link.source === targetId;
|
117
|
-
}); // 如果连线组未关联链路并可见
|
118
|
-
|
119
|
-
if (!aggLink && edge.isEdgeGroupAgent()) {
|
120
|
-
// 查询两端代理节点(包含子节点)间的子链路列表
|
121
|
-
var sourceCiIds = getChildrenNodeCiIds([sourceAgent]);
|
122
|
-
var targetCiIds = getChildrenNodeCiIds([targetAgent]);
|
123
|
-
var aggLinks = (0, _linkUtil.getLinksBetweenNodes)(linkGroups, sourceCiIds, targetCiIds);
|
124
|
-
var phyLinks = (0, _linkUtil.getLinksBetweenNodes)(links, sourceCiIds, targetCiIds);
|
125
|
-
var linkBetweenNodes = aggLinks.length ? aggLinks : phyLinks; // 如果有子链路,计算线宽并设置
|
126
|
-
|
127
|
-
if (linkBetweenNodes.length) {
|
128
|
-
var edgeWidth = _this.calcEdgeGroupEdgeWidth(linkBetweenNodes);
|
129
|
-
|
130
|
-
edge.s('edge.width', edgeWidth);
|
131
|
-
}
|
132
|
-
}
|
133
|
-
} catch (error) {
|
134
|
-
_componentTopologyUtils.rlog.error('连线组未关联链路并可见,设置线宽:异常', edge, error);
|
135
|
-
}
|
136
78
|
});
|
137
|
-
topo.historyManager
|
79
|
+
(_topo$historyManager2 = topo.historyManager) === null || _topo$historyManager2 === void 0 ? void 0 : _topo$historyManager2.setDisabled(false, '链路动态粗细');
|
138
80
|
}
|
139
81
|
/**
|
140
82
|
* 处理单个连线组切换。有链路时设置
|
@@ -5,8 +5,6 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
5
5
|
exports.__esModule = true;
|
6
6
|
exports["default"] = exports.TOPO_PARENT_ID = exports.TOPO_GROUP_ID = void 0;
|
7
7
|
|
8
|
-
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
9
|
-
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
11
9
|
|
12
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
@@ -23,7 +21,12 @@ var _model = require("../model");
|
|
23
21
|
|
24
22
|
var _exitLinkUtil = require("../../utils/exitLinkUtil");
|
25
23
|
|
26
|
-
var
|
24
|
+
var relateTopoDataUtil = _interopRequireWildcard(require("../../utils/relateTopoDataUtil"));
|
25
|
+
|
26
|
+
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); }
|
27
|
+
|
28
|
+
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; }
|
29
|
+
|
27
30
|
var API_ROOT = _constants.TOPO_API_ROOT;
|
28
31
|
/**
|
29
32
|
* 拓扑图(看做一个容器)的“父容器”ID
|
@@ -66,7 +69,7 @@ function prepareResourceParams(conditions, query) {
|
|
66
69
|
return {
|
67
70
|
dynamicCondition: dynamicCondition,
|
68
71
|
fixedConditionIdList: (staticRes || []).filter(function (ciId) {
|
69
|
-
return !ciId.
|
72
|
+
return !ciId.includes(':');
|
70
73
|
}),
|
71
74
|
linkIps: (staticRes || []).filter(function (ciId) {
|
72
75
|
return ciId.startsWith('ip:');
|
@@ -115,7 +118,8 @@ function prepareGroupParams(modifiedGroups) {
|
|
115
118
|
};
|
116
119
|
}).filter(Boolean);
|
117
120
|
return {
|
118
|
-
groups: groups
|
121
|
+
groups: groups,
|
122
|
+
relateTopoIdList: relateTopoDataUtil.getRelateTopoIdListFromConfig(modifiedGroups)
|
119
123
|
};
|
120
124
|
}
|
121
125
|
|
@@ -406,16 +410,20 @@ var _default = (0, _extends2["default"])({
|
|
406
410
|
|
407
411
|
case 2:
|
408
412
|
result = _context12.sent;
|
409
|
-
|
413
|
+
result = (0, _extends2["default"])({}, result, {
|
410
414
|
nodes: (_result$nodes = result.nodes) !== null && _result$nodes !== void 0 ? _result$nodes : [],
|
411
415
|
links: ((_result$links = result.links) !== null && _result$links !== void 0 ? _result$links : []).map(function (item) {
|
412
416
|
return (0, _extends2["default"])({}, item, {
|
413
417
|
ciType: 'network_link'
|
414
418
|
});
|
415
|
-
})
|
416
|
-
|
419
|
+
}),
|
420
|
+
serialize: result.serialize ? JSON.parse(result.serialize) : undefined
|
421
|
+
});
|
422
|
+
result = relateTopoDataUtil.processBothTopoData(result);
|
423
|
+
result = (0, _exitLinkUtil.processExitLink)(result);
|
424
|
+
return _context12.abrupt("return", result);
|
417
425
|
|
418
|
-
case
|
426
|
+
case 7:
|
419
427
|
case "end":
|
420
428
|
return _context12.stop();
|
421
429
|
}
|
@@ -434,7 +442,7 @@ var _default = (0, _extends2["default"])({
|
|
434
442
|
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13() {
|
435
443
|
var _result$nodes2, _result$links2;
|
436
444
|
|
437
|
-
var data,
|
445
|
+
var data, params, result;
|
438
446
|
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
439
447
|
while (1) switch (_context13.prev = _context13.next) {
|
440
448
|
case 0:
|
@@ -448,22 +456,28 @@ var _default = (0, _extends2["default"])({
|
|
448
456
|
});
|
449
457
|
}
|
450
458
|
|
451
|
-
|
459
|
+
params = prepareGroupParams(data);
|
452
460
|
_context13.next = 5;
|
453
|
-
return _componentTopologyUtils.request.post(API_ROOT + "/structure/byCondition/" + id,
|
461
|
+
return _componentTopologyUtils.request.post(API_ROOT + "/structure/byCondition/" + id, params);
|
454
462
|
|
455
463
|
case 5:
|
456
464
|
result = _context13.sent;
|
457
|
-
|
465
|
+
result = (0, _extends2["default"])({}, result, {
|
458
466
|
nodes: (_result$nodes2 = result.nodes) !== null && _result$nodes2 !== void 0 ? _result$nodes2 : [],
|
459
467
|
links: ((_result$links2 = result.links) !== null && _result$links2 !== void 0 ? _result$links2 : []).map(function (item) {
|
460
468
|
return (0, _extends2["default"])({}, item, {
|
461
469
|
ciType: 'network_link'
|
462
470
|
});
|
463
471
|
})
|
464
|
-
})
|
472
|
+
});
|
473
|
+
result = relateTopoDataUtil.processByConditionTopoData({
|
474
|
+
data: result,
|
475
|
+
config: data
|
476
|
+
});
|
477
|
+
result = (0, _exitLinkUtil.processByConditionResult)(result, params.groups);
|
478
|
+
return _context13.abrupt("return", result);
|
465
479
|
|
466
|
-
case
|
480
|
+
case 10:
|
467
481
|
case "end":
|
468
482
|
return _context13.stop();
|
469
483
|
}
|
@@ -480,11 +494,11 @@ var _default = (0, _extends2["default"])({
|
|
480
494
|
*/
|
481
495
|
bindResourceToTopo: function bindResourceToTopo(id, config) {
|
482
496
|
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14() {
|
483
|
-
var groups, resources,
|
497
|
+
var groups, resources, newGroups, obj;
|
484
498
|
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
485
499
|
while (1) switch (_context14.prev = _context14.next) {
|
486
500
|
case 0:
|
487
|
-
groups = config.groups, resources = config.resources
|
501
|
+
groups = config.groups, resources = config.resources;
|
488
502
|
newGroups = Array.isArray(groups) ? groups : [];
|
489
503
|
|
490
504
|
if (resources) {
|
@@ -498,7 +512,7 @@ var _default = (0, _extends2["default"])({
|
|
498
512
|
|
499
513
|
obj = prepareGroupParams(newGroups);
|
500
514
|
_context14.next = 6;
|
501
|
-
return _componentTopologyUtils.request.post(API_ROOT + "/resource/" + id,
|
515
|
+
return _componentTopologyUtils.request.post(API_ROOT + "/resource/" + id, obj);
|
502
516
|
|
503
517
|
case 6:
|
504
518
|
return _context14.abrupt("return", _context14.sent);
|