@riil-frontend/component-topology 12.1.0-dev.9 → 12.1.2
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 +14 -14
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -1
- package/es/core/components/TopoView/topoView.js +7 -4
- package/es/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +11 -3
- 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/hooks/useGraphAlarmDisplay.js +4 -0
- package/es/core/hooks/usePolling.js +2 -1
- package/es/core/hooks/useTopoEdit.js +208 -243
- package/es/core/models/AttributeMetricDisplay.js +4 -3
- package/es/core/models/HistoryManager.js +11 -9
- package/es/core/models/TopoApp.js +17 -15
- package/es/core/models/topoData.js +7 -14
- package/es/core/models/utils/linkUtils.js +2 -2
- package/es/core/store/models/topoConfig.js +7 -11
- package/es/core/utils/edgeUtil.js +7 -11
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +1 -1
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.module.scss +1 -1
- package/es/networkTopo/models/LinkDynamicStyleExecutor.js +7 -63
- package/es/networkTopo/utils/exitLinkUtil.js +23 -11
- package/es/style.js +1 -1
- package/es/utils/clusterUtil.js +3 -3
- package/es/utils/htElementUtils.js +11 -109
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -1
- package/lib/core/components/TopoView/topoView.js +15 -19
- package/lib/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +12 -3
- 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/hooks/useGraphAlarmDisplay.js +4 -0
- package/lib/core/hooks/usePolling.js +6 -5
- package/lib/core/hooks/useTopoEdit.js +214 -267
- package/lib/core/models/AttributeMetricDisplay.js +6 -6
- package/lib/core/models/HistoryManager.js +13 -17
- package/lib/core/models/TopoApp.js +18 -15
- package/lib/core/models/topoData.js +7 -14
- package/lib/core/models/utils/linkUtils.js +1 -1
- package/lib/core/store/models/topoConfig.js +13 -25
- package/lib/core/utils/edgeUtil.js +6 -10
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +1 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.module.scss +1 -1
- package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +6 -64
- package/lib/networkTopo/utils/exitLinkUtil.js +23 -11
- package/lib/style.js +1 -1
- package/lib/utils/clusterUtil.js +2 -2
- package/lib/utils/htElementUtils.js +12 -120
- package/package.json +2 -2
- package/es/networkTopo/models/LinkTagsTipsBuilder.js +0 -235
- package/lib/networkTopo/models/LinkTagsTipsBuilder.js +0 -245
@@ -1,13 +1,14 @@
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
4
|
-
import
|
4
|
+
import Logger from 'loglevel';
|
5
5
|
import { DEFAULT_NODE_TAG_COMMON_CONFIG, DEFAULT_TIP_COMMON_CONFIG } from "../../constants/ResourceInfoDisplay";
|
6
6
|
import { isMonitoring } from "../utils/manageStatusUtil";
|
7
7
|
import AttributeFormatter from "./attributeFormatter";
|
8
8
|
import DictCache from "./cache/DictCache";
|
9
9
|
import { getNodesNameVisible as _getNodesNameVisible, updateNodesNameVisible as _updateNodesNameVisible } from "./utils/nodeNameVisibleUtil";
|
10
10
|
import { translateCisRefAttributeName } from "../../utils/ciRefAttributeTranslateUtil";
|
11
|
+
var rlog = Logger.getLogger('topo');
|
11
12
|
|
12
13
|
function isGraphField(item) {
|
13
14
|
return item.type === 'graph';
|
@@ -526,7 +527,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
526
527
|
tags: tags
|
527
528
|
});
|
528
529
|
});
|
529
|
-
rlog.debug('
|
530
|
+
rlog.debug(' ==> ht: 推送标注', elementTagsAndTips);
|
530
531
|
var htTopo = topo.getHtTopo();
|
531
532
|
|
532
533
|
if (htTopo) {
|
@@ -537,7 +538,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
537
538
|
try {
|
538
539
|
htTopo.loadTagAndTip(JSON.parse(JSON.stringify(elementTagsAndTips)));
|
539
540
|
} catch (error) {
|
540
|
-
rlog.error('
|
541
|
+
rlog.error(' ==> ht: 推送标注失败', error);
|
541
542
|
}
|
542
543
|
|
543
544
|
(_topo$historyManager2 = topo.historyManager) === null || _topo$historyManager2 === void 0 ? void 0 : _topo$historyManager2.setDisabled(false, '加载标注');
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import { rlog } from '@riil-frontend/component-topology-utils';
|
3
|
+
import Logger from 'loglevel';
|
4
|
+
var log = Logger.getLogger('topo.HistoryManager');
|
3
5
|
var ht = window.ht;
|
4
6
|
|
5
7
|
var HistoryManager = /*#__PURE__*/function () {
|
@@ -10,7 +12,7 @@ var HistoryManager = /*#__PURE__*/function () {
|
|
10
12
|
this.topo = topo;
|
11
13
|
this.htHistoryManager = htHistoryManager;
|
12
14
|
htHistoryManager.clear();
|
13
|
-
|
15
|
+
log.info('HistoryManager 初始化', htHistoryManager);
|
14
16
|
this.updateStore = this.updateStore.bind(this);
|
15
17
|
this.init();
|
16
18
|
}
|
@@ -58,10 +60,10 @@ var HistoryManager = /*#__PURE__*/function () {
|
|
58
60
|
|
59
61
|
_proto.setDisabled = function setDisabled(disabled, message) {
|
60
62
|
this.htHistoryManager.setDisabled(disabled);
|
61
|
-
|
63
|
+
log.debug("HistoryManager.setDisabled: " + (disabled ? '禁用' : '启用') + ". <" + message + ">, " + this.toString() + ", ", 'Histories: ', this.getHistories());
|
62
64
|
};
|
63
65
|
|
64
|
-
_proto.beginTransaction = function beginTransaction() {
|
66
|
+
_proto.beginTransaction = function beginTransaction(name) {
|
65
67
|
var _this = this;
|
66
68
|
|
67
69
|
this.htHistoryManager.beginTransaction();
|
@@ -92,7 +94,7 @@ var HistoryManager = /*#__PURE__*/function () {
|
|
92
94
|
oldValue: _this.topo.store.getModelState(item.modelName)[item.property]
|
93
95
|
});
|
94
96
|
});
|
95
|
-
|
97
|
+
log.debug("HistoryManager.beginTransaction: " + this.toString(), this.getHistories());
|
96
98
|
};
|
97
99
|
|
98
100
|
_proto.addStoreHistory = function addStoreHistory() {
|
@@ -117,16 +119,16 @@ var HistoryManager = /*#__PURE__*/function () {
|
|
117
119
|
type: 'store',
|
118
120
|
data: storeChanged
|
119
121
|
});
|
120
|
-
|
122
|
+
log.debug('HistoryManager.addStoreHistory', storeChanged);
|
121
123
|
}
|
122
124
|
|
123
125
|
this.storeHistory = [];
|
124
126
|
};
|
125
127
|
|
126
|
-
_proto.endTransaction = function endTransaction() {
|
128
|
+
_proto.endTransaction = function endTransaction(name) {
|
127
129
|
this.addStoreHistory();
|
128
130
|
this.htHistoryManager.endTransaction();
|
129
|
-
|
131
|
+
log.debug("HistoryManager.endTransaction: " + this.toString(), this.getHistories());
|
130
132
|
};
|
131
133
|
|
132
134
|
_proto.clear = function clear() {
|
@@ -170,7 +172,7 @@ var HistoryManager = /*#__PURE__*/function () {
|
|
170
172
|
return;
|
171
173
|
}
|
172
174
|
|
173
|
-
|
175
|
+
log.debug('HistoryManager.undo', this.getHistories(), this.getHistoryIndex());
|
174
176
|
var storeHistory = this.getCurrentStoreHistory(true);
|
175
177
|
|
176
178
|
if (storeHistory) {
|
@@ -188,7 +190,7 @@ var HistoryManager = /*#__PURE__*/function () {
|
|
188
190
|
_proto.redo = function redo() {
|
189
191
|
var _this4 = this;
|
190
192
|
|
191
|
-
|
193
|
+
log.debug('HistoryManager.redo', this.getHistories(), this.getHistoryIndex());
|
192
194
|
var storeHistory = this.getCurrentStoreHistory(false);
|
193
195
|
|
194
196
|
if (storeHistory) {
|
@@ -24,7 +24,7 @@ import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
|
|
24
24
|
import SelectionModel from "./SelectionModel";
|
25
25
|
import CiCache from "./cache/CiCache"; // eslint-disable-next-line no-undef
|
26
26
|
|
27
|
-
var version = typeof "12.1.
|
27
|
+
var version = typeof "12.1.2" === 'string' ? "12.1.2" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
@@ -508,38 +508,39 @@ var Topo = /*#__PURE__*/function () {
|
|
508
508
|
while (1) switch (_context12.prev = _context12.next) {
|
509
509
|
case 0:
|
510
510
|
rlog.info('TopoApp.enterEditMode');
|
511
|
+
this.historyManager = null;
|
511
512
|
|
512
513
|
if (!this.options.onSwitchToEditModeBegin) {
|
513
|
-
_context12.next =
|
514
|
+
_context12.next = 5;
|
514
515
|
break;
|
515
516
|
}
|
516
517
|
|
517
|
-
_context12.next =
|
518
|
+
_context12.next = 5;
|
518
519
|
return this.options.onSwitchToEditModeBegin(this);
|
519
520
|
|
520
|
-
case
|
521
|
+
case 5:
|
521
522
|
topoDispatchers = this.store.getModelDispatchers('topoMod');
|
522
|
-
_context12.next =
|
523
|
+
_context12.next = 8;
|
523
524
|
return topoDispatchers.update({
|
524
525
|
viewState: 'edit'
|
525
526
|
});
|
526
527
|
|
527
|
-
case
|
528
|
-
_context12.next =
|
528
|
+
case 8:
|
529
|
+
_context12.next = 10;
|
529
530
|
return this.view.switchToEditMode();
|
530
531
|
|
531
|
-
case
|
532
|
+
case 10:
|
532
533
|
updateEdgeExpanded(this);
|
533
534
|
|
534
535
|
if (!this.options.onSwitchToEditMode) {
|
535
|
-
_context12.next =
|
536
|
+
_context12.next = 14;
|
536
537
|
break;
|
537
538
|
}
|
538
539
|
|
539
|
-
_context12.next =
|
540
|
+
_context12.next = 14;
|
540
541
|
return this.options.onSwitchToEditMode(this);
|
541
542
|
|
542
|
-
case
|
543
|
+
case 14:
|
543
544
|
if (this.getDataModel()) {
|
544
545
|
// 更新节点名称显示隐藏
|
545
546
|
this.attributeMetricDisplay.updateNodesNameVisible();
|
@@ -549,7 +550,7 @@ var Topo = /*#__PURE__*/function () {
|
|
549
550
|
iconManageDispatchers = this.store.getModelDispatchers('customIcon');
|
550
551
|
iconManageDispatchers.loadEditorIcons();
|
551
552
|
|
552
|
-
case
|
553
|
+
case 17:
|
553
554
|
case "end":
|
554
555
|
return _context12.stop();
|
555
556
|
}
|
@@ -573,18 +574,19 @@ var Topo = /*#__PURE__*/function () {
|
|
573
574
|
return this.view.switchToViewMode();
|
574
575
|
|
575
576
|
case 2:
|
577
|
+
this.historyManager = null;
|
576
578
|
editDispatchers = this.store.getModelDispatchers('topoConfig');
|
577
579
|
editDispatchers.switchToViewMode(this.id);
|
578
580
|
|
579
581
|
if (!this.options.onSwitchToViewMode) {
|
580
|
-
_context13.next =
|
582
|
+
_context13.next = 8;
|
581
583
|
break;
|
582
584
|
}
|
583
585
|
|
584
|
-
_context13.next =
|
586
|
+
_context13.next = 8;
|
585
587
|
return this.options.onSwitchToViewMode(this);
|
586
588
|
|
587
|
-
case
|
589
|
+
case 8:
|
588
590
|
case "end":
|
589
591
|
return _context13.stop();
|
590
592
|
}
|
@@ -41,7 +41,7 @@ export function saveTopo(_x) {
|
|
41
41
|
|
42
42
|
function _saveTopo() {
|
43
43
|
_saveTopo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
|
44
|
-
var topoService, topoId, template, layout, backgroundId, globalConfig, serialize, resources, groups, relateTopoIdList, viewGroupId, groupInfo, viewResources
|
44
|
+
var topoService, topoId, template, layout, backgroundId, globalConfig, serialize, resources, groups, relateTopoIdList, viewGroupId, groupInfo, viewResources;
|
45
45
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
46
46
|
while (1) switch (_context.prev = _context.next) {
|
47
47
|
case 0:
|
@@ -72,7 +72,7 @@ function _saveTopo() {
|
|
72
72
|
|
73
73
|
case 8:
|
74
74
|
if (!(resources || groups)) {
|
75
|
-
_context.next =
|
75
|
+
_context.next = 15;
|
76
76
|
break;
|
77
77
|
}
|
78
78
|
|
@@ -94,30 +94,23 @@ function _saveTopo() {
|
|
94
94
|
});
|
95
95
|
}
|
96
96
|
|
97
|
-
linkIps = []; // resources?.static.map((nodeId) => {
|
98
|
-
// if (nodeId.startsWith("ip_")) {
|
99
|
-
// linkIps.push(nodeId.replace("ip_", ""));
|
100
|
-
// }
|
101
|
-
// });
|
102
|
-
|
103
97
|
rlog.debug("saveTopo-groupInfo", groupInfo);
|
104
|
-
_context.next =
|
98
|
+
_context.next = 15;
|
105
99
|
return topoService.bindResourceToTopo(topoId, {
|
106
100
|
groups: groupInfo,
|
107
|
-
linkIps: linkIps,
|
108
101
|
relateTopoIdList: relateTopoIdList
|
109
102
|
});
|
110
103
|
|
111
|
-
case
|
104
|
+
case 15:
|
112
105
|
if (!serialize) {
|
113
|
-
_context.next =
|
106
|
+
_context.next = 18;
|
114
107
|
break;
|
115
108
|
}
|
116
109
|
|
117
|
-
_context.next =
|
110
|
+
_context.next = 18;
|
118
111
|
return topoService.saveSerializeData(topoId, serialize);
|
119
112
|
|
120
|
-
case
|
113
|
+
case 18:
|
121
114
|
case "end":
|
122
115
|
return _context.stop();
|
123
116
|
}
|
@@ -4,7 +4,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
import keyBy from "lodash/keyBy";
|
5
5
|
import _ from "lodash"; // 查询所有连线
|
6
6
|
|
7
|
-
import { getEdges,
|
7
|
+
import { getEdges, isEdgeGroupAgent } from "../../../utils/htElementUtils";
|
8
8
|
import CiTypeCache from "../cache/CiTypeCache";
|
9
9
|
import CiCache from "../cache/CiCache"; // const interfaceTypeMap = {
|
10
10
|
// "network.interface": {
|
@@ -172,7 +172,7 @@ export var showLinkByConfig = function showLinkByConfig(props) {
|
|
172
172
|
var gv = topo.getGraphView();
|
173
173
|
var dm = gv.getDataModel();
|
174
174
|
var edges = getEdges(dm).filter(function (edge) {
|
175
|
-
return !
|
175
|
+
return !isEdgeGroupAgent(edge);
|
176
176
|
}); // console.log("edges", edges);
|
177
177
|
|
178
178
|
var showPhy = types.indexOf("phy") >= 0;
|
@@ -8,13 +8,14 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
import { getUUID, isAvailableArray } from "@riil-frontend/utils";
|
9
9
|
import { transformTopoElements } from "@riil-frontend/component-topology-graph/es/utils";
|
10
10
|
import { TOPO_PARENT_ID } from "@riil-frontend/component-topology-common/es/services/topo";
|
11
|
-
import
|
11
|
+
import Logger from 'loglevel';
|
12
12
|
import { removeFromArray } from "../../../utils/format";
|
13
13
|
import { DEFAULT_GROUP } from "../../../utils/template";
|
14
14
|
import { combTopoData, getCiTypes } from "../../../utils/topoData";
|
15
15
|
import { saveTopo as _saveTopo, resToConditions, getLayoutId } from "../../../core/models/topoData";
|
16
16
|
import networkLinkServer from "../../../networkTopo/services/topo/networkLink";
|
17
17
|
import { addLinkData, buildData as buildTopoData } from "../../../networkTopo/getTopoData";
|
18
|
+
var rlog = Logger.getLogger('topo');
|
18
19
|
|
19
20
|
var newGroupWithUUID = function newGroupWithUUID(group) {
|
20
21
|
if (group === void 0) {
|
@@ -259,13 +260,7 @@ export default function (topoApp) {
|
|
259
260
|
|
260
261
|
case 5:
|
261
262
|
data = _context2.sent;
|
262
|
-
rlog.debug("
|
263
|
-
config: {
|
264
|
-
resources: resources,
|
265
|
-
groups: groups
|
266
|
-
},
|
267
|
-
data: data
|
268
|
-
});
|
263
|
+
rlog.debug("按配置查询拓扑数据. 参数:", query, ", 返回结果: ", data);
|
269
264
|
return _context2.abrupt("return", data);
|
270
265
|
|
271
266
|
case 8:
|
@@ -327,10 +322,11 @@ export default function (topoApp) {
|
|
327
322
|
|
328
323
|
case 11:
|
329
324
|
data = _context4.sent;
|
330
|
-
|
325
|
+
rlog.debug("getTopoByConditions--------", data, groupInfo);
|
326
|
+
_context4.next = 15;
|
331
327
|
return Promise.all([addLinkData(data), topoApp.ciTyeCache.load(getCiTypes(data)), dispatch.customIcon.loadCustomIcons()]);
|
332
328
|
|
333
|
-
case
|
329
|
+
case 15:
|
334
330
|
_yield$Promise$all = _context4.sent;
|
335
331
|
dataWithLinkDetail = _yield$Promise$all[0];
|
336
332
|
_combTopoData = combTopoData({
|
@@ -357,7 +353,7 @@ export default function (topoApp) {
|
|
357
353
|
topoDataTrans: topoDataTrans
|
358
354
|
});
|
359
355
|
|
360
|
-
case
|
356
|
+
case 23:
|
361
357
|
case "end":
|
362
358
|
return _context4.stop();
|
363
359
|
}
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
2
2
|
import { showLinkByConfig } from "../models/utils/linkUtils";
|
3
|
-
import {
|
3
|
+
import { isEdgeGroupAgent } from "../../utils/htElementUtils";
|
4
4
|
/**
|
5
5
|
* 是否手工连线
|
6
6
|
* @param {*} edge
|
7
7
|
*/
|
8
8
|
|
9
9
|
export function isCustomEdge(edge) {
|
10
|
-
return !
|
10
|
+
return !isEdgeGroupAgent(edge) && (edge.a('type') == 'line' || !edge.a('type'));
|
11
11
|
}
|
12
12
|
/**
|
13
13
|
* 根据配置更新连线展开折叠状态
|
@@ -16,7 +16,7 @@ export function isCustomEdge(edge) {
|
|
16
16
|
*/
|
17
17
|
|
18
18
|
export var updateEdgeExpanded = function updateEdgeExpanded(topo) {
|
19
|
-
var _topo$historyManager, _topo$historyManager2;
|
19
|
+
var _topo$historyManager, _topo$historyManager2, _topo$linkDynamicStyl;
|
20
20
|
|
21
21
|
var _topo$store$getModelS = topo.store.getModelState("topoMod"),
|
22
22
|
viewState = _topo$store$getModelS.viewState;
|
@@ -29,8 +29,7 @@ export var updateEdgeExpanded = function updateEdgeExpanded(topo) {
|
|
29
29
|
}
|
30
30
|
|
31
31
|
var _topo$store$getModelS2 = topo.store.getModelState("displayConfig"),
|
32
|
-
expandAllEdges = _topo$store$getModelS2.expandAllEdges;
|
33
|
-
|
32
|
+
expandAllEdges = _topo$store$getModelS2.expandAllEdges;
|
34
33
|
|
35
34
|
(_topo$historyManager = topo.historyManager) === null || _topo$historyManager === void 0 ? void 0 : _topo$historyManager.setDisabled(true, '连线展开控制');
|
36
35
|
|
@@ -39,10 +38,10 @@ export var updateEdgeExpanded = function updateEdgeExpanded(topo) {
|
|
39
38
|
topo: topo,
|
40
39
|
showType: 1
|
41
40
|
});
|
42
|
-
htTopo.
|
41
|
+
htTopo.toggleAllEdgeGroups(false);
|
43
42
|
rlog.debug("updateEdgeExpanded 折叠");
|
44
43
|
} else {
|
45
|
-
htTopo.
|
44
|
+
htTopo.toggleAllEdgeGroups(true);
|
46
45
|
showLinkByConfig({
|
47
46
|
topo: topo,
|
48
47
|
showType: expandAllEdges,
|
@@ -52,8 +51,5 @@ export var updateEdgeExpanded = function updateEdgeExpanded(topo) {
|
|
52
51
|
}
|
53
52
|
|
54
53
|
(_topo$historyManager2 = topo.historyManager) === null || _topo$historyManager2 === void 0 ? void 0 : _topo$historyManager2.setDisabled(false, '连线展开控制');
|
55
|
-
|
56
|
-
if (topo.linkDynamicStyleExecutor) {
|
57
|
-
topo.linkDynamicStyleExecutor.execute();
|
58
|
-
}
|
54
|
+
(_topo$linkDynamicStyl = topo.linkDynamicStyleExecutor) === null || _topo$linkDynamicStyl === void 0 ? void 0 : _topo$linkDynamicStyl.execute();
|
59
55
|
};
|
@@ -1,7 +1,5 @@
|
|
1
|
-
import { rlog } from '@riil-frontend/component-topology-utils';
|
2
1
|
import { isClusterHtElement } from "../../utils/clusterUtil";
|
3
|
-
import {
|
4
|
-
import { getLinksBetweenNodes } from "../utils/linkUtil"; // network_link.actual_bandwidth
|
2
|
+
import { isNode } from "../../utils/htElementUtils"; // network_link.actual_bandwidth
|
5
3
|
|
6
4
|
function calcEdgeWidth(actualBandwidth) {
|
7
5
|
if (!actualBandwidth) {
|
@@ -52,16 +50,17 @@ var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
|
|
52
50
|
var _proto = LinkDynamicStyleExecutor.prototype;
|
53
51
|
|
54
52
|
_proto.execute = function execute() {
|
55
|
-
var
|
53
|
+
var _topo$historyManager,
|
54
|
+
_this = this,
|
55
|
+
_topo$historyManager2;
|
56
56
|
|
57
57
|
var topo = this.topo;
|
58
58
|
|
59
59
|
var _topo$dataModel$getDa = topo.dataModel.getData(),
|
60
|
-
links = _topo$dataModel$getDa.links
|
61
|
-
linkGroups = _topo$dataModel$getDa.linkGroups;
|
60
|
+
links = _topo$dataModel$getDa.links;
|
62
61
|
|
63
62
|
var dataModel = this.topo.getDataModel();
|
64
|
-
|
63
|
+
(_topo$historyManager = topo.historyManager) === null || _topo$historyManager === void 0 ? void 0 : _topo$historyManager.setDisabled(true, '链路动态粗细'); // 1、如果连线可见,设置线宽
|
65
64
|
|
66
65
|
links.forEach(function (link) {
|
67
66
|
var edge = dataModel.getDataByTag(link.id);
|
@@ -69,63 +68,8 @@ var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
|
|
69
68
|
if (edge) {
|
70
69
|
edge.s('edge.width', _this.calcLinkEdgeWidth(link));
|
71
70
|
}
|
72
|
-
}); // 2、如果连线组关联链路并可见,设置线宽
|
73
|
-
|
74
|
-
linkGroups.forEach(function (link) {
|
75
|
-
// 聚合链路是连线/连线组,并可以查询到
|
76
|
-
var edge = topo.getDataModel().getDataByTag(link.id);
|
77
|
-
|
78
|
-
if (edge) {
|
79
|
-
edge.s('edge.width', _this.calcLinkEdgeWidth(link));
|
80
|
-
return;
|
81
|
-
} // 聚合链路是连线组(编辑模式还未关联业务信息)
|
82
|
-
|
83
|
-
|
84
|
-
var edgeGroup = getEdgeGroupByNodeTags(dataModel, link.source, link.target);
|
85
|
-
|
86
|
-
if (edgeGroup) {
|
87
|
-
var edgeGroupAgent = edgeGroup.getEdgeGroupAgent(); // 判断是显示的连线组元素
|
88
|
-
|
89
|
-
if (edgeGroupAgent) {
|
90
|
-
edgeGroup.getEdgeGroupAgent().s('edge.width', _this.calcLinkEdgeWidth(link));
|
91
|
-
}
|
92
|
-
} else {
|
93
|
-
rlog.warn('动态链路样式执行:未找到聚合链路的ht元素', link);
|
94
|
-
}
|
95
|
-
}); // 3、如果连线组未关联链路并可见,设置线宽。
|
96
|
-
|
97
|
-
var edges = getEdges(dataModel);
|
98
|
-
edges.forEach(function (edge) {
|
99
|
-
try {
|
100
|
-
// 获取两端代理节点
|
101
|
-
var sourceAgent = edge.getSourceAgent();
|
102
|
-
var targetAgent = edge.getTargetAgent();
|
103
|
-
var sourceId = sourceAgent.getTag();
|
104
|
-
var targetId = targetAgent.getTag(); // 查询是否有聚合链路
|
105
|
-
|
106
|
-
var aggLink = linkGroups.find(function (link) {
|
107
|
-
return link.source === sourceId && link.target === targetId || link.target === sourceId && link.source === targetId;
|
108
|
-
}); // 如果连线组未关联链路并可见
|
109
|
-
|
110
|
-
if (!aggLink && edge.isEdgeGroupAgent()) {
|
111
|
-
// 查询两端代理节点(包含子节点)间的子链路列表
|
112
|
-
var sourceCiIds = getChildrenNodeCiIds([sourceAgent]);
|
113
|
-
var targetCiIds = getChildrenNodeCiIds([targetAgent]);
|
114
|
-
var aggLinks = getLinksBetweenNodes(linkGroups, sourceCiIds, targetCiIds);
|
115
|
-
var phyLinks = getLinksBetweenNodes(links, sourceCiIds, targetCiIds);
|
116
|
-
var linkBetweenNodes = aggLinks.length ? aggLinks : phyLinks; // 如果有子链路,计算线宽并设置
|
117
|
-
|
118
|
-
if (linkBetweenNodes.length) {
|
119
|
-
var edgeWidth = _this.calcEdgeGroupEdgeWidth(linkBetweenNodes);
|
120
|
-
|
121
|
-
edge.s('edge.width', edgeWidth);
|
122
|
-
}
|
123
|
-
}
|
124
|
-
} catch (error) {
|
125
|
-
rlog.error('连线组未关联链路并可见,设置线宽:异常', edge, error);
|
126
|
-
}
|
127
71
|
});
|
128
|
-
topo.historyManager
|
72
|
+
(_topo$historyManager2 = topo.historyManager) === null || _topo$historyManager2 === void 0 ? void 0 : _topo$historyManager2.setDisabled(false, '链路动态粗细');
|
129
73
|
}
|
130
74
|
/**
|
131
75
|
* 处理单个连线组切换。有链路时设置
|
@@ -239,9 +239,10 @@ function updateLinkTarget(links, nodes) {
|
|
239
239
|
|
240
240
|
|
241
241
|
export function processByConditionResult(topoData, groupConfigs) {
|
242
|
-
var
|
242
|
+
var groups = topoData.groups,
|
243
|
+
nodes = topoData.nodes,
|
243
244
|
links = topoData.links;
|
244
|
-
var ipNodes = getIpNodes(groupConfigs,
|
245
|
+
var ipNodes = getIpNodes(groupConfigs, topoData); // 出口链路目的端设置为IP节点或者ping资源节点id
|
245
246
|
|
246
247
|
var newLinks = updateLinkTarget(links, nodes);
|
247
248
|
return _extends({}, topoData, {
|
@@ -249,15 +250,26 @@ export function processByConditionResult(topoData, groupConfigs) {
|
|
249
250
|
links: newLinks
|
250
251
|
});
|
251
252
|
|
252
|
-
function getIpNodes(groupConfigs,
|
253
|
-
var
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
253
|
+
function getIpNodes(groupConfigs, _ref) {
|
254
|
+
var groups = _ref.groups,
|
255
|
+
nodes = _ref.nodes;
|
256
|
+
var ipNodes = [];
|
257
|
+
groupConfigs.forEach(function (g) {
|
258
|
+
g.condition.linkIps // 过滤ping资源对应的ip节点
|
259
|
+
.filter(function (ip) {
|
260
|
+
return !findPingNode(nodes, ip);
|
261
|
+
}).map(function (ip) {
|
262
|
+
var topoGroup = g.topoGroup;
|
263
|
+
var group = groups.find(function (item) {
|
264
|
+
return item.id === topoGroup.id || item.tag === topoGroup.tag;
|
265
|
+
});
|
266
|
+
ipNodes.push(_extends({}, buildIpNode(ip), {
|
267
|
+
// 解决区域里有ip添加资源ip消失的问题
|
268
|
+
'groupId': group === null || group === void 0 ? void 0 : group.id,
|
269
|
+
'groupTag': group === null || group === void 0 ? void 0 : group.tag
|
270
|
+
}));
|
271
|
+
});
|
260
272
|
});
|
261
|
-
return
|
273
|
+
return ipNodes;
|
262
274
|
}
|
263
275
|
}
|
package/es/style.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import '@riil-frontend/component-topology-graph/es/style';
|
2
2
|
import '@alifd/next/es/box/style';
|
3
|
-
import '@riil-frontend/component-topology-utils/es/style';
|
4
3
|
import '@alifd/next/es/message/style';
|
4
|
+
import '@riil-frontend/component-topology-utils/es/style';
|
5
5
|
import '@riil-frontend/utils/es/style';
|
6
6
|
import '@riil-frontend/component-riil-event-emitter/es/style';
|
7
7
|
import '@alifd/next/es/menu-button/style';
|
package/es/utils/clusterUtil.js
CHANGED
@@ -5,7 +5,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
5
5
|
*/
|
6
6
|
import { transformTopoElements } from "@riil-frontend/component-topology-graph/es/utils";
|
7
7
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
8
|
-
import { getGroups,
|
8
|
+
import { getGroups, containsElement } from "./htElementUtils";
|
9
9
|
import { findGroupChildren } from "./topoData";
|
10
10
|
export function isCluster(node) {
|
11
11
|
return !!node.cluster;
|
@@ -76,7 +76,7 @@ export function isClusterHtElement(element) {
|
|
76
76
|
return !!element.a('cluster');
|
77
77
|
}
|
78
78
|
export function isClusterMemberHtElement(element) {
|
79
|
-
return element
|
79
|
+
return (element === null || element === void 0 ? void 0 : element.getParent()) && isClusterHtElement(element.getParent());
|
80
80
|
}
|
81
81
|
/**
|
82
82
|
* 集群无权限时收起
|
@@ -111,7 +111,7 @@ export function upgradeV103GraphClusterNode(topo, topoData) {
|
|
111
111
|
var topoDataTrans = transformTopoElements(topoData);
|
112
112
|
var dm = topo.getDataModel();
|
113
113
|
var unExistedList = topoDataTrans.filter(function (data) {
|
114
|
-
return !
|
114
|
+
return !containsElement(dm, data);
|
115
115
|
});
|
116
116
|
|
117
117
|
if (!unExistedList.length) {
|