@riil-frontend/component-topology 7.0.0-dev.9 → 7.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/1.js +2 -2
- package/build/2.js +1 -1
- package/build/index.css +1 -1
- package/build/index.js +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/AttributeMetricDisplay.js +24 -10
- package/es/core/models/TopoApp.js +5 -3
- package/es/core/models/attributeFormatter/index.js +4 -0
- package/es/core/models/utils/linkUtils.js +0 -3
- package/es/core/store/models/topoMod.js +7 -6
- package/es/core/utils/manageStatusUtil.js +4 -0
- 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/style.js +1 -1
- package/es/utils/topoData.js +6 -67
- 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/AttributeMetricDisplay.js +25 -10
- package/lib/core/models/TopoApp.js +5 -3
- package/lib/core/models/attributeFormatter/index.js +4 -0
- package/lib/core/models/utils/linkUtils.js +0 -5
- package/lib/core/store/models/topoMod.js +9 -6
- package/lib/core/utils/manageStatusUtil.js +9 -0
- 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/style.js +1 -1
- package/lib/utils/topoData.js +7 -75
- 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,1283 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
4
|
+
import { request } from '@riil-frontend/component-topology-utils';
|
5
|
+
import { isNull } from '@riil-frontend/utils';
|
6
|
+
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
7
|
+
import { DICT } from "../utils/storage";
|
8
|
+
import { modelDictList } from "./mdc";
|
9
|
+
/**
|
10
|
+
* 查询 CI 组件信息(又实例的)
|
11
|
+
*/
|
12
|
+
|
13
|
+
export var getCommonCount = /*#__PURE__*/function () {
|
14
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(code) {
|
15
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
16
|
+
while (1) {
|
17
|
+
switch (_context.prev = _context.next) {
|
18
|
+
case 0:
|
19
|
+
_context.next = 2;
|
20
|
+
return request.post('/cmdb/v1/api/ci/commonCount', {
|
21
|
+
condition: "\"principal(type('" + code + "'))\"",
|
22
|
+
groupKeys: ['ci_type']
|
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 getCommonCount(_x) {
|
37
|
+
return _ref.apply(this, arguments);
|
38
|
+
};
|
39
|
+
}();
|
40
|
+
/**
|
41
|
+
* 查询 CI 组件信息
|
42
|
+
*/
|
43
|
+
|
44
|
+
export var getComponents = /*#__PURE__*/function () {
|
45
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(code) {
|
46
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
47
|
+
while (1) {
|
48
|
+
switch (_context2.prev = _context2.next) {
|
49
|
+
case 0:
|
50
|
+
_context2.next = 2;
|
51
|
+
return request.post('/model/v1/api/getComponents', {
|
52
|
+
code: code
|
53
|
+
});
|
54
|
+
|
55
|
+
case 2:
|
56
|
+
return _context2.abrupt("return", _context2.sent);
|
57
|
+
|
58
|
+
case 3:
|
59
|
+
case "end":
|
60
|
+
return _context2.stop();
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}, _callee2);
|
64
|
+
}));
|
65
|
+
|
66
|
+
return function getComponents(_x2) {
|
67
|
+
return _ref2.apply(this, arguments);
|
68
|
+
};
|
69
|
+
}();
|
70
|
+
/**
|
71
|
+
* 查询关系类型定义
|
72
|
+
*/
|
73
|
+
|
74
|
+
export var getAllRelationType = /*#__PURE__*/function () {
|
75
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
76
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
77
|
+
while (1) {
|
78
|
+
switch (_context3.prev = _context3.next) {
|
79
|
+
case 0:
|
80
|
+
_context3.next = 2;
|
81
|
+
return request.post('/model/v1/api/getAllRelationType');
|
82
|
+
|
83
|
+
case 2:
|
84
|
+
return _context3.abrupt("return", _context3.sent);
|
85
|
+
|
86
|
+
case 3:
|
87
|
+
case "end":
|
88
|
+
return _context3.stop();
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}, _callee3);
|
92
|
+
}));
|
93
|
+
|
94
|
+
return function getAllRelationType() {
|
95
|
+
return _ref3.apply(this, arguments);
|
96
|
+
};
|
97
|
+
}();
|
98
|
+
/**
|
99
|
+
* ci类型树(包含组件)
|
100
|
+
* @param {string} moduleName 标识模块名
|
101
|
+
*/
|
102
|
+
|
103
|
+
export var getCiTypes = /*#__PURE__*/function () {
|
104
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(moduleName) {
|
105
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
106
|
+
while (1) {
|
107
|
+
switch (_context4.prev = _context4.next) {
|
108
|
+
case 0:
|
109
|
+
_context4.next = 2;
|
110
|
+
return request.post('/model/v1/api/getCiTypes', {
|
111
|
+
moduleName: moduleName
|
112
|
+
});
|
113
|
+
|
114
|
+
case 2:
|
115
|
+
return _context4.abrupt("return", _context4.sent);
|
116
|
+
|
117
|
+
case 3:
|
118
|
+
case "end":
|
119
|
+
return _context4.stop();
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}, _callee4);
|
123
|
+
}));
|
124
|
+
|
125
|
+
return function getCiTypes(_x3) {
|
126
|
+
return _ref4.apply(this, arguments);
|
127
|
+
};
|
128
|
+
}();
|
129
|
+
/**
|
130
|
+
* 模型树拖动接口,用于节点拖拽
|
131
|
+
*/
|
132
|
+
|
133
|
+
export var dragTree = /*#__PURE__*/function () {
|
134
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(param) {
|
135
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
136
|
+
while (1) {
|
137
|
+
switch (_context5.prev = _context5.next) {
|
138
|
+
case 0:
|
139
|
+
_context5.next = 2;
|
140
|
+
return request.post('/model/v1/api/dragTree', param);
|
141
|
+
|
142
|
+
case 2:
|
143
|
+
return _context5.abrupt("return", _context5.sent);
|
144
|
+
|
145
|
+
case 3:
|
146
|
+
case "end":
|
147
|
+
return _context5.stop();
|
148
|
+
}
|
149
|
+
}
|
150
|
+
}, _callee5);
|
151
|
+
}));
|
152
|
+
|
153
|
+
return function dragTree(_x4) {
|
154
|
+
return _ref5.apply(this, arguments);
|
155
|
+
};
|
156
|
+
}();
|
157
|
+
/**
|
158
|
+
* 模型改造树
|
159
|
+
*/
|
160
|
+
|
161
|
+
export var getModelTree = /*#__PURE__*/function () {
|
162
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
163
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
164
|
+
while (1) {
|
165
|
+
switch (_context6.prev = _context6.next) {
|
166
|
+
case 0:
|
167
|
+
_context6.next = 2;
|
168
|
+
return request.post('/mdc/v1/api/model-asset/tree');
|
169
|
+
|
170
|
+
case 2:
|
171
|
+
return _context6.abrupt("return", _context6.sent);
|
172
|
+
|
173
|
+
case 3:
|
174
|
+
case "end":
|
175
|
+
return _context6.stop();
|
176
|
+
}
|
177
|
+
}
|
178
|
+
}, _callee6);
|
179
|
+
}));
|
180
|
+
|
181
|
+
return function getModelTree() {
|
182
|
+
return _ref6.apply(this, arguments);
|
183
|
+
};
|
184
|
+
}();
|
185
|
+
/**
|
186
|
+
* 验证CI名称
|
187
|
+
* @param {Object} param - 验证值对象.
|
188
|
+
* @param {string} param.flag - 验证那种类型的名称.
|
189
|
+
1. 验证ci:flag=ci,
|
190
|
+
2. 验证 ci 属性: flag=ci.attribute,
|
191
|
+
3. 验证关系: flag=relation,
|
192
|
+
4. 验证数据字典: flag=dict
|
193
|
+
5. 验证关系类型: flag=relationType
|
194
|
+
* @param {string} employee.data - 被验证的值. eg:{"name":"未命名类型-1"}
|
195
|
+
*/
|
196
|
+
|
197
|
+
export var verify = /*#__PURE__*/function () {
|
198
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(param) {
|
199
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
200
|
+
while (1) {
|
201
|
+
switch (_context7.prev = _context7.next) {
|
202
|
+
case 0:
|
203
|
+
_context7.next = 2;
|
204
|
+
return request.post('/model/v1/api/verify', param);
|
205
|
+
|
206
|
+
case 2:
|
207
|
+
return _context7.abrupt("return", _context7.sent);
|
208
|
+
|
209
|
+
case 3:
|
210
|
+
case "end":
|
211
|
+
return _context7.stop();
|
212
|
+
}
|
213
|
+
}
|
214
|
+
}, _callee7);
|
215
|
+
}));
|
216
|
+
|
217
|
+
return function verify(_x5) {
|
218
|
+
return _ref7.apply(this, arguments);
|
219
|
+
};
|
220
|
+
}();
|
221
|
+
/**
|
222
|
+
* 获得CI指标
|
223
|
+
*/
|
224
|
+
|
225
|
+
export var getCiMetric = /*#__PURE__*/function () {
|
226
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(ciCode) {
|
227
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
228
|
+
while (1) {
|
229
|
+
switch (_context8.prev = _context8.next) {
|
230
|
+
case 0:
|
231
|
+
_context8.next = 2;
|
232
|
+
return request.post('/model/v1/api/getCiMetric', {
|
233
|
+
ciCode: ciCode
|
234
|
+
});
|
235
|
+
|
236
|
+
case 2:
|
237
|
+
return _context8.abrupt("return", _context8.sent);
|
238
|
+
|
239
|
+
case 3:
|
240
|
+
case "end":
|
241
|
+
return _context8.stop();
|
242
|
+
}
|
243
|
+
}
|
244
|
+
}, _callee8);
|
245
|
+
}));
|
246
|
+
|
247
|
+
return function getCiMetric(_x6) {
|
248
|
+
return _ref8.apply(this, arguments);
|
249
|
+
};
|
250
|
+
}();
|
251
|
+
/**
|
252
|
+
* 所有领域
|
253
|
+
* @returns {array} 对象数组
|
254
|
+
*/
|
255
|
+
|
256
|
+
export var getDomains = /*#__PURE__*/function () {
|
257
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
258
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
259
|
+
while (1) {
|
260
|
+
switch (_context9.prev = _context9.next) {
|
261
|
+
case 0:
|
262
|
+
_context9.next = 2;
|
263
|
+
return request.post('/model/v1/api/getDomains');
|
264
|
+
|
265
|
+
case 2:
|
266
|
+
return _context9.abrupt("return", _context9.sent);
|
267
|
+
|
268
|
+
case 3:
|
269
|
+
case "end":
|
270
|
+
return _context9.stop();
|
271
|
+
}
|
272
|
+
}
|
273
|
+
}, _callee9);
|
274
|
+
}));
|
275
|
+
|
276
|
+
return function getDomains() {
|
277
|
+
return _ref9.apply(this, arguments);
|
278
|
+
};
|
279
|
+
}();
|
280
|
+
/** ************************************** 关系定义 start ************************************ */
|
281
|
+
|
282
|
+
/**
|
283
|
+
* 查询ci关系定义
|
284
|
+
* @param {object} params
|
285
|
+
* @returns {object}
|
286
|
+
*/
|
287
|
+
|
288
|
+
export var getRelation = /*#__PURE__*/function () {
|
289
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(params) {
|
290
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
291
|
+
while (1) {
|
292
|
+
switch (_context10.prev = _context10.next) {
|
293
|
+
case 0:
|
294
|
+
_context10.next = 2;
|
295
|
+
return request.post('/model/v1/api/getRelation', params);
|
296
|
+
|
297
|
+
case 2:
|
298
|
+
return _context10.abrupt("return", _context10.sent);
|
299
|
+
|
300
|
+
case 3:
|
301
|
+
case "end":
|
302
|
+
return _context10.stop();
|
303
|
+
}
|
304
|
+
}
|
305
|
+
}, _callee10);
|
306
|
+
}));
|
307
|
+
|
308
|
+
return function getRelation(_x7) {
|
309
|
+
return _ref10.apply(this, arguments);
|
310
|
+
};
|
311
|
+
}();
|
312
|
+
/**
|
313
|
+
* 创建关系
|
314
|
+
* @param {object} params
|
315
|
+
*/
|
316
|
+
|
317
|
+
export var createRelation = /*#__PURE__*/function () {
|
318
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(params) {
|
319
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
320
|
+
while (1) {
|
321
|
+
switch (_context11.prev = _context11.next) {
|
322
|
+
case 0:
|
323
|
+
_context11.next = 2;
|
324
|
+
return request.post('/model/v1/api/createRelation', params);
|
325
|
+
|
326
|
+
case 2:
|
327
|
+
return _context11.abrupt("return", _context11.sent);
|
328
|
+
|
329
|
+
case 3:
|
330
|
+
case "end":
|
331
|
+
return _context11.stop();
|
332
|
+
}
|
333
|
+
}
|
334
|
+
}, _callee11);
|
335
|
+
}));
|
336
|
+
|
337
|
+
return function createRelation(_x8) {
|
338
|
+
return _ref11.apply(this, arguments);
|
339
|
+
};
|
340
|
+
}();
|
341
|
+
/**
|
342
|
+
* 编辑关系
|
343
|
+
* @param {object} params
|
344
|
+
*/
|
345
|
+
|
346
|
+
export var updateRelation = /*#__PURE__*/function () {
|
347
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(params) {
|
348
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
349
|
+
while (1) {
|
350
|
+
switch (_context12.prev = _context12.next) {
|
351
|
+
case 0:
|
352
|
+
_context12.next = 2;
|
353
|
+
return request.post('/model/v1/api/updateRelation', params);
|
354
|
+
|
355
|
+
case 2:
|
356
|
+
return _context12.abrupt("return", _context12.sent);
|
357
|
+
|
358
|
+
case 3:
|
359
|
+
case "end":
|
360
|
+
return _context12.stop();
|
361
|
+
}
|
362
|
+
}
|
363
|
+
}, _callee12);
|
364
|
+
}));
|
365
|
+
|
366
|
+
return function updateRelation(_x9) {
|
367
|
+
return _ref12.apply(this, arguments);
|
368
|
+
};
|
369
|
+
}();
|
370
|
+
/**
|
371
|
+
* 删除关系定义
|
372
|
+
* @param {object} params {
|
373
|
+
"data":
|
374
|
+
[
|
375
|
+
{
|
376
|
+
"srcCiCode":"test21",
|
377
|
+
"dstCiCode":"test22",
|
378
|
+
"relationTypeCode":"runs"
|
379
|
+
},
|
380
|
+
{
|
381
|
+
"srcCiCode":"test23",
|
382
|
+
"dstCiCode":"test24",
|
383
|
+
"relationTypeCode":"runs"
|
384
|
+
}
|
385
|
+
]
|
386
|
+
}
|
387
|
+
*/
|
388
|
+
|
389
|
+
export var deleteRelation = /*#__PURE__*/function () {
|
390
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(params) {
|
391
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
392
|
+
while (1) {
|
393
|
+
switch (_context13.prev = _context13.next) {
|
394
|
+
case 0:
|
395
|
+
_context13.next = 2;
|
396
|
+
return request.post('/model/v1/api/deleteRelation', params);
|
397
|
+
|
398
|
+
case 2:
|
399
|
+
return _context13.abrupt("return", _context13.sent);
|
400
|
+
|
401
|
+
case 3:
|
402
|
+
case "end":
|
403
|
+
return _context13.stop();
|
404
|
+
}
|
405
|
+
}
|
406
|
+
}, _callee13);
|
407
|
+
}));
|
408
|
+
|
409
|
+
return function deleteRelation(_x10) {
|
410
|
+
return _ref13.apply(this, arguments);
|
411
|
+
};
|
412
|
+
}();
|
413
|
+
/** ************************************** 关系定义 end************************************ */
|
414
|
+
|
415
|
+
/** ************************************** 数据字典 start ********************************** */
|
416
|
+
|
417
|
+
/**
|
418
|
+
* 根据 CI 和属性 code 查询字典信息
|
419
|
+
* @param {object} param {
|
420
|
+
"ciCode":[
|
421
|
+
"xxx",
|
422
|
+
"xxxxx"
|
423
|
+
]
|
424
|
+
}
|
425
|
+
* @returns {array}
|
426
|
+
* @example
|
427
|
+
* --------------------------------------------------------------------------
|
428
|
+
*
|
429
|
+
* {"ciCode":[
|
430
|
+
* "ruijieSwitch"
|
431
|
+
* ]}
|
432
|
+
*
|
433
|
+
* result
|
434
|
+
* [
|
435
|
+
{
|
436
|
+
"ciCode": "switch",
|
437
|
+
"attributeCode": "xxxx",
|
438
|
+
"dict": {
|
439
|
+
"id": "00000000023b4135",
|
440
|
+
"code": "protocol",
|
441
|
+
"name": "协议类型",
|
442
|
+
"description": "协议类型",
|
443
|
+
"source": "system",
|
444
|
+
"items": {
|
445
|
+
DB_MYSQL: "MySQL"
|
446
|
+
DB_ORACLE: "Oracle"
|
447
|
+
}
|
448
|
+
}
|
449
|
+
},
|
450
|
+
...]
|
451
|
+
*/
|
452
|
+
|
453
|
+
export var getCiAttributeDict = /*#__PURE__*/function () {
|
454
|
+
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(param) {
|
455
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
456
|
+
while (1) {
|
457
|
+
switch (_context14.prev = _context14.next) {
|
458
|
+
case 0:
|
459
|
+
_context14.next = 2;
|
460
|
+
return request.post('/model/v1/api/getCiAttributeDict', param);
|
461
|
+
|
462
|
+
case 2:
|
463
|
+
return _context14.abrupt("return", _context14.sent);
|
464
|
+
|
465
|
+
case 3:
|
466
|
+
case "end":
|
467
|
+
return _context14.stop();
|
468
|
+
}
|
469
|
+
}
|
470
|
+
}, _callee14);
|
471
|
+
}));
|
472
|
+
|
473
|
+
return function getCiAttributeDict(_x11) {
|
474
|
+
return _ref14.apply(this, arguments);
|
475
|
+
};
|
476
|
+
}();
|
477
|
+
/**
|
478
|
+
* 获取用户自建的属性(数据字典)
|
479
|
+
* @param {Array} codes ci类型code集合
|
480
|
+
* @returns {Object} {key:{xx:xxx,...}}
|
481
|
+
*/
|
482
|
+
|
483
|
+
export function getUserDicts(_x12) {
|
484
|
+
return _getUserDicts.apply(this, arguments);
|
485
|
+
}
|
486
|
+
/**
|
487
|
+
* 查询单个数据字典
|
488
|
+
* @param {string} code 字典对象code属性
|
489
|
+
* @returns {object}
|
490
|
+
* @example
|
491
|
+
* --------------------------------------------------------------------------
|
492
|
+
*
|
493
|
+
* {
|
494
|
+
* "code": "SNMPReachable"
|
495
|
+
* }
|
496
|
+
*
|
497
|
+
* result
|
498
|
+
*
|
499
|
+
* {
|
500
|
+
* "code": "SNMPReachable",
|
501
|
+
* "name": "SNMP状态",
|
502
|
+
* "description": "网络设备SNMP状态",
|
503
|
+
* "items": {
|
504
|
+
* "0": "异常",
|
505
|
+
* "1": "正常"
|
506
|
+
* }
|
507
|
+
* }
|
508
|
+
*/
|
509
|
+
|
510
|
+
function _getUserDicts() {
|
511
|
+
_getUserDicts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(codes) {
|
512
|
+
var dicts, userDict;
|
513
|
+
return _regeneratorRuntime.wrap(function _callee29$(_context29) {
|
514
|
+
while (1) {
|
515
|
+
switch (_context29.prev = _context29.next) {
|
516
|
+
case 0:
|
517
|
+
_context29.next = 2;
|
518
|
+
return getCiAttributeDict({
|
519
|
+
ciCode: codes
|
520
|
+
});
|
521
|
+
|
522
|
+
case 2:
|
523
|
+
dicts = _context29.sent;
|
524
|
+
userDict = dicts.reduce(function (map, obj) {
|
525
|
+
map[obj.attributeCode] = obj.dict.items;
|
526
|
+
return map;
|
527
|
+
}, {});
|
528
|
+
return _context29.abrupt("return", userDict);
|
529
|
+
|
530
|
+
case 5:
|
531
|
+
case "end":
|
532
|
+
return _context29.stop();
|
533
|
+
}
|
534
|
+
}
|
535
|
+
}, _callee29);
|
536
|
+
}));
|
537
|
+
return _getUserDicts.apply(this, arguments);
|
538
|
+
}
|
539
|
+
|
540
|
+
export var queryDict = /*#__PURE__*/function () {
|
541
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(code) {
|
542
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
543
|
+
while (1) {
|
544
|
+
switch (_context15.prev = _context15.next) {
|
545
|
+
case 0:
|
546
|
+
_context15.next = 2;
|
547
|
+
return request.post('/model/v1/api/getDict', {
|
548
|
+
code: code
|
549
|
+
});
|
550
|
+
|
551
|
+
case 2:
|
552
|
+
return _context15.abrupt("return", _context15.sent);
|
553
|
+
|
554
|
+
case 3:
|
555
|
+
case "end":
|
556
|
+
return _context15.stop();
|
557
|
+
}
|
558
|
+
}
|
559
|
+
}, _callee15);
|
560
|
+
}));
|
561
|
+
|
562
|
+
return function queryDict(_x13) {
|
563
|
+
return _ref15.apply(this, arguments);
|
564
|
+
};
|
565
|
+
}();
|
566
|
+
/**
|
567
|
+
* 查询厂商
|
568
|
+
* TODO:由于当前后端只有一个单查厂商的接口,暂使用promise.all形式查询多个
|
569
|
+
* -- 后端会在模型改造过程中重构接口,到时一起调整
|
570
|
+
*
|
571
|
+
* @param {*} vendorKeys 厂商key数组,如['ruijie']
|
572
|
+
*/
|
573
|
+
|
574
|
+
export var queryVendors = /*#__PURE__*/function () {
|
575
|
+
var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(vendorKeys) {
|
576
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
577
|
+
while (1) {
|
578
|
+
switch (_context16.prev = _context16.next) {
|
579
|
+
case 0:
|
580
|
+
_context16.next = 2;
|
581
|
+
return Promise.all(vendorKeys.map(function (vendor) {
|
582
|
+
return request.post('/model/v1/api/getDict', {
|
583
|
+
vendor: vendor
|
584
|
+
});
|
585
|
+
}));
|
586
|
+
|
587
|
+
case 2:
|
588
|
+
return _context16.abrupt("return", _context16.sent);
|
589
|
+
|
590
|
+
case 3:
|
591
|
+
case "end":
|
592
|
+
return _context16.stop();
|
593
|
+
}
|
594
|
+
}
|
595
|
+
}, _callee16);
|
596
|
+
}));
|
597
|
+
|
598
|
+
return function queryVendors(_x14) {
|
599
|
+
return _ref16.apply(this, arguments);
|
600
|
+
};
|
601
|
+
}();
|
602
|
+
/**
|
603
|
+
* 查询全部数据字典
|
604
|
+
* @param {string} source 查询全量:source=null,查询内建:source=system,查询自建: source=custom
|
605
|
+
* @returns {array}
|
606
|
+
*
|
607
|
+
* @example
|
608
|
+
* --------------------------------------------------------------------------
|
609
|
+
*
|
610
|
+
* {
|
611
|
+
* "source":"custom"
|
612
|
+
* }
|
613
|
+
*
|
614
|
+
* result
|
615
|
+
*
|
616
|
+
*
|
617
|
+
* [
|
618
|
+
* {
|
619
|
+
* "code": "poeSupported",
|
620
|
+
* "name": "支持POE",
|
621
|
+
* "description": "是否支持POE供电",
|
622
|
+
* "items": {
|
623
|
+
* "false": "不支持",
|
624
|
+
* "true": "支持"
|
625
|
+
* }
|
626
|
+
* },
|
627
|
+
* ...
|
628
|
+
* ]
|
629
|
+
*/
|
630
|
+
|
631
|
+
export var queryDicts = /*#__PURE__*/function () {
|
632
|
+
var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(source) {
|
633
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
634
|
+
while (1) {
|
635
|
+
switch (_context17.prev = _context17.next) {
|
636
|
+
case 0:
|
637
|
+
if (source === void 0) {
|
638
|
+
source = null;
|
639
|
+
}
|
640
|
+
|
641
|
+
_context17.next = 3;
|
642
|
+
return modelDictList();
|
643
|
+
|
644
|
+
case 3:
|
645
|
+
return _context17.abrupt("return", _context17.sent);
|
646
|
+
|
647
|
+
case 4:
|
648
|
+
case "end":
|
649
|
+
return _context17.stop();
|
650
|
+
}
|
651
|
+
}
|
652
|
+
}, _callee17);
|
653
|
+
}));
|
654
|
+
|
655
|
+
return function queryDicts(_x15) {
|
656
|
+
return _ref17.apply(this, arguments);
|
657
|
+
};
|
658
|
+
}();
|
659
|
+
/**
|
660
|
+
* 新建数据字典
|
661
|
+
* @param {object} param
|
662
|
+
* @returns {object}
|
663
|
+
*
|
664
|
+
* @example
|
665
|
+
* --------------------------------------------------------------------------
|
666
|
+
*
|
667
|
+
* {
|
668
|
+
* "name":"test",
|
669
|
+
* "description":"test",
|
670
|
+
* "items":{
|
671
|
+
* "a":"a",
|
672
|
+
* "b":"b"
|
673
|
+
* }
|
674
|
+
* }
|
675
|
+
*
|
676
|
+
* result
|
677
|
+
*
|
678
|
+
* {
|
679
|
+
* "id": "000000000051dc4d",
|
680
|
+
* "code": "8365d53668554559b7c946ea0d1058e9",
|
681
|
+
* "name": "test",
|
682
|
+
* "description": "test",
|
683
|
+
* "source": "custom",
|
684
|
+
* "items": {
|
685
|
+
* "a":"a",
|
686
|
+
* "b":"b"
|
687
|
+
* }
|
688
|
+
* }
|
689
|
+
*/
|
690
|
+
|
691
|
+
export var createDict = /*#__PURE__*/function () {
|
692
|
+
var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(param) {
|
693
|
+
return _regeneratorRuntime.wrap(function _callee18$(_context18) {
|
694
|
+
while (1) {
|
695
|
+
switch (_context18.prev = _context18.next) {
|
696
|
+
case 0:
|
697
|
+
_context18.next = 2;
|
698
|
+
return request.post('/model/v1/api/createDict', param);
|
699
|
+
|
700
|
+
case 2:
|
701
|
+
return _context18.abrupt("return", _context18.sent);
|
702
|
+
|
703
|
+
case 3:
|
704
|
+
case "end":
|
705
|
+
return _context18.stop();
|
706
|
+
}
|
707
|
+
}
|
708
|
+
}, _callee18);
|
709
|
+
}));
|
710
|
+
|
711
|
+
return function createDict(_x16) {
|
712
|
+
return _ref18.apply(this, arguments);
|
713
|
+
};
|
714
|
+
}();
|
715
|
+
/**
|
716
|
+
* 编辑数据字典
|
717
|
+
* @param {object} param
|
718
|
+
* @returns {string}
|
719
|
+
*
|
720
|
+
* @example
|
721
|
+
* --------------------------------------------------------------------------
|
722
|
+
*
|
723
|
+
* {
|
724
|
+
* "id": "000000000051dc4d",
|
725
|
+
* "code": "8365d53668554559b7c946ea0d1058e9",
|
726
|
+
* "name": "test",
|
727
|
+
* "description": "test",
|
728
|
+
* "source": "custom",
|
729
|
+
* "items": {
|
730
|
+
* "a":"a",
|
731
|
+
* "b":"b"
|
732
|
+
* }
|
733
|
+
* }
|
734
|
+
*
|
735
|
+
* result
|
736
|
+
*
|
737
|
+
* "dict/000000000051dd09"
|
738
|
+
*/
|
739
|
+
|
740
|
+
export var updateDict = /*#__PURE__*/function () {
|
741
|
+
var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(param) {
|
742
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context19) {
|
743
|
+
while (1) {
|
744
|
+
switch (_context19.prev = _context19.next) {
|
745
|
+
case 0:
|
746
|
+
_context19.next = 2;
|
747
|
+
return request.post('/model/v1/api/updateDict', param);
|
748
|
+
|
749
|
+
case 2:
|
750
|
+
return _context19.abrupt("return", _context19.sent);
|
751
|
+
|
752
|
+
case 3:
|
753
|
+
case "end":
|
754
|
+
return _context19.stop();
|
755
|
+
}
|
756
|
+
}
|
757
|
+
}, _callee19);
|
758
|
+
}));
|
759
|
+
|
760
|
+
return function updateDict(_x17) {
|
761
|
+
return _ref19.apply(this, arguments);
|
762
|
+
};
|
763
|
+
}();
|
764
|
+
/**
|
765
|
+
* 删除数据字典
|
766
|
+
* @param {string} id
|
767
|
+
* @returns {string}
|
768
|
+
*
|
769
|
+
* @example
|
770
|
+
* --------------------------------------------------------------------------
|
771
|
+
* {
|
772
|
+
* "id":"000000000051dc4d"
|
773
|
+
* }
|
774
|
+
*
|
775
|
+
* result
|
776
|
+
*
|
777
|
+
* "000000000051dc4d"
|
778
|
+
*/
|
779
|
+
|
780
|
+
export var deleteDict = /*#__PURE__*/function () {
|
781
|
+
var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(id) {
|
782
|
+
return _regeneratorRuntime.wrap(function _callee20$(_context20) {
|
783
|
+
while (1) {
|
784
|
+
switch (_context20.prev = _context20.next) {
|
785
|
+
case 0:
|
786
|
+
_context20.next = 2;
|
787
|
+
return request.post('/model/v1/api/deleteDict', {
|
788
|
+
id: id
|
789
|
+
});
|
790
|
+
|
791
|
+
case 2:
|
792
|
+
return _context20.abrupt("return", _context20.sent);
|
793
|
+
|
794
|
+
case 3:
|
795
|
+
case "end":
|
796
|
+
return _context20.stop();
|
797
|
+
}
|
798
|
+
}
|
799
|
+
}, _callee20);
|
800
|
+
}));
|
801
|
+
|
802
|
+
return function deleteDict(_x18) {
|
803
|
+
return _ref20.apply(this, arguments);
|
804
|
+
};
|
805
|
+
}();
|
806
|
+
/** ************************************** 数据字典 end ************************************ */
|
807
|
+
|
808
|
+
/** ************************************** ci类型 start ************************************ */
|
809
|
+
|
810
|
+
/**
|
811
|
+
* 根据code查询继承自该code的CI
|
812
|
+
* @param {Object} param {
|
813
|
+
"code":"networkInterface",
|
814
|
+
"ifUpSearch":false
|
815
|
+
}
|
816
|
+
* @returns
|
817
|
+
*/
|
818
|
+
|
819
|
+
export var getCiExtends = /*#__PURE__*/function () {
|
820
|
+
var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(param) {
|
821
|
+
return _regeneratorRuntime.wrap(function _callee21$(_context21) {
|
822
|
+
while (1) {
|
823
|
+
switch (_context21.prev = _context21.next) {
|
824
|
+
case 0:
|
825
|
+
_context21.next = 2;
|
826
|
+
return request.post('/model/v1/api/getCiExtends', param);
|
827
|
+
|
828
|
+
case 2:
|
829
|
+
return _context21.abrupt("return", _context21.sent);
|
830
|
+
|
831
|
+
case 3:
|
832
|
+
case "end":
|
833
|
+
return _context21.stop();
|
834
|
+
}
|
835
|
+
}
|
836
|
+
}, _callee21);
|
837
|
+
}));
|
838
|
+
|
839
|
+
return function getCiExtends(_x19) {
|
840
|
+
return _ref21.apply(this, arguments);
|
841
|
+
};
|
842
|
+
}();
|
843
|
+
/**
|
844
|
+
*
|
845
|
+
* 模型接口-ci元数据
|
846
|
+
* @param {object} code 模型code
|
847
|
+
* @param {boolean} userVisibleFilter 是否按照模型的userVisible过滤,发现页面不过滤
|
848
|
+
* @param {boolean} dict 是否需要绑定数据字典
|
849
|
+
*/
|
850
|
+
|
851
|
+
export var getCi = /*#__PURE__*/function () {
|
852
|
+
var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(code, userVisibleFilter, dict) {
|
853
|
+
var meta;
|
854
|
+
return _regeneratorRuntime.wrap(function _callee22$(_context22) {
|
855
|
+
while (1) {
|
856
|
+
switch (_context22.prev = _context22.next) {
|
857
|
+
case 0:
|
858
|
+
if (userVisibleFilter === void 0) {
|
859
|
+
userVisibleFilter = true;
|
860
|
+
}
|
861
|
+
|
862
|
+
if (dict === void 0) {
|
863
|
+
dict = true;
|
864
|
+
}
|
865
|
+
|
866
|
+
_context22.next = 4;
|
867
|
+
return formatCiAttributes(code, userVisibleFilter);
|
868
|
+
|
869
|
+
case 4:
|
870
|
+
meta = _context22.sent;
|
871
|
+
|
872
|
+
if (!dict) {
|
873
|
+
_context22.next = 14;
|
874
|
+
break;
|
875
|
+
}
|
876
|
+
|
877
|
+
_context22.prev = 6;
|
878
|
+
return _context22.abrupt("return", bindDict(meta));
|
879
|
+
|
880
|
+
case 10:
|
881
|
+
_context22.prev = 10;
|
882
|
+
_context22.t0 = _context22["catch"](6);
|
883
|
+
console.error(_context22.t0);
|
884
|
+
return _context22.abrupt("return", meta);
|
885
|
+
|
886
|
+
case 14:
|
887
|
+
return _context22.abrupt("return", meta);
|
888
|
+
|
889
|
+
case 15:
|
890
|
+
case "end":
|
891
|
+
return _context22.stop();
|
892
|
+
}
|
893
|
+
}
|
894
|
+
}, _callee22, null, [[6, 10]]);
|
895
|
+
}));
|
896
|
+
|
897
|
+
return function getCi(_x20, _x21, _x22) {
|
898
|
+
return _ref22.apply(this, arguments);
|
899
|
+
};
|
900
|
+
}();
|
901
|
+
/**
|
902
|
+
* 编辑ci类型
|
903
|
+
* @param {string} code
|
904
|
+
*/
|
905
|
+
|
906
|
+
export var updateCi = /*#__PURE__*/function () {
|
907
|
+
var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(data) {
|
908
|
+
return _regeneratorRuntime.wrap(function _callee23$(_context23) {
|
909
|
+
while (1) {
|
910
|
+
switch (_context23.prev = _context23.next) {
|
911
|
+
case 0:
|
912
|
+
_context23.next = 2;
|
913
|
+
return request.post('/model/v1/api/updateCi', data);
|
914
|
+
|
915
|
+
case 2:
|
916
|
+
return _context23.abrupt("return", _context23.sent);
|
917
|
+
|
918
|
+
case 3:
|
919
|
+
case "end":
|
920
|
+
return _context23.stop();
|
921
|
+
}
|
922
|
+
}
|
923
|
+
}, _callee23);
|
924
|
+
}));
|
925
|
+
|
926
|
+
return function updateCi(_x23) {
|
927
|
+
return _ref23.apply(this, arguments);
|
928
|
+
};
|
929
|
+
}();
|
930
|
+
/**
|
931
|
+
* 创建ci类型
|
932
|
+
* @param {object} data
|
933
|
+
* @returns {string}
|
934
|
+
*
|
935
|
+
* @example
|
936
|
+
* --------------------------------------------------------------------------
|
937
|
+
*
|
938
|
+
* {
|
939
|
+
* "domain":"network",
|
940
|
+
* "enable":true,
|
941
|
+
* "source":"custom",
|
942
|
+
* "name":"睿智-天津-打印机",
|
943
|
+
* "displayName":"睿智-天津-打印机",
|
944
|
+
* "vendor":"",
|
945
|
+
* "version":"",
|
946
|
+
* "category":"resources",
|
947
|
+
* "metaAttributes":{
|
948
|
+
* "abstractable":"true",//可实例化
|
949
|
+
* "discoverable":"false",//不可发现
|
950
|
+
* "icon":"",
|
951
|
+
* "monitorable":"false"//不可管理(即不可监控)
|
952
|
+
* }
|
953
|
+
* }
|
954
|
+
*
|
955
|
+
* result
|
956
|
+
*
|
957
|
+
* "513b7713-4854-496f-9e4a-a4bf85cb0f63"
|
958
|
+
*/
|
959
|
+
|
960
|
+
export var createCi = /*#__PURE__*/function () {
|
961
|
+
var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(data) {
|
962
|
+
return _regeneratorRuntime.wrap(function _callee24$(_context24) {
|
963
|
+
while (1) {
|
964
|
+
switch (_context24.prev = _context24.next) {
|
965
|
+
case 0:
|
966
|
+
_context24.next = 2;
|
967
|
+
return request.post('/model/v1/api/createCi', data);
|
968
|
+
|
969
|
+
case 2:
|
970
|
+
return _context24.abrupt("return", _context24.sent);
|
971
|
+
|
972
|
+
case 3:
|
973
|
+
case "end":
|
974
|
+
return _context24.stop();
|
975
|
+
}
|
976
|
+
}
|
977
|
+
}, _callee24);
|
978
|
+
}));
|
979
|
+
|
980
|
+
return function createCi(_x24) {
|
981
|
+
return _ref24.apply(this, arguments);
|
982
|
+
};
|
983
|
+
}();
|
984
|
+
/**
|
985
|
+
* 删除ci类型
|
986
|
+
* @param {Object} param
|
987
|
+
*/
|
988
|
+
|
989
|
+
export var deleteCi = /*#__PURE__*/function () {
|
990
|
+
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(param) {
|
991
|
+
return _regeneratorRuntime.wrap(function _callee25$(_context25) {
|
992
|
+
while (1) {
|
993
|
+
switch (_context25.prev = _context25.next) {
|
994
|
+
case 0:
|
995
|
+
_context25.next = 2;
|
996
|
+
return request.post('/model/v1/api/deleteCi', param);
|
997
|
+
|
998
|
+
case 2:
|
999
|
+
return _context25.abrupt("return", _context25.sent);
|
1000
|
+
|
1001
|
+
case 3:
|
1002
|
+
case "end":
|
1003
|
+
return _context25.stop();
|
1004
|
+
}
|
1005
|
+
}
|
1006
|
+
}, _callee25);
|
1007
|
+
}));
|
1008
|
+
|
1009
|
+
return function deleteCi(_x25) {
|
1010
|
+
return _ref25.apply(this, arguments);
|
1011
|
+
};
|
1012
|
+
}();
|
1013
|
+
/**
|
1014
|
+
* 查询所有 CI 类型
|
1015
|
+
* @param {object} params
|
1016
|
+
*/
|
1017
|
+
|
1018
|
+
export var getAllCi = /*#__PURE__*/function () {
|
1019
|
+
var _ref26 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(params) {
|
1020
|
+
return _regeneratorRuntime.wrap(function _callee26$(_context26) {
|
1021
|
+
while (1) {
|
1022
|
+
switch (_context26.prev = _context26.next) {
|
1023
|
+
case 0:
|
1024
|
+
_context26.next = 2;
|
1025
|
+
return request.post('/model/v1/api/getAllCi', params);
|
1026
|
+
|
1027
|
+
case 2:
|
1028
|
+
return _context26.abrupt("return", _context26.sent);
|
1029
|
+
|
1030
|
+
case 3:
|
1031
|
+
case "end":
|
1032
|
+
return _context26.stop();
|
1033
|
+
}
|
1034
|
+
}
|
1035
|
+
}, _callee26);
|
1036
|
+
}));
|
1037
|
+
|
1038
|
+
return function getAllCi(_x26) {
|
1039
|
+
return _ref26.apply(this, arguments);
|
1040
|
+
};
|
1041
|
+
}();
|
1042
|
+
/**
|
1043
|
+
* 获取类型元数据
|
1044
|
+
* @param {string} code
|
1045
|
+
*/
|
1046
|
+
|
1047
|
+
export function getCiMeta(_x27) {
|
1048
|
+
return _getCiMeta.apply(this, arguments);
|
1049
|
+
}
|
1050
|
+
/**
|
1051
|
+
* 格式化ci类型元数据
|
1052
|
+
* @param {string} code
|
1053
|
+
* @param {boolean} userVisibleFilter
|
1054
|
+
*/
|
1055
|
+
|
1056
|
+
function _getCiMeta() {
|
1057
|
+
_getCiMeta = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(code) {
|
1058
|
+
return _regeneratorRuntime.wrap(function _callee30$(_context30) {
|
1059
|
+
while (1) {
|
1060
|
+
switch (_context30.prev = _context30.next) {
|
1061
|
+
case 0:
|
1062
|
+
_context30.next = 2;
|
1063
|
+
return request.get("/mdc/v1/api/model-asset/" + code);
|
1064
|
+
|
1065
|
+
case 2:
|
1066
|
+
return _context30.abrupt("return", _context30.sent);
|
1067
|
+
|
1068
|
+
case 3:
|
1069
|
+
case "end":
|
1070
|
+
return _context30.stop();
|
1071
|
+
}
|
1072
|
+
}
|
1073
|
+
}, _callee30);
|
1074
|
+
}));
|
1075
|
+
return _getCiMeta.apply(this, arguments);
|
1076
|
+
}
|
1077
|
+
|
1078
|
+
function formatCiAttributes(_x28, _x29) {
|
1079
|
+
return _formatCiAttributes.apply(this, arguments);
|
1080
|
+
} // 属性为用户字典
|
1081
|
+
|
1082
|
+
|
1083
|
+
function _formatCiAttributes() {
|
1084
|
+
_formatCiAttributes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31(code, userVisibleFilter) {
|
1085
|
+
var meta, attributes;
|
1086
|
+
return _regeneratorRuntime.wrap(function _callee31$(_context31) {
|
1087
|
+
while (1) {
|
1088
|
+
switch (_context31.prev = _context31.next) {
|
1089
|
+
case 0:
|
1090
|
+
_context31.next = 2;
|
1091
|
+
return request.post('/model/v1/api/getCi', {
|
1092
|
+
code: code
|
1093
|
+
});
|
1094
|
+
|
1095
|
+
case 2:
|
1096
|
+
meta = _context31.sent;
|
1097
|
+
|
1098
|
+
if (!meta) {
|
1099
|
+
_context31.next = 9;
|
1100
|
+
break;
|
1101
|
+
}
|
1102
|
+
|
1103
|
+
attributes = meta.attributes;
|
1104
|
+
|
1105
|
+
if (attributes) {
|
1106
|
+
_context31.next = 7;
|
1107
|
+
break;
|
1108
|
+
}
|
1109
|
+
|
1110
|
+
return _context31.abrupt("return", meta);
|
1111
|
+
|
1112
|
+
case 7:
|
1113
|
+
try {
|
1114
|
+
// 适配后端,使属性正序
|
1115
|
+
attributes = attributes.reverse(); // 获取过滤userVisible=true的属性(用户可见)
|
1116
|
+
|
1117
|
+
if (userVisibleFilter) {
|
1118
|
+
meta.attributes = attributes.filter(function (item) {
|
1119
|
+
return item.userVisible === 'true';
|
1120
|
+
});
|
1121
|
+
}
|
1122
|
+
} catch (error) {
|
1123
|
+
rlog.error('services=>model=>:', error);
|
1124
|
+
}
|
1125
|
+
|
1126
|
+
return _context31.abrupt("return", meta);
|
1127
|
+
|
1128
|
+
case 9:
|
1129
|
+
return _context31.abrupt("return", meta);
|
1130
|
+
|
1131
|
+
case 10:
|
1132
|
+
case "end":
|
1133
|
+
return _context31.stop();
|
1134
|
+
}
|
1135
|
+
}
|
1136
|
+
}, _callee31);
|
1137
|
+
}));
|
1138
|
+
return _formatCiAttributes.apply(this, arguments);
|
1139
|
+
}
|
1140
|
+
|
1141
|
+
var ATTRIBUTE_USER_DICT = 'userDict';
|
1142
|
+
/**
|
1143
|
+
* 为属性绑定“数据字典”数据
|
1144
|
+
* @param {object} data
|
1145
|
+
*/
|
1146
|
+
|
1147
|
+
function bindDict(data) {
|
1148
|
+
var meta = _extends({}, data);
|
1149
|
+
|
1150
|
+
var visibleAttributes = meta.attributes;
|
1151
|
+
meta.attributes = visibleAttributes.map(function (item) {
|
1152
|
+
var attr = _extends({}, item);
|
1153
|
+
|
1154
|
+
var dataSource = attr.dataSource,
|
1155
|
+
dictCode = attr.dictCode,
|
1156
|
+
code = attr.code;
|
1157
|
+
if (isNull(attr.changeValue)) return attr; // 用户自定义数据字典key为dictCode
|
1158
|
+
|
1159
|
+
var key = ATTRIBUTE_USER_DICT === dataSource ? dictCode : code;
|
1160
|
+
|
1161
|
+
if (DICT.get(key)) {
|
1162
|
+
attr.dict = DICT.get(key).items;
|
1163
|
+
return attr;
|
1164
|
+
}
|
1165
|
+
|
1166
|
+
console.error("\u627E\u4E0D\u5230 " + attr.name + " \u5BF9\u5E94\u7684\u6570\u636E\u5B57\u5178");
|
1167
|
+
return attr;
|
1168
|
+
});
|
1169
|
+
return meta;
|
1170
|
+
}
|
1171
|
+
|
1172
|
+
export function queryAllModel(_x30) {
|
1173
|
+
return _queryAllModel.apply(this, arguments);
|
1174
|
+
}
|
1175
|
+
/**
|
1176
|
+
* 查询知识库分类列表
|
1177
|
+
*/
|
1178
|
+
// export async function queryAllType(isAuth = false) {
|
1179
|
+
// if (isAuth){
|
1180
|
+
// return await request.post('/knowledge/v1/api/type/list');
|
1181
|
+
// }
|
1182
|
+
// return await request.post('/type/list');
|
1183
|
+
// }
|
1184
|
+
|
1185
|
+
/** *
|
1186
|
+
* 批量查询ci属性
|
1187
|
+
*/
|
1188
|
+
|
1189
|
+
function _queryAllModel() {
|
1190
|
+
_queryAllModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(isAuth) {
|
1191
|
+
return _regeneratorRuntime.wrap(function _callee32$(_context32) {
|
1192
|
+
while (1) {
|
1193
|
+
switch (_context32.prev = _context32.next) {
|
1194
|
+
case 0:
|
1195
|
+
if (isAuth === void 0) {
|
1196
|
+
isAuth = false;
|
1197
|
+
}
|
1198
|
+
|
1199
|
+
if (!isAuth) {
|
1200
|
+
_context32.next = 5;
|
1201
|
+
break;
|
1202
|
+
}
|
1203
|
+
|
1204
|
+
_context32.next = 4;
|
1205
|
+
return request.post('/model/v1/api/authority/modelTree');
|
1206
|
+
|
1207
|
+
case 4:
|
1208
|
+
return _context32.abrupt("return", _context32.sent);
|
1209
|
+
|
1210
|
+
case 5:
|
1211
|
+
_context32.next = 7;
|
1212
|
+
return request.get('/mdc/v1/api/model-asset/tree');
|
1213
|
+
|
1214
|
+
case 7:
|
1215
|
+
return _context32.abrupt("return", _context32.sent);
|
1216
|
+
|
1217
|
+
case 8:
|
1218
|
+
case "end":
|
1219
|
+
return _context32.stop();
|
1220
|
+
}
|
1221
|
+
}
|
1222
|
+
}, _callee32);
|
1223
|
+
}));
|
1224
|
+
return _queryAllModel.apply(this, arguments);
|
1225
|
+
}
|
1226
|
+
|
1227
|
+
export var getBatchCi = /*#__PURE__*/function () {
|
1228
|
+
var _ref27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(typeCodes) {
|
1229
|
+
return _regeneratorRuntime.wrap(function _callee27$(_context27) {
|
1230
|
+
while (1) {
|
1231
|
+
switch (_context27.prev = _context27.next) {
|
1232
|
+
case 0:
|
1233
|
+
_context27.next = 2;
|
1234
|
+
return request.post('/model/v1/api/getBatchCi', {
|
1235
|
+
typeCodes: typeCodes
|
1236
|
+
});
|
1237
|
+
|
1238
|
+
case 2:
|
1239
|
+
return _context27.abrupt("return", _context27.sent);
|
1240
|
+
|
1241
|
+
case 3:
|
1242
|
+
case "end":
|
1243
|
+
return _context27.stop();
|
1244
|
+
}
|
1245
|
+
}
|
1246
|
+
}, _callee27);
|
1247
|
+
}));
|
1248
|
+
|
1249
|
+
return function getBatchCi(_x31) {
|
1250
|
+
return _ref27.apply(this, arguments);
|
1251
|
+
};
|
1252
|
+
}();
|
1253
|
+
/** *
|
1254
|
+
* 批量查询ci属性
|
1255
|
+
*/
|
1256
|
+
|
1257
|
+
export var getBatchCiMetric = /*#__PURE__*/function () {
|
1258
|
+
var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(typeCodes) {
|
1259
|
+
return _regeneratorRuntime.wrap(function _callee28$(_context28) {
|
1260
|
+
while (1) {
|
1261
|
+
switch (_context28.prev = _context28.next) {
|
1262
|
+
case 0:
|
1263
|
+
_context28.next = 2;
|
1264
|
+
return request.post('/model/v1/api/getBatchCiMetric', {
|
1265
|
+
typeCodes: typeCodes
|
1266
|
+
});
|
1267
|
+
|
1268
|
+
case 2:
|
1269
|
+
return _context28.abrupt("return", _context28.sent);
|
1270
|
+
|
1271
|
+
case 3:
|
1272
|
+
case "end":
|
1273
|
+
return _context28.stop();
|
1274
|
+
}
|
1275
|
+
}
|
1276
|
+
}, _callee28);
|
1277
|
+
}));
|
1278
|
+
|
1279
|
+
return function getBatchCiMetric(_x32) {
|
1280
|
+
return _ref28.apply(this, arguments);
|
1281
|
+
};
|
1282
|
+
}();
|
1283
|
+
/** ************************************** ci类型 end ************************************ */
|