@riil-frontend/component-topology 12.0.0-dev.8 → 12.0.0-dev.9
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 +6 -6
- package/es/core/hooks/useTopoEdit.js +21 -16
- package/es/core/models/AttributeMetricDisplay.js +5 -2
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/cache/CiTypeCache.js +4 -0
- package/es/core/services/index.js +1 -1
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +12 -13
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +20 -18
- package/es/utils/ciRefAttributeTranslateUtil.d.ts +12 -0
- package/es/utils/ciRefAttributeTranslateUtil.js +156 -0
- package/es/utils/topoData.js +4 -2
- package/lib/core/hooks/useTopoEdit.js +21 -16
- package/lib/core/models/AttributeMetricDisplay.js +6 -2
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/cache/CiTypeCache.js +4 -0
- package/lib/core/services/index.js +1 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +12 -13
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +20 -18
- package/lib/utils/ciRefAttributeTranslateUtil.d.ts +12 -0
- package/lib/utils/ciRefAttributeTranslateUtil.js +169 -0
- package/lib/utils/topoData.js +4 -2
- package/package.json +3 -3
@@ -554,7 +554,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
554
554
|
|
555
555
|
function _bindViewResources() {
|
556
556
|
_bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(data) {
|
557
|
-
var config,
|
557
|
+
var config, result, _elements;
|
558
558
|
|
559
559
|
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
560
560
|
while (1) switch (_context12.prev = _context12.next) {
|
@@ -570,15 +570,19 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
570
570
|
return editDispatchers.fetchDataByConfig();
|
571
571
|
|
572
572
|
case 6:
|
573
|
-
|
574
|
-
|
575
|
-
saveBind(TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements); // 临时放这里,仅拓扑中心有
|
573
|
+
result = _context12.sent;
|
574
|
+
console.log("fetchDataByConfig", result);
|
576
575
|
|
577
|
-
if (
|
578
|
-
|
576
|
+
if (result) {
|
577
|
+
_elements = result.elements;
|
578
|
+
saveBind(TopoEvent.DATA_TYPE_RESOURCE_COMBO, _elements); // 临时放这里,仅拓扑中心有
|
579
|
+
|
580
|
+
if (topo.linkDynamicStyleExecutor) {
|
581
|
+
topo.linkDynamicStyleExecutor.execute();
|
582
|
+
}
|
579
583
|
}
|
580
584
|
|
581
|
-
case
|
585
|
+
case 9:
|
582
586
|
case "end":
|
583
587
|
return _context12.stop();
|
584
588
|
}
|
@@ -593,7 +597,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
593
597
|
|
594
598
|
function _addLayerResources() {
|
595
599
|
_addLayerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(group, newResourceIds) {
|
596
|
-
var _yield$
|
600
|
+
var _yield$editDispatcher3, elements, newElements;
|
597
601
|
|
598
602
|
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
599
603
|
while (1) switch (_context13.prev = _context13.next) {
|
@@ -608,8 +612,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
608
612
|
return editDispatchers.fetchDataByConfig();
|
609
613
|
|
610
614
|
case 5:
|
611
|
-
_yield$
|
612
|
-
elements = _yield$
|
615
|
+
_yield$editDispatcher3 = _context13.sent;
|
616
|
+
elements = _yield$editDispatcher3.elements;
|
613
617
|
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
614
618
|
newElements = findUNExistedElements(elements);
|
615
619
|
rlog.debug("添加分层资源", {
|
@@ -1001,7 +1005,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1001
1005
|
|
1002
1006
|
function _relateNodeIp() {
|
1003
1007
|
_relateNodeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(txtValue, nodeElement) {
|
1004
|
-
var dm, isUnique, ip, configObj, configData,
|
1008
|
+
var dm, isUnique, ip, configObj, configData, _elements2, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
1005
1009
|
|
1006
1010
|
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
1007
1011
|
while (1) switch (_context15.prev = _context15.next) {
|
@@ -1023,7 +1027,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1023
1027
|
isUnique = isUniqueIp(dm, txtValue, nodeElement); // 获取关联链路
|
1024
1028
|
|
1025
1029
|
if (!isUnique) {
|
1026
|
-
_context15.next =
|
1030
|
+
_context15.next = 24;
|
1027
1031
|
break;
|
1028
1032
|
}
|
1029
1033
|
|
@@ -1047,8 +1051,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1047
1051
|
case 16:
|
1048
1052
|
configData = _context15.sent;
|
1049
1053
|
// console.log("configData",configObj, configData);
|
1050
|
-
|
1051
|
-
newLinkElements = findUNExistedLinkElements(
|
1054
|
+
_elements2 = configData.elements;
|
1055
|
+
newLinkElements = findUNExistedLinkElements(_elements2); // console.log("configData", configData, newLinkElements);
|
1052
1056
|
|
1053
1057
|
newLink = newLinkElements.filter(function (item) {
|
1054
1058
|
return item.type === "link";
|
@@ -1063,7 +1067,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1063
1067
|
nodes: [],
|
1064
1068
|
links: newLink,
|
1065
1069
|
linkGroups: newLinkGroup
|
1066
|
-
};
|
1070
|
+
};
|
1071
|
+
console.log("createElementsData", createElementsData);
|
1067
1072
|
|
1068
1073
|
if ([].concat(newLink, newLinkGroup).length > 0) {
|
1069
1074
|
_htTopo = topo.getHtTopo();
|
@@ -1071,7 +1076,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1071
1076
|
_htTopo.createElements(createElementsData);
|
1072
1077
|
}
|
1073
1078
|
|
1074
|
-
case
|
1079
|
+
case 24:
|
1075
1080
|
case "end":
|
1076
1081
|
return _context15.stop();
|
1077
1082
|
}
|
@@ -7,6 +7,7 @@ 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
|
+
import { translateCisRefAttributeName } from "../../utils/ciRefAttributeTranslateUtil";
|
10
11
|
|
11
12
|
function isGraphField(item) {
|
12
13
|
return item.type === 'graph';
|
@@ -331,7 +332,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
331
332
|
}); // 翻译引用属性
|
332
333
|
|
333
334
|
_context.next = 4;
|
334
|
-
return
|
335
|
+
return translateCisRefAttributeName(ciDatas);
|
335
336
|
|
336
337
|
case 4:
|
337
338
|
ciDatas = _context.sent;
|
@@ -461,8 +462,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
461
462
|
var refCi = refCiMap[refAttrs.id];
|
462
463
|
|
463
464
|
if (refCi) {
|
465
|
+
// 引用ci名称获取规则:如果ci是树形结构(例如区域),取 tree_name_path;非树形,取display_name
|
466
|
+
var displayName = refCi.attributes.tree_name_path || refCi.attributes.display_name;
|
464
467
|
attributeMap[refAttrs.attrCode + "_object"] = {
|
465
|
-
displayName:
|
468
|
+
displayName: displayName
|
466
469
|
};
|
467
470
|
}
|
468
471
|
});
|
@@ -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.9" === 'string' ? "12.0.0-dev.9" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
@@ -106,6 +106,10 @@ var CiTypeCache = /*#__PURE__*/function () {
|
|
106
106
|
this.ciTypeMap = cache;
|
107
107
|
};
|
108
108
|
|
109
|
+
_proto.getCiTypeMap = function getCiTypeMap() {
|
110
|
+
return this.ciTypeMap;
|
111
|
+
};
|
112
|
+
|
109
113
|
_proto.getCiType = function getCiType(typeCode) {
|
110
114
|
return this.ciTypeMap[typeCode];
|
111
115
|
};
|
package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js
CHANGED
@@ -20,32 +20,31 @@ function EventsCard(props) {
|
|
20
20
|
onHandleAlarm = props.onHandleAlarm; // 告警table列配置
|
21
21
|
|
22
22
|
var columns = [{
|
23
|
-
title:
|
24
|
-
dataIndex:
|
25
|
-
key:
|
23
|
+
title: "描述",
|
24
|
+
dataIndex: "title",
|
25
|
+
key: "title",
|
26
26
|
cell: function cell(value, index, record) {
|
27
27
|
return /*#__PURE__*/React.createElement("div", {
|
28
|
-
className: styles[
|
28
|
+
className: styles["alarm-title"],
|
29
29
|
title: value,
|
30
30
|
onClick: closeDetailDrawer
|
31
31
|
}, /*#__PURE__*/React.createElement(_Icon, {
|
32
32
|
type: record.icon,
|
33
33
|
size: "xs",
|
34
|
-
className: styles[
|
35
|
-
}), /*#__PURE__*/React.createElement(
|
36
|
-
|
37
|
-
href: formatUrl(record.link)
|
34
|
+
className: styles["alarm-color-icon"] + " " + record.className
|
35
|
+
}), /*#__PURE__*/React.createElement(Link, {
|
36
|
+
to: formatUrl(record.link)
|
38
37
|
}, value));
|
39
38
|
}
|
40
39
|
}, {
|
41
|
-
title:
|
42
|
-
dataIndex:
|
43
|
-
key:
|
40
|
+
title: "时间",
|
41
|
+
dataIndex: "time",
|
42
|
+
key: "time",
|
44
43
|
width: 144,
|
45
44
|
cell: function cell(value, index, record) {
|
46
45
|
return /*#__PURE__*/React.createElement("div", {
|
47
|
-
title: moment(value).format(
|
48
|
-
}, moment(value).format(
|
46
|
+
title: moment(value).format("YYYY-MM-DD HH:mm:ss")
|
47
|
+
}, moment(value).format("YYYY-MM-DD HH:mm:ss"));
|
49
48
|
}
|
50
49
|
} // 临时屏蔽告警操作列,后续版本按权限显示 2023-3-6 20:23:45
|
51
50
|
// {
|
@@ -34,7 +34,7 @@ var useAlarmAndRiskData = function useAlarmAndRiskData(props) {
|
|
34
34
|
while (1) switch (_context.prev = _context.next) {
|
35
35
|
case 0:
|
36
36
|
if (!isAppTopo) {
|
37
|
-
_context.next =
|
37
|
+
_context.next = 10;
|
38
38
|
break;
|
39
39
|
}
|
40
40
|
|
@@ -49,27 +49,29 @@ var useAlarmAndRiskData = function useAlarmAndRiskData(props) {
|
|
49
49
|
alarmList = _yield$resourceOvervi2.alarms;
|
50
50
|
alarmList = ((_alarmList = alarmList) === null || _alarmList === void 0 ? void 0 : _alarmList.map(function (item) {
|
51
51
|
return {
|
52
|
-
|
53
|
-
|
52
|
+
alarmInfo: item,
|
53
|
+
type: "alarm",
|
54
|
+
icon: "gaojing-3",
|
54
55
|
className: "alarm-color-icon-lv" + item.alertLevel,
|
55
56
|
title: "[" + item.alertObject + "] " + item.alertTitle,
|
56
|
-
link: "/default/pagecenter/alertDetail/view/" + item.alertId + "?alertId=" + item.alertId + "&resId=" + item.ciId + "&title=" + item.alertObject + "&ruleId=" + item.ruleId,
|
57
|
+
link: "/default/pagecenter/alertDetail/view/" + item.alertId + "?alertId=" + item.alertId + "&resId=" + item.ciId + "&title=" + encodeURI(encodeURI(item.alertObject)) + "&ruleId=" + item.ruleId,
|
57
58
|
time: item.createTime,
|
58
59
|
status: item.status,
|
59
60
|
params: [{
|
60
61
|
alertId: item.alertId,
|
61
|
-
status:
|
62
|
+
status: "dealing",
|
62
63
|
userId: userId,
|
63
64
|
isBaseAlert: false
|
64
65
|
}]
|
65
66
|
};
|
66
67
|
})) || [];
|
68
|
+
console.log("setAlarmRiskList", alarmList);
|
67
69
|
setAlarmRiskList(alarmList);
|
68
|
-
_context.next =
|
70
|
+
_context.next = 25;
|
69
71
|
break;
|
70
72
|
|
71
|
-
case
|
72
|
-
_context.next =
|
73
|
+
case 10:
|
74
|
+
_context.next = 12;
|
73
75
|
return alarmService.getAlarmByIds([id].concat(childrenIds), {
|
74
76
|
alertStatusList: ['toDeal', 'woDealing', 'dealing'],
|
75
77
|
// toDeal: 待处理, dealing:处理中
|
@@ -79,7 +81,7 @@ var useAlarmAndRiskData = function useAlarmAndRiskData(props) {
|
|
79
81
|
sortOrder: 'asc'
|
80
82
|
});
|
81
83
|
|
82
|
-
case
|
84
|
+
case 12:
|
83
85
|
_yield$alarmService$g2 = _context.sent;
|
84
86
|
_alarmList2 = _yield$alarmService$g2.datas;
|
85
87
|
// 2022-07-16 后端不支持多列排序,暂通过前端实现,按创建时间倒序
|
@@ -88,28 +90,28 @@ var useAlarmAndRiskData = function useAlarmAndRiskData(props) {
|
|
88
90
|
});
|
89
91
|
_alarmList2 = _alarmList2.map(function (item) {
|
90
92
|
return {
|
91
|
-
type:
|
92
|
-
icon:
|
93
|
+
type: "alarm",
|
94
|
+
icon: "gaojing-3",
|
93
95
|
className: "alarm-color-icon-lv" + item.alertLevel,
|
94
96
|
title: "" + item.alertObject + item.alertTitle,
|
95
|
-
link: "/default/pagecenter/alertDetail/view/" + item.alertId + "?alertId=" + item.alertId + "&resId=" + item.ciId + "&title=" + item.alertObject + "&ruleId=" + item.ruleId,
|
97
|
+
link: "/default/pagecenter/alertDetail/view/" + item.alertId + "?alertId=" + item.alertId + "&resId=" + item.ciId + "&title=" + encodeURI(encodeURI(item.alertObject)) + "&ruleId=" + item.ruleId,
|
96
98
|
time: item.createTime,
|
97
99
|
status: item.status,
|
98
100
|
params: [{
|
99
101
|
alertId: item.alertId,
|
100
|
-
status:
|
102
|
+
status: "dealing",
|
101
103
|
userId: userId,
|
102
104
|
isBaseAlert: false
|
103
105
|
}]
|
104
106
|
};
|
105
107
|
}); // fix NEWITOM-33635【南昌大学】网络拓扑上双击设备拉开的抽屉中无法看到风险
|
106
108
|
|
107
|
-
_context.next =
|
109
|
+
_context.next = 18;
|
108
110
|
return service.queryAllComponentsByCiId(id);
|
109
111
|
|
110
|
-
case
|
112
|
+
case 18:
|
111
113
|
AllComponentsByCiId = _context.sent;
|
112
|
-
_context.next =
|
114
|
+
_context.next = 21;
|
113
115
|
return service.getRiskByIds({
|
114
116
|
ciIdList: [id].concat(childrenIds, AllComponentsByCiId.map(function (item) {
|
115
117
|
return item.id;
|
@@ -119,7 +121,7 @@ var useAlarmAndRiskData = function useAlarmAndRiskData(props) {
|
|
119
121
|
pageSize: 10000
|
120
122
|
});
|
121
123
|
|
122
|
-
case
|
124
|
+
case 21:
|
123
125
|
_yield$service$getRis2 = _context.sent;
|
124
126
|
riskList = _yield$service$getRis2.content;
|
125
127
|
riskList = riskList.map(function (item) {
|
@@ -135,7 +137,7 @@ var useAlarmAndRiskData = function useAlarmAndRiskData(props) {
|
|
135
137
|
|
136
138
|
setAlarmRiskList([].concat(_alarmList2, riskList));
|
137
139
|
|
138
|
-
case
|
140
|
+
case 25:
|
139
141
|
case "end":
|
140
142
|
return _context.stop();
|
141
143
|
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/**
|
2
|
+
* 翻译ci列表引用属性名称
|
3
|
+
* @param ciDatas
|
4
|
+
* @returns
|
5
|
+
*/
|
6
|
+
export declare function translateCisRefAttributeName(ciDatas: Array<any>): Promise<Array<any>>;
|
7
|
+
/**
|
8
|
+
* 翻译ci引用属性名称
|
9
|
+
* @param ciData
|
10
|
+
* @returns
|
11
|
+
*/
|
12
|
+
export declare function translateCiRefAttributeName(ciData: any): Promise<any>;
|
@@ -0,0 +1,156 @@
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
4
|
+
import { rlog } from '@riil-frontend/component-topology-utils';
|
5
|
+
import ciTypeCache from "../core/models/cache/CiTypeCache";
|
6
|
+
import ciCache from "../core/models/cache/CiCache";
|
7
|
+
import { getCiTypesFromCiElements } from "./topoData";
|
8
|
+
|
9
|
+
/**
|
10
|
+
* 获取ci列表的引用字段列表
|
11
|
+
*/
|
12
|
+
function getCiRefAttributesMap(ciDatas, ciTypeMap) {
|
13
|
+
// ci引用字段列表
|
14
|
+
var ciRefAttributeMap = {};
|
15
|
+
ciDatas.forEach(function (ciData) {
|
16
|
+
var id = ciData.id;
|
17
|
+
var attributeMap = ciData.attributeMap || ciData.attributes;
|
18
|
+
ciRefAttributeMap[id] = [];
|
19
|
+
var typeCode = ciData.typeCode || ciData.ciType;
|
20
|
+
var ciTypeMeta = ciTypeMap[typeCode];
|
21
|
+
|
22
|
+
if (ciTypeMeta) {
|
23
|
+
ciTypeMeta.attributes.filter(function (attributeMeta) {
|
24
|
+
return !!attributeMeta.refCi;
|
25
|
+
}).forEach(function (attributeMeta) {
|
26
|
+
var refId = attributeMap[attributeMeta.code];
|
27
|
+
|
28
|
+
if (refId) {
|
29
|
+
var ciRefAttributeData = {
|
30
|
+
attrCode: attributeMeta.code,
|
31
|
+
id: refId
|
32
|
+
};
|
33
|
+
ciRefAttributeMap[ciData.id].push(ciRefAttributeData);
|
34
|
+
}
|
35
|
+
});
|
36
|
+
} else {
|
37
|
+
rlog.warn("\u7FFB\u8BD1\u5F15\u7528\u5B57\u6BB5\u540D\u79F0\uFF1A\u672A\u67E5\u8BE2\u5230ciType " + typeCode, ciData);
|
38
|
+
}
|
39
|
+
});
|
40
|
+
return ciRefAttributeMap;
|
41
|
+
}
|
42
|
+
|
43
|
+
function getRefIds(ciRefAttributesMap) {
|
44
|
+
var refIds = [];
|
45
|
+
Object.keys(ciRefAttributesMap).forEach(function (ciId) {
|
46
|
+
var ciRefAttributeDatas = ciRefAttributesMap[ciId];
|
47
|
+
ciRefAttributeDatas.forEach(function (ciRefAttributeData) {
|
48
|
+
var refId = ciRefAttributeData.id;
|
49
|
+
|
50
|
+
if (!refIds.includes(refId)) {
|
51
|
+
refIds.push(refId);
|
52
|
+
}
|
53
|
+
});
|
54
|
+
});
|
55
|
+
return refIds;
|
56
|
+
}
|
57
|
+
|
58
|
+
function addRefCiNameToCiDatas(ciDatas, ciRefAttributesMap, refCiMap) {
|
59
|
+
return ciDatas.map(function (ciData) {
|
60
|
+
var id = ciData.id;
|
61
|
+
|
62
|
+
var attributeMap = _extends({}, ciData.attributeMap || ciData.attributes);
|
63
|
+
|
64
|
+
ciRefAttributesMap[id].forEach(function (refAttrs) {
|
65
|
+
var refCi = refCiMap[refAttrs.id];
|
66
|
+
|
67
|
+
if (refCi) {
|
68
|
+
// 引用ci名称获取规则:如果ci是树形结构(例如区域),取 tree_name_path;非树形,取display_name
|
69
|
+
var displayName = refCi.attributes.tree_name_path || refCi.attributes.display_name;
|
70
|
+
attributeMap[refAttrs.attrCode + "_object"] = {
|
71
|
+
displayName: displayName
|
72
|
+
};
|
73
|
+
}
|
74
|
+
});
|
75
|
+
return _extends({}, ciData, {
|
76
|
+
attributeMap: attributeMap
|
77
|
+
});
|
78
|
+
});
|
79
|
+
}
|
80
|
+
/**
|
81
|
+
* 翻译ci列表引用属性名称
|
82
|
+
* @param ciDatas
|
83
|
+
* @returns
|
84
|
+
*/
|
85
|
+
|
86
|
+
|
87
|
+
export function translateCisRefAttributeName(_x) {
|
88
|
+
return _translateCisRefAttributeName.apply(this, arguments);
|
89
|
+
}
|
90
|
+
/**
|
91
|
+
* 翻译ci引用属性名称
|
92
|
+
* @param ciData
|
93
|
+
* @returns
|
94
|
+
*/
|
95
|
+
|
96
|
+
function _translateCisRefAttributeName() {
|
97
|
+
_translateCisRefAttributeName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(ciDatas) {
|
98
|
+
var ciTypeMap, ciRefAttributesMap, refIds, refCiMap;
|
99
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
100
|
+
while (1) switch (_context.prev = _context.next) {
|
101
|
+
case 0:
|
102
|
+
_context.next = 2;
|
103
|
+
return ciTypeCache.load(getCiTypesFromCiElements(ciDatas));
|
104
|
+
|
105
|
+
case 2:
|
106
|
+
ciTypeMap = _context.sent;
|
107
|
+
// 2. 查找引用字段及值
|
108
|
+
ciRefAttributesMap = getCiRefAttributesMap(ciDatas, ciTypeMap); // 3. 引用id列表
|
109
|
+
|
110
|
+
refIds = getRefIds(ciRefAttributesMap);
|
111
|
+
|
112
|
+
if (refIds.length) {
|
113
|
+
_context.next = 7;
|
114
|
+
break;
|
115
|
+
}
|
116
|
+
|
117
|
+
return _context.abrupt("return", ciDatas);
|
118
|
+
|
119
|
+
case 7:
|
120
|
+
_context.next = 9;
|
121
|
+
return ciCache.load(refIds);
|
122
|
+
|
123
|
+
case 9:
|
124
|
+
refCiMap = _context.sent;
|
125
|
+
return _context.abrupt("return", addRefCiNameToCiDatas(ciDatas, ciRefAttributesMap, refCiMap));
|
126
|
+
|
127
|
+
case 11:
|
128
|
+
case "end":
|
129
|
+
return _context.stop();
|
130
|
+
}
|
131
|
+
}, _callee);
|
132
|
+
}));
|
133
|
+
return _translateCisRefAttributeName.apply(this, arguments);
|
134
|
+
}
|
135
|
+
|
136
|
+
export function translateCiRefAttributeName(_x2) {
|
137
|
+
return _translateCiRefAttributeName.apply(this, arguments);
|
138
|
+
}
|
139
|
+
|
140
|
+
function _translateCiRefAttributeName() {
|
141
|
+
_translateCiRefAttributeName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(ciData) {
|
142
|
+
var result;
|
143
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
144
|
+
while (1) switch (_context2.prev = _context2.next) {
|
145
|
+
case 0:
|
146
|
+
result = translateCisRefAttributeName([]);
|
147
|
+
return _context2.abrupt("return", result[0]);
|
148
|
+
|
149
|
+
case 2:
|
150
|
+
case "end":
|
151
|
+
return _context2.stop();
|
152
|
+
}
|
153
|
+
}, _callee2);
|
154
|
+
}));
|
155
|
+
return _translateCiRefAttributeName.apply(this, arguments);
|
156
|
+
}
|
package/es/utils/topoData.js
CHANGED
@@ -97,8 +97,10 @@ var tfLink = function tfLink(engine, link) {
|
|
97
97
|
export function getCiTypesFromCiElements(allCi) {
|
98
98
|
var ciTypes = [];
|
99
99
|
allCi.forEach(function (element) {
|
100
|
-
|
101
|
-
|
100
|
+
var typeCode = element.typeCode || element.ciType;
|
101
|
+
|
102
|
+
if (typeCode && ciTypes.indexOf(typeCode) < 0) {
|
103
|
+
ciTypes.push(typeCode);
|
102
104
|
}
|
103
105
|
});
|
104
106
|
return ciTypes;
|
@@ -591,7 +591,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
591
591
|
|
592
592
|
function _bindViewResources() {
|
593
593
|
_bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(data) {
|
594
|
-
var config,
|
594
|
+
var config, result, _elements;
|
595
595
|
|
596
596
|
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
597
597
|
while (1) switch (_context12.prev = _context12.next) {
|
@@ -607,15 +607,19 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
607
607
|
return editDispatchers.fetchDataByConfig();
|
608
608
|
|
609
609
|
case 6:
|
610
|
-
|
611
|
-
|
612
|
-
saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements); // 临时放这里,仅拓扑中心有
|
610
|
+
result = _context12.sent;
|
611
|
+
console.log("fetchDataByConfig", result);
|
613
612
|
|
614
|
-
if (
|
615
|
-
|
613
|
+
if (result) {
|
614
|
+
_elements = result.elements;
|
615
|
+
saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, _elements); // 临时放这里,仅拓扑中心有
|
616
|
+
|
617
|
+
if (topo.linkDynamicStyleExecutor) {
|
618
|
+
topo.linkDynamicStyleExecutor.execute();
|
619
|
+
}
|
616
620
|
}
|
617
621
|
|
618
|
-
case
|
622
|
+
case 9:
|
619
623
|
case "end":
|
620
624
|
return _context12.stop();
|
621
625
|
}
|
@@ -630,7 +634,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
630
634
|
|
631
635
|
function _addLayerResources() {
|
632
636
|
_addLayerResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(group, newResourceIds) {
|
633
|
-
var _yield$
|
637
|
+
var _yield$editDispatcher3, elements, newElements;
|
634
638
|
|
635
639
|
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
636
640
|
while (1) switch (_context13.prev = _context13.next) {
|
@@ -645,8 +649,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
645
649
|
return editDispatchers.fetchDataByConfig();
|
646
650
|
|
647
651
|
case 5:
|
648
|
-
_yield$
|
649
|
-
elements = _yield$
|
652
|
+
_yield$editDispatcher3 = _context13.sent;
|
653
|
+
elements = _yield$editDispatcher3.elements;
|
650
654
|
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
651
655
|
newElements = findUNExistedElements(elements);
|
652
656
|
|
@@ -1047,7 +1051,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1047
1051
|
|
1048
1052
|
function _relateNodeIp() {
|
1049
1053
|
_relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(txtValue, nodeElement) {
|
1050
|
-
var dm, isUnique, ip, configObj, configData,
|
1054
|
+
var dm, isUnique, ip, configObj, configData, _elements2, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
1051
1055
|
|
1052
1056
|
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
1053
1057
|
while (1) switch (_context15.prev = _context15.next) {
|
@@ -1069,7 +1073,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1069
1073
|
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
|
1070
1074
|
|
1071
1075
|
if (!isUnique) {
|
1072
|
-
_context15.next =
|
1076
|
+
_context15.next = 24;
|
1073
1077
|
break;
|
1074
1078
|
}
|
1075
1079
|
|
@@ -1093,8 +1097,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1093
1097
|
case 16:
|
1094
1098
|
configData = _context15.sent;
|
1095
1099
|
// console.log("configData",configObj, configData);
|
1096
|
-
|
1097
|
-
newLinkElements = findUNExistedLinkElements(
|
1100
|
+
_elements2 = configData.elements;
|
1101
|
+
newLinkElements = findUNExistedLinkElements(_elements2); // console.log("configData", configData, newLinkElements);
|
1098
1102
|
|
1099
1103
|
newLink = newLinkElements.filter(function (item) {
|
1100
1104
|
return item.type === "link";
|
@@ -1109,7 +1113,8 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1109
1113
|
nodes: [],
|
1110
1114
|
links: newLink,
|
1111
1115
|
linkGroups: newLinkGroup
|
1112
|
-
};
|
1116
|
+
};
|
1117
|
+
console.log("createElementsData", createElementsData);
|
1113
1118
|
|
1114
1119
|
if ([].concat(newLink, newLinkGroup).length > 0) {
|
1115
1120
|
_htTopo = topo.getHtTopo();
|
@@ -1117,7 +1122,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1117
1122
|
_htTopo.createElements(createElementsData);
|
1118
1123
|
}
|
1119
1124
|
|
1120
|
-
case
|
1125
|
+
case 24:
|
1121
1126
|
case "end":
|
1122
1127
|
return _context15.stop();
|
1123
1128
|
}
|
@@ -23,6 +23,8 @@ var _DictCache = _interopRequireDefault(require("./cache/DictCache"));
|
|
23
23
|
|
24
24
|
var _nodeNameVisibleUtil = require("./utils/nodeNameVisibleUtil");
|
25
25
|
|
26
|
+
var _ciRefAttributeTranslateUtil = require("../../utils/ciRefAttributeTranslateUtil");
|
27
|
+
|
26
28
|
function isGraphField(item) {
|
27
29
|
return item.type === 'graph';
|
28
30
|
}
|
@@ -346,7 +348,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
346
348
|
}); // 翻译引用属性
|
347
349
|
|
348
350
|
_context.next = 4;
|
349
|
-
return
|
351
|
+
return (0, _ciRefAttributeTranslateUtil.translateCisRefAttributeName)(ciDatas);
|
350
352
|
|
351
353
|
case 4:
|
352
354
|
ciDatas = _context.sent;
|
@@ -474,8 +476,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
474
476
|
var refCi = refCiMap[refAttrs.id];
|
475
477
|
|
476
478
|
if (refCi) {
|
479
|
+
// 引用ci名称获取规则:如果ci是树形结构(例如区域),取 tree_name_path;非树形,取display_name
|
480
|
+
var displayName = refCi.attributes.tree_name_path || refCi.attributes.display_name;
|
477
481
|
attributeMap[refAttrs.attrCode + "_object"] = {
|
478
|
-
displayName:
|
482
|
+
displayName: displayName
|
479
483
|
};
|
480
484
|
}
|
481
485
|
});
|
@@ -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 "12.0.0-dev.
|
57
|
+
var version = typeof "12.0.0-dev.9" === 'string' ? "12.0.0-dev.9" : null;
|
58
58
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
59
59
|
/**
|
60
60
|
* 拓扑显示和编辑
|
@@ -119,6 +119,10 @@ var CiTypeCache = /*#__PURE__*/function () {
|
|
119
119
|
this.ciTypeMap = cache;
|
120
120
|
};
|
121
121
|
|
122
|
+
_proto.getCiTypeMap = function getCiTypeMap() {
|
123
|
+
return this.ciTypeMap;
|
124
|
+
};
|
125
|
+
|
122
126
|
_proto.getCiType = function getCiType(typeCode) {
|
123
127
|
return this.ciTypeMap[typeCode];
|
124
128
|
};
|