@riil-frontend/component-topology 8.0.0-a.7 → 8.0.0-a.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 +9 -9
- package/es/core/hooks/usePolling.js +3 -3
- package/es/core/models/TopoApp.js +2 -2
- package/es/core/models/tagstips/ElementTagTipConfig.js +1 -1
- package/es/core/models/utils/linkUtils.js +31 -63
- package/es/core/services/topo/basic.js +34 -0
- package/es/core/services/topo/constants.js +1 -0
- package/es/core/services/topo/index.js +4 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +2 -1
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +4 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +2 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +3 -3
- package/es/networkTopo/store/linkManager.js +0 -1
- package/es/networkTopo/store/topoCenter.js +0 -1
- package/es/networkTopo/store/topoLinkMod.js +0 -1
- package/lib/core/hooks/usePolling.js +3 -3
- package/lib/core/models/TopoApp.js +3 -3
- package/lib/core/models/tagstips/ElementTagTipConfig.js +2 -2
- package/lib/core/models/utils/linkUtils.js +32 -67
- package/lib/core/services/topo/basic.js +46 -0
- package/lib/core/services/topo/constants.js +6 -0
- package/lib/core/services/topo/index.js +16 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +2 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +4 -2
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +2 -2
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +3 -3
- package/lib/networkTopo/store/linkManager.js +0 -2
- package/lib/networkTopo/store/topoCenter.js +0 -2
- package/lib/networkTopo/store/topoLinkMod.js +0 -2
- package/package.json +2 -2
- /package/es/core/services/{topo.js → topo/tagtip.js} +0 -0
- /package/lib/core/services/{topo.js → topo/tagtip.js} +0 -0
@@ -21,9 +21,9 @@ var usePolling = function usePolling(props) {
|
|
21
21
|
var resIdsList = resAndMetrics === null || resAndMetrics === void 0 ? void 0 : resAndMetrics.resIdsList; // 轮询hooks
|
22
22
|
|
23
23
|
var _useRequest = useRequest(refresh, {
|
24
|
-
pollingInterval:
|
25
|
-
|
26
|
-
// debounceInterval:
|
24
|
+
pollingInterval: 60 * 1000,
|
25
|
+
pollingWhenHidden: false,
|
26
|
+
// debounceInterval: 200,
|
27
27
|
manual: true,
|
28
28
|
onSuccess: function onSuccess(result) {
|
29
29
|
if (result) {
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
4
|
-
import topoService from '@riil-frontend/component-topology-common/es/services/topo';
|
5
4
|
import { setRequest } from '@riil-frontend/component-topology-utils';
|
6
5
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
7
6
|
import { cloneDeep } from 'lodash';
|
7
|
+
import topoService from "../services/topo";
|
8
8
|
import CiTypeCache from "./cache/CiTypeCache";
|
9
9
|
import Alarm from "./Alarm";
|
10
10
|
import TopoGraphView from "./TopoGraphView";
|
@@ -23,7 +23,7 @@ import topoFactory from "./topoFactory";
|
|
23
23
|
import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
|
24
24
|
import SelectionModel from "./SelectionModel"; // eslint-disable-next-line no-undef
|
25
25
|
|
26
|
-
var version = typeof "8.0.0-a.
|
26
|
+
var version = typeof "8.0.0-a.9" === 'string' ? "8.0.0-a.9" : null;
|
27
27
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
28
28
|
/**
|
29
29
|
* 拓扑显示和编辑
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
4
4
|
import { getLinkMtCodes, getMonitorTemplateCodesFromTopoData, getMtCodeCiTypeMap, getNodeMtCodes } from "./utils";
|
5
|
-
import { getMetricsByMonitorTemplateCodes } from "../../services/topo";
|
5
|
+
import { getMetricsByMonitorTemplateCodes } from "../../services/topo/tagtip";
|
6
6
|
import rlog from '@riil-frontend/component-topology-utils/lib/rlog';
|
7
7
|
|
8
8
|
var ElementTagTipConfig = /*#__PURE__*/function () {
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
4
|
-
import topoService from '@riil-frontend/component-topology-common/es/services/topo';
|
5
4
|
import keyBy from 'lodash/keyBy';
|
6
5
|
import _ from 'lodash';
|
7
6
|
import { queryCisByIds, queryModelAsset } from "../../services"; // 查询所有连线
|
8
7
|
|
9
|
-
import { getEdges } from "../../../utils/htElementUtils";
|
8
|
+
import { getEdges } from "../../../utils/htElementUtils";
|
9
|
+
import CiTypeCache from "../cache/CiTypeCache"; // const interfaceTypeMap = {
|
10
10
|
// "network.interface": {
|
11
11
|
// displayName: "网络接口",
|
12
12
|
// },
|
@@ -33,40 +33,6 @@ export function isCrucialLink(link) {
|
|
33
33
|
export function isExitLink(link) {
|
34
34
|
return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes['destination_id']);
|
35
35
|
}
|
36
|
-
export var getInterfaceObject = /*#__PURE__*/function () {
|
37
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(codes) {
|
38
|
-
var query, promises, result, ifDoc;
|
39
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
40
|
-
while (1) {
|
41
|
-
switch (_context.prev = _context.next) {
|
42
|
-
case 0:
|
43
|
-
query = _.compact(_.uniq(codes));
|
44
|
-
promises = query.map(queryModelAsset);
|
45
|
-
_context.next = 4;
|
46
|
-
return Promise.all(promises);
|
47
|
-
|
48
|
-
case 4:
|
49
|
-
result = _context.sent;
|
50
|
-
ifDoc = {};
|
51
|
-
result.map(function (ifItem) {
|
52
|
-
ifDoc[ifItem.code] = {
|
53
|
-
displayName: ifItem.displayName
|
54
|
-
};
|
55
|
-
});
|
56
|
-
return _context.abrupt("return", ifDoc);
|
57
|
-
|
58
|
-
case 8:
|
59
|
-
case "end":
|
60
|
-
return _context.stop();
|
61
|
-
}
|
62
|
-
}
|
63
|
-
}, _callee);
|
64
|
-
}));
|
65
|
-
|
66
|
-
return function getInterfaceObject(_x) {
|
67
|
-
return _ref.apply(this, arguments);
|
68
|
-
};
|
69
|
-
}();
|
70
36
|
export function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc) {
|
71
37
|
var linkCiMap = keyBy(links, 'id');
|
72
38
|
return links.map(function (link) {
|
@@ -110,57 +76,59 @@ export function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc
|
|
110
76
|
});
|
111
77
|
});
|
112
78
|
}
|
113
|
-
export function getLinksDetail(
|
79
|
+
export function getLinksDetail(_x, _x2) {
|
114
80
|
return _getLinksDetail.apply(this, arguments);
|
115
81
|
}
|
116
82
|
|
117
83
|
function _getLinksDetail() {
|
118
|
-
_getLinksDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
84
|
+
_getLinksDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(links, nodes) {
|
119
85
|
var linkCis, interfaceIds, interfaceTypes, interfaceCis, interfaceDoc;
|
120
|
-
return _regeneratorRuntime.wrap(function
|
86
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
121
87
|
while (1) {
|
122
|
-
switch (
|
88
|
+
switch (_context.prev = _context.next) {
|
123
89
|
case 0:
|
124
90
|
if (!(!links || !links.length)) {
|
125
|
-
|
91
|
+
_context.next = 2;
|
126
92
|
break;
|
127
93
|
}
|
128
94
|
|
129
|
-
return
|
95
|
+
return _context.abrupt("return", []);
|
130
96
|
|
131
97
|
case 2:
|
132
98
|
// const linkCis = await topoService.relation.batchQueryRelation(
|
133
99
|
// links.map((link) => link.id)
|
134
100
|
// );
|
135
101
|
linkCis = links;
|
136
|
-
interfaceIds = []
|
137
|
-
|
138
|
-
linkCis.
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
102
|
+
interfaceIds = [].concat(linkCis.map(function (item) {
|
103
|
+
return item.attributes.source_id;
|
104
|
+
}), linkCis.map(function (item) {
|
105
|
+
return item.attributes.destination_id;
|
106
|
+
}));
|
107
|
+
interfaceTypes = _.compact(_.uniq([].concat(linkCis.map(function (item) {
|
108
|
+
return item.attributes.source_type;
|
109
|
+
}), linkCis.map(function (item) {
|
110
|
+
return item.attributes.destination_type;
|
111
|
+
})))).filter(function (item) {
|
112
|
+
return item !== 'ip';
|
143
113
|
});
|
144
|
-
|
114
|
+
_context.next = 7;
|
145
115
|
return queryCisByIds(interfaceIds);
|
146
116
|
|
147
|
-
case
|
148
|
-
interfaceCis =
|
149
|
-
|
150
|
-
return
|
151
|
-
return item !== 'ip';
|
152
|
-
}));
|
117
|
+
case 7:
|
118
|
+
interfaceCis = _context.sent;
|
119
|
+
_context.next = 10;
|
120
|
+
return CiTypeCache.getCiTypeMap(interfaceTypes);
|
153
121
|
|
154
|
-
case
|
155
|
-
interfaceDoc =
|
156
|
-
return
|
122
|
+
case 10:
|
123
|
+
interfaceDoc = _context.sent;
|
124
|
+
return _context.abrupt("return", mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc));
|
157
125
|
|
158
|
-
case
|
126
|
+
case 12:
|
159
127
|
case "end":
|
160
|
-
return
|
128
|
+
return _context.stop();
|
161
129
|
}
|
162
130
|
}
|
163
|
-
},
|
131
|
+
}, _callee);
|
164
132
|
}));
|
165
133
|
return _getLinksDetail.apply(this, arguments);
|
166
134
|
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
3
|
+
import { request } from '@riil-frontend/component-topology-utils';
|
4
|
+
import { TOPO_API_ROOT } from "./constants";
|
5
|
+
export default {
|
6
|
+
/**
|
7
|
+
* 保存拓扑绘制数据(第三方库内部结构,无需关心含义)
|
8
|
+
* @param {Number} id Topo ID
|
9
|
+
* @param {String} data ht拓扑序列化数据
|
10
|
+
* @returns
|
11
|
+
*/
|
12
|
+
saveSerializeData: function saveSerializeData(id, data) {
|
13
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
14
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
15
|
+
while (1) {
|
16
|
+
switch (_context.prev = _context.next) {
|
17
|
+
case 0:
|
18
|
+
_context.next = 2;
|
19
|
+
return request.post(TOPO_API_ROOT + "/structure/" + id, {
|
20
|
+
data: data
|
21
|
+
});
|
22
|
+
|
23
|
+
case 2:
|
24
|
+
return _context.abrupt("return", _context.sent);
|
25
|
+
|
26
|
+
case 3:
|
27
|
+
case "end":
|
28
|
+
return _context.stop();
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}, _callee);
|
32
|
+
}))();
|
33
|
+
}
|
34
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export var TOPO_API_ROOT = '/topo/v1/api';
|
@@ -954,7 +954,8 @@ export default function ResourceOverview(props) {
|
|
954
954
|
ciAttrAndMetricData: ciAttrAndMetricData
|
955
955
|
},
|
956
956
|
data: metric,
|
957
|
-
loading: metricInitLoading
|
957
|
+
loading: metricInitLoading,
|
958
|
+
formatMetricLatestValue: resourceOverviewProps.formatMetricLatestValue
|
958
959
|
})), /*#__PURE__*/React.createElement(EventsCard, {
|
959
960
|
alarmRiskList: alarmRiskList,
|
960
961
|
closeDetailDrawer: onClose,
|
@@ -60,7 +60,8 @@ export default function ResourceOverviewMetric(props) {
|
|
60
60
|
var topo = props.topo,
|
61
61
|
type = props.type,
|
62
62
|
data = props.data,
|
63
|
-
loading = props.loading
|
63
|
+
loading = props.loading,
|
64
|
+
formatMetricLatestValue = props.formatMetricLatestValue;
|
64
65
|
|
65
66
|
function formatValue(itemData) {
|
66
67
|
var _list;
|
@@ -69,7 +70,8 @@ export default function ResourceOverviewMetric(props) {
|
|
69
70
|
metricItem = itemData.metricItem,
|
70
71
|
list = itemData.list;
|
71
72
|
var format = metricValueFormat({
|
72
|
-
|
73
|
+
// 支持业务拓扑历史时间点指标值处理
|
74
|
+
value: formatMetricLatestValue ? formatMetricLatestValue(list) : (_list = list[list.length - 1]) === null || _list === void 0 ? void 0 : _list.metricValue,
|
73
75
|
dataType: metricItem.dataType,
|
74
76
|
dict: topo.dictCache.getDictObject(),
|
75
77
|
unit: metricItem.unit,
|
@@ -21,7 +21,7 @@ export default function useMetricPolling(_ref) {
|
|
21
21
|
|
22
22
|
|
23
23
|
var queryLinkMetricsRequest = useRequest(queryLinkLatestMetrics, {
|
24
|
-
pollingInterval:
|
24
|
+
pollingInterval: 60 * 1000,
|
25
25
|
pollingWhenHidden: false,
|
26
26
|
debounceInterval: 200,
|
27
27
|
manual: true,
|
@@ -31,7 +31,7 @@ export default function useMetricPolling(_ref) {
|
|
31
31
|
}
|
32
32
|
});
|
33
33
|
var queryInterfaceMetricsRequest = useRequest(queryLinkInterfacesLatestMetrics, {
|
34
|
-
pollingInterval:
|
34
|
+
pollingInterval: 60 * 1000,
|
35
35
|
pollingWhenHidden: false,
|
36
36
|
debounceInterval: 200,
|
37
37
|
manual: true,
|
@@ -92,9 +92,9 @@ var useMetricModels = function useMetricModels(props) {
|
|
92
92
|
}
|
93
93
|
|
94
94
|
var request = useRequest(fetchData, {
|
95
|
-
pollingInterval: 1000 *
|
96
|
-
|
97
|
-
// debounceInterval:
|
95
|
+
pollingInterval: 1000 * 60,
|
96
|
+
pollingWhenHidden: false,
|
97
|
+
// debounceInterval: 200,
|
98
98
|
manual: true,
|
99
99
|
onSuccess: function onSuccess(newMetricModels) {
|
100
100
|
var a = metricModels.map(function (item) {
|
@@ -6,7 +6,6 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
* 链路新增、编辑 Model
|
7
7
|
*/
|
8
8
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
9
|
-
import topoService from '@riil-frontend/component-topology-common/es/services/topo';
|
10
9
|
export default function (topoApp) {
|
11
10
|
return {
|
12
11
|
// 定义 model 的初始 state
|
@@ -8,7 +8,6 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
*
|
9
9
|
*/
|
10
10
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
11
|
-
import topoService from '@riil-frontend/component-topology-common/es/services/topo';
|
12
11
|
export default {
|
13
12
|
// 定义 model 的初始 state
|
14
13
|
state: {
|
@@ -6,7 +6,6 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
* 拓扑链路相关 Model
|
7
7
|
*/
|
8
8
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
9
|
-
import topoService from "@riil-frontend/component-topology-common/es/services/topo";
|
10
9
|
export default function (topoApp) {
|
11
10
|
return {
|
12
11
|
// 定义 model 的初始 state
|
@@ -34,9 +34,9 @@ var usePolling = function usePolling(props) {
|
|
34
34
|
var resIdsList = resAndMetrics === null || resAndMetrics === void 0 ? void 0 : resAndMetrics.resIdsList; // 轮询hooks
|
35
35
|
|
36
36
|
var _useRequest = (0, _ahooks.useRequest)(refresh, {
|
37
|
-
pollingInterval:
|
38
|
-
|
39
|
-
// debounceInterval:
|
37
|
+
pollingInterval: 60 * 1000,
|
38
|
+
pollingWhenHidden: false,
|
39
|
+
// debounceInterval: 200,
|
40
40
|
manual: true,
|
41
41
|
onSuccess: function onSuccess(result) {
|
42
42
|
if (result) {
|
@@ -11,14 +11,14 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
11
11
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13
13
|
|
14
|
-
var _topo = _interopRequireDefault(require("@riil-frontend/component-topology-common/es/services/topo"));
|
15
|
-
|
16
14
|
var _componentTopologyUtils = require("@riil-frontend/component-topology-utils");
|
17
15
|
|
18
16
|
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
|
19
17
|
|
20
18
|
var _lodash = require("lodash");
|
21
19
|
|
20
|
+
var _topo = _interopRequireDefault(require("../services/topo"));
|
21
|
+
|
22
22
|
var _CiTypeCache = _interopRequireDefault(require("./cache/CiTypeCache"));
|
23
23
|
|
24
24
|
var _Alarm = _interopRequireDefault(require("./Alarm"));
|
@@ -54,7 +54,7 @@ var _ElementTagTipConfig = _interopRequireDefault(require("./tagstips/ElementTag
|
|
54
54
|
var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
|
55
55
|
|
56
56
|
// eslint-disable-next-line no-undef
|
57
|
-
var version = typeof "8.0.0-a.
|
57
|
+
var version = typeof "8.0.0-a.9" === 'string' ? "8.0.0-a.9" : null;
|
58
58
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
59
59
|
/**
|
60
60
|
* 拓扑显示和编辑
|
@@ -13,7 +13,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
13
13
|
|
14
14
|
var _utils = require("./utils");
|
15
15
|
|
16
|
-
var
|
16
|
+
var _tagtip = require("../../services/topo/tagtip");
|
17
17
|
|
18
18
|
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/lib/rlog"));
|
19
19
|
|
@@ -44,7 +44,7 @@ var ElementTagTipConfig = /*#__PURE__*/function () {
|
|
44
44
|
}
|
45
45
|
|
46
46
|
_context.next = 6;
|
47
|
-
return (0,
|
47
|
+
return (0, _tagtip.getMetricsByMonitorTemplateCodes)(this.mtCodes);
|
48
48
|
|
49
49
|
case 6:
|
50
50
|
this.mtMetricsMap = _context.sent;
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
4
4
|
|
5
5
|
exports.__esModule = true;
|
6
6
|
exports.buildTopoLinkData = buildTopoLinkData;
|
7
|
-
exports.
|
7
|
+
exports.compatibleWith = void 0;
|
8
8
|
exports.getLinksDetail = getLinksDetail;
|
9
9
|
exports.isCrucialLink = isCrucialLink;
|
10
10
|
exports.isExitLink = isExitLink;
|
@@ -13,11 +13,9 @@ exports.showLinkByConfig = exports.plurals = void 0;
|
|
13
13
|
|
14
14
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
15
15
|
|
16
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
17
|
-
|
18
16
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
19
17
|
|
20
|
-
var
|
18
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
21
19
|
|
22
20
|
var _keyBy = _interopRequireDefault(require("lodash/keyBy"));
|
23
21
|
|
@@ -27,6 +25,8 @@ var _services = require("../../services");
|
|
27
25
|
|
28
26
|
var _htElementUtils = require("../../../utils/htElementUtils");
|
29
27
|
|
28
|
+
var _CiTypeCache = _interopRequireDefault(require("../cache/CiTypeCache"));
|
29
|
+
|
30
30
|
// 查询所有连线
|
31
31
|
// const interfaceTypeMap = {
|
32
32
|
// "network.interface": {
|
@@ -56,43 +56,6 @@ function isExitLink(link) {
|
|
56
56
|
return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes['destination_id']);
|
57
57
|
}
|
58
58
|
|
59
|
-
var getInterfaceObject = /*#__PURE__*/function () {
|
60
|
-
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(codes) {
|
61
|
-
var query, promises, result, ifDoc;
|
62
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
63
|
-
while (1) {
|
64
|
-
switch (_context.prev = _context.next) {
|
65
|
-
case 0:
|
66
|
-
query = _lodash["default"].compact(_lodash["default"].uniq(codes));
|
67
|
-
promises = query.map(_services.queryModelAsset);
|
68
|
-
_context.next = 4;
|
69
|
-
return Promise.all(promises);
|
70
|
-
|
71
|
-
case 4:
|
72
|
-
result = _context.sent;
|
73
|
-
ifDoc = {};
|
74
|
-
result.map(function (ifItem) {
|
75
|
-
ifDoc[ifItem.code] = {
|
76
|
-
displayName: ifItem.displayName
|
77
|
-
};
|
78
|
-
});
|
79
|
-
return _context.abrupt("return", ifDoc);
|
80
|
-
|
81
|
-
case 8:
|
82
|
-
case "end":
|
83
|
-
return _context.stop();
|
84
|
-
}
|
85
|
-
}
|
86
|
-
}, _callee);
|
87
|
-
}));
|
88
|
-
|
89
|
-
return function getInterfaceObject(_x) {
|
90
|
-
return _ref.apply(this, arguments);
|
91
|
-
};
|
92
|
-
}();
|
93
|
-
|
94
|
-
exports.getInterfaceObject = getInterfaceObject;
|
95
|
-
|
96
59
|
function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc) {
|
97
60
|
var linkCiMap = (0, _keyBy["default"])(links, 'id');
|
98
61
|
return links.map(function (link) {
|
@@ -135,57 +98,59 @@ function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc) {
|
|
135
98
|
});
|
136
99
|
}
|
137
100
|
|
138
|
-
function getLinksDetail(
|
101
|
+
function getLinksDetail(_x, _x2) {
|
139
102
|
return _getLinksDetail.apply(this, arguments);
|
140
103
|
}
|
141
104
|
|
142
105
|
function _getLinksDetail() {
|
143
|
-
_getLinksDetail = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
106
|
+
_getLinksDetail = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(links, nodes) {
|
144
107
|
var linkCis, interfaceIds, interfaceTypes, interfaceCis, interfaceDoc;
|
145
|
-
return _regenerator["default"].wrap(function
|
108
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
146
109
|
while (1) {
|
147
|
-
switch (
|
110
|
+
switch (_context.prev = _context.next) {
|
148
111
|
case 0:
|
149
112
|
if (!(!links || !links.length)) {
|
150
|
-
|
113
|
+
_context.next = 2;
|
151
114
|
break;
|
152
115
|
}
|
153
116
|
|
154
|
-
return
|
117
|
+
return _context.abrupt("return", []);
|
155
118
|
|
156
119
|
case 2:
|
157
120
|
// const linkCis = await topoService.relation.batchQueryRelation(
|
158
121
|
// links.map((link) => link.id)
|
159
122
|
// );
|
160
123
|
linkCis = links;
|
161
|
-
interfaceIds = []
|
162
|
-
|
163
|
-
linkCis.
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
124
|
+
interfaceIds = [].concat(linkCis.map(function (item) {
|
125
|
+
return item.attributes.source_id;
|
126
|
+
}), linkCis.map(function (item) {
|
127
|
+
return item.attributes.destination_id;
|
128
|
+
}));
|
129
|
+
interfaceTypes = _lodash["default"].compact(_lodash["default"].uniq([].concat(linkCis.map(function (item) {
|
130
|
+
return item.attributes.source_type;
|
131
|
+
}), linkCis.map(function (item) {
|
132
|
+
return item.attributes.destination_type;
|
133
|
+
})))).filter(function (item) {
|
134
|
+
return item !== 'ip';
|
168
135
|
});
|
169
|
-
|
136
|
+
_context.next = 7;
|
170
137
|
return (0, _services.queryCisByIds)(interfaceIds);
|
171
138
|
|
172
|
-
case
|
173
|
-
interfaceCis =
|
174
|
-
|
175
|
-
return
|
176
|
-
return item !== 'ip';
|
177
|
-
}));
|
139
|
+
case 7:
|
140
|
+
interfaceCis = _context.sent;
|
141
|
+
_context.next = 10;
|
142
|
+
return _CiTypeCache["default"].getCiTypeMap(interfaceTypes);
|
178
143
|
|
179
|
-
case
|
180
|
-
interfaceDoc =
|
181
|
-
return
|
144
|
+
case 10:
|
145
|
+
interfaceDoc = _context.sent;
|
146
|
+
return _context.abrupt("return", mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc));
|
182
147
|
|
183
|
-
case
|
148
|
+
case 12:
|
184
149
|
case "end":
|
185
|
-
return
|
150
|
+
return _context.stop();
|
186
151
|
}
|
187
152
|
}
|
188
|
-
},
|
153
|
+
}, _callee);
|
189
154
|
}));
|
190
155
|
return _getLinksDetail.apply(this, arguments);
|
191
156
|
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
exports.__esModule = true;
|
6
|
+
exports["default"] = void 0;
|
7
|
+
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
9
|
+
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
11
|
+
|
12
|
+
var _componentTopologyUtils = require("@riil-frontend/component-topology-utils");
|
13
|
+
|
14
|
+
var _constants = require("./constants");
|
15
|
+
|
16
|
+
var _default = {
|
17
|
+
/**
|
18
|
+
* 保存拓扑绘制数据(第三方库内部结构,无需关心含义)
|
19
|
+
* @param {Number} id Topo ID
|
20
|
+
* @param {String} data ht拓扑序列化数据
|
21
|
+
* @returns
|
22
|
+
*/
|
23
|
+
saveSerializeData: function saveSerializeData(id, data) {
|
24
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
25
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
26
|
+
while (1) {
|
27
|
+
switch (_context.prev = _context.next) {
|
28
|
+
case 0:
|
29
|
+
_context.next = 2;
|
30
|
+
return _componentTopologyUtils.request.post(_constants.TOPO_API_ROOT + "/structure/" + id, {
|
31
|
+
data: data
|
32
|
+
});
|
33
|
+
|
34
|
+
case 2:
|
35
|
+
return _context.abrupt("return", _context.sent);
|
36
|
+
|
37
|
+
case 3:
|
38
|
+
case "end":
|
39
|
+
return _context.stop();
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}, _callee);
|
43
|
+
}))();
|
44
|
+
}
|
45
|
+
};
|
46
|
+
exports["default"] = _default;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
exports.__esModule = true;
|
6
|
+
exports["default"] = void 0;
|
7
|
+
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
|
+
|
10
|
+
var _topo = _interopRequireDefault(require("@riil-frontend/component-topology-common/es/services/topo"));
|
11
|
+
|
12
|
+
var _basic = _interopRequireDefault(require("./basic"));
|
13
|
+
|
14
|
+
var _default = (0, _extends2["default"])({}, _topo["default"], _basic["default"]);
|
15
|
+
|
16
|
+
exports["default"] = _default;
|
@@ -989,7 +989,8 @@ function ResourceOverview(props) {
|
|
989
989
|
ciAttrAndMetricData: ciAttrAndMetricData
|
990
990
|
},
|
991
991
|
data: metric,
|
992
|
-
loading: metricInitLoading
|
992
|
+
loading: metricInitLoading,
|
993
|
+
formatMetricLatestValue: resourceOverviewProps.formatMetricLatestValue
|
993
994
|
})), /*#__PURE__*/_react["default"].createElement(_EventsCard["default"], {
|
994
995
|
alarmRiskList: alarmRiskList,
|
995
996
|
closeDetailDrawer: onClose,
|
@@ -78,7 +78,8 @@ function ResourceOverviewMetric(props) {
|
|
78
78
|
var topo = props.topo,
|
79
79
|
type = props.type,
|
80
80
|
data = props.data,
|
81
|
-
loading = props.loading
|
81
|
+
loading = props.loading,
|
82
|
+
formatMetricLatestValue = props.formatMetricLatestValue;
|
82
83
|
|
83
84
|
function formatValue(itemData) {
|
84
85
|
var _list;
|
@@ -87,7 +88,8 @@ function ResourceOverviewMetric(props) {
|
|
87
88
|
metricItem = itemData.metricItem,
|
88
89
|
list = itemData.list;
|
89
90
|
var format = (0, _utils.metricValueFormat)({
|
90
|
-
|
91
|
+
// 支持业务拓扑历史时间点指标值处理
|
92
|
+
value: formatMetricLatestValue ? formatMetricLatestValue(list) : (_list = list[list.length - 1]) === null || _list === void 0 ? void 0 : _list.metricValue,
|
91
93
|
dataType: metricItem.dataType,
|
92
94
|
dict: topo.dictCache.getDictObject(),
|
93
95
|
unit: metricItem.unit,
|