@riil-frontend/component-topology 12.0.0-dev.3 → 12.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/hooks/__tests__/useCiAttributeChange.test.js +0 -0
- package/es/core/hooks/useCiAttributeChange.js +30 -14
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +1 -0
- package/lib/core/hooks/__tests__/useCiAttributeChange.test.js +1 -0
- package/lib/core/hooks/useCiAttributeChange.js +29 -13
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +1 -0
- package/package.json +3 -3
File without changes
|
@@ -3,9 +3,20 @@ import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
|
3
3
|
import CiCache from "../models/cache/CiCache";
|
4
4
|
import useTopoEventListener from "./useTopoEventListener";
|
5
5
|
|
6
|
+
function ciExistTopo(topoData, ciChangeData) {
|
7
|
+
if (!topoData) {
|
8
|
+
return false;
|
9
|
+
}
|
10
|
+
|
11
|
+
var ciIds = [].concat(topoData.nodes, topoData.links, topoData.linkGroups).map(function (data) {
|
12
|
+
return data.ciId || data.id;
|
13
|
+
});
|
14
|
+
return ciIds.includes(ciChangeData.id);
|
15
|
+
}
|
16
|
+
|
6
17
|
function mergeData(cis, ciChangeData) {
|
7
18
|
var matchData = function matchData(item) {
|
8
|
-
return item.
|
19
|
+
return (item.ciId || item.id) === ciChangeData.id;
|
9
20
|
};
|
10
21
|
|
11
22
|
if (!cis.find(matchData)) {
|
@@ -13,16 +24,26 @@ function mergeData(cis, ciChangeData) {
|
|
13
24
|
}
|
14
25
|
|
15
26
|
return cis.map(function (ci) {
|
16
|
-
if (matchData(ci)) {
|
17
|
-
return
|
18
|
-
id: ci.id,
|
19
|
-
attributes: _extends({}, ci.attributes, ciChangeData.attributes)
|
20
|
-
});
|
27
|
+
if (!matchData(ci)) {
|
28
|
+
return ci;
|
21
29
|
}
|
22
30
|
|
23
|
-
return ci
|
31
|
+
return _extends({}, ci, {
|
32
|
+
id: ci.id,
|
33
|
+
attributes: _extends({}, ci.attributes, ciChangeData.attributes)
|
34
|
+
});
|
24
35
|
});
|
25
36
|
}
|
37
|
+
|
38
|
+
function mergeTopoData(topoData, ciChangeData) {
|
39
|
+
var newData = _extends({}, topoData, {
|
40
|
+
nodes: mergeData(topoData.nodes, ciChangeData),
|
41
|
+
links: mergeData(topoData.links, ciChangeData),
|
42
|
+
linkGroups: mergeData(topoData.linkGroups, ciChangeData)
|
43
|
+
});
|
44
|
+
|
45
|
+
return newData;
|
46
|
+
}
|
26
47
|
/**
|
27
48
|
* 监听ci属性变更
|
28
49
|
*
|
@@ -38,13 +59,8 @@ export default function useCiAttributeChange(props) {
|
|
38
59
|
// 更新拓扑数据
|
39
60
|
var topoData = topo.store.getModelState('topoMod').data;
|
40
61
|
|
41
|
-
if (topoData) {
|
42
|
-
var newData =
|
43
|
-
nodes: mergeData(topoData.nodes, ciChangeData),
|
44
|
-
links: mergeData(topoData.links, ciChangeData),
|
45
|
-
linkGroups: mergeData(topoData.linkGroups, ciChangeData)
|
46
|
-
});
|
47
|
-
|
62
|
+
if (ciExistTopo(topoData, ciChangeData)) {
|
63
|
+
var newData = mergeTopoData(topoData, ciChangeData);
|
48
64
|
var topoDispatchers = topo.store.getModelDispatchers('topoMod');
|
49
65
|
topoDispatchers.update({
|
50
66
|
data: newData
|
@@ -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.0.0-dev.
|
27
|
+
var version = typeof "12.0.0-dev.5" === 'string' ? "12.0.0-dev.5" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
@@ -46,6 +46,7 @@ export default function ResourceDetail(props) {
|
|
46
46
|
|
47
47
|
if (tabBodys.length === 1) {
|
48
48
|
return /*#__PURE__*/React.createElement(ResourceOverview, _extends({}, props, activeData, {
|
49
|
+
resourceDetailProps: viewerProps === null || viewerProps === void 0 ? void 0 : viewerProps.resourceDetailProps,
|
49
50
|
userId: userId,
|
50
51
|
style: {
|
51
52
|
overflowY: 'auto',
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";
|
@@ -13,9 +13,20 @@ var _CiCache = _interopRequireDefault(require("../models/cache/CiCache"));
|
|
13
13
|
|
14
14
|
var _useTopoEventListener = _interopRequireDefault(require("./useTopoEventListener"));
|
15
15
|
|
16
|
+
function ciExistTopo(topoData, ciChangeData) {
|
17
|
+
if (!topoData) {
|
18
|
+
return false;
|
19
|
+
}
|
20
|
+
|
21
|
+
var ciIds = [].concat(topoData.nodes, topoData.links, topoData.linkGroups).map(function (data) {
|
22
|
+
return data.ciId || data.id;
|
23
|
+
});
|
24
|
+
return ciIds.includes(ciChangeData.id);
|
25
|
+
}
|
26
|
+
|
16
27
|
function mergeData(cis, ciChangeData) {
|
17
28
|
var matchData = function matchData(item) {
|
18
|
-
return item.
|
29
|
+
return (item.ciId || item.id) === ciChangeData.id;
|
19
30
|
};
|
20
31
|
|
21
32
|
if (!cis.find(matchData)) {
|
@@ -23,16 +34,25 @@ function mergeData(cis, ciChangeData) {
|
|
23
34
|
}
|
24
35
|
|
25
36
|
return cis.map(function (ci) {
|
26
|
-
if (matchData(ci)) {
|
27
|
-
return
|
28
|
-
id: ci.id,
|
29
|
-
attributes: (0, _extends2["default"])({}, ci.attributes, ciChangeData.attributes)
|
30
|
-
});
|
37
|
+
if (!matchData(ci)) {
|
38
|
+
return ci;
|
31
39
|
}
|
32
40
|
|
33
|
-
return ci
|
41
|
+
return (0, _extends2["default"])({}, ci, {
|
42
|
+
id: ci.id,
|
43
|
+
attributes: (0, _extends2["default"])({}, ci.attributes, ciChangeData.attributes)
|
44
|
+
});
|
34
45
|
});
|
35
46
|
}
|
47
|
+
|
48
|
+
function mergeTopoData(topoData, ciChangeData) {
|
49
|
+
var newData = (0, _extends2["default"])({}, topoData, {
|
50
|
+
nodes: mergeData(topoData.nodes, ciChangeData),
|
51
|
+
links: mergeData(topoData.links, ciChangeData),
|
52
|
+
linkGroups: mergeData(topoData.linkGroups, ciChangeData)
|
53
|
+
});
|
54
|
+
return newData;
|
55
|
+
}
|
36
56
|
/**
|
37
57
|
* 监听ci属性变更
|
38
58
|
*
|
@@ -48,12 +68,8 @@ function useCiAttributeChange(props) {
|
|
48
68
|
// 更新拓扑数据
|
49
69
|
var topoData = topo.store.getModelState('topoMod').data;
|
50
70
|
|
51
|
-
if (topoData) {
|
52
|
-
var newData = (
|
53
|
-
nodes: mergeData(topoData.nodes, ciChangeData),
|
54
|
-
links: mergeData(topoData.links, ciChangeData),
|
55
|
-
linkGroups: mergeData(topoData.linkGroups, ciChangeData)
|
56
|
-
});
|
71
|
+
if (ciExistTopo(topoData, ciChangeData)) {
|
72
|
+
var newData = mergeTopoData(topoData, ciChangeData);
|
57
73
|
var topoDispatchers = topo.store.getModelDispatchers('topoMod');
|
58
74
|
topoDispatchers.update({
|
59
75
|
data: newData
|
@@ -56,7 +56,7 @@ var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
|
|
56
56
|
var _CiCache = _interopRequireDefault(require("./cache/CiCache"));
|
57
57
|
|
58
58
|
// eslint-disable-next-line no-undef
|
59
|
-
var version = typeof "12.0.0-dev.
|
59
|
+
var version = typeof "12.0.0-dev.5" === 'string' ? "12.0.0-dev.5" : null;
|
60
60
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
61
61
|
/**
|
62
62
|
* 拓扑显示和编辑
|
@@ -60,6 +60,7 @@ function ResourceDetail(props) {
|
|
60
60
|
|
61
61
|
if (tabBodys.length === 1) {
|
62
62
|
return /*#__PURE__*/_react["default"].createElement(_ResourceOverview["default"], (0, _extends2["default"])({}, props, activeData, {
|
63
|
+
resourceDetailProps: viewerProps === null || viewerProps === void 0 ? void 0 : viewerProps.resourceDetailProps,
|
63
64
|
userId: userId,
|
64
65
|
style: {
|
65
66
|
overflowY: 'auto',
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@riil-frontend/component-topology",
|
3
|
-
"version": "12.0.0-dev.
|
3
|
+
"version": "12.0.0-dev.5",
|
4
4
|
"description": "拓扑",
|
5
5
|
"scripts": {
|
6
6
|
"start": "build-scripts start",
|
@@ -64,7 +64,7 @@
|
|
64
64
|
"@riil-frontend/component-action-tree": "^1.0.13",
|
65
65
|
"@riil-frontend/component-common-res-list": "^1.0.26",
|
66
66
|
"@riil-frontend/component-condition-res-list": "^1.0.18",
|
67
|
-
"@riil-frontend/component-crucial-link-topo": "
|
67
|
+
"@riil-frontend/component-crucial-link-topo": "*",
|
68
68
|
"@riil-frontend/component-extra-title": "^1.0.3",
|
69
69
|
"@riil-frontend/component-more-buttons-menu": "^2.0.1",
|
70
70
|
"@riil-frontend/component-no-data-page": "^3.0.4",
|
@@ -123,6 +123,6 @@
|
|
123
123
|
"access": "public"
|
124
124
|
},
|
125
125
|
"license": "MIT",
|
126
|
-
"homepage": "https://unpkg.com/@riil-frontend/component-topology@12.0.0-dev.
|
126
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@12.0.0-dev.5/build/index.html",
|
127
127
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
128
128
|
}
|