@riil-frontend/component-topology 12.0.0-dev.25 → 12.0.0-dev.27

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.
Files changed (36) hide show
  1. package/build/index.js +10 -10
  2. package/es/core/editor/components/Toolbar/widgets/Layout/index.js +2 -2
  3. package/es/core/editor/utils/edgeTypeStyleUtil.js +0 -23
  4. package/es/core/hooks/useAlarm.js +131 -81
  5. package/es/core/hooks/useCmpLinkAlarm.js +153 -0
  6. package/es/core/hooks/useEventData.js +1 -2
  7. package/es/core/hooks/useGraphAlarmDisplay.js +36 -23
  8. package/es/core/hooks/useTopoEdit.js +0 -4
  9. package/es/core/models/Alarm.js +60 -145
  10. package/es/core/models/AttributeMetricDisplay.js +1 -1
  11. package/es/core/models/TopoApp.js +1 -1
  12. package/es/core/models/utils/linkUtils.js +20 -13
  13. package/es/core/utils/metricUtil.js +8 -4
  14. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +11 -5
  15. package/es/core/viewer/components/titlebar/widgets/AlarmButton.js +1 -5
  16. package/es/networkTopo/store/topoCenter.js +260 -223
  17. package/es/style.js +1 -1
  18. package/es/utils/ciRefAttributeTranslateUtil.js +1 -1
  19. package/lib/core/editor/components/Toolbar/widgets/Layout/index.js +1 -1
  20. package/lib/core/editor/utils/edgeTypeStyleUtil.js +0 -25
  21. package/lib/core/hooks/useAlarm.js +130 -79
  22. package/lib/core/hooks/useCmpLinkAlarm.js +166 -0
  23. package/lib/core/hooks/useEventData.js +1 -2
  24. package/lib/core/hooks/useGraphAlarmDisplay.js +36 -22
  25. package/lib/core/hooks/useTopoEdit.js +0 -4
  26. package/lib/core/models/Alarm.js +60 -147
  27. package/lib/core/models/AttributeMetricDisplay.js +1 -1
  28. package/lib/core/models/TopoApp.js +1 -1
  29. package/lib/core/models/utils/linkUtils.js +21 -13
  30. package/lib/core/utils/metricUtil.js +8 -4
  31. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +13 -5
  32. package/lib/core/viewer/components/titlebar/widgets/AlarmButton.js +1 -5
  33. package/lib/networkTopo/store/topoCenter.js +262 -225
  34. package/lib/style.js +1 -1
  35. package/lib/utils/ciRefAttributeTranslateUtil.js +1 -1
  36. package/package.json +2 -2
@@ -3,7 +3,7 @@
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
5
  exports.__esModule = true;
6
- exports["default"] = void 0;
6
+ exports["default"] = _default;
7
7
 
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
 
@@ -13,249 +13,286 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
13
13
 
14
14
  var _componentTopologyUtils = require("@riil-frontend/component-topology-utils");
15
15
 
16
+ var _topoData = require("../../utils/topoData");
17
+
16
18
  /**
17
19
  * 拓扑中心 Model
18
20
  *
19
21
  *
20
22
  */
21
- var _default = {
22
- // 定义 model 的初始 state
23
- state: {
24
- loading: true,
25
- id: undefined,
26
- viewState: 'view' // view, create, 2种模式
27
-
28
- },
29
- // 定义改变该模型状态的纯函数
30
- reducers: {
31
- update: function update(prevState, payload) {
32
- return (0, _extends2["default"])({}, prevState, payload);
33
- }
34
- },
35
- // 定义处理该模型副作用的函数
36
- effects: function effects(dispatch) {
37
- return {
38
- /**
39
- * 初始化。
40
- */
41
- initData: function initData(params, rootState) {
42
- var _this = this;
43
-
44
- return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
45
- var topoModState, viewType, id, topoTreeModState;
46
- return _regenerator["default"].wrap(function _callee$(_context) {
47
- while (1) switch (_context.prev = _context.next) {
48
- case 0:
49
- if (params === void 0) {
50
- params = {};
51
- }
52
-
53
- topoModState = rootState.topoMod;
54
- viewType = params.type || 'view';
55
- id = params.id || topoModState.topoId || '';
56
-
57
- _this.update({
58
- loading: true,
59
- viewState: viewType
60
- }); // 加载功能操作权限
61
-
62
-
63
- _context.next = 7;
64
- return dispatch.functionAuth.init();
65
-
66
- case 7:
67
- // 加载拓扑树数据
68
- topoTreeModState = rootState.topoTreeMod;
69
-
70
- if (topoTreeModState.loaded) {
71
- _context.next = 16;
23
+ function _default(topo) {
24
+ return {
25
+ // 定义 model 的初始 state
26
+ state: {
27
+ loading: true,
28
+ id: undefined,
29
+ viewState: 'view' // view, create, 2种模式
30
+
31
+ },
32
+ // 定义改变该模型状态的纯函数
33
+ reducers: {
34
+ update: function update(prevState, payload) {
35
+ return (0, _extends2["default"])({}, prevState, payload);
36
+ }
37
+ },
38
+ // 定义处理该模型副作用的函数
39
+ effects: function effects(dispatch) {
40
+ return {
41
+ /**
42
+ * 初始化。
43
+ */
44
+ initData: function initData(params, rootState) {
45
+ var _this = this;
46
+
47
+ return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
48
+ var topoModState, viewType, id, topoTreeModState;
49
+ return _regenerator["default"].wrap(function _callee$(_context) {
50
+ while (1) switch (_context.prev = _context.next) {
51
+ case 0:
52
+ if (params === void 0) {
53
+ params = {};
54
+ }
55
+
56
+ topoModState = rootState.topoMod;
57
+ viewType = params.type || 'view';
58
+ id = params.id || topoModState.topoId || '';
59
+
60
+ _this.update({
61
+ loading: true,
62
+ viewState: viewType
63
+ }); // 加载功能操作权限
64
+
65
+
66
+ _context.next = 7;
67
+ return dispatch.functionAuth.init();
68
+
69
+ case 7:
70
+ // 加载拓扑树数据
71
+ topoTreeModState = rootState.topoTreeMod;
72
+
73
+ if (topoTreeModState.loaded) {
74
+ _context.next = 16;
75
+ break;
76
+ }
77
+
78
+ _context.next = 11;
79
+ return dispatch.topoTreeMod.fetchTopoTree({
80
+ id: id
81
+ });
82
+
83
+ case 11:
84
+ _context.next = 13;
85
+ return dispatch.topoTreeMod.getSelectedTopoId();
86
+
87
+ case 13:
88
+ id = _context.sent;
89
+ _context.next = 18;
72
90
  break;
73
- }
74
91
 
75
- _context.next = 11;
76
- return dispatch.topoTreeMod.fetchTopoTree({
77
- id: id
78
- });
92
+ case 16:
93
+ _context.next = 18;
94
+ return _this.refreshTopoTree();
79
95
 
80
- case 11:
81
- _context.next = 13;
82
- return dispatch.topoTreeMod.getSelectedTopoId();
96
+ case 18:
97
+ if (id) {
98
+ // 左侧树切换选中
99
+ dispatch.topoTreeMod.selectNode(id);
100
+ }
83
101
 
84
- case 13:
85
- id = _context.sent;
86
- _context.next = 18;
87
- break;
102
+ if (!(viewType === 'create')) {
103
+ _context.next = 24;
104
+ break;
105
+ }
88
106
 
89
- case 16:
90
- _context.next = 18;
91
- return _this.refreshTopoTree();
92
-
93
- case 18:
94
- if (id) {
95
- // 左侧树切换选中
96
- dispatch.topoTreeMod.selectNode(id);
97
- }
107
+ _context.next = 22;
108
+ return _this.openCreateTopoPage({
109
+ id: id
110
+ });
98
111
 
99
- if (!(viewType === 'create')) {
100
- _context.next = 24;
112
+ case 22:
113
+ _context.next = 29;
101
114
  break;
102
- }
103
115
 
104
- _context.next = 22;
105
- return _this.openCreateTopoPage({
106
- id: id
107
- });
116
+ case 24:
117
+ if (!params.selectedElementTag) {
118
+ _context.next = 27;
119
+ break;
120
+ }
108
121
 
109
- case 22:
110
- _context.next = 29;
111
- break;
112
-
113
- case 24:
114
- if (!params.selectedElementTag) {
115
122
  _context.next = 27;
116
- break;
117
- }
123
+ return dispatch.selection.update({
124
+ initSelectionId: params.selectedElementTag
125
+ });
118
126
 
119
- _context.next = 27;
120
- return dispatch.selection.update({
121
- initSelectionId: params.selectedElementTag
122
- });
127
+ case 27:
128
+ _context.next = 29;
129
+ return dispatch.topoMod.initData((0, _extends2["default"])({}, params, {
130
+ type: params.type,
131
+ id: id
132
+ }));
123
133
 
124
- case 27:
125
- _context.next = 29;
126
- return dispatch.topoMod.initData((0, _extends2["default"])({}, params, {
127
- type: params.type,
128
- id: id
129
- }));
134
+ case 29:
135
+ _this.update({
136
+ loading: false
137
+ }); // 是否打开概览
130
138
 
131
- case 29:
132
- _this.update({
133
- loading: false
134
- }); // 是否打开概览
135
139
 
140
+ if (!params.openResourceOverview) {
141
+ _context.next = 33;
142
+ break;
143
+ }
136
144
 
137
- if (!params.openResourceOverview) {
138
145
  _context.next = 33;
146
+ return dispatch.resourceDetail.update({
147
+ visible: true,
148
+ id: params.openResourceOverview
149
+ });
150
+
151
+ case 33:
152
+ case "end":
153
+ return _context.stop();
154
+ }
155
+ }, _callee);
156
+ }))();
157
+ },
158
+
159
+ /**
160
+ * 退出。
161
+ */
162
+ exit: function exit(playload, rootState) {
163
+ return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
164
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
165
+ while (1) switch (_context2.prev = _context2.next) {
166
+ case 0:
167
+ _context2.next = 2;
168
+ return dispatch.topoMod.exit(playload);
169
+
170
+ case 2:
171
+ case "end":
172
+ return _context2.stop();
173
+ }
174
+ }, _callee2);
175
+ }))();
176
+ },
177
+ openCreateTopoPage: function openCreateTopoPage(playload, state) {
178
+ var _this2 = this;
179
+
180
+ return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
181
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
182
+ while (1) switch (_context3.prev = _context3.next) {
183
+ case 0:
184
+ if (playload === void 0) {
185
+ playload = {};
186
+ }
187
+
188
+ _this2.update({
189
+ viewState: 'create',
190
+ id: playload.id
191
+ });
192
+
193
+ dispatch.topoCreate.init(playload); // history.replace(`/default/topoCenter?type=create&id=${playload.id}`);
194
+
195
+ case 3:
196
+ case "end":
197
+ return _context3.stop();
198
+ }
199
+ }, _callee3);
200
+ }))();
201
+ },
202
+
203
+ /**
204
+ *
205
+ * @param playload {{id: string, linkTo:?object}}
206
+ */
207
+ openTopoPage: function openTopoPage(playload, rootState) {
208
+ var _this3 = this;
209
+
210
+ return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
211
+ var id, viewState;
212
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
213
+ while (1) switch (_context4.prev = _context4.next) {
214
+ case 0:
215
+ id = playload.id, viewState = playload.viewState; // 左侧树切换选中
216
+
217
+ dispatch.topoTreeMod.selectNode(id);
218
+
219
+ _this3.update({
220
+ viewState: viewState || 'view'
221
+ });
222
+
223
+ if (!id) {
224
+ _context4.next = 8;
225
+ break;
226
+ }
227
+
228
+ _context4.next = 6;
229
+ return dispatch.topoMod.openTopoPage(playload);
230
+
231
+ case 6:
232
+ _context4.next = 10;
139
233
  break;
140
- }
141
-
142
- _context.next = 33;
143
- return dispatch.resourceDetail.update({
144
- visible: true,
145
- id: params.openResourceOverview
146
- });
147
-
148
- case 33:
149
- case "end":
150
- return _context.stop();
151
- }
152
- }, _callee);
153
- }))();
154
- },
155
-
156
- /**
157
- * 退出。
158
- */
159
- exit: function exit(playload, rootState) {
160
- return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
161
- return _regenerator["default"].wrap(function _callee2$(_context2) {
162
- while (1) switch (_context2.prev = _context2.next) {
163
- case 0:
164
- _context2.next = 2;
165
- return dispatch.topoMod.exit(playload);
166
-
167
- case 2:
168
- case "end":
169
- return _context2.stop();
170
- }
171
- }, _callee2);
172
- }))();
173
- },
174
- openCreateTopoPage: function openCreateTopoPage(playload, state) {
175
- var _this2 = this;
176
-
177
- return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
178
- return _regenerator["default"].wrap(function _callee3$(_context3) {
179
- while (1) switch (_context3.prev = _context3.next) {
180
- case 0:
181
- if (playload === void 0) {
182
- playload = {};
183
- }
184
-
185
- _this2.update({
186
- viewState: 'create',
187
- id: playload.id
188
- });
189
-
190
- dispatch.topoCreate.init(playload); // history.replace(`/default/topoCenter?type=create&id=${playload.id}`);
191
-
192
- case 3:
193
- case "end":
194
- return _context3.stop();
195
- }
196
- }, _callee3);
197
- }))();
198
- },
199
-
200
- /**
201
- *
202
- * @param playload {{id: string, linkTo:?object}}
203
- */
204
- openTopoPage: function openTopoPage(playload, rootState) {
205
- var _this3 = this;
206
-
207
- return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
208
- var id, viewState;
209
- return _regenerator["default"].wrap(function _callee4$(_context4) {
210
- while (1) switch (_context4.prev = _context4.next) {
211
- case 0:
212
- id = playload.id, viewState = playload.viewState; // 左侧树切换选中
213
-
214
- dispatch.topoTreeMod.selectNode(id);
215
-
216
- _this3.update({
217
- viewState: viewState || 'view'
218
- });
219
-
220
- if (!id) {
221
- _context4.next = 8;
222
- break;
223
- }
224
-
225
- _context4.next = 6;
226
- return dispatch.topoMod.openTopoPage(playload);
227
-
228
- case 6:
229
- _context4.next = 10;
230
- break;
231
-
232
- case 8:
233
- _context4.next = 10;
234
- return dispatch.topoMod.clearData();
235
-
236
- case 10:
237
- case "end":
238
- return _context4.stop();
239
- }
240
- }, _callee4);
241
- }))();
242
- },
243
- refreshTopoTree: function refreshTopoTree() {
244
- return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
245
- return _regenerator["default"].wrap(function _callee5$(_context5) {
246
- while (1) switch (_context5.prev = _context5.next) {
247
- case 0:
248
- _context5.next = 2;
249
- return dispatch.topoTreeMod.refreshTree();
250
-
251
- case 2:
252
- case "end":
253
- return _context5.stop();
254
- }
255
- }, _callee5);
256
- }))();
257
- }
258
- };
259
- }
260
- };
261
- exports["default"] = _default;
234
+
235
+ case 8:
236
+ _context4.next = 10;
237
+ return dispatch.topoMod.clearData();
238
+
239
+ case 10:
240
+ case "end":
241
+ return _context4.stop();
242
+ }
243
+ }, _callee4);
244
+ }))();
245
+ },
246
+ refreshTopoTree: function refreshTopoTree() {
247
+ return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
248
+ return _regenerator["default"].wrap(function _callee5$(_context5) {
249
+ while (1) switch (_context5.prev = _context5.next) {
250
+ case 0:
251
+ _context5.next = 2;
252
+ return dispatch.topoTreeMod.refreshTree();
253
+
254
+ case 2:
255
+ case "end":
256
+ return _context5.stop();
257
+ }
258
+ }, _callee5);
259
+ }))();
260
+ },
261
+ refreshGlobalConfig: function refreshGlobalConfig() {
262
+ return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
263
+ var result, extraConfig;
264
+ return _regenerator["default"].wrap(function _callee6$(_context6) {
265
+ while (1) switch (_context6.prev = _context6.next) {
266
+ case 0:
267
+ if (topo.id) {
268
+ _context6.next = 2;
269
+ break;
270
+ }
271
+
272
+ return _context6.abrupt("return");
273
+
274
+ case 2:
275
+ _context6.next = 4;
276
+ return topo.options.loadData(topo.id, topo.serverApi);
277
+
278
+ case 4:
279
+ result = _context6.sent;
280
+ result = (0, _topoData.parseTopoData)(result);
281
+ extraConfig = result.global.extraConfig;
282
+ _context6.next = 9;
283
+ return dispatch.displayConfig.setConfig((0, _extends2["default"])({}, extraConfig, {
284
+ alarmSwitch: result.global.alarmSwitch,
285
+ alarmListDefaultOpen: result.global.alarmListDefaultOpen
286
+ }));
287
+
288
+ case 9:
289
+ case "end":
290
+ return _context6.stop();
291
+ }
292
+ }, _callee6);
293
+ }))();
294
+ }
295
+ };
296
+ }
297
+ };
298
+ }
package/lib/style.js CHANGED
@@ -2,8 +2,8 @@ require('@riil-frontend/component-topology-graph/lib/style');
2
2
  require('@alifd/next/lib/box/style');
3
3
  require('@riil-frontend/component-topology-utils/lib/style');
4
4
  require('@alifd/next/lib/message/style');
5
- require('@riil-frontend/component-riil-event-emitter/lib/style');
6
5
  require('@riil-frontend/utils/lib/style');
6
+ require('@riil-frontend/component-riil-event-emitter/lib/style');
7
7
  require('@alifd/next/lib/menu-button/style');
8
8
  require('@alifd/next/lib/search/style');
9
9
  require('@alifd/next/lib/drawer/style');
@@ -30,7 +30,7 @@ function getCiRefAttributesMap(ciDatas, ciTypeMap) {
30
30
  var id = ciData.id;
31
31
  var attributeMap = ciData.attributeMap || ciData.attributes;
32
32
  ciRefAttributeMap[id] = [];
33
- var typeCode = ciData.typeCode || ciData.ciType;
33
+ var typeCode = ciData.ciType || ciData.typeCode;
34
34
  var ciTypeMeta = ciTypeMap[typeCode];
35
35
 
36
36
  if (ciTypeMeta) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "12.0.0-dev.25",
3
+ "version": "12.0.0-dev.27",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -123,6 +123,6 @@
123
123
  "access": "public"
124
124
  },
125
125
  "license": "MIT",
126
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@12.0.0-dev.25/build/index.html",
126
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@12.0.0-dev.27/build/index.html",
127
127
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
128
128
  }