@riil-frontend/component-topology 3.1.5 → 3.1.8
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/CHANGELOG.md +4 -15
- package/build/1.js +1 -1
- package/build/index.css +1 -1
- package/build/index.js +11 -11
- package/demo/1/345/237/272/346/234/254//345/256/232/345/210/266/345/214/226/350/265/204/346/272/220/346/246/202/350/247/210.md +11 -0
- package/demo/1/345/237/272/346/234/254//350/207/252/345/256/232/344/271/211/346/240/207/346/263/250/345/222/214/346/202/254/346/265/256/346/241/206.md +11 -0
- package/demo//346/240/207/346/263/250/345/222/214/346/202/254/346/265/256/346/241/206//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 +2 -2
- package/demo-mock/basic/topo/v1/api/attributes/once +9164 -2796
- package/demo-mock/basic/topo/v1/api/attributes/once.json +9164 -2796
- package/es/core/components/DisplaySettingDrawer/DisplaySetting.js +4 -5
- package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +2 -2
- package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +4 -4
- package/es/core/models/AttributeMetricDisplay.js +112 -98
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/viewer/components/plugins/{BaseInfo/index.js → ResourceDetail/ResourceDetail.js} +23 -11
- package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailPlugin.js +11 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +131 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfoBlock.js +31 -0
- package/es/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/BlockBox.js +0 -0
- package/es/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/BlockBox.module.scss +0 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +46 -0
- package/es/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/SingleResourceStrategyLink.js +4 -2
- package/es/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/index.js +70 -180
- package/es/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/index.module.scss +0 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/useCiAttrAndMetricData.js +12 -0
- package/es/core/viewer/components/plugins/ResourceDetail/index.js +2 -0
- package/es/core/viewer/components/plugins/ResourceDetail/index.module.scss +39 -30
- package/es/core/viewer/components/plugins/ViewerPlugin.js +2 -2
- package/es/core/viewer/components/titlebar/BasicTools.js +1 -1
- package/es/core/viewer/components/titlebar/widgets/SettingButton.js +3 -4
- package/es/core/viewer/components/titlebar/widgets/SettingButtonWidget.js +19 -0
- package/es/topoCenter/components/TopoView.js +3 -4
- package/es/topoCenter/models/TopoCenter.js +9 -5
- package/lib/core/components/DisplaySettingDrawer/DisplaySetting.js +4 -5
- package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +2 -2
- package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +4 -4
- package/lib/core/models/AttributeMetricDisplay.js +111 -97
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/viewer/components/plugins/{BaseInfo/index.js → ResourceDetail/ResourceDetail.js} +25 -12
- package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailPlugin.js +21 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +141 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfoBlock.js +42 -0
- package/lib/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/BlockBox.js +0 -0
- package/lib/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/BlockBox.module.scss +0 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +56 -0
- package/lib/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/SingleResourceStrategyLink.js +4 -2
- package/lib/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/index.js +73 -182
- package/lib/core/viewer/components/plugins/{BaseInfo → ResourceDetail}/components/ResourceOverview/index.module.scss +0 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/useCiAttrAndMetricData.js +17 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/index.js +11 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/index.module.scss +39 -30
- package/lib/core/viewer/components/plugins/ViewerPlugin.js +2 -2
- package/lib/core/viewer/components/titlebar/BasicTools.js +2 -2
- package/lib/core/viewer/components/titlebar/widgets/SettingButton.js +2 -3
- package/lib/core/viewer/components/titlebar/widgets/SettingButtonWidget.js +28 -0
- package/lib/topoCenter/components/TopoView.js +3 -4
- package/lib/topoCenter/models/TopoCenter.js +9 -5
- package/package.json +2 -2
- 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 +0 -11
- package/es/core/viewer/components/plugins/BaseInfo/index.module.scss +0 -49
- package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawerPlugin.js +0 -37
- package/es/core/viewer/components/plugins/ResourceDetail/topoDrawer.js +0 -147
- package/lib/core/viewer/components/plugins/BaseInfo/index.module.scss +0 -49
- package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawerPlugin.js +0 -50
- package/lib/core/viewer/components/plugins/ResourceDetail/topoDrawer.js +0 -167
|
@@ -17,16 +17,15 @@ import EdgeFlowDirection from "./EdgeFlowDirection";
|
|
|
17
17
|
|
|
18
18
|
function DisplaySetting(props, ref) {
|
|
19
19
|
var topo = props.topo,
|
|
20
|
-
|
|
20
|
+
displaySettingProps = props.displaySettingProps;
|
|
21
21
|
var displayConfig = topo.store.getModelState('displayConfig');
|
|
22
22
|
|
|
23
|
-
var _ref =
|
|
23
|
+
var _ref = displaySettingProps || {},
|
|
24
24
|
linkTagConfig = _ref.linkTagConfig,
|
|
25
25
|
linkTipConfig = _ref.linkTipConfig,
|
|
26
26
|
showEdgeExpandConfig = _ref.showEdgeExpandConfig,
|
|
27
|
-
extraConfig = _ref.extraConfig
|
|
28
|
-
|
|
29
|
-
var showLinkConfig = !!(viewerProps !== null && viewerProps !== void 0 && viewerProps.showLinkConfig);
|
|
27
|
+
extraConfig = _ref.extraConfig,
|
|
28
|
+
showLinkConfig = _ref.showLinkConfig;
|
|
30
29
|
|
|
31
30
|
var field = _Field.useField({
|
|
32
31
|
autoUnmount: false,
|
|
@@ -9,7 +9,7 @@ import useDisplaySetting from "./hooks/useDisplaySetting";
|
|
|
9
9
|
export default function DisplaySettingDrawer(props) {
|
|
10
10
|
var visible = props.visible,
|
|
11
11
|
topo = props.topo,
|
|
12
|
-
|
|
12
|
+
displaySettingProps = props.displaySettingProps,
|
|
13
13
|
onClose = props.onClose;
|
|
14
14
|
var settingRef = useRef();
|
|
15
15
|
|
|
@@ -76,7 +76,7 @@ export default function DisplaySettingDrawer(props) {
|
|
|
76
76
|
}, visible && /*#__PURE__*/React.createElement(DisplaySetting, {
|
|
77
77
|
ref: settingRef,
|
|
78
78
|
topo: topo,
|
|
79
|
-
|
|
79
|
+
displaySettingProps: displaySettingProps
|
|
80
80
|
}));
|
|
81
81
|
}
|
|
82
82
|
;
|
|
@@ -4,7 +4,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
4
4
|
import topoService from '@riil-frontend/component-topology-common/es/services/topo';
|
|
5
5
|
export default (function (props) {
|
|
6
6
|
var topo = props.topo,
|
|
7
|
-
|
|
7
|
+
displaySettingProps = props.displaySettingProps,
|
|
8
8
|
settingRef = props.settingRef;
|
|
9
9
|
|
|
10
10
|
var executeByConfig = /*#__PURE__*/function () {
|
|
@@ -17,7 +17,7 @@ export default (function (props) {
|
|
|
17
17
|
// 更新节点名称显示隐藏
|
|
18
18
|
topo.attributeMetricDisplay.updateNodesNameVisible(); // 更新连线展开折叠状态
|
|
19
19
|
|
|
20
|
-
if (
|
|
20
|
+
if (displaySettingProps !== null && displaySettingProps !== void 0 && displaySettingProps.showLinkConfig) {
|
|
21
21
|
if (config.expandAllEdges) {
|
|
22
22
|
topo.getHtTopo().expandAllEdgeGroups();
|
|
23
23
|
} else {
|
|
@@ -49,7 +49,7 @@ export default (function (props) {
|
|
|
49
49
|
|
|
50
50
|
var save = /*#__PURE__*/function () {
|
|
51
51
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
52
|
-
var
|
|
52
|
+
var _displaySettingProps$;
|
|
53
53
|
|
|
54
54
|
var values, prevDisplayConfig, displayConfig, displayConfigDispatchers, extraOnOk;
|
|
55
55
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
@@ -73,7 +73,7 @@ export default (function (props) {
|
|
|
73
73
|
displayConfigDispatchers.update(displayConfig); // 按配置执行
|
|
74
74
|
|
|
75
75
|
executeByConfig(displayConfig);
|
|
76
|
-
extraOnOk = (
|
|
76
|
+
extraOnOk = (displaySettingProps === null || displaySettingProps === void 0 ? void 0 : (_displaySettingProps$ = displaySettingProps.displaySettingProps) === null || _displaySettingProps$ === void 0 ? void 0 : _displaySettingProps$.onOk) || (displaySettingProps === null || displaySettingProps === void 0 ? void 0 : displaySettingProps.onDisplaySettingDrawerOk);
|
|
77
77
|
|
|
78
78
|
if (extraOnOk) {
|
|
79
79
|
extraOnOk();
|
|
@@ -4,7 +4,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
4
4
|
import topoServer from '@riil-frontend/component-topology-common/es/services/topo';
|
|
5
5
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
|
6
6
|
import { keyBy } from 'lodash';
|
|
7
|
-
import {
|
|
7
|
+
import { DEFAULT_NODE_TAG_COMMON_CONFIG, DEFAULT_TIP_COMMON_CONFIG } from "../../constants/ResourceInfoDisplay";
|
|
8
8
|
import { findItem } from "../../utils/topoData";
|
|
9
9
|
import { queryCisByIds } from "../services";
|
|
10
10
|
import AttributeFormatter from "./attributeFormatter";
|
|
@@ -35,8 +35,10 @@ var filterByPermission = function filterByPermission(resource, items) {
|
|
|
35
35
|
|
|
36
36
|
var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
37
37
|
function AttributeMetricDisplay(topo) {
|
|
38
|
+
var _this$topo$options$ta;
|
|
39
|
+
|
|
38
40
|
this.topo = topo;
|
|
39
|
-
var ExtElementTagTipBuilder = this.topo.options.ExtElementTagTipBuilder;
|
|
41
|
+
var ExtElementTagTipBuilder = (_this$topo$options$ta = this.topo.options.tagTip) === null || _this$topo$options$ta === void 0 ? void 0 : _this$topo$options$ta.ExtElementTagTipBuilder;
|
|
40
42
|
|
|
41
43
|
if (ExtElementTagTipBuilder) {
|
|
42
44
|
this.extElementTagTipBuilder = new ExtElementTagTipBuilder(this);
|
|
@@ -76,6 +78,10 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
76
78
|
var ciTypeMeta = this.topo.ciTyeCache.getCiType(ciType);
|
|
77
79
|
|
|
78
80
|
function getItems(cfg) {
|
|
81
|
+
if (!ciTypeMeta || !cfg) {
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
84
|
+
|
|
79
85
|
var isCustom = cfg.isCustom,
|
|
80
86
|
data = cfg.data;
|
|
81
87
|
var items = (isCustom ? data[ciType] : data) || []; // 过滤类型不存在的属性和指标、图片名称
|
|
@@ -90,94 +96,6 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
90
96
|
tips: getItems(nodeTip || DEFAULT_TIP_COMMON_CONFIG)
|
|
91
97
|
};
|
|
92
98
|
}
|
|
93
|
-
/**
|
|
94
|
-
* 按链路类型获取对应的属性、指标配置
|
|
95
|
-
* @param {*} link
|
|
96
|
-
* @param {*} config
|
|
97
|
-
* @returns
|
|
98
|
-
*/
|
|
99
|
-
;
|
|
100
|
-
|
|
101
|
-
_proto.getNetworkLinkConfig = function getNetworkLinkConfig(link, config) {
|
|
102
|
-
var _this$getConfig2 = this.getConfig(config),
|
|
103
|
-
linkTag = _this$getConfig2.linkTag,
|
|
104
|
-
linkTip = _this$getConfig2.linkTip;
|
|
105
|
-
|
|
106
|
-
var linkConnectType = link.attributes['network_link.connect_type'];
|
|
107
|
-
var ciTypeMeta = this.topo.ciTyeCache.getNetworkLinkCiType(linkConnectType);
|
|
108
|
-
|
|
109
|
-
var getMetricCode = function getMetricCode(code) {
|
|
110
|
-
var _connectTypeMap$linkC;
|
|
111
|
-
|
|
112
|
-
var connectTypeMap = {
|
|
113
|
-
phy: {
|
|
114
|
-
id: 'phy',
|
|
115
|
-
metricPrefix: 'physical_link.'
|
|
116
|
-
},
|
|
117
|
-
agg: {
|
|
118
|
-
id: 'agg',
|
|
119
|
-
metricPrefix: 'agg_link.'
|
|
120
|
-
},
|
|
121
|
-
exit: {
|
|
122
|
-
id: 'exit',
|
|
123
|
-
metricPrefix: 'export_link.'
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
var metricPrefix = (_connectTypeMap$linkC = connectTypeMap[linkConnectType]) === null || _connectTypeMap$linkC === void 0 ? void 0 : _connectTypeMap$linkC.metricPrefix;
|
|
127
|
-
|
|
128
|
-
if (!metricPrefix) {
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
var finalCode = null;
|
|
133
|
-
|
|
134
|
-
if (ciTypeMeta.metricMap[code]) {
|
|
135
|
-
finalCode = code;
|
|
136
|
-
} else if (ciTypeMeta.metricMap["" + metricPrefix + code]) {
|
|
137
|
-
finalCode = "" + metricPrefix + code;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return finalCode;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
var formatItems = function formatItems(items) {
|
|
144
|
-
var newItems = [];
|
|
145
|
-
items.forEach(function (item) {
|
|
146
|
-
if (item.type === 'metric') {
|
|
147
|
-
var code = item.code;
|
|
148
|
-
var finalCode = getMetricCode(code);
|
|
149
|
-
|
|
150
|
-
if (finalCode) {
|
|
151
|
-
newItems.push(_extends({}, item, {
|
|
152
|
-
code: finalCode
|
|
153
|
-
}));
|
|
154
|
-
}
|
|
155
|
-
} else {
|
|
156
|
-
newItems.push(item);
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
return newItems;
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
function getItems(cfg) {
|
|
163
|
-
if (!ciTypeMeta || !cfg) {
|
|
164
|
-
return [];
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
var isCustom = cfg.isCustom,
|
|
168
|
-
data = cfg.data;
|
|
169
|
-
var configItems = (isCustom ? data[linkConnectType] : data) || [];
|
|
170
|
-
var items = formatItems(configItems); // 过滤不存在的
|
|
171
|
-
|
|
172
|
-
return filterUnExistedFields(items, ciTypeMeta);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
var defaultLinkTagTipConfig = this.topo.options.defaultLinkTagTipConfig;
|
|
176
|
-
return {
|
|
177
|
-
tags: getItems(linkTag || (defaultLinkTagTipConfig === null || defaultLinkTagTipConfig === void 0 ? void 0 : defaultLinkTagTipConfig.tag)),
|
|
178
|
-
tips: getItems(linkTip || (defaultLinkTagTipConfig === null || defaultLinkTagTipConfig === void 0 ? void 0 : defaultLinkTagTipConfig.tip))
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
99
|
/**
|
|
182
100
|
* 查询需要查询数据的连线
|
|
183
101
|
*
|
|
@@ -203,10 +121,6 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
203
121
|
}));
|
|
204
122
|
};
|
|
205
123
|
|
|
206
|
-
_proto.getLinkTagTipConfig = function getLinkTagTipConfig(link) {
|
|
207
|
-
return this.getNetworkLinkConfig(link);
|
|
208
|
-
};
|
|
209
|
-
|
|
210
124
|
_proto.getNodesTagTipConfig = function getNodesTagTipConfig() {
|
|
211
125
|
var _this = this;
|
|
212
126
|
|
|
@@ -228,6 +142,109 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
228
142
|
tips: filterByPermission(node, ciTypeConfig.tips)
|
|
229
143
|
};
|
|
230
144
|
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* 按链路类型获取对应的属性、指标配置
|
|
148
|
+
* @param {*} link
|
|
149
|
+
* @returns
|
|
150
|
+
*/
|
|
151
|
+
;
|
|
152
|
+
|
|
153
|
+
_proto.getLinkTagTipConfig = function getLinkTagTipConfig(link) {
|
|
154
|
+
var _this$getConfig2 = this.getConfig(),
|
|
155
|
+
linkTag = _this$getConfig2.linkTag,
|
|
156
|
+
linkTip = _this$getConfig2.linkTip;
|
|
157
|
+
|
|
158
|
+
var ciTypeMeta;
|
|
159
|
+
var isNetworkLink = link.ciType === 'network_link';
|
|
160
|
+
|
|
161
|
+
if (isNetworkLink) {
|
|
162
|
+
var linkConnectType = link.attributes['network_link.connect_type'];
|
|
163
|
+
ciTypeMeta = this.topo.ciTyeCache.getNetworkLinkCiType(linkConnectType);
|
|
164
|
+
} else {
|
|
165
|
+
ciTypeMeta = this.topo.ciTyeCache.getCiType(link.ciType);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
var dataType = isNetworkLink ? link.attributes['network_link.connect_type'] : link.ciType;
|
|
169
|
+
|
|
170
|
+
function getNetworkFieldItems(configItems) {
|
|
171
|
+
var getMetricCode = function getMetricCode(code) {
|
|
172
|
+
var _connectTypeMap$linkC;
|
|
173
|
+
|
|
174
|
+
var linkConnectType = link.attributes['network_link.connect_type'];
|
|
175
|
+
var connectTypeMap = {
|
|
176
|
+
phy: {
|
|
177
|
+
id: 'phy',
|
|
178
|
+
metricPrefix: 'physical_link.'
|
|
179
|
+
},
|
|
180
|
+
agg: {
|
|
181
|
+
id: 'agg',
|
|
182
|
+
metricPrefix: 'agg_link.'
|
|
183
|
+
},
|
|
184
|
+
exit: {
|
|
185
|
+
id: 'exit',
|
|
186
|
+
metricPrefix: 'export_link.'
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
var metricPrefix = (_connectTypeMap$linkC = connectTypeMap[linkConnectType]) === null || _connectTypeMap$linkC === void 0 ? void 0 : _connectTypeMap$linkC.metricPrefix;
|
|
190
|
+
|
|
191
|
+
if (!metricPrefix) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
var finalCode = null;
|
|
196
|
+
|
|
197
|
+
if (ciTypeMeta.metricMap[code]) {
|
|
198
|
+
finalCode = code;
|
|
199
|
+
} else if (ciTypeMeta.metricMap["" + metricPrefix + code]) {
|
|
200
|
+
finalCode = "" + metricPrefix + code;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return finalCode;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
var formatItems = function formatItems(items) {
|
|
207
|
+
var newItems = [];
|
|
208
|
+
items.forEach(function (item) {
|
|
209
|
+
if (item.type === 'metric') {
|
|
210
|
+
var code = item.code;
|
|
211
|
+
var finalCode = getMetricCode(code);
|
|
212
|
+
|
|
213
|
+
if (finalCode) {
|
|
214
|
+
newItems.push(_extends({}, item, {
|
|
215
|
+
code: finalCode
|
|
216
|
+
}));
|
|
217
|
+
}
|
|
218
|
+
} else {
|
|
219
|
+
newItems.push(item);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
return newItems;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
return formatItems(configItems);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function getItems(cfg) {
|
|
229
|
+
if (!ciTypeMeta || !cfg) {
|
|
230
|
+
return [];
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
var isCustom = cfg.isCustom,
|
|
234
|
+
data = cfg.data;
|
|
235
|
+
var configItems = (isCustom ? data[dataType] : data) || [];
|
|
236
|
+
var items = isNetworkLink ? getNetworkFieldItems(configItems) : configItems; // 过滤不存在的
|
|
237
|
+
|
|
238
|
+
return filterUnExistedFields(items, ciTypeMeta);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
var tagTipOptions = this.topo.options.tagTip;
|
|
242
|
+
var defaultLinkTagConfig = tagTipOptions !== null && tagTipOptions !== void 0 && tagTipOptions.getDefaultLinkTagConfig ? tagTipOptions === null || tagTipOptions === void 0 ? void 0 : tagTipOptions.getDefaultLinkTagConfig(link) : null;
|
|
243
|
+
var defaultLinkTipConfig = tagTipOptions !== null && tagTipOptions !== void 0 && tagTipOptions.getDefaultLinkTipConfig ? tagTipOptions === null || tagTipOptions === void 0 ? void 0 : tagTipOptions.getDefaultLinkTipConfig(link) : null;
|
|
244
|
+
return {
|
|
245
|
+
tags: getItems(linkTag || defaultLinkTagConfig),
|
|
246
|
+
tips: getItems(linkTip || defaultLinkTipConfig)
|
|
247
|
+
};
|
|
231
248
|
};
|
|
232
249
|
|
|
233
250
|
_proto.getLinksTagTipConfig = function getLinksTagTipConfig() {
|
|
@@ -580,10 +597,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
|
580
597
|
});
|
|
581
598
|
});
|
|
582
599
|
} else {
|
|
583
|
-
rlog.warn(
|
|
584
|
-
ciData: ciData,
|
|
585
|
-
ciType: ciType
|
|
586
|
-
});
|
|
600
|
+
rlog.warn("\u63A8\u9001\u5C5E\u6027\u6307\u6807\u6570\u636E\uFF1A\u672A\u67E5\u8BE2\u5230ciType " + ciType, ciData);
|
|
587
601
|
}
|
|
588
602
|
});
|
|
589
603
|
refIds = Object.keys(refIdMap);
|
|
@@ -20,7 +20,7 @@ import { updateEdgeExpanded } from "../utils/edgeUtil";
|
|
|
20
20
|
import PluginManager from "./PluginManager";
|
|
21
21
|
import topoFactory from "./topoFactory"; // eslint-disable-next-line no-undef
|
|
22
22
|
|
|
23
|
-
var version = typeof "3.1.
|
|
23
|
+
var version = typeof "3.1.8" === 'string' ? "3.1.8" : null;
|
|
24
24
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
|
25
25
|
/**
|
|
26
26
|
* 拓扑显示和编辑
|
package/es/core/viewer/components/plugins/{BaseInfo/index.js → ResourceDetail/ResourceDetail.js}
RENAMED
|
@@ -5,12 +5,13 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
5
5
|
import _MenuButton from "@alifd/next/es/menu-button";
|
|
6
6
|
import _Search from "@alifd/next/es/search";
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
-
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
9
|
-
import { isAvailableArray, dataSearch } from '@riil-frontend/utils';
|
|
10
8
|
import { TopoEvent } from '@riil-frontend/component-topology-graph';
|
|
9
|
+
import { dataSearch, isAvailableArray } from '@riil-frontend/utils';
|
|
10
|
+
import React, { useEffect, useState } from 'react';
|
|
11
|
+
import PropTypes from 'prop-types';
|
|
11
12
|
import service from "../../../../services/overview";
|
|
12
|
-
import styles from "./index.module.scss";
|
|
13
13
|
import ResourceOverview from "./components/ResourceOverview";
|
|
14
|
+
import styles from "./index.module.scss";
|
|
14
15
|
|
|
15
16
|
function Title(_ref) {
|
|
16
17
|
var id = _ref.id,
|
|
@@ -72,8 +73,9 @@ function Title(_ref) {
|
|
|
72
73
|
} // 基本信息
|
|
73
74
|
|
|
74
75
|
|
|
75
|
-
function
|
|
76
|
-
var topo = props.topo
|
|
76
|
+
function ResourceDetail(props) {
|
|
77
|
+
var topo = props.topo,
|
|
78
|
+
canShow = props.canShow;
|
|
77
79
|
|
|
78
80
|
var _topo$store$useModel = topo.store.useModel('topoBaseInfoOverview'),
|
|
79
81
|
topoState = _topo$store$useModel[0],
|
|
@@ -189,8 +191,6 @@ function BaseInfo(props) {
|
|
|
189
191
|
}
|
|
190
192
|
|
|
191
193
|
function init(data, targetType) {
|
|
192
|
-
var _topo$options$resourc;
|
|
193
|
-
|
|
194
194
|
console.log('初始化基本信息', data, targetType);
|
|
195
195
|
var id = data.id,
|
|
196
196
|
name = data.name,
|
|
@@ -199,11 +199,15 @@ function BaseInfo(props) {
|
|
|
199
199
|
ciName = data.ciName,
|
|
200
200
|
operation = data.operation; // 仅展示资源和链路的概览
|
|
201
201
|
|
|
202
|
-
if (!['node', 'link', 'linkGroup'].includes(type)) return; //
|
|
203
|
-
|
|
204
|
-
if ((_topo$options$resourc = topo.options.resourceOverviewDrawer) !== null && _topo$options$resourc !== void 0 && _topo$options$resourc.getData && type === 'link') return; // 没有权限不显示
|
|
202
|
+
if (!['node', 'link', 'linkGroup'].includes(type)) return; // 没有权限不显示
|
|
205
203
|
|
|
206
204
|
if (!operation) return;
|
|
205
|
+
var htElement = topo.getDataModel().getDataByTag(id);
|
|
206
|
+
|
|
207
|
+
if (!canShow(htElement)) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
|
|
207
211
|
setActiveData({
|
|
208
212
|
id: id,
|
|
209
213
|
name: name,
|
|
@@ -273,4 +277,12 @@ function BaseInfo(props) {
|
|
|
273
277
|
}))))));
|
|
274
278
|
}
|
|
275
279
|
|
|
276
|
-
|
|
280
|
+
ResourceDetail.propTypes = {
|
|
281
|
+
canShow: PropTypes.func
|
|
282
|
+
};
|
|
283
|
+
ResourceDetail.defaultProps = {
|
|
284
|
+
canShow: function canShow(htElement) {
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
export default ResourceDetail;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import ResourceDetail from "./ResourceDetail";
|
|
4
|
+
|
|
5
|
+
function ResourceDetailPlugin(props) {
|
|
6
|
+
var viewerProps = props.viewerProps;
|
|
7
|
+
var resourceDetailProps = viewerProps === null || viewerProps === void 0 ? void 0 : viewerProps.resourceDetailProps;
|
|
8
|
+
return /*#__PURE__*/React.createElement(ResourceDetail, _extends({}, props, resourceDetailProps));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default ResourceDetailPlugin;
|
package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Link } from 'react-router-dom';
|
|
3
|
+
import styles from "./index.module.scss"; // url 处理,UICBB 的地址需截取前缀
|
|
4
|
+
|
|
5
|
+
function formatUrl(url) {
|
|
6
|
+
var _window, _window$location;
|
|
7
|
+
|
|
8
|
+
var prefix = '/default/pagecenter';
|
|
9
|
+
|
|
10
|
+
if (((_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.pathname.indexOf(prefix)) === 0 && (url === null || url === void 0 ? void 0 : url.indexOf(prefix)) === 0) {
|
|
11
|
+
return url.split(prefix)[1];
|
|
12
|
+
} else {
|
|
13
|
+
return url;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function AttributeItem(props) {
|
|
18
|
+
var style = props.style,
|
|
19
|
+
key = props.key,
|
|
20
|
+
label = props.label,
|
|
21
|
+
contentTitle = props.contentTitle,
|
|
22
|
+
children = props.children;
|
|
23
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
className: styles.item,
|
|
25
|
+
style: style || {},
|
|
26
|
+
key: key
|
|
27
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
28
|
+
className: styles.label
|
|
29
|
+
}, label), /*#__PURE__*/React.createElement("span", {
|
|
30
|
+
className: styles.content,
|
|
31
|
+
title: contentTitle
|
|
32
|
+
}, children));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function BaseInfoContent(props) {
|
|
36
|
+
var _itemCols$type;
|
|
37
|
+
|
|
38
|
+
var topo = props.topo,
|
|
39
|
+
type = props.type,
|
|
40
|
+
data = props.data;
|
|
41
|
+
var itemCols = {
|
|
42
|
+
node: [{
|
|
43
|
+
label: '资源名称:',
|
|
44
|
+
objKey: 'resource',
|
|
45
|
+
render: function render(valueData, key) {
|
|
46
|
+
var display_name = valueData.display_name,
|
|
47
|
+
link = valueData.link;
|
|
48
|
+
return /*#__PURE__*/React.createElement(AttributeItem, {
|
|
49
|
+
key: key,
|
|
50
|
+
label: "\u8D44\u6E90\u540D\u79F0\uFF1A",
|
|
51
|
+
contentTitle: display_name
|
|
52
|
+
}, valueData ? /*#__PURE__*/React.createElement(Link, {
|
|
53
|
+
className: styles.link,
|
|
54
|
+
to: formatUrl(link)
|
|
55
|
+
}, display_name || '-') : '-');
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
label: 'IP地址:',
|
|
59
|
+
objKey: 'ipv4_address'
|
|
60
|
+
}, {
|
|
61
|
+
label: '资产编号:',
|
|
62
|
+
objKey: 'asset_number'
|
|
63
|
+
}, {
|
|
64
|
+
label: '资源类型:',
|
|
65
|
+
objKey: 'ciName'
|
|
66
|
+
}, {
|
|
67
|
+
label: '资源位置:',
|
|
68
|
+
objKey: 'res_address'
|
|
69
|
+
} // {
|
|
70
|
+
// label: '负责人:',
|
|
71
|
+
// objKey: 'principal'
|
|
72
|
+
// },
|
|
73
|
+
],
|
|
74
|
+
link: [{
|
|
75
|
+
label: '链路带宽:',
|
|
76
|
+
objKey: 'rated_bandwidth',
|
|
77
|
+
style: {
|
|
78
|
+
width: '100%'
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
label: '源IP地址:',
|
|
82
|
+
objKey: 'source_ipv4'
|
|
83
|
+
}, {
|
|
84
|
+
label: '目的IP地址:',
|
|
85
|
+
objKey: 'destination_ipv4'
|
|
86
|
+
}, {
|
|
87
|
+
label: '源端口:',
|
|
88
|
+
objKey: 'source_Interface'
|
|
89
|
+
}, {
|
|
90
|
+
label: '目的端口:',
|
|
91
|
+
objKey: 'destination_Interface'
|
|
92
|
+
}]
|
|
93
|
+
};
|
|
94
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, (_itemCols$type = itemCols[type]) === null || _itemCols$type === void 0 ? void 0 : _itemCols$type.map(function (_ref, key) {
|
|
95
|
+
var label = _ref.label,
|
|
96
|
+
objKey = _ref.objKey,
|
|
97
|
+
style = _ref.style,
|
|
98
|
+
render = _ref.render;
|
|
99
|
+
return data[objKey] === false ? '' : render ? render(data[objKey], key) : /*#__PURE__*/React.createElement(AttributeItem, {
|
|
100
|
+
key: key,
|
|
101
|
+
label: label,
|
|
102
|
+
style: style || {},
|
|
103
|
+
contentTitle: data[objKey]
|
|
104
|
+
}, data[objKey] || '-');
|
|
105
|
+
}));
|
|
106
|
+
} // 基本信息
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
export default function BaseInfo(props) {
|
|
110
|
+
var topo = props.topo,
|
|
111
|
+
type = props.type,
|
|
112
|
+
data = props.data,
|
|
113
|
+
baseInfo = props.baseInfo,
|
|
114
|
+
renderContent = props.renderContent;
|
|
115
|
+
var content = renderContent ? renderContent({
|
|
116
|
+
type: type,
|
|
117
|
+
data: data,
|
|
118
|
+
AttributeItem: AttributeItem
|
|
119
|
+
}) : null;
|
|
120
|
+
|
|
121
|
+
if (!content) {
|
|
122
|
+
content = /*#__PURE__*/React.createElement(BaseInfoContent, {
|
|
123
|
+
type: type,
|
|
124
|
+
data: baseInfo
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
129
|
+
className: styles['base-info']
|
|
130
|
+
}, content);
|
|
131
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import BaseInfo from "./BaseInfo";
|
|
3
|
+
import BlockBox from "./BlockBox";
|
|
4
|
+
import SingleResourceStrategyLink from "./SingleResourceStrategyLink";
|
|
5
|
+
export default function BaseInfoBlock(props) {
|
|
6
|
+
var topo = props.topo,
|
|
7
|
+
data = props.data,
|
|
8
|
+
ciTypeMeta = props.ciTypeMeta,
|
|
9
|
+
headerExtra = props.headerExtra,
|
|
10
|
+
renderContent = props.renderContent,
|
|
11
|
+
baseInfo = props.baseInfo;
|
|
12
|
+
var id = data.id,
|
|
13
|
+
ciType = data.ciType,
|
|
14
|
+
type = data.type,
|
|
15
|
+
name = data.name;
|
|
16
|
+
return /*#__PURE__*/React.createElement(BlockBox, {
|
|
17
|
+
headerTitle: "\u57FA\u672C\u4FE1\u606F",
|
|
18
|
+
headerExtra: headerExtra ? headerExtra(props) : ciType === 'network_link' && /*#__PURE__*/React.createElement(SingleResourceStrategyLink, {
|
|
19
|
+
id: id,
|
|
20
|
+
ciType: ciType,
|
|
21
|
+
name: name
|
|
22
|
+
})
|
|
23
|
+
}, /*#__PURE__*/React.createElement(BaseInfo, {
|
|
24
|
+
topo: topo,
|
|
25
|
+
type: type,
|
|
26
|
+
data: data,
|
|
27
|
+
ciTypeMeta: ciTypeMeta,
|
|
28
|
+
renderContent: renderContent,
|
|
29
|
+
baseInfo: baseInfo
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { metricValueFormat } from '@riil-frontend/utils';
|
|
3
|
+
import styles from "./index.module.scss"; // 关键指标
|
|
4
|
+
|
|
5
|
+
export default function ResourceOverviewMetric(props) {
|
|
6
|
+
var topo = props.topo,
|
|
7
|
+
type = props.type,
|
|
8
|
+
data = props.data;
|
|
9
|
+
|
|
10
|
+
function formatValue(itemData) {
|
|
11
|
+
var format = metricValueFormat({
|
|
12
|
+
value: itemData.value,
|
|
13
|
+
dataType: itemData.dataType,
|
|
14
|
+
dict: topo.dictCache.getDictObject(),
|
|
15
|
+
unit: itemData.unit,
|
|
16
|
+
code: itemData.code
|
|
17
|
+
});
|
|
18
|
+
return format.value + " " + (format.value === '-' ? '' : format.unit);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
22
|
+
className: styles.indicator
|
|
23
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
className: styles.row
|
|
25
|
+
}, data.slice(0, 3).map(function (item) {
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: styles.item,
|
|
28
|
+
key: item.code
|
|
29
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
30
|
+
className: styles.content
|
|
31
|
+
}, formatValue(item)), /*#__PURE__*/React.createElement("span", {
|
|
32
|
+
className: styles.label
|
|
33
|
+
}, item.name));
|
|
34
|
+
})), type === 'node' ? /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: styles.row
|
|
36
|
+
}, data.slice(3, 6).map(function (item) {
|
|
37
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: styles.item,
|
|
39
|
+
key: item.code
|
|
40
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
41
|
+
className: styles.content
|
|
42
|
+
}, formatValue(item)), /*#__PURE__*/React.createElement("span", {
|
|
43
|
+
className: styles.label
|
|
44
|
+
}, item.name));
|
|
45
|
+
})) : '');
|
|
46
|
+
}
|
|
@@ -3,9 +3,11 @@ import { Link } from 'react-router-dom';
|
|
|
3
3
|
export default function SingleResourceStrategyLink(props) {
|
|
4
4
|
var id = props.id,
|
|
5
5
|
ciType = props.ciType,
|
|
6
|
-
name = props.name
|
|
6
|
+
name = props.name,
|
|
7
|
+
_props$label = props.label,
|
|
8
|
+
label = _props$label === void 0 ? '监控策略' : _props$label;
|
|
7
9
|
var url = "/default/singleResourceStrategy/" + id + "?title=" + encodeURIComponent(name) + "-\u76D1\u63A7\u914D\u7F6E&ciId=" + id + "&ciType=" + ciType + "&ciName=" + encodeURIComponent(name);
|
|
8
10
|
return /*#__PURE__*/React.createElement(Link, {
|
|
9
11
|
to: url
|
|
10
|
-
},
|
|
12
|
+
}, label);
|
|
11
13
|
}
|