@riil-frontend/component-topology 7.0.0-dev.8 → 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/editor/hooks/useKeyboardShortcut.js +1 -1
- 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/editor/hooks/useKeyboardShortcut.js +1 -1
- 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,897 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
4
|
+
var _excluded = ["checkAuth"],
|
5
|
+
_excluded2 = ["totalPage", "pageIndex", "data"];
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
7
|
+
import { request } from '@riil-frontend/component-topology-utils';
|
8
|
+
/**
|
9
|
+
* 根据id获取实例数据
|
10
|
+
* TODO params参数名称可语义化
|
11
|
+
* @param {string} id 实例id
|
12
|
+
*/
|
13
|
+
|
14
|
+
export var queryById = /*#__PURE__*/function () {
|
15
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(id) {
|
16
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
17
|
+
while (1) {
|
18
|
+
switch (_context.prev = _context.next) {
|
19
|
+
case 0:
|
20
|
+
_context.next = 2;
|
21
|
+
return request.post('/mdc/v1/api/cmdb/queryCiById', {
|
22
|
+
id: id
|
23
|
+
});
|
24
|
+
|
25
|
+
case 2:
|
26
|
+
return _context.abrupt("return", _context.sent);
|
27
|
+
|
28
|
+
case 3:
|
29
|
+
case "end":
|
30
|
+
return _context.stop();
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}, _callee);
|
34
|
+
}));
|
35
|
+
|
36
|
+
return function queryById(_x) {
|
37
|
+
return _ref.apply(this, arguments);
|
38
|
+
};
|
39
|
+
}();
|
40
|
+
/**
|
41
|
+
* ci删除
|
42
|
+
* @param {string} id 实例id
|
43
|
+
* @returns {object} {
|
44
|
+
"code": "OK",
|
45
|
+
"message": null,
|
46
|
+
"data": 0 //0:成功 -1:失败
|
47
|
+
}
|
48
|
+
*/
|
49
|
+
|
50
|
+
export var deleteById = /*#__PURE__*/function () {
|
51
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id) {
|
52
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
53
|
+
while (1) {
|
54
|
+
switch (_context2.prev = _context2.next) {
|
55
|
+
case 0:
|
56
|
+
_context2.next = 2;
|
57
|
+
return request.post('/cmdb/v1/api/ci/deleteById', {
|
58
|
+
id: id
|
59
|
+
});
|
60
|
+
|
61
|
+
case 2:
|
62
|
+
return _context2.abrupt("return", _context2.sent);
|
63
|
+
|
64
|
+
case 3:
|
65
|
+
case "end":
|
66
|
+
return _context2.stop();
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}, _callee2);
|
70
|
+
}));
|
71
|
+
|
72
|
+
return function deleteById(_x2) {
|
73
|
+
return _ref2.apply(this, arguments);
|
74
|
+
};
|
75
|
+
}();
|
76
|
+
/**
|
77
|
+
* ci删除(批量)
|
78
|
+
* @param {array} keys [ "1513569" ,...]
|
79
|
+
* @returns {object} {
|
80
|
+
"code": "OK",
|
81
|
+
"message": null,
|
82
|
+
"data": 0 //0:成功 -1:失败
|
83
|
+
}
|
84
|
+
*/
|
85
|
+
|
86
|
+
export var batchDeleteById = /*#__PURE__*/function () {
|
87
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(keys) {
|
88
|
+
var ids;
|
89
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
90
|
+
while (1) {
|
91
|
+
switch (_context3.prev = _context3.next) {
|
92
|
+
case 0:
|
93
|
+
if (keys === void 0) {
|
94
|
+
keys = [];
|
95
|
+
}
|
96
|
+
|
97
|
+
// TODO 替换为map
|
98
|
+
ids = keys.map(function (key) {
|
99
|
+
return {
|
100
|
+
id: key
|
101
|
+
};
|
102
|
+
});
|
103
|
+
_context3.next = 4;
|
104
|
+
return request.post('/cmdb/v1/api/ci/batchDeleteById', ids);
|
105
|
+
|
106
|
+
case 4:
|
107
|
+
return _context3.abrupt("return", _context3.sent);
|
108
|
+
|
109
|
+
case 5:
|
110
|
+
case "end":
|
111
|
+
return _context3.stop();
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}, _callee3);
|
115
|
+
}));
|
116
|
+
|
117
|
+
return function batchDeleteById(_x3) {
|
118
|
+
return _ref3.apply(this, arguments);
|
119
|
+
};
|
120
|
+
}();
|
121
|
+
/**
|
122
|
+
* cmdm 通用查询接口
|
123
|
+
* @param {Object | string } condition 查询条件对象 或 接口原生查询字符串
|
124
|
+
* @param { string | Array } condition.ciType 单ci类型或ci类型数组
|
125
|
+
* @param { string } condition.searchValue 搜索的关键字
|
126
|
+
* @param { Array } condition.searchIndexArray 搜索的属性数组
|
127
|
+
* @param { Object } condition.alert 告警相关查询
|
128
|
+
* @param { Number } condition.alert.alert_type 告警类型
|
129
|
+
* @param { Number } condition.alert.alert_level 告警级别
|
130
|
+
* @param {string } sortIndex 排序索引
|
131
|
+
* @param { string } sortMethod 排序方法
|
132
|
+
* @param { string } currentPage 当前页
|
133
|
+
* @param { pageSize } pageSize 每页条数
|
134
|
+
* @param {Object} authOption 权限参数包装,透传给带权限的commonQuery接口
|
135
|
+
* @param {boolean} authOption.checkAuth 默认为true,是否只查看有权限的资源
|
136
|
+
*/
|
137
|
+
|
138
|
+
export var fetchCommonQuery = /*#__PURE__*/function () {
|
139
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(condition, sortIndex, sortMethod, currentPage, pageSize, sort, authOption) {
|
140
|
+
var newCondition, _ref5, _ref5$checkAuth, checkAuth, otherOption, url, sorts, params, response, _ref6, totalPage, pageIndex, data, result;
|
141
|
+
|
142
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
143
|
+
while (1) {
|
144
|
+
switch (_context4.prev = _context4.next) {
|
145
|
+
case 0:
|
146
|
+
newCondition = condition;
|
147
|
+
|
148
|
+
if (typeof newCondition !== 'string') {
|
149
|
+
newCondition = Object.keys(newCondition).reduce(function (param, current) {
|
150
|
+
if (current === 'ciType') {
|
151
|
+
param.push("type(" + (Array.isArray(newCondition[current]) ? newCondition[current].map(function (item) {
|
152
|
+
return "'" + item + "'";
|
153
|
+
}).toString() : "'" + newCondition[current] + "'") + ")");
|
154
|
+
} else if (current === 'principal') {
|
155
|
+
param.push(newCondition[current]);
|
156
|
+
} else if (current === 'searchValue' && newCondition.searchValue && newCondition.searchIndexArray) {
|
157
|
+
param.push("contain('" + newCondition.searchValue + "'," + newCondition.searchIndexArray.toString() + ")");
|
158
|
+
} else if (current === 'alert') {
|
159
|
+
var alert = Object.keys(newCondition[current]).map(function (item) {
|
160
|
+
return item + " = " + newCondition[current][item];
|
161
|
+
}).join(' && ');
|
162
|
+
param.push("alert(" + alert + ")");
|
163
|
+
}
|
164
|
+
|
165
|
+
return param;
|
166
|
+
}, []).join(' && ');
|
167
|
+
}
|
168
|
+
|
169
|
+
_ref5 = authOption || {}, _ref5$checkAuth = _ref5.checkAuth, checkAuth = _ref5$checkAuth === void 0 ? true : _ref5$checkAuth, otherOption = _objectWithoutPropertiesLoose(_ref5, _excluded); // const url = checkAuth
|
170
|
+
// ? '/appserver/api/v1/cmdb/ci/commonQuery'
|
171
|
+
// : '/api/v1/cmdb/ci/commonQuery';
|
172
|
+
// const url ='/api/v1/cmdb/ci/commonQuery';
|
173
|
+
// let params = {
|
174
|
+
// condition: condition.conditions
|
175
|
+
// ? `${newCondition} && ${condition.conditions}`
|
176
|
+
// : newCondition,
|
177
|
+
// sort: sort || `${sortIndex} ${sortMethod}`,
|
178
|
+
// currentPage,
|
179
|
+
// pageSize,
|
180
|
+
// };
|
181
|
+
// APPBIR MVP
|
182
|
+
// ------------------------------------------------
|
183
|
+
// TODO important 带确认权限接口是否可通 ---
|
184
|
+
|
185
|
+
url = checkAuth ? '/mdc/v1/api/cmdb/authority/commonQueryCiData' : '/mdc/v1/api/cmdb/commonQueryCiData';
|
186
|
+
sorts = sort ? sort.split(" ") : [sortIndex, sortMethod];
|
187
|
+
params = {
|
188
|
+
condition: condition.conditions ? newCondition + " && " + condition.conditions : newCondition,
|
189
|
+
// APPBIR MVP 临时去掉排序 等接口OK
|
190
|
+
// orders: [{
|
191
|
+
// name: sorts[0],
|
192
|
+
// type: sorts[1]
|
193
|
+
// }],
|
194
|
+
pageIndex: currentPage,
|
195
|
+
pageSize: pageSize
|
196
|
+
};
|
197
|
+
|
198
|
+
if (checkAuth && otherOption) {
|
199
|
+
params = _extends({}, params, otherOption);
|
200
|
+
} // 处理 返回结果
|
201
|
+
|
202
|
+
|
203
|
+
_context4.next = 9;
|
204
|
+
return request.post(url, params);
|
205
|
+
|
206
|
+
case 9:
|
207
|
+
response = _context4.sent;
|
208
|
+
// TODO ---
|
209
|
+
_ref6 = response || {}, totalPage = _ref6.totalPage, pageIndex = _ref6.pageIndex, data = _ref6.data, result = _objectWithoutPropertiesLoose(_ref6, _excluded2);
|
210
|
+
return _context4.abrupt("return", _extends({}, result, {
|
211
|
+
total: totalPage,
|
212
|
+
page: pageIndex,
|
213
|
+
content: data
|
214
|
+
}));
|
215
|
+
|
216
|
+
case 12:
|
217
|
+
case "end":
|
218
|
+
return _context4.stop();
|
219
|
+
}
|
220
|
+
}
|
221
|
+
}, _callee4);
|
222
|
+
}));
|
223
|
+
|
224
|
+
return function fetchCommonQuery(_x4, _x5, _x6, _x7, _x8, _x9, _x10) {
|
225
|
+
return _ref4.apply(this, arguments);
|
226
|
+
};
|
227
|
+
}();
|
228
|
+
/**
|
229
|
+
* cmdb实例查询接口(不涉及权限)
|
230
|
+
* @param {Object} param
|
231
|
+
* @returns
|
232
|
+
*/
|
233
|
+
|
234
|
+
export function commonQuery(_x11) {
|
235
|
+
return _commonQuery.apply(this, arguments);
|
236
|
+
} // 批量属性更新
|
237
|
+
|
238
|
+
function _commonQuery() {
|
239
|
+
_commonQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(param) {
|
240
|
+
return _regeneratorRuntime.wrap(function _callee18$(_context18) {
|
241
|
+
while (1) {
|
242
|
+
switch (_context18.prev = _context18.next) {
|
243
|
+
case 0:
|
244
|
+
_context18.next = 2;
|
245
|
+
return request.post('/cmdb/v1/api/ci/commonQuery', param);
|
246
|
+
|
247
|
+
case 2:
|
248
|
+
return _context18.abrupt("return", _context18.sent);
|
249
|
+
|
250
|
+
case 3:
|
251
|
+
case "end":
|
252
|
+
return _context18.stop();
|
253
|
+
}
|
254
|
+
}
|
255
|
+
}, _callee18);
|
256
|
+
}));
|
257
|
+
return _commonQuery.apply(this, arguments);
|
258
|
+
}
|
259
|
+
|
260
|
+
export var batchUpdateAttributes = /*#__PURE__*/function () {
|
261
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(values, fieldName) {
|
262
|
+
var aa, _aa;
|
263
|
+
|
264
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
265
|
+
while (1) {
|
266
|
+
switch (_context5.prev = _context5.next) {
|
267
|
+
case 0:
|
268
|
+
if (!fieldName) {
|
269
|
+
_context5.next = 8;
|
270
|
+
break;
|
271
|
+
}
|
272
|
+
|
273
|
+
// 传了要更新的属性名,更新某一个属性
|
274
|
+
aa = {};
|
275
|
+
aa[fieldName] = values[fieldName];
|
276
|
+
_context5.next = 5;
|
277
|
+
return request.post('/cmdb/v1/api/ci/batchUpdateAttributes', [{
|
278
|
+
id: values.id,
|
279
|
+
attributes: aa
|
280
|
+
}]);
|
281
|
+
|
282
|
+
case 5:
|
283
|
+
return _context5.abrupt("return", _context5.sent);
|
284
|
+
|
285
|
+
case 8:
|
286
|
+
if (!Array.isArray(values)) {
|
287
|
+
_context5.next = 12;
|
288
|
+
break;
|
289
|
+
}
|
290
|
+
|
291
|
+
_context5.next = 11;
|
292
|
+
return request.post('/cmdb/v1/api/ci/batchUpdateAttributes', values);
|
293
|
+
|
294
|
+
case 11:
|
295
|
+
return _context5.abrupt("return", _context5.sent);
|
296
|
+
|
297
|
+
case 12:
|
298
|
+
_aa = values.id;
|
299
|
+
delete values.id;
|
300
|
+
_context5.next = 16;
|
301
|
+
return request.post('/cmdb/v1/api/ci/batchUpdateAttributes', [{
|
302
|
+
id: _aa,
|
303
|
+
attributes: values
|
304
|
+
}]);
|
305
|
+
|
306
|
+
case 16:
|
307
|
+
return _context5.abrupt("return", _context5.sent);
|
308
|
+
|
309
|
+
case 17:
|
310
|
+
case "end":
|
311
|
+
return _context5.stop();
|
312
|
+
}
|
313
|
+
}
|
314
|
+
}, _callee5);
|
315
|
+
}));
|
316
|
+
|
317
|
+
return function batchUpdateAttributes(_x12, _x13) {
|
318
|
+
return _ref7.apply(this, arguments);
|
319
|
+
};
|
320
|
+
}(); // 创建单个ci实例
|
321
|
+
|
322
|
+
export var createInstance = /*#__PURE__*/function () {
|
323
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(values) {
|
324
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
325
|
+
while (1) {
|
326
|
+
switch (_context6.prev = _context6.next) {
|
327
|
+
case 0:
|
328
|
+
_context6.next = 2;
|
329
|
+
return request.post('/cmdb/v1/api/ci/create', values);
|
330
|
+
|
331
|
+
case 2:
|
332
|
+
return _context6.abrupt("return", _context6.sent);
|
333
|
+
|
334
|
+
case 3:
|
335
|
+
case "end":
|
336
|
+
return _context6.stop();
|
337
|
+
}
|
338
|
+
}
|
339
|
+
}, _callee6);
|
340
|
+
}));
|
341
|
+
|
342
|
+
return function createInstance(_x14) {
|
343
|
+
return _ref8.apply(this, arguments);
|
344
|
+
};
|
345
|
+
}();
|
346
|
+
/**
|
347
|
+
* 改变监控状态
|
348
|
+
* @param {object} param 查询传参{"id":"xxxx","manageStatus": 3,//已监控:3,加入监控中:2,取消监控中:1,未监控:0}
|
349
|
+
* @returns {object}
|
350
|
+
*/
|
351
|
+
|
352
|
+
export function changeManageStatus(_x15) {
|
353
|
+
return _changeManageStatus.apply(this, arguments);
|
354
|
+
}
|
355
|
+
/**
|
356
|
+
* 批量改变监控状态
|
357
|
+
* @param {Array} param 查询传参[{"id":"xxxx","manageStatus": 3,//已监控:3,加入监控中:2,取消监控中:1,未监控:0}]
|
358
|
+
* @returns {object}
|
359
|
+
*/
|
360
|
+
|
361
|
+
function _changeManageStatus() {
|
362
|
+
_changeManageStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(param) {
|
363
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context19) {
|
364
|
+
while (1) {
|
365
|
+
switch (_context19.prev = _context19.next) {
|
366
|
+
case 0:
|
367
|
+
_context19.next = 2;
|
368
|
+
return request.post('/cmdb/v1/api/ci/changeManageStatus', param);
|
369
|
+
|
370
|
+
case 2:
|
371
|
+
return _context19.abrupt("return", _context19.sent);
|
372
|
+
|
373
|
+
case 3:
|
374
|
+
case "end":
|
375
|
+
return _context19.stop();
|
376
|
+
}
|
377
|
+
}
|
378
|
+
}, _callee19);
|
379
|
+
}));
|
380
|
+
return _changeManageStatus.apply(this, arguments);
|
381
|
+
}
|
382
|
+
|
383
|
+
export function batchChangeManageStatus(_x16) {
|
384
|
+
return _batchChangeManageStatus.apply(this, arguments);
|
385
|
+
}
|
386
|
+
/**
|
387
|
+
* 计数函数
|
388
|
+
* @param {object} param 复杂对象,具体看后端给的API说明
|
389
|
+
* @return eg:[
|
390
|
+
{
|
391
|
+
"count": 0
|
392
|
+
}
|
393
|
+
]
|
394
|
+
*/
|
395
|
+
|
396
|
+
function _batchChangeManageStatus() {
|
397
|
+
_batchChangeManageStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(param) {
|
398
|
+
return _regeneratorRuntime.wrap(function _callee20$(_context20) {
|
399
|
+
while (1) {
|
400
|
+
switch (_context20.prev = _context20.next) {
|
401
|
+
case 0:
|
402
|
+
_context20.next = 2;
|
403
|
+
return request.post('/cmdb/v1/api/ci/batchChangeManageStatus', param);
|
404
|
+
|
405
|
+
case 2:
|
406
|
+
return _context20.abrupt("return", _context20.sent);
|
407
|
+
|
408
|
+
case 3:
|
409
|
+
case "end":
|
410
|
+
return _context20.stop();
|
411
|
+
}
|
412
|
+
}
|
413
|
+
}, _callee20);
|
414
|
+
}));
|
415
|
+
return _batchChangeManageStatus.apply(this, arguments);
|
416
|
+
}
|
417
|
+
|
418
|
+
export function commonCount(_x17) {
|
419
|
+
return _commonCount.apply(this, arguments);
|
420
|
+
}
|
421
|
+
/**
|
422
|
+
* 批量改变监控状态
|
423
|
+
* @param {Array} param 传参['xx']
|
424
|
+
* @returns {object}
|
425
|
+
*/
|
426
|
+
|
427
|
+
function _commonCount() {
|
428
|
+
_commonCount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(param) {
|
429
|
+
return _regeneratorRuntime.wrap(function _callee21$(_context21) {
|
430
|
+
while (1) {
|
431
|
+
switch (_context21.prev = _context21.next) {
|
432
|
+
case 0:
|
433
|
+
_context21.next = 2;
|
434
|
+
return request.post('/cmdb/v1/api/ci/commonCount', param);
|
435
|
+
|
436
|
+
case 2:
|
437
|
+
return _context21.abrupt("return", _context21.sent);
|
438
|
+
|
439
|
+
case 3:
|
440
|
+
case "end":
|
441
|
+
return _context21.stop();
|
442
|
+
}
|
443
|
+
}
|
444
|
+
}, _callee21);
|
445
|
+
}));
|
446
|
+
return _commonCount.apply(this, arguments);
|
447
|
+
}
|
448
|
+
|
449
|
+
export function queryCiWithComponents(_x18) {
|
450
|
+
return _queryCiWithComponents.apply(this, arguments);
|
451
|
+
}
|
452
|
+
/**
|
453
|
+
* 连接关系忽略列表查询
|
454
|
+
* @param {*} relationType 关系类型编码,为空不做限制
|
455
|
+
* @param {*} currentPage 当前页码
|
456
|
+
* @param {*} pageSize 单页数据量
|
457
|
+
* @param {*} condition 检索条件,可为空,每个检索项的语法类似common query接口
|
458
|
+
* @param {*} sort 排序对象
|
459
|
+
*/
|
460
|
+
|
461
|
+
function _queryCiWithComponents() {
|
462
|
+
_queryCiWithComponents = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(mainCiIds) {
|
463
|
+
return _regeneratorRuntime.wrap(function _callee22$(_context22) {
|
464
|
+
while (1) {
|
465
|
+
switch (_context22.prev = _context22.next) {
|
466
|
+
case 0:
|
467
|
+
_context22.next = 2;
|
468
|
+
return request.post('/cmdb/v1/api/ci/queryCiWithComponents', mainCiIds);
|
469
|
+
|
470
|
+
case 2:
|
471
|
+
return _context22.abrupt("return", _context22.sent);
|
472
|
+
|
473
|
+
case 3:
|
474
|
+
case "end":
|
475
|
+
return _context22.stop();
|
476
|
+
}
|
477
|
+
}
|
478
|
+
}, _callee22);
|
479
|
+
}));
|
480
|
+
return _queryCiWithComponents.apply(this, arguments);
|
481
|
+
}
|
482
|
+
|
483
|
+
export function queryPageIgnoreRelations(_x19, _x20, _x21, _x22, _x23) {
|
484
|
+
return _queryPageIgnoreRelations.apply(this, arguments);
|
485
|
+
}
|
486
|
+
/**
|
487
|
+
* 忽略的连接关系批量删除
|
488
|
+
* @param {*} ids id集合
|
489
|
+
*/
|
490
|
+
|
491
|
+
function _queryPageIgnoreRelations() {
|
492
|
+
_queryPageIgnoreRelations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(relationType, currentPage, pageSize, condition, sort) {
|
493
|
+
return _regeneratorRuntime.wrap(function _callee23$(_context23) {
|
494
|
+
while (1) {
|
495
|
+
switch (_context23.prev = _context23.next) {
|
496
|
+
case 0:
|
497
|
+
_context23.next = 2;
|
498
|
+
return request.post('/cmdb/v1/api/relation/ignore/list', _extends({
|
499
|
+
relationType: relationType,
|
500
|
+
currentPage: currentPage,
|
501
|
+
pageSize: pageSize
|
502
|
+
}, condition ? {
|
503
|
+
condition: condition
|
504
|
+
} : {}, sort ? {
|
505
|
+
sort: sort
|
506
|
+
} : {}));
|
507
|
+
|
508
|
+
case 2:
|
509
|
+
return _context23.abrupt("return", _context23.sent);
|
510
|
+
|
511
|
+
case 3:
|
512
|
+
case "end":
|
513
|
+
return _context23.stop();
|
514
|
+
}
|
515
|
+
}
|
516
|
+
}, _callee23);
|
517
|
+
}));
|
518
|
+
return _queryPageIgnoreRelations.apply(this, arguments);
|
519
|
+
}
|
520
|
+
|
521
|
+
export function deleteIgnoreRelations(_x24) {
|
522
|
+
return _deleteIgnoreRelations.apply(this, arguments);
|
523
|
+
} // 上传文件
|
524
|
+
|
525
|
+
function _deleteIgnoreRelations() {
|
526
|
+
_deleteIgnoreRelations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(ids) {
|
527
|
+
return _regeneratorRuntime.wrap(function _callee24$(_context24) {
|
528
|
+
while (1) {
|
529
|
+
switch (_context24.prev = _context24.next) {
|
530
|
+
case 0:
|
531
|
+
_context24.next = 2;
|
532
|
+
return request.post('/cmdb/v1/api/relation/ignore/batchDeleteById', ids.map(function (id) {
|
533
|
+
return {
|
534
|
+
id: id
|
535
|
+
};
|
536
|
+
}));
|
537
|
+
|
538
|
+
case 2:
|
539
|
+
return _context24.abrupt("return", _context24.sent);
|
540
|
+
|
541
|
+
case 3:
|
542
|
+
case "end":
|
543
|
+
return _context24.stop();
|
544
|
+
}
|
545
|
+
}
|
546
|
+
}, _callee24);
|
547
|
+
}));
|
548
|
+
return _deleteIgnoreRelations.apply(this, arguments);
|
549
|
+
}
|
550
|
+
|
551
|
+
export var uploadFile = /*#__PURE__*/function () {
|
552
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(files, userId, modelType) {
|
553
|
+
var formData, names, originFiles, config, result;
|
554
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
555
|
+
while (1) {
|
556
|
+
switch (_context7.prev = _context7.next) {
|
557
|
+
case 0:
|
558
|
+
formData = new FormData(); // 用户id
|
559
|
+
|
560
|
+
formData.append('userId', userId);
|
561
|
+
modelType && formData.append('modelType', modelType);
|
562
|
+
names = [];
|
563
|
+
originFiles = [];
|
564
|
+
files.forEach(function (_ref10) {
|
565
|
+
var name = _ref10.name,
|
566
|
+
originFileObj = _ref10.originFileObj;
|
567
|
+
names.push(name);
|
568
|
+
originFiles.push(originFileObj);
|
569
|
+
formData.append('files', originFileObj, name);
|
570
|
+
});
|
571
|
+
config = {
|
572
|
+
headers: {
|
573
|
+
'Content-Type': "multipart/form-data;boundary=" + new Date().getTime()
|
574
|
+
}
|
575
|
+
};
|
576
|
+
_context7.next = 9;
|
577
|
+
return request.post('/cmdb/v1/api/import', formData, config);
|
578
|
+
|
579
|
+
case 9:
|
580
|
+
result = _context7.sent;
|
581
|
+
return _context7.abrupt("return", result);
|
582
|
+
|
583
|
+
case 11:
|
584
|
+
case "end":
|
585
|
+
return _context7.stop();
|
586
|
+
}
|
587
|
+
}
|
588
|
+
}, _callee7);
|
589
|
+
}));
|
590
|
+
|
591
|
+
return function uploadFile(_x25, _x26, _x27) {
|
592
|
+
return _ref9.apply(this, arguments);
|
593
|
+
};
|
594
|
+
}(); // 关闭提示
|
595
|
+
|
596
|
+
export var closeRecord = /*#__PURE__*/function () {
|
597
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(userId, modelType) {
|
598
|
+
var result;
|
599
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
600
|
+
while (1) {
|
601
|
+
switch (_context8.prev = _context8.next) {
|
602
|
+
case 0:
|
603
|
+
_context8.next = 2;
|
604
|
+
return request.post('/cmdb/v1/api/delete/import/record', {
|
605
|
+
userId: userId,
|
606
|
+
modelType: modelType
|
607
|
+
});
|
608
|
+
|
609
|
+
case 2:
|
610
|
+
result = _context8.sent;
|
611
|
+
return _context8.abrupt("return", result);
|
612
|
+
|
613
|
+
case 4:
|
614
|
+
case "end":
|
615
|
+
return _context8.stop();
|
616
|
+
}
|
617
|
+
}
|
618
|
+
}, _callee8);
|
619
|
+
}));
|
620
|
+
|
621
|
+
return function closeRecord(_x28, _x29) {
|
622
|
+
return _ref11.apply(this, arguments);
|
623
|
+
};
|
624
|
+
}(); // 获取提示信息
|
625
|
+
|
626
|
+
export var getRecord = /*#__PURE__*/function () {
|
627
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(userId, modelType) {
|
628
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
629
|
+
while (1) {
|
630
|
+
switch (_context9.prev = _context9.next) {
|
631
|
+
case 0:
|
632
|
+
_context9.next = 2;
|
633
|
+
return request.post('/cmdb/v1/api/get/import/record', {
|
634
|
+
userId: userId,
|
635
|
+
modelType: modelType
|
636
|
+
});
|
637
|
+
|
638
|
+
case 2:
|
639
|
+
return _context9.abrupt("return", _context9.sent);
|
640
|
+
|
641
|
+
case 3:
|
642
|
+
case "end":
|
643
|
+
return _context9.stop();
|
644
|
+
}
|
645
|
+
}
|
646
|
+
}, _callee9);
|
647
|
+
}));
|
648
|
+
|
649
|
+
return function getRecord(_x30, _x31) {
|
650
|
+
return _ref12.apply(this, arguments);
|
651
|
+
};
|
652
|
+
}();
|
653
|
+
/**
|
654
|
+
* 批量创建关系
|
655
|
+
* @param {*} params
|
656
|
+
* @returns
|
657
|
+
*/
|
658
|
+
|
659
|
+
export var batchCreateRelation = /*#__PURE__*/function () {
|
660
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(params) {
|
661
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
662
|
+
while (1) {
|
663
|
+
switch (_context10.prev = _context10.next) {
|
664
|
+
case 0:
|
665
|
+
_context10.next = 2;
|
666
|
+
return request.post('/cmdb/v1/api/relation/batchCreate', params);
|
667
|
+
|
668
|
+
case 2:
|
669
|
+
return _context10.abrupt("return", _context10.sent);
|
670
|
+
|
671
|
+
case 3:
|
672
|
+
case "end":
|
673
|
+
return _context10.stop();
|
674
|
+
}
|
675
|
+
}
|
676
|
+
}, _callee10);
|
677
|
+
}));
|
678
|
+
|
679
|
+
return function batchCreateRelation(_x32) {
|
680
|
+
return _ref13.apply(this, arguments);
|
681
|
+
};
|
682
|
+
}();
|
683
|
+
export var queryRelationByEndpoint = /*#__PURE__*/function () {
|
684
|
+
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(id) {
|
685
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
686
|
+
while (1) {
|
687
|
+
switch (_context11.prev = _context11.next) {
|
688
|
+
case 0:
|
689
|
+
_context11.next = 2;
|
690
|
+
return request.post('/cmdb/v1/api/relation/queryByEndpoint', {
|
691
|
+
id: id
|
692
|
+
});
|
693
|
+
|
694
|
+
case 2:
|
695
|
+
return _context11.abrupt("return", _context11.sent);
|
696
|
+
|
697
|
+
case 3:
|
698
|
+
case "end":
|
699
|
+
return _context11.stop();
|
700
|
+
}
|
701
|
+
}
|
702
|
+
}, _callee11);
|
703
|
+
}));
|
704
|
+
|
705
|
+
return function queryRelationByEndpoint(_x33) {
|
706
|
+
return _ref14.apply(this, arguments);
|
707
|
+
};
|
708
|
+
}();
|
709
|
+
/**
|
710
|
+
* 批量更新关系
|
711
|
+
* @param {*} params
|
712
|
+
* @returns
|
713
|
+
*/
|
714
|
+
|
715
|
+
export var batchUpdateRelation = /*#__PURE__*/function () {
|
716
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(params) {
|
717
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
718
|
+
while (1) {
|
719
|
+
switch (_context12.prev = _context12.next) {
|
720
|
+
case 0:
|
721
|
+
_context12.next = 2;
|
722
|
+
return request.post('/cmdb/v1/api/relation/batchUpdateAttributes', params);
|
723
|
+
|
724
|
+
case 2:
|
725
|
+
return _context12.abrupt("return", _context12.sent);
|
726
|
+
|
727
|
+
case 3:
|
728
|
+
case "end":
|
729
|
+
return _context12.stop();
|
730
|
+
}
|
731
|
+
}
|
732
|
+
}, _callee12);
|
733
|
+
}));
|
734
|
+
|
735
|
+
return function batchUpdateRelation(_x34) {
|
736
|
+
return _ref15.apply(this, arguments);
|
737
|
+
};
|
738
|
+
}();
|
739
|
+
/**
|
740
|
+
* 删除关系,添加到忽略
|
741
|
+
* @param {*} id 关系id
|
742
|
+
* @returns
|
743
|
+
*/
|
744
|
+
|
745
|
+
export var deleteRelation = /*#__PURE__*/function () {
|
746
|
+
var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(id) {
|
747
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
748
|
+
while (1) {
|
749
|
+
switch (_context13.prev = _context13.next) {
|
750
|
+
case 0:
|
751
|
+
_context13.next = 2;
|
752
|
+
return request.post('/cmdb/v1/api/relation/delete', {
|
753
|
+
id: id
|
754
|
+
});
|
755
|
+
|
756
|
+
case 2:
|
757
|
+
return _context13.abrupt("return", _context13.sent);
|
758
|
+
|
759
|
+
case 3:
|
760
|
+
case "end":
|
761
|
+
return _context13.stop();
|
762
|
+
}
|
763
|
+
}
|
764
|
+
}, _callee13);
|
765
|
+
}));
|
766
|
+
|
767
|
+
return function deleteRelation(_x35) {
|
768
|
+
return _ref16.apply(this, arguments);
|
769
|
+
};
|
770
|
+
}();
|
771
|
+
/**
|
772
|
+
* 批量删除关系
|
773
|
+
* @param {[{id: string}]} params
|
774
|
+
* @returns
|
775
|
+
*/
|
776
|
+
|
777
|
+
export var batchDeleteRelation = /*#__PURE__*/function () {
|
778
|
+
var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(params) {
|
779
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
780
|
+
while (1) {
|
781
|
+
switch (_context14.prev = _context14.next) {
|
782
|
+
case 0:
|
783
|
+
_context14.next = 2;
|
784
|
+
return request.post('/cmdb/v1/api/relation/batchDelete', params);
|
785
|
+
|
786
|
+
case 2:
|
787
|
+
return _context14.abrupt("return", _context14.sent);
|
788
|
+
|
789
|
+
case 3:
|
790
|
+
case "end":
|
791
|
+
return _context14.stop();
|
792
|
+
}
|
793
|
+
}
|
794
|
+
}, _callee14);
|
795
|
+
}));
|
796
|
+
|
797
|
+
return function batchDeleteRelation(_x36) {
|
798
|
+
return _ref17.apply(this, arguments);
|
799
|
+
};
|
800
|
+
}();
|
801
|
+
/**
|
802
|
+
* 强制删除关系
|
803
|
+
* @param {*} id 关系id
|
804
|
+
* @returns
|
805
|
+
*/
|
806
|
+
|
807
|
+
export var forceDeleteRelation = /*#__PURE__*/function () {
|
808
|
+
var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(id) {
|
809
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
810
|
+
while (1) {
|
811
|
+
switch (_context15.prev = _context15.next) {
|
812
|
+
case 0:
|
813
|
+
_context15.next = 2;
|
814
|
+
return batchDeleteRelation([{
|
815
|
+
id: id,
|
816
|
+
force: true
|
817
|
+
}]);
|
818
|
+
|
819
|
+
case 2:
|
820
|
+
return _context15.abrupt("return", _context15.sent);
|
821
|
+
|
822
|
+
case 3:
|
823
|
+
case "end":
|
824
|
+
return _context15.stop();
|
825
|
+
}
|
826
|
+
}
|
827
|
+
}, _callee15);
|
828
|
+
}));
|
829
|
+
|
830
|
+
return function forceDeleteRelation(_x37) {
|
831
|
+
return _ref18.apply(this, arguments);
|
832
|
+
};
|
833
|
+
}();
|
834
|
+
/**
|
835
|
+
* 查询关系
|
836
|
+
* @param {[{id: string}]} params
|
837
|
+
* @returns
|
838
|
+
*/
|
839
|
+
|
840
|
+
export var batchQueryRelationById = /*#__PURE__*/function () {
|
841
|
+
var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(params) {
|
842
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
843
|
+
while (1) {
|
844
|
+
switch (_context16.prev = _context16.next) {
|
845
|
+
case 0:
|
846
|
+
_context16.next = 2;
|
847
|
+
return request.post('/cmdb/v1/api/relation/batchQueryById', params);
|
848
|
+
|
849
|
+
case 2:
|
850
|
+
return _context16.abrupt("return", _context16.sent);
|
851
|
+
|
852
|
+
case 3:
|
853
|
+
case "end":
|
854
|
+
return _context16.stop();
|
855
|
+
}
|
856
|
+
}
|
857
|
+
}, _callee16);
|
858
|
+
}));
|
859
|
+
|
860
|
+
return function batchQueryRelationById(_x38) {
|
861
|
+
return _ref19.apply(this, arguments);
|
862
|
+
};
|
863
|
+
}();
|
864
|
+
/**
|
865
|
+
* 查询关系
|
866
|
+
* @param {*} ids 关系ids
|
867
|
+
* @returns
|
868
|
+
*/
|
869
|
+
|
870
|
+
export var queryRelationByIds = /*#__PURE__*/function () {
|
871
|
+
var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(ids) {
|
872
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
873
|
+
while (1) {
|
874
|
+
switch (_context17.prev = _context17.next) {
|
875
|
+
case 0:
|
876
|
+
_context17.next = 2;
|
877
|
+
return batchQueryRelationById(ids.map(function (id) {
|
878
|
+
return {
|
879
|
+
id: id
|
880
|
+
};
|
881
|
+
}));
|
882
|
+
|
883
|
+
case 2:
|
884
|
+
return _context17.abrupt("return", _context17.sent);
|
885
|
+
|
886
|
+
case 3:
|
887
|
+
case "end":
|
888
|
+
return _context17.stop();
|
889
|
+
}
|
890
|
+
}
|
891
|
+
}, _callee17);
|
892
|
+
}));
|
893
|
+
|
894
|
+
return function queryRelationByIds(_x39) {
|
895
|
+
return _ref20.apply(this, arguments);
|
896
|
+
};
|
897
|
+
}();
|