@riil-frontend/component-topology 13.0.0-dev.8 → 13.0.0-dev.9

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.
@@ -1,14 +1,68 @@
1
1
  import _Balloon from "@alifd/next/es/balloon";
2
+ import _extends from "@babel/runtime/helpers/extends";
2
3
 
3
4
  /* eslint-disable eqeqeq */
4
5
 
5
6
  /* eslint-disable jsx-a11y/alt-text */
6
7
  import React, { useState, useEffect, useRef, useCallback } from 'react';
8
+ import PropTypes from 'prop-types';
7
9
  import classnames from 'classnames';
8
10
  import Color from 'color';
9
11
  import { SketchPicker } from 'react-color';
10
12
  import ColorBlock from "./components/ColorBlock";
11
13
  import styles from "./index.module.scss";
14
+ var defaultColorList = [{
15
+ color: 'rgba(255, 255, 255, 1)',
16
+ borderColor: 'rgba(219, 219, 219, 1)'
17
+ }, {
18
+ color: 'rgba(245, 245, 245, 1)',
19
+ borderColor: 'rgba(208, 208, 208, 1)'
20
+ }, {
21
+ color: 'rgba(230, 230, 230, 1)',
22
+ borderColor: 'rgba(196, 196, 196, 1)'
23
+ }, {
24
+ color: 'rgba(168, 168, 168, 1)',
25
+ borderColor: 'rgba(146, 146, 146, 1)'
26
+ }, {
27
+ color: 'rgba(97, 97, 97, 1)',
28
+ borderColor: 'rgba(85, 85, 85, 1)'
29
+ }, {
30
+ color: 'rgba(49, 49, 49, 1)',
31
+ borderColor: 'rgba(43, 43, 43, 1)'
32
+ }, {
33
+ color: 'rgba(251, 115, 80, 1)',
34
+ borderColor: 'rgba(213, 98, 69, 1)'
35
+ }, {
36
+ color: 'rgba(255, 166, 41, 1)',
37
+ borderColor: 'rgba(219, 144, 45, 1)'
38
+ }, {
39
+ color: 'rgba(255, 205, 42, 1)',
40
+ borderColor: 'rgba(216, 175, 37, 1)'
41
+ }, {
42
+ color: 'rgba(18, 174, 92, 1)',
43
+ borderColor: 'rgba(23, 148, 79, 1)'
44
+ }, {
45
+ color: 'rgba(83, 184, 255, 1)',
46
+ borderColor: 'rgba(74, 156, 217, 1)'
47
+ }, {
48
+ color: 'rgba(183, 128, 255, 1)',
49
+ borderColor: 'rgba(155, 109, 216, 1)'
50
+ }, {
51
+ color: 'rgba(254, 192, 174, 1)',
52
+ borderColor: 'rgba(217, 163, 148, 1)'
53
+ }, {
54
+ color: 'rgba(252, 209, 156, 1)',
55
+ borderColor: 'rgba(215, 178, 133, 1)'
56
+ }, {
57
+ color: 'rgba(255, 232, 163, 1)',
58
+ borderColor: 'rgba(217, 198, 139, 1)'
59
+ }, {
60
+ color: 'rgba(176, 244, 197, 1)',
61
+ borderColor: 'rgba(153, 209, 171, 1)'
62
+ }, {
63
+ color: 'rgba(189, 227, 255, 1)',
64
+ borderColor: 'rgba(161, 193, 217, 1)'
65
+ }];
12
66
  /**
13
67
  * 颜色选择
14
68
  *
@@ -22,7 +76,9 @@ function ColorPanel(props) {
22
76
 
23
77
  var value = props.value,
24
78
  showClear = props.showClear,
25
- dataSource = props.dataSource,
79
+ _props$dataSource = props.dataSource,
80
+ dataSource = _props$dataSource === void 0 ? defaultColorList : _props$dataSource,
81
+ colorPickerBalloonProps = props.colorPickerBalloonProps,
26
82
  onChange = props.onChange,
27
83
  onPickerFocus = props.onPickerFocus,
28
84
  onPickerBlur = props.onPickerBlur;
@@ -169,9 +225,7 @@ function ColorPanel(props) {
169
225
  onClick: function onClick() {
170
226
  changClick('17');
171
227
  }
172
- }, /*#__PURE__*/React.createElement(_Balloon, {
173
- visible: visible,
174
- trigger: defaultTrigger,
228
+ }, /*#__PURE__*/React.createElement(_Balloon, _extends({
175
229
  closable: false,
176
230
  triggerType: "click",
177
231
  animation: false,
@@ -180,9 +234,12 @@ function ColorPanel(props) {
180
234
  alignEdge: true,
181
235
  style: {
182
236
  paddingBottom: 0
183
- },
237
+ }
238
+ }, colorPickerBalloonProps, {
239
+ visible: visible,
240
+ trigger: defaultTrigger,
184
241
  onClose: close
185
- }, /*#__PURE__*/React.createElement(SketchPicker, {
242
+ }), /*#__PURE__*/React.createElement(SketchPicker, {
186
243
  color: data !== null && data !== void 0 ? data : undefined // width={230}
187
244
  ,
188
245
  disableAlpha: true,
@@ -198,61 +255,14 @@ function ColorPanel(props) {
198
255
  }))))));
199
256
  }
200
257
 
258
+ ColorPanel.propTypes = {
259
+ dataSource: PropTypes.array
260
+ };
201
261
  ColorPanel.defaultProps = {
202
262
  value: undefined,
203
263
  showClear: false,
204
- dataSource: [{
205
- color: 'rgba(255, 255, 255, 1)',
206
- borderColor: 'rgba(219, 219, 219, 1)'
207
- }, {
208
- color: 'rgba(245, 245, 245, 1)',
209
- borderColor: 'rgba(208, 208, 208, 1)'
210
- }, {
211
- color: 'rgba(230, 230, 230, 1)',
212
- borderColor: 'rgba(196, 196, 196, 1)'
213
- }, {
214
- color: 'rgba(168, 168, 168, 1)',
215
- borderColor: 'rgba(146, 146, 146, 1)'
216
- }, {
217
- color: 'rgba(97, 97, 97, 1)',
218
- borderColor: 'rgba(85, 85, 85, 1)'
219
- }, {
220
- color: 'rgba(49, 49, 49, 1)',
221
- borderColor: 'rgba(43, 43, 43, 1)'
222
- }, {
223
- color: 'rgba(251, 115, 80, 1)',
224
- borderColor: 'rgba(213, 98, 69, 1)'
225
- }, {
226
- color: 'rgba(255, 166, 41, 1)',
227
- borderColor: 'rgba(219, 144, 45, 1)'
228
- }, {
229
- color: 'rgba(255, 205, 42, 1)',
230
- borderColor: 'rgba(216, 175, 37, 1)'
231
- }, {
232
- color: 'rgba(18, 174, 92, 1)',
233
- borderColor: 'rgba(23, 148, 79, 1)'
234
- }, {
235
- color: 'rgba(83, 184, 255, 1)',
236
- borderColor: 'rgba(74, 156, 217, 1)'
237
- }, {
238
- color: 'rgba(183, 128, 255, 1)',
239
- borderColor: 'rgba(155, 109, 216, 1)'
240
- }, {
241
- color: 'rgba(254, 192, 174, 1)',
242
- borderColor: 'rgba(217, 163, 148, 1)'
243
- }, {
244
- color: 'rgba(252, 209, 156, 1)',
245
- borderColor: 'rgba(215, 178, 133, 1)'
246
- }, {
247
- color: 'rgba(255, 232, 163, 1)',
248
- borderColor: 'rgba(217, 198, 139, 1)'
249
- }, {
250
- color: 'rgba(176, 244, 197, 1)',
251
- borderColor: 'rgba(153, 209, 171, 1)'
252
- }, {
253
- color: 'rgba(189, 227, 255, 1)',
254
- borderColor: 'rgba(161, 193, 217, 1)'
255
- }],
264
+ dataSource: defaultColorList,
265
+ colorPickerBalloonProps: {},
256
266
  onChange: function onChange() {},
257
267
  onPickerFocus: function onPickerFocus() {},
258
268
  onPickerBlur: function onPickerBlur() {}
@@ -15,6 +15,8 @@ function FontColorDropdown(props) {
15
15
  background = props.background,
16
16
  _props$fieldDisabled = props.fieldDisabled,
17
17
  fieldDisabled = _props$fieldDisabled === void 0 ? {} : _props$fieldDisabled,
18
+ colorPickerBalloonProps = props.colorPickerBalloonProps,
19
+ backgroundPickerBalloonProps = props.backgroundPickerBalloonProps,
18
20
  onChange = props.onChange,
19
21
  onColorChange = props.onColorChange,
20
22
  onBackgroundChange = props.onBackgroundChange,
@@ -27,11 +29,9 @@ function FontColorDropdown(props) {
27
29
  var backgroundEnabled = fieldDisabled.background !== true;
28
30
  var opacityEnabled = fieldDisabled.opacity !== true;
29
31
 
30
- var onFocus = function onFocus() {// topo.historyManager.beginTransaction();
31
- };
32
+ var onFocus = function onFocus() {};
32
33
 
33
- var onBlur = function onBlur() {// topo.historyManager.endTransaction();
34
- };
34
+ var onBlur = function onBlur() {};
35
35
 
36
36
  var icon = disabled ? /*#__PURE__*/React.createElement("img", {
37
37
  src: "/img/topo/editor/toolbar/\u6587\u5B57\u989C\u8272\u53CA\u586B\u5145/Disable.svg",
@@ -54,6 +54,7 @@ function FontColorDropdown(props) {
54
54
  }
55
55
  }, /*#__PURE__*/React.createElement(ColorPanel, {
56
56
  value: color,
57
+ colorPickerBalloonProps: colorPickerBalloonProps,
57
58
  onChange: onColorChange,
58
59
  onPickerFocus: onFocus,
59
60
  onPickerBlur: onBlur
@@ -80,6 +81,7 @@ function FontColorDropdown(props) {
80
81
  }, /*#__PURE__*/React.createElement(ColorPanel, {
81
82
  showClear: true,
82
83
  value: background,
84
+ colorPickerBalloonProps: backgroundPickerBalloonProps,
83
85
  onChange: onBackgroundChange,
84
86
  onPickerFocus: onFocus,
85
87
  onPickerBlur: onBlur
@@ -111,4 +113,8 @@ function FontColorD(props) {
111
113
  }));
112
114
  }
113
115
 
116
+ ColorPanel.defaultProps = {
117
+ colorPickerBalloonProps: {},
118
+ backgroundPickerBalloonProps: {}
119
+ };
114
120
  export default FontColorD;
@@ -32,7 +32,25 @@ function FontStyleSelect(props) {
32
32
  disabled = props.disabled,
33
33
  onChange = props.onChange,
34
34
  _props$fieldDisabled = props.fieldDisabled,
35
- fieldDisabled = _props$fieldDisabled === void 0 ? {} : _props$fieldDisabled;
35
+ fieldDisabled = _props$fieldDisabled === void 0 ? {} : _props$fieldDisabled,
36
+ hideItemTootip = props.hideItemTootip;
37
+
38
+ var renderMenuItemContent = function renderMenuItemContent(item) {
39
+ return /*#__PURE__*/React.createElement("div", {
40
+ style: {
41
+ display: 'flex',
42
+ alignItems: 'center'
43
+ }
44
+ }, /*#__PURE__*/React.createElement("img", {
45
+ src: "/img/topo/editor/toolbar/" + item.icon + "/" + (fieldDisabled[item.key] ? 'Disable' : 'Normal') + ".svg",
46
+ alt: ""
47
+ }), /*#__PURE__*/React.createElement("span", {
48
+ style: fieldDisabled[item.key] ? {} : {
49
+ color: variables['$color-text1-4']
50
+ }
51
+ }, item.label));
52
+ };
53
+
36
54
  return /*#__PURE__*/React.createElement(DropdownMenu, {
37
55
  value: value,
38
56
  valueRender: function valueRender() {
@@ -48,20 +66,8 @@ function FontStyleSelect(props) {
48
66
  return /*#__PURE__*/React.createElement(DropdownMenu.Item, {
49
67
  key: item.key,
50
68
  disabled: !!fieldDisabled[item.key]
51
- }, /*#__PURE__*/React.createElement(Tooltip, {
52
- trigger: /*#__PURE__*/React.createElement("div", {
53
- style: {
54
- display: 'flex',
55
- alignItems: 'center'
56
- }
57
- }, /*#__PURE__*/React.createElement("img", {
58
- src: "/img/topo/editor/toolbar/" + item.icon + "/" + (fieldDisabled[item.key] ? 'Disable' : 'Normal') + ".svg",
59
- alt: ""
60
- }), /*#__PURE__*/React.createElement("span", {
61
- style: fieldDisabled[item.key] ? {} : {
62
- color: variables['$color-text1-4']
63
- }
64
- }, item.label)),
69
+ }, hideItemTootip ? renderMenuItemContent(item) : /*#__PURE__*/React.createElement(Tooltip, {
70
+ trigger: renderMenuItemContent(item),
65
71
  align: "r",
66
72
  popupStyle: {}
67
73
  }, item.tooltip));
@@ -41,8 +41,7 @@ export default function (props) {
41
41
  var config = getConfigFromHt();
42
42
  return {
43
43
  resources: config.resources,
44
- groups: config.groups,
45
- relateTopoIdList: config.relateTopoIdList
44
+ groups: config.groups
46
45
  };
47
46
  };
48
47
 
@@ -24,7 +24,7 @@ import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
24
24
  import SelectionModel from "./SelectionModel";
25
25
  import CiCache from "./cache/CiCache"; // eslint-disable-next-line no-undef
26
26
 
27
- var version = typeof "13.0.0-dev.8" === 'string' ? "13.0.0-dev.8" : null;
27
+ var version = typeof "13.0.0-dev.9" === 'string' ? "13.0.0-dev.9" : null;
28
28
  console.info("\u62D3\u6251\u7248\u672C: " + version);
29
29
  /**
30
30
  * 拓扑显示和编辑
@@ -41,11 +41,11 @@ export function saveTopo(_x) {
41
41
 
42
42
  function _saveTopo() {
43
43
  _saveTopo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
44
- var topoService, topoId, template, layout, backgroundId, globalConfig, serialize, resources, groups, relateTopoIdList, viewGroupId, groupInfo, viewResources;
44
+ var topoService, topoId, template, layout, backgroundId, globalConfig, serialize, resources, groups, viewGroupId, groupInfo, viewResources;
45
45
  return _regeneratorRuntime.wrap(function _callee$(_context) {
46
46
  while (1) switch (_context.prev = _context.next) {
47
47
  case 0:
48
- topoService = data.topoService, topoId = data.id, template = data.template, layout = data.layout, backgroundId = data.backgroundId, globalConfig = data.globalConfig, serialize = data.serialize, resources = data.resources, groups = data.groups, relateTopoIdList = data.relateTopoIdList, viewGroupId = data.viewGroupId;
48
+ topoService = data.topoService, topoId = data.id, template = data.template, layout = data.layout, backgroundId = data.backgroundId, globalConfig = data.globalConfig, serialize = data.serialize, resources = data.resources, groups = data.groups, viewGroupId = data.viewGroupId;
49
49
  rlog.debug("saveTopo", data); // 保存布局
50
50
 
51
51
  if (!(template && layout)) {
@@ -97,8 +97,7 @@ function _saveTopo() {
97
97
  rlog.debug("saveTopo-groupInfo", groupInfo);
98
98
  _context.next = 15;
99
99
  return topoService.bindResourceToTopo(topoId, {
100
- groups: groupInfo,
101
- relateTopoIdList: relateTopoIdList
100
+ groups: groupInfo
102
101
  });
103
102
 
104
103
  case 15:
@@ -243,18 +243,17 @@ export default function (topoApp) {
243
243
  var _this2 = this;
244
244
 
245
245
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
246
- var editState, resources, _editState$groups, groups, relateTopoIdList, query, data;
246
+ var editState, resources, _editState$groups, groups, query, data;
247
247
 
248
248
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
249
249
  while (1) switch (_context2.prev = _context2.next) {
250
250
  case 0:
251
251
  editState = rootState.topoConfig;
252
- resources = editState.resources, _editState$groups = editState.groups, groups = _editState$groups === void 0 ? [] : _editState$groups, relateTopoIdList = editState.relateTopoIdList;
252
+ resources = editState.resources, _editState$groups = editState.groups, groups = _editState$groups === void 0 ? [] : _editState$groups;
253
253
  query = {
254
254
  id: rootState.topoMod.topoId,
255
255
  resources: resources,
256
- groups: groups,
257
- relateTopoIdList: relateTopoIdList
256
+ groups: groups
258
257
  };
259
258
  _context2.next = 5;
260
259
  return _this2.getTopoByConditions(query);
@@ -297,13 +296,13 @@ export default function (topoApp) {
297
296
  var _this4 = this;
298
297
 
299
298
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
300
- var topoId, resources, groups, relateTopoIdList, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
299
+ var topoId, resources, groups, viewConditions, groupInfo, data, _yield$Promise$all, dataWithLinkDetail, _combTopoData, topoData, resAndMetrics, topoDataTrans;
301
300
 
302
301
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
303
302
  while (1) switch (_context4.prev = _context4.next) {
304
303
  case 0:
305
304
  rlog.debug("getTopoByConditions--------", params);
306
- topoId = params.id, resources = params.resources, groups = params.groups, relateTopoIdList = params.relateTopoIdList;
305
+ topoId = params.id, resources = params.resources, groups = params.groups;
307
306
  viewConditions = resToConditions(resources);
308
307
  groupInfo = isAvailableArray(groups) && groups.map(function (group) {
309
308
  return _extends({}, group, {
@@ -313,7 +312,7 @@ export default function (topoApp) {
313
312
  });
314
313
  rlog.debug("getTopoByConditions--------", viewConditions, groupInfo);
315
314
  _context4.next = 7;
316
- return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo, relateTopoIdList);
315
+ return topoApp.serverApi.getTopoDataByResource(topoId, viewConditions, groupInfo);
317
316
 
318
317
  case 7:
319
318
  data = _context4.sent;
@@ -1,7 +1,5 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _extends from "@babel/runtime/helpers/extends";
4
- var _excluded = ["groups", "resources"];
5
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
6
4
  import { request } from '@riil-frontend/component-topology-utils';
7
5
  import { rlog } from '@riil-frontend/component-topology-utils';
@@ -9,7 +7,7 @@ import blackList from "./blacklist";
9
7
  import { TOPO_API_ROOT } from "./constants";
10
8
  import { getBatchCi as _getBatchCi, getBatchCiMetric as _getBatchCiMetric } from "../model";
11
9
  import { processByConditionResult, processExitLink } from "../../utils/exitLinkUtil";
12
- import * as processBothTopoDataUtil from "../../utils/relateTopoDataUtil";
10
+ import * as relateTopoDataUtil from "../../utils/relateTopoDataUtil";
13
11
  var API_ROOT = TOPO_API_ROOT;
14
12
  /**
15
13
  * 拓扑图(看做一个容器)的“父容器”ID
@@ -99,7 +97,8 @@ function prepareGroupParams(modifiedGroups) {
99
97
  };
100
98
  }).filter(Boolean);
101
99
  return {
102
- groups: groups
100
+ groups: groups,
101
+ relateTopoIdList: relateTopoDataUtil.getRelateTopoIdListFromConfig(modifiedGroups)
103
102
  };
104
103
  }
105
104
 
@@ -399,7 +398,7 @@ export default _extends({
399
398
  }),
400
399
  serialize: result.serialize ? JSON.parse(result.serialize) : undefined
401
400
  });
402
- result = processBothTopoDataUtil.processBothTopoData(result);
401
+ result = relateTopoDataUtil.processBothTopoData(result);
403
402
  result = processExitLink(result);
404
403
  return _context12.abrupt("return", result);
405
404
 
@@ -418,11 +417,11 @@ export default _extends({
418
417
  * @param {Array} groups
419
418
  * @returns
420
419
  */
421
- getTopoDataByResource: function getTopoDataByResource(id, resources, groups, relateTopoIdList) {
420
+ getTopoDataByResource: function getTopoDataByResource(id, resources, groups) {
422
421
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
423
422
  var _result$nodes2, _result$links2;
424
423
 
425
- var data, obj, result;
424
+ var data, params, result;
426
425
  return _regeneratorRuntime.wrap(function _callee13$(_context13) {
427
426
  while (1) switch (_context13.prev = _context13.next) {
428
427
  case 0:
@@ -436,11 +435,9 @@ export default _extends({
436
435
  });
437
436
  }
438
437
 
439
- obj = prepareGroupParams(data);
438
+ params = prepareGroupParams(data);
440
439
  _context13.next = 5;
441
- return request.post(API_ROOT + "/structure/byCondition/" + id, _extends({}, obj, {
442
- relateTopoIdList: relateTopoIdList
443
- }));
440
+ return request.post(API_ROOT + "/structure/byCondition/" + id, params);
444
441
 
445
442
  case 5:
446
443
  result = _context13.sent;
@@ -452,9 +449,14 @@ export default _extends({
452
449
  });
453
450
  })
454
451
  });
455
- return _context13.abrupt("return", processByConditionResult(result, obj.groups));
452
+ result = relateTopoDataUtil.processByConditionTopoData({
453
+ data: result,
454
+ config: data
455
+ });
456
+ result = processByConditionResult(result, params.groups);
457
+ return _context13.abrupt("return", result);
456
458
 
457
- case 8:
459
+ case 10:
458
460
  case "end":
459
461
  return _context13.stop();
460
462
  }
@@ -471,11 +473,11 @@ export default _extends({
471
473
  */
472
474
  bindResourceToTopo: function bindResourceToTopo(id, config) {
473
475
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
474
- var groups, resources, otherConfig, newGroups, obj;
476
+ var groups, resources, newGroups, obj;
475
477
  return _regeneratorRuntime.wrap(function _callee14$(_context14) {
476
478
  while (1) switch (_context14.prev = _context14.next) {
477
479
  case 0:
478
- groups = config.groups, resources = config.resources, otherConfig = _objectWithoutPropertiesLoose(config, _excluded);
480
+ groups = config.groups, resources = config.resources;
479
481
  newGroups = Array.isArray(groups) ? groups : [];
480
482
 
481
483
  if (resources) {
@@ -489,7 +491,7 @@ export default _extends({
489
491
 
490
492
  obj = prepareGroupParams(newGroups);
491
493
  _context14.next = 6;
492
- return request.post(API_ROOT + "/resource/" + id, _extends({}, otherConfig, obj));
494
+ return request.post(API_ROOT + "/resource/" + id, obj);
493
495
 
494
496
  case 6:
495
497
  return _context14.abrupt("return", _context14.sent);
@@ -25,10 +25,29 @@ export function processBothTopoData(topoData) {
25
25
  */
26
26
 
27
27
  export function processByConditionTopoData(ctx) {
28
- var topoData = ctx.topoData;
29
- var nodes = topoData.nodes,
30
- links = topoData.links;
31
- return _extends({}, topoData);
28
+ var data = ctx.data,
29
+ config = ctx.config;
30
+ var nodes = data.nodes,
31
+ links = data.links;
32
+ return _extends({}, data, {
33
+ nodes: [].concat(nodes, buildTopoNodeDatas(config)),
34
+ links: buildTopoLinks(links)
35
+ });
36
+ }
37
+ export function getRelateTopoIdListFromConfig(groups) {
38
+ var relateTopoIdList = [];
39
+ groups.forEach(function (g) {
40
+ g.resources["static"].filter(function (ciId) {
41
+ return ciId.startsWith('topo:');
42
+ }).map(function (ciId) {
43
+ return ciId.replace('topo:', '');
44
+ }).map(function (topoId) {
45
+ if (!relateTopoIdList.includes(topoId)) {
46
+ relateTopoIdList.push(topoId);
47
+ }
48
+ });
49
+ });
50
+ return relateTopoIdList;
32
51
  }
33
52
  export function buildTopoNode(topoId) {
34
53
  return {
@@ -50,7 +69,7 @@ export function buildTopoNode(topoId) {
50
69
  }
51
70
 
52
71
  function buildTopoLinks(links) {
53
- links.push.apply(links, topoLinks);
72
+ // links.push(...topoLinks)
54
73
  return links.map(function (link) {
55
74
  return _extends({}, link, {
56
75
  "source": link.sourceType ? link.sourceType + ':' + link.source : link.source,
@@ -104,6 +123,24 @@ function buildTopoNodeDatasFromSerialize(serialize) {
104
123
  return topoNodeDatas;
105
124
  }
106
125
 
126
+ function buildTopoNodeDatas(config) {
127
+ var topoNodeDatas = [];
128
+ config.forEach(function (g) {
129
+ g.resources["static"].filter(function (ciId) {
130
+ return ciId.startsWith('topo:');
131
+ }).map(function (ciId) {
132
+ return ciId.replace('topo:', '');
133
+ }).map(function (topoId) {
134
+ topoNodeDatas.push(_extends({}, buildTopoNode(topoId), {
135
+ // 添加资源拓扑节点消失的问题
136
+ 'groupId': g.id,
137
+ 'groupTag': g.tag
138
+ }));
139
+ });
140
+ });
141
+ return topoNodeDatas;
142
+ }
143
+
107
144
  function getRelateTopoIdsFromSerialize(serialize) {
108
145
  return serialize;
109
146
  }
@@ -41,23 +41,8 @@ function getResourceConfigFromHt(topo) {
41
41
  return {
42
42
  layers: sortBy(layers, 'order'),
43
43
  groups: groups,
44
- resources: resources,
45
- relateTopoIdList: getRelateTopoIdList(dataModel)
44
+ resources: resources
46
45
  };
47
- } // 查询关联拓扑id列表
48
-
49
-
50
- function getRelateTopoIdList(dataModel) {
51
- return getNodes(dataModel).reduce(function (topoIds, node) {
52
- var bindType = node.a('bindType');
53
- var bindTopo = node.a('bindTopo');
54
-
55
- if (bindType === 'topo' && bindTopo && !topoIds.includes(bindTopo)) {
56
- return [].concat(topoIds, [bindTopo]);
57
- }
58
-
59
- return topoIds;
60
- }, []);
61
46
  }
62
47
 
63
48
  function getLayerDatas(dataModel) {