@riil-frontend/component-topology 7.0.8 → 8.0.0-a.1
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 +1 -1
- package/es/components/BatchAttrMetric/setting.js +0 -2
- package/es/core/common/icons/basicIcons.js +57 -0
- package/es/core/common/icons/icon.js +3 -9
- package/es/core/components/ResourceViewAttributeSetting/Setting.js +5 -11
- package/es/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +121 -0
- package/es/core/components/TopoView/GraphViewPanel.js +1 -2
- package/es/core/components/TopoView/topoView.js +3 -1
- package/es/core/hooks/useTopoEdit.js +35 -127
- package/es/core/models/AttributeMetricDisplay.js +4 -4
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/tagstips/ElementTagTipConfig.js +17 -9
- package/es/core/models/utils/linkUtils.js +30 -36
- package/es/core/store/models/topoBizMod.js +1 -11
- package/es/core/store/models/topoConfig.js +7 -13
- package/es/core/store/models/topoMod.js +74 -50
- package/es/networkTopo/getTopoData.js +72 -64
- package/es/networkTopo/models/TopoCenter.js +14 -94
- package/es/networkTopo/services/topo/basic.js +26 -8
- package/es/networkTopo/utils/resourcePermissionUtil.js +2 -2
- package/es/utils/topoData.js +4 -169
- package/lib/components/BatchAttrMetric/setting.js +0 -4
- package/lib/core/common/icons/basicIcons.js +62 -0
- package/lib/core/common/icons/icon.js +4 -10
- package/lib/core/components/ResourceViewAttributeSetting/Setting.js +6 -11
- package/lib/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +127 -0
- package/lib/core/components/TopoView/GraphViewPanel.js +1 -2
- package/lib/core/components/TopoView/topoView.js +4 -1
- package/lib/core/hooks/useTopoEdit.js +35 -129
- package/lib/core/models/AttributeMetricDisplay.js +4 -4
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/tagstips/ElementTagTipConfig.js +17 -9
- package/lib/core/models/utils/linkUtils.js +27 -33
- package/lib/core/store/models/topoBizMod.js +1 -11
- package/lib/core/store/models/topoConfig.js +6 -12
- package/lib/core/store/models/topoMod.js +71 -48
- package/lib/networkTopo/getTopoData.js +73 -65
- package/lib/networkTopo/models/TopoCenter.js +14 -94
- package/lib/networkTopo/services/topo/basic.js +26 -8
- package/lib/networkTopo/utils/resourcePermissionUtil.js +2 -2
- package/lib/utils/topoData.js +6 -172
- package/package.json +2 -2
@@ -1,11 +1,25 @@
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
4
4
|
import { getLinksDetail } from "../core/models/utils/linkUtils";
|
5
5
|
import { addTopoDataResourcePermission } from "./utils/resourcePermissionUtil"; // import "./utils/__tests__/resourcePermissionUtil.test";
|
6
|
+
// 过滤掉无两端节点数据的链路
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
function filterLinkNoSourceTarget(data) {
|
9
|
+
var links = (data.links || []).filter(function (link) {
|
10
|
+
var sourceNode = (data.nodes || []).find(function (node) {
|
11
|
+
return node.id === link.source;
|
12
|
+
});
|
13
|
+
|
14
|
+
if (link.source && !sourceNode) {
|
15
|
+
return false;
|
16
|
+
}
|
17
|
+
|
18
|
+
return true;
|
19
|
+
});
|
20
|
+
return _extends({}, data, {
|
21
|
+
links: links
|
22
|
+
});
|
9
23
|
}
|
10
24
|
/**
|
11
25
|
* 修正告警配置。因为:接口返回值没有全局告警配置时,返回null,代表开启
|
@@ -13,42 +27,65 @@ export function addLinkData(_x, _x2) {
|
|
13
27
|
* @returns
|
14
28
|
*/
|
15
29
|
|
30
|
+
|
31
|
+
function fixAlarmConfig(data) {
|
32
|
+
var _data$global = data.global,
|
33
|
+
alarmSwitch = _data$global.alarmSwitch,
|
34
|
+
alarmListDefaultOpen = _data$global.alarmListDefaultOpen;
|
35
|
+
return _extends({}, data, {
|
36
|
+
global: _extends({}, data.global, {
|
37
|
+
alarmSwitch: alarmSwitch === null ? true : alarmSwitch,
|
38
|
+
alarmListDefaultOpen: alarmListDefaultOpen === null ? true : alarmListDefaultOpen
|
39
|
+
})
|
40
|
+
});
|
41
|
+
} // 修正容器找不到时groupId设为空
|
42
|
+
|
43
|
+
|
44
|
+
function fixNodeGroupId(data) {
|
45
|
+
var nodes = (data.nodes || [] // 修正容器找不到时groupId设为空
|
46
|
+
).map(function (node) {
|
47
|
+
var groupExisted = !!(data.groups || []).filter(function (g) {
|
48
|
+
return g.id === node.groupId;
|
49
|
+
}).length;
|
50
|
+
return _extends({}, node, {
|
51
|
+
groupId: groupExisted ? node.groupId : null
|
52
|
+
});
|
53
|
+
});
|
54
|
+
return _extends({}, data, {
|
55
|
+
nodes: nodes
|
56
|
+
});
|
57
|
+
}
|
58
|
+
|
59
|
+
export function addLinkData(_x) {
|
60
|
+
return _addLinkData.apply(this, arguments);
|
61
|
+
} // FIXME 业务拓扑不需要链路相关逻辑
|
62
|
+
|
16
63
|
function _addLinkData() {
|
17
|
-
_addLinkData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(
|
18
|
-
var links, networkLinks, otherLinks;
|
64
|
+
_addLinkData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
|
65
|
+
var links, nodes, networkLinks, otherLinks;
|
19
66
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
20
67
|
while (1) {
|
21
68
|
switch (_context.prev = _context.next) {
|
22
69
|
case 0:
|
23
|
-
|
24
|
-
|
25
|
-
var sourceNode = nodes.find(function (node) {
|
26
|
-
return node.id === link.source;
|
27
|
-
});
|
28
|
-
|
29
|
-
if (link.source && !sourceNode) {
|
30
|
-
return false;
|
31
|
-
}
|
32
|
-
|
33
|
-
return true;
|
34
|
-
}); // 如果是网络链路,补充详情信息
|
70
|
+
links = data.links || [];
|
71
|
+
nodes = data.nodes || []; // 如果是网络链路,补充详情信息
|
35
72
|
|
36
|
-
_context.next =
|
73
|
+
_context.next = 4;
|
37
74
|
return getLinksDetail(links.filter(function (link) {
|
38
|
-
return
|
75
|
+
return link.ciType === 'network_link';
|
39
76
|
}), nodes);
|
40
77
|
|
41
|
-
case
|
78
|
+
case 4:
|
42
79
|
networkLinks = _context.sent;
|
43
80
|
otherLinks = links.filter(function (link) {
|
44
|
-
return
|
81
|
+
return link.ciType !== 'network_link';
|
45
82
|
});
|
46
|
-
return _context.abrupt("return", {
|
83
|
+
return _context.abrupt("return", _extends({}, data, {
|
47
84
|
links: [].concat(networkLinks, otherLinks),
|
48
85
|
linkGroups: []
|
49
|
-
});
|
86
|
+
}));
|
50
87
|
|
51
|
-
case
|
88
|
+
case 7:
|
52
89
|
case "end":
|
53
90
|
return _context.stop();
|
54
91
|
}
|
@@ -58,54 +95,25 @@ function _addLinkData() {
|
|
58
95
|
return _addLinkData.apply(this, arguments);
|
59
96
|
}
|
60
97
|
|
61
|
-
function
|
62
|
-
var _data$global = data.global,
|
63
|
-
alarmSwitch = _data$global.alarmSwitch,
|
64
|
-
alarmListDefaultOpen = _data$global.alarmListDefaultOpen;
|
65
|
-
return _extends({}, data, {
|
66
|
-
global: _extends({}, data.global, {
|
67
|
-
alarmSwitch: alarmSwitch === null ? true : alarmSwitch,
|
68
|
-
alarmListDefaultOpen: alarmListDefaultOpen === null ? true : alarmListDefaultOpen
|
69
|
-
})
|
70
|
-
});
|
71
|
-
} // FIXME 业务拓扑不需要链路相关逻辑
|
72
|
-
|
73
|
-
|
74
|
-
export function buildData(_x3) {
|
98
|
+
export function buildData(_x2) {
|
75
99
|
return _buildData.apply(this, arguments);
|
76
100
|
}
|
77
101
|
|
78
102
|
function _buildData() {
|
79
|
-
_buildData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(
|
80
|
-
var
|
81
|
-
|
103
|
+
_buildData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(oldData) {
|
104
|
+
var data;
|
82
105
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
83
106
|
while (1) {
|
84
107
|
switch (_context2.prev = _context2.next) {
|
85
108
|
case 0:
|
86
|
-
|
87
|
-
|
88
|
-
)
|
89
|
-
var groupExisted = !!(data.groups || []).filter(function (g) {
|
90
|
-
return g.id === node.groupId;
|
91
|
-
}).length;
|
92
|
-
return _extends({}, node, {
|
93
|
-
groupId: groupExisted ? node.groupId : null
|
94
|
-
});
|
95
|
-
});
|
96
|
-
_context2.next = 4;
|
97
|
-
return Promise.all([addLinkData(data.links || [], nodes)]);
|
109
|
+
data = oldData;
|
110
|
+
data = fixNodeGroupId(data);
|
111
|
+
data = filterLinkNoSourceTarget(data); // data = await addLinkData(data)
|
98
112
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
nodes: nodes
|
104
|
-
}, linkData);
|
105
|
-
newData = addTopoDataResourcePermission(newData);
|
106
|
-
return _context2.abrupt("return", newData);
|
107
|
-
|
108
|
-
case 9:
|
113
|
+
data = addTopoDataResourcePermission(data);
|
114
|
+
return _context2.abrupt("return", data);
|
115
|
+
|
116
|
+
case 5:
|
109
117
|
case "end":
|
110
118
|
return _context2.stop();
|
111
119
|
}
|
@@ -115,7 +123,7 @@ function _buildData() {
|
|
115
123
|
return _buildData.apply(this, arguments);
|
116
124
|
}
|
117
125
|
|
118
|
-
export default function getTopoData(
|
126
|
+
export default function getTopoData(_x3, _x4) {
|
119
127
|
return _getTopoData.apply(this, arguments);
|
120
128
|
}
|
121
129
|
|
@@ -30,87 +30,7 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
|
|
30
30
|
return DEFAULT_TIP_COMMON_CONFIG;
|
31
31
|
} // ExtElementTagTipBuilder: LinkTagsTipsBuilder,
|
32
32
|
|
33
|
-
}
|
34
|
-
onSwitchToEditModeBegin: function () {
|
35
|
-
var _onSwitchToEditModeBegin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(topo) {
|
36
|
-
var topoDispatchers;
|
37
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
38
|
-
while (1) {
|
39
|
-
switch (_context.prev = _context.next) {
|
40
|
-
case 0:
|
41
|
-
topoDispatchers = topo.store.getModelDispatchers('topoMod'); // topoDispatchers.update({ topoData: null });
|
42
|
-
|
43
|
-
_context.next = 3;
|
44
|
-
return topoDispatchers.refreshTopo();
|
45
|
-
|
46
|
-
case 3:
|
47
|
-
case "end":
|
48
|
-
return _context.stop();
|
49
|
-
}
|
50
|
-
}
|
51
|
-
}, _callee);
|
52
|
-
}));
|
53
|
-
|
54
|
-
function onSwitchToEditModeBegin(_x) {
|
55
|
-
return _onSwitchToEditModeBegin.apply(this, arguments);
|
56
|
-
}
|
57
|
-
|
58
|
-
return onSwitchToEditModeBegin;
|
59
|
-
}(),
|
60
|
-
onSwitchToEditMode: function () {
|
61
|
-
var _onSwitchToEditMode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(topo) {
|
62
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
63
|
-
while (1) {
|
64
|
-
switch (_context2.prev = _context2.next) {
|
65
|
-
case 0:
|
66
|
-
_context2.next = 2;
|
67
|
-
return topo.resourceConfig.loadConfig();
|
68
|
-
|
69
|
-
case 2:
|
70
|
-
case "end":
|
71
|
-
return _context2.stop();
|
72
|
-
}
|
73
|
-
}
|
74
|
-
}, _callee2);
|
75
|
-
}));
|
76
|
-
|
77
|
-
function onSwitchToEditMode(_x2) {
|
78
|
-
return _onSwitchToEditMode.apply(this, arguments);
|
79
|
-
}
|
80
|
-
|
81
|
-
return onSwitchToEditMode;
|
82
|
-
}(),
|
83
|
-
onSwitchToViewMode: function () {
|
84
|
-
var _onSwitchToViewMode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(topo) {
|
85
|
-
var topoModDispatchers;
|
86
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
87
|
-
while (1) {
|
88
|
-
switch (_context3.prev = _context3.next) {
|
89
|
-
case 0:
|
90
|
-
topoModDispatchers = topo.store.getModelDispatchers('topoMod');
|
91
|
-
_context3.next = 3;
|
92
|
-
return topoModDispatchers.openTopoPage({
|
93
|
-
id: topo.id
|
94
|
-
});
|
95
|
-
|
96
|
-
case 3:
|
97
|
-
_context3.next = 5;
|
98
|
-
return topoModDispatchers.refreshTopoTree();
|
99
|
-
|
100
|
-
case 5:
|
101
|
-
case "end":
|
102
|
-
return _context3.stop();
|
103
|
-
}
|
104
|
-
}
|
105
|
-
}, _callee3);
|
106
|
-
}));
|
107
|
-
|
108
|
-
function onSwitchToViewMode(_x3) {
|
109
|
-
return _onSwitchToViewMode.apply(this, arguments);
|
110
|
-
}
|
111
|
-
|
112
|
-
return onSwitchToViewMode;
|
113
|
-
}()
|
33
|
+
}
|
114
34
|
})) || this;
|
115
35
|
_this.resourceConfig = null;
|
116
36
|
var menuCommands = createMenuCommands(_assertThisInitialized(_this));
|
@@ -131,25 +51,25 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
|
|
131
51
|
_proto.initData =
|
132
52
|
/*#__PURE__*/
|
133
53
|
function () {
|
134
|
-
var _initData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
54
|
+
var _initData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
|
135
55
|
var topoDispatchers;
|
136
|
-
return _regeneratorRuntime.wrap(function
|
56
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
137
57
|
while (1) {
|
138
|
-
switch (
|
58
|
+
switch (_context.prev = _context.next) {
|
139
59
|
case 0:
|
140
60
|
topoDispatchers = this.store.getModelDispatchers('topoCenter');
|
141
|
-
|
61
|
+
_context.next = 3;
|
142
62
|
return topoDispatchers.initData(params);
|
143
63
|
|
144
64
|
case 3:
|
145
65
|
case "end":
|
146
|
-
return
|
66
|
+
return _context.stop();
|
147
67
|
}
|
148
68
|
}
|
149
|
-
},
|
69
|
+
}, _callee, this);
|
150
70
|
}));
|
151
71
|
|
152
|
-
function initData(
|
72
|
+
function initData(_x) {
|
153
73
|
return _initData.apply(this, arguments);
|
154
74
|
}
|
155
75
|
|
@@ -168,22 +88,22 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
|
|
168
88
|
_proto.exit =
|
169
89
|
/*#__PURE__*/
|
170
90
|
function () {
|
171
|
-
var _exit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
91
|
+
var _exit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
172
92
|
var topoDispatchers;
|
173
|
-
return _regeneratorRuntime.wrap(function
|
93
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
174
94
|
while (1) {
|
175
|
-
switch (
|
95
|
+
switch (_context2.prev = _context2.next) {
|
176
96
|
case 0:
|
177
97
|
topoDispatchers = this.store.getModelDispatchers('topoCenter');
|
178
|
-
|
98
|
+
_context2.next = 3;
|
179
99
|
return topoDispatchers.exit();
|
180
100
|
|
181
101
|
case 3:
|
182
102
|
case "end":
|
183
|
-
return
|
103
|
+
return _context2.stop();
|
184
104
|
}
|
185
105
|
}
|
186
|
-
},
|
106
|
+
}, _callee2, this);
|
187
107
|
}));
|
188
108
|
|
189
109
|
function exit() {
|
@@ -401,6 +401,8 @@ export default _extends({
|
|
401
401
|
*/
|
402
402
|
getTopoData: function getTopoData(id) {
|
403
403
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
|
404
|
+
var _result$links, result;
|
405
|
+
|
404
406
|
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
405
407
|
while (1) {
|
406
408
|
switch (_context12.prev = _context12.next) {
|
@@ -410,20 +412,27 @@ export default _extends({
|
|
410
412
|
return request.get(API_ROOT + "/structure/both/" + id);
|
411
413
|
|
412
414
|
case 3:
|
413
|
-
|
415
|
+
result = _context12.sent;
|
416
|
+
return _context12.abrupt("return", _extends({}, result, {
|
417
|
+
links: ((_result$links = result.links) !== null && _result$links !== void 0 ? _result$links : []).map(function (item) {
|
418
|
+
return _extends({}, item, {
|
419
|
+
ciType: 'network_link'
|
420
|
+
});
|
421
|
+
})
|
422
|
+
}));
|
414
423
|
|
415
|
-
case
|
416
|
-
_context12.prev =
|
424
|
+
case 7:
|
425
|
+
_context12.prev = 7;
|
417
426
|
_context12.t0 = _context12["catch"](0);
|
418
427
|
rlog.debug('getTopoData-error', _context12.t0);
|
419
428
|
return _context12.abrupt("return", null);
|
420
429
|
|
421
|
-
case
|
430
|
+
case 11:
|
422
431
|
case "end":
|
423
432
|
return _context12.stop();
|
424
433
|
}
|
425
434
|
}
|
426
|
-
}, _callee12, null, [[0,
|
435
|
+
}, _callee12, null, [[0, 7]]);
|
427
436
|
}))();
|
428
437
|
},
|
429
438
|
|
@@ -436,7 +445,9 @@ export default _extends({
|
|
436
445
|
*/
|
437
446
|
getTopoDataByResource: function getTopoDataByResource(id, resources, groups, exportLinkIdList) {
|
438
447
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
|
439
|
-
var
|
448
|
+
var _result$links2;
|
449
|
+
|
450
|
+
var data, obj, result;
|
440
451
|
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
441
452
|
while (1) {
|
442
453
|
switch (_context13.prev = _context13.next) {
|
@@ -458,9 +469,16 @@ export default _extends({
|
|
458
469
|
}));
|
459
470
|
|
460
471
|
case 5:
|
461
|
-
|
472
|
+
result = _context13.sent;
|
473
|
+
return _context13.abrupt("return", _extends({}, result, {
|
474
|
+
links: ((_result$links2 = result.links) !== null && _result$links2 !== void 0 ? _result$links2 : []).map(function (item) {
|
475
|
+
return _extends({}, item, {
|
476
|
+
ciType: 'network_link'
|
477
|
+
});
|
478
|
+
})
|
479
|
+
}));
|
462
480
|
|
463
|
-
case
|
481
|
+
case 7:
|
464
482
|
case "end":
|
465
483
|
return _context13.stop();
|
466
484
|
}
|
@@ -88,7 +88,7 @@ export function addTopoDataResourcePermission(data) {
|
|
88
88
|
permission: getNodePermission(node)
|
89
89
|
});
|
90
90
|
}),
|
91
|
-
links: addLinksPermission(links),
|
92
|
-
linkGroups: addLinksPermission(linkGroups)
|
91
|
+
links: addLinksPermission(links || []),
|
92
|
+
linkGroups: addLinksPermission(linkGroups || [])
|
93
93
|
});
|
94
94
|
}
|
package/es/utils/topoData.js
CHANGED
@@ -3,7 +3,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
var _excluded = ["extraConfig"];
|
4
4
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
5
5
|
import _ from "lodash";
|
6
|
-
import topoPermissionUtil from "./topoPermissionUtil";
|
7
6
|
import buildViewerContextMenu from "../core/viewer/contextmenu/buildContextmenu";
|
8
7
|
import buildEditorContextMenu from "../core/editor/contextmenu/buildContextmenu";
|
9
8
|
import mergeContextmenu from "../core/common/contextmenu/mergeContextmenu";
|
@@ -68,7 +67,7 @@ function updateNodeInfo(topoEngine, topoData) {
|
|
68
67
|
nodes: topoData.nodes.map(function (node) {
|
69
68
|
var attributes = node.attributes;
|
70
69
|
return _extends({}, node, {
|
71
|
-
ipAddress: node.ipAddress || (attributes === null || attributes === void 0 ? void 0 : attributes.
|
70
|
+
ipAddress: node.ipAddress || (attributes === null || attributes === void 0 ? void 0 : attributes.ipv4_address) || null,
|
72
71
|
isShowName: topoEngine.attributeMetricDisplay.getNodeNameVisible(node)
|
73
72
|
});
|
74
73
|
})
|
@@ -97,87 +96,6 @@ export function getCiTypes(topoData) {
|
|
97
96
|
var allCi = [].concat(topoData.nodes, topoData.links, topoData.linkGroups);
|
98
97
|
return getCiTypesFromCiElements(allCi);
|
99
98
|
}
|
100
|
-
/**
|
101
|
-
* 过滤ci元数据中的属性和指标,用于属性和指标显示设置
|
102
|
-
* @param {} ciTypeObj
|
103
|
-
* @returns
|
104
|
-
*/
|
105
|
-
|
106
|
-
var ciModfilter = function ciModfilter(ciTypeObj, globalSetting, type, code) {
|
107
|
-
var tips = globalSetting[type + "Tip"];
|
108
|
-
var tags = globalSetting[type + "Tag"];
|
109
|
-
var tipArr = [];
|
110
|
-
var tagArr = [];
|
111
|
-
|
112
|
-
if (tips !== null && tips !== void 0 && tips.isCustom) {
|
113
|
-
var _tips$data$code;
|
114
|
-
|
115
|
-
(_tips$data$code = tips.data[code]) === null || _tips$data$code === void 0 ? void 0 : _tips$data$code.map(function (item) {
|
116
|
-
tipArr.push(item.code + "-" + item.type);
|
117
|
-
});
|
118
|
-
}
|
119
|
-
|
120
|
-
if (tags !== null && tags !== void 0 && tags.isCustom) {
|
121
|
-
var _tags$data$code;
|
122
|
-
|
123
|
-
(_tags$data$code = tags.data[code]) === null || _tags$data$code === void 0 ? void 0 : _tags$data$code.map(function (item) {
|
124
|
-
tagArr.push(item.code + "-" + item.type);
|
125
|
-
});
|
126
|
-
} // rlog.debug(
|
127
|
-
// "过滤ci元数据中的属性和指标,用于属性和指标显示设置",
|
128
|
-
// globalSetting,
|
129
|
-
// tipArr,
|
130
|
-
// tagArr
|
131
|
-
// );
|
132
|
-
|
133
|
-
|
134
|
-
var custom = [];
|
135
|
-
|
136
|
-
if (type === "node") {
|
137
|
-
custom.push({
|
138
|
-
id: "name-graph",
|
139
|
-
code: "name",
|
140
|
-
name: "图片名称",
|
141
|
-
type: "custom",
|
142
|
-
tag: tagArr.indexOf("name-graph") >= 0,
|
143
|
-
tip: tipArr.indexOf("name-graph") >= 0
|
144
|
-
});
|
145
|
-
custom.push({
|
146
|
-
id: "display_name-ciType",
|
147
|
-
code: "ciType",
|
148
|
-
name: "资源类型",
|
149
|
-
type: "custom",
|
150
|
-
tag: tagArr.indexOf("display_name-ciType") >= 0,
|
151
|
-
tip: tipArr.indexOf("display_name-ciType") >= 0
|
152
|
-
});
|
153
|
-
}
|
154
|
-
|
155
|
-
var attributes = ciTypeObj.attributes.filter(function (attr) {
|
156
|
-
return !!attr.userVisible;
|
157
|
-
}).map(function (item) {
|
158
|
-
var aid = item.code + "-attribute";
|
159
|
-
return {
|
160
|
-
id: aid,
|
161
|
-
code: item.code,
|
162
|
-
name: item.name,
|
163
|
-
type: "attribute",
|
164
|
-
tag: tagArr.indexOf(aid) >= 0,
|
165
|
-
tip: tipArr.indexOf(aid) >= 0
|
166
|
-
};
|
167
|
-
});
|
168
|
-
var metrics = ciTypeObj.metrics.map(function (item) {
|
169
|
-
var mid = item.code + "-metric";
|
170
|
-
return {
|
171
|
-
id: mid,
|
172
|
-
code: item.code,
|
173
|
-
name: item.name,
|
174
|
-
type: "metric",
|
175
|
-
tag: tagArr.indexOf(mid) >= 0,
|
176
|
-
tip: tipArr.indexOf(mid) >= 0
|
177
|
-
};
|
178
|
-
});
|
179
|
-
return [].concat(custom, attributes, metrics);
|
180
|
-
};
|
181
99
|
/**
|
182
100
|
* 格式化拓扑数据
|
183
101
|
*
|
@@ -185,7 +103,6 @@ var ciModfilter = function ciModfilter(ciTypeObj, globalSetting, type, code) {
|
|
185
103
|
* @returns
|
186
104
|
*/
|
187
105
|
|
188
|
-
|
189
106
|
export function parseTopoData(result) {
|
190
107
|
var _result$global;
|
191
108
|
|
@@ -211,7 +128,6 @@ function buildGlobal(_ref2) {
|
|
211
128
|
var _result$config, _engine$viewProps, _result$global2, _result$customGlobal, _result$customGlobal2, _engine$options$viewe, _engine$options$edito, _engine$options$edito2;
|
212
129
|
|
213
130
|
var result = _ref2.data,
|
214
|
-
permission = _ref2.permission,
|
215
131
|
linkTo = _ref2.linkTo,
|
216
132
|
globalConfig = _ref2.globalConfig,
|
217
133
|
engine = _ref2.engine;
|
@@ -239,7 +155,7 @@ function buildGlobal(_ref2) {
|
|
239
155
|
// 背景图
|
240
156
|
backgroundImgUrl: (_engine$viewProps = engine.viewProps) !== null && _engine$viewProps !== void 0 && _engine$viewProps.hideBackground ? null : getBackgroundImageUrl(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.background),
|
241
157
|
control: _extends({
|
242
|
-
editable:
|
158
|
+
editable: true,
|
243
159
|
// 是否可编辑----控制[编辑]按钮
|
244
160
|
moveable: true,
|
245
161
|
// 节点是否可移动
|
@@ -324,10 +240,8 @@ export var combTopoData = function combTopoData(_ref3) {
|
|
324
240
|
var _result$groups;
|
325
241
|
|
326
242
|
var data = _ref3.data,
|
327
|
-
permission = _ref3.permission,
|
328
243
|
linkTo = _ref3.linkTo,
|
329
244
|
globalConfig = _ref3.globalConfig,
|
330
|
-
ciTypeMap = _ref3.ciTypeMap,
|
331
245
|
engine = _ref3.engine;
|
332
246
|
var result = processCluster(updateNodeInfo(engine, data)); // rlog.debug("combTopoData-接收到数据", result, engine, globalConfig);
|
333
247
|
|
@@ -338,7 +252,6 @@ export var combTopoData = function combTopoData(_ref3) {
|
|
338
252
|
|
339
253
|
var global = buildGlobal({
|
340
254
|
data: result,
|
341
|
-
permission: permission,
|
342
255
|
linkTo: linkTo,
|
343
256
|
globalConfig: globalConfig,
|
344
257
|
engine: engine
|
@@ -369,18 +282,11 @@ export var combTopoData = function combTopoData(_ref3) {
|
|
369
282
|
}; // 所有资源
|
370
283
|
|
371
284
|
var allCis = [].concat(data.nodes, data.links, data.linkGroups);
|
372
|
-
|
373
|
-
var resAndMetrics = _extends({
|
285
|
+
var resAndMetrics = {
|
374
286
|
// topo所有ci的id集合
|
375
287
|
resIdsList: allCis.map(function (item) {
|
376
288
|
return item.id;
|
377
289
|
}),
|
378
|
-
ciTypes: getCiTypes(data),
|
379
|
-
// ci类型集合
|
380
|
-
ciTypeMap: ciTypeMap,
|
381
|
-
// ci类型模型map
|
382
|
-
metrics: [],
|
383
|
-
// 所有指标
|
384
290
|
nodeIdsList: data.nodes.map(function (item) {
|
385
291
|
return {
|
386
292
|
ciId: item.id,
|
@@ -393,84 +299,13 @@ export var combTopoData = function combTopoData(_ref3) {
|
|
393
299
|
operation: linkObj.operation
|
394
300
|
};
|
395
301
|
})
|
396
|
-
},
|
397
|
-
engine: engine,
|
398
|
-
data: data,
|
399
|
-
allCis: allCis,
|
400
|
-
ciTypeMap: ciTypeMap,
|
401
|
-
globalConfig: globalConfig
|
402
|
-
})); // rlog.debug("combTopoData-格式化后数据", topoData, resAndMetrics);
|
403
|
-
|
302
|
+
}; // rlog.debug("combTopoData-格式化后数据", topoData, resAndMetrics);
|
404
303
|
|
405
304
|
return {
|
406
305
|
topoData: topoData,
|
407
306
|
resAndMetrics: resAndMetrics
|
408
307
|
};
|
409
308
|
};
|
410
|
-
export function getCiModSet(params) {
|
411
|
-
var data = params.data,
|
412
|
-
engine = params.engine,
|
413
|
-
allCis = params.allCis,
|
414
|
-
ciTypeMap = params.ciTypeMap,
|
415
|
-
globalConfig = params.globalConfig; // 当前拓扑资源字典
|
416
|
-
|
417
|
-
var ciDoc = {};
|
418
|
-
var ciTypesDoc = {};
|
419
|
-
var allCiModSet = getNodeModSet();
|
420
|
-
|
421
|
-
function getNodeModSet() {
|
422
|
-
var ciTypes = getCiTypesFromCiElements(data.nodes);
|
423
|
-
return getModSet(ciTypes);
|
424
|
-
}
|
425
|
-
/**
|
426
|
-
*
|
427
|
-
* @param {array} ciTypeCodes
|
428
|
-
* @returns
|
429
|
-
*/
|
430
|
-
|
431
|
-
|
432
|
-
function getModSet(ciTypeCodes) {
|
433
|
-
var modSet = {};
|
434
|
-
Object.keys(ciTypeMap).filter(function (item) {
|
435
|
-
return ciTypeCodes.includes(item);
|
436
|
-
}).forEach(function (key) {
|
437
|
-
var ciTypeObj = ciTypeMap[key];
|
438
|
-
modSet[key] = {
|
439
|
-
name: ciTypeObj.displayName,
|
440
|
-
code: ciTypeObj.code,
|
441
|
-
icon: ciTypeObj.icon,
|
442
|
-
list: ciModfilter(ciTypeObj, globalConfig, "node", ciTypeObj.code)
|
443
|
-
};
|
444
|
-
}); // console.log("modSet--------------------", modSet);
|
445
|
-
|
446
|
-
return modSet;
|
447
|
-
}
|
448
|
-
|
449
|
-
if (allCis.length > 0) {
|
450
|
-
allCis.forEach(function (element, index) {
|
451
|
-
var ciType = element.ciType;
|
452
|
-
ciDoc[element.id] = {
|
453
|
-
code: element.ciType,
|
454
|
-
name: element.name,
|
455
|
-
tag: [],
|
456
|
-
tip: []
|
457
|
-
};
|
458
|
-
ciTypesDoc[ciType] = ciTypesDoc[ciType] || [];
|
459
|
-
ciTypesDoc[element.ciType].push({
|
460
|
-
ciId: element.id
|
461
|
-
});
|
462
|
-
});
|
463
|
-
}
|
464
|
-
|
465
|
-
return {
|
466
|
-
ciDoc: ciDoc,
|
467
|
-
// ci信息集合
|
468
|
-
ciTypesDoc: ciTypesDoc,
|
469
|
-
// 每种ci含有的ci
|
470
|
-
allCiModSet: allCiModSet // 资源类型含有属性和指标集合
|
471
|
-
|
472
|
-
};
|
473
|
-
}
|
474
309
|
/**
|
475
310
|
* 获得两个节点间的连线列表
|
476
311
|
* @param {*} links
|
@@ -53,10 +53,6 @@ var Setting = function Setting(_ref) {
|
|
53
53
|
saveCb = props.saveCb,
|
54
54
|
elementType = props.elementType;
|
55
55
|
|
56
|
-
_rlog["default"].debug("Setting-resAndMetrics-allCiSet-elementType", showType, props, elementType);
|
57
|
-
|
58
|
-
_rlog["default"].debug("Setting----allCiSet", allCiSet);
|
59
|
-
|
60
56
|
var _useState = (0, _react.useState)(Object.keys(allCiSet)[0]),
|
61
57
|
ciType = _useState[0],
|
62
58
|
setCiType = _useState[1];
|