@riil-frontend/component-topology 7.0.9 → 8.0.0-a.10

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 (73) hide show
  1. package/build/index.css +1 -1
  2. package/build/index.js +13 -13
  3. package/es/components/BatchAttrMetric/setting.js +0 -2
  4. package/es/core/common/icons/basicIcons.js +57 -0
  5. package/es/core/common/icons/icon.js +4 -6
  6. package/es/core/components/ResourceViewAttributeSetting/Setting.js +5 -11
  7. package/es/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +121 -0
  8. package/es/core/components/TopoView/GraphViewPanel.js +1 -2
  9. package/es/core/components/TopoView/topoView.js +3 -1
  10. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +42 -24
  11. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +7 -2
  12. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +4 -0
  13. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -0
  14. package/es/core/editor/utils/edgeTypeStyleUtil.js +2 -3
  15. package/es/core/hooks/useTopoEdit.js +35 -127
  16. package/es/core/models/AttributeMetricDisplay.js +4 -4
  17. package/es/core/models/TopoApp.js +2 -2
  18. package/es/core/models/tagstips/ElementTagTipConfig.js +18 -10
  19. package/es/core/models/topoData.js +9 -1
  20. package/es/core/models/utils/linkUtils.js +53 -91
  21. package/es/core/services/topo/basic.js +34 -0
  22. package/es/core/services/topo/constants.js +1 -0
  23. package/es/core/services/topo/index.js +4 -0
  24. package/es/core/store/models/topoBizMod.js +1 -11
  25. package/es/core/store/models/topoConfig.js +6 -7
  26. package/es/core/store/models/topoMod.js +74 -50
  27. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +1 -1
  28. package/es/core/viewer/components/titlebar/widgets/SearchWidget.js +4 -0
  29. package/es/networkTopo/getTopoData.js +72 -64
  30. package/es/networkTopo/models/TopoCenter.js +14 -94
  31. package/es/networkTopo/services/topo/basic.js +30 -10
  32. package/es/networkTopo/store/linkManager.js +0 -1
  33. package/es/networkTopo/store/topoCenter.js +0 -1
  34. package/es/networkTopo/store/topoLinkMod.js +0 -1
  35. package/es/networkTopo/utils/resourcePermissionUtil.js +2 -2
  36. package/es/utils/topoData.js +4 -169
  37. package/lib/components/BatchAttrMetric/setting.js +0 -4
  38. package/lib/core/common/icons/basicIcons.js +62 -0
  39. package/lib/core/common/icons/icon.js +5 -7
  40. package/lib/core/components/ResourceViewAttributeSetting/Setting.js +6 -11
  41. package/lib/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +127 -0
  42. package/lib/core/components/TopoView/GraphViewPanel.js +1 -2
  43. package/lib/core/components/TopoView/topoView.js +4 -1
  44. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +43 -24
  45. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +8 -2
  46. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +4 -0
  47. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -0
  48. package/lib/core/editor/utils/edgeTypeStyleUtil.js +2 -3
  49. package/lib/core/hooks/useTopoEdit.js +35 -129
  50. package/lib/core/models/AttributeMetricDisplay.js +4 -4
  51. package/lib/core/models/TopoApp.js +3 -3
  52. package/lib/core/models/tagstips/ElementTagTipConfig.js +19 -11
  53. package/lib/core/models/topoData.js +9 -1
  54. package/lib/core/models/utils/linkUtils.js +52 -93
  55. package/lib/core/services/topo/basic.js +46 -0
  56. package/lib/core/services/topo/constants.js +6 -0
  57. package/lib/core/services/topo/index.js +16 -0
  58. package/lib/core/store/models/topoBizMod.js +1 -11
  59. package/lib/core/store/models/topoConfig.js +5 -6
  60. package/lib/core/store/models/topoMod.js +71 -48
  61. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +1 -1
  62. package/lib/core/viewer/components/titlebar/widgets/SearchWidget.js +4 -0
  63. package/lib/networkTopo/getTopoData.js +73 -65
  64. package/lib/networkTopo/models/TopoCenter.js +14 -94
  65. package/lib/networkTopo/services/topo/basic.js +30 -10
  66. package/lib/networkTopo/store/linkManager.js +0 -2
  67. package/lib/networkTopo/store/topoCenter.js +0 -2
  68. package/lib/networkTopo/store/topoLinkMod.js +0 -2
  69. package/lib/networkTopo/utils/resourcePermissionUtil.js +2 -2
  70. package/lib/utils/topoData.js +6 -172
  71. package/package.json +2 -2
  72. /package/es/core/services/{topo.js → topo/tagtip.js} +0 -0
  73. /package/lib/core/services/{topo.js → topo/tagtip.js} +0 -0
@@ -27,8 +27,6 @@ var Setting = function Setting(_ref) {
27
27
  var limit = props.limit,
28
28
  saveCb = props.saveCb,
29
29
  elementType = props.elementType;
30
- rlog.debug("Setting-resAndMetrics-allCiSet-elementType", showType, props, elementType);
31
- rlog.debug("Setting----allCiSet", allCiSet);
32
30
 
33
31
  var _useState = useState(Object.keys(allCiSet)[0]),
34
32
  ciType = _useState[0],
@@ -0,0 +1,57 @@
1
+ export default [{
2
+ 'id': 'system.防火墙2.5D',
3
+ 'name': '防火墙',
4
+ 'url': '/img/topo/basicIcon/防火墙2.5D.svg'
5
+ }, {
6
+ 'id': 'system.云2.5D',
7
+ 'name': '云',
8
+ 'url': '/img/topo/basicIcon/云2.5D.svg'
9
+ }, {
10
+ 'id': 'system.五角星2.5D',
11
+ 'name': '五角星',
12
+ 'url': '/img/topo/basicIcon/五角星2.5D.svg'
13
+ }, {
14
+ 'id': 'system.旗帜2.5D',
15
+ 'name': '旗帜',
16
+ 'url': '/img/topo/basicIcon/旗帜2.5D.svg'
17
+ }, {
18
+ 'id': 'system.人员',
19
+ 'name': '人员',
20
+ 'url': '/img/topo/basicIcon/人员平面.svg'
21
+ }, {
22
+ 'id': 'system.楼宇',
23
+ 'name': '楼宇',
24
+ 'url': '/img/topo/basicIcon/楼宇平面.svg'
25
+ }, {
26
+ 'id': 'system.黑客',
27
+ 'name': '黑客',
28
+ 'url': '/img/topo/basicIcon/黑客平面.svg'
29
+ }, {
30
+ 'id': 'system.摄像头',
31
+ 'name': '摄像头',
32
+ 'url': '/img/topo/basicIcon/摄像头平面.svg'
33
+ }, {
34
+ 'id': 'system.蓝色云端',
35
+ 'name': '蓝色云端',
36
+ 'url': '/img/topo/basicIcon/云平面.svg'
37
+ }, {
38
+ 'id': 'system.五角星平面',
39
+ 'name': '五角星',
40
+ 'url': '/img/topo/basicIcon/五角星平面.svg'
41
+ }, {
42
+ 'id': 'system.旗帜平面',
43
+ 'name': '旗帜',
44
+ 'url': '/img/topo/basicIcon/旗帜平面.svg'
45
+ }, {
46
+ 'id': 'system.防火墙平面',
47
+ 'name': '防火墙',
48
+ 'url': '/img/topo/basicIcon/防火墙平面.svg'
49
+ }, {
50
+ 'id': 'system.线路平面',
51
+ 'name': '线路',
52
+ 'url': '/img/topo/basicIcon/线路平面.svg'
53
+ }, {
54
+ 'id': 'system.打印机平面',
55
+ 'name': '打印机',
56
+ 'url': '/img/topo/basicIcon/打印机平面.svg'
57
+ }];
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import topoManager from '@riil-frontend/component-topology-graph/es/manager';
3
3
  import { getCiModels } from "../../../constants/ResourceTypeLimit";
4
+ import basicIcons from "./basicIcons";
4
5
  /**
5
6
  * 获取默认图标
6
7
  * @param {*} topo
@@ -36,18 +37,15 @@ export function getResourceIcons(topo) {
36
37
  */
37
38
 
38
39
  export function getBasicIcons(topo, containsGroupIcon) {
39
- var icons = topoManager.iconLibManager.getIcons();
40
- icons = icons.filter(function (icon) {
40
+ var nodeIcons = topoManager.iconLibManager.getNodeIcons().filter(function (icon) {
41
41
  return !icon.ciType;
42
42
  });
43
43
 
44
44
  if (containsGroupIcon === false) {
45
- icons = icons.filter(function (icon) {
46
- return icon.type !== 'group';
47
- });
45
+ return [].concat(nodeIcons, basicIcons);
48
46
  }
49
47
 
50
- return icons;
48
+ return [topoManager.iconLibManager.getGroupIcon()].concat(nodeIcons, basicIcons);
51
49
  }
52
50
  export function getGroupDefaultIcons(topo) {
53
51
  return [].concat(topoManager.iconLibManager.getIcons());
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useState, useEffect, useRef, useCallback, useImperativeHandle, forwardRef, useMemo } from "react";
3
3
  import rlog from "@riil-frontend/component-topology-utils/es/rlog";
4
4
  import BatchAttrMetricDrawer from "../../../components/BatchAttrMetric";
5
+ import { getNodeCiModSet } from "./nodeCiTypeAttrUtil";
5
6
  /**
6
7
  * 资源显示属性、指标配置
7
8
  */
@@ -20,22 +21,15 @@ var ResourceDiplayInfoSetting = /*#__PURE__*/forwardRef(function (props, ref) {
20
21
  markData = _useState[0],
21
22
  setMarkarkData = _useState[1];
22
23
 
23
- var _topo$store$useModel = topo.store.useModel("topoBizMod"),
24
- bizState = _topo$store$useModel[0],
25
- bizDispatchers = _topo$store$useModel[1]; // rlog.debug('TopoView---income', topoId, viewState);
26
-
27
-
28
- var resAndMetrics = bizState.resAndMetrics;
29
- var allCiModSet = resAndMetrics.allCiModSet,
30
- allLinkModSet = resAndMetrics.allLinkModSet;
31
-
32
24
  var openMarkSetting = function openMarkSetting(parm) {
33
- rlog.debug("openMarkSetting", parm, elementType, showType, allCiModSet, allLinkModSet);
25
+ rlog.debug("openMarkSetting", parm, elementType, showType);
34
26
 
35
27
  if (queryData) {
36
28
  setMarkarkData(queryData());
37
29
  } else {
38
- setMarkarkData(elementType === "node" ? allCiModSet : allLinkModSet);
30
+ setMarkarkData(elementType === "node" ? getNodeCiModSet({
31
+ topo: topo
32
+ }) : undefined);
39
33
  }
40
34
 
41
35
  batchAttrMetric.current.show({
@@ -0,0 +1,121 @@
1
+ import { getCiTypesFromCiElements } from "../../../utils/topoData"; // 资源类型含有属性和指标集合
2
+
3
+ export function getNodeCiModSet(params) {
4
+ var topo = params.topo;
5
+ var data = topo.store.getModelState('topoMod').data;
6
+ var globalConfig = data.global.extraConfig;
7
+ var ciTypeMap = topo.ciTyeCache.ciTypes;
8
+
9
+ function getNodeModSet() {
10
+ var ciTypes = getCiTypesFromCiElements(data.nodes);
11
+ return getModSet(ciTypes);
12
+ }
13
+ /**
14
+ *
15
+ * @param {array} ciTypeCodes
16
+ * @returns
17
+ */
18
+
19
+
20
+ function getModSet(ciTypeCodes) {
21
+ var modSet = {};
22
+ Object.keys(ciTypeMap).filter(function (item) {
23
+ return ciTypeCodes.includes(item);
24
+ }).forEach(function (key) {
25
+ var ciTypeObj = ciTypeMap[key];
26
+ modSet[key] = {
27
+ name: ciTypeObj.displayName,
28
+ code: ciTypeObj.code,
29
+ icon: ciTypeObj.icon,
30
+ list: ciModfilter(ciTypeObj, globalConfig, 'node', ciTypeObj.code)
31
+ };
32
+ }); // console.log("modSet--------------------", modSet);
33
+
34
+ return modSet;
35
+ }
36
+ /**
37
+ * 过滤ci元数据中的属性和指标,用于属性和指标显示设置
38
+ * @param {} ciTypeObj
39
+ * @returns
40
+ */
41
+
42
+
43
+ function ciModfilter(ciTypeObj, globalSetting, type, code) {
44
+ var tips = globalSetting[type + "Tip"];
45
+ var tags = globalSetting[type + "Tag"];
46
+ var tipArr = [];
47
+ var tagArr = [];
48
+
49
+ if (tips !== null && tips !== void 0 && tips.isCustom) {
50
+ var _tips$data$code;
51
+
52
+ (_tips$data$code = tips.data[code]) === null || _tips$data$code === void 0 ? void 0 : _tips$data$code.map(function (item) {
53
+ tipArr.push(item.code + "-" + item.type);
54
+ });
55
+ }
56
+
57
+ if (tags !== null && tags !== void 0 && tags.isCustom) {
58
+ var _tags$data$code;
59
+
60
+ (_tags$data$code = tags.data[code]) === null || _tags$data$code === void 0 ? void 0 : _tags$data$code.map(function (item) {
61
+ tagArr.push(item.code + "-" + item.type);
62
+ });
63
+ } // rlog.debug(
64
+ // "过滤ci元数据中的属性和指标,用于属性和指标显示设置",
65
+ // globalSetting,
66
+ // tipArr,
67
+ // tagArr
68
+ // );
69
+
70
+
71
+ var custom = [];
72
+
73
+ if (type === 'node') {
74
+ custom.push({
75
+ id: 'name-graph',
76
+ code: 'name',
77
+ name: '图片名称',
78
+ type: 'custom',
79
+ tag: tagArr.indexOf('name-graph') >= 0,
80
+ tip: tipArr.indexOf('name-graph') >= 0
81
+ });
82
+ custom.push({
83
+ id: 'display_name-ciType',
84
+ code: 'ciType',
85
+ name: '资源类型',
86
+ type: 'custom',
87
+ tag: tagArr.indexOf('display_name-ciType') >= 0,
88
+ tip: tipArr.indexOf('display_name-ciType') >= 0
89
+ });
90
+ }
91
+
92
+ var attributes = ciTypeObj.attributes.filter(function (attr) {
93
+ return !!attr.userVisible;
94
+ }).map(function (item) {
95
+ var aid = item.code + "-attribute";
96
+ return {
97
+ id: aid,
98
+ code: item.code,
99
+ name: item.name,
100
+ type: 'attribute',
101
+ tag: tagArr.indexOf(aid) >= 0,
102
+ tip: tipArr.indexOf(aid) >= 0
103
+ };
104
+ });
105
+ var metrics = ciTypeObj.metrics.map(function (item) {
106
+ var mid = item.code + "-metric";
107
+ return {
108
+ id: mid,
109
+ code: item.code,
110
+ name: item.name,
111
+ type: 'metric',
112
+ tag: tagArr.indexOf(mid) >= 0,
113
+ tip: tipArr.indexOf(mid) >= 0
114
+ };
115
+ });
116
+ return [].concat(custom, attributes, metrics);
117
+ }
118
+
119
+ ;
120
+ return getNodeModSet();
121
+ }
@@ -33,7 +33,6 @@ export default function GraphViewPanel(props) {
33
33
  style: {
34
34
  background: canvasColor
35
35
  },
36
- onFocus: onFocus,
37
- on: true
36
+ onFocus: onFocus
38
37
  }, props.children);
39
38
  }
@@ -24,6 +24,7 @@ import Sidebar from "../../editor/components/Sidebar/Sidebar";
24
24
  import PropertyView from "../../editor/components/settings/PropertyView";
25
25
  import HistoryManager from "../../models/HistoryManager";
26
26
  import editorStyles from "./editor.module.scss";
27
+ import basicIcons from "../../common/icons/basicIcons";
27
28
 
28
29
  var Topology = function Topology(props) {
29
30
  var _classnames;
@@ -74,7 +75,7 @@ var Topology = function Topology(props) {
74
75
  topo: topo,
75
76
  topoId: topoId,
76
77
  isEditing: isEditMode,
77
- onSave: onSave,
78
+ onSave: editorProps.onSave || onSave,
78
79
  nodeDeleteable: nodeDeleteable,
79
80
  onNodeDelete: onNodeDelete,
80
81
  onLineDelete: onLineDelete,
@@ -236,6 +237,7 @@ var Topology = function Topology(props) {
236
237
  }),
237
238
  data: tData,
238
239
  defaultEnterEditMode: defaultEnterEditMode,
240
+ icons: [].concat(graphViewProps.icons || [], basicIcons),
239
241
  onCreate: onGraphCreated,
240
242
  onLoaded: handleGraphLoaded,
241
243
  onDataLoaded: handleGraphDataLoaded,
@@ -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
  * 遍历连线及子连线
@@ -692,58 +692,9 @@ var useTopoEdit = function useTopoEdit(params) {
692
692
  };
693
693
  }();
694
694
 
695
- function checkSavePermission(_x13) {
696
- return _checkSavePermission.apply(this, arguments);
697
- }
698
-
699
- function _checkSavePermission() {
700
- _checkSavePermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(id) {
701
- var permission;
702
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
703
- while (1) {
704
- switch (_context16.prev = _context16.next) {
705
- case 0:
706
- _context16.next = 2;
707
- return topoDispatchers.getTopoPermission({
708
- id: id,
709
- update: false
710
- });
711
-
712
- case 2:
713
- permission = _context16.sent;
714
-
715
- if (!topoPermissonUtil.isEditable(permission)) {
716
- _context16.next = 5;
717
- break;
718
- }
719
-
720
- return _context16.abrupt("return", true);
721
-
722
- case 5:
723
- _Dialog.alert({
724
- title: "没有权限进行此操作",
725
- content: "您的权限发生了变化,请联系相关管理员。",
726
- okProps: {
727
- children: "确定"
728
- },
729
- onOk: function onOk() {}
730
- });
731
-
732
- return _context16.abrupt("return", false);
733
-
734
- case 7:
735
- case "end":
736
- return _context16.stop();
737
- }
738
- }
739
- }, _callee16);
740
- }));
741
- return _checkSavePermission.apply(this, arguments);
742
- }
743
-
744
695
  var onSaveTopo = /*#__PURE__*/function () {
745
696
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(data) {
746
- var id, config, serialize, _config$layout, template, layout, saveConfig, valid, saveData;
697
+ var id, config, serialize, _config$layout, template, layout, saveConfig;
747
698
 
748
699
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
749
700
  while (1) {
@@ -752,85 +703,42 @@ var useTopoEdit = function useTopoEdit(params) {
752
703
  id = data.id, config = data.config, serialize = data.serialize;
753
704
  _config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
754
705
 
755
- if (!onSave) {
756
- _context8.next = 6;
757
- break;
758
- }
706
+ if (onSave) {
707
+ // 自定义保存
708
+ saveConfig = /*#__PURE__*/function () {
709
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
710
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
711
+ while (1) {
712
+ switch (_context7.prev = _context7.next) {
713
+ case 0:
714
+ _context7.next = 2;
715
+ return editDispatchers.saveTopo({
716
+ id: id,
717
+ layout: layout,
718
+ serialize: serialize
719
+ });
759
720
 
760
- // 自定义保存
761
- saveConfig = /*#__PURE__*/function () {
762
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
763
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
764
- while (1) {
765
- switch (_context7.prev = _context7.next) {
766
- case 0:
767
- _context7.next = 2;
768
- return editDispatchers.saveTopo({
769
- id: id,
770
- layout: layout,
771
- serialize: serialize
772
- });
773
-
774
- case 2:
775
- case "end":
776
- return _context7.stop();
721
+ case 2:
722
+ case "end":
723
+ return _context7.stop();
724
+ }
777
725
  }
778
- }
779
- }, _callee7);
780
- }));
781
-
782
- return function saveConfig() {
783
- return _ref7.apply(this, arguments);
784
- };
785
- }();
786
-
787
- onSave({
788
- data: data,
789
- saveConfig: saveConfig
790
- });
791
- return _context8.abrupt("return");
792
-
793
- case 6:
794
- // TODO 以下逻辑移到拓扑中心
795
- topoEditDispatchers.update({
796
- saving: true
797
- }); // 检查权限
798
-
799
- _context8.next = 9;
800
- return checkSavePermission(id);
801
-
802
- case 9:
803
- valid = _context8.sent;
804
-
805
- if (valid) {
806
- _context8.next = 13;
807
- break;
726
+ }, _callee7);
727
+ }));
728
+
729
+ return function saveConfig() {
730
+ return _ref7.apply(this, arguments);
731
+ };
732
+ }();
733
+
734
+ onSave({
735
+ topo: topo,
736
+ data: data,
737
+ saveConfig: saveConfig
738
+ });
808
739
  }
809
740
 
810
- topoEditDispatchers.update({
811
- saving: false
812
- });
813
- return _context8.abrupt("return");
814
-
815
- case 13:
816
- // 保存
817
- saveData = _extends({
818
- id: id,
819
- layout: layout,
820
- serialize: serialize
821
- }, resourceConfig.getConfig());
822
- rlog.info("保存", saveData);
823
- _context8.next = 17;
824
- return editDispatchers.saveTopo(saveData);
825
-
826
- case 17:
827
- topoEditDispatchers.update({
828
- saving: false
829
- });
830
-
831
- _Message.success("保存成功!");
832
-
833
- case 19:
741
+ case 3:
834
742
  case "end":
835
743
  return _context8.stop();
836
744
  }
@@ -838,7 +746,7 @@ var useTopoEdit = function useTopoEdit(params) {
838
746
  }, _callee8);
839
747
  }));
840
748
 
841
- return function onSaveTopo(_x14) {
749
+ return function onSaveTopo(_x13) {
842
750
  return _ref6.apply(this, arguments);
843
751
  };
844
752
  }();
@@ -1048,7 +956,7 @@ var useTopoEdit = function useTopoEdit(params) {
1048
956
  }, _callee10);
1049
957
  }));
1050
958
 
1051
- return function bindNodeResource(_x15) {
959
+ return function bindNodeResource(_x14) {
1052
960
  return _ref8.apply(this, arguments);
1053
961
  };
1054
962
  }();