@riil-frontend/component-topology 12.1.2 → 13.0.0-dev.10
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/index.css +1 -1
- package/build/index.js +29 -29
- package/es/components/ColorPanel/index.js +68 -58
- package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +10 -91
- package/es/core/editor/components/Toolbar/widgets/components/FontColorDropdown.js +120 -0
- package/es/core/editor/components/Toolbar/widgets/components/FontStyleSelect.js +21 -15
- package/es/core/hooks/useResourceConfig.js +1 -2
- package/es/core/hooks/useTopoEdit.js +2 -1
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/topoData.js +3 -4
- package/es/core/models/utils/linkUtils.js +29 -24
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +4 -2
- package/es/networkTopo/services/topo/basic.js +27 -17
- package/es/networkTopo/utils/__tests__/relateTopoData.js +205 -0
- package/es/networkTopo/utils/exitLinkUtil.js +2 -2
- package/es/networkTopo/utils/relateTopoDataUtil.js +149 -0
- package/es/utils/ResourceConfigUtil.js +1 -16
- package/lib/components/ColorPanel/index.js +71 -59
- package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +11 -95
- package/lib/core/editor/components/Toolbar/widgets/components/FontColorDropdown.js +136 -0
- package/lib/core/editor/components/Toolbar/widgets/components/FontStyleSelect.js +21 -15
- package/lib/core/hooks/useResourceConfig.js +1 -2
- package/lib/core/hooks/useTopoEdit.js +2 -1
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/topoData.js +3 -4
- package/lib/core/models/utils/linkUtils.js +29 -24
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +6 -2
- package/lib/networkTopo/services/topo/basic.js +32 -18
- package/lib/networkTopo/utils/__tests__/relateTopoData.js +210 -0
- package/lib/networkTopo/utils/exitLinkUtil.js +2 -2
- package/lib/networkTopo/utils/relateTopoDataUtil.js +164 -0
- package/lib/utils/ResourceConfigUtil.js +1 -16
- package/package.json +2 -2
- /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
@@ -1,7 +1,5 @@
|
|
1
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
3
2
|
import _extends from "@babel/runtime/helpers/extends";
|
4
|
-
var _excluded = ["groups", "resources"];
|
5
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
6
4
|
import { request } from '@riil-frontend/component-topology-utils';
|
7
5
|
import { rlog } from '@riil-frontend/component-topology-utils';
|
@@ -9,6 +7,7 @@ import blackList from "./blacklist";
|
|
9
7
|
import { TOPO_API_ROOT } from "./constants";
|
10
8
|
import { getBatchCi as _getBatchCi, getBatchCiMetric as _getBatchCiMetric } from "../model";
|
11
9
|
import { processByConditionResult, processExitLink } from "../../utils/exitLinkUtil";
|
10
|
+
import * as relateTopoDataUtil from "../../utils/relateTopoDataUtil";
|
12
11
|
var API_ROOT = TOPO_API_ROOT;
|
13
12
|
/**
|
14
13
|
* 拓扑图(看做一个容器)的“父容器”ID
|
@@ -49,7 +48,7 @@ function prepareResourceParams(conditions, query) {
|
|
49
48
|
return {
|
50
49
|
dynamicCondition: dynamicCondition,
|
51
50
|
fixedConditionIdList: (staticRes || []).filter(function (ciId) {
|
52
|
-
return !ciId.
|
51
|
+
return !ciId.includes(':');
|
53
52
|
}),
|
54
53
|
linkIps: (staticRes || []).filter(function (ciId) {
|
55
54
|
return ciId.startsWith('ip:');
|
@@ -98,7 +97,8 @@ function prepareGroupParams(modifiedGroups) {
|
|
98
97
|
};
|
99
98
|
}).filter(Boolean);
|
100
99
|
return {
|
101
|
-
groups: groups
|
100
|
+
groups: groups,
|
101
|
+
relateTopoIdList: relateTopoDataUtil.getRelateTopoIdListFromConfig(modifiedGroups)
|
102
102
|
};
|
103
103
|
}
|
104
104
|
|
@@ -389,16 +389,20 @@ export default _extends({
|
|
389
389
|
|
390
390
|
case 2:
|
391
391
|
result = _context12.sent;
|
392
|
-
|
392
|
+
result = _extends({}, result, {
|
393
393
|
nodes: (_result$nodes = result.nodes) !== null && _result$nodes !== void 0 ? _result$nodes : [],
|
394
394
|
links: ((_result$links = result.links) !== null && _result$links !== void 0 ? _result$links : []).map(function (item) {
|
395
395
|
return _extends({}, item, {
|
396
396
|
ciType: 'network_link'
|
397
397
|
});
|
398
|
-
})
|
399
|
-
|
398
|
+
}),
|
399
|
+
serialize: result.serialize ? JSON.parse(result.serialize) : undefined
|
400
|
+
});
|
401
|
+
result = relateTopoDataUtil.processBothTopoData(result);
|
402
|
+
result = processExitLink(result);
|
403
|
+
return _context12.abrupt("return", result);
|
400
404
|
|
401
|
-
case
|
405
|
+
case 7:
|
402
406
|
case "end":
|
403
407
|
return _context12.stop();
|
404
408
|
}
|
@@ -417,7 +421,7 @@ export default _extends({
|
|
417
421
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
|
418
422
|
var _result$nodes2, _result$links2;
|
419
423
|
|
420
|
-
var data,
|
424
|
+
var data, params, result;
|
421
425
|
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
422
426
|
while (1) switch (_context13.prev = _context13.next) {
|
423
427
|
case 0:
|
@@ -431,22 +435,28 @@ export default _extends({
|
|
431
435
|
});
|
432
436
|
}
|
433
437
|
|
434
|
-
|
438
|
+
params = prepareGroupParams(data);
|
435
439
|
_context13.next = 5;
|
436
|
-
return request.post(API_ROOT + "/structure/byCondition/" + id,
|
440
|
+
return request.post(API_ROOT + "/structure/byCondition/" + id, params);
|
437
441
|
|
438
442
|
case 5:
|
439
443
|
result = _context13.sent;
|
440
|
-
|
444
|
+
result = _extends({}, result, {
|
441
445
|
nodes: (_result$nodes2 = result.nodes) !== null && _result$nodes2 !== void 0 ? _result$nodes2 : [],
|
442
446
|
links: ((_result$links2 = result.links) !== null && _result$links2 !== void 0 ? _result$links2 : []).map(function (item) {
|
443
447
|
return _extends({}, item, {
|
444
448
|
ciType: 'network_link'
|
445
449
|
});
|
446
450
|
})
|
447
|
-
})
|
451
|
+
});
|
452
|
+
result = relateTopoDataUtil.processByConditionTopoData({
|
453
|
+
data: result,
|
454
|
+
config: data
|
455
|
+
});
|
456
|
+
result = processByConditionResult(result, params.groups);
|
457
|
+
return _context13.abrupt("return", result);
|
448
458
|
|
449
|
-
case
|
459
|
+
case 10:
|
450
460
|
case "end":
|
451
461
|
return _context13.stop();
|
452
462
|
}
|
@@ -463,11 +473,11 @@ export default _extends({
|
|
463
473
|
*/
|
464
474
|
bindResourceToTopo: function bindResourceToTopo(id, config) {
|
465
475
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
466
|
-
var groups, resources,
|
476
|
+
var groups, resources, newGroups, obj;
|
467
477
|
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
468
478
|
while (1) switch (_context14.prev = _context14.next) {
|
469
479
|
case 0:
|
470
|
-
groups = config.groups, resources = config.resources
|
480
|
+
groups = config.groups, resources = config.resources;
|
471
481
|
newGroups = Array.isArray(groups) ? groups : [];
|
472
482
|
|
473
483
|
if (resources) {
|
@@ -481,7 +491,7 @@ export default _extends({
|
|
481
491
|
|
482
492
|
obj = prepareGroupParams(newGroups);
|
483
493
|
_context14.next = 6;
|
484
|
-
return request.post(API_ROOT + "/resource/" + id,
|
494
|
+
return request.post(API_ROOT + "/resource/" + id, obj);
|
485
495
|
|
486
496
|
case 6:
|
487
497
|
return _context14.abrupt("return", _context14.sent);
|
@@ -0,0 +1,205 @@
|
|
1
|
+
// 二、子拓扑链路
|
2
|
+
// - 资源-子拓扑资源
|
3
|
+
// - 资源-子拓扑IP、Ping资源
|
4
|
+
// - 子拓扑资源-IP、Ping资源
|
5
|
+
// - 子拓扑资源-子拓扑资源
|
6
|
+
// - 子拓扑资源-子拓扑IP、Ping资源
|
7
|
+
export var topoLinks = [// 资源-子拓扑资源
|
8
|
+
{
|
9
|
+
ciType: 'network_link',
|
10
|
+
"id": "00000000010decab",
|
11
|
+
"name": '资源、Ping资源-子拓扑资源',
|
12
|
+
"source": "00000000010de861",
|
13
|
+
'targetType': 'topo',
|
14
|
+
"target": "6",
|
15
|
+
"operation": "delete",
|
16
|
+
"interfaceSource": "00000000010de8da",
|
17
|
+
"interfaceTarget": "00000000010de973",
|
18
|
+
"attributes": {
|
19
|
+
"network_link.to_if_connect": "r926054146526674944",
|
20
|
+
"network_link.source_device_ipv4": "172.17.166.18",
|
21
|
+
"network_link.destination_ipv4": "172.17.166.20",
|
22
|
+
"network_link.work_mode": "single",
|
23
|
+
"support_templates": "m.ethernet_link",
|
24
|
+
"destination_id": "00000000010de973",
|
25
|
+
"rated_bandwidth": 1000,
|
26
|
+
"network_link.actual_bandwidth": 1000,
|
27
|
+
"source_type": "network.interface",
|
28
|
+
"network_link.connect_type": "phy",
|
29
|
+
"display_name": "资源-子拓扑资源",
|
30
|
+
"asset_status": "2",
|
31
|
+
"destination_type": "network.interface",
|
32
|
+
"network_link.network_category": "CAN",
|
33
|
+
"network_link.source_ipv4": "172.17.166.18",
|
34
|
+
"name": "资源-子拓扑资源",
|
35
|
+
"distance_outlet": 2147483647,
|
36
|
+
"network_link.is_crucial": false,
|
37
|
+
"source_id": "00000000010de8da",
|
38
|
+
"network_link.source_device_id": "00000000010de861",
|
39
|
+
"network_link.destination_device_id": "00000000010de864",
|
40
|
+
"network_link.destination_device_ipv4": "172.17.166.20"
|
41
|
+
},
|
42
|
+
"sourceCode": null,
|
43
|
+
"level": null,
|
44
|
+
"customType": null,
|
45
|
+
"manageStatus": 3
|
46
|
+
}, // 资源-子拓扑IP、Ping资源
|
47
|
+
{
|
48
|
+
ciType: 'network_link',
|
49
|
+
"id": "00000000019990f1",
|
50
|
+
"name": "资源-子拓扑IP",
|
51
|
+
"source": "00000000010de861",
|
52
|
+
'targetType': 'topo',
|
53
|
+
"target": "6",
|
54
|
+
"operation": "delete",
|
55
|
+
"interfaceSource": "00000000010de8b3",
|
56
|
+
"interfaceTarget": "",
|
57
|
+
"attributes": {
|
58
|
+
"network_link.source_device_ipv4": "172.17.166.18",
|
59
|
+
"network_link.destination_ipv4": "1.1.1.1",
|
60
|
+
"network_link.work_mode": "AandS",
|
61
|
+
"support_templates": "m.ethernet_link",
|
62
|
+
"rated_bandwidth": 100,
|
63
|
+
"network_link.actual_bandwidth": 100,
|
64
|
+
"source_type": "network.interface",
|
65
|
+
"network_link.connect_type": "phy",
|
66
|
+
"display_name": "资源-子拓扑IP",
|
67
|
+
"asset_status": "2",
|
68
|
+
"network_link_type": "2",
|
69
|
+
"destination_type": "ip",
|
70
|
+
"network_link.role": "master",
|
71
|
+
"network_link.network_category": "CAN",
|
72
|
+
"dcs": "331268969",
|
73
|
+
"network_link.source_ipv4": "172.17.166.18",
|
74
|
+
"name": "资源-子拓扑IP",
|
75
|
+
"distance_outlet": 2147483647,
|
76
|
+
"network_link.is_crucial": false,
|
77
|
+
"source_id": "00000000010de8b3",
|
78
|
+
"network_link.source_device_id": "00000000010de861",
|
79
|
+
"network_link.destination_device_ipv4": "1.1.1.1"
|
80
|
+
},
|
81
|
+
"sourceCode": null,
|
82
|
+
"level": null,
|
83
|
+
"customType": null,
|
84
|
+
"manageStatus": 3
|
85
|
+
}, // 子拓扑资源-IP、Ping资源
|
86
|
+
{
|
87
|
+
ciType: 'network_link',
|
88
|
+
"id": "0000000001999538",
|
89
|
+
"name": "IP-子拓扑资源",
|
90
|
+
'sourceType': 'topo',
|
91
|
+
"source": "6",
|
92
|
+
"target": "",
|
93
|
+
"operation": "delete",
|
94
|
+
"interfaceSource": "00000000010de95e",
|
95
|
+
"interfaceTarget": "",
|
96
|
+
"attributes": {
|
97
|
+
"network_link.source_device_ipv4": "172.17.166.20",
|
98
|
+
"network_link.destination_ipv4": "1.5.5.5",
|
99
|
+
"network_link.work_mode": "AandS",
|
100
|
+
"support_templates": "m.ethernet_link",
|
101
|
+
"rated_bandwidth": 1000,
|
102
|
+
"network_link.actual_bandwidth": 1000,
|
103
|
+
"source_type": "network.interface",
|
104
|
+
"network_link.connect_type": "phy",
|
105
|
+
"display_name": "IP-子拓扑资源",
|
106
|
+
"asset_status": "2",
|
107
|
+
"network_link_type": "2",
|
108
|
+
"destination_type": "ip",
|
109
|
+
"network_link.role": "master",
|
110
|
+
"network_link.network_category": "CAN",
|
111
|
+
"dcs": "331268969",
|
112
|
+
"network_link.source_ipv4": "172.17.166.20",
|
113
|
+
"name": "172.17.166.20(Gi 0/1) - 1.5.5.5",
|
114
|
+
"distance_outlet": 2147483647,
|
115
|
+
"network_link.is_crucial": false,
|
116
|
+
"source_id": "00000000010de95e",
|
117
|
+
"network_link.source_device_id": "00000000010de864",
|
118
|
+
"network_link.destination_device_ipv4": "1.5.5.5"
|
119
|
+
},
|
120
|
+
"sourceCode": null,
|
121
|
+
"level": null,
|
122
|
+
"customType": null,
|
123
|
+
"manageStatus": 3
|
124
|
+
}, // 子拓扑资源-子拓扑资源
|
125
|
+
{
|
126
|
+
ciType: 'network_link',
|
127
|
+
"id": "0000000001899476",
|
128
|
+
"name": '子拓扑资源-子拓扑资源',
|
129
|
+
'sourceType': 'topo',
|
130
|
+
"source": "3",
|
131
|
+
'targetType': 'topo',
|
132
|
+
"target": "6",
|
133
|
+
"operation": "delete",
|
134
|
+
"interfaceSource": "00000000010de90e",
|
135
|
+
"interfaceTarget": "00000000010de973",
|
136
|
+
"attributes": {
|
137
|
+
"network_link.to_if_connect": "r933757920628178944",
|
138
|
+
"network_link.source_device_ipv4": "172.17.166.19",
|
139
|
+
"network_link.destination_ipv4": "172.17.166.20",
|
140
|
+
"network_link.work_mode": "single",
|
141
|
+
"support_templates": "m.ethernet_link",
|
142
|
+
"destination_id": "00000000010de973",
|
143
|
+
"rated_bandwidth": 1000,
|
144
|
+
"network_link.actual_bandwidth": 1000,
|
145
|
+
"source_type": "network.interface",
|
146
|
+
"network_link.connect_type": "phy",
|
147
|
+
"display_name": "子拓扑资源-子拓扑资源",
|
148
|
+
"asset_status": "2",
|
149
|
+
"network_link_type": "2",
|
150
|
+
"destination_type": "network.interface",
|
151
|
+
"network_link.network_category": "CAN",
|
152
|
+
"network_link.source_ipv4": "172.17.166.19",
|
153
|
+
"name": "172.17.166.19(Gi 0/50) - 172.17.166.20(Gi 0/22)",
|
154
|
+
"distance_outlet": 2147483647,
|
155
|
+
"network_link.is_crucial": false,
|
156
|
+
"source_id": "00000000010de90e",
|
157
|
+
"network_link.source_device_id": "00000000010de862",
|
158
|
+
"network_link.destination_device_id": "00000000010de864",
|
159
|
+
"network_link.destination_device_ipv4": "172.17.166.20"
|
160
|
+
},
|
161
|
+
"sourceCode": null,
|
162
|
+
"level": null,
|
163
|
+
"customType": null,
|
164
|
+
"manageStatus": 3
|
165
|
+
}, // 子拓扑资源-子拓扑IP、Ping资源
|
166
|
+
{
|
167
|
+
ciType: 'network_link',
|
168
|
+
"id": "0000000001999c86",
|
169
|
+
"name": "子拓扑资源-子拓扑IP",
|
170
|
+
'sourceType': 'topo',
|
171
|
+
"source": "3",
|
172
|
+
'targetType': 'topo',
|
173
|
+
"target": "6",
|
174
|
+
"operation": "delete",
|
175
|
+
"interfaceSource": "00000000010de95e",
|
176
|
+
"interfaceTarget": "",
|
177
|
+
"attributes": {
|
178
|
+
"network_link.source_device_ipv4": "172.17.166.20",
|
179
|
+
"network_link.destination_ipv4": "2.2.2.2",
|
180
|
+
"network_link.work_mode": "AandS",
|
181
|
+
"support_templates": "m.ethernet_link",
|
182
|
+
"rated_bandwidth": 1000,
|
183
|
+
"network_link.actual_bandwidth": 1000,
|
184
|
+
"source_type": "network.interface",
|
185
|
+
"network_link.connect_type": "phy",
|
186
|
+
"display_name": "子拓扑资源-子拓扑IP",
|
187
|
+
"asset_status": "2",
|
188
|
+
"network_link_type": "2",
|
189
|
+
"destination_type": "ip",
|
190
|
+
"network_link.role": "master",
|
191
|
+
"network_link.network_category": "CAN",
|
192
|
+
"dcs": "331268969",
|
193
|
+
"network_link.source_ipv4": "172.17.166.20",
|
194
|
+
"name": "172.17.166.20(Gi 0/1) - 2.2.2.2",
|
195
|
+
"distance_outlet": 2147483647,
|
196
|
+
"network_link.is_crucial": false,
|
197
|
+
"source_id": "00000000010de95e",
|
198
|
+
"network_link.source_device_id": "00000000010de864",
|
199
|
+
"network_link.destination_device_ipv4": "2.2.2.2"
|
200
|
+
},
|
201
|
+
"sourceCode": null,
|
202
|
+
"level": null,
|
203
|
+
"customType": null,
|
204
|
+
"manageStatus": 3
|
205
|
+
}];
|
@@ -36,11 +36,11 @@ export function buildIpNode(ip) {
|
|
36
36
|
}
|
37
37
|
|
38
38
|
function getHtSerialize(serialize) {
|
39
|
-
if (serialize) {
|
39
|
+
if (serialize && typeof serialize === 'string') {
|
40
40
|
return JSON.parse(serialize);
|
41
41
|
}
|
42
42
|
|
43
|
-
return
|
43
|
+
return serialize;
|
44
44
|
}
|
45
45
|
|
46
46
|
function isExitLink(link) {
|
@@ -0,0 +1,149 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
// 关联拓扑数据
|
3
|
+
import { topoLinks } from "./__tests__/relateTopoData";
|
4
|
+
/**
|
5
|
+
* 升级历史数据:子拓扑节点序列化数据
|
6
|
+
* 构造子拓扑节点
|
7
|
+
* 构造子拓扑链路
|
8
|
+
* @param {*} ctx
|
9
|
+
*/
|
10
|
+
|
11
|
+
export function processBothTopoData(topoData) {
|
12
|
+
var nodes = topoData.nodes,
|
13
|
+
links = topoData.links;
|
14
|
+
var serialize = upgradeSerializeOldTopoNode(topoData.serialize);
|
15
|
+
return _extends({}, topoData, {
|
16
|
+
nodes: [].concat(nodes, buildTopoNodeDatasFromSerialize(serialize)),
|
17
|
+
links: buildTopoLinks(links),
|
18
|
+
serialize: serialize
|
19
|
+
});
|
20
|
+
}
|
21
|
+
/**
|
22
|
+
* 构造子拓扑节点
|
23
|
+
* 构造子拓扑链路
|
24
|
+
* @param {*} ctx
|
25
|
+
*/
|
26
|
+
|
27
|
+
export function processByConditionTopoData(ctx) {
|
28
|
+
var data = ctx.data,
|
29
|
+
config = ctx.config;
|
30
|
+
var nodes = data.nodes,
|
31
|
+
links = data.links;
|
32
|
+
return _extends({}, data, {
|
33
|
+
nodes: [].concat(nodes, buildTopoNodeDatas(config)),
|
34
|
+
links: buildTopoLinks(links)
|
35
|
+
});
|
36
|
+
}
|
37
|
+
export function getRelateTopoIdListFromConfig(groups) {
|
38
|
+
var relateTopoIdList = [];
|
39
|
+
groups.forEach(function (g) {
|
40
|
+
g.resources["static"].filter(function (ciId) {
|
41
|
+
return ciId.startsWith('topo:');
|
42
|
+
}).map(function (ciId) {
|
43
|
+
return ciId.replace('topo:', '');
|
44
|
+
}).map(function (topoId) {
|
45
|
+
if (!relateTopoIdList.includes(topoId)) {
|
46
|
+
relateTopoIdList.push(topoId);
|
47
|
+
}
|
48
|
+
});
|
49
|
+
});
|
50
|
+
return relateTopoIdList;
|
51
|
+
}
|
52
|
+
export function buildTopoNode(topoId) {
|
53
|
+
return {
|
54
|
+
id: "topo:" + topoId,
|
55
|
+
// name: ,
|
56
|
+
bindType: "topo",
|
57
|
+
// 绑定资源类型。关联资源 值为空,关联IP ip
|
58
|
+
bindIp: topoId,
|
59
|
+
// TODO 所属区域,从序列化拿
|
60
|
+
// 'groupId': null,
|
61
|
+
// 'groupTag': null,
|
62
|
+
// 'attributes': [],
|
63
|
+
// 'metrics': [],
|
64
|
+
type: "node",
|
65
|
+
isbinding: true,
|
66
|
+
// 'dtype': 'device'
|
67
|
+
operation: "delete"
|
68
|
+
};
|
69
|
+
}
|
70
|
+
|
71
|
+
function buildTopoLinks(links) {
|
72
|
+
if (process.env.NODE_ENV !== 'production') {
|
73
|
+
links.push.apply(links, topoLinks);
|
74
|
+
}
|
75
|
+
|
76
|
+
return links.map(function (link) {
|
77
|
+
return _extends({}, link, {
|
78
|
+
"source": link.sourceType ? link.sourceType + ':' + link.source : link.source,
|
79
|
+
"target": link.targetType ? link.targetType + ':' + link.target : link.target
|
80
|
+
});
|
81
|
+
});
|
82
|
+
}
|
83
|
+
/**
|
84
|
+
* 升级历史数据:子拓扑节点序列化数据
|
85
|
+
* @param {*} serialize
|
86
|
+
*/
|
87
|
+
|
88
|
+
|
89
|
+
function upgradeSerializeOldTopoNode(serialize) {
|
90
|
+
if (serialize) {
|
91
|
+
var isOldTopoNode = function isOldTopoNode(ele) {
|
92
|
+
return isTopoNode(ele) && !ele.p.tag;
|
93
|
+
};
|
94
|
+
|
95
|
+
var oldTopoNodes = serialize.d.filter(isOldTopoNode);
|
96
|
+
oldTopoNodes.forEach(function (node) {
|
97
|
+
var _node$a;
|
98
|
+
|
99
|
+
var topoId = (_node$a = node.a) === null || _node$a === void 0 ? void 0 : _node$a.bindTopo;
|
100
|
+
node.a = _extends({}, node.a, buildTopoNode(topoId));
|
101
|
+
node.p.tag = "topo:" + topoId;
|
102
|
+
});
|
103
|
+
}
|
104
|
+
|
105
|
+
return serialize;
|
106
|
+
}
|
107
|
+
|
108
|
+
function isTopoNode(ele) {
|
109
|
+
var _ele$a;
|
110
|
+
|
111
|
+
return !!((_ele$a = ele.a) !== null && _ele$a !== void 0 && _ele$a.bindTopo);
|
112
|
+
}
|
113
|
+
|
114
|
+
function buildTopoNodeDatasFromSerialize(serialize) {
|
115
|
+
if (!serialize) {
|
116
|
+
return [];
|
117
|
+
}
|
118
|
+
|
119
|
+
var topoNodes = serialize.d.filter(isTopoNode);
|
120
|
+
var topoNodeDatas = topoNodes.map(function (node) {
|
121
|
+
var _node$a2;
|
122
|
+
|
123
|
+
var topoId = (_node$a2 = node.a) === null || _node$a2 === void 0 ? void 0 : _node$a2.bindTopo;
|
124
|
+
return buildTopoNode(topoId);
|
125
|
+
});
|
126
|
+
return topoNodeDatas;
|
127
|
+
}
|
128
|
+
|
129
|
+
function buildTopoNodeDatas(config) {
|
130
|
+
var topoNodeDatas = [];
|
131
|
+
config.forEach(function (g) {
|
132
|
+
g.resources["static"].filter(function (ciId) {
|
133
|
+
return ciId.startsWith('topo:');
|
134
|
+
}).map(function (ciId) {
|
135
|
+
return ciId.replace('topo:', '');
|
136
|
+
}).map(function (topoId) {
|
137
|
+
topoNodeDatas.push(_extends({}, buildTopoNode(topoId), {
|
138
|
+
// 添加资源拓扑节点消失的问题
|
139
|
+
'groupId': g.id,
|
140
|
+
'groupTag': g.tag
|
141
|
+
}));
|
142
|
+
});
|
143
|
+
});
|
144
|
+
return topoNodeDatas;
|
145
|
+
}
|
146
|
+
|
147
|
+
function getRelateTopoIdsFromSerialize(serialize) {
|
148
|
+
return serialize;
|
149
|
+
}
|
@@ -41,23 +41,8 @@ function getResourceConfigFromHt(topo) {
|
|
41
41
|
return {
|
42
42
|
layers: sortBy(layers, 'order'),
|
43
43
|
groups: groups,
|
44
|
-
resources: resources
|
45
|
-
relateTopoIdList: getRelateTopoIdList(dataModel)
|
44
|
+
resources: resources
|
46
45
|
};
|
47
|
-
} // 查询关联拓扑id列表
|
48
|
-
|
49
|
-
|
50
|
-
function getRelateTopoIdList(dataModel) {
|
51
|
-
return getNodes(dataModel).reduce(function (topoIds, node) {
|
52
|
-
var bindType = node.a('bindType');
|
53
|
-
var bindTopo = node.a('bindTopo');
|
54
|
-
|
55
|
-
if (bindType === 'topo' && bindTopo && !topoIds.includes(bindTopo)) {
|
56
|
-
return [].concat(topoIds, [bindTopo]);
|
57
|
-
}
|
58
|
-
|
59
|
-
return topoIds;
|
60
|
-
}, []);
|
61
46
|
}
|
62
47
|
|
63
48
|
function getLayerDatas(dataModel) {
|