@riil-frontend/component-topology 8.0.0-a.1 → 8.0.0-a.11

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 (59) hide show
  1. package/build/index.css +1 -1
  2. package/build/index.js +13 -13
  3. package/es/core/common/icons/basicIcons.js +1 -1
  4. package/es/core/common/icons/icon.js +6 -2
  5. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +42 -24
  6. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +7 -2
  7. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +4 -0
  8. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -0
  9. package/es/core/editor/utils/edgeTypeStyleUtil.js +2 -3
  10. package/es/core/hooks/usePolling.js +3 -3
  11. package/es/core/models/TopoApp.js +2 -2
  12. package/es/core/models/tagstips/ElementTagTipConfig.js +1 -1
  13. package/es/core/models/topoData.js +9 -1
  14. package/es/core/models/utils/linkUtils.js +31 -63
  15. package/es/core/services/overview.js +33 -9
  16. package/es/core/services/topo/basic.js +34 -0
  17. package/es/core/services/topo/constants.js +1 -0
  18. package/es/core/services/topo/index.js +4 -0
  19. package/es/core/store/models/topoConfig.js +6 -1
  20. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +124 -251
  21. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +4 -2
  22. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +2 -2
  23. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +171 -0
  24. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +3 -3
  25. package/es/core/viewer/components/titlebar/widgets/SearchWidget.js +4 -0
  26. package/es/networkTopo/services/topo/basic.js +4 -2
  27. package/es/networkTopo/store/linkManager.js +0 -1
  28. package/es/networkTopo/store/topoCenter.js +0 -1
  29. package/es/networkTopo/store/topoLinkMod.js +0 -1
  30. package/lib/core/common/icons/basicIcons.js +1 -1
  31. package/lib/core/common/icons/icon.js +6 -2
  32. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +43 -24
  33. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +8 -2
  34. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +4 -0
  35. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -0
  36. package/lib/core/editor/utils/edgeTypeStyleUtil.js +2 -3
  37. package/lib/core/hooks/usePolling.js +3 -3
  38. package/lib/core/models/TopoApp.js +3 -3
  39. package/lib/core/models/tagstips/ElementTagTipConfig.js +2 -2
  40. package/lib/core/models/topoData.js +9 -1
  41. package/lib/core/models/utils/linkUtils.js +32 -67
  42. package/lib/core/services/overview.js +32 -8
  43. package/lib/core/services/topo/basic.js +46 -0
  44. package/lib/core/services/topo/constants.js +6 -0
  45. package/lib/core/services/topo/index.js +16 -0
  46. package/lib/core/store/models/topoConfig.js +6 -1
  47. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +125 -251
  48. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +4 -2
  49. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +2 -2
  50. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +184 -0
  51. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +3 -3
  52. package/lib/core/viewer/components/titlebar/widgets/SearchWidget.js +4 -0
  53. package/lib/networkTopo/services/topo/basic.js +4 -2
  54. package/lib/networkTopo/store/linkManager.js +0 -2
  55. package/lib/networkTopo/store/topoCenter.js +0 -2
  56. package/lib/networkTopo/store/topoLinkMod.js +0 -2
  57. package/package.json +2 -2
  58. /package/es/core/services/{topo.js → topo/tagtip.js} +0 -0
  59. /package/lib/core/services/{topo.js → topo/tagtip.js} +0 -0
@@ -19,7 +19,7 @@ export default [{
19
19
  'name': '人员',
20
20
  'url': '/img/topo/basicIcon/人员平面.svg'
21
21
  }, {
22
- 'id': 'system.building',
22
+ 'id': 'system.楼宇',
23
23
  'name': '楼宇',
24
24
  'url': '/img/topo/basicIcon/楼宇平面.svg'
25
25
  }, {
@@ -37,11 +37,15 @@ export function getResourceIcons(topo) {
37
37
  */
38
38
 
39
39
  export function getBasicIcons(topo, containsGroupIcon) {
40
+ var nodeIcons = topoManager.iconLibManager.getNodeIcons().filter(function (icon) {
41
+ return !icon.ciType;
42
+ });
43
+
40
44
  if (containsGroupIcon === false) {
41
- return basicIcons;
45
+ return [].concat(nodeIcons, basicIcons);
42
46
  }
43
47
 
44
- return [topoManager.iconLibManager.getGroupIcon()].concat(basicIcons);
48
+ return [topoManager.iconLibManager.getGroupIcon()].concat(nodeIcons, basicIcons);
45
49
  }
46
50
  export function getGroupDefaultIcons(topo) {
47
51
  return [].concat(topoManager.iconLibManager.getIcons());
@@ -2,6 +2,7 @@ import _Field from "@alifd/next/es/field";
2
2
  import _Select from "@alifd/next/es/select";
3
3
  import _Form from "@alifd/next/es/form";
4
4
  import React, { useEffect } from 'react';
5
+ import { getEdgesBySelection, loopEdgesAndChildren } from "../../../../utils/edgeTypeStyleUtil";
5
6
  import styles from "./EdgeType.module.scss";
6
7
  import LineType from "./LineType";
7
8
  var FormItem = _Form.Item;
@@ -60,43 +61,60 @@ var LINE_MOLD_OPTIONS = [{
60
61
  icon: 'topo_lineMold_dotted_two'
61
62
  }];
62
63
 
63
- function getValuesBySelection(selection) {
64
+ function getValuesByEdges(topo) {
65
+ function getStartPoint(edge) {
66
+ var icons = edge.s('icons') || {};
67
+ return ['sourceArrow', 'sourceSolidCircle', 'sourceNoneCircle'].filter(function (name) {
68
+ return icons[name];
69
+ })[0] || 'nil';
70
+ }
71
+
72
+ function getEndPoint(edge) {
73
+ var icons = edge.s('icons') || {};
74
+ return ['targetArrow', 'targetSolidCircle', 'targetNoneCircle'].filter(function (name) {
75
+ return icons[name];
76
+ })[0] || 'nil';
77
+ }
78
+
79
+ var selectionEdges = getEdgesBySelection(topo);
80
+ var edgeValues = [];
81
+ loopEdgesAndChildren(topo, selectionEdges, function (edge) {
82
+ edgeValues.push({
83
+ lineButton: edge.s('edge.type'),
84
+ startPoint: getStartPoint(edge),
85
+ endPoint: getEndPoint(edge),
86
+ lineMold: edge.a('lineMode') || 'solidLine'
87
+ });
88
+ });
64
89
  var values = {
90
+ lineButton: undefined,
65
91
  startPoint: undefined,
66
92
  endPoint: undefined,
67
93
  lineMold: undefined
68
- }; // 仅一条连线选中时回显
69
-
70
- if (selection.length === 1) {
71
- var edge = selection[0];
72
- values = {
73
- startPoint: 'nil',
74
- endPoint: 'nil',
75
- lineMold: edge.a('lineMode') || 'solidLine'
76
- };
77
- var icons = edge.s('icons') || {};
78
- ['sourceArrow', 'sourceSolidCircle', 'sourceNoneCircle'].forEach(function (name) {
79
- if (icons[name]) {
80
- values.startPoint = name;
81
- }
94
+ };
95
+ Object.keys(values).forEach(function (name) {
96
+ var vals = edgeValues.map(function (item) {
97
+ return item[name];
82
98
  });
83
- ['targetArrow', 'targetSolidCircle', 'targetNoneCircle'].forEach(function (name) {
84
- if (icons[name]) {
85
- values.endPoint = name;
86
- }
87
- });
88
- }
99
+ var isSame = vals.filter(function (val) {
100
+ return val === vals[0];
101
+ }).length === vals.length;
89
102
 
103
+ if (isSame) {
104
+ values[name] = vals[0];
105
+ }
106
+ });
90
107
  return values;
91
108
  }
92
109
 
93
110
  function EdgeType(props) {
94
- var selection = props.selection,
111
+ var topo = props.topo,
112
+ selection = props.selection,
95
113
  _onChange = props.onChange;
96
114
 
97
115
  var field = _Field.useField({
98
116
  autoUnmount: false,
99
- values: getValuesBySelection(selection),
117
+ values: getValuesByEdges(topo),
100
118
  onChange: function onChange(name, value) {
101
119
  if (['startPoint', 'endPoint'].includes(name) && value === 'nil') {
102
120
  _onChange(name, null);
@@ -107,7 +125,7 @@ function EdgeType(props) {
107
125
  });
108
126
 
109
127
  useEffect(function () {
110
- field.setValues(getValuesBySelection(selection));
128
+ field.setValues(getValuesByEdges(topo));
111
129
  }, [selection]);
112
130
  return /*#__PURE__*/React.createElement("div", {
113
131
  className: styles.lineBox
@@ -1,6 +1,7 @@
1
1
  import _Button from "@alifd/next/es/button";
2
2
  import _Balloon from "@alifd/next/es/balloon";
3
3
  import React, { useState } from 'react';
4
+ import classNames from 'classnames';
4
5
  import styles from "./LineType.module.scss";
5
6
  var Tooltip = _Balloon.Tooltip;
6
7
  var LINE_TYPE_OPTIONS = [{
@@ -25,11 +26,14 @@ var LINE_TYPE_OPTIONS = [{
25
26
  icon: 'topo_linear_icon_arcline'
26
27
  }];
27
28
  var LineType = /*#__PURE__*/React.forwardRef(function (props, ref) {
28
- var onChange = props.onChange;
29
+ var value = props.value,
30
+ onChange = props.onChange;
29
31
 
30
32
  function lineButton(item) {
33
+ var _classNames;
34
+
31
35
  return /*#__PURE__*/React.createElement(_Button, {
32
- className: "" + styles.redioBtn,
36
+ className: classNames(styles.redioBtn, (_classNames = {}, _classNames[styles.selected] = value === item.value, _classNames)),
33
37
  onClick: function onClick() {
34
38
  onChange(item.value);
35
39
  }
@@ -50,4 +54,5 @@ var LineType = /*#__PURE__*/React.forwardRef(function (props, ref) {
50
54
  }, item.label);
51
55
  }));
52
56
  });
57
+ LineType.displayName = 'LineType';
53
58
  export default LineType;
@@ -21,6 +21,10 @@
21
21
  &:hover {
22
22
  background: #F2F7FD !important;
23
23
  }
24
+
25
+ &.selected {
26
+ background: #F2F7FD !important;
27
+ }
24
28
  }
25
29
  .redioBtn:last-child{
26
30
  margin-right: 0;
@@ -109,6 +109,7 @@ function EdgeTypeButton(props) {
109
109
  disabled: disabled,
110
110
  trigger: icon
111
111
  }, !disabled && /*#__PURE__*/React.createElement(EdgeType, {
112
+ topo: topo,
112
113
  selection: selection,
113
114
  onChange: handleChange
114
115
  })));
@@ -14,8 +14,7 @@ export function getEdgesBySelection(topo) {
14
14
  return nodeIds;
15
15
  };
16
16
 
17
- var getSelectedEdges = function getSelectedEdges(topo) {
18
- var gv = topo.getGraphView();
17
+ var getSelectedEdges = function getSelectedEdges(gv) {
19
18
  var selection = gv.getSelectionModel().getSelection().toArray(); // 选中的连线
20
19
 
21
20
  var edges = selection.filter(function (element) {
@@ -41,7 +40,7 @@ export function getEdgesBySelection(topo) {
41
40
  return edges;
42
41
  };
43
42
 
44
- return getSelectedEdges(topo);
43
+ return getSelectedEdges(topo.getGraphView());
45
44
  }
46
45
  /**
47
46
  * 遍历连线及子连线
@@ -21,9 +21,9 @@ var usePolling = function usePolling(props) {
21
21
  var resIdsList = resAndMetrics === null || resAndMetrics === void 0 ? void 0 : resAndMetrics.resIdsList; // 轮询hooks
22
22
 
23
23
  var _useRequest = useRequest(refresh, {
24
- pollingInterval: 1000 * 15,
25
- // pollingWhenHidden: false,
26
- // debounceInterval: 1000,
24
+ pollingInterval: 60 * 1000,
25
+ pollingWhenHidden: false,
26
+ // debounceInterval: 200,
27
27
  manual: true,
28
28
  onSuccess: function onSuccess(result) {
29
29
  if (result) {
@@ -1,10 +1,10 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- import topoService from '@riil-frontend/component-topology-common/es/services/topo';
5
4
  import { setRequest } from '@riil-frontend/component-topology-utils';
6
5
  import rlog from '@riil-frontend/component-topology-utils/es/rlog';
7
6
  import { cloneDeep } from 'lodash';
7
+ import topoService from "../services/topo";
8
8
  import CiTypeCache from "./cache/CiTypeCache";
9
9
  import Alarm from "./Alarm";
10
10
  import TopoGraphView from "./TopoGraphView";
@@ -23,7 +23,7 @@ import topoFactory from "./topoFactory";
23
23
  import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
24
24
  import SelectionModel from "./SelectionModel"; // eslint-disable-next-line no-undef
25
25
 
26
- var version = typeof "8.0.0-a.1" === 'string' ? "8.0.0-a.1" : null;
26
+ var version = typeof "8.0.0-a.11" === 'string' ? "8.0.0-a.11" : null;
27
27
  console.info("\u62D3\u6251\u7248\u672C: " + version);
28
28
  /**
29
29
  * 拓扑显示和编辑
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import { getLinkMtCodes, getMonitorTemplateCodesFromTopoData, getMtCodeCiTypeMap, getNodeMtCodes } from "./utils";
5
- import { getMetricsByMonitorTemplateCodes } from "../../services/topo";
5
+ import { getMetricsByMonitorTemplateCodes } from "../../services/topo/tagtip";
6
6
  import rlog from '@riil-frontend/component-topology-utils/lib/rlog';
7
7
 
8
8
  var ElementTagTipConfig = /*#__PURE__*/function () {
@@ -4,8 +4,16 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import { TOPO_PARENT_ID } from "@riil-frontend/component-topology-common/es/services/topo";
5
5
  import rlog from "@riil-frontend/component-topology-utils/es/rlog";
6
6
  export function getLayoutId(layout) {
7
- if (!layout || typeof layout === "string") {
7
+ if (!layout) {
8
8
  return layout;
9
+ } // 拖拽添加分层后点击保存ht传参不正确,临时适配
10
+
11
+
12
+ if (typeof layout === "string") {
13
+ return {
14
+ v: 'towardeast',
15
+ h: 'towardsouth'
16
+ }[layout] || layout;
9
17
  }
10
18
 
11
19
  var id = layout.id,
@@ -1,12 +1,12 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- import topoService from '@riil-frontend/component-topology-common/es/services/topo';
5
4
  import keyBy from 'lodash/keyBy';
6
5
  import _ from 'lodash';
7
6
  import { queryCisByIds, queryModelAsset } from "../../services"; // 查询所有连线
8
7
 
9
- import { getEdges } from "../../../utils/htElementUtils"; // const interfaceTypeMap = {
8
+ import { getEdges } from "../../../utils/htElementUtils";
9
+ import CiTypeCache from "../cache/CiTypeCache"; // const interfaceTypeMap = {
10
10
  // "network.interface": {
11
11
  // displayName: "网络接口",
12
12
  // },
@@ -33,40 +33,6 @@ export function isCrucialLink(link) {
33
33
  export function isExitLink(link) {
34
34
  return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes['destination_id']);
35
35
  }
36
- export var getInterfaceObject = /*#__PURE__*/function () {
37
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(codes) {
38
- var query, promises, result, ifDoc;
39
- return _regeneratorRuntime.wrap(function _callee$(_context) {
40
- while (1) {
41
- switch (_context.prev = _context.next) {
42
- case 0:
43
- query = _.compact(_.uniq(codes));
44
- promises = query.map(queryModelAsset);
45
- _context.next = 4;
46
- return Promise.all(promises);
47
-
48
- case 4:
49
- result = _context.sent;
50
- ifDoc = {};
51
- result.map(function (ifItem) {
52
- ifDoc[ifItem.code] = {
53
- displayName: ifItem.displayName
54
- };
55
- });
56
- return _context.abrupt("return", ifDoc);
57
-
58
- case 8:
59
- case "end":
60
- return _context.stop();
61
- }
62
- }
63
- }, _callee);
64
- }));
65
-
66
- return function getInterfaceObject(_x) {
67
- return _ref.apply(this, arguments);
68
- };
69
- }();
70
36
  export function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc) {
71
37
  var linkCiMap = keyBy(links, 'id');
72
38
  return links.map(function (link) {
@@ -110,57 +76,59 @@ export function mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc
110
76
  });
111
77
  });
112
78
  }
113
- export function getLinksDetail(_x2, _x3) {
79
+ export function getLinksDetail(_x, _x2) {
114
80
  return _getLinksDetail.apply(this, arguments);
115
81
  }
116
82
 
117
83
  function _getLinksDetail() {
118
- _getLinksDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(links, nodes) {
84
+ _getLinksDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(links, nodes) {
119
85
  var linkCis, interfaceIds, interfaceTypes, interfaceCis, interfaceDoc;
120
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
86
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
121
87
  while (1) {
122
- switch (_context2.prev = _context2.next) {
88
+ switch (_context.prev = _context.next) {
123
89
  case 0:
124
90
  if (!(!links || !links.length)) {
125
- _context2.next = 2;
91
+ _context.next = 2;
126
92
  break;
127
93
  }
128
94
 
129
- return _context2.abrupt("return", []);
95
+ return _context.abrupt("return", []);
130
96
 
131
97
  case 2:
132
98
  // const linkCis = await topoService.relation.batchQueryRelation(
133
99
  // links.map((link) => link.id)
134
100
  // );
135
101
  linkCis = links;
136
- interfaceIds = [];
137
- interfaceTypes = [];
138
- linkCis.forEach(function (item) {
139
- interfaceIds.push(item.attributes.source_id);
140
- interfaceIds.push(item.attributes.destination_id);
141
- interfaceTypes.push(item.attributes.source_type);
142
- interfaceTypes.push(item.attributes.destination_type);
102
+ interfaceIds = [].concat(linkCis.map(function (item) {
103
+ return item.attributes.source_id;
104
+ }), linkCis.map(function (item) {
105
+ return item.attributes.destination_id;
106
+ }));
107
+ interfaceTypes = _.compact(_.uniq([].concat(linkCis.map(function (item) {
108
+ return item.attributes.source_type;
109
+ }), linkCis.map(function (item) {
110
+ return item.attributes.destination_type;
111
+ })))).filter(function (item) {
112
+ return item !== 'ip';
143
113
  });
144
- _context2.next = 8;
114
+ _context.next = 7;
145
115
  return queryCisByIds(interfaceIds);
146
116
 
147
- case 8:
148
- interfaceCis = _context2.sent;
149
- _context2.next = 11;
150
- return getInterfaceObject(interfaceTypes.filter(function (item) {
151
- return item !== 'ip';
152
- }));
117
+ case 7:
118
+ interfaceCis = _context.sent;
119
+ _context.next = 10;
120
+ return CiTypeCache.getCiTypeMap(interfaceTypes);
153
121
 
154
- case 11:
155
- interfaceDoc = _context2.sent;
156
- return _context2.abrupt("return", mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc));
122
+ case 10:
123
+ interfaceDoc = _context.sent;
124
+ return _context.abrupt("return", mergeLinksData(links, linkCis, nodes, interfaceCis, interfaceDoc));
157
125
 
158
- case 13:
126
+ case 12:
159
127
  case "end":
160
- return _context2.stop();
128
+ return _context.stop();
161
129
  }
162
130
  }
163
- }, _callee2);
131
+ }, _callee);
164
132
  }));
165
133
  return _getLinksDetail.apply(this, arguments);
166
134
  }
@@ -1,7 +1,11 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { request } from '@riil-frontend/component-topology-utils';
4
- import { commonQueryCiDataByIds } from "./cmdb";
4
+ import { commonQueryCiDataByIds } from "./cmdb"; // 机房可上架设备类型缓存数据
5
+
6
+ var roomDeviceTypeList = null; // 资源子组件缓存
7
+
8
+ var ciComponentsMap = {};
5
9
  export default {
6
10
  /**
7
11
  * 根据资源id获取风险
@@ -35,19 +39,31 @@ export default {
35
39
  */
36
40
  queryAllComponentsByCiId: function queryAllComponentsByCiId(id) {
37
41
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
42
+ var components;
38
43
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
39
44
  while (1) {
40
45
  switch (_context2.prev = _context2.next) {
41
46
  case 0:
42
- _context2.next = 2;
47
+ components = ciComponentsMap[id];
48
+
49
+ if (components) {
50
+ _context2.next = 6;
51
+ break;
52
+ }
53
+
54
+ _context2.next = 4;
43
55
  return request.post('/mdc/v1/api/cmdb/queryAllComponentsByCiId', {
44
56
  id: id
45
57
  });
46
58
 
47
- case 2:
48
- return _context2.abrupt("return", _context2.sent);
59
+ case 4:
60
+ components = _context2.sent;
61
+ ciComponentsMap[id] = components;
49
62
 
50
- case 3:
63
+ case 6:
64
+ return _context2.abrupt("return", components);
65
+
66
+ case 7:
51
67
  case "end":
52
68
  return _context2.stop();
53
69
  }
@@ -186,13 +202,21 @@ export default {
186
202
  while (1) {
187
203
  switch (_context8.prev = _context8.next) {
188
204
  case 0:
189
- _context8.next = 2;
190
- return request.post("/room/v1/api/device/type/list", {});
205
+ if (roomDeviceTypeList) {
206
+ _context8.next = 4;
207
+ break;
208
+ }
191
209
 
192
- case 2:
193
- return _context8.abrupt("return", _context8.sent);
210
+ _context8.next = 3;
211
+ return request.post("/room/v1/api/device/type/list", {});
194
212
 
195
213
  case 3:
214
+ roomDeviceTypeList = _context8.sent;
215
+
216
+ case 4:
217
+ return _context8.abrupt("return", roomDeviceTypeList);
218
+
219
+ case 5:
196
220
  case "end":
197
221
  return _context8.stop();
198
222
  }
@@ -0,0 +1,34 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { request } from '@riil-frontend/component-topology-utils';
4
+ import { TOPO_API_ROOT } from "./constants";
5
+ export default {
6
+ /**
7
+ * 保存拓扑绘制数据(第三方库内部结构,无需关心含义)
8
+ * @param {Number} id Topo ID
9
+ * @param {String} data ht拓扑序列化数据
10
+ * @returns
11
+ */
12
+ saveSerializeData: function saveSerializeData(id, data) {
13
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
14
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
15
+ while (1) {
16
+ switch (_context.prev = _context.next) {
17
+ case 0:
18
+ _context.next = 2;
19
+ return request.post(TOPO_API_ROOT + "/structure/" + id, {
20
+ data: data
21
+ });
22
+
23
+ case 2:
24
+ return _context.abrupt("return", _context.sent);
25
+
26
+ case 3:
27
+ case "end":
28
+ return _context.stop();
29
+ }
30
+ }
31
+ }, _callee);
32
+ }))();
33
+ }
34
+ };
@@ -0,0 +1 @@
1
+ export var TOPO_API_ROOT = '/topo/v1/api';
@@ -0,0 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import topoService from '@riil-frontend/component-topology-common/es/services/topo';
3
+ import basic from "./basic";
4
+ export default _extends({}, topoService, basic);
@@ -385,7 +385,12 @@ export default function (topoApp) {
385
385
  alarmListDefaultOpen: displayConfig.alarmListDefaultOpen,
386
386
  extraConfig: JSON.stringify(_extends({}, displayConfig, {
387
387
  // 背景图,便于加载拓扑直接显示背景图
388
- background: topoApp.store.getModelState("background").current
388
+ background: topoApp.store.getModelState("background").current,
389
+ // 增加保存日志,便于排查链路重复问题 2023-4-12 19:27:18
390
+ saveHistories: [{
391
+ date: new Date().toLocaleString(),
392
+ version: topoApp.version
393
+ }].concat(displayConfig.saveHistories || [])
389
394
  }))
390
395
  };
391
396
  rlog.debug('saveGlobalConfig', config);