@riil-frontend/component-topology 11.0.33 → 11.0.35
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 +4 -2
- package/build/index.js +52 -45
- package/es/components/MultiResourceDrawer/index.js +22 -26
- package/es/components/ResourceList/ResourceSelect.js +55 -58
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +30 -34
- package/es/components/SingleResourceDrawer/SelectDrawer.js +24 -28
- package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +29 -33
- package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +92 -108
- package/es/core/components/titlebar/widgets/TitleWidget.js +5 -3
- package/es/core/editor/components/BackgroundView/UploadDialog/index.js +17 -18
- package/es/core/editor/components/BackgroundView/index.js +149 -178
- package/es/core/editor/components/BackgroundView/index.module.scss +2 -1
- package/es/core/editor/components/CustomIconPlugin/RenameDialog.js +26 -30
- package/es/core/editor/components/CustomIconPlugin/UploadIconDialog.js +33 -34
- package/es/core/editor/components/CustomIconPlugin/utils/svgToShape.js +20 -24
- package/es/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +13 -17
- package/es/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +45 -56
- package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +60 -70
- package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +60 -70
- package/es/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +17 -21
- package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +27 -31
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +21 -25
- package/es/core/editor/components/settings/propertyViews/view/BackgroundSize.js +16 -20
- package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +37 -55
- package/es/core/editor/hooks/useKeyboardShortcut.js +2 -2
- package/es/core/editor/hooks/useNewElementTheme.js +2 -2
- package/es/core/editor/store/background.js +8 -10
- package/es/core/editor/store/topoEdit.js +4 -6
- package/es/core/editor/utils/edgeTypeStyleUtil.js +2 -4
- package/es/core/hooks/usePolling.js +130 -142
- package/es/core/hooks/useResourceConfig.js +76 -100
- package/es/core/hooks/useTopoEdit.js +525 -623
- package/es/core/models/Alarm.js +319 -402
- package/es/core/models/AttributeMetricDisplay.js +115 -143
- package/es/core/models/PluginManager.js +4 -3
- package/es/core/models/SelectionModel.js +4 -5
- package/es/core/models/TopoApp.js +279 -436
- package/es/core/models/TopoGraphView.js +28 -41
- package/es/core/models/cache/CiCache.js +34 -39
- package/es/core/models/cache/CiTypeCache.js +47 -61
- package/es/core/models/cache/DictCache.js +36 -42
- package/es/core/models/graph/Background.js +21 -26
- package/es/core/models/plugins/resourceWebControllUrl.js +84 -103
- package/es/core/models/tagstips/ElementTagTipConfig.js +44 -58
- package/es/core/models/topoData.js +73 -77
- package/es/core/models/utils/linkUtils.js +46 -51
- package/es/core/models/utils/nodeNameVisibleUtil.js +4 -4
- package/es/core/services/alarm.js +14 -16
- package/es/core/services/background.js +59 -67
- package/es/core/services/cmdb/metric.js +14 -18
- package/es/core/services/cmdb.js +23 -27
- package/es/core/services/index.js +48 -68
- package/es/core/services/overview.js +131 -151
- package/es/core/services/topo/basic.js +37 -41
- package/es/core/services/topo/tagtip.js +15 -19
- package/es/core/store/models/ciModel.js +58 -62
- package/es/core/store/models/customIcon.js +126 -145
- package/es/core/store/models/displayConfig.js +15 -19
- package/es/core/store/models/selection.js +4 -6
- package/es/core/store/models/topoAlarm.js +162 -145
- package/es/core/store/models/topoBaseInfoOverview.js +4 -6
- package/es/core/store/models/topoBizMod.js +9 -11
- package/es/core/store/models/topoConfig.js +215 -231
- package/es/core/store/models/topoGraphView.js +4 -6
- package/es/core/store/models/topoMod.js +373 -395
- package/es/core/utils/imageUtil.js +23 -27
- package/es/core/utils/saveSerialize.js +14 -18
- package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +62 -66
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +20 -25
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +363 -409
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +112 -131
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +40 -46
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +219 -275
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +113 -118
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +63 -68
- package/es/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +45 -54
- package/es/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +32 -44
- package/es/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +36 -43
- package/es/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +23 -27
- package/es/networkTopo/components/Link/hook.js +85 -96
- package/es/networkTopo/components/Link/index.js +104 -126
- package/es/networkTopo/components/Link/setting.js +48 -52
- package/es/networkTopo/getTopoData.js +73 -92
- package/es/networkTopo/hooks/viewer/useRelateTopo.js +34 -39
- package/es/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
- package/es/networkTopo/models/TopoCenter.js +28 -46
- package/es/networkTopo/services/alert.js +18 -22
- package/es/networkTopo/services/authorization.js +45 -55
- package/es/networkTopo/services/cmdb.js +548 -696
- package/es/networkTopo/services/funcAuth.js +22 -24
- package/es/networkTopo/services/link.js +107 -117
- package/es/networkTopo/services/mdc.js +33 -48
- package/es/networkTopo/services/metric.js +38 -47
- package/es/networkTopo/services/model.js +616 -809
- package/es/networkTopo/services/risk.js +9 -11
- package/es/networkTopo/services/topo/auth.js +27 -33
- package/es/networkTopo/services/topo/basic.js +251 -289
- package/es/networkTopo/services/topo/blacklist.js +20 -24
- package/es/networkTopo/services/topo/ciInfo.js +27 -31
- package/es/networkTopo/services/topo/icon.js +49 -59
- package/es/networkTopo/services/topo/networkLink.js +32 -36
- package/es/networkTopo/services/topo/relation.js +9 -11
- package/es/networkTopo/services/topo/resourceWebUrl.js +36 -42
- package/es/networkTopo/store/functionAuth.js +31 -37
- package/es/networkTopo/store/topoCenter.js +142 -152
- package/es/networkTopo/store/topoLinkMod.js +4 -6
- package/es/networkTopo/store/topoTreeMod.js +170 -182
- package/es/networkTopo/utils/exportData.js +57 -61
- package/lib/components/MultiResourceDrawer/index.js +22 -26
- package/lib/components/ResourceList/ResourceSelect.js +54 -58
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +33 -37
- package/lib/components/SingleResourceDrawer/SelectDrawer.js +24 -28
- package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +36 -40
- package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +92 -108
- package/lib/core/components/titlebar/widgets/TitleWidget.js +5 -3
- package/lib/core/editor/components/BackgroundView/UploadDialog/index.js +18 -18
- package/lib/core/editor/components/BackgroundView/index.js +148 -177
- package/lib/core/editor/components/BackgroundView/index.module.scss +2 -1
- package/lib/core/editor/components/CustomIconPlugin/RenameDialog.js +28 -32
- package/lib/core/editor/components/CustomIconPlugin/UploadIconDialog.js +34 -34
- package/lib/core/editor/components/CustomIconPlugin/utils/svgToShape.js +23 -28
- package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +14 -18
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +45 -56
- package/lib/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +60 -70
- package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +60 -70
- package/lib/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +18 -22
- package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +32 -36
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +21 -25
- package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +18 -22
- package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +41 -59
- package/lib/core/editor/hooks/useKeyboardShortcut.js +2 -2
- package/lib/core/editor/hooks/useNewElementTheme.js +2 -2
- package/lib/core/editor/store/background.js +8 -10
- package/lib/core/editor/store/topoEdit.js +4 -6
- package/lib/core/editor/utils/edgeTypeStyleUtil.js +2 -4
- package/lib/core/hooks/usePolling.js +129 -141
- package/lib/core/hooks/useResourceConfig.js +76 -100
- package/lib/core/hooks/useTopoEdit.js +517 -615
- package/lib/core/models/Alarm.js +313 -396
- package/lib/core/models/AttributeMetricDisplay.js +118 -146
- package/lib/core/models/PluginManager.js +4 -3
- package/lib/core/models/SelectionModel.js +4 -5
- package/lib/core/models/TopoApp.js +279 -436
- package/lib/core/models/TopoGraphView.js +28 -41
- package/lib/core/models/cache/CiCache.js +39 -44
- package/lib/core/models/cache/CiTypeCache.js +48 -62
- package/lib/core/models/cache/DictCache.js +39 -45
- package/lib/core/models/graph/Background.js +22 -27
- package/lib/core/models/plugins/resourceWebControllUrl.js +82 -101
- package/lib/core/models/tagstips/ElementTagTipConfig.js +44 -58
- package/lib/core/models/topoData.js +73 -78
- package/lib/core/models/utils/linkUtils.js +45 -51
- package/lib/core/models/utils/nodeNameVisibleUtil.js +4 -4
- package/lib/core/services/alarm.js +18 -20
- package/lib/core/services/background.js +70 -78
- package/lib/core/services/cmdb/metric.js +14 -19
- package/lib/core/services/cmdb.js +24 -29
- package/lib/core/services/index.js +53 -72
- package/lib/core/services/overview.js +131 -151
- package/lib/core/services/topo/basic.js +37 -41
- package/lib/core/services/topo/tagtip.js +16 -21
- package/lib/core/store/models/ciModel.js +66 -70
- package/lib/core/store/models/customIcon.js +126 -145
- package/lib/core/store/models/displayConfig.js +15 -19
- package/lib/core/store/models/selection.js +4 -6
- package/lib/core/store/models/topoAlarm.js +163 -145
- package/lib/core/store/models/topoBaseInfoOverview.js +4 -6
- package/lib/core/store/models/topoBizMod.js +9 -11
- package/lib/core/store/models/topoConfig.js +222 -238
- package/lib/core/store/models/topoGraphView.js +4 -6
- package/lib/core/store/models/topoMod.js +375 -397
- package/lib/core/utils/imageUtil.js +26 -31
- package/lib/core/utils/saveSerialize.js +13 -18
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +62 -66
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +21 -26
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +364 -410
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +114 -133
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +44 -50
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +220 -274
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +113 -118
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +63 -68
- package/lib/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +40 -50
- package/lib/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +35 -47
- package/lib/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +36 -43
- package/lib/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +24 -28
- package/lib/networkTopo/components/Link/hook.js +86 -98
- package/lib/networkTopo/components/Link/index.js +105 -127
- package/lib/networkTopo/components/Link/setting.js +48 -52
- package/lib/networkTopo/getTopoData.js +73 -92
- package/lib/networkTopo/hooks/viewer/useRelateTopo.js +35 -40
- package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
- package/lib/networkTopo/models/TopoCenter.js +28 -46
- package/lib/networkTopo/services/alert.js +18 -22
- package/lib/networkTopo/services/authorization.js +55 -65
- package/lib/networkTopo/services/cmdb.js +551 -700
- package/lib/networkTopo/services/funcAuth.js +24 -26
- package/lib/networkTopo/services/link.js +108 -118
- package/lib/networkTopo/services/mdc.js +35 -51
- package/lib/networkTopo/services/metric.js +37 -47
- package/lib/networkTopo/services/model.js +615 -809
- package/lib/networkTopo/services/risk.js +11 -13
- package/lib/networkTopo/services/topo/auth.js +27 -33
- package/lib/networkTopo/services/topo/basic.js +252 -290
- package/lib/networkTopo/services/topo/blacklist.js +20 -24
- package/lib/networkTopo/services/topo/ciInfo.js +34 -38
- package/lib/networkTopo/services/topo/icon.js +59 -69
- package/lib/networkTopo/services/topo/networkLink.js +32 -36
- package/lib/networkTopo/services/topo/relation.js +11 -13
- package/lib/networkTopo/services/topo/resourceWebUrl.js +44 -50
- package/lib/networkTopo/store/functionAuth.js +31 -37
- package/lib/networkTopo/store/topoCenter.js +142 -152
- package/lib/networkTopo/store/topoLinkMod.js +4 -6
- package/lib/networkTopo/store/topoTreeMod.js +166 -178
- package/lib/networkTopo/utils/exportData.js +63 -68
- package/package.json +4 -3
@@ -4,57 +4,50 @@ import React, { useState } from 'react';
|
|
4
4
|
import service from "../../../../../services/overview";
|
5
5
|
|
6
6
|
function useUserId(props) {
|
7
|
+
var _fetchUserId;
|
8
|
+
|
7
9
|
var _useState = useState(''),
|
8
10
|
userId = _useState[0],
|
9
11
|
setUserId = _useState[1];
|
10
12
|
|
11
13
|
function fetchUserId() {
|
12
|
-
return _fetchUserId.
|
13
|
-
}
|
14
|
-
|
15
|
-
function _fetchUserId() {
|
16
|
-
_fetchUserId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
14
|
+
return (_fetchUserId = _fetchUserId || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
17
15
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
18
|
-
while (1) {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
case 1:
|
51
|
-
case "end":
|
52
|
-
return _context2.stop();
|
53
|
-
}
|
16
|
+
while (1) switch (_context2.prev = _context2.next) {
|
17
|
+
case 0:
|
18
|
+
setUserId(function (prev) {
|
19
|
+
// console.log('获取用户id', prev);
|
20
|
+
// 如果已经获取过,就不再重新获取
|
21
|
+
if (!prev) {
|
22
|
+
_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
23
|
+
var res;
|
24
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
25
|
+
while (1) switch (_context.prev = _context.next) {
|
26
|
+
case 0:
|
27
|
+
_context.next = 2;
|
28
|
+
return service.getUserId();
|
29
|
+
|
30
|
+
case 2:
|
31
|
+
res = _context.sent;
|
32
|
+
setUserId((res === null || res === void 0 ? void 0 : res.user_id) || '');
|
33
|
+
|
34
|
+
case 4:
|
35
|
+
case "end":
|
36
|
+
return _context.stop();
|
37
|
+
}
|
38
|
+
}, _callee);
|
39
|
+
}))();
|
40
|
+
}
|
41
|
+
|
42
|
+
return prev;
|
43
|
+
});
|
44
|
+
|
45
|
+
case 1:
|
46
|
+
case "end":
|
47
|
+
return _context2.stop();
|
54
48
|
}
|
55
49
|
}, _callee2);
|
56
|
-
}));
|
57
|
-
return _fetchUserId.apply(this, arguments);
|
50
|
+
}))).apply(this, arguments);
|
58
51
|
}
|
59
52
|
|
60
53
|
return {
|
@@ -9,6 +9,8 @@ import React, { useEffect } from 'react';
|
|
9
9
|
import styles from "./ResourceWebControllUrlSettingDialog.module.scss";
|
10
10
|
var FormItem = _Form.Item;
|
11
11
|
export default function ResourceWebControllUrlSettingDialog(props) {
|
12
|
+
var _ref;
|
13
|
+
|
12
14
|
var topo = props.topo;
|
13
15
|
var store = topo.store;
|
14
16
|
var resourceWebControllUrl = topo.pluginManager.pluginMap.resourceWebControllUrl;
|
@@ -33,42 +35,36 @@ export default function ResourceWebControllUrlSettingDialog(props) {
|
|
33
35
|
});
|
34
36
|
}, [url]);
|
35
37
|
|
36
|
-
var submit =
|
37
|
-
|
38
|
+
var submit = function submit() {
|
39
|
+
return (_ref = _ref || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
38
40
|
var _yield$field$validate, errors, values;
|
39
41
|
|
40
42
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
41
|
-
while (1) {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
return field.validatePromise();
|
46
|
-
|
47
|
-
case 2:
|
48
|
-
_yield$field$validate = _context.sent;
|
49
|
-
errors = _yield$field$validate.errors;
|
50
|
-
values = _yield$field$validate.values;
|
43
|
+
while (1) switch (_context.prev = _context.next) {
|
44
|
+
case 0:
|
45
|
+
_context.next = 2;
|
46
|
+
return field.validatePromise();
|
51
47
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
48
|
+
case 2:
|
49
|
+
_yield$field$validate = _context.sent;
|
50
|
+
errors = _yield$field$validate.errors;
|
51
|
+
values = _yield$field$validate.values;
|
56
52
|
|
53
|
+
if (errors) {
|
57
54
|
_context.next = 8;
|
58
|
-
|
55
|
+
break;
|
56
|
+
}
|
59
57
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
58
|
+
_context.next = 8;
|
59
|
+
return resourceWebControllUrl.setting.saveResourceWebUrl(resourceWebControllUrl.setting.getCurrentId(), values.url);
|
60
|
+
|
61
|
+
case 8:
|
62
|
+
case "end":
|
63
|
+
return _context.stop();
|
64
64
|
}
|
65
65
|
}, _callee);
|
66
|
-
}));
|
67
|
-
|
68
|
-
return function submit() {
|
69
|
-
return _ref.apply(this, arguments);
|
70
|
-
};
|
71
|
-
}();
|
66
|
+
}))).apply(this, arguments);
|
67
|
+
};
|
72
68
|
|
73
69
|
var renameIconForm = /*#__PURE__*/React.createElement(_Form, {
|
74
70
|
field: field,
|
@@ -2,6 +2,9 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
3
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
4
4
|
var _excluded = ["run"];
|
5
|
+
|
6
|
+
var _updateLink, _saveLink;
|
7
|
+
|
5
8
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
6
9
|
import { useEffect, useState } from 'react';
|
7
10
|
import { useRequest } from 'ahooks';
|
@@ -87,79 +90,104 @@ function buildCreateLinkParams(params, discoveryId) {
|
|
87
90
|
|
88
91
|
|
89
92
|
function updateLink(_x, _x2) {
|
90
|
-
return _updateLink.
|
91
|
-
}
|
92
|
-
|
93
|
-
function _updateLink() {
|
94
|
-
_updateLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(oldLink, params) {
|
93
|
+
return (_updateLink = _updateLink || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(oldLink, params) {
|
95
94
|
var result, src, dst, srcRelation, dstRelation, srcIsCurrentRelation, dstIsCurrentRelation, onlyChangeOneEnd, createResult;
|
96
95
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
97
|
-
while (1) {
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
if (!onlyChangeOneEnd) {
|
120
|
-
_context.next = 14;
|
121
|
-
break;
|
122
|
-
}
|
123
|
-
|
96
|
+
while (1) switch (_context.prev = _context.next) {
|
97
|
+
case 0:
|
98
|
+
result = {
|
99
|
+
oldId: oldLink.id
|
100
|
+
};
|
101
|
+
src = params.src, dst = params.dst; // 如果只修改一端,则先删除再新建
|
102
|
+
|
103
|
+
_context.next = 4;
|
104
|
+
return cmdbService.queryRelationByEndpoint(src.sub);
|
105
|
+
|
106
|
+
case 4:
|
107
|
+
srcRelation = _context.sent;
|
108
|
+
_context.next = 7;
|
109
|
+
return cmdbService.queryRelationByEndpoint(dst.sub);
|
110
|
+
|
111
|
+
case 7:
|
112
|
+
dstRelation = _context.sent;
|
113
|
+
srcIsCurrentRelation = srcRelation && srcRelation.id === oldLink.id && !dstRelation;
|
114
|
+
dstIsCurrentRelation = dstRelation && dstRelation.id === oldLink.id && !srcRelation;
|
115
|
+
onlyChangeOneEnd = srcIsCurrentRelation || dstIsCurrentRelation;
|
116
|
+
|
117
|
+
if (!onlyChangeOneEnd) {
|
124
118
|
_context.next = 14;
|
125
|
-
|
119
|
+
break;
|
120
|
+
}
|
126
121
|
|
127
|
-
|
128
|
-
|
129
|
-
return cmdbService.batchCreateRelation([buildCreateLinkParams(params, 0)]);
|
122
|
+
_context.next = 14;
|
123
|
+
return cmdbService.forceDeleteRelation(oldLink.id);
|
130
124
|
|
131
|
-
|
132
|
-
|
133
|
-
|
125
|
+
case 14:
|
126
|
+
_context.next = 16;
|
127
|
+
return cmdbService.batchCreateRelation([buildCreateLinkParams(params, 0)]);
|
134
128
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
}
|
129
|
+
case 16:
|
130
|
+
createResult = _context.sent;
|
131
|
+
Object.assign(result, createResult[0]);
|
139
132
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
133
|
+
if (!(result.status === 0)) {
|
134
|
+
_context.next = 22;
|
135
|
+
break;
|
136
|
+
}
|
144
137
|
|
138
|
+
if (onlyChangeOneEnd) {
|
145
139
|
_context.next = 22;
|
146
|
-
|
140
|
+
break;
|
141
|
+
}
|
142
|
+
|
143
|
+
_context.next = 22;
|
144
|
+
return cmdbService.forceDeleteRelation(oldLink.id);
|
147
145
|
|
148
|
-
|
149
|
-
|
146
|
+
case 22:
|
147
|
+
return _context.abrupt("return", result);
|
150
148
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
}
|
149
|
+
case 23:
|
150
|
+
case "end":
|
151
|
+
return _context.stop();
|
155
152
|
}
|
156
153
|
}, _callee);
|
157
|
-
}));
|
158
|
-
return _updateLink.apply(this, arguments);
|
154
|
+
}))).apply(this, arguments);
|
159
155
|
}
|
160
156
|
|
161
157
|
function saveLink(_x3) {
|
162
|
-
return _saveLink.
|
158
|
+
return (_saveLink = _saveLink || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
|
159
|
+
var link, values, params, result, _params;
|
160
|
+
|
161
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
162
|
+
while (1) switch (_context2.prev = _context2.next) {
|
163
|
+
case 0:
|
164
|
+
link = _ref2.link, values = _ref2.values;
|
165
|
+
|
166
|
+
if (!link) {
|
167
|
+
_context2.next = 9;
|
168
|
+
break;
|
169
|
+
}
|
170
|
+
|
171
|
+
params = values[0];
|
172
|
+
_context2.next = 5;
|
173
|
+
return updateLink(link, params);
|
174
|
+
|
175
|
+
case 5:
|
176
|
+
result = _context2.sent;
|
177
|
+
return _context2.abrupt("return", [result]);
|
178
|
+
|
179
|
+
case 9:
|
180
|
+
_params = values.map(function (item, index) {
|
181
|
+
return buildCreateLinkParams(item, index);
|
182
|
+
});
|
183
|
+
return _context2.abrupt("return", cmdbService.batchCreateRelation(_params));
|
184
|
+
|
185
|
+
case 11:
|
186
|
+
case "end":
|
187
|
+
return _context2.stop();
|
188
|
+
}
|
189
|
+
}, _callee2);
|
190
|
+
}))).apply(this, arguments);
|
163
191
|
}
|
164
192
|
/**
|
165
193
|
* 保存链路
|
@@ -169,45 +197,6 @@ function saveLink(_x3) {
|
|
169
197
|
*/
|
170
198
|
|
171
199
|
|
172
|
-
function _saveLink() {
|
173
|
-
_saveLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
|
174
|
-
var link, values, params, result, _params;
|
175
|
-
|
176
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
177
|
-
while (1) {
|
178
|
-
switch (_context2.prev = _context2.next) {
|
179
|
-
case 0:
|
180
|
-
link = _ref2.link, values = _ref2.values;
|
181
|
-
|
182
|
-
if (!link) {
|
183
|
-
_context2.next = 9;
|
184
|
-
break;
|
185
|
-
}
|
186
|
-
|
187
|
-
params = values[0];
|
188
|
-
_context2.next = 5;
|
189
|
-
return updateLink(link, params);
|
190
|
-
|
191
|
-
case 5:
|
192
|
-
result = _context2.sent;
|
193
|
-
return _context2.abrupt("return", [result]);
|
194
|
-
|
195
|
-
case 9:
|
196
|
-
_params = values.map(function (item, index) {
|
197
|
-
return buildCreateLinkParams(item, index);
|
198
|
-
});
|
199
|
-
return _context2.abrupt("return", cmdbService.batchCreateRelation(_params));
|
200
|
-
|
201
|
-
case 11:
|
202
|
-
case "end":
|
203
|
-
return _context2.stop();
|
204
|
-
}
|
205
|
-
}
|
206
|
-
}, _callee2);
|
207
|
-
}));
|
208
|
-
return _saveLink.apply(this, arguments);
|
209
|
-
}
|
210
|
-
|
211
200
|
export var useSave = function useSave(_ref3) {
|
212
201
|
var cb = _ref3.cb;
|
213
202
|
|
@@ -14,6 +14,8 @@ import LinkSetting from "./setting";
|
|
14
14
|
*/
|
15
15
|
|
16
16
|
var LinkDrawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
17
|
+
var _ref2, _ref3, _ref4, _ref5;
|
18
|
+
|
17
19
|
var topoContext = props.topoContext,
|
18
20
|
topo = props.topo;
|
19
21
|
var store = topo.store;
|
@@ -81,154 +83,130 @@ var LinkDrawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
81
83
|
}
|
82
84
|
}, [urlParams.showAddLink]); // 链路更新,通过资源重新获取链路信息通知HT来更新
|
83
85
|
|
84
|
-
var refreshLink =
|
85
|
-
|
86
|
+
var refreshLink = function refreshLink() {
|
87
|
+
return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
86
88
|
var data;
|
87
89
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
88
|
-
while (1) {
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
return _context.stop();
|
105
|
-
}
|
90
|
+
while (1) switch (_context.prev = _context.next) {
|
91
|
+
case 0:
|
92
|
+
rlog.debug('useTopoEdit.refreshLink');
|
93
|
+
_context.next = 3;
|
94
|
+
return editDispatchers.fetchData();
|
95
|
+
|
96
|
+
case 3:
|
97
|
+
data = _context.sent;
|
98
|
+
topo.view.topoClient.emitEvent(TopoEvent.EVENT_DATA_RESULT, {
|
99
|
+
type: TopoEvent.DATA_TYPE_RESOURCE_COMBO,
|
100
|
+
data: data
|
101
|
+
});
|
102
|
+
|
103
|
+
case 5:
|
104
|
+
case "end":
|
105
|
+
return _context.stop();
|
106
106
|
}
|
107
107
|
}, _callee);
|
108
|
-
}));
|
109
|
-
|
110
|
-
return function refreshLink() {
|
111
|
-
return _ref2.apply(this, arguments);
|
112
|
-
};
|
113
|
-
}();
|
108
|
+
}))).apply(this, arguments);
|
109
|
+
};
|
114
110
|
|
115
|
-
var getLink =
|
116
|
-
|
111
|
+
var getLink = function getLink(_x) {
|
112
|
+
return (_ref3 = _ref3 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id) {
|
117
113
|
var data;
|
118
114
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
119
|
-
while (1) {
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
return
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
return _context2.stop();
|
134
|
-
}
|
115
|
+
while (1) switch (_context2.prev = _context2.next) {
|
116
|
+
case 0:
|
117
|
+
_context2.next = 2;
|
118
|
+
return editDispatchers.fetchData();
|
119
|
+
|
120
|
+
case 2:
|
121
|
+
data = _context2.sent;
|
122
|
+
return _context2.abrupt("return", data.filter(function (item) {
|
123
|
+
return item.id === id;
|
124
|
+
})[0]);
|
125
|
+
|
126
|
+
case 4:
|
127
|
+
case "end":
|
128
|
+
return _context2.stop();
|
135
129
|
}
|
136
130
|
}, _callee2);
|
137
|
-
}));
|
138
|
-
|
139
|
-
return function getLink(_x) {
|
140
|
-
return _ref3.apply(this, arguments);
|
141
|
-
};
|
142
|
-
}();
|
131
|
+
}))).apply(this, arguments);
|
132
|
+
};
|
143
133
|
|
144
|
-
var updateTopo = useCallback(
|
145
|
-
|
146
|
-
var changed, isAdd, _data$result
|
134
|
+
var updateTopo = useCallback(function (_x2) {
|
135
|
+
return (_ref4 = _ref4 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data) {
|
136
|
+
var changed, isAdd, _data$result$2, oldId, id, linkData;
|
147
137
|
|
148
138
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
149
|
-
while (1) {
|
150
|
-
|
151
|
-
|
152
|
-
changed = data.changed, isAdd = data.isAddMode;
|
153
|
-
|
154
|
-
if (!(changed === false)) {
|
155
|
-
_context3.next = 3;
|
156
|
-
break;
|
157
|
-
}
|
139
|
+
while (1) switch (_context3.prev = _context3.next) {
|
140
|
+
case 0:
|
141
|
+
changed = data.changed, isAdd = data.isAddMode;
|
158
142
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
_context3.next = 8;
|
164
|
-
break;
|
165
|
-
}
|
143
|
+
if (!(changed === false)) {
|
144
|
+
_context3.next = 3;
|
145
|
+
break;
|
146
|
+
}
|
166
147
|
|
167
|
-
|
168
|
-
return refreshLink();
|
148
|
+
return _context3.abrupt("return");
|
169
149
|
|
170
|
-
|
171
|
-
|
150
|
+
case 3:
|
151
|
+
if (!isAdd) {
|
152
|
+
_context3.next = 8;
|
172
153
|
break;
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
154
|
+
}
|
155
|
+
|
156
|
+
_context3.next = 6;
|
157
|
+
return refreshLink();
|
158
|
+
|
159
|
+
case 6:
|
160
|
+
_context3.next = 13;
|
161
|
+
break;
|
162
|
+
|
163
|
+
case 8:
|
164
|
+
_data$result$2 = data.result[0], oldId = _data$result$2.oldId, id = _data$result$2.id;
|
165
|
+
_context3.next = 11;
|
166
|
+
return getLink(id);
|
167
|
+
|
168
|
+
case 11:
|
169
|
+
linkData = _context3.sent;
|
170
|
+
topo.view.topoClient.emitEvent('topo_link_update', {
|
171
|
+
id: oldId,
|
172
|
+
link: linkData
|
173
|
+
});
|
174
|
+
|
175
|
+
case 13:
|
176
|
+
case "end":
|
177
|
+
return _context3.stop();
|
190
178
|
}
|
191
179
|
}, _callee3);
|
192
|
-
}));
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
};
|
197
|
-
}(), []);
|
198
|
-
var handleSaved = useCallback( /*#__PURE__*/function () {
|
199
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
|
180
|
+
}))).apply(this, arguments);
|
181
|
+
}, []);
|
182
|
+
var handleSaved = useCallback(function (_x3) {
|
183
|
+
return (_ref5 = _ref5 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
|
200
184
|
var errorItems;
|
201
185
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
202
|
-
while (1) {
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
return _context4.stop();
|
223
|
-
}
|
186
|
+
while (1) switch (_context4.prev = _context4.next) {
|
187
|
+
case 0:
|
188
|
+
errorItems = data.errorItems;
|
189
|
+
|
190
|
+
if (errorItems.length) {
|
191
|
+
_context4.next = 7;
|
192
|
+
break;
|
193
|
+
}
|
194
|
+
|
195
|
+
setFalse();
|
196
|
+
setUpdateTopoState(true);
|
197
|
+
_context4.next = 6;
|
198
|
+
return updateTopo(data);
|
199
|
+
|
200
|
+
case 6:
|
201
|
+
setUpdateTopoState(false);
|
202
|
+
|
203
|
+
case 7:
|
204
|
+
case "end":
|
205
|
+
return _context4.stop();
|
224
206
|
}
|
225
207
|
}, _callee4);
|
226
|
-
}));
|
227
|
-
|
228
|
-
return function (_x3) {
|
229
|
-
return _ref5.apply(this, arguments);
|
230
|
-
};
|
231
|
-
}(), []);
|
208
|
+
}))).apply(this, arguments);
|
209
|
+
}, []);
|
232
210
|
return /*#__PURE__*/React.createElement(_Drawer, {
|
233
211
|
closeMode: ['close', 'esc'],
|
234
212
|
visible: visible,
|