@riil-frontend/component-topology 3.1.4 → 3.1.7
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 +1 -1
- package/build/index.css +1 -1
- package/build/index.js +11 -11
- 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 +1 -1
- 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/ResourceDetail.js +288 -0
- package/es/core/viewer/components/plugins/BaseInfo/ResourceDetailPlugin.js +11 -0
- package/es/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/BaseInfo.js +129 -0
- package/es/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/ResourceOverviewMetric.js +46 -0
- package/es/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.js +64 -172
- package/es/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/useCiAttrAndMetricData.js +12 -0
- package/es/core/viewer/components/plugins/BaseInfo/index.js +2 -276
- 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/ResourceDetail.js +313 -0
- package/lib/core/viewer/components/plugins/BaseInfo/ResourceDetailPlugin.js +21 -0
- package/lib/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/BaseInfo.js +139 -0
- package/lib/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/ResourceOverviewMetric.js +56 -0
- package/lib/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.js +65 -173
- package/lib/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/useCiAttrAndMetricData.js +17 -0
- package/lib/core/viewer/components/plugins/BaseInfo/index.js +2 -291
- 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 +3 -3
|
@@ -0,0 +1,129 @@
|
|
|
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
|
+
resourceOverviewProps = props.resourceOverviewProps;
|
|
114
|
+
var content;
|
|
115
|
+
|
|
116
|
+
if (resourceOverviewProps !== null && resourceOverviewProps !== void 0 && resourceOverviewProps.renderBaseInfoContent) {
|
|
117
|
+
content = resourceOverviewProps === null || resourceOverviewProps === void 0 ? void 0 : resourceOverviewProps.renderBaseInfoContent({
|
|
118
|
+
type: type,
|
|
119
|
+
DefaultBaseInfoContent: BaseInfoContent,
|
|
120
|
+
AttributeItem: AttributeItem
|
|
121
|
+
});
|
|
122
|
+
} else {
|
|
123
|
+
content = /*#__PURE__*/React.createElement(BaseInfoContent, props);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
127
|
+
className: styles['base-info']
|
|
128
|
+
}, content);
|
|
129
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -5,20 +5,20 @@ import _Button from "@alifd/next/es/button";
|
|
|
5
5
|
import _Icon from "@alifd/next/es/icon";
|
|
6
6
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
-
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
8
|
+
import React, { useState, useEffect, useRef, useCallback, useMemo } from 'react';
|
|
9
9
|
import { Link } from 'react-router-dom';
|
|
10
|
-
import { metricValueFormat } from '@riil-frontend/utils';
|
|
11
10
|
import moment from 'moment';
|
|
12
|
-
import { TopoEvent } from '@riil-frontend/component-topology-graph';
|
|
13
11
|
import topoService from '@riil-frontend/component-topology-common/es/services/topo';
|
|
14
12
|
import { findItem } from "../../../../../../../utils/topoData";
|
|
15
13
|
import service from "../../../../../../services/overview";
|
|
16
14
|
import alarmService from "../../../../../../services/alarm";
|
|
17
|
-
import DictCache from "../../../../../../models/cache/DictCache";
|
|
18
15
|
import { queryCisByIds } from "../../../../../../services";
|
|
19
16
|
import styles from "./index.module.scss";
|
|
20
17
|
import SingleResourceStrategyLink from "./SingleResourceStrategyLink";
|
|
21
|
-
import BlockBox from "./BlockBox";
|
|
18
|
+
import BlockBox from "./BlockBox";
|
|
19
|
+
import useCiAttrAndMetricData from "./useCiAttrAndMetricData";
|
|
20
|
+
import ResourceOverviewMetric from "./ResourceOverviewMetric";
|
|
21
|
+
import BaseInfo from "./BaseInfo"; // url 处理,UICBB 的地址需截取前缀
|
|
22
22
|
|
|
23
23
|
function formatUrl(url) {
|
|
24
24
|
var _window, _window$location;
|
|
@@ -30,127 +30,6 @@ function formatUrl(url) {
|
|
|
30
30
|
} else {
|
|
31
31
|
return url;
|
|
32
32
|
}
|
|
33
|
-
} // 基本信息
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
function BaseInfoRender(type, data) {
|
|
37
|
-
var _itemCols$type;
|
|
38
|
-
|
|
39
|
-
var itemCols = {
|
|
40
|
-
node: [{
|
|
41
|
-
label: '资源名称:',
|
|
42
|
-
objKey: 'resource',
|
|
43
|
-
render: function render(valueData, key) {
|
|
44
|
-
var display_name = valueData.display_name,
|
|
45
|
-
link = valueData.link;
|
|
46
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
47
|
-
className: styles.item,
|
|
48
|
-
key: key
|
|
49
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
50
|
-
className: styles.label
|
|
51
|
-
}, "\u8D44\u6E90\u540D\u79F0\uFF1A"), /*#__PURE__*/React.createElement("span", {
|
|
52
|
-
className: styles.content,
|
|
53
|
-
title: display_name
|
|
54
|
-
}, valueData ? /*#__PURE__*/React.createElement(Link, {
|
|
55
|
-
className: styles.link,
|
|
56
|
-
to: formatUrl(link)
|
|
57
|
-
}, display_name) : '-'));
|
|
58
|
-
}
|
|
59
|
-
}, {
|
|
60
|
-
label: 'IP地址:',
|
|
61
|
-
objKey: 'ipv4_address'
|
|
62
|
-
}, {
|
|
63
|
-
label: '资产编号:',
|
|
64
|
-
objKey: 'asset_number'
|
|
65
|
-
}, {
|
|
66
|
-
label: '资源类型:',
|
|
67
|
-
objKey: 'ciName'
|
|
68
|
-
}, {
|
|
69
|
-
label: '资源位置:',
|
|
70
|
-
objKey: 'res_address'
|
|
71
|
-
} // {
|
|
72
|
-
// label: '负责人:',
|
|
73
|
-
// objKey: 'principal'
|
|
74
|
-
// },
|
|
75
|
-
],
|
|
76
|
-
link: [{
|
|
77
|
-
label: '链路带宽:',
|
|
78
|
-
objKey: 'rated_bandwidth',
|
|
79
|
-
style: {
|
|
80
|
-
width: '100%'
|
|
81
|
-
}
|
|
82
|
-
}, {
|
|
83
|
-
label: '源IP地址:',
|
|
84
|
-
objKey: 'source_ipv4'
|
|
85
|
-
}, {
|
|
86
|
-
label: '目的IP地址:',
|
|
87
|
-
objKey: 'destination_ipv4'
|
|
88
|
-
}, {
|
|
89
|
-
label: '源端口:',
|
|
90
|
-
objKey: 'source_Interface'
|
|
91
|
-
}, {
|
|
92
|
-
label: '目的端口:',
|
|
93
|
-
objKey: 'destination_Interface'
|
|
94
|
-
}]
|
|
95
|
-
};
|
|
96
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
97
|
-
className: styles['base-info']
|
|
98
|
-
}, (_itemCols$type = itemCols[type]) === null || _itemCols$type === void 0 ? void 0 : _itemCols$type.map(function (_ref, key) {
|
|
99
|
-
var label = _ref.label,
|
|
100
|
-
objKey = _ref.objKey,
|
|
101
|
-
style = _ref.style,
|
|
102
|
-
render = _ref.render;
|
|
103
|
-
return data[objKey] === false ? '' : render ? render(data[objKey], key) : /*#__PURE__*/React.createElement("div", {
|
|
104
|
-
className: styles.item,
|
|
105
|
-
style: style || {},
|
|
106
|
-
key: key
|
|
107
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
108
|
-
className: styles.label
|
|
109
|
-
}, label), /*#__PURE__*/React.createElement("span", {
|
|
110
|
-
className: styles.content,
|
|
111
|
-
title: data[objKey]
|
|
112
|
-
}, data[objKey] || '-'));
|
|
113
|
-
}));
|
|
114
|
-
} // 关键指标
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
function indicatorRender(type, data) {
|
|
118
|
-
function formatValue(itemData) {
|
|
119
|
-
var format = metricValueFormat({
|
|
120
|
-
value: itemData.value,
|
|
121
|
-
dataType: itemData.dataType,
|
|
122
|
-
dict: DictCache.getDictObject(),
|
|
123
|
-
unit: itemData.unit,
|
|
124
|
-
code: itemData.code
|
|
125
|
-
});
|
|
126
|
-
return format.value + " " + (format.value === '-' ? '' : format.unit);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
130
|
-
className: styles.indicator
|
|
131
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
132
|
-
className: styles.row
|
|
133
|
-
}, data.slice(0, 3).map(function (item) {
|
|
134
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
135
|
-
className: styles.item,
|
|
136
|
-
key: item.code
|
|
137
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
138
|
-
className: styles.content
|
|
139
|
-
}, formatValue(item)), /*#__PURE__*/React.createElement("span", {
|
|
140
|
-
className: styles.label
|
|
141
|
-
}, item.name));
|
|
142
|
-
})), type === 'node' ? /*#__PURE__*/React.createElement("div", {
|
|
143
|
-
className: styles.row
|
|
144
|
-
}, data.slice(3, 6).map(function (item) {
|
|
145
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
146
|
-
className: styles.item,
|
|
147
|
-
key: item.code
|
|
148
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
149
|
-
className: styles.content
|
|
150
|
-
}, formatValue(item)), /*#__PURE__*/React.createElement("span", {
|
|
151
|
-
className: styles.label
|
|
152
|
-
}, item.name));
|
|
153
|
-
})) : '');
|
|
154
33
|
}
|
|
155
34
|
/**
|
|
156
35
|
* 资源概览
|
|
@@ -158,18 +37,19 @@ function indicatorRender(type, data) {
|
|
|
158
37
|
|
|
159
38
|
|
|
160
39
|
export default function ResourceOverview(props) {
|
|
40
|
+
var _viewerProps$resource;
|
|
41
|
+
|
|
161
42
|
var topo = props.topo,
|
|
162
43
|
id = props.id,
|
|
163
44
|
type = props.type,
|
|
164
45
|
ciType = props.ciType,
|
|
165
|
-
userId = props.userId
|
|
166
|
-
|
|
167
|
-
var
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
links = _topo$store$useModelS2.links;
|
|
46
|
+
userId = props.userId,
|
|
47
|
+
viewerProps = props.viewerProps;
|
|
48
|
+
var resourceOverviewProps = viewerProps === null || viewerProps === void 0 ? void 0 : (_viewerProps$resource = viewerProps.resourceDetailProps) === null || _viewerProps$resource === void 0 ? void 0 : _viewerProps$resource.resourceOverviewProps;
|
|
49
|
+
var ciAttrAndMetricData = useCiAttrAndMetricData({
|
|
50
|
+
topo: topo,
|
|
51
|
+
id: id
|
|
52
|
+
});
|
|
173
53
|
|
|
174
54
|
var _useState = useState({
|
|
175
55
|
// 资源
|
|
@@ -215,9 +95,25 @@ export default function ResourceOverview(props) {
|
|
|
215
95
|
isAppTopo = _useState4[0],
|
|
216
96
|
setIsAppTopo = _useState4[1];
|
|
217
97
|
|
|
98
|
+
var ciTypeMeta = useMemo(function () {
|
|
99
|
+
var typeMeta;
|
|
100
|
+
|
|
101
|
+
if (ciType === 'network_link') {
|
|
102
|
+
// 网络链路要按链路类型查询属性、指标
|
|
103
|
+
var link = topo.dataModel.getDataById(id);
|
|
104
|
+
var linkConnectType = link.attributes['network_link.connect_type'];
|
|
105
|
+
typeMeta = topo.ciTyeCache.getNetworkLinkCiType(linkConnectType);
|
|
106
|
+
} else {
|
|
107
|
+
typeMeta = topo.ciTyeCache.getCiType(ciType);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return typeMeta;
|
|
111
|
+
}, [id]);
|
|
218
112
|
useEffect(function () {
|
|
219
|
-
|
|
220
|
-
|
|
113
|
+
if (ciAttrAndMetricData) {
|
|
114
|
+
init();
|
|
115
|
+
}
|
|
116
|
+
}, [ciAttrAndMetricData, ciTypeMeta, id]);
|
|
221
117
|
|
|
222
118
|
function init() {
|
|
223
119
|
return _init.apply(this, arguments);
|
|
@@ -227,27 +123,15 @@ export default function ResourceOverview(props) {
|
|
|
227
123
|
_init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
228
124
|
var _topo$options$resourc, _modelAttributeMap$ow, _modelAttributeMap$, _modelAttributeMap$2, _modelAttributeMap$3, _modelAttributeMap$di, _modelAttributeMap$ip, _modelAttributeMap$as, _modelAttributeMap$5, _modelAttributeMap$6, _modelAttributeMap$so, _attributeMap$source_, _modelAttributeMap$de, _attributeMap$destina;
|
|
229
125
|
|
|
230
|
-
var
|
|
126
|
+
var modelMetrics, ciName, modelAttributeMap, domain, topModelMetrics, isAppTopoFlag, attributeMap, metrics, res_address, _attributeMap$, rated_bandwidth, _modelAttributeMap$4;
|
|
231
127
|
|
|
232
128
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
233
129
|
while (1) {
|
|
234
130
|
switch (_context.prev = _context.next) {
|
|
235
131
|
case 0:
|
|
236
|
-
console.log('初始化/更新概览 props', props);
|
|
237
|
-
|
|
238
|
-
if (ciType === 'network_link') {
|
|
239
|
-
// 网络链路要按链路类型查询属性、指标
|
|
240
|
-
link = [].concat(linkGroups, links).find(function (item) {
|
|
241
|
-
return item.id === id;
|
|
242
|
-
});
|
|
243
|
-
linkConnectType = link.attributes['network_link.connect_type'];
|
|
244
|
-
ciTypeMeta = topo.ciTyeCache.getNetworkLinkCiType(linkConnectType);
|
|
245
|
-
} else {
|
|
246
|
-
ciTypeMeta = topo.ciTyeCache.getCiType(ciType);
|
|
247
|
-
} // 指标模型
|
|
248
|
-
|
|
132
|
+
console.log('初始化/更新概览 props', props); // 指标模型
|
|
249
133
|
|
|
250
|
-
|
|
134
|
+
modelMetrics = ciTypeMeta.metrics, ciName = ciTypeMeta.displayName, modelAttributeMap = ciTypeMeta.attributeMap, domain = ciTypeMeta.domain;
|
|
251
135
|
topModelMetrics = modelMetrics.slice(0, 6); // 应用拓扑处理
|
|
252
136
|
|
|
253
137
|
isAppTopoFlag = !!((_topo$options$resourc = topo.options.resourceOverviewDrawer) !== null && _topo$options$resourc !== void 0 && _topo$options$resourc.getData);
|
|
@@ -255,41 +139,41 @@ export default function ResourceOverview(props) {
|
|
|
255
139
|
setIsAppTopo(isAppTopoFlag);
|
|
256
140
|
|
|
257
141
|
if (!isAppTopoFlag) {
|
|
258
|
-
_context.next =
|
|
142
|
+
_context.next = 9;
|
|
259
143
|
break;
|
|
260
144
|
}
|
|
261
145
|
|
|
262
146
|
initAppTopo(topModelMetrics, modelAttributeMap, ciName, domain);
|
|
263
147
|
return _context.abrupt("return");
|
|
264
148
|
|
|
265
|
-
case
|
|
149
|
+
case 9:
|
|
266
150
|
// 拓扑(默认) ---------------------------
|
|
267
151
|
// 基本信息
|
|
268
|
-
|
|
269
|
-
console.log('基本信息', attributeMap,
|
|
152
|
+
attributeMap = ciAttrAndMetricData.attributeMap, metrics = ciAttrAndMetricData.metrics;
|
|
153
|
+
console.log('基本信息', attributeMap, modelAttributeMap); // userVisible
|
|
270
154
|
// 位置
|
|
271
155
|
|
|
272
156
|
res_address = false;
|
|
273
157
|
|
|
274
158
|
if (!((_modelAttributeMap$ow = modelAttributeMap.owned_computer_room) !== null && _modelAttributeMap$ow !== void 0 && _modelAttributeMap$ow.userVisible)) {
|
|
275
|
-
_context.next =
|
|
159
|
+
_context.next = 18;
|
|
276
160
|
break;
|
|
277
161
|
}
|
|
278
162
|
|
|
279
|
-
_context.next =
|
|
163
|
+
_context.next = 15;
|
|
280
164
|
return getAddressFormat(attributeMap);
|
|
281
165
|
|
|
282
|
-
case
|
|
166
|
+
case 15:
|
|
283
167
|
res_address = _context.sent;
|
|
284
|
-
_context.next =
|
|
168
|
+
_context.next = 19;
|
|
285
169
|
break;
|
|
286
170
|
|
|
287
|
-
case
|
|
171
|
+
case 18:
|
|
288
172
|
if ((_modelAttributeMap$ = modelAttributeMap[ciType + ".computer_room"]) !== null && _modelAttributeMap$ !== void 0 && _modelAttributeMap$.userVisible || (_modelAttributeMap$2 = modelAttributeMap[ciType + ".area"]) !== null && _modelAttributeMap$2 !== void 0 && _modelAttributeMap$2.userVisible) {
|
|
289
173
|
res_address = attributeMap[ciType + ".computer_room "] || attributeMap[ciType + ".area"] ? " " + (((_attributeMap$ = attributeMap[ciType + ".area_object"]) === null || _attributeMap$ === void 0 ? void 0 : _attributeMap$.displayName) || '') + " " + (attributeMap[ciType + ".computer_room"] || '') : false;
|
|
290
174
|
}
|
|
291
175
|
|
|
292
|
-
case
|
|
176
|
+
case 19:
|
|
293
177
|
// 链路带宽(取实际带宽)
|
|
294
178
|
rated_bandwidth = false;
|
|
295
179
|
|
|
@@ -320,16 +204,16 @@ export default function ResourceOverview(props) {
|
|
|
320
204
|
}); // 资源/链路-关键指标 数据 metrics,模型 topo.ciTyeCache.getCiType(ciType)
|
|
321
205
|
|
|
322
206
|
setIndicator(topModelMetrics.map(function (item) {
|
|
323
|
-
var
|
|
207
|
+
var _findItem;
|
|
324
208
|
|
|
325
209
|
return _extends({}, item, {
|
|
326
|
-
value: ((
|
|
210
|
+
value: ((_findItem = findItem(metrics, 'code', item.code)) === null || _findItem === void 0 ? void 0 : _findItem.value) || ''
|
|
327
211
|
});
|
|
328
212
|
})); // 资源-告警/风险
|
|
329
213
|
|
|
330
214
|
getAlarmRiskData(id);
|
|
331
215
|
|
|
332
|
-
case
|
|
216
|
+
case 24:
|
|
333
217
|
case "end":
|
|
334
218
|
return _context.stop();
|
|
335
219
|
}
|
|
@@ -453,7 +337,7 @@ export default function ResourceOverview(props) {
|
|
|
453
337
|
|
|
454
338
|
function _getAttribute() {
|
|
455
339
|
_getAttribute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id) {
|
|
456
|
-
var res,
|
|
340
|
+
var res, _ref2, attributes, attributeMap;
|
|
457
341
|
|
|
458
342
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
459
343
|
while (1) {
|
|
@@ -471,7 +355,7 @@ export default function ResourceOverview(props) {
|
|
|
471
355
|
|
|
472
356
|
case 2:
|
|
473
357
|
res = _context3.sent;
|
|
474
|
-
|
|
358
|
+
_ref2 = res[0] || {}, attributes = _ref2.attributes;
|
|
475
359
|
attributeMap = {};
|
|
476
360
|
attributes.forEach(function (item) {
|
|
477
361
|
attributeMap[item.code] = item.value;
|
|
@@ -494,14 +378,14 @@ export default function ResourceOverview(props) {
|
|
|
494
378
|
|
|
495
379
|
|
|
496
380
|
function _getAddressFormat() {
|
|
497
|
-
_getAddressFormat = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(
|
|
381
|
+
_getAddressFormat = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref) {
|
|
498
382
|
var owned_computer_room, owned_cabinet, start_u_location, end_u_location, address, _res$find, _res$find$attributes, _res$find2, _res$find2$attributes, res, u;
|
|
499
383
|
|
|
500
384
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
501
385
|
while (1) {
|
|
502
386
|
switch (_context4.prev = _context4.next) {
|
|
503
387
|
case 0:
|
|
504
|
-
owned_computer_room =
|
|
388
|
+
owned_computer_room = _ref.owned_computer_room, owned_cabinet = _ref.owned_cabinet, start_u_location = _ref.start_u_location, end_u_location = _ref.end_u_location;
|
|
505
389
|
console.log('获取地址信息:', {
|
|
506
390
|
owned_computer_room: owned_computer_room,
|
|
507
391
|
owned_cabinet: owned_cabinet,
|
|
@@ -726,11 +610,19 @@ export default function ResourceOverview(props) {
|
|
|
726
610
|
ciType: ciType,
|
|
727
611
|
name: baseInfo.resource.display_name
|
|
728
612
|
})
|
|
729
|
-
},
|
|
613
|
+
}, /*#__PURE__*/React.createElement(BaseInfo, {
|
|
614
|
+
topo: topo,
|
|
615
|
+
type: type,
|
|
616
|
+
data: baseInfo,
|
|
617
|
+
ciTypeMeta: ciTypeMeta,
|
|
618
|
+
resourceOverviewProps: resourceOverviewProps
|
|
619
|
+
})), /*#__PURE__*/React.createElement(BlockBox, {
|
|
730
620
|
headerTitle: "\u5173\u952E\u6307\u6807"
|
|
731
|
-
}, /*#__PURE__*/React.createElement(
|
|
732
|
-
|
|
733
|
-
|
|
621
|
+
}, /*#__PURE__*/React.createElement(ResourceOverviewMetric, {
|
|
622
|
+
topo: topo,
|
|
623
|
+
type: type,
|
|
624
|
+
data: indicator
|
|
625
|
+
})), /*#__PURE__*/React.createElement(BlockBox, {
|
|
734
626
|
headerTitle: "\u6700\u8FD1\u7684\u544A\u8B66\u548C\u98CE\u9669"
|
|
735
627
|
}, /*#__PURE__*/React.createElement("div", {
|
|
736
628
|
className: styles.alarm
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default function useCiAttrAndMetricData(props) {
|
|
2
|
+
var topo = props.topo,
|
|
3
|
+
id = props.id;
|
|
4
|
+
|
|
5
|
+
var _topo$store$useModelS = topo.store.useModelState('topoBizMod'),
|
|
6
|
+
attrsAndMetrics = _topo$store$useModelS.attrsAndMetrics;
|
|
7
|
+
|
|
8
|
+
var data = attrsAndMetrics.find(function (item) {
|
|
9
|
+
return item.id === id;
|
|
10
|
+
});
|
|
11
|
+
return data;
|
|
12
|
+
}
|