@riil-frontend/component-topology 7.0.0-dev.9 → 7.0.1
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 +31 -31
- package/es/core/components/DisplaySettingDrawer/DisplaySetting.js +2 -23
- package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +3 -2
- package/es/core/components/DisplaySettingDrawer/LineExpandAllRadioGroup.js +1 -2
- package/es/core/components/TopoView/GraphViewPanel.js +18 -2
- package/es/core/editor/components/Toolbar/buttons.js +2 -2
- package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +10 -3
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/edgeTag.js +9 -2
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +7 -1
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/nodeTag.js +21 -6
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/textStyleUtil.js +5 -0
- package/es/core/editor/components/settings/PropertyView.js +11 -10
- package/es/core/editor/components/settings/Settings.js +8 -1
- package/es/core/editor/components/settings/core/PropertyViewManager.js +4 -3
- package/es/core/editor/components/settings/core/edgePropertyViewAdapter.js +1 -7
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +4 -2
- package/es/core/editor/components/settings/propertyViews/node/data/PlatformDisplay.js +15 -0
- package/es/core/hooks/usePolling.js +1 -6
- package/es/core/hooks/useTopoEdit.js +3 -1
- package/es/core/models/Alarm.js +12 -24
- package/es/core/models/TopoApp.js +5 -3
- package/es/core/models/utils/linkUtils.js +0 -3
- package/es/core/store/models/topoMod.js +7 -6
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +28 -25
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +4 -0
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +17 -17
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.module.scss +1 -0
- package/es/core/viewer/components/titlebar/widgets/SettingButton.js +3 -11
- package/es/core/viewer/components/titlebar/widgets/SettingButtonWidget.js +5 -3
- package/es/networkTopo/getTopoData.js +16 -27
- package/es/networkTopo/index.js +2 -2
- package/es/networkTopo/services/alert.js +55 -0
- package/es/networkTopo/services/authorization.js +135 -0
- package/es/networkTopo/services/cmdb.js +897 -0
- package/es/networkTopo/services/index.js +2 -26
- package/es/networkTopo/services/mdc.js +74 -0
- package/es/networkTopo/services/metric.js +68 -0
- package/es/networkTopo/services/model.js +1283 -0
- package/es/networkTopo/services/risk.js +29 -0
- package/es/networkTopo/services/topo/auth.js +67 -0
- package/es/networkTopo/services/topo/basic.js +727 -0
- package/es/networkTopo/services/topo/blacklist.js +60 -0
- package/es/networkTopo/services/topo/ciInfo.js +69 -0
- package/es/networkTopo/services/topo/constants.js +1 -0
- package/es/networkTopo/services/topo/icon.js +131 -0
- package/es/networkTopo/services/topo/index.js +18 -0
- package/es/networkTopo/services/topo/networkLink.js +33 -0
- package/es/networkTopo/services/topo/relation.js +27 -0
- package/es/networkTopo/services/topo/resourceWebUrl.js +84 -0
- package/es/networkTopo/store/topoTreeMod.js +5 -1
- package/es/networkTopo/utils/storage.js +38 -0
- package/es/utils/tree.js +1 -0
- package/lib/core/components/DisplaySettingDrawer/DisplaySetting.js +3 -24
- package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +3 -3
- package/lib/core/components/DisplaySettingDrawer/LineExpandAllRadioGroup.js +1 -2
- package/lib/core/components/TopoView/GraphViewPanel.js +22 -2
- package/lib/core/editor/components/Toolbar/buttons.js +2 -2
- package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +10 -3
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/edgeTag.js +9 -3
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +8 -1
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/nodeTag.js +21 -7
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/textStyleUtil.js +5 -0
- package/lib/core/editor/components/settings/PropertyView.js +10 -10
- package/lib/core/editor/components/settings/Settings.js +9 -1
- package/lib/core/editor/components/settings/core/PropertyViewManager.js +4 -3
- package/lib/core/editor/components/settings/core/edgePropertyViewAdapter.js +1 -10
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +5 -3
- package/lib/core/editor/components/settings/propertyViews/node/data/PlatformDisplay.js +23 -0
- package/lib/core/hooks/usePolling.js +1 -6
- package/lib/core/hooks/useTopoEdit.js +3 -1
- package/lib/core/models/Alarm.js +12 -24
- package/lib/core/models/TopoApp.js +5 -3
- package/lib/core/models/utils/linkUtils.js +0 -5
- package/lib/core/store/models/topoMod.js +9 -6
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +28 -26
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +4 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +17 -17
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.module.scss +1 -0
- package/lib/core/viewer/components/titlebar/widgets/SettingButton.js +3 -11
- package/lib/core/viewer/components/titlebar/widgets/SettingButtonWidget.js +5 -3
- package/lib/networkTopo/getTopoData.js +16 -28
- package/lib/networkTopo/index.js +4 -4
- package/lib/networkTopo/services/alert.js +66 -0
- package/lib/networkTopo/services/authorization.js +145 -0
- package/lib/networkTopo/services/cmdb.js +977 -0
- package/lib/networkTopo/services/index.js +3 -29
- package/lib/networkTopo/services/mdc.js +91 -0
- package/lib/networkTopo/services/metric.js +82 -0
- package/lib/networkTopo/services/model.js +1387 -0
- package/lib/networkTopo/services/risk.js +40 -0
- package/lib/networkTopo/services/topo/auth.js +79 -0
- package/lib/networkTopo/services/topo/basic.js +753 -0
- package/lib/networkTopo/services/topo/blacklist.js +72 -0
- package/lib/networkTopo/services/topo/ciInfo.js +82 -0
- package/lib/networkTopo/services/topo/constants.js +6 -0
- package/lib/networkTopo/services/topo/icon.js +144 -0
- package/lib/networkTopo/{components/editor/plugins/LayerConfigPlugin.js → services/topo/index.js} +33 -23
- package/lib/networkTopo/services/topo/networkLink.js +45 -0
- package/lib/networkTopo/services/topo/relation.js +39 -0
- package/lib/networkTopo/services/topo/resourceWebUrl.js +95 -0
- package/lib/networkTopo/store/topoTreeMod.js +5 -1
- package/lib/networkTopo/utils/storage.js +46 -0
- package/lib/utils/tree.js +1 -0
- package/package.json +3 -3
- package/es/core/components/DisplaySettingDrawer/EditorDisplaySetting.js +0 -122
- package/es/core/editor/components/settings/propertyViews/edge/addEdgeProps.js +0 -10
- package/es/networkTopo/components/Topology.js +0 -28
- package/es/networkTopo/components/editor/plugins/LayerConfigPlugin.js +0 -22
- package/es/networkTopo/components/editor/propertyViews/LayerRelatedResourceList.js +0 -48
- package/es/networkTopo/components/editor/propertyViews/edge/EdgeGroupPropertyView.js +0 -35
- package/es/networkTopo/components/editor/propertyViews/edge/EdgePropertyView.js +0 -43
- package/es/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +0 -39
- package/es/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +0 -31
- package/es/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyViewV1.js +0 -37
- package/es/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/Setting/index.js +0 -49
- package/es/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/index.js +0 -2
- package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +0 -630
- package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/NetworkLinkForm.js +0 -4
- package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +0 -458
- package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/index.module.scss +0 -34
- package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/hooks/useAddLink.js +0 -104
- package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/index.module.scss +0 -12
- package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/mock.js +0 -55
- package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/server.js +0 -187
- package/es/networkTopo/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +0 -178
- package/es/networkTopo/components/editor/propertyViews/edge/link/LinkInfoPreview.js +0 -103
- package/es/networkTopo/components/editor/propertyViews/edge/link/LinkInfoPreview.module.scss +0 -65
- package/es/networkTopo/components/editor/useEditorProps.js +0 -32
- package/es/networkTopo/event/index.js +0 -6
- package/es/networkTopo/hooks/editor/useDeleteEdges.js +0 -200
- package/es/networkTopo/hooks/editor/useGroupSortResources.js +0 -16
- package/es/networkTopo/hooks/useTopoEdit.js +0 -26
- package/lib/core/components/DisplaySettingDrawer/EditorDisplaySetting.js +0 -147
- package/lib/core/editor/components/settings/propertyViews/edge/addEdgeProps.js +0 -19
- package/lib/networkTopo/components/Topology.js +0 -40
- package/lib/networkTopo/components/editor/propertyViews/LayerRelatedResourceList.js +0 -63
- package/lib/networkTopo/components/editor/propertyViews/edge/EdgeGroupPropertyView.js +0 -51
- package/lib/networkTopo/components/editor/propertyViews/edge/EdgePropertyView.js +0 -60
- package/lib/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +0 -54
- package/lib/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +0 -42
- package/lib/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyViewV1.js +0 -50
- package/lib/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/Setting/index.js +0 -66
- package/lib/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/index.js +0 -11
- package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +0 -661
- package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/NetworkLinkForm.js +0 -12
- package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +0 -486
- package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/index.module.scss +0 -34
- package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/hooks/useAddLink.js +0 -120
- package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/index.module.scss +0 -12
- package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/mock.js +0 -60
- package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/server.js +0 -207
- package/lib/networkTopo/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +0 -205
- package/lib/networkTopo/components/editor/propertyViews/edge/link/LinkInfoPreview.js +0 -121
- package/lib/networkTopo/components/editor/propertyViews/edge/link/LinkInfoPreview.module.scss +0 -65
- package/lib/networkTopo/components/editor/useEditorProps.js +0 -46
- package/lib/networkTopo/event/index.js +0 -11
- package/lib/networkTopo/hooks/editor/useDeleteEdges.js +0 -218
- package/lib/networkTopo/hooks/editor/useGroupSortResources.js +0 -21
- package/lib/networkTopo/hooks/useTopoEdit.js +0 -40
@@ -0,0 +1,753 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
exports.__esModule = true;
|
6
|
+
exports["default"] = exports.TOPO_PARENT_ID = exports.TOPO_GROUP_ID = void 0;
|
7
|
+
|
8
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
9
|
+
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
11
|
+
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
13
|
+
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
15
|
+
|
16
|
+
var _componentTopologyUtils = require("@riil-frontend/component-topology-utils");
|
17
|
+
|
18
|
+
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
|
19
|
+
|
20
|
+
var _blacklist = _interopRequireDefault(require("./blacklist"));
|
21
|
+
|
22
|
+
var _constants = require("./constants");
|
23
|
+
|
24
|
+
var _cmdb = require("../cmdb");
|
25
|
+
|
26
|
+
var _model = require("../model");
|
27
|
+
|
28
|
+
var _excluded = ["groups", "resources"];
|
29
|
+
var API_ROOT = _constants.TOPO_API_ROOT;
|
30
|
+
/**
|
31
|
+
* 拓扑图(看做一个容器)的“父容器”ID
|
32
|
+
*/
|
33
|
+
|
34
|
+
var TOPO_PARENT_ID = -2;
|
35
|
+
/**
|
36
|
+
* 拓扑图(看做一个容器)的容器ID
|
37
|
+
*/
|
38
|
+
|
39
|
+
exports.TOPO_PARENT_ID = TOPO_PARENT_ID;
|
40
|
+
var TOPO_GROUP_ID = -1;
|
41
|
+
exports.TOPO_GROUP_ID = TOPO_GROUP_ID;
|
42
|
+
var DEFAULT_QUERY = {
|
43
|
+
current: 1,
|
44
|
+
pageSize: 200,
|
45
|
+
sortBy: 'name',
|
46
|
+
sortOrder: 'asc'
|
47
|
+
};
|
48
|
+
|
49
|
+
function isAvailableArray(arr) {
|
50
|
+
return arr && Array.isArray(arr) && arr.length > 0;
|
51
|
+
}
|
52
|
+
|
53
|
+
function prepareResourceParams(conditions, query) {
|
54
|
+
if (query === void 0) {
|
55
|
+
query = DEFAULT_QUERY;
|
56
|
+
}
|
57
|
+
|
58
|
+
var dynamicRes = conditions.dynamic,
|
59
|
+
staticRes = conditions["static"],
|
60
|
+
stateValue = conditions.stateValue; // if (isNull(dynamicRes) && isNull(staticRes)) {
|
61
|
+
// return null;
|
62
|
+
// }
|
63
|
+
|
64
|
+
var dynamicCondition = dynamicRes && {
|
65
|
+
stateValue: stateValue,
|
66
|
+
condition: dynamicRes
|
67
|
+
} || undefined;
|
68
|
+
|
69
|
+
if (dynamicCondition && query) {
|
70
|
+
dynamicCondition.currentPage = query.current;
|
71
|
+
dynamicCondition.pageSize = query.pageSize;
|
72
|
+
dynamicCondition.sort = query.sortBy + " " + query.sortOrder;
|
73
|
+
}
|
74
|
+
|
75
|
+
var fixedConditionIdList = staticRes || undefined;
|
76
|
+
return {
|
77
|
+
dynamicCondition: dynamicCondition,
|
78
|
+
fixedConditionIdList: fixedConditionIdList
|
79
|
+
};
|
80
|
+
}
|
81
|
+
|
82
|
+
function prepareGroupParams(modifiedGroups) {
|
83
|
+
if (modifiedGroups === void 0) {
|
84
|
+
modifiedGroups = [];
|
85
|
+
}
|
86
|
+
|
87
|
+
var groups = modifiedGroups.map(function (group, index) {
|
88
|
+
var id = group.id,
|
89
|
+
layout = group.layout,
|
90
|
+
_group$parentId = group.parentId,
|
91
|
+
parentId = _group$parentId === void 0 ? TOPO_GROUP_ID : _group$parentId,
|
92
|
+
_group$name = group.name,
|
93
|
+
name = _group$name === void 0 ? '' : _group$name,
|
94
|
+
expanded = group.expanded,
|
95
|
+
_group$styles = group.styles,
|
96
|
+
styles = _group$styles === void 0 ? {} : _group$styles,
|
97
|
+
resources = group.resources,
|
98
|
+
tag = group.tag;
|
99
|
+
|
100
|
+
if (!resources) {
|
101
|
+
return null;
|
102
|
+
}
|
103
|
+
|
104
|
+
var topoGroup = {
|
105
|
+
id: id,
|
106
|
+
layout: layout,
|
107
|
+
parentId: parentId,
|
108
|
+
name: name,
|
109
|
+
styles: JSON.stringify(expanded !== undefined ? (0, _extends2["default"])({}, styles, {
|
110
|
+
showExpanded: expanded
|
111
|
+
}) : styles),
|
112
|
+
order: index,
|
113
|
+
tag: tag
|
114
|
+
};
|
115
|
+
return {
|
116
|
+
topoGroup: topoGroup,
|
117
|
+
condition: prepareResourceParams(resources)
|
118
|
+
};
|
119
|
+
}).filter(Boolean);
|
120
|
+
return {
|
121
|
+
groups: groups
|
122
|
+
};
|
123
|
+
}
|
124
|
+
|
125
|
+
var _default = (0, _extends2["default"])({
|
126
|
+
// 获取拓扑树
|
127
|
+
getTopoTree: function getTopoTree(params) {
|
128
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
129
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
130
|
+
while (1) {
|
131
|
+
switch (_context.prev = _context.next) {
|
132
|
+
case 0:
|
133
|
+
_context.next = 2;
|
134
|
+
return _componentTopologyUtils.request.get(API_ROOT + "/menu");
|
135
|
+
|
136
|
+
case 2:
|
137
|
+
return _context.abrupt("return", _context.sent);
|
138
|
+
|
139
|
+
case 3:
|
140
|
+
case "end":
|
141
|
+
return _context.stop();
|
142
|
+
}
|
143
|
+
}
|
144
|
+
}, _callee);
|
145
|
+
}))();
|
146
|
+
},
|
147
|
+
// 获取有权限的拓扑树
|
148
|
+
getTopoTreeByLoginUser: function getTopoTreeByLoginUser(params) {
|
149
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
150
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
151
|
+
while (1) {
|
152
|
+
switch (_context2.prev = _context2.next) {
|
153
|
+
case 0:
|
154
|
+
_context2.next = 2;
|
155
|
+
return _componentTopologyUtils.request.get('/topo/v1/api/menuByLoginUser');
|
156
|
+
|
157
|
+
case 2:
|
158
|
+
return _context2.abrupt("return", _context2.sent);
|
159
|
+
|
160
|
+
case 3:
|
161
|
+
case "end":
|
162
|
+
return _context2.stop();
|
163
|
+
}
|
164
|
+
}
|
165
|
+
}, _callee2);
|
166
|
+
}))();
|
167
|
+
},
|
168
|
+
|
169
|
+
/**
|
170
|
+
* 添加新拓扑
|
171
|
+
*
|
172
|
+
* @param params.name
|
173
|
+
* @param params.parentId
|
174
|
+
* @param params.type": 0 //0为文件夹 //1为拓扑文件
|
175
|
+
* */
|
176
|
+
addNewTopo: function addNewTopo(params) {
|
177
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
178
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
179
|
+
while (1) {
|
180
|
+
switch (_context3.prev = _context3.next) {
|
181
|
+
case 0:
|
182
|
+
_context3.next = 2;
|
183
|
+
return _componentTopologyUtils.request.post(API_ROOT + "/menu", params);
|
184
|
+
|
185
|
+
case 2:
|
186
|
+
return _context3.abrupt("return", _context3.sent);
|
187
|
+
|
188
|
+
case 3:
|
189
|
+
case "end":
|
190
|
+
return _context3.stop();
|
191
|
+
}
|
192
|
+
}
|
193
|
+
}, _callee3);
|
194
|
+
}))();
|
195
|
+
},
|
196
|
+
|
197
|
+
/**
|
198
|
+
* @param id
|
199
|
+
* @param name
|
200
|
+
* */
|
201
|
+
editTopo: function editTopo(params) {
|
202
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
203
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
204
|
+
while (1) {
|
205
|
+
switch (_context4.prev = _context4.next) {
|
206
|
+
case 0:
|
207
|
+
_context4.next = 2;
|
208
|
+
return _componentTopologyUtils.request.put(API_ROOT + "/menu", params);
|
209
|
+
|
210
|
+
case 2:
|
211
|
+
return _context4.abrupt("return", _context4.sent);
|
212
|
+
|
213
|
+
case 3:
|
214
|
+
case "end":
|
215
|
+
return _context4.stop();
|
216
|
+
}
|
217
|
+
}
|
218
|
+
}, _callee4);
|
219
|
+
}))();
|
220
|
+
},
|
221
|
+
|
222
|
+
/**
|
223
|
+
* 复制拓扑
|
224
|
+
*
|
225
|
+
* @param params.id
|
226
|
+
* @param params.name
|
227
|
+
* */
|
228
|
+
copyTopo: function copyTopo(params) {
|
229
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
230
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
231
|
+
while (1) {
|
232
|
+
switch (_context5.prev = _context5.next) {
|
233
|
+
case 0:
|
234
|
+
_context5.next = 2;
|
235
|
+
return _componentTopologyUtils.request.post(API_ROOT + "/menu/copy", params);
|
236
|
+
|
237
|
+
case 2:
|
238
|
+
return _context5.abrupt("return", _context5.sent);
|
239
|
+
|
240
|
+
case 3:
|
241
|
+
case "end":
|
242
|
+
return _context5.stop();
|
243
|
+
}
|
244
|
+
}
|
245
|
+
}, _callee5);
|
246
|
+
}))();
|
247
|
+
},
|
248
|
+
// 删除
|
249
|
+
|
250
|
+
/**
|
251
|
+
* @param id
|
252
|
+
* @param name
|
253
|
+
* */
|
254
|
+
deleteTopoonTree: function deleteTopoonTree(id) {
|
255
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
256
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
257
|
+
while (1) {
|
258
|
+
switch (_context6.prev = _context6.next) {
|
259
|
+
case 0:
|
260
|
+
_context6.next = 2;
|
261
|
+
return _componentTopologyUtils.request["delete"](API_ROOT + "/menu/" + id);
|
262
|
+
|
263
|
+
case 2:
|
264
|
+
return _context6.abrupt("return", _context6.sent);
|
265
|
+
|
266
|
+
case 3:
|
267
|
+
case "end":
|
268
|
+
return _context6.stop();
|
269
|
+
}
|
270
|
+
}
|
271
|
+
}, _callee6);
|
272
|
+
}))();
|
273
|
+
},
|
274
|
+
// 设置默认拓扑
|
275
|
+
|
276
|
+
/**
|
277
|
+
* @param id
|
278
|
+
* @param name
|
279
|
+
* */
|
280
|
+
setDefTopo: function setDefTopo(id) {
|
281
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
282
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
283
|
+
while (1) {
|
284
|
+
switch (_context7.prev = _context7.next) {
|
285
|
+
case 0:
|
286
|
+
return _context7.abrupt("return", _componentTopologyUtils.request.put(API_ROOT + "/menu/default/" + id));
|
287
|
+
|
288
|
+
case 1:
|
289
|
+
case "end":
|
290
|
+
return _context7.stop();
|
291
|
+
}
|
292
|
+
}
|
293
|
+
}, _callee7);
|
294
|
+
}))();
|
295
|
+
},
|
296
|
+
// 移动拓扑文件
|
297
|
+
|
298
|
+
/**
|
299
|
+
* @param params
|
300
|
+
* "id": 0,
|
301
|
+
*"newPId": 0,
|
302
|
+
*"newSubList": [
|
303
|
+
* 0
|
304
|
+
*]
|
305
|
+
*
|
306
|
+
* */
|
307
|
+
moveTopoOnTree: function moveTopoOnTree(params) {
|
308
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
309
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
310
|
+
while (1) {
|
311
|
+
switch (_context8.prev = _context8.next) {
|
312
|
+
case 0:
|
313
|
+
_context8.next = 2;
|
314
|
+
return _componentTopologyUtils.request.put(API_ROOT + "/menu/move/", params);
|
315
|
+
|
316
|
+
case 2:
|
317
|
+
return _context8.abrupt("return", _context8.sent);
|
318
|
+
|
319
|
+
case 3:
|
320
|
+
case "end":
|
321
|
+
return _context8.stop();
|
322
|
+
}
|
323
|
+
}
|
324
|
+
}, _callee8);
|
325
|
+
}))();
|
326
|
+
},
|
327
|
+
|
328
|
+
/**
|
329
|
+
* 修改拓扑布局
|
330
|
+
* @param {Number} id
|
331
|
+
* @param {String} layout
|
332
|
+
* @returns
|
333
|
+
*/
|
334
|
+
changeLayout: function changeLayout(_ref) {
|
335
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
|
336
|
+
var id, template, layout, backgroundId;
|
337
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
338
|
+
while (1) {
|
339
|
+
switch (_context9.prev = _context9.next) {
|
340
|
+
case 0:
|
341
|
+
id = _ref.id, template = _ref.template, layout = _ref.layout, backgroundId = _ref.backgroundId;
|
342
|
+
_context9.next = 3;
|
343
|
+
return _componentTopologyUtils.request.put(API_ROOT + "/menu", {
|
344
|
+
id: id,
|
345
|
+
showType: template,
|
346
|
+
layout: layout,
|
347
|
+
backgroundId: backgroundId || -1,
|
348
|
+
type: 1
|
349
|
+
});
|
350
|
+
|
351
|
+
case 3:
|
352
|
+
return _context9.abrupt("return", _context9.sent);
|
353
|
+
|
354
|
+
case 4:
|
355
|
+
case "end":
|
356
|
+
return _context9.stop();
|
357
|
+
}
|
358
|
+
}
|
359
|
+
}, _callee9);
|
360
|
+
}))();
|
361
|
+
},
|
362
|
+
|
363
|
+
/**
|
364
|
+
* 根据动静条件查询资源列表
|
365
|
+
* @param {Object} conditions
|
366
|
+
* @param {Object} query
|
367
|
+
* @returns
|
368
|
+
*/
|
369
|
+
getResourceList: function getResourceList(conditions, query) {
|
370
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
|
371
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
372
|
+
while (1) {
|
373
|
+
switch (_context10.prev = _context10.next) {
|
374
|
+
case 0:
|
375
|
+
_context10.next = 2;
|
376
|
+
return _componentTopologyUtils.request.post(API_ROOT + "/resource", prepareResourceParams(conditions, query));
|
377
|
+
|
378
|
+
case 2:
|
379
|
+
return _context10.abrupt("return", _context10.sent);
|
380
|
+
|
381
|
+
case 3:
|
382
|
+
case "end":
|
383
|
+
return _context10.stop();
|
384
|
+
}
|
385
|
+
}
|
386
|
+
}, _callee10);
|
387
|
+
}))();
|
388
|
+
},
|
389
|
+
|
390
|
+
/**
|
391
|
+
* 查询拓扑绑定的动静条件
|
392
|
+
* @param {Number} id Topo ID
|
393
|
+
* @returns Conditions
|
394
|
+
*/
|
395
|
+
getConditions: function getConditions(id) {
|
396
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
|
397
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
398
|
+
while (1) {
|
399
|
+
switch (_context11.prev = _context11.next) {
|
400
|
+
case 0:
|
401
|
+
_context11.next = 2;
|
402
|
+
return _componentTopologyUtils.request.get(API_ROOT + "/resource/" + id);
|
403
|
+
|
404
|
+
case 2:
|
405
|
+
return _context11.abrupt("return", _context11.sent);
|
406
|
+
|
407
|
+
case 3:
|
408
|
+
case "end":
|
409
|
+
return _context11.stop();
|
410
|
+
}
|
411
|
+
}
|
412
|
+
}, _callee11);
|
413
|
+
}))();
|
414
|
+
},
|
415
|
+
|
416
|
+
/**
|
417
|
+
* 查询拓扑数据
|
418
|
+
* @param {*} id Topo ID
|
419
|
+
* @returns
|
420
|
+
*/
|
421
|
+
getTopoData: function getTopoData(id) {
|
422
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
|
423
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
424
|
+
while (1) {
|
425
|
+
switch (_context12.prev = _context12.next) {
|
426
|
+
case 0:
|
427
|
+
_context12.prev = 0;
|
428
|
+
_context12.next = 3;
|
429
|
+
return _componentTopologyUtils.request.get(API_ROOT + "/structure/both/" + id);
|
430
|
+
|
431
|
+
case 3:
|
432
|
+
return _context12.abrupt("return", _context12.sent);
|
433
|
+
|
434
|
+
case 6:
|
435
|
+
_context12.prev = 6;
|
436
|
+
_context12.t0 = _context12["catch"](0);
|
437
|
+
|
438
|
+
_rlog["default"].debug('getTopoData-error', _context12.t0);
|
439
|
+
|
440
|
+
return _context12.abrupt("return", null);
|
441
|
+
|
442
|
+
case 10:
|
443
|
+
case "end":
|
444
|
+
return _context12.stop();
|
445
|
+
}
|
446
|
+
}
|
447
|
+
}, _callee12, null, [[0, 6]]);
|
448
|
+
}))();
|
449
|
+
},
|
450
|
+
|
451
|
+
/**
|
452
|
+
* 查询拓扑数据
|
453
|
+
* @param {Number} id Topo ID
|
454
|
+
* @param {Object} resources
|
455
|
+
* @param {Array} groups
|
456
|
+
* @returns
|
457
|
+
*/
|
458
|
+
getTopoDataByResource: function getTopoDataByResource(id, resources, groups, exportLinkIdList) {
|
459
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13() {
|
460
|
+
var data, obj;
|
461
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
462
|
+
while (1) {
|
463
|
+
switch (_context13.prev = _context13.next) {
|
464
|
+
case 0:
|
465
|
+
data = isAvailableArray(groups) ? groups : [];
|
466
|
+
|
467
|
+
if (resources) {
|
468
|
+
data.push({
|
469
|
+
parentId: TOPO_PARENT_ID,
|
470
|
+
order: 100,
|
471
|
+
resources: resources
|
472
|
+
});
|
473
|
+
}
|
474
|
+
|
475
|
+
obj = prepareGroupParams(data);
|
476
|
+
_context13.next = 5;
|
477
|
+
return _componentTopologyUtils.request.post(API_ROOT + "/structure/byCondition/" + id, (0, _extends2["default"])({}, obj, {
|
478
|
+
exportLinkIdList: exportLinkIdList
|
479
|
+
}));
|
480
|
+
|
481
|
+
case 5:
|
482
|
+
return _context13.abrupt("return", _context13.sent);
|
483
|
+
|
484
|
+
case 6:
|
485
|
+
case "end":
|
486
|
+
return _context13.stop();
|
487
|
+
}
|
488
|
+
}
|
489
|
+
}, _callee13);
|
490
|
+
}))();
|
491
|
+
},
|
492
|
+
|
493
|
+
/**
|
494
|
+
* 绑定资源到拓扑
|
495
|
+
* @param {Number} id Topo ID
|
496
|
+
* @param {Object} resources
|
497
|
+
* @param {Array} groups
|
498
|
+
* @returns
|
499
|
+
*/
|
500
|
+
bindResourceToTopo: function bindResourceToTopo(id, config) {
|
501
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14() {
|
502
|
+
var groups, resources, otherConfig, newGroups, obj;
|
503
|
+
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
504
|
+
while (1) {
|
505
|
+
switch (_context14.prev = _context14.next) {
|
506
|
+
case 0:
|
507
|
+
groups = config.groups, resources = config.resources, otherConfig = (0, _objectWithoutPropertiesLoose2["default"])(config, _excluded);
|
508
|
+
newGroups = isAvailableArray(groups) ? groups : [];
|
509
|
+
|
510
|
+
if (resources) {
|
511
|
+
// 新建拓扑时
|
512
|
+
newGroups.push({
|
513
|
+
parentId: TOPO_PARENT_ID,
|
514
|
+
order: 100,
|
515
|
+
resources: resources
|
516
|
+
});
|
517
|
+
}
|
518
|
+
|
519
|
+
obj = prepareGroupParams(newGroups);
|
520
|
+
_context14.next = 6;
|
521
|
+
return _componentTopologyUtils.request.post(API_ROOT + "/resource/" + id, (0, _extends2["default"])({}, otherConfig, obj));
|
522
|
+
|
523
|
+
case 6:
|
524
|
+
return _context14.abrupt("return", _context14.sent);
|
525
|
+
|
526
|
+
case 7:
|
527
|
+
case "end":
|
528
|
+
return _context14.stop();
|
529
|
+
}
|
530
|
+
}
|
531
|
+
}, _callee14);
|
532
|
+
}))();
|
533
|
+
},
|
534
|
+
|
535
|
+
/**
|
536
|
+
* 保存拓扑绘制数据(第三方库内部结构,无需关心含义)
|
537
|
+
* @param {Number} id Topo ID
|
538
|
+
* @param {String} data
|
539
|
+
* @returns
|
540
|
+
*/
|
541
|
+
saveSerializeData: function saveSerializeData(id, data) {
|
542
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15() {
|
543
|
+
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
544
|
+
while (1) {
|
545
|
+
switch (_context15.prev = _context15.next) {
|
546
|
+
case 0:
|
547
|
+
_context15.next = 2;
|
548
|
+
return _componentTopologyUtils.request.post(API_ROOT + "/structure/" + id, data);
|
549
|
+
|
550
|
+
case 2:
|
551
|
+
return _context15.abrupt("return", _context15.sent);
|
552
|
+
|
553
|
+
case 3:
|
554
|
+
case "end":
|
555
|
+
return _context15.stop();
|
556
|
+
}
|
557
|
+
}
|
558
|
+
}, _callee15);
|
559
|
+
}))();
|
560
|
+
},
|
561
|
+
|
562
|
+
/**
|
563
|
+
* 保存拓扑全局设置
|
564
|
+
* @param {*} id 拓扑ID
|
565
|
+
* @param {*} settings 设置
|
566
|
+
* @returns
|
567
|
+
*/
|
568
|
+
saveTopoSettings: function saveTopoSettings(id, settings) {
|
569
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16() {
|
570
|
+
var parm;
|
571
|
+
return _regenerator["default"].wrap(function _callee16$(_context16) {
|
572
|
+
while (1) {
|
573
|
+
switch (_context16.prev = _context16.next) {
|
574
|
+
case 0:
|
575
|
+
_rlog["default"].debug('saveTopoSettings', settings);
|
576
|
+
|
577
|
+
parm = {
|
578
|
+
id: id,
|
579
|
+
globalConfig: settings
|
580
|
+
};
|
581
|
+
return _context16.abrupt("return", _componentTopologyUtils.request.post(API_ROOT + "/config", parm));
|
582
|
+
|
583
|
+
case 3:
|
584
|
+
case "end":
|
585
|
+
return _context16.stop();
|
586
|
+
}
|
587
|
+
}
|
588
|
+
}, _callee16);
|
589
|
+
}))();
|
590
|
+
}
|
591
|
+
}, _blacklist["default"], {
|
592
|
+
/**
|
593
|
+
* 打开拓扑告警
|
594
|
+
* @param {*} id Topo ID
|
595
|
+
*/
|
596
|
+
openTopoAlarm: function openTopoAlarm(id) {
|
597
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee17() {
|
598
|
+
return _regenerator["default"].wrap(function _callee17$(_context17) {
|
599
|
+
while (1) {
|
600
|
+
switch (_context17.prev = _context17.next) {
|
601
|
+
case 0:
|
602
|
+
_context17.next = 2;
|
603
|
+
return _componentTopologyUtils.request.post(API_ROOT + "/alarm?topoId=" + id);
|
604
|
+
|
605
|
+
case 2:
|
606
|
+
return _context17.abrupt("return", _context17.sent);
|
607
|
+
|
608
|
+
case 3:
|
609
|
+
case "end":
|
610
|
+
return _context17.stop();
|
611
|
+
}
|
612
|
+
}
|
613
|
+
}, _callee17);
|
614
|
+
}))();
|
615
|
+
},
|
616
|
+
|
617
|
+
/**
|
618
|
+
* 关闭拓扑告警
|
619
|
+
* @param {*} id Topo ID
|
620
|
+
*/
|
621
|
+
closeTopoAlarm: function closeTopoAlarm(id, secretKey) {
|
622
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee18() {
|
623
|
+
return _regenerator["default"].wrap(function _callee18$(_context18) {
|
624
|
+
while (1) {
|
625
|
+
switch (_context18.prev = _context18.next) {
|
626
|
+
case 0:
|
627
|
+
_context18.next = 2;
|
628
|
+
return _componentTopologyUtils.request["delete"](API_ROOT + "/alarm?topoId=" + id + "&secretKey=" + secretKey);
|
629
|
+
|
630
|
+
case 2:
|
631
|
+
return _context18.abrupt("return", _context18.sent);
|
632
|
+
|
633
|
+
case 3:
|
634
|
+
case "end":
|
635
|
+
return _context18.stop();
|
636
|
+
}
|
637
|
+
}
|
638
|
+
}, _callee18);
|
639
|
+
}))();
|
640
|
+
},
|
641
|
+
|
642
|
+
/**
|
643
|
+
* 根据资源id获取属性及属性值
|
644
|
+
* @param {*} params Topo ID
|
645
|
+
*/
|
646
|
+
getAttributesByIds: function getAttributesByIds(params) {
|
647
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee19() {
|
648
|
+
var _params$ids;
|
649
|
+
|
650
|
+
var param;
|
651
|
+
return _regenerator["default"].wrap(function _callee19$(_context19) {
|
652
|
+
while (1) {
|
653
|
+
switch (_context19.prev = _context19.next) {
|
654
|
+
case 0:
|
655
|
+
if (!(((_params$ids = params.ids) === null || _params$ids === void 0 ? void 0 : _params$ids.length) > 0)) {
|
656
|
+
_context19.next = 6;
|
657
|
+
break;
|
658
|
+
}
|
659
|
+
|
660
|
+
param = {
|
661
|
+
condition: "id('" + params.ids.join("','") + "')",
|
662
|
+
sort: 'index DESC',
|
663
|
+
currentPage: 1,
|
664
|
+
pageSize: params.ids.length > 10 ? params.ids.length : 10
|
665
|
+
};
|
666
|
+
|
667
|
+
_rlog["default"].debug('getAttributesByIds', param);
|
668
|
+
|
669
|
+
_context19.next = 5;
|
670
|
+
return (0, _cmdb.commonQuery)(param);
|
671
|
+
|
672
|
+
case 5:
|
673
|
+
return _context19.abrupt("return", _context19.sent);
|
674
|
+
|
675
|
+
case 6:
|
676
|
+
case "end":
|
677
|
+
return _context19.stop();
|
678
|
+
}
|
679
|
+
}
|
680
|
+
}, _callee19);
|
681
|
+
}))();
|
682
|
+
},
|
683
|
+
|
684
|
+
/**
|
685
|
+
* 批量查询ci信息接口
|
686
|
+
* @param {*} params Topo ID
|
687
|
+
*/
|
688
|
+
getBatchCi: function getBatchCi(params) {
|
689
|
+
var _params$ciTypes;
|
690
|
+
|
691
|
+
if (((_params$ciTypes = params.ciTypes) === null || _params$ciTypes === void 0 ? void 0 : _params$ciTypes.length) > 0) {
|
692
|
+
return (0, _model.getBatchCi)(params.ciTypes);
|
693
|
+
}
|
694
|
+
},
|
695
|
+
|
696
|
+
/**
|
697
|
+
* 批量查询ci指标信息
|
698
|
+
* @param {*} params Topo ID
|
699
|
+
*/
|
700
|
+
getBatchCiMetric: function getBatchCiMetric(params) {
|
701
|
+
var _params$ciTypes2;
|
702
|
+
|
703
|
+
if (((_params$ciTypes2 = params.ciTypes) === null || _params$ciTypes2 === void 0 ? void 0 : _params$ciTypes2.length) > 0) {
|
704
|
+
return (0, _model.getBatchCiMetric)(params.ciTypes);
|
705
|
+
}
|
706
|
+
},
|
707
|
+
|
708
|
+
/**
|
709
|
+
* 批量查询ci属性
|
710
|
+
* @param {*} params Topo ID
|
711
|
+
*/
|
712
|
+
getBatchCiArr: function getBatchCiArr(params) {
|
713
|
+
var _params$ids2;
|
714
|
+
|
715
|
+
if (((_params$ids2 = params.ids) === null || _params$ids2 === void 0 ? void 0 : _params$ids2.length) > 0) {
|
716
|
+
var param = {
|
717
|
+
condition: "id('" + params.ids.join("','") + "')",
|
718
|
+
sort: 'name asc',
|
719
|
+
currentPage: 1,
|
720
|
+
pageSize: 999
|
721
|
+
}; // rlog.debug('getBatchCi', param);
|
722
|
+
|
723
|
+
return (0, _cmdb.commonQuery)(param);
|
724
|
+
}
|
725
|
+
},
|
726
|
+
|
727
|
+
/**
|
728
|
+
* 批量查询ci指标属性
|
729
|
+
* @param {*} params Topo ID
|
730
|
+
*/
|
731
|
+
getBatchCiPolling: function getBatchCiPolling(params) {
|
732
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee20() {
|
733
|
+
return _regenerator["default"].wrap(function _callee20$(_context20) {
|
734
|
+
while (1) {
|
735
|
+
switch (_context20.prev = _context20.next) {
|
736
|
+
case 0:
|
737
|
+
_context20.next = 2;
|
738
|
+
return _componentTopologyUtils.request.post(_constants.TOPO_API_ROOT + "/attributes/polling", params);
|
739
|
+
|
740
|
+
case 2:
|
741
|
+
return _context20.abrupt("return", _context20.sent);
|
742
|
+
|
743
|
+
case 3:
|
744
|
+
case "end":
|
745
|
+
return _context20.stop();
|
746
|
+
}
|
747
|
+
}
|
748
|
+
}, _callee20);
|
749
|
+
}))();
|
750
|
+
}
|
751
|
+
});
|
752
|
+
|
753
|
+
exports["default"] = _default;
|