@riil-frontend/component-topology 13.0.0-dev.1 → 13.0.0-dev.3
Sign up to get free protection for your applications and to get access to all the features.
- package/build/1.js +1 -1
- package/build/index.js +14 -14
- 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/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/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 +71 -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/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/useTopoEdit.js +206 -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 +7 -14
- package/es/core/models/utils/linkUtils.js +36 -28
- package/es/core/store/models/topoConfig.js +14 -17
- package/es/core/utils/edgeUtil.js +7 -10
- package/es/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js +2 -2
- package/es/networkTopo/models/EdgeGroupTagTipBuilder.js +7 -7
- package/es/networkTopo/models/LinkDynamicStyleExecutor.js +7 -63
- package/es/networkTopo/services/topo/basic.js +15 -8
- package/es/networkTopo/utils/edgeGroupTagUtil.js +2 -2
- package/es/networkTopo/utils/exitLinkUtil.js +23 -11
- package/es/networkTopo/utils/relateTopoDataUtil.js +96 -0
- package/es/style.js +1 -1
- package/es/utils/clusterUtil.js +3 -3
- package/es/utils/htElementUtils.js +16 -84
- 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/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/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 +83 -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/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/useTopoEdit.js +212 -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 +7 -14
- package/lib/core/models/utils/linkUtils.js +36 -27
- package/lib/core/store/models/topoConfig.js +20 -31
- package/lib/core/utils/edgeUtil.js +8 -10
- package/lib/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js +3 -2
- package/lib/networkTopo/models/EdgeGroupTagTipBuilder.js +6 -6
- package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +6 -64
- package/lib/networkTopo/services/topo/basic.js +21 -8
- package/lib/networkTopo/utils/edgeGroupTagUtil.js +2 -2
- package/lib/networkTopo/utils/exitLinkUtil.js +23 -11
- package/lib/networkTopo/utils/relateTopoDataUtil.js +109 -0
- package/lib/style.js +1 -1
- package/lib/utils/clusterUtil.js +2 -2
- package/lib/utils/htElementUtils.js +19 -93
- package/package.json +2 -2
- package/es/networkTopo/models/LinkTagsTipsBuilder.js +0 -235
- package/lib/networkTopo/models/LinkTagsTipsBuilder.js +0 -245
@@ -11,7 +11,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
11
11
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13
13
|
|
14
|
-
var
|
14
|
+
var _loglevel = _interopRequireDefault(require("loglevel"));
|
15
15
|
|
16
16
|
var _ResourceInfoDisplay = require("../../constants/ResourceInfoDisplay");
|
17
17
|
|
@@ -25,6 +25,8 @@ var _nodeNameVisibleUtil = require("./utils/nodeNameVisibleUtil");
|
|
25
25
|
|
26
26
|
var _ciRefAttributeTranslateUtil = require("../../utils/ciRefAttributeTranslateUtil");
|
27
27
|
|
28
|
+
var rlog = _loglevel["default"].getLogger('topo');
|
29
|
+
|
28
30
|
function isGraphField(item) {
|
29
31
|
return item.type === 'graph';
|
30
32
|
}
|
@@ -451,7 +453,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
451
453
|
});
|
452
454
|
});
|
453
455
|
} else {
|
454
|
-
|
456
|
+
rlog.warn("\u63A8\u9001\u5C5E\u6027\u6307\u6807\u6570\u636E\uFF1A\u672A\u67E5\u8BE2\u5230ciType " + ciType, ciData);
|
455
457
|
}
|
456
458
|
});
|
457
459
|
refIds = Object.keys(refIdMap);
|
@@ -540,9 +542,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
540
542
|
tags: tags
|
541
543
|
});
|
542
544
|
});
|
543
|
-
|
544
|
-
_componentTopologyUtils.rlog.debug('推送标注 => ht', elementTagsAndTips);
|
545
|
-
|
545
|
+
rlog.debug(' ==> ht: 推送标注', elementTagsAndTips);
|
546
546
|
var htTopo = topo.getHtTopo();
|
547
547
|
|
548
548
|
if (htTopo) {
|
@@ -553,7 +553,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
553
553
|
try {
|
554
554
|
htTopo.loadTagAndTip(JSON.parse(JSON.stringify(elementTagsAndTips)));
|
555
555
|
} catch (error) {
|
556
|
-
|
556
|
+
rlog.error(' ==> ht: 推送标注失败', error);
|
557
557
|
}
|
558
558
|
|
559
559
|
(_topo$historyManager2 = topo.historyManager) === null || _topo$historyManager2 === void 0 ? void 0 : _topo$historyManager2.setDisabled(false, '加载标注');
|
@@ -9,6 +9,10 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
9
9
|
|
10
10
|
var _componentTopologyUtils = require("@riil-frontend/component-topology-utils");
|
11
11
|
|
12
|
+
var _loglevel = _interopRequireDefault(require("loglevel"));
|
13
|
+
|
14
|
+
var log = _loglevel["default"].getLogger('topo.HistoryManager');
|
15
|
+
|
12
16
|
var ht = window.ht;
|
13
17
|
|
14
18
|
var HistoryManager = /*#__PURE__*/function () {
|
@@ -19,9 +23,7 @@ var HistoryManager = /*#__PURE__*/function () {
|
|
19
23
|
this.topo = topo;
|
20
24
|
this.htHistoryManager = htHistoryManager;
|
21
25
|
htHistoryManager.clear();
|
22
|
-
|
23
|
-
_componentTopologyUtils.rlog.info('HistoryManager 初始化', htHistoryManager);
|
24
|
-
|
26
|
+
log.info('HistoryManager 初始化', htHistoryManager);
|
25
27
|
this.updateStore = this.updateStore.bind(this);
|
26
28
|
this.init();
|
27
29
|
}
|
@@ -69,11 +71,10 @@ var HistoryManager = /*#__PURE__*/function () {
|
|
69
71
|
|
70
72
|
_proto.setDisabled = function setDisabled(disabled, message) {
|
71
73
|
this.htHistoryManager.setDisabled(disabled);
|
72
|
-
|
73
|
-
_componentTopologyUtils.rlog.debug("HistoryManager.setDisabled " + (disabled ? '禁用' : '启用') + (message ? "(" + message + ")" : '') + ": " + this.toString(), this.getHistories());
|
74
|
+
log.debug("HistoryManager.setDisabled: " + (disabled ? '禁用' : '启用') + ". <" + message + ">, " + this.toString() + ", ", 'Histories: ', this.getHistories());
|
74
75
|
};
|
75
76
|
|
76
|
-
_proto.beginTransaction = function beginTransaction() {
|
77
|
+
_proto.beginTransaction = function beginTransaction(name) {
|
77
78
|
var _this = this;
|
78
79
|
|
79
80
|
this.htHistoryManager.beginTransaction();
|
@@ -104,8 +105,7 @@ var HistoryManager = /*#__PURE__*/function () {
|
|
104
105
|
oldValue: _this.topo.store.getModelState(item.modelName)[item.property]
|
105
106
|
});
|
106
107
|
});
|
107
|
-
|
108
|
-
_componentTopologyUtils.rlog.debug("HistoryManager.beginTransaction: " + this.toString(), this.getHistories());
|
108
|
+
log.debug("HistoryManager.beginTransaction: " + this.toString(), this.getHistories());
|
109
109
|
};
|
110
110
|
|
111
111
|
_proto.addStoreHistory = function addStoreHistory() {
|
@@ -130,18 +130,16 @@ var HistoryManager = /*#__PURE__*/function () {
|
|
130
130
|
type: 'store',
|
131
131
|
data: storeChanged
|
132
132
|
});
|
133
|
-
|
134
|
-
_componentTopologyUtils.rlog.debug('HistoryManager.addStoreHistory', storeChanged);
|
133
|
+
log.debug('HistoryManager.addStoreHistory', storeChanged);
|
135
134
|
}
|
136
135
|
|
137
136
|
this.storeHistory = [];
|
138
137
|
};
|
139
138
|
|
140
|
-
_proto.endTransaction = function endTransaction() {
|
139
|
+
_proto.endTransaction = function endTransaction(name) {
|
141
140
|
this.addStoreHistory();
|
142
141
|
this.htHistoryManager.endTransaction();
|
143
|
-
|
144
|
-
_componentTopologyUtils.rlog.debug("HistoryManager.endTransaction: " + this.toString(), this.getHistories());
|
142
|
+
log.debug("HistoryManager.endTransaction: " + this.toString(), this.getHistories());
|
145
143
|
};
|
146
144
|
|
147
145
|
_proto.clear = function clear() {
|
@@ -185,8 +183,7 @@ var HistoryManager = /*#__PURE__*/function () {
|
|
185
183
|
return;
|
186
184
|
}
|
187
185
|
|
188
|
-
|
189
|
-
|
186
|
+
log.debug('HistoryManager.undo', this.getHistories(), this.getHistoryIndex());
|
190
187
|
var storeHistory = this.getCurrentStoreHistory(true);
|
191
188
|
|
192
189
|
if (storeHistory) {
|
@@ -204,8 +201,7 @@ var HistoryManager = /*#__PURE__*/function () {
|
|
204
201
|
_proto.redo = function redo() {
|
205
202
|
var _this4 = this;
|
206
203
|
|
207
|
-
|
208
|
-
|
204
|
+
log.debug('HistoryManager.redo', this.getHistories(), this.getHistoryIndex());
|
209
205
|
var storeHistory = this.getCurrentStoreHistory(false);
|
210
206
|
|
211
207
|
if (storeHistory) {
|
@@ -54,7 +54,7 @@ var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
|
|
54
54
|
var _CiCache = _interopRequireDefault(require("./cache/CiCache"));
|
55
55
|
|
56
56
|
// eslint-disable-next-line no-undef
|
57
|
-
var version = typeof "13.0.0-dev.
|
57
|
+
var version = typeof "13.0.0-dev.3" === 'string' ? "13.0.0-dev.3" : null;
|
58
58
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
59
59
|
/**
|
60
60
|
* 拓扑显示和编辑
|
@@ -218,37 +218,29 @@ var Topo = /*#__PURE__*/function () {
|
|
218
218
|
|
219
219
|
_proto.getData = function getData() {
|
220
220
|
return {
|
221
|
-
groups: this.
|
222
|
-
nodes:
|
223
|
-
|
221
|
+
groups: (0, _htElementUtils.getGroupDatas)(this.getDataModel()),
|
222
|
+
nodes: (0, _htElementUtils.getNodes)(this.getDataModel()).filter(function (node) {
|
223
|
+
return !!node.getTag();
|
224
|
+
}).map(_htElementUtils.getNodeData),
|
224
225
|
customNodes: (0, _htElementUtils.getNodeDatas)(this.getDataModel()).filter(function (item) {
|
225
226
|
return !item.id;
|
226
227
|
}),
|
227
|
-
|
228
|
+
lines: (0, _htElementUtils.getEdgeDatas)(this.getDataModel()).filter(function (item) {
|
229
|
+
return !!item.id;
|
230
|
+
}),
|
231
|
+
customLines: (0, _htElementUtils.getEdgeDatas)(this.getDataModel()).filter(function (item) {
|
228
232
|
return !item.id;
|
229
233
|
})
|
230
234
|
};
|
231
|
-
}
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
_proto.getNodes = function getNodes() {
|
238
|
-
var nodes = (0, _htElementUtils.getNodes)(this.getDataModel()).filter(function (node) {
|
239
|
-
return !!node.getTag();
|
240
|
-
});
|
241
|
-
return nodes.map(_htElementUtils.getNodeData);
|
242
|
-
};
|
235
|
+
}
|
236
|
+
/**
|
237
|
+
* @deprecated 待移除。uicbb有使用
|
238
|
+
* @returns
|
239
|
+
*/
|
240
|
+
;
|
243
241
|
|
244
242
|
_proto.getLines = function getLines() {
|
245
|
-
return this.
|
246
|
-
return !!item.id;
|
247
|
-
});
|
248
|
-
};
|
249
|
-
|
250
|
-
_proto.getEdges = function getEdges() {
|
251
|
-
return (0, _htElementUtils.getEdgeDatas)(this.getDataModel());
|
243
|
+
return this.getData().lines;
|
252
244
|
}
|
253
245
|
/**
|
254
246
|
* 全量更新数据
|
@@ -307,18 +299,19 @@ var Topo = /*#__PURE__*/function () {
|
|
307
299
|
/*#__PURE__*/
|
308
300
|
function () {
|
309
301
|
var _addElements = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(elements) {
|
310
|
-
var data;
|
302
|
+
var prevData, data;
|
311
303
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
312
304
|
while (1) switch (_context5.prev = _context5.next) {
|
313
305
|
case 0:
|
306
|
+
prevData = this.getData();
|
314
307
|
data = {
|
315
|
-
groups: [].concat(
|
316
|
-
nodes: [].concat(
|
317
|
-
lines: [].concat(
|
308
|
+
groups: [].concat(prevData.groups, elements.groups || []),
|
309
|
+
nodes: [].concat(prevData.nodes, elements.nodes || []),
|
310
|
+
lines: [].concat(prevData.lines, elements.lines || [])
|
318
311
|
};
|
319
312
|
this.updateElements(data); // TODO 更新store,触发属性、指标模型加载,更新指标
|
320
313
|
|
321
|
-
case
|
314
|
+
case 3:
|
322
315
|
case "end":
|
323
316
|
return _context5.stop();
|
324
317
|
}
|
@@ -547,37 +540,39 @@ var Topo = /*#__PURE__*/function () {
|
|
547
540
|
case 0:
|
548
541
|
_componentTopologyUtils.rlog.info('TopoApp.enterEditMode');
|
549
542
|
|
543
|
+
this.historyManager = null;
|
544
|
+
|
550
545
|
if (!this.options.onSwitchToEditModeBegin) {
|
551
|
-
_context12.next =
|
546
|
+
_context12.next = 5;
|
552
547
|
break;
|
553
548
|
}
|
554
549
|
|
555
|
-
_context12.next =
|
550
|
+
_context12.next = 5;
|
556
551
|
return this.options.onSwitchToEditModeBegin(this);
|
557
552
|
|
558
|
-
case
|
553
|
+
case 5:
|
559
554
|
topoDispatchers = this.store.getModelDispatchers('topoMod');
|
560
|
-
_context12.next =
|
555
|
+
_context12.next = 8;
|
561
556
|
return topoDispatchers.update({
|
562
557
|
viewState: 'edit'
|
563
558
|
});
|
564
559
|
|
565
|
-
case
|
566
|
-
_context12.next =
|
560
|
+
case 8:
|
561
|
+
_context12.next = 10;
|
567
562
|
return this.view.switchToEditMode();
|
568
563
|
|
569
|
-
case
|
564
|
+
case 10:
|
570
565
|
(0, _edgeUtil.updateEdgeExpanded)(this);
|
571
566
|
|
572
567
|
if (!this.options.onSwitchToEditMode) {
|
573
|
-
_context12.next =
|
568
|
+
_context12.next = 14;
|
574
569
|
break;
|
575
570
|
}
|
576
571
|
|
577
|
-
_context12.next =
|
572
|
+
_context12.next = 14;
|
578
573
|
return this.options.onSwitchToEditMode(this);
|
579
574
|
|
580
|
-
case
|
575
|
+
case 14:
|
581
576
|
if (this.getDataModel()) {
|
582
577
|
// 更新节点名称显示隐藏
|
583
578
|
this.attributeMetricDisplay.updateNodesNameVisible();
|
@@ -587,7 +582,7 @@ var Topo = /*#__PURE__*/function () {
|
|
587
582
|
iconManageDispatchers = this.store.getModelDispatchers('customIcon');
|
588
583
|
iconManageDispatchers.loadEditorIcons();
|
589
584
|
|
590
|
-
case
|
585
|
+
case 17:
|
591
586
|
case "end":
|
592
587
|
return _context12.stop();
|
593
588
|
}
|
@@ -611,18 +606,19 @@ var Topo = /*#__PURE__*/function () {
|
|
611
606
|
return this.view.switchToViewMode();
|
612
607
|
|
613
608
|
case 2:
|
609
|
+
this.historyManager = null;
|
614
610
|
editDispatchers = this.store.getModelDispatchers('topoConfig');
|
615
611
|
editDispatchers.switchToViewMode(this.id);
|
616
612
|
|
617
613
|
if (!this.options.onSwitchToViewMode) {
|
618
|
-
_context13.next =
|
614
|
+
_context13.next = 8;
|
619
615
|
break;
|
620
616
|
}
|
621
617
|
|
622
|
-
_context13.next =
|
618
|
+
_context13.next = 8;
|
623
619
|
return this.options.onSwitchToViewMode(this);
|
624
620
|
|
625
|
-
case
|
621
|
+
case 8:
|
626
622
|
case "end":
|
627
623
|
return _context13.stop();
|
628
624
|
}
|
@@ -57,7 +57,7 @@ function saveTopo(_x) {
|
|
57
57
|
|
58
58
|
function _saveTopo() {
|
59
59
|
_saveTopo = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(data) {
|
60
|
-
var topoService, topoId, template, layout, backgroundId, globalConfig, serialize, resources, groups, relateTopoIdList, viewGroupId, groupInfo, viewResources
|
60
|
+
var topoService, topoId, template, layout, backgroundId, globalConfig, serialize, resources, groups, relateTopoIdList, viewGroupId, groupInfo, viewResources;
|
61
61
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
62
62
|
while (1) switch (_context.prev = _context.next) {
|
63
63
|
case 0:
|
@@ -90,7 +90,7 @@ function _saveTopo() {
|
|
90
90
|
|
91
91
|
case 8:
|
92
92
|
if (!(resources || groups)) {
|
93
|
-
_context.next =
|
93
|
+
_context.next = 15;
|
94
94
|
break;
|
95
95
|
}
|
96
96
|
|
@@ -112,31 +112,24 @@ function _saveTopo() {
|
|
112
112
|
});
|
113
113
|
}
|
114
114
|
|
115
|
-
linkIps = []; // resources?.static.map((nodeId) => {
|
116
|
-
// if (nodeId.startsWith("ip_")) {
|
117
|
-
// linkIps.push(nodeId.replace("ip_", ""));
|
118
|
-
// }
|
119
|
-
// });
|
120
|
-
|
121
115
|
_rlog["default"].debug("saveTopo-groupInfo", groupInfo);
|
122
116
|
|
123
|
-
_context.next =
|
117
|
+
_context.next = 15;
|
124
118
|
return topoService.bindResourceToTopo(topoId, {
|
125
119
|
groups: groupInfo,
|
126
|
-
linkIps: linkIps,
|
127
120
|
relateTopoIdList: relateTopoIdList
|
128
121
|
});
|
129
122
|
|
130
|
-
case
|
123
|
+
case 15:
|
131
124
|
if (!serialize) {
|
132
|
-
_context.next =
|
125
|
+
_context.next = 18;
|
133
126
|
break;
|
134
127
|
}
|
135
128
|
|
136
|
-
_context.next =
|
129
|
+
_context.next = 18;
|
137
130
|
return topoService.saveSerializeData(topoId, serialize);
|
138
131
|
|
139
|
-
case
|
132
|
+
case 18:
|
140
133
|
case "end":
|
141
134
|
return _context.stop();
|
142
135
|
}
|
@@ -6,6 +6,7 @@ exports.__esModule = true;
|
|
6
6
|
exports.buildTopoLinkData = buildTopoLinkData;
|
7
7
|
exports.compatibleWith = void 0;
|
8
8
|
exports.getLinksDetail = getLinksDetail;
|
9
|
+
exports.isAggLink = isAggLink;
|
9
10
|
exports.isCrucialLink = isCrucialLink;
|
10
11
|
exports.isExitLink = isExitLink;
|
11
12
|
exports.mergeExportLinkData = void 0;
|
@@ -22,8 +23,6 @@ var _keyBy = _interopRequireDefault(require("lodash/keyBy"));
|
|
22
23
|
|
23
24
|
var _lodash = _interopRequireDefault(require("lodash"));
|
24
25
|
|
25
|
-
var _services = require("../../services");
|
26
|
-
|
27
26
|
var _htElementUtils = require("../../../utils/htElementUtils");
|
28
27
|
|
29
28
|
var _CiTypeCache = _interopRequireDefault(require("../cache/CiTypeCache"));
|
@@ -56,7 +55,21 @@ function isCrucialLink(link) {
|
|
56
55
|
|
57
56
|
|
58
57
|
function isExitLink(link) {
|
59
|
-
|
58
|
+
var _link$attributes;
|
59
|
+
|
60
|
+
return (link === null || link === void 0 ? void 0 : (_link$attributes = link.attributes) === null || _link$attributes === void 0 ? void 0 : _link$attributes.destination_type) === "ip";
|
61
|
+
}
|
62
|
+
/**
|
63
|
+
* 是否聚合链路
|
64
|
+
* @param {*} link
|
65
|
+
* @returns
|
66
|
+
*/
|
67
|
+
|
68
|
+
|
69
|
+
function isAggLink(link) {
|
70
|
+
var _link$attributes2, _link$attributes3;
|
71
|
+
|
72
|
+
return (link === null || link === void 0 ? void 0 : (_link$attributes2 = link.attributes) === null || _link$attributes2 === void 0 ? void 0 : _link$attributes2.destination_type) === "network.agg_interface" && (link === null || link === void 0 ? void 0 : (_link$attributes3 = link.attributes) === null || _link$attributes3 === void 0 ? void 0 : _link$attributes3.source_type) === "network.agg_interface";
|
60
73
|
}
|
61
74
|
|
62
75
|
function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc) {
|
@@ -107,7 +120,7 @@ function _getLinksDetail() {
|
|
107
120
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
108
121
|
while (1) switch (_context.prev = _context.next) {
|
109
122
|
case 0:
|
110
|
-
if (
|
123
|
+
if (links !== null && links !== void 0 && links.length) {
|
111
124
|
_context.next = 2;
|
112
125
|
break;
|
113
126
|
}
|
@@ -115,9 +128,6 @@ function _getLinksDetail() {
|
|
115
128
|
return _context.abrupt("return", []);
|
116
129
|
|
117
130
|
case 2:
|
118
|
-
// const linkCis = await topoService.relation.batchQueryRelation(
|
119
|
-
// links.map((link) => link.id)
|
120
|
-
// );
|
121
131
|
linkCis = links;
|
122
132
|
interfaceIds = [].concat(linkCis.map(function (item) {
|
123
133
|
return item.attributes.source_id;
|
@@ -176,7 +186,8 @@ var plurals = {
|
|
176
186
|
2: ["phy"],
|
177
187
|
3: ["agg"],
|
178
188
|
4: ["phy", "agg"]
|
179
|
-
};
|
189
|
+
}; // 待办:移到网络拓扑组件
|
190
|
+
|
180
191
|
exports.plurals = plurals;
|
181
192
|
|
182
193
|
var showLinkByConfig = function showLinkByConfig(props) {
|
@@ -190,31 +201,29 @@ var showLinkByConfig = function showLinkByConfig(props) {
|
|
190
201
|
|
191
202
|
var gv = topo.getGraphView();
|
192
203
|
var dm = gv.getDataModel();
|
193
|
-
var edges = (0, _htElementUtils.getEdges)(dm)
|
204
|
+
var edges = (0, _htElementUtils.getEdges)(dm).filter(function (edge) {
|
205
|
+
return !(0, _htElementUtils.isEdgeGroupAgent)(edge);
|
206
|
+
}); // console.log("edges", edges);
|
194
207
|
|
195
208
|
var showPhy = types.indexOf("phy") >= 0;
|
196
209
|
var showAgg = types.indexOf("agg") >= 0; // console.log("edges----types",showType, types,showPhy, showAgg);
|
197
210
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
var _d$attributes, _d$attributes2;
|
206
|
-
|
207
|
-
var d = topo.dataModel.getDataById(edge.getTag()); // 判断是否聚合链路
|
211
|
+
edges.forEach(function (edge) {
|
212
|
+
if (showType === 1 || showType === true) {
|
213
|
+
// 单链路全部显示
|
214
|
+
// console.log("单链路全部显示", edge);
|
215
|
+
edge.s("x.visible", true);
|
216
|
+
} else {
|
217
|
+
var d = topo.dataModel.getDataById(edge.getTag()); // 判断是否聚合链路
|
208
218
|
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
}
|
219
|
+
if (isAggLink(d)) {
|
220
|
+
edge.s("x.visible", showAgg);
|
221
|
+
} else {
|
222
|
+
// console.log("edge", edge, d, showAgg);
|
223
|
+
edge.s("x.visible", showPhy);
|
215
224
|
}
|
216
|
-
}
|
217
|
-
}
|
225
|
+
}
|
226
|
+
});
|
218
227
|
};
|
219
228
|
|
220
229
|
exports.showLinkByConfig = showLinkByConfig;
|
@@ -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);
|
@@ -259,32 +261,25 @@ function _default(topoApp) {
|
|
259
261
|
var _this2 = this;
|
260
262
|
|
261
263
|
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
262
|
-
var editState, resources, _editState$groups, groups, query, data;
|
264
|
+
var editState, resources, _editState$groups, groups, relateTopoIdList, query, data;
|
263
265
|
|
264
266
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
265
267
|
while (1) switch (_context2.prev = _context2.next) {
|
266
268
|
case 0:
|
267
269
|
editState = rootState.topoConfig;
|
268
|
-
resources = editState.resources, _editState$groups = editState.groups, groups = _editState$groups === void 0 ? [] : _editState$groups;
|
270
|
+
resources = editState.resources, _editState$groups = editState.groups, groups = _editState$groups === void 0 ? [] : _editState$groups, relateTopoIdList = editState.relateTopoIdList;
|
269
271
|
query = {
|
270
272
|
id: rootState.topoMod.topoId,
|
271
273
|
resources: resources,
|
272
|
-
groups: groups
|
274
|
+
groups: groups,
|
275
|
+
relateTopoIdList: relateTopoIdList
|
273
276
|
};
|
274
277
|
_context2.next = 5;
|
275
278
|
return _this2.getTopoByConditions(query);
|
276
279
|
|
277
280
|
case 5:
|
278
281
|
data = _context2.sent;
|
279
|
-
|
280
|
-
_rlog["default"].debug("按配置查询拓扑数据", {
|
281
|
-
config: {
|
282
|
-
resources: resources,
|
283
|
-
groups: groups
|
284
|
-
},
|
285
|
-
data: data
|
286
|
-
});
|
287
|
-
|
282
|
+
rlog.debug("按配置查询拓扑数据. 参数:", query, ", 返回结果: ", data);
|
288
283
|
return _context2.abrupt("return", data);
|
289
284
|
|
290
285
|
case 8:
|
@@ -320,14 +315,13 @@ function _default(topoApp) {
|
|
320
315
|
var _this4 = this;
|
321
316
|
|
322
317
|
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
323
|
-
var topoId, resources, groups, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
|
318
|
+
var topoId, resources, groups, relateTopoIdList, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
|
324
319
|
|
325
320
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
326
321
|
while (1) switch (_context4.prev = _context4.next) {
|
327
322
|
case 0:
|
328
|
-
|
329
|
-
|
330
|
-
topoId = params.id, resources = params.resources, groups = params.groups;
|
323
|
+
rlog.debug("getTopoByConditions--------", params);
|
324
|
+
topoId = params.id, resources = params.resources, groups = params.groups, relateTopoIdList = params.relateTopoIdList;
|
331
325
|
viewConditions = (0, _topoData2.resToConditions)(resources);
|
332
326
|
groupInfo = (0, _utils.isAvailableArray)(groups) && groups.map(function (group) {
|
333
327
|
return (0, _extends2["default"])({}, group, {
|
@@ -335,26 +329,23 @@ function _default(topoApp) {
|
|
335
329
|
resources: (0, _topoData2.resToConditions)(group.resources)
|
336
330
|
});
|
337
331
|
});
|
338
|
-
|
339
|
-
_rlog["default"].debug("getTopoByConditions--------", viewConditions, groupInfo);
|
340
|
-
|
332
|
+
rlog.debug("getTopoByConditions--------", viewConditions, groupInfo);
|
341
333
|
_context4.next = 7;
|
342
|
-
return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo);
|
334
|
+
return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, relateTopoIdList);
|
343
335
|
|
344
336
|
case 7:
|
345
337
|
data = _context4.sent;
|
346
|
-
|
347
|
-
_rlog["default"].debug("getTopoByConditions--------data", data);
|
348
|
-
|
338
|
+
rlog.debug("getTopoByConditions--------data", data);
|
349
339
|
_context4.next = 11;
|
350
340
|
return (0, _getTopoData.buildData)(data);
|
351
341
|
|
352
342
|
case 11:
|
353
343
|
data = _context4.sent;
|
354
|
-
|
344
|
+
rlog.debug("getTopoByConditions--------", data, groupInfo);
|
345
|
+
_context4.next = 15;
|
355
346
|
return Promise.all([(0, _getTopoData.addLinkData)(data), topoApp.ciTyeCache.load((0, _topoData.getCiTypes)(data)), dispatch.customIcon.loadCustomIcons()]);
|
356
347
|
|
357
|
-
case
|
348
|
+
case 15:
|
358
349
|
_yield$Promise$all = _context4.sent;
|
359
350
|
dataWithLinkDetail = _yield$Promise$all[0];
|
360
351
|
_combTopoData = (0, _topoData.combTopoData)({
|
@@ -381,7 +372,7 @@ function _default(topoApp) {
|
|
381
372
|
topoDataTrans: topoDataTrans
|
382
373
|
});
|
383
374
|
|
384
|
-
case
|
375
|
+
case 23:
|
385
376
|
case "end":
|
386
377
|
return _context4.stop();
|
387
378
|
}
|
@@ -408,9 +399,7 @@ function _default(topoApp) {
|
|
408
399
|
}].concat(displayConfig.saveHistories || [])
|
409
400
|
}))
|
410
401
|
};
|
411
|
-
|
412
|
-
_rlog["default"].debug("saveGlobalConfig", config);
|
413
|
-
|
402
|
+
rlog.debug("saveGlobalConfig", config);
|
414
403
|
_context5.next = 5;
|
415
404
|
return topoApp.serverApi.saveTopoSettings(topoApp.id, config);
|
416
405
|
|
@@ -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;
|