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