@riil-frontend/component-topology 5.0.0-alpha.9 → 5.0.2
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 +20 -20
- package/es/common/components/ColorPicker/ColorPicker.js +5 -3
- package/es/components/BatchAttrMetric/setting.js +3 -5
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +2 -1
- package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +2 -1
- package/es/core/components/DisplaySettingDrawer/LinkTip.js +5 -1
- package/es/core/components/DisplaySettingDrawer/demo/Demo.js +63 -0
- package/es/core/components/ResourceViewAttributeSetting/Setting.js +9 -48
- package/es/core/components/TopoView/TopoView.module.scss +1 -1
- package/es/core/components/TopoView/topoView.js +31 -22
- package/es/core/editor/components/BackgroundView/index.js +74 -35
- package/es/core/editor/components/settings/common/LineType/index.js +7 -1
- package/es/core/editor/components/settings/common/text/FontStyleCheckbox.js +3 -3
- package/es/core/editor/components/settings/common/text/TextStyle.js +21 -6
- package/es/core/editor/components/settings/common/text/fontStyleUtil.js +0 -1
- package/es/core/editor/components/settings/propertyViews/box/BoxPropertyView.js +12 -1
- package/es/core/editor/components/settings/propertyViews/box/NameInput.js +9 -1
- package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +15 -1
- package/es/core/editor/components/settings/propertyViews/group/DataTab/GroupNodeList.js +2 -0
- package/es/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandSetting.js +9 -5
- package/es/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandStatus.js +10 -2
- package/es/core/editor/components/settings/propertyViews/group/SettingTab/Setting.js +12 -1
- package/es/core/editor/components/settings/propertyViews/layer/SettingTab/Setting.js +13 -3
- package/es/core/editor/components/settings/propertyViews/layer/SettingTab/Setting_bak.js +0 -1
- package/es/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeIcon.js +2 -0
- package/es/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeSize/BatchSetNodeSize.js +2 -0
- package/es/core/editor/components/settings/propertyViews/multipleElements/MultipleElementPropertyView.js +4 -1
- package/es/core/editor/components/settings/propertyViews/node/Setting/Setting.js +4 -0
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +34 -6
- package/es/core/editor/components/settings/propertyViews/text/TextPropertyView.js +9 -2
- package/es/core/editor/components/settings/propertyViews/view/BackgroundSize.js +30 -1
- package/es/core/editor/components/settings/propertyViews/view/GlobalLayout.js +2 -0
- package/es/core/editor/components/settings/propertyViews/view/GlobalNodeLabelStyle.js +15 -1
- package/es/core/editor/components/settings/propertyViews/view/hooks/useBackgroundSizeConfig.js +0 -1
- package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +4 -1
- package/es/core/editor/components/titlebar/widgets/DebugTools.js +29 -0
- package/es/core/hooks/useAlarm.js +18 -0
- package/es/core/hooks/useGraphAlarmDisplay.js +25 -3
- package/es/core/hooks/useResourceConfig.js +2 -1
- package/es/core/hooks/useRouterAdapter.js +7 -1
- package/es/core/hooks/useTopoEdit.js +220 -163
- package/es/core/models/AttributeMetricDisplay.js +31 -73
- package/es/core/models/HistoryManager.js +100 -50
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/cache/CiTypeCache.js +10 -44
- package/es/core/models/cache/DictCache.js +2 -1
- package/es/core/models/graph/Background.js +31 -14
- package/es/core/models/tagstips/ElementTagTipConfig.js +46 -12
- package/es/core/models/tagstips/utils.js +1 -1
- package/es/core/models/topoData.js +7 -3
- package/es/core/models/utils/linkUtils.js +18 -0
- package/es/core/store/models/topoAlarm.js +5 -1
- package/es/core/store/models/topoMod.js +6 -31
- package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +51 -249
- package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawer.js +218 -0
- package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailPlugin.js +2 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +1 -1
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfoBlock.js +0 -1
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +79 -43
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +2 -3
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +2 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +23 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.module.scss +11 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +34 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/constants.js +6 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +62 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +188 -0
- package/es/core/viewer/components/titlebar/BasicTools.js +1 -1
- package/es/core/viewer/components/titlebar/widgets/NodesDragSwitchWrapper.js +18 -0
- package/es/core/viewer/components/titlebar/widgets/SettingButton.js +11 -1
- package/es/networkTopo/components/TopoView.js +2 -1
- package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +164 -225
- package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/NetworkLinkForm.js +4 -0
- package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +161 -137
- package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/hooks/useAddLink.js +104 -0
- package/es/networkTopo/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +17 -7
- package/es/networkTopo/components/editor/propertyViews/edge/link/LinkInfoPreview.js +8 -9
- package/es/networkTopo/components/viewer/displaySetting/LinkAttrCustomSettingDrawer.js +59 -0
- package/es/networkTopo/components/viewer/displaySetting/LinkTagV2.js +10 -4
- package/es/networkTopo/getTopoData.js +11 -14
- package/es/networkTopo/hooks/editor/useDeleteEdges.js +11 -8
- package/es/networkTopo/hooks/viewer/useRelateTopo.js +1 -1
- package/es/networkTopo/models/LinkDynamicStyleExecutor.js +2 -0
- package/es/networkTopo/models/TopoCenter.js +1 -1
- package/es/networkTopo/services/index.js +6 -4
- package/es/networkTopo/services/link.js +2 -2
- package/es/networkTopo/store/topoCenter.js +5 -2
- package/es/networkTopo/store/topoTreeMod.js +84 -43
- package/es/networkTopo/utils/__tests__/resourcePermissionUtil.test.js +135 -0
- package/es/networkTopo/utils/resourcePermissionUtil.js +10 -6
- package/es/style.js +2 -1
- package/es/utils/ResourceConfigUtil.js +79 -39
- package/es/utils/clusterUtil.js +1 -1
- package/es/utils/htElementUtils.js +0 -1
- package/es/utils/topoData.js +24 -63
- package/es/utils/tree.js +1 -3
- package/lib/common/components/ColorPicker/ColorPicker.js +6 -3
- package/lib/components/BatchAttrMetric/setting.js +3 -6
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +4 -1
- package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +4 -1
- package/lib/core/components/DisplaySettingDrawer/LinkTip.js +6 -1
- package/lib/core/components/DisplaySettingDrawer/demo/Demo.js +71 -0
- package/lib/core/components/ResourceViewAttributeSetting/Setting.js +8 -48
- package/lib/core/components/TopoView/TopoView.module.scss +1 -1
- package/lib/core/components/TopoView/topoView.js +26 -17
- package/lib/core/editor/components/BackgroundView/index.js +75 -35
- package/lib/core/editor/components/settings/common/LineType/index.js +7 -1
- package/lib/core/editor/components/settings/common/text/FontStyleCheckbox.js +5 -4
- package/lib/core/editor/components/settings/common/text/TextStyle.js +23 -7
- package/lib/core/editor/components/settings/common/text/fontStyleUtil.js +0 -1
- package/lib/core/editor/components/settings/propertyViews/box/BoxPropertyView.js +13 -1
- package/lib/core/editor/components/settings/propertyViews/box/NameInput.js +9 -1
- package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +15 -1
- package/lib/core/editor/components/settings/propertyViews/group/DataTab/GroupNodeList.js +2 -0
- package/lib/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandSetting.js +9 -5
- package/lib/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandStatus.js +10 -2
- package/lib/core/editor/components/settings/propertyViews/group/SettingTab/Setting.js +12 -1
- package/lib/core/editor/components/settings/propertyViews/layer/SettingTab/Setting.js +17 -3
- package/lib/core/editor/components/settings/propertyViews/layer/SettingTab/Setting_bak.js +0 -1
- package/lib/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeIcon.js +2 -0
- package/lib/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeSize/BatchSetNodeSize.js +2 -0
- package/lib/core/editor/components/settings/propertyViews/multipleElements/MultipleElementPropertyView.js +4 -1
- package/lib/core/editor/components/settings/propertyViews/node/Setting/Setting.js +4 -0
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +36 -6
- package/lib/core/editor/components/settings/propertyViews/text/TextPropertyView.js +9 -2
- package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +32 -1
- package/lib/core/editor/components/settings/propertyViews/view/GlobalLayout.js +2 -0
- package/lib/core/editor/components/settings/propertyViews/view/GlobalNodeLabelStyle.js +15 -1
- package/lib/core/editor/components/settings/propertyViews/view/hooks/useBackgroundSizeConfig.js +0 -1
- package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +5 -1
- package/lib/core/editor/components/titlebar/widgets/DebugTools.js +38 -0
- package/lib/core/hooks/useAlarm.js +19 -0
- package/lib/core/hooks/useGraphAlarmDisplay.js +27 -3
- package/lib/core/hooks/useResourceConfig.js +2 -1
- package/lib/core/hooks/useRouterAdapter.js +8 -1
- package/lib/core/hooks/useTopoEdit.js +219 -162
- package/lib/core/models/AttributeMetricDisplay.js +31 -73
- package/lib/core/models/HistoryManager.js +105 -51
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/cache/CiTypeCache.js +12 -44
- package/lib/core/models/cache/DictCache.js +4 -1
- package/lib/core/models/graph/Background.js +36 -16
- package/lib/core/models/tagstips/ElementTagTipConfig.js +49 -12
- package/lib/core/models/tagstips/utils.js +1 -1
- package/lib/core/models/topoData.js +7 -3
- package/lib/core/models/utils/linkUtils.js +22 -0
- package/lib/core/store/models/topoAlarm.js +5 -1
- package/lib/core/store/models/topoMod.js +7 -32
- package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +51 -261
- package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawer.js +245 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailPlugin.js +2 -2
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +1 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfoBlock.js +0 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +79 -42
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +2 -3
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +2 -2
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +36 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.module.scss +11 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +45 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/constants.js +11 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +77 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +214 -0
- package/lib/core/viewer/components/titlebar/BasicTools.js +2 -2
- package/lib/core/viewer/components/titlebar/widgets/NodesDragSwitchWrapper.js +28 -0
- package/lib/core/viewer/components/titlebar/widgets/SettingButton.js +10 -0
- package/lib/networkTopo/components/TopoView.js +3 -2
- package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +160 -223
- package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/NetworkLinkForm.js +12 -0
- package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +161 -137
- package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/hooks/useAddLink.js +120 -0
- package/lib/networkTopo/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +19 -7
- package/lib/networkTopo/components/editor/propertyViews/edge/link/LinkInfoPreview.js +8 -9
- package/lib/networkTopo/components/viewer/displaySetting/LinkAttrCustomSettingDrawer.js +76 -0
- package/lib/networkTopo/components/viewer/displaySetting/LinkTagV2.js +10 -4
- package/lib/networkTopo/getTopoData.js +10 -13
- package/lib/networkTopo/hooks/editor/useDeleteEdges.js +11 -8
- package/lib/networkTopo/hooks/viewer/useRelateTopo.js +2 -1
- package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +2 -0
- package/lib/networkTopo/models/TopoCenter.js +2 -2
- package/lib/networkTopo/services/index.js +6 -4
- package/lib/networkTopo/services/link.js +2 -2
- package/lib/networkTopo/store/topoCenter.js +5 -2
- package/lib/networkTopo/store/topoTreeMod.js +84 -43
- package/lib/networkTopo/utils/__tests__/resourcePermissionUtil.test.js +137 -0
- package/lib/networkTopo/utils/resourcePermissionUtil.js +11 -6
- package/lib/style.js +2 -1
- package/lib/utils/ResourceConfigUtil.js +78 -37
- package/lib/utils/clusterUtil.js +1 -1
- package/lib/utils/htElementUtils.js +0 -1
- package/lib/utils/topoData.js +25 -64
- package/lib/utils/tree.js +1 -3
- package/package.json +3 -2
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports["default"] = useMetricPolling;
|
|
7
|
+
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _ahooks = require("ahooks");
|
|
13
|
+
|
|
14
|
+
var _services = require("../services");
|
|
15
|
+
|
|
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
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
// 资源节点上方色块展示资源的发送速率发送带宽利用率、接收速率发送接收利用率、总错包数
|
|
21
|
+
function useMetricPolling(_ref) {
|
|
22
|
+
var linkCi = _ref.linkCi,
|
|
23
|
+
linkMetricCodes = _ref.linkMetricCodes;
|
|
24
|
+
var linkId = linkCi.id;
|
|
25
|
+
|
|
26
|
+
var _useState = (0, _react.useState)({
|
|
27
|
+
sourceMetrics: null,
|
|
28
|
+
destinationMetrics: null,
|
|
29
|
+
// 链路指标列表
|
|
30
|
+
linkMetrics: []
|
|
31
|
+
}),
|
|
32
|
+
data = _useState[0],
|
|
33
|
+
setData = _useState[1]; // 轮询hooks
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
var queryLinkMetricsRequest = (0, _ahooks.useRequest)(_services.queryLinkLatestMetrics, {
|
|
37
|
+
pollingInterval: 1000 * 15,
|
|
38
|
+
pollingWhenHidden: false,
|
|
39
|
+
debounceInterval: 200,
|
|
40
|
+
manual: true,
|
|
41
|
+
onSuccess: function onSuccess(result) {
|
|
42
|
+
setData((0, _extends2["default"])({}, data, {
|
|
43
|
+
linkMetrics: result
|
|
44
|
+
}));
|
|
45
|
+
console.info('链路拓扑指标轮询', result);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
var queryInterfaceMetricsRequest = (0, _ahooks.useRequest)(_services.queryLinkInterfacesLatestMetrics, {
|
|
49
|
+
pollingInterval: 1000 * 15,
|
|
50
|
+
pollingWhenHidden: false,
|
|
51
|
+
debounceInterval: 200,
|
|
52
|
+
manual: true,
|
|
53
|
+
onSuccess: function onSuccess(result) {
|
|
54
|
+
setData((0, _extends2["default"])({}, data, result));
|
|
55
|
+
console.info('链路拓扑指标轮询 queryInterfaceMetricsRequest 结果', result);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
var linkMetricCodesStr = linkMetricCodes.map(function (item) {
|
|
59
|
+
return item;
|
|
60
|
+
}).sort().join(',');
|
|
61
|
+
(0, _react.useEffect)(function () {
|
|
62
|
+
console.info('链路拓扑指标轮询 切换', {
|
|
63
|
+
linkCi: linkCi,
|
|
64
|
+
linkMetricCodes: linkMetricCodes
|
|
65
|
+
});
|
|
66
|
+
queryLinkMetricsRequest.run(linkCi, linkMetricCodes);
|
|
67
|
+
return function () {};
|
|
68
|
+
}, [linkId, linkMetricCodesStr]);
|
|
69
|
+
(0, _react.useEffect)(function () {
|
|
70
|
+
console.info('链路拓扑指标轮询 queryInterfaceMetricsRequest 开始', {
|
|
71
|
+
linkCi: linkCi
|
|
72
|
+
});
|
|
73
|
+
queryInterfaceMetricsRequest.run(linkCi);
|
|
74
|
+
return function () {};
|
|
75
|
+
}, [linkId]);
|
|
76
|
+
return data;
|
|
77
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.queryAssetModel = queryAssetModel;
|
|
7
|
+
exports.queryLatestMetrics = queryLatestMetrics;
|
|
8
|
+
exports.queryLinkInterfacesLatestMetrics = queryLinkInterfacesLatestMetrics;
|
|
9
|
+
exports.queryLinkLatestMetrics = queryLinkLatestMetrics;
|
|
10
|
+
|
|
11
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
|
+
|
|
13
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
14
|
+
|
|
15
|
+
var _componentTopologyUtils = require("@riil-frontend/component-topology-utils");
|
|
16
|
+
|
|
17
|
+
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
|
|
18
|
+
|
|
19
|
+
var _attributeFormatter = require("../../../../../../../../../models/attributeFormatter");
|
|
20
|
+
|
|
21
|
+
var _CiTypeCache = _interopRequireDefault(require("../../../../../../../../../models/cache/CiTypeCache"));
|
|
22
|
+
|
|
23
|
+
var _constants = require("../constants");
|
|
24
|
+
|
|
25
|
+
function queryAssetModel(_x) {
|
|
26
|
+
return _queryAssetModel.apply(this, arguments);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function _queryAssetModel() {
|
|
30
|
+
_queryAssetModel = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(code) {
|
|
31
|
+
var result;
|
|
32
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
33
|
+
while (1) {
|
|
34
|
+
switch (_context.prev = _context.next) {
|
|
35
|
+
case 0:
|
|
36
|
+
_context.next = 2;
|
|
37
|
+
return _componentTopologyUtils.request.get("/mdc/v1/api/model-asset/" + code);
|
|
38
|
+
|
|
39
|
+
case 2:
|
|
40
|
+
result = _context.sent;
|
|
41
|
+
return _context.abrupt("return", result);
|
|
42
|
+
|
|
43
|
+
case 4:
|
|
44
|
+
case "end":
|
|
45
|
+
return _context.stop();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, _callee);
|
|
49
|
+
}));
|
|
50
|
+
return _queryAssetModel.apply(this, arguments);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function queryLatestMetrics(_x2) {
|
|
54
|
+
return _queryLatestMetrics.apply(this, arguments);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* 查询链路及两端接口指标数据
|
|
58
|
+
*
|
|
59
|
+
* @param {*} linkCi
|
|
60
|
+
* @param {*} linkMetricCodes
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
function _queryLatestMetrics() {
|
|
66
|
+
_queryLatestMetrics = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(params) {
|
|
67
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
68
|
+
while (1) {
|
|
69
|
+
switch (_context2.prev = _context2.next) {
|
|
70
|
+
case 0:
|
|
71
|
+
return _context2.abrupt("return", _componentTopologyUtils.request.post('/mdc/v1/api/cmdb/metric/queryLatestMetrics', params));
|
|
72
|
+
|
|
73
|
+
case 1:
|
|
74
|
+
case "end":
|
|
75
|
+
return _context2.stop();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}, _callee2);
|
|
79
|
+
}));
|
|
80
|
+
return _queryLatestMetrics.apply(this, arguments);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function queryLinkLatestMetrics(_x3, _x4) {
|
|
84
|
+
return _queryLinkLatestMetrics.apply(this, arguments);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function _queryLinkLatestMetrics() {
|
|
88
|
+
_queryLinkLatestMetrics = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(linkCi, linkMetricCodes) {
|
|
89
|
+
var linkMetrics, resultData;
|
|
90
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
91
|
+
while (1) {
|
|
92
|
+
switch (_context3.prev = _context3.next) {
|
|
93
|
+
case 0:
|
|
94
|
+
_rlog["default"].debug('链路拓扑指标轮询 queryLinkLatestMetrics', linkCi, linkMetricCodes);
|
|
95
|
+
|
|
96
|
+
if (linkMetricCodes.length) {
|
|
97
|
+
_context3.next = 3;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return _context3.abrupt("return", []);
|
|
102
|
+
|
|
103
|
+
case 3:
|
|
104
|
+
_context3.next = 5;
|
|
105
|
+
return queryLatestMetrics({
|
|
106
|
+
ciId: [linkCi.id],
|
|
107
|
+
'metricCode': linkMetricCodes
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
case 5:
|
|
111
|
+
linkMetrics = _context3.sent;
|
|
112
|
+
// format
|
|
113
|
+
resultData = linkMetricCodes.map(function (code) {
|
|
114
|
+
var _linkMetrics$find;
|
|
115
|
+
|
|
116
|
+
var value = (_linkMetrics$find = linkMetrics.find(function (m) {
|
|
117
|
+
return m.metricCode === code;
|
|
118
|
+
})) === null || _linkMetrics$find === void 0 ? void 0 : _linkMetrics$find.metricValue;
|
|
119
|
+
|
|
120
|
+
var metricDef = _CiTypeCache["default"].getMetric(linkCi.ciType, code);
|
|
121
|
+
|
|
122
|
+
return {
|
|
123
|
+
code: code,
|
|
124
|
+
name: metricDef.name,
|
|
125
|
+
value: (0, _attributeFormatter.formatMetric)(value, metricDef) || ''
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
return _context3.abrupt("return", resultData);
|
|
129
|
+
|
|
130
|
+
case 8:
|
|
131
|
+
case "end":
|
|
132
|
+
return _context3.stop();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}, _callee3);
|
|
136
|
+
}));
|
|
137
|
+
return _queryLinkLatestMetrics.apply(this, arguments);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function queryLinkInterfacesLatestMetrics(_x5) {
|
|
141
|
+
return _queryLinkInterfacesLatestMetrics.apply(this, arguments);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function _queryLinkInterfacesLatestMetrics() {
|
|
145
|
+
_queryLinkInterfacesLatestMetrics = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(linkCi) {
|
|
146
|
+
var _linkCi$attributes, sourceType, sourceId, destinationId, destinationType, typeCodes, queryInterfaceMetricsParam, interfaceMetrics, resultData, parseInterfaceMetrics;
|
|
147
|
+
|
|
148
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
149
|
+
while (1) {
|
|
150
|
+
switch (_context4.prev = _context4.next) {
|
|
151
|
+
case 0:
|
|
152
|
+
parseInterfaceMetrics = function _parseInterfaceMetric(subCiId) {
|
|
153
|
+
var metrics = interfaceMetrics.filter(function (metric) {
|
|
154
|
+
return metric.subCiId === subCiId;
|
|
155
|
+
});
|
|
156
|
+
return _constants.INTERFACE_METRIC_CODES.reduce(function (res, code) {
|
|
157
|
+
var _metrics$find;
|
|
158
|
+
|
|
159
|
+
var value = (_metrics$find = metrics.find(function (m) {
|
|
160
|
+
return m.metricCode === code;
|
|
161
|
+
})) === null || _metrics$find === void 0 ? void 0 : _metrics$find.metricValue;
|
|
162
|
+
|
|
163
|
+
var metricDef = _CiTypeCache["default"].getMetric(linkCi.ciType, code);
|
|
164
|
+
|
|
165
|
+
var formatValue = (0, _attributeFormatter.formatMetric)(value, metricDef);
|
|
166
|
+
res[code] = formatValue === 'undefined' ? '-' : formatValue;
|
|
167
|
+
return res;
|
|
168
|
+
}, {});
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
_linkCi$attributes = linkCi.attributes, sourceType = _linkCi$attributes.source_type, sourceId = _linkCi$attributes.source_id, destinationId = _linkCi$attributes.destination_id, destinationType = _linkCi$attributes.destination_type;
|
|
172
|
+
|
|
173
|
+
_rlog["default"].debug('查询链路接口指标', linkCi); // 查询指标模型
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
typeCodes = [sourceType];
|
|
177
|
+
queryInterfaceMetricsParam = {
|
|
178
|
+
'subCiId': [sourceId],
|
|
179
|
+
'metricCode': [].concat(_constants.INTERFACE_METRIC_CODES)
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
if (destinationId) {
|
|
183
|
+
queryInterfaceMetricsParam.subCiId.push(destinationId);
|
|
184
|
+
typeCodes.push(destinationType);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
_context4.next = 8;
|
|
188
|
+
return _CiTypeCache["default"].load(typeCodes);
|
|
189
|
+
|
|
190
|
+
case 8:
|
|
191
|
+
_context4.next = 10;
|
|
192
|
+
return queryLatestMetrics(queryInterfaceMetricsParam);
|
|
193
|
+
|
|
194
|
+
case 10:
|
|
195
|
+
interfaceMetrics = _context4.sent;
|
|
196
|
+
// format
|
|
197
|
+
resultData = {
|
|
198
|
+
sourceMetrics: parseInterfaceMetrics(sourceId),
|
|
199
|
+
destinationMetrics: destinationId ? parseInterfaceMetrics(destinationId) : null
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
_rlog["default"].debug('查询链路接口指标 结果', linkCi);
|
|
203
|
+
|
|
204
|
+
return _context4.abrupt("return", resultData);
|
|
205
|
+
|
|
206
|
+
case 14:
|
|
207
|
+
case "end":
|
|
208
|
+
return _context4.stop();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}, _callee4);
|
|
212
|
+
}));
|
|
213
|
+
return _queryLinkInterfacesLatestMetrics.apply(this, arguments);
|
|
214
|
+
}
|
|
@@ -13,7 +13,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
13
13
|
|
|
14
14
|
var _EditButton = _interopRequireDefault(require("./widgets/EditButton"));
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _NodesDragSwitchWrapper = _interopRequireDefault(require("./widgets/NodesDragSwitchWrapper"));
|
|
17
17
|
|
|
18
18
|
var _AlarmListShowButton = _interopRequireDefault(require("./widgets/AlarmListShowButton"));
|
|
19
19
|
|
|
@@ -45,7 +45,7 @@ function BasicTools(props) {
|
|
|
45
45
|
}, props, {
|
|
46
46
|
alarmPanelIsOpen: alarmPanelIsOpen,
|
|
47
47
|
alarmData: alarmData
|
|
48
|
-
})), /*#__PURE__*/_react["default"].createElement(_SettingButtonWidget["default"], props), /*#__PURE__*/_react["default"].createElement(
|
|
48
|
+
})), /*#__PURE__*/_react["default"].createElement(_SettingButtonWidget["default"], props), /*#__PURE__*/_react["default"].createElement(_NodesDragSwitchWrapper["default"], (0, _extends2["default"])({
|
|
49
49
|
topo: topo
|
|
50
50
|
}, props)), children);
|
|
51
51
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports["default"] = NodesDragSwitchWrapper;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _NodesDragSwitch = _interopRequireDefault(require("./NodesDragSwitch"));
|
|
11
|
+
|
|
12
|
+
var _topoPermissionUtil = _interopRequireDefault(require("../../../../../utils/topoPermissionUtil"));
|
|
13
|
+
|
|
14
|
+
function NodesDragSwitchWrapper(props) {
|
|
15
|
+
var topo = props.topo;
|
|
16
|
+
var store = topo.store;
|
|
17
|
+
|
|
18
|
+
var _store$useModel = store.useModel('topoMod'),
|
|
19
|
+
topoState = _store$useModel[0];
|
|
20
|
+
|
|
21
|
+
var topoPermission = topoState.topoPermission;
|
|
22
|
+
|
|
23
|
+
if (!_topoPermissionUtil["default"].isEditable(topoPermission)) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return /*#__PURE__*/_react["default"].createElement(_NodesDragSwitch["default"], props);
|
|
28
|
+
}
|
|
@@ -31,10 +31,20 @@ function SettingButton(props) {
|
|
|
31
31
|
visible = _useState[0],
|
|
32
32
|
setVisible = _useState[1];
|
|
33
33
|
|
|
34
|
+
var topoModState = topo.store.useModelState('topoMod');
|
|
35
|
+
var graphLoaded = topoModState.graphLoaded;
|
|
36
|
+
|
|
34
37
|
var changeClick = function changeClick() {
|
|
35
38
|
setVisible(true);
|
|
36
39
|
};
|
|
37
40
|
|
|
41
|
+
(0, _react.useEffect)(function () {
|
|
42
|
+
if (graphLoaded) {
|
|
43
|
+
var _topo$viewProps$urlPa;
|
|
44
|
+
|
|
45
|
+
setVisible(!!((_topo$viewProps$urlPa = topo.viewProps.urlParams) !== null && _topo$viewProps$urlPa !== void 0 && _topo$viewProps$urlPa.showSetting));
|
|
46
|
+
}
|
|
47
|
+
}, [graphLoaded]);
|
|
38
48
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
39
49
|
style: style,
|
|
40
50
|
onClick: changeClick,
|
|
@@ -33,12 +33,12 @@ var _useLinkDynamicStyle = _interopRequireDefault(require("../hooks/useLinkDynam
|
|
|
33
33
|
|
|
34
34
|
var _useRelateTopo = _interopRequireDefault(require("../hooks/viewer/useRelateTopo"));
|
|
35
35
|
|
|
36
|
-
var _LinkTip = _interopRequireDefault(require("../../core/components/DisplaySettingDrawer/LinkTip"));
|
|
37
|
-
|
|
38
36
|
var _ViewerTools = _interopRequireDefault(require("./viewer/titlebar/ViewerTools"));
|
|
39
37
|
|
|
40
38
|
var _useEdgeFlow = _interopRequireDefault(require("../hooks/viewer/useEdgeFlow"));
|
|
41
39
|
|
|
40
|
+
var _LinkTip = _interopRequireDefault(require("../../core/components/DisplaySettingDrawer/LinkTip"));
|
|
41
|
+
|
|
42
42
|
var _LinkTagV = _interopRequireDefault(require("./viewer/displaySetting/LinkTagV2"));
|
|
43
43
|
|
|
44
44
|
var _useEdgeExpand = _interopRequireDefault(require("../hooks/useEdgeExpand"));
|
|
@@ -210,5 +210,6 @@ function NetworkTopologyCore(props) {
|
|
|
210
210
|
}, renderContent()));
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
NetworkTopologyCore.displayName = 'NetworkTopologyCore';
|
|
213
214
|
var _default = NetworkTopologyCore;
|
|
214
215
|
exports["default"] = _default;
|