@riil-frontend/component-topology 3.5.0-a.9 → 3.5.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.
Files changed (106) hide show
  1. package/build/1.js +1 -1
  2. package/build/index.css +1 -1
  3. package/build/index.js +12 -12
  4. package/es/components/index.module.scss +3 -114
  5. package/es/core/components/AlarmListPanel/index.js +7 -12
  6. package/es/core/components/DisplaySettingDrawer/DisplaySetting.js +8 -5
  7. package/es/core/components/DisplaySettingDrawer/NodeTag.js +10 -5
  8. package/es/core/components/DisplaySettingDrawer/NodeTip.js +10 -5
  9. package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +3 -21
  10. package/es/core/components/TopoView/topoView.js +1 -0
  11. package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +7 -140
  12. package/es/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +1 -1
  13. package/es/core/editor/components/settings/propertyViews/node/Setting/Setting.js +1 -1
  14. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +18 -17
  15. package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +62 -18
  16. package/es/core/models/Alarm.js +206 -120
  17. package/es/core/models/DataModel.js +15 -1
  18. package/es/core/models/TopoApp.js +4 -6
  19. package/es/core/models/cache/CiTyeCache.js +4 -0
  20. package/es/core/models/utils/linkUtils.js +87 -42
  21. package/es/core/services/index.js +28 -0
  22. package/es/core/utils/saveSerialize.js +34 -0
  23. package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +0 -37
  24. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +31 -28
  25. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +44 -43
  26. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +39 -26
  27. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useCiData.js +0 -0
  28. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +143 -0
  29. package/es/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +37 -0
  30. package/es/core/viewer/components/titlebar/BasicTools.js +11 -1
  31. package/es/core/viewer/components/titlebar/widgets/AlarmListShowButton.js +21 -13
  32. package/es/hooks/useGraphAlarmDisplay.js +3 -4
  33. package/es/hooks/useManageStatus.js +1 -1
  34. package/es/hooks/useTopoEdit.js +200 -144
  35. package/es/hooks/useTopoEventListener.js +13 -6
  36. package/es/index.js +3 -2
  37. package/es/models/topoConfig.js +0 -1
  38. package/es/models/topoMod.js +15 -10
  39. package/es/topoCenter/components/Topo404.js +3 -1
  40. package/es/topoCenter/components/TopoNoPermission.js +3 -1
  41. package/es/topoCenter/components/TopoView.js +77 -32
  42. package/es/topoCenter/components/Topology.js +2 -0
  43. package/es/topoCenter/components/editor/propertyViews/edge/EdgePropertyView.js +10 -0
  44. package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +5 -20
  45. package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +12 -6
  46. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +84 -43
  47. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +60 -34
  48. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/index.module.scss +9 -0
  49. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/server.js +62 -19
  50. package/es/topoCenter/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +157 -0
  51. package/es/topoCenter/components/editor/propertyViews/edge/link/LinkInfoPreview.js +1 -2
  52. package/es/topoCenter/hooks/editor/useDeleteEdges.js +2 -3
  53. package/es/topoCenter/utils/resourcePermissionUtil.js +18 -12
  54. package/es/utils/topoData.js +15 -13
  55. package/lib/components/index.module.scss +3 -114
  56. package/lib/core/components/AlarmListPanel/index.js +7 -12
  57. package/lib/core/components/DisplaySettingDrawer/DisplaySetting.js +9 -5
  58. package/lib/core/components/DisplaySettingDrawer/NodeTag.js +11 -5
  59. package/lib/core/components/DisplaySettingDrawer/NodeTip.js +12 -5
  60. package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +3 -21
  61. package/lib/core/components/TopoView/topoView.js +1 -0
  62. package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +7 -151
  63. package/lib/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +2 -2
  64. package/lib/core/editor/components/settings/propertyViews/node/Setting/Setting.js +1 -1
  65. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +17 -16
  66. package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +66 -20
  67. package/lib/core/models/Alarm.js +206 -121
  68. package/lib/core/models/DataModel.js +15 -1
  69. package/lib/core/models/TopoApp.js +4 -6
  70. package/lib/core/models/cache/CiTyeCache.js +4 -0
  71. package/lib/core/models/utils/linkUtils.js +92 -43
  72. package/lib/core/services/index.js +29 -0
  73. package/lib/core/utils/saveSerialize.js +43 -0
  74. package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +0 -37
  75. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +29 -26
  76. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +45 -43
  77. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +38 -24
  78. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useCiData.js +1 -0
  79. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +155 -0
  80. package/lib/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +47 -0
  81. package/lib/core/viewer/components/titlebar/BasicTools.js +11 -1
  82. package/lib/core/viewer/components/titlebar/widgets/AlarmListShowButton.js +22 -15
  83. package/lib/hooks/useGraphAlarmDisplay.js +3 -5
  84. package/lib/hooks/useManageStatus.js +1 -1
  85. package/lib/hooks/useTopoEdit.js +197 -141
  86. package/lib/hooks/useTopoEventListener.js +13 -6
  87. package/lib/index.js +5 -0
  88. package/lib/models/topoConfig.js +0 -1
  89. package/lib/models/topoMod.js +15 -10
  90. package/lib/topoCenter/components/Topo404.js +4 -1
  91. package/lib/topoCenter/components/TopoNoPermission.js +4 -1
  92. package/lib/topoCenter/components/TopoView.js +78 -33
  93. package/lib/topoCenter/components/Topology.js +3 -0
  94. package/lib/topoCenter/components/editor/propertyViews/edge/EdgePropertyView.js +22 -0
  95. package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +5 -21
  96. package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +13 -8
  97. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +87 -42
  98. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +61 -37
  99. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/index.module.scss +9 -0
  100. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/server.js +62 -18
  101. package/lib/topoCenter/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +183 -0
  102. package/lib/topoCenter/components/editor/propertyViews/edge/link/LinkInfoPreview.js +1 -2
  103. package/lib/topoCenter/hooks/editor/useDeleteEdges.js +2 -3
  104. package/lib/topoCenter/utils/resourcePermissionUtil.js +20 -12
  105. package/lib/utils/topoData.js +15 -13
  106. package/package.json +5 -5
@@ -7,13 +7,20 @@ export default function useTopoEventListener(props) {
7
7
  return "topo_" + n++;
8
8
  }, []);
9
9
  useEffect(function () {
10
- window.EE.on('topo', eventListenerName, function (data) {
11
- if (data.type === type) {
12
- onMessage(data.data);
13
- }
14
- });
10
+ var EE = window.EE;
11
+
12
+ if (EE) {
13
+ window.EE.on('topo', eventListenerName, function (data) {
14
+ if (data.type === type) {
15
+ onMessage(data.data);
16
+ }
17
+ });
18
+ }
19
+
15
20
  return function () {
16
- window.EE.removeListener('topo', eventListenerName);
21
+ if (EE) {
22
+ window.EE.removeListener('topo', eventListenerName);
23
+ }
17
24
  };
18
25
  }, [type, onMessage]);
19
26
  }
package/es/index.js CHANGED
@@ -1,7 +1,8 @@
1
- import { iconFactory } from '@riil-frontend/component-topology-graph';
1
+ import { iconFactory } from "@riil-frontend/component-topology-graph";
2
2
  import Topology from "./core/components/TopoView";
3
3
  import BasicTagTipDisplayConfig from "./core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig";
4
+ import AlarmListPanel from "./core/components/AlarmListPanel";
4
5
  import * as htElementUtils from "./utils/htElementUtils";
5
6
  export * from "./createTopo";
6
7
  export * from "./core/components/titlebar";
7
- export { Topology, htElementUtils, iconFactory, BasicTagTipDisplayConfig };
8
+ export { Topology, htElementUtils, iconFactory, AlarmListPanel, BasicTagTipDisplayConfig };
@@ -452,7 +452,6 @@ export default function (topoApp) {
452
452
  }, _callee7);
453
453
  }))();
454
454
  },
455
- switchToEditMode: function switchToEditMode() {},
456
455
  switchToViewMode: function switchToViewMode() {
457
456
  this.reset();
458
457
  dispatch.topoMod.switchToViewMode();
@@ -585,28 +585,32 @@ export default function (topoApp) {
585
585
  var _this8 = this;
586
586
 
587
587
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
588
- var id, update, topoPermission, getTopoPermission;
588
+ var id, update, topoPermission;
589
589
  return _regeneratorRuntime.wrap(function _callee11$(_context11) {
590
590
  while (1) {
591
591
  switch (_context11.prev = _context11.next) {
592
592
  case 0:
593
593
  id = playload.id, update = playload.update;
594
594
  _context11.prev = 1;
595
- getTopoPermission = topoApp.options.getTopoPermission || topoService.auth.getTopoPermission;
596
- _context11.next = 5;
597
- return getTopoPermission(id);
595
+ _context11.next = 4;
596
+ return topoService.auth.getTopoPermission(id);
598
597
 
599
- case 5:
598
+ case 4:
600
599
  topoPermission = _context11.sent;
601
- _context11.next = 11;
600
+ _context11.next = 10;
602
601
  break;
603
602
 
604
- case 8:
605
- _context11.prev = 8;
603
+ case 7:
604
+ _context11.prev = 7;
606
605
  _context11.t0 = _context11["catch"](1);
607
606
  rlog.error("\u67E5\u8BE2\u62D3\u6251" + id + "\u7684\u6743\u9650\u5931\u8D25", _context11.t0); // 尚未区分拓扑图不存在还是接口请求报错
608
607
 
609
- case 11:
608
+ case 10:
609
+ if (!topoPermission) {
610
+ _context11.next = 19;
611
+ break;
612
+ }
613
+
610
614
  _context11.next = 13;
611
615
  return dispatch.functionAuth.checkAuth('createTopo');
612
616
 
@@ -626,6 +630,7 @@ export default function (topoApp) {
626
630
  case 18:
627
631
  topoPermission = _context11.t1;
628
632
 
633
+ case 19:
629
634
  if (update !== false) {
630
635
  _this8.update({
631
636
  topoPermission: topoPermission
@@ -639,7 +644,7 @@ export default function (topoApp) {
639
644
  return _context11.stop();
640
645
  }
641
646
  }
642
- }, _callee11, null, [[1, 8]]);
647
+ }, _callee11, null, [[1, 7]]);
643
648
  }))();
644
649
  }
645
650
  };
@@ -1,10 +1,12 @@
1
1
  import React, { useState, useEffect, useRef, useCallback } from 'react';
2
2
  import NodataPage from '@riil-frontend/component-topology-common/es/components/NoDataPage/index';
3
+ import classNames from 'classnames';
3
4
  import styles from "../../components/index.module.scss";
4
5
  export default function Topo404(props) {
6
+ var className = props.className;
5
7
  return /*#__PURE__*/React.createElement(NodataPage, {
6
8
  imgSize: "large",
7
- className: styles.empty,
9
+ className: classNames(styles.empty, className),
8
10
  statusCode: "\u6B64\u62D3\u6251\u56FE\u65E0\u6CD5\u8BBF\u95EE\uFF0C\u53EF\u80FD\u5DF2\u88AB\u5220\u9664"
9
11
  });
10
12
  }
@@ -1,12 +1,14 @@
1
1
  import React, { useState, useEffect, useRef, useCallback } from 'react';
2
2
  import NodataPage from '@riil-frontend/component-topology-common/es/components/NoDataPage/index';
3
+ import classNames from 'classnames';
3
4
  import styles from "../../components/index.module.scss";
4
5
  export default function TopoNoPermission(props) {
6
+ var className = props.className;
5
7
  return /*#__PURE__*/React.createElement(NodataPage, {
6
8
  statusCode: "\u6CA1\u6709\u6743\u9650\u8BBF\u95EE\u6B64\u62D3\u6251\u56FE",
7
9
  imgSrc: "/img/topo/noPageAuthority.png",
8
10
  imgSize: "large",
9
- className: styles.empty
11
+ className: classNames(styles.empty, className)
10
12
  });
11
13
  }
12
14
  ;
@@ -1,8 +1,8 @@
1
1
  import _Loading from "@alifd/next/es/loading";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _extends from "@babel/runtime/helpers/extends";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
5
- var _excluded = ["topo", "titleBar", "onEnterEdit"];
5
+ var _excluded = ["topo", "titleBar", "onEnterEdit", "nodataPage", "notfoundPageProps", "noPermissionPageProps"];
6
6
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
7
  import React, { useState, useEffect, useRef, useCallback } from "react";
8
8
  import NodataPage from "@riil-frontend/component-topology-common/es/components/NoDataPage/index";
@@ -24,6 +24,9 @@ function NetworkTopologyCore(props) {
24
24
  var topo = props.topo,
25
25
  titleBar = props.titleBar,
26
26
  onEnterEdit = props.onEnterEdit,
27
+ nodataPage = props.nodataPage,
28
+ notfoundPageProps = props.notfoundPageProps,
29
+ noPermissionPageProps = props.noPermissionPageProps,
27
30
  otherProps = _objectWithoutPropertiesLoose(props, _excluded);
28
31
 
29
32
  var topoState = topo.store.useModelState("topoMod");
@@ -39,12 +42,78 @@ function NetworkTopologyCore(props) {
39
42
  });
40
43
 
41
44
  var renderTopoView = function renderTopoView() {
45
+ var hancleDisplaySettingOk = /*#__PURE__*/function () {
46
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(config) {
47
+ var edgeFlowConfig;
48
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
49
+ while (1) {
50
+ switch (_context.prev = _context.next) {
51
+ case 0:
52
+ // 单多链路切换
53
+ if (config.expandAllEdges) {
54
+ topo.getHtTopo().expandAllEdgeGroups();
55
+ } else {
56
+ topo.getHtTopo().collapseAllEdgeGroups();
57
+ } // 更新连线流动效果
58
+
59
+
60
+ edgeFlowConfig = config.edgeFlow ? {
61
+ type: config.edgeFlow,
62
+ // 必填,支持传送带drip、光点point、箭头arrow
63
+ direction: config.edgeFlowDirection || 'from' // 流动方向,可为空,默认源到目的
64
+
65
+ } : null;
66
+ topo.getHtTopo().setGlobalEdgeFlow(edgeFlowConfig); // 更新链路动态样式
67
+
68
+ if (topo.linkDynamicStyleExecutor) {
69
+ topo.linkDynamicStyleExecutor.execute();
70
+ }
71
+
72
+ case 4:
73
+ case "end":
74
+ return _context.stop();
75
+ }
76
+ }
77
+ }, _callee);
78
+ }));
79
+
80
+ return function hancleDisplaySettingOk(_x) {
81
+ return _ref.apply(this, arguments);
82
+ };
83
+ }();
84
+
42
85
  var viewerProps = _extends({}, props.viewerProps, {
43
86
  plugins: [],
44
87
  // 右侧工具栏按钮
45
88
  ViewerTitlebarRightTools: ViewerTools,
46
89
  displaySettingProps: {
47
- showLinkConfig: true,
90
+ // 资源标注选项配置
91
+ nodeTagProps: {
92
+ commonOptions: [{
93
+ value: 'graph:name',
94
+ label: '图片名称'
95
+ }, {
96
+ value: 'attribute:display_name',
97
+ label: '显示名称'
98
+ }, {
99
+ value: 'attribute:ipv4_address',
100
+ label: 'IP地址'
101
+ }]
102
+ },
103
+ // 资源悬浮框选项配置
104
+ nodeTipProps: {
105
+ commonOptions: [{
106
+ value: 'attribute:ipv4_address',
107
+ label: 'IP地址'
108
+ }, {
109
+ value: 'attribute:display_name',
110
+ label: '显示名称'
111
+ }, {
112
+ value: 'ciType:display_name',
113
+ label: '资源类型'
114
+ }]
115
+ },
116
+ showLinkConfig: false,
48
117
  // 是否显示链路相关配置
49
118
  linkTagConfig: function linkTagConfig(params) {
50
119
  return /*#__PURE__*/React.createElement(LinkTag, params);
@@ -54,34 +123,10 @@ function NetworkTopologyCore(props) {
54
123
  },
55
124
  showEdgeExpandConfig: true,
56
125
  // 是否显示连线展开折叠配置
57
- // 额外配置
126
+ // TODO 额外配置,单多链路切换、动态效果迁移到这里
58
127
  // extraConfig: () => <div>1111</div>,
59
128
  // 点击回调
60
- onOk: function () {
61
- var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
62
- return _regeneratorRuntime.wrap(function _callee$(_context) {
63
- while (1) {
64
- switch (_context.prev = _context.next) {
65
- case 0:
66
- // 更新链路动态样式
67
- if (topo.linkDynamicStyleExecutor) {
68
- topo.linkDynamicStyleExecutor.execute();
69
- }
70
-
71
- case 1:
72
- case "end":
73
- return _context.stop();
74
- }
75
- }
76
- }, _callee);
77
- }));
78
-
79
- function onOk() {
80
- return _onOk.apply(this, arguments);
81
- }
82
-
83
- return onOk;
84
- }()
129
+ onOk: hancleDisplaySettingOk
85
130
  }
86
131
  });
87
132
 
@@ -100,7 +145,7 @@ function NetworkTopologyCore(props) {
100
145
 
101
146
  var renderContent = function renderContent() {
102
147
  if (!loading && !topoId) {
103
- return /*#__PURE__*/React.createElement(NodataPage, {
148
+ return nodataPage || /*#__PURE__*/React.createElement(NodataPage, {
104
149
  imgSize: "large",
105
150
  className: styles.empty
106
151
  });
@@ -114,11 +159,11 @@ function NetworkTopologyCore(props) {
114
159
  if (!loading) {
115
160
  // 加载完成后
116
161
  if (topoPermission && !topoPermissonUtil.isReadable(topoPermission)) {
117
- return /*#__PURE__*/React.createElement(TopoNoPermission, null);
162
+ return /*#__PURE__*/React.createElement(TopoNoPermission, noPermissionPageProps);
118
163
  }
119
164
 
120
165
  if (!topoData) {
121
- return /*#__PURE__*/React.createElement(Topo404, null);
166
+ return /*#__PURE__*/React.createElement(Topo404, notfoundPageProps);
122
167
  }
123
168
  }
124
169
 
@@ -7,6 +7,7 @@ import EdgeGroupPropertyView from "./editor/propertyViews/edge/EdgeGroupProperty
7
7
  import LinkPropertyView from "./editor/propertyViews/edge/LinkPropertyView";
8
8
  import AddLinkDrawer from "./editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer";
9
9
  import useTopoEdit from "../hooks/useTopoEdit";
10
+ import EdgePropertyView from "./editor/propertyViews/edge/EdgePropertyView";
10
11
  export default function NetworkTopologyFull(props) {
11
12
  var topo = props.topo,
12
13
  customEditorProps = props.editorProps,
@@ -22,6 +23,7 @@ export default function NetworkTopologyFull(props) {
22
23
  },
23
24
  // 连线属性面板
24
25
  edgePropertyViews: {
26
+ edge: EdgePropertyView,
25
27
  link: LinkPropertyView,
26
28
  edgeGroup: EdgeGroupPropertyView
27
29
  },
@@ -0,0 +1,10 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import CommonEdgePropertyView from "../../../../../core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView";
4
+ import BindExitLinkSelect from "./link/BindExitLinkSelect";
5
+ export default function EdgePropertyView(props) {
6
+ var extraDisplaySetting = /*#__PURE__*/React.createElement(BindExitLinkSelect, props);
7
+ return /*#__PURE__*/React.createElement(CommonEdgePropertyView, _extends({}, props, {
8
+ extraDisplaySetting: extraDisplaySetting
9
+ }));
10
+ }
@@ -3,28 +3,13 @@ import React from "react";
3
3
  import LindInfoPreview from "../../link/LinkInfoPreview";
4
4
  import styles from "../../link/LinkInfoPreview.module.scss";
5
5
  import rlog from "@riil-frontend/component-topology-utils/es/rlog";
6
- import { getLinkPermission } from "../../../../../../utils/linPermissionUtil";
7
6
  import { useState, useEffect } from "react";
8
7
  export default function LinkDataTab(props) {
9
- var topo = props.topo,
10
- edge = props.edge;
11
- var nodes = topo.dataModel.getNodes();
12
-
13
- var _useState = useState(),
14
- link = _useState[0],
15
- setLink = _useState[1]; // 节点间只有连线组时,显示连线组的数据
8
+ var _link$permission;
16
9
 
17
-
18
- var _topo$store$useModelS = topo.store.useModelState("topoMod").data,
19
- links = _topo$store$useModelS.links,
20
- linkGroups = _topo$store$useModelS.linkGroups;
21
- var linkData = [].concat(links, linkGroups).find(function (item) {
22
- return item.id === edge.getTag();
23
- });
24
- useEffect(function () {
25
- setLink(linkData);
26
- }, [edge, linkData]);
27
- var permission = getLinkPermission(edge, nodes, link);
10
+ var topo = props.topo,
11
+ edge = props.edge,
12
+ link = props.link;
28
13
 
29
14
  var _topo$store$useModel = topo.store.useModel("topoConfig"),
30
15
  editState = _topo$store$useModel[0],
@@ -48,7 +33,7 @@ export default function LinkDataTab(props) {
48
33
  }, /*#__PURE__*/React.createElement(_Button, {
49
34
  className: styles.button,
50
35
  type: "primary",
51
- disabled: !permission.writeable,
36
+ disabled: !(link !== null && link !== void 0 && (_link$permission = link.permission) !== null && _link$permission !== void 0 && _link$permission.writeable),
52
37
  onClick: openEditLinkDrawer
53
38
  }, "\u7F16\u8F91")));
54
39
  }
@@ -1,10 +1,9 @@
1
1
  import _Tab from "@alifd/next/es/tab";
2
+ import _extends from "@babel/runtime/helpers/extends";
2
3
  import React from "react";
3
4
  import TabView from "../../../../../../core/editor/components/settings/common/tab/TabView";
4
5
  import Data from "./Data";
5
6
  import Setting from "./Setting";
6
- import { getLinkPermission } from "../../../../../../topoCenter/utils/linPermissionUtil.js";
7
- import { getNodes } from "../../../../../../utils/htElementUtils.js";
8
7
  export default function LinkPropertyView(props) {
9
8
  var edge = props.edge,
10
9
  topo = props.topo; // 无权限不显示数据页签
@@ -14,18 +13,25 @@ export default function LinkPropertyView(props) {
14
13
  linkGroups = _topo$store$useModelS.linkGroups;
15
14
  var link = [].concat(links, linkGroups).find(function (item) {
16
15
  return item.id === edge.getTag();
17
- }); // console.log("LinkPropertyView--getLinkPermission", links, link);
16
+ });
17
+ console.log('LinkPropertyView', link);
18
18
 
19
- var operation = getLinkPermission(edge, topo.getNodes(topo.dataModel), link);
19
+ if (link) {
20
+ var readable = link.permission.readable;
20
21
 
21
- if (!operation) {
22
+ if (!readable) {
23
+ return /*#__PURE__*/React.createElement(Setting, props);
24
+ }
25
+ } else {
22
26
  return /*#__PURE__*/React.createElement(Setting, props);
23
27
  }
24
28
 
25
29
  return /*#__PURE__*/React.createElement(TabView, null, /*#__PURE__*/React.createElement(_Tab.Item, {
26
30
  title: "\u6570\u636E",
27
31
  key: "1"
28
- }, /*#__PURE__*/React.createElement(Data, props)), /*#__PURE__*/React.createElement(_Tab.Item, {
32
+ }, /*#__PURE__*/React.createElement(Data, _extends({}, props, {
33
+ link: link
34
+ }))), /*#__PURE__*/React.createElement(_Tab.Item, {
29
35
  title: "\u8BBE\u7F6E",
30
36
  key: "2"
31
37
  }, /*#__PURE__*/React.createElement(Setting, props)));