@riil-frontend/component-topology 2.14.2-alpha.2 → 2.14.2-alpha.6
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/1.js +2 -2
- package/build/2.js +1 -1
- package/build/index.css +1 -1
- package/build/index.js +22 -22
- package/demo/1/345/237/272/346/234/254//350/207/252/345/256/232/344/271/211/345/261/236/346/200/247/345/222/214/346/214/207/346/240/207.md +1 -1
- package/demo/API//346/250/241/345/236/213.md +29 -0
- package/es/components/BatchAttrMetric/constant.js +4 -0
- package/es/components/BatchAttrMetric/index.js +8 -10
- package/es/components/BatchAttrMetric/setting.js +6 -4
- package/es/components/BatchAttrMetric/utils.js +39 -32
- package/es/constants/ResourceTypeLimit.js +1 -1
- package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +6 -5
- package/es/core/components/DisplaySettingDrawer/LinkTag.js +8 -6
- package/es/core/components/DisplaySettingDrawer/LinkTip.js +9 -7
- package/es/core/components/DisplaySettingDrawer/NodeTag.js +2 -0
- package/es/core/components/DisplaySettingDrawer/NodeTip.js +2 -0
- package/es/core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig.js +30 -9
- package/es/core/components/ResourceViewAttributeSetting/Setting.js +123 -0
- package/es/core/editor/components/EditorPlugin.js +4 -3
- package/es/core/editor/components/settings/propertyViews/view/GlobalTootipSetting.js +3 -1
- package/es/core/editor/components/settings/propertyViews/view/ViewPropertyView.js +0 -5
- package/es/core/models/AttributeMetricDisplay.js +181 -66
- package/es/core/models/TopoApp.js +18 -16
- package/es/core/models/attributeFormatter/index.js +33 -8
- package/es/core/models/common/Alarm.js +45 -31
- package/es/core/models/utils/linkUtils.js +14 -2
- package/es/core/utils/exportData.js +33 -0
- package/es/core/utils/linkPollingAttributesAdapter.js +3 -0
- package/es/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.js +264 -0
- package/es/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.module.scss +73 -0
- package/es/core/viewer/components/plugins/BaseInfo/index.js +127 -0
- package/es/core/viewer/components/plugins/BaseInfo/index.module.scss +24 -0
- package/es/core/viewer/components/plugins/ViewerPlugin.js +2 -1
- package/es/core/viewer/components/titlebar/widgets/MoreButtonMenu.js +5 -0
- package/es/getStoreModels.js +3 -1
- package/es/hooks/useAlarm.js +1 -1
- package/es/hooks/usePolling.js +2 -1
- package/es/models/topoAlarm.js +43 -17
- package/es/models/topoBaseInfoOverview.js +43 -0
- package/es/models/topoBizMod.js +0 -70
- package/es/style.js +8 -7
- package/es/utils/topoData.js +266 -155
- package/lib/components/BatchAttrMetric/constant.js +4 -0
- package/lib/components/BatchAttrMetric/index.js +8 -10
- package/lib/components/BatchAttrMetric/setting.js +8 -5
- package/lib/components/BatchAttrMetric/utils.js +39 -35
- package/lib/constants/ResourceTypeLimit.js +1 -1
- package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +6 -5
- package/lib/core/components/DisplaySettingDrawer/LinkTag.js +8 -6
- package/lib/core/components/DisplaySettingDrawer/LinkTip.js +9 -7
- package/lib/core/components/DisplaySettingDrawer/NodeTag.js +2 -0
- package/lib/core/components/DisplaySettingDrawer/NodeTip.js +2 -0
- package/lib/core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig.js +32 -8
- package/lib/core/{editor/components → components}/ResourceViewAttributeSetting/Setting.js +77 -71
- package/lib/core/editor/components/EditorPlugin.js +3 -3
- package/lib/core/editor/components/settings/propertyViews/view/GlobalTootipSetting.js +3 -1
- package/lib/core/editor/components/settings/propertyViews/view/ViewPropertyView.js +0 -5
- package/lib/core/models/AttributeMetricDisplay.js +181 -66
- package/lib/core/models/TopoApp.js +18 -17
- package/lib/core/models/attributeFormatter/index.js +34 -8
- package/lib/core/models/common/Alarm.js +46 -33
- package/lib/core/models/utils/linkUtils.js +12 -2
- package/lib/core/utils/exportData.js +44 -0
- package/lib/core/utils/linkPollingAttributesAdapter.js +10 -0
- package/lib/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.js +284 -0
- package/lib/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.module.scss +73 -0
- package/lib/core/viewer/components/plugins/BaseInfo/index.js +146 -0
- package/lib/core/viewer/components/plugins/BaseInfo/index.module.scss +24 -0
- package/lib/core/viewer/components/plugins/ViewerPlugin.js +3 -1
- package/lib/core/viewer/components/titlebar/widgets/MoreButtonMenu.js +6 -0
- package/lib/getStoreModels.js +4 -1
- package/lib/hooks/useAlarm.js +1 -1
- package/lib/hooks/usePolling.js +2 -1
- package/lib/models/topoAlarm.js +43 -17
- package/lib/models/topoBaseInfoOverview.js +55 -0
- package/lib/models/topoBizMod.js +0 -70
- package/lib/style.js +8 -7
- package/lib/utils/topoData.js +267 -151
- package/package.json +2 -2
- package/es/core/editor/components/ResourceViewAttributeSetting/ResourceViewAttributeSettingPlugin.js +0 -57
- package/es/core/editor/components/ResourceViewAttributeSetting/Setting.js +0 -114
- package/es/core/models/attrAndMetric.js +0 -131
- package/lib/core/editor/components/ResourceViewAttributeSetting/ResourceViewAttributeSettingPlugin.js +0 -73
- package/lib/core/models/attrAndMetric.js +0 -148
|
@@ -13,8 +13,6 @@ var _IconManage = _interopRequireDefault(require("./iconManage/IconManage"));
|
|
|
13
13
|
|
|
14
14
|
var _LinkDynamicStyleSettingDrawer = _interopRequireDefault(require("./LinkDynamicStyleSettingDrawer"));
|
|
15
15
|
|
|
16
|
-
var _ResourceViewAttributeSettingPlugin = _interopRequireDefault(require("./ResourceViewAttributeSetting/ResourceViewAttributeSettingPlugin"));
|
|
17
|
-
|
|
18
16
|
var _Link = _interopRequireDefault(require("../../../components/Link"));
|
|
19
17
|
|
|
20
18
|
var _SaveLoading = _interopRequireDefault(require("./plugins/SaveLoading"));
|
|
@@ -23,13 +21,15 @@ var _MultipleResourceSelectPlugin = _interopRequireDefault(require("./plugins/Mu
|
|
|
23
21
|
|
|
24
22
|
var _GroupAddResourceDrawerPlugin = _interopRequireDefault(require("./GroupAddResourceDrawerPlugin"));
|
|
25
23
|
|
|
24
|
+
// import ResourceViewAttributeSettingPlugin from './ResourceViewAttributeSetting/ResourceViewAttributeSettingPlugin';
|
|
26
25
|
function TopoEditorPlugin(props) {
|
|
27
26
|
var topo = props.topo,
|
|
28
27
|
topoContext = props.topoContext,
|
|
29
28
|
topoEdit = props.topoEdit,
|
|
30
29
|
editorProps = props.editorProps;
|
|
31
30
|
var store = topo.store;
|
|
32
|
-
var plugins = [_SaveLoading["default"], _GroupAddResourceDrawerPlugin["default"], _MultipleResourceSelectPlugin["default"],
|
|
31
|
+
var plugins = [_SaveLoading["default"], _GroupAddResourceDrawerPlugin["default"], _MultipleResourceSelectPlugin["default"], // ResourceViewAttributeSettingPlugin,
|
|
32
|
+
_Link["default"], _IconManage["default"], _LinkDynamicStyleSettingDrawer["default"]].concat((editorProps === null || editorProps === void 0 ? void 0 : editorProps.plugins) || []);
|
|
33
33
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, plugins.map(function (Plugin, index) {
|
|
34
34
|
return /*#__PURE__*/_react["default"].createElement(Plugin, (0, _extends2["default"])({
|
|
35
35
|
key: index,
|
|
@@ -11,7 +11,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
|
|
12
12
|
require("@riil-frontend/css/lib/index.scss");
|
|
13
13
|
|
|
14
|
-
var _Setting = _interopRequireDefault(require("
|
|
14
|
+
var _Setting = _interopRequireDefault(require("../../../../../components/ResourceViewAttributeSetting/Setting"));
|
|
15
15
|
|
|
16
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
17
|
|
|
@@ -19,6 +19,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* 显示属性、指标配置
|
|
22
|
+
*
|
|
23
|
+
* 已废弃
|
|
22
24
|
*/
|
|
23
25
|
function GlobalTootipSetting(props) {
|
|
24
26
|
var topo = props.topo;
|
|
@@ -45,10 +45,5 @@ function ViewPropertyView(props) {
|
|
|
45
45
|
title: "\u5E03\u5C40"
|
|
46
46
|
}, /*#__PURE__*/_react["default"].createElement(_GlobalLayout["default"], {
|
|
47
47
|
topo: topo
|
|
48
|
-
})), /*#__PURE__*/_react["default"].createElement(CollapsePanel, {
|
|
49
|
-
key: "\u5C5E\u6027/\u6307\u6807\u663E\u793A\u8BBE\u7F6E",
|
|
50
|
-
title: "\u5C5E\u6027/\u6307\u6807\u663E\u793A\u8BBE\u7F6E"
|
|
51
|
-
}, /*#__PURE__*/_react["default"].createElement(_GlobalTootipSetting["default"], {
|
|
52
|
-
topo: topo
|
|
53
48
|
}))))));
|
|
54
49
|
}
|
|
@@ -7,10 +7,10 @@ exports["default"] = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
11
|
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
14
|
var _topo = _interopRequireDefault(require("@riil-frontend/component-topology-common/es/services/topo"));
|
|
15
15
|
|
|
16
16
|
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
|
|
@@ -23,9 +23,16 @@ var _attributeFormatter = _interopRequireDefault(require("./attributeFormatter")
|
|
|
23
23
|
|
|
24
24
|
var _DictCache = _interopRequireDefault(require("./cache/DictCache"));
|
|
25
25
|
|
|
26
|
+
function filterUnExistedFields(fields, ciTypeMeta) {
|
|
27
|
+
return fields.filter(function (item) {
|
|
28
|
+
return item.type !== 'graph' && (item.type === 'attribute' && ciTypeMeta.attributeMap[item.code] || item.type === 'metric' && ciTypeMeta.metricMap[item.code] || item.type !== 'attribute' && item.type !== 'metric');
|
|
29
|
+
});
|
|
30
|
+
}
|
|
26
31
|
/**
|
|
27
32
|
* 资源标注、悬浮框数据
|
|
28
33
|
*/
|
|
34
|
+
|
|
35
|
+
|
|
29
36
|
var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
30
37
|
function AttributeMetricDisplay(topo) {
|
|
31
38
|
this.topo = topo;
|
|
@@ -36,11 +43,15 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
36
43
|
_proto.getConfig = function getConfig(config) {
|
|
37
44
|
var _ref = config || this.topo.store.getModelState('displayConfig'),
|
|
38
45
|
nodeTag = _ref.nodeTag,
|
|
39
|
-
nodeTip = _ref.nodeTip
|
|
46
|
+
nodeTip = _ref.nodeTip,
|
|
47
|
+
linkTag = _ref.linkTag,
|
|
48
|
+
linkTip = _ref.linkTip;
|
|
40
49
|
|
|
41
50
|
return {
|
|
42
51
|
nodeTag: nodeTag,
|
|
43
|
-
nodeTip: nodeTip
|
|
52
|
+
nodeTip: nodeTip,
|
|
53
|
+
linkTag: linkTag,
|
|
54
|
+
linkTip: linkTip
|
|
44
55
|
};
|
|
45
56
|
}
|
|
46
57
|
/**
|
|
@@ -64,41 +75,13 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
64
75
|
data = cfg.data;
|
|
65
76
|
var items = isCustom ? data[ciType] : data; // TODO 过滤类型不存在的属性和指标、图上名称
|
|
66
77
|
|
|
67
|
-
return items
|
|
68
|
-
return item.type !== 'graph' && (item.type === 'attribute' && ciTypeMeta.attributeMap[item.code] || item.type === 'metric' && ciTypeMeta.metricMap[item.code] || item.type !== 'attribute' && item.type !== 'metric');
|
|
69
|
-
});
|
|
78
|
+
return filterUnExistedFields(items, ciTypeMeta);
|
|
70
79
|
}
|
|
71
80
|
|
|
72
81
|
return {
|
|
73
82
|
tags: getItems(nodeTag || _ResourceInfoDisplay.DEFAULT_NODE_TAG_COMMON_CONFIG),
|
|
74
83
|
tips: getItems(nodeTip || _ResourceInfoDisplay.DEFAULT_TIP_COMMON_CONFIG)
|
|
75
84
|
};
|
|
76
|
-
} // 获取资源节点是否显示名称配置
|
|
77
|
-
;
|
|
78
|
-
|
|
79
|
-
_proto.getNodeNameVisibleConfig = function getNodeNameVisibleConfig(config) {
|
|
80
|
-
var nodes = this.topo.store.getModelState('topoMod').data.nodes;
|
|
81
|
-
|
|
82
|
-
var _this$getConfig2 = this.getConfig(config),
|
|
83
|
-
nodeTag = _this$getConfig2.nodeTag;
|
|
84
|
-
|
|
85
|
-
return nodes.map(function (node) {
|
|
86
|
-
var visible = true;
|
|
87
|
-
|
|
88
|
-
if (nodeTag) {
|
|
89
|
-
var isCustom = nodeTag.isCustom,
|
|
90
|
-
data = nodeTag.data;
|
|
91
|
-
var items = isCustom ? data[node.ciType] : data;
|
|
92
|
-
visible = !!items.filter(function (item) {
|
|
93
|
-
return item.type === 'graph';
|
|
94
|
-
}).length;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return {
|
|
98
|
-
id: node.id,
|
|
99
|
-
visible: visible
|
|
100
|
-
};
|
|
101
|
-
});
|
|
102
85
|
}
|
|
103
86
|
/**
|
|
104
87
|
* 按链路类型获取对应的属性、指标配置
|
|
@@ -109,31 +92,44 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
109
92
|
;
|
|
110
93
|
|
|
111
94
|
_proto.getNetworkLinkConfig = function getNetworkLinkConfig(link, config) {
|
|
112
|
-
var _this$
|
|
113
|
-
linkTag = _this$
|
|
114
|
-
linkTip = _this$
|
|
95
|
+
var _this$getConfig2 = this.getConfig(config),
|
|
96
|
+
linkTag = _this$getConfig2.linkTag,
|
|
97
|
+
linkTip = _this$getConfig2.linkTip;
|
|
115
98
|
|
|
116
99
|
var linkConnectType = link.detail.attributes['network_link.connect_type'];
|
|
117
|
-
var
|
|
100
|
+
var ciTypeMeta = this.topo.ciTyeCache.getNetworkLinkCiType(linkConnectType);
|
|
118
101
|
|
|
119
102
|
function getItems(cfg, connectType) {
|
|
103
|
+
if (!ciTypeMeta) {
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
|
|
120
107
|
var isCustom = cfg.isCustom,
|
|
121
108
|
data = cfg.data;
|
|
122
|
-
var
|
|
123
|
-
var
|
|
124
|
-
|
|
109
|
+
var configItems = (isCustom ? data[connectType.id] : data) || [];
|
|
110
|
+
var items = [];
|
|
111
|
+
configItems.forEach(function (item) {
|
|
125
112
|
if (item.type === 'metric') {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
113
|
+
var finalCode = null;
|
|
114
|
+
var code = item.code;
|
|
115
|
+
|
|
116
|
+
if (ciTypeMeta.metricMap[code]) {
|
|
117
|
+
finalCode = code;
|
|
118
|
+
} else if (ciTypeMeta.metricMap["" + connectType.metricPprefix + code]) {
|
|
119
|
+
finalCode = "" + connectType.metricPprefix + code;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (finalCode) {
|
|
123
|
+
items.push((0, _extends2["default"])({}, item, {
|
|
124
|
+
code: finalCode
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
129
127
|
} else {
|
|
130
|
-
|
|
128
|
+
items.push(item);
|
|
131
129
|
}
|
|
132
|
-
}); //
|
|
130
|
+
}); // 过滤不存在的
|
|
133
131
|
|
|
134
|
-
return items
|
|
135
|
-
return item.type !== 'graph';
|
|
136
|
-
});
|
|
132
|
+
return filterUnExistedFields(items, ciTypeMeta);
|
|
137
133
|
}
|
|
138
134
|
|
|
139
135
|
var linkConfig = {};
|
|
@@ -145,8 +141,8 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
145
141
|
metricPprefix: 'agg_link.'
|
|
146
142
|
}].forEach(function (connectType) {
|
|
147
143
|
linkConfig[connectType.id] = {
|
|
148
|
-
tags: getItems(linkTag, connectType),
|
|
149
|
-
tips: getItems(linkTip, connectType)
|
|
144
|
+
tags: getItems(linkTag || _ResourceInfoDisplay.DEFAULT_TAG_COMMON_CONFIG, connectType),
|
|
145
|
+
tips: getItems(linkTip || _ResourceInfoDisplay.DEFAULT_TIP_COMMON_CONFIG, connectType)
|
|
150
146
|
};
|
|
151
147
|
});
|
|
152
148
|
return linkConfig[link.detail.attributes['network_link.connect_type']] || {
|
|
@@ -166,9 +162,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
166
162
|
_proto.getResourceTagTipConfig = function getResourceTagTipConfig(data, config) {
|
|
167
163
|
var _this = this;
|
|
168
164
|
|
|
169
|
-
|
|
165
|
+
// 获得图上业务节点、业务连线
|
|
166
|
+
var _ref2 = data || this.topo.getData(),
|
|
170
167
|
nodes = _ref2.nodes,
|
|
171
|
-
|
|
168
|
+
lines = _ref2.lines; // 无权限不显示标注、悬浮框
|
|
172
169
|
|
|
173
170
|
|
|
174
171
|
var filterByPermission = function filterByPermission(resource, items) {
|
|
@@ -186,11 +183,26 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
186
183
|
tags: filterByPermission(node, ciTypeConfig.tags),
|
|
187
184
|
tips: filterByPermission(node, ciTypeConfig.tips)
|
|
188
185
|
};
|
|
186
|
+
}), lines.filter(function (link) {
|
|
187
|
+
return link.ciType === 'network_link';
|
|
188
|
+
}).map(function (link) {
|
|
189
|
+
var ciType = link.ciType;
|
|
190
|
+
|
|
191
|
+
var ciTypeConfig = _this.getNetworkLinkConfig(link, config);
|
|
192
|
+
|
|
193
|
+
return {
|
|
194
|
+
code: link.id,
|
|
195
|
+
ciType: ciType,
|
|
196
|
+
tags: filterByPermission(link, ciTypeConfig.tags),
|
|
197
|
+
tips: filterByPermission(link, ciTypeConfig.tips)
|
|
198
|
+
};
|
|
189
199
|
}));
|
|
190
200
|
} // 获取资源属性、指标配置(不包含显示名称)
|
|
191
201
|
;
|
|
192
202
|
|
|
193
203
|
_proto.getResourceFields = function getResourceFields() {
|
|
204
|
+
var _this2 = this;
|
|
205
|
+
|
|
194
206
|
return this.getResourceTagTipConfig().map(function (ciConfig) {
|
|
195
207
|
// 非标注需要的属性往这里添加。例如动态改变带宽需要链路带宽
|
|
196
208
|
var fields = {
|
|
@@ -206,7 +218,18 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
206
218
|
if (Array.isArray(arr) && arr.indexOf(code) === -1) {
|
|
207
219
|
arr.push(code);
|
|
208
220
|
}
|
|
209
|
-
});
|
|
221
|
+
}); // 增加概览需要的指标字段
|
|
222
|
+
|
|
223
|
+
var overviewState = _this2.topo.store.getModelState('topoBaseInfoOverview');
|
|
224
|
+
|
|
225
|
+
if (overviewState.id === fields.id) {
|
|
226
|
+
overviewState.metricCodes.forEach(function (code) {
|
|
227
|
+
if (fields.metrics.indexOf(code) === -1) {
|
|
228
|
+
fields.metrics.push(code);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
210
233
|
return fields;
|
|
211
234
|
});
|
|
212
235
|
}
|
|
@@ -228,6 +251,54 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
228
251
|
});
|
|
229
252
|
return metricCodes;
|
|
230
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* 从配置获得节点名称是否显示
|
|
256
|
+
* @param {*} node
|
|
257
|
+
* @returns
|
|
258
|
+
*/
|
|
259
|
+
;
|
|
260
|
+
|
|
261
|
+
_proto.getNodeNameVisible = function getNodeNameVisible(node) {
|
|
262
|
+
var _this$getConfig3 = this.getConfig(),
|
|
263
|
+
nodeTag = _this$getConfig3.nodeTag;
|
|
264
|
+
|
|
265
|
+
var visible = true;
|
|
266
|
+
|
|
267
|
+
if (nodeTag) {
|
|
268
|
+
var isCustom = nodeTag.isCustom,
|
|
269
|
+
data = nodeTag.data;
|
|
270
|
+
var items = isCustom ? data[node.ciType] : data;
|
|
271
|
+
visible = !!items.filter(function (item) {
|
|
272
|
+
return item.type === 'graph';
|
|
273
|
+
}).length;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return visible;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* 根据配置执行节点名称显示隐藏
|
|
280
|
+
*/
|
|
281
|
+
;
|
|
282
|
+
|
|
283
|
+
_proto.updateNodesNameVisible = function updateNodesNameVisible() {
|
|
284
|
+
var _this3 = this;
|
|
285
|
+
|
|
286
|
+
var dm = this.topo.getDataModel();
|
|
287
|
+
|
|
288
|
+
var _this$topo$getData = this.topo.getData(),
|
|
289
|
+
nodes = _this$topo$getData.nodes;
|
|
290
|
+
|
|
291
|
+
nodes.map(function (node) {
|
|
292
|
+
return {
|
|
293
|
+
id: node.id,
|
|
294
|
+
visible: _this3.getNodeNameVisible(node)
|
|
295
|
+
};
|
|
296
|
+
}).forEach(function (_ref3) {
|
|
297
|
+
var id = _ref3.id,
|
|
298
|
+
visible = _ref3.visible;
|
|
299
|
+
dm.getDataByTag(id).a('isShowName', visible);
|
|
300
|
+
});
|
|
301
|
+
}
|
|
231
302
|
/**
|
|
232
303
|
* 查询拓扑图资源的属性指标
|
|
233
304
|
*
|
|
@@ -239,27 +310,48 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
239
310
|
/*#__PURE__*/
|
|
240
311
|
function () {
|
|
241
312
|
var _getData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
242
|
-
var
|
|
313
|
+
var _this4 = this;
|
|
314
|
+
|
|
315
|
+
var _this$topo$store$getS, resIdsList, nodeIdsList, linkIdsList, codes, param, linkAdapter, result;
|
|
243
316
|
|
|
244
317
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
245
318
|
while (1) {
|
|
246
319
|
switch (_context.prev = _context.next) {
|
|
247
320
|
case 0:
|
|
321
|
+
linkAdapter = function _linkAdapter(data, topo) {
|
|
322
|
+
var links = topo.store.getModelState('topoMod').data.links;
|
|
323
|
+
var link = (0, _topoData.findItem)(links, 'id', data.id);
|
|
324
|
+
|
|
325
|
+
if (!link) {
|
|
326
|
+
return data;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
var attributeMap = data.attributeMap;
|
|
330
|
+
|
|
331
|
+
if (!Object.keys(attributeMap).length) {
|
|
332
|
+
attributeMap = (0, _extends2["default"])({}, link.attributes || {});
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return (0, _extends2["default"])({}, data, {
|
|
336
|
+
attributeMap: attributeMap
|
|
337
|
+
});
|
|
338
|
+
};
|
|
339
|
+
|
|
248
340
|
_this$topo$store$getS = this.topo.store.getState().topoBizMod.resAndMetrics, resIdsList = _this$topo$store$getS.resIdsList, nodeIdsList = _this$topo$store$getS.nodeIdsList, linkIdsList = _this$topo$store$getS.linkIdsList; // rlog.debug('根据ci的id获取属性的值-getCiArrByIds', resIdsList, metrics);
|
|
249
341
|
// 无资源,不查询
|
|
250
342
|
|
|
251
343
|
if (resIdsList.length) {
|
|
252
|
-
_context.next =
|
|
344
|
+
_context.next = 4;
|
|
253
345
|
break;
|
|
254
346
|
}
|
|
255
347
|
|
|
256
348
|
return _context.abrupt("return", []);
|
|
257
349
|
|
|
258
|
-
case
|
|
259
|
-
_context.next =
|
|
350
|
+
case 4:
|
|
351
|
+
_context.next = 6;
|
|
260
352
|
return _DictCache["default"].init();
|
|
261
353
|
|
|
262
|
-
case
|
|
354
|
+
case 6:
|
|
263
355
|
// 需要查询的指标列表
|
|
264
356
|
codes = this.getResourceMetricCodes(); // if (!codes.length) {
|
|
265
357
|
// return [];
|
|
@@ -269,15 +361,35 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
269
361
|
ciId: nodeIdsList,
|
|
270
362
|
codes: codes,
|
|
271
363
|
relationId: linkIdsList
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* 链路属性适配
|
|
367
|
+
* @param {*} data
|
|
368
|
+
* @param {*} topo
|
|
369
|
+
* @returns
|
|
370
|
+
*/
|
|
371
|
+
|
|
372
|
+
_context.next = 10;
|
|
275
373
|
return _topo["default"].ciInfo.batchQueryCiInfo(param);
|
|
276
374
|
|
|
277
|
-
case 9:
|
|
278
|
-
return _context.abrupt("return", _context.sent);
|
|
279
|
-
|
|
280
375
|
case 10:
|
|
376
|
+
result = _context.sent;
|
|
377
|
+
return _context.abrupt("return", result.map(function (data) {
|
|
378
|
+
var list2map = function list2map(list) {
|
|
379
|
+
var map = {};
|
|
380
|
+
(list || []).forEach(function (item) {
|
|
381
|
+
map[item.code] = item.value;
|
|
382
|
+
});
|
|
383
|
+
return map;
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
return linkAdapter((0, _extends2["default"])({}, data, {
|
|
387
|
+
attributeMap: list2map(data.attributes),
|
|
388
|
+
metricMap: list2map(data.metrics)
|
|
389
|
+
}), _this4.topo);
|
|
390
|
+
}));
|
|
391
|
+
|
|
392
|
+
case 12:
|
|
281
393
|
case "end":
|
|
282
394
|
return _context.stop();
|
|
283
395
|
}
|
|
@@ -315,7 +427,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
315
427
|
|
|
316
428
|
case 4:
|
|
317
429
|
// 获取标注、悬浮框配置
|
|
318
|
-
ciConfigs =
|
|
430
|
+
ciConfigs = this.getResourceTagTipConfig();
|
|
319
431
|
formatter = new _attributeFormatter["default"](this.topo);
|
|
320
432
|
tagAndTip = ciConfigs.map(function (ciConfig) {
|
|
321
433
|
// 获取ci数据
|
|
@@ -329,7 +441,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
329
441
|
};
|
|
330
442
|
}); // 刷新标注、浮层
|
|
331
443
|
|
|
332
|
-
_rlog["default"].debug('
|
|
444
|
+
_rlog["default"].debug('属性指标:loadAttributeAndMetric', {
|
|
445
|
+
tagAndTip: tagAndTip,
|
|
446
|
+
ciConfigs: ciConfigs
|
|
447
|
+
});
|
|
333
448
|
|
|
334
449
|
topo.getHtTopo().loadTagAndTip(tagAndTip);
|
|
335
450
|
|
|
@@ -33,8 +33,6 @@ var _Test = _interopRequireDefault(require("../test/Test"));
|
|
|
33
33
|
|
|
34
34
|
var _topoData = require("../../utils/topoData");
|
|
35
35
|
|
|
36
|
-
var _attrAndMetric = require("./attrAndMetric");
|
|
37
|
-
|
|
38
36
|
var _DictCache = _interopRequireDefault(require("./cache/DictCache"));
|
|
39
37
|
|
|
40
38
|
var _AttributeMetricDisplay = _interopRequireDefault(require("./AttributeMetricDisplay"));
|
|
@@ -63,6 +61,7 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
63
61
|
this.store = void 0;
|
|
64
62
|
this.serverApi = _topo["default"];
|
|
65
63
|
this.ciTyeCache = _CiTyeCache["default"];
|
|
64
|
+
this.dictCache = _DictCache["default"];
|
|
66
65
|
this.test = void 0;
|
|
67
66
|
this.options = (0, _extends2["default"])({
|
|
68
67
|
enableDefaultAlarmLoader: true,
|
|
@@ -623,9 +622,15 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
623
622
|
}
|
|
624
623
|
|
|
625
624
|
return exitEditMode;
|
|
626
|
-
}()
|
|
625
|
+
}()
|
|
626
|
+
/**
|
|
627
|
+
* 后续待优化,移除该接口,由ht提供原子接口获取相关数据
|
|
628
|
+
*/
|
|
629
|
+
;
|
|
627
630
|
|
|
628
|
-
_proto.triggerSaveEvent =
|
|
631
|
+
_proto.triggerSaveEvent =
|
|
632
|
+
/*#__PURE__*/
|
|
633
|
+
function () {
|
|
629
634
|
var _triggerSaveEvent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14() {
|
|
630
635
|
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
631
636
|
while (1) {
|
|
@@ -646,9 +651,15 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
646
651
|
}
|
|
647
652
|
|
|
648
653
|
return triggerSaveEvent;
|
|
649
|
-
}()
|
|
654
|
+
}()
|
|
655
|
+
/**
|
|
656
|
+
* 后续待优化,移除该接口,由ht提供原子接口获取相关数据
|
|
657
|
+
*/
|
|
658
|
+
;
|
|
650
659
|
|
|
651
|
-
_proto.save =
|
|
660
|
+
_proto.save =
|
|
661
|
+
/*#__PURE__*/
|
|
662
|
+
function () {
|
|
652
663
|
var _save = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15() {
|
|
653
664
|
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
|
654
665
|
while (1) {
|
|
@@ -726,21 +737,11 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
726
737
|
while (1) {
|
|
727
738
|
switch (_context17.prev = _context17.next) {
|
|
728
739
|
case 0:
|
|
729
|
-
_context17.next = 2;
|
|
730
|
-
return _DictCache["default"].init();
|
|
731
|
-
|
|
732
|
-
case 2:
|
|
733
|
-
(0, _attrAndMetric.updateAttrsAndMetrics)({
|
|
734
|
-
topo: this,
|
|
735
|
-
data: data
|
|
736
|
-
});
|
|
737
|
-
|
|
738
|
-
case 3:
|
|
739
740
|
case "end":
|
|
740
741
|
return _context17.stop();
|
|
741
742
|
}
|
|
742
743
|
}
|
|
743
|
-
}, _callee17
|
|
744
|
+
}, _callee17);
|
|
744
745
|
}));
|
|
745
746
|
|
|
746
747
|
function loadAttrsAndMetrics(_x11) {
|
|
@@ -5,6 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
exports.__esModule = true;
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
|
|
8
10
|
var _utils = require("@riil-frontend/utils");
|
|
9
11
|
|
|
10
12
|
var _topoData = require("../../../utils/topoData");
|
|
@@ -32,6 +34,33 @@ function formatMetric(val, metricInfo) {
|
|
|
32
34
|
return "" + val;
|
|
33
35
|
}
|
|
34
36
|
}
|
|
37
|
+
|
|
38
|
+
function addLinkMetricUnderlineArrow(metricCode) {
|
|
39
|
+
var map = {
|
|
40
|
+
// 总流速和总带宽利用率:双向箭头
|
|
41
|
+
'link.total_flow_rate': 'both',
|
|
42
|
+
'link.bandwidth_utilization': 'both',
|
|
43
|
+
// 发送速率和发送带宽利用率:背向取值端口的箭头 指向目的
|
|
44
|
+
'link.out_rate': 'to',
|
|
45
|
+
'link.out_bandwidth_utilization': 'to',
|
|
46
|
+
// 接收速率和接收带宽利用率:指向取值端口的箭头 指向源
|
|
47
|
+
'link.in_rate': 'from',
|
|
48
|
+
'link.in_bandwidth_utilization': 'from'
|
|
49
|
+
};
|
|
50
|
+
var codes = Object.keys(map);
|
|
51
|
+
|
|
52
|
+
for (var i = 0; i < codes.length; i++) {
|
|
53
|
+
var code = codes[i];
|
|
54
|
+
|
|
55
|
+
if (metricCode.endsWith(code)) {
|
|
56
|
+
return {
|
|
57
|
+
underlineArrow: map[code]
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return {};
|
|
63
|
+
}
|
|
35
64
|
/**
|
|
36
65
|
* 标注值格式化
|
|
37
66
|
*/
|
|
@@ -43,9 +72,7 @@ var AttributeFormatter = /*#__PURE__*/function () {
|
|
|
43
72
|
this.transformMap = {
|
|
44
73
|
attribute: this.attributeTransform.bind(this),
|
|
45
74
|
metric: this.metricTransform.bind(this),
|
|
46
|
-
ciType: this.ciTypeAttrTransform.bind(this)
|
|
47
|
-
linkMetric: null // TODO 链路自定义转换
|
|
48
|
-
|
|
75
|
+
ciType: this.ciTypeAttrTransform.bind(this)
|
|
49
76
|
};
|
|
50
77
|
}
|
|
51
78
|
|
|
@@ -68,16 +95,15 @@ var AttributeFormatter = /*#__PURE__*/function () {
|
|
|
68
95
|
|
|
69
96
|
var attrCode = item.code;
|
|
70
97
|
var metricMeta = this.topo.ciTyeCache.getCiType(ciData.ciType)[attrType + "Map"][attrCode];
|
|
71
|
-
var metricValue = (_findItem = (0, _topoData.findItem)(ciData[attrType + "s"], 'code', attrCode)) === null || _findItem === void 0 ? void 0 : _findItem.value;
|
|
72
|
-
return {
|
|
98
|
+
var metricValue = ciData[attrType + "Map"][attrCode] || ((_findItem = (0, _topoData.findItem)(ciData[attrType + "s"], 'code', attrCode)) === null || _findItem === void 0 ? void 0 : _findItem.value);
|
|
99
|
+
return (0, _extends2["default"])({
|
|
73
100
|
type: item.type,
|
|
74
101
|
code: item.code,
|
|
75
102
|
// 属性code
|
|
76
103
|
name: (metricMeta === null || metricMeta === void 0 ? void 0 : metricMeta.name) || '',
|
|
77
104
|
// 属性名称
|
|
78
|
-
value: formatMetric(metricValue, metricMeta)
|
|
79
|
-
|
|
80
|
-
};
|
|
105
|
+
value: formatMetric(metricValue, metricMeta)
|
|
106
|
+
}, addLinkMetricUnderlineArrow(attrCode));
|
|
81
107
|
};
|
|
82
108
|
|
|
83
109
|
_proto.attributeTransform = function attributeTransform(item, ciData) {
|