@riil-frontend/component-topology 13.0.0-dev.3 → 13.0.0-dev.5
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.js +2 -2
- package/es/core/components/TopoView/topoView.js +1 -1
- package/es/core/editor/hooks/useKeyboardShortcut.js +4 -0
- package/es/core/hooks/useTopoEdit.js +3 -0
- package/es/core/models/TopoApp.js +1 -1
- package/es/networkTopo/services/topo/basic.js +1 -1
- package/es/networkTopo/utils/__tests__/relateTopoData.js +38 -0
- package/es/networkTopo/utils/relateTopoDataUtil.js +14 -1
- package/lib/core/components/TopoView/topoView.js +1 -1
- package/lib/core/editor/hooks/useKeyboardShortcut.js +4 -0
- package/lib/core/hooks/useTopoEdit.js +3 -0
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/networkTopo/services/topo/basic.js +1 -1
- package/lib/networkTopo/utils/__tests__/relateTopoData.js +43 -0
- package/lib/networkTopo/utils/relateTopoDataUtil.js +13 -0
- package/package.json +2 -2
@@ -129,7 +129,7 @@ var Topology = function Topology(props) {
|
|
129
129
|
topo.selectionModel.init();
|
130
130
|
var htHistoryManager = topo.getDataModel().getHistoryManager();
|
131
131
|
|
132
|
-
if (
|
132
|
+
if (topo.store.getState().topoMod.viewState === 'edit' && htHistoryManager) {
|
133
133
|
topo.historyManager = new HistoryManager(topo, htHistoryManager);
|
134
134
|
topo.historyManager.clear();
|
135
135
|
rlog.info('TopoView.handleGraphDataLoaded: 初始化HistoryManager ', topo.historyManager.toString());
|
@@ -307,6 +307,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
307
307
|
}
|
308
308
|
};
|
309
309
|
|
310
|
+
var batchDeleteSelectedElement = function batchDeleteSelectedElement() {};
|
311
|
+
|
310
312
|
var onDeleteElement = function onDeleteElement(data) {
|
311
313
|
var dtype = data.dtype;
|
312
314
|
rlog.info("onDeleteElement", data);
|
@@ -1123,6 +1125,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1123
1125
|
onCloseComboResDrawer: function onCloseComboResDrawer() {
|
1124
1126
|
return setShowComboResDrawer(false);
|
1125
1127
|
},
|
1128
|
+
batchDeleteSelectedElement: batchDeleteSelectedElement,
|
1126
1129
|
|
1127
1130
|
/**
|
1128
1131
|
* 拓扑图元素(节点、连线、容器)删除回调
|
@@ -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 "13.0.0-dev.
|
27
|
+
var version = typeof "13.0.0-dev.5" === 'string' ? "13.0.0-dev.5" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
@@ -50,7 +50,7 @@ function prepareResourceParams(conditions, query) {
|
|
50
50
|
return {
|
51
51
|
dynamicCondition: dynamicCondition,
|
52
52
|
fixedConditionIdList: (staticRes || []).filter(function (ciId) {
|
53
|
-
return !ciId.
|
53
|
+
return !ciId.includes(':');
|
54
54
|
}),
|
55
55
|
linkIps: (staticRes || []).filter(function (ciId) {
|
56
56
|
return ciId.startsWith('ip:');
|
@@ -0,0 +1,38 @@
|
|
1
|
+
export var topoLinks = [// 子拓扑之间
|
2
|
+
{
|
3
|
+
"id": "2-2",
|
4
|
+
"name": "子拓扑链路",
|
5
|
+
'sourceType': 'topo',
|
6
|
+
"source": "3",
|
7
|
+
'targetType': 'topo',
|
8
|
+
"target": "6",
|
9
|
+
"operation": "delete",
|
10
|
+
"ciType": "network_link",
|
11
|
+
"attributes": {
|
12
|
+
"network_link.source_device_ipv4": "172.17.166.18",
|
13
|
+
"network_link.destination_ipv4": "1.5.5.5",
|
14
|
+
"network_link.work_mode": "AandS",
|
15
|
+
"support_templates": "m.ethernet_link",
|
16
|
+
"rated_bandwidth": 100,
|
17
|
+
"network_link.actual_bandwidth": 100,
|
18
|
+
"source_type": "network.interface",
|
19
|
+
"network_link.connect_type": "phy",
|
20
|
+
"display_name": "172.17.166.18(Fa 0/10) - 1.5.5.5",
|
21
|
+
"asset_status": "2",
|
22
|
+
"network_link_type": "2",
|
23
|
+
"destination_type": "ip",
|
24
|
+
"network_link.role": "master",
|
25
|
+
"network_link.network_category": "CAN",
|
26
|
+
"dcs": "331268969",
|
27
|
+
"network_link.source_ipv4": "172.17.166.18",
|
28
|
+
"name": "172.17.166.18(Fa 0/10) - 1.5.5.5",
|
29
|
+
"distance_outlet": 2147483647,
|
30
|
+
"network_link.is_crucial": false,
|
31
|
+
"source_id": "00000000010de8b2",
|
32
|
+
"network_link.source_device_id": "00000000010de861"
|
33
|
+
},
|
34
|
+
"sourceCode": null,
|
35
|
+
"level": null,
|
36
|
+
"customType": null,
|
37
|
+
"manageStatus": 3
|
38
|
+
}];
|
@@ -1,18 +1,20 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
// 关联拓扑数据
|
3
|
-
|
3
|
+
import { topoLinks } from "./__tests__/relateTopoData";
|
4
4
|
/**
|
5
5
|
* 升级历史数据:子拓扑节点序列化数据
|
6
6
|
* 构造子拓扑节点
|
7
7
|
* 构造子拓扑链路
|
8
8
|
* @param {*} ctx
|
9
9
|
*/
|
10
|
+
|
10
11
|
export function processBothTopoData(topoData) {
|
11
12
|
var nodes = topoData.nodes,
|
12
13
|
links = topoData.links;
|
13
14
|
var serialize = upgradeSerializeOldTopoNode(topoData.serialize);
|
14
15
|
return _extends({}, topoData, {
|
15
16
|
nodes: [].concat(nodes, buildTopoNodeDatasFromSerialize(serialize)),
|
17
|
+
links: buildTopoLinks(links),
|
16
18
|
serialize: serialize
|
17
19
|
});
|
18
20
|
}
|
@@ -46,11 +48,22 @@ export function buildTopoNode(topoId) {
|
|
46
48
|
operation: "delete"
|
47
49
|
};
|
48
50
|
}
|
51
|
+
|
52
|
+
function buildTopoLinks(links) {
|
53
|
+
links.push.apply(links, topoLinks);
|
54
|
+
return links.map(function (link) {
|
55
|
+
return _extends({}, link, {
|
56
|
+
"source": link.sourceType ? link.sourceType + ':' + link.source : link.source,
|
57
|
+
"target": link.targetType ? link.targetType + ':' + link.target : link.target
|
58
|
+
});
|
59
|
+
});
|
60
|
+
}
|
49
61
|
/**
|
50
62
|
* 升级历史数据:子拓扑节点序列化数据
|
51
63
|
* @param {*} serialize
|
52
64
|
*/
|
53
65
|
|
66
|
+
|
54
67
|
function upgradeSerializeOldTopoNode(serialize) {
|
55
68
|
if (serialize) {
|
56
69
|
var isOldTopoNode = function isOldTopoNode(ele) {
|
@@ -167,7 +167,7 @@ var Topology = function Topology(props) {
|
|
167
167
|
topo.selectionModel.init();
|
168
168
|
var htHistoryManager = topo.getDataModel().getHistoryManager();
|
169
169
|
|
170
|
-
if (
|
170
|
+
if (topo.store.getState().topoMod.viewState === 'edit' && htHistoryManager) {
|
171
171
|
topo.historyManager = new _HistoryManager["default"](topo, htHistoryManager);
|
172
172
|
topo.historyManager.clear();
|
173
173
|
rlog.info('TopoView.handleGraphDataLoaded: 初始化HistoryManager ', topo.historyManager.toString());
|
@@ -34,6 +34,10 @@ function initKeyboardShortcuts(props) {
|
|
34
34
|
|
35
35
|
(0, _hotkeysJs["default"])('ctrl+v, command+v', function (event) {
|
36
36
|
return (0, _copyElementUtil.handlePasteHotkey)(event, props);
|
37
|
+
}); // 删除
|
38
|
+
|
39
|
+
(0, _hotkeysJs["default"])('delete', function (event) {
|
40
|
+
topoEdit.batchDeleteSelectedElement();
|
37
41
|
});
|
38
42
|
}
|
39
43
|
|
@@ -336,6 +336,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
336
336
|
}
|
337
337
|
};
|
338
338
|
|
339
|
+
var batchDeleteSelectedElement = function batchDeleteSelectedElement() {};
|
340
|
+
|
339
341
|
var onDeleteElement = function onDeleteElement(data) {
|
340
342
|
var dtype = data.dtype;
|
341
343
|
rlog.info("onDeleteElement", data);
|
@@ -1152,6 +1154,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1152
1154
|
onCloseComboResDrawer: function onCloseComboResDrawer() {
|
1153
1155
|
return setShowComboResDrawer(false);
|
1154
1156
|
},
|
1157
|
+
batchDeleteSelectedElement: batchDeleteSelectedElement,
|
1155
1158
|
|
1156
1159
|
/**
|
1157
1160
|
* 拓扑图元素(节点、连线、容器)删除回调
|
@@ -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.5" === 'string' ? "13.0.0-dev.5" : null;
|
58
58
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
59
59
|
/**
|
60
60
|
* 拓扑显示和编辑
|
@@ -73,7 +73,7 @@ function prepareResourceParams(conditions, query) {
|
|
73
73
|
return {
|
74
74
|
dynamicCondition: dynamicCondition,
|
75
75
|
fixedConditionIdList: (staticRes || []).filter(function (ciId) {
|
76
|
-
return !ciId.
|
76
|
+
return !ciId.includes(':');
|
77
77
|
}),
|
78
78
|
linkIps: (staticRes || []).filter(function (ciId) {
|
79
79
|
return ciId.startsWith('ip:');
|
@@ -0,0 +1,43 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
exports.topoLinks = void 0;
|
5
|
+
var topoLinks = [// 子拓扑之间
|
6
|
+
{
|
7
|
+
"id": "2-2",
|
8
|
+
"name": "子拓扑链路",
|
9
|
+
'sourceType': 'topo',
|
10
|
+
"source": "3",
|
11
|
+
'targetType': 'topo',
|
12
|
+
"target": "6",
|
13
|
+
"operation": "delete",
|
14
|
+
"ciType": "network_link",
|
15
|
+
"attributes": {
|
16
|
+
"network_link.source_device_ipv4": "172.17.166.18",
|
17
|
+
"network_link.destination_ipv4": "1.5.5.5",
|
18
|
+
"network_link.work_mode": "AandS",
|
19
|
+
"support_templates": "m.ethernet_link",
|
20
|
+
"rated_bandwidth": 100,
|
21
|
+
"network_link.actual_bandwidth": 100,
|
22
|
+
"source_type": "network.interface",
|
23
|
+
"network_link.connect_type": "phy",
|
24
|
+
"display_name": "172.17.166.18(Fa 0/10) - 1.5.5.5",
|
25
|
+
"asset_status": "2",
|
26
|
+
"network_link_type": "2",
|
27
|
+
"destination_type": "ip",
|
28
|
+
"network_link.role": "master",
|
29
|
+
"network_link.network_category": "CAN",
|
30
|
+
"dcs": "331268969",
|
31
|
+
"network_link.source_ipv4": "172.17.166.18",
|
32
|
+
"name": "172.17.166.18(Fa 0/10) - 1.5.5.5",
|
33
|
+
"distance_outlet": 2147483647,
|
34
|
+
"network_link.is_crucial": false,
|
35
|
+
"source_id": "00000000010de8b2",
|
36
|
+
"network_link.source_device_id": "00000000010de861"
|
37
|
+
},
|
38
|
+
"sourceCode": null,
|
39
|
+
"level": null,
|
40
|
+
"customType": null,
|
41
|
+
"manageStatus": 3
|
42
|
+
}];
|
43
|
+
exports.topoLinks = topoLinks;
|
@@ -9,6 +9,8 @@ exports.processByConditionTopoData = processByConditionTopoData;
|
|
9
9
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
11
11
|
|
12
|
+
var _relateTopoData = require("./__tests__/relateTopoData");
|
13
|
+
|
12
14
|
// 关联拓扑数据
|
13
15
|
|
14
16
|
/**
|
@@ -23,6 +25,7 @@ function processBothTopoData(topoData) {
|
|
23
25
|
var serialize = upgradeSerializeOldTopoNode(topoData.serialize);
|
24
26
|
return (0, _extends2["default"])({}, topoData, {
|
25
27
|
nodes: [].concat(nodes, buildTopoNodeDatasFromSerialize(serialize)),
|
28
|
+
links: buildTopoLinks(links),
|
26
29
|
serialize: serialize
|
27
30
|
});
|
28
31
|
}
|
@@ -58,6 +61,16 @@ function buildTopoNode(topoId) {
|
|
58
61
|
operation: "delete"
|
59
62
|
};
|
60
63
|
}
|
64
|
+
|
65
|
+
function buildTopoLinks(links) {
|
66
|
+
links.push.apply(links, _relateTopoData.topoLinks);
|
67
|
+
return links.map(function (link) {
|
68
|
+
return (0, _extends2["default"])({}, link, {
|
69
|
+
"source": link.sourceType ? link.sourceType + ':' + link.source : link.source,
|
70
|
+
"target": link.targetType ? link.targetType + ':' + link.target : link.target
|
71
|
+
});
|
72
|
+
});
|
73
|
+
}
|
61
74
|
/**
|
62
75
|
* 升级历史数据:子拓扑节点序列化数据
|
63
76
|
* @param {*} serialize
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@riil-frontend/component-topology",
|
3
|
-
"version": "13.0.0-dev.
|
3
|
+
"version": "13.0.0-dev.5",
|
4
4
|
"description": "拓扑",
|
5
5
|
"scripts": {
|
6
6
|
"start": "build-scripts start",
|
@@ -123,6 +123,6 @@
|
|
123
123
|
"access": "public"
|
124
124
|
},
|
125
125
|
"license": "MIT",
|
126
|
-
"homepage": "https://unpkg.com/@riil-frontend/component-topology@13.0.0-dev.
|
126
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@13.0.0-dev.5/build/index.html",
|
127
127
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
128
128
|
}
|