@riil-frontend/component-topology 5.0.0-alpha.9 → 5.0.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 (195) hide show
  1. package/build/1.js +2 -2
  2. package/build/2.js +1 -1
  3. package/build/index.css +1 -1
  4. package/build/index.js +20 -20
  5. package/es/common/components/ColorPicker/ColorPicker.js +5 -3
  6. package/es/components/BatchAttrMetric/setting.js +3 -5
  7. package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +2 -1
  8. package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +2 -1
  9. package/es/core/components/DisplaySettingDrawer/LinkTip.js +5 -1
  10. package/es/core/components/DisplaySettingDrawer/demo/Demo.js +63 -0
  11. package/es/core/components/ResourceViewAttributeSetting/Setting.js +9 -48
  12. package/es/core/components/TopoView/TopoView.module.scss +1 -1
  13. package/es/core/components/TopoView/topoView.js +31 -22
  14. package/es/core/editor/components/BackgroundView/index.js +74 -35
  15. package/es/core/editor/components/settings/common/LineType/index.js +7 -1
  16. package/es/core/editor/components/settings/common/text/FontStyleCheckbox.js +3 -3
  17. package/es/core/editor/components/settings/common/text/TextStyle.js +21 -6
  18. package/es/core/editor/components/settings/common/text/fontStyleUtil.js +0 -1
  19. package/es/core/editor/components/settings/propertyViews/box/BoxPropertyView.js +12 -1
  20. package/es/core/editor/components/settings/propertyViews/box/NameInput.js +9 -1
  21. package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +15 -1
  22. package/es/core/editor/components/settings/propertyViews/group/DataTab/GroupNodeList.js +2 -0
  23. package/es/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandSetting.js +9 -5
  24. package/es/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandStatus.js +10 -2
  25. package/es/core/editor/components/settings/propertyViews/group/SettingTab/Setting.js +12 -1
  26. package/es/core/editor/components/settings/propertyViews/layer/SettingTab/Setting.js +13 -3
  27. package/es/core/editor/components/settings/propertyViews/layer/SettingTab/Setting_bak.js +0 -1
  28. package/es/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeIcon.js +2 -0
  29. package/es/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeSize/BatchSetNodeSize.js +2 -0
  30. package/es/core/editor/components/settings/propertyViews/multipleElements/MultipleElementPropertyView.js +4 -1
  31. package/es/core/editor/components/settings/propertyViews/node/Setting/Setting.js +4 -0
  32. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +34 -6
  33. package/es/core/editor/components/settings/propertyViews/text/TextPropertyView.js +9 -2
  34. package/es/core/editor/components/settings/propertyViews/view/BackgroundSize.js +30 -1
  35. package/es/core/editor/components/settings/propertyViews/view/GlobalLayout.js +2 -0
  36. package/es/core/editor/components/settings/propertyViews/view/GlobalNodeLabelStyle.js +15 -1
  37. package/es/core/editor/components/settings/propertyViews/view/hooks/useBackgroundSizeConfig.js +0 -1
  38. package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +4 -1
  39. package/es/core/editor/components/titlebar/widgets/DebugTools.js +29 -0
  40. package/es/core/hooks/useAlarm.js +18 -0
  41. package/es/core/hooks/useGraphAlarmDisplay.js +25 -3
  42. package/es/core/hooks/useResourceConfig.js +2 -1
  43. package/es/core/hooks/useRouterAdapter.js +7 -1
  44. package/es/core/hooks/useTopoEdit.js +220 -163
  45. package/es/core/models/AttributeMetricDisplay.js +31 -73
  46. package/es/core/models/HistoryManager.js +100 -50
  47. package/es/core/models/TopoApp.js +1 -1
  48. package/es/core/models/cache/CiTypeCache.js +10 -44
  49. package/es/core/models/cache/DictCache.js +2 -1
  50. package/es/core/models/graph/Background.js +31 -14
  51. package/es/core/models/tagstips/ElementTagTipConfig.js +46 -12
  52. package/es/core/models/tagstips/utils.js +1 -1
  53. package/es/core/models/topoData.js +7 -3
  54. package/es/core/models/utils/linkUtils.js +18 -0
  55. package/es/core/store/models/topoAlarm.js +5 -1
  56. package/es/core/store/models/topoMod.js +6 -31
  57. package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +51 -249
  58. package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawer.js +218 -0
  59. package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailPlugin.js +2 -2
  60. package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +1 -1
  61. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfoBlock.js +0 -1
  62. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +79 -43
  63. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +2 -3
  64. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +2 -2
  65. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +23 -0
  66. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.module.scss +11 -0
  67. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +34 -0
  68. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/constants.js +6 -0
  69. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +62 -0
  70. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +188 -0
  71. package/es/core/viewer/components/titlebar/BasicTools.js +1 -1
  72. package/es/core/viewer/components/titlebar/widgets/NodesDragSwitchWrapper.js +18 -0
  73. package/es/core/viewer/components/titlebar/widgets/SettingButton.js +11 -1
  74. package/es/networkTopo/components/TopoView.js +2 -1
  75. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +164 -225
  76. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/NetworkLinkForm.js +4 -0
  77. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +161 -137
  78. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/hooks/useAddLink.js +104 -0
  79. package/es/networkTopo/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +17 -7
  80. package/es/networkTopo/components/editor/propertyViews/edge/link/LinkInfoPreview.js +8 -9
  81. package/es/networkTopo/components/viewer/displaySetting/LinkAttrCustomSettingDrawer.js +59 -0
  82. package/es/networkTopo/components/viewer/displaySetting/LinkTagV2.js +10 -4
  83. package/es/networkTopo/getTopoData.js +11 -14
  84. package/es/networkTopo/hooks/editor/useDeleteEdges.js +11 -8
  85. package/es/networkTopo/hooks/viewer/useRelateTopo.js +1 -1
  86. package/es/networkTopo/models/LinkDynamicStyleExecutor.js +2 -0
  87. package/es/networkTopo/models/TopoCenter.js +1 -1
  88. package/es/networkTopo/services/index.js +6 -4
  89. package/es/networkTopo/services/link.js +2 -2
  90. package/es/networkTopo/store/topoCenter.js +5 -2
  91. package/es/networkTopo/store/topoTreeMod.js +84 -43
  92. package/es/networkTopo/utils/__tests__/resourcePermissionUtil.test.js +135 -0
  93. package/es/networkTopo/utils/resourcePermissionUtil.js +10 -6
  94. package/es/style.js +2 -1
  95. package/es/utils/ResourceConfigUtil.js +79 -39
  96. package/es/utils/clusterUtil.js +1 -1
  97. package/es/utils/htElementUtils.js +0 -1
  98. package/es/utils/topoData.js +24 -63
  99. package/es/utils/tree.js +1 -3
  100. package/lib/common/components/ColorPicker/ColorPicker.js +6 -3
  101. package/lib/components/BatchAttrMetric/setting.js +3 -6
  102. package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +4 -1
  103. package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +4 -1
  104. package/lib/core/components/DisplaySettingDrawer/LinkTip.js +6 -1
  105. package/lib/core/components/DisplaySettingDrawer/demo/Demo.js +71 -0
  106. package/lib/core/components/ResourceViewAttributeSetting/Setting.js +8 -48
  107. package/lib/core/components/TopoView/TopoView.module.scss +1 -1
  108. package/lib/core/components/TopoView/topoView.js +26 -17
  109. package/lib/core/editor/components/BackgroundView/index.js +75 -35
  110. package/lib/core/editor/components/settings/common/LineType/index.js +7 -1
  111. package/lib/core/editor/components/settings/common/text/FontStyleCheckbox.js +5 -4
  112. package/lib/core/editor/components/settings/common/text/TextStyle.js +23 -7
  113. package/lib/core/editor/components/settings/common/text/fontStyleUtil.js +0 -1
  114. package/lib/core/editor/components/settings/propertyViews/box/BoxPropertyView.js +13 -1
  115. package/lib/core/editor/components/settings/propertyViews/box/NameInput.js +9 -1
  116. package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +15 -1
  117. package/lib/core/editor/components/settings/propertyViews/group/DataTab/GroupNodeList.js +2 -0
  118. package/lib/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandSetting.js +9 -5
  119. package/lib/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandStatus.js +10 -2
  120. package/lib/core/editor/components/settings/propertyViews/group/SettingTab/Setting.js +12 -1
  121. package/lib/core/editor/components/settings/propertyViews/layer/SettingTab/Setting.js +17 -3
  122. package/lib/core/editor/components/settings/propertyViews/layer/SettingTab/Setting_bak.js +0 -1
  123. package/lib/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeIcon.js +2 -0
  124. package/lib/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeSize/BatchSetNodeSize.js +2 -0
  125. package/lib/core/editor/components/settings/propertyViews/multipleElements/MultipleElementPropertyView.js +4 -1
  126. package/lib/core/editor/components/settings/propertyViews/node/Setting/Setting.js +4 -0
  127. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +36 -6
  128. package/lib/core/editor/components/settings/propertyViews/text/TextPropertyView.js +9 -2
  129. package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +32 -1
  130. package/lib/core/editor/components/settings/propertyViews/view/GlobalLayout.js +2 -0
  131. package/lib/core/editor/components/settings/propertyViews/view/GlobalNodeLabelStyle.js +15 -1
  132. package/lib/core/editor/components/settings/propertyViews/view/hooks/useBackgroundSizeConfig.js +0 -1
  133. package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +5 -1
  134. package/lib/core/editor/components/titlebar/widgets/DebugTools.js +38 -0
  135. package/lib/core/hooks/useAlarm.js +19 -0
  136. package/lib/core/hooks/useGraphAlarmDisplay.js +27 -3
  137. package/lib/core/hooks/useResourceConfig.js +2 -1
  138. package/lib/core/hooks/useRouterAdapter.js +8 -1
  139. package/lib/core/hooks/useTopoEdit.js +219 -162
  140. package/lib/core/models/AttributeMetricDisplay.js +31 -73
  141. package/lib/core/models/HistoryManager.js +105 -51
  142. package/lib/core/models/TopoApp.js +1 -1
  143. package/lib/core/models/cache/CiTypeCache.js +12 -44
  144. package/lib/core/models/cache/DictCache.js +4 -1
  145. package/lib/core/models/graph/Background.js +36 -16
  146. package/lib/core/models/tagstips/ElementTagTipConfig.js +49 -12
  147. package/lib/core/models/tagstips/utils.js +1 -1
  148. package/lib/core/models/topoData.js +7 -3
  149. package/lib/core/models/utils/linkUtils.js +22 -0
  150. package/lib/core/store/models/topoAlarm.js +5 -1
  151. package/lib/core/store/models/topoMod.js +7 -32
  152. package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +51 -261
  153. package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailDrawer.js +245 -0
  154. package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailPlugin.js +2 -2
  155. package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +1 -1
  156. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfoBlock.js +0 -1
  157. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +79 -42
  158. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +2 -3
  159. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +2 -2
  160. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.js +36 -0
  161. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.module.scss +11 -0
  162. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +45 -0
  163. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/constants.js +11 -0
  164. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +77 -0
  165. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +214 -0
  166. package/lib/core/viewer/components/titlebar/BasicTools.js +2 -2
  167. package/lib/core/viewer/components/titlebar/widgets/NodesDragSwitchWrapper.js +28 -0
  168. package/lib/core/viewer/components/titlebar/widgets/SettingButton.js +10 -0
  169. package/lib/networkTopo/components/TopoView.js +3 -2
  170. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +160 -223
  171. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/NetworkLinkForm.js +12 -0
  172. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +161 -137
  173. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/hooks/useAddLink.js +120 -0
  174. package/lib/networkTopo/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +19 -7
  175. package/lib/networkTopo/components/editor/propertyViews/edge/link/LinkInfoPreview.js +8 -9
  176. package/lib/networkTopo/components/viewer/displaySetting/LinkAttrCustomSettingDrawer.js +76 -0
  177. package/lib/networkTopo/components/viewer/displaySetting/LinkTagV2.js +10 -4
  178. package/lib/networkTopo/getTopoData.js +10 -13
  179. package/lib/networkTopo/hooks/editor/useDeleteEdges.js +11 -8
  180. package/lib/networkTopo/hooks/viewer/useRelateTopo.js +2 -1
  181. package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +2 -0
  182. package/lib/networkTopo/models/TopoCenter.js +2 -2
  183. package/lib/networkTopo/services/index.js +6 -4
  184. package/lib/networkTopo/services/link.js +2 -2
  185. package/lib/networkTopo/store/topoCenter.js +5 -2
  186. package/lib/networkTopo/store/topoTreeMod.js +84 -43
  187. package/lib/networkTopo/utils/__tests__/resourcePermissionUtil.test.js +137 -0
  188. package/lib/networkTopo/utils/resourcePermissionUtil.js +11 -6
  189. package/lib/style.js +2 -1
  190. package/lib/utils/ResourceConfigUtil.js +78 -37
  191. package/lib/utils/clusterUtil.js +1 -1
  192. package/lib/utils/htElementUtils.js +0 -1
  193. package/lib/utils/topoData.js +25 -64
  194. package/lib/utils/tree.js +1 -3
  195. package/package.json +3 -2
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export default function NetworkLinkForm(props) {
3
+ return /*#__PURE__*/React.createElement("div", null, "LinkForm");
4
+ }
@@ -1,7 +1,7 @@
1
1
  import _Button from "@alifd/next/es/button";
2
2
  import _NumberPicker from "@alifd/next/es/number-picker";
3
- import _Select from "@alifd/next/es/select";
4
3
  import _Input from "@alifd/next/es/input";
4
+ import _Select from "@alifd/next/es/select";
5
5
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
6
6
  import _Dialog from "@alifd/next/es/dialog";
7
7
  import _Field from "@alifd/next/es/field";
@@ -10,15 +10,14 @@ import _Grid from "@alifd/next/es/grid";
10
10
  import _Form from "@alifd/next/es/form";
11
11
  import _Radio from "@alifd/next/es/radio";
12
12
  import _regeneratorRuntime from "@babel/runtime/regenerator";
13
- import React, { useState, useEffect } from "react";
14
- import validator from "validator";
15
- import rlog from "@riil-frontend/component-topology-utils/es/rlog";
13
+ import React, { useState, useEffect } from 'react';
14
+ import rlog from '@riil-frontend/component-topology-utils/es/rlog'; // import LindInfoPreview from "../../link/LindInfoPreview";
15
+
16
+ import styles from "./index.module.scss";
16
17
  var RadioGroup = _Radio.Group;
17
18
  var FormItem = _Form.Item;
18
19
  var Row = _Grid.Row,
19
- Col = _Grid.Col; // import LindInfoPreview from "../../link/LindInfoPreview";
20
-
21
- import styles from "./index.module.scss";
20
+ Col = _Grid.Col;
22
21
 
23
22
  function parseValues(values) {
24
23
  return _extends({}, values);
@@ -32,7 +31,7 @@ function parseValues(values) {
32
31
 
33
32
 
34
33
  export default function EditLinkInfo(props) {
35
- var _sourceValue$ipAddres2, _sourceValue$portsDoc5, _sourceValue$portsDoc6, _targetValue$portsDoc5, _targetValue$portsDoc6;
34
+ var _field$getValue, _field$getValue2, _sourceValue$portsDoc5, _sourceValue$portsDoc6, _targetValue$portsDoc5, _targetValue$portsDoc6;
36
35
 
37
36
  var topo = props.topo,
38
37
  lineData = props.lineData,
@@ -60,16 +59,18 @@ export default function EditLinkInfo(props) {
60
59
  ratedBandwidth = _useState4[0],
61
60
  setRatedBandwidth = _useState4[1];
62
61
 
63
- var fieldOnChange = function fieldOnChange(name, value) {
64
- var newValues = field.getValues();
65
- rlog.debug("Field-onChange", newValues, name, value);
66
- setValus(newValues);
67
- };
68
-
69
62
  var field = _Field.useField({
70
63
  autoUnmount: false,
71
64
  values: parseValues(attributes),
72
- onChange: fieldOnChange
65
+ onChange: function onChange(name, value) {
66
+ var newValues = field.getValues();
67
+ rlog.debug('Field-onChange', newValues, name, value);
68
+ setValus(newValues);
69
+
70
+ if (name === 'network_link.destination_ipv4') {
71
+ setDisplayNames(newValues);
72
+ }
73
+ }
73
74
  });
74
75
 
75
76
  useEffect(function () {
@@ -77,49 +78,69 @@ export default function EditLinkInfo(props) {
77
78
  setSource(source);
78
79
  setTarget(target);
79
80
  field.setValues(attributes);
80
- }, [source, target, field, attributes]); // const [editState, editDispatchers] = store.useModel("topoConfig");
81
-
82
- var labelAlign = "top";
81
+ }, [source, target, field, attributes]);
82
+ var labelAlign = 'top';
83
83
  var formItemLayout = {
84
84
  labelCol: {
85
85
  fixedSpan: 4
86
86
  }
87
87
  };
88
88
 
89
- var linkTypeJudge = function linkTypeJudge(sourceType, destinationType, type) {
90
- // console.log("linkTypeJudge", sourceType, destinationType, type);
91
- var connect = "phy";
92
- var support = "m.physical_link";
93
-
94
- if (sourceType === "network.agg_interface" && destinationType === sourceType) {
95
- connect = "agg";
96
- support = "m.agg_link";
89
+ var setDisplayNames = function setDisplayNames(vals) {
90
+ if (!isAdd) {
91
+ return;
97
92
  }
98
93
 
99
- if (type === "exit") {
100
- connect = "exit";
101
- support = "m.export_link";
94
+ var newValues = vals || field.getValues();
95
+ var destDeviceId = newValues['network_link.destination_device_id'];
96
+ var sourceIp = newValues['network_link.source_device_ipv4'];
97
+ var targetIp = destDeviceId ? newValues['network_link.destination_device_ipv4'] : newValues['network_link.destination_ipv4'];
98
+
99
+ if (sourceIp && targetIp) {
100
+ var obj = [{
101
+ reg: /FastEthernet/g,
102
+ Abbreviation: 'Fa '
103
+ }, {
104
+ reg: /TwoGigabitEthernet/g,
105
+ Abbreviation: 'Tw '
106
+ }, {
107
+ reg: /FiveGigabitEthernet/g,
108
+ Abbreviation: 'Fi '
109
+ }, {
110
+ reg: /TenGigabitEthernet/g,
111
+ Abbreviation: 'Te '
112
+ }, {
113
+ reg: /TwentyFiveGigE/g,
114
+ Abbreviation: 'Twe '
115
+ }, {
116
+ reg: /FortyGigabitEthernet/g,
117
+ Abbreviation: 'Fo '
118
+ }, {
119
+ reg: /XGigabitEthernet/g,
120
+ Abbreviation: 'Te '
121
+ }, {
122
+ reg: /Ten-GigabitEthernet/g,
123
+ Abbreviation: 'Te '
124
+ }, {
125
+ reg: /GigabitEthernet/g,
126
+ Abbreviation: 'Gi '
127
+ }];
128
+ var displayName = sourceIp + (sourceValue.portsDoc[newValues['source_id']] ? '(' + sourceValue.portsDoc[newValues['source_id']].label + ')' : '') + ' - ' + targetIp + (targetValue.portsDoc[newValues['destination_id']] ? '(' + targetValue.portsDoc[newValues['destination_id']].label + ')' : '');
129
+ obj.filter(function (node) {
130
+ return node.reg.test(displayName);
131
+ }).forEach(function (node) {
132
+ displayName = displayName.replace(node.reg, node.Abbreviation);
133
+ });
134
+ field.setValue('display_name', displayName);
102
135
  }
103
-
104
- return {
105
- connect: connect,
106
- support: support
107
- };
108
136
  };
109
137
 
110
- var connectHandleChange = function connectHandleChange(v) {
111
- field.setValue("connect_type", v);
112
- field.reset("destination_id");
113
- };
114
-
115
- var getRatedBandwidth = function getRatedBandwidth() {};
116
-
117
138
  var portsHandleChange = function portsHandleChange(type, value) {
118
139
  var _sourceValue$portsDoc, _sourceValue$portsDoc2, _targetValue$portsDoc, _targetValue$portsDoc2;
119
140
 
120
141
  var nowValues = field.getValues();
121
- var sourceId = nowValues["source_id"];
122
- var targetId = nowValues["destination_id"];
142
+ var sourceId = nowValues['source_id'];
143
+ var targetId = nowValues['destination_id'];
123
144
  var sourceRb = (_sourceValue$portsDoc = (_sourceValue$portsDoc2 = sourceValue.portsDoc[sourceId]) === null || _sourceValue$portsDoc2 === void 0 ? void 0 : _sourceValue$portsDoc2.ratedBandwidth) !== null && _sourceValue$portsDoc !== void 0 ? _sourceValue$portsDoc : 0;
124
145
  var targetRb = (_targetValue$portsDoc = (_targetValue$portsDoc2 = targetValue.portsDoc[targetId]) === null || _targetValue$portsDoc2 === void 0 ? void 0 : _targetValue$portsDoc2.ratedBandwidth) !== null && _targetValue$portsDoc !== void 0 ? _targetValue$portsDoc : 0;
125
146
  var actualBandwidth = 0;
@@ -132,7 +153,8 @@ export default function EditLinkInfo(props) {
132
153
 
133
154
 
134
155
  setRatedBandwidth(actualBandwidth);
135
- field.setValue("network_link.actual_bandwidth", actualBandwidth);
156
+ field.setValue('network_link.actual_bandwidth', actualBandwidth);
157
+ setDisplayNames();
136
158
  };
137
159
 
138
160
  var checkName = function checkName(rule, value, callback) {
@@ -142,7 +164,7 @@ export default function EditLinkInfo(props) {
142
164
  var usedNames = [];
143
165
  links.map(function (link) {
144
166
  // console.log('checkName',link.id,lineData)
145
- if (link.dtype === "link" && link.name && link.id !== lineData.attributes.linkId) {
167
+ if (link.dtype === 'link' && link.name && link.id !== lineData.attributes.linkId) {
146
168
  usedNames.push(link.name);
147
169
  }
148
170
  });
@@ -150,7 +172,7 @@ export default function EditLinkInfo(props) {
150
172
  if (usedNames.indexOf(displayName) >= 0) {
151
173
  // console.log("setError", checkName, usedNames, displayName);
152
174
  // field.setError("display_name", "链路名称重复");
153
- return callback("链路名称重复");
175
+ return callback('链路名称重复');
154
176
  } else {
155
177
  return callback();
156
178
  }
@@ -159,75 +181,80 @@ export default function EditLinkInfo(props) {
159
181
  var saveHandleChange = function saveHandleChange() {
160
182
  field.validate(function (errors, values) {
161
183
  if (errors) {
162
- rlog.error("saveHandleChange-error", errors, values);
184
+ rlog.error('saveHandleChange-error', errors, values);
163
185
  } else {
164
- var _valus$destination_id, _sourceValue$portsDoc3, _sourceValue$portsDoc4, _targetValue$portsDoc3, _targetValue$portsDoc4, _targetValue$ipAddres, _sourceValue$ipAddres, _targetValue$id;
165
-
166
- var sourceId = valus["source_id"];
167
- var destinationId = (_valus$destination_id = valus["destination_id"]) !== null && _valus$destination_id !== void 0 ? _valus$destination_id : "";
168
- var sourceType = (_sourceValue$portsDoc3 = (_sourceValue$portsDoc4 = sourceValue.portsDoc[sourceId]) === null || _sourceValue$portsDoc4 === void 0 ? void 0 : _sourceValue$portsDoc4.type) !== null && _sourceValue$portsDoc3 !== void 0 ? _sourceValue$portsDoc3 : "";
169
- var destinationType = (_targetValue$portsDoc3 = (_targetValue$portsDoc4 = targetValue.portsDoc[destinationId]) === null || _targetValue$portsDoc4 === void 0 ? void 0 : _targetValue$portsDoc4.type) !== null && _targetValue$portsDoc3 !== void 0 ? _targetValue$portsDoc3 : "";
170
- var typeJudge = linkTypeJudge(sourceType, destinationType, valus["connect_type"]);
171
- var destination_ipv4 = (_targetValue$ipAddres = targetValue.ipAddress) !== null && _targetValue$ipAddres !== void 0 ? _targetValue$ipAddres : valus["network_link.destination_ipv4"];
186
+ var _valus$destination_id, _targetValue$id;
187
+
188
+ var sourceId = valus.source_id;
189
+ var destinationId = (_valus$destination_id = valus.destination_id) !== null && _valus$destination_id !== void 0 ? _valus$destination_id : '';
172
190
  var obj = {
173
- display_name: valus["display_name"],
191
+ display_name: values.display_name,
174
192
  // 链路名称
175
- name: isAdd ? valus["display_name"] : attributes["name"],
193
+ name: values.display_name,
176
194
  // 链路名称
177
- "network_link.source_ipv4": (_sourceValue$ipAddres = sourceValue.ipAddress) !== null && _sourceValue$ipAddres !== void 0 ? _sourceValue$ipAddres : valus["network_link.source_ipv4"],
178
- // 源IP
179
- "network_link.destination_ipv4": destination_ipv4,
180
- // 目的IP
195
+ 'network_link.source_device_id': sourceValue.id,
196
+ // 必须
197
+ 'network_link.source_device_ipv4': valus['network_link.source_device_ipv4'],
198
+ // 必须
181
199
  // source_id, // 源端口
182
- // destination_id, // 目的端口
183
- "network_link.actual_bandwidth": valus["network_link.actual_bandwidth"],
184
- // 实际带宽
185
- use: valus["use"],
186
- // 用途
187
200
  // source_type, // 必须
188
- // destination_type, // 必须
189
- "network_link.source_device_id": sourceValue.id,
190
- // 必须
191
- "network_link.destination_device_id": (_targetValue$id = targetValue.id) !== null && _targetValue$id !== void 0 ? _targetValue$id : "",
201
+ 'network_link.source_ipv4': valus['network_link.source_ipv4'],
202
+ // 源IP
203
+ 'network_link.destination_device_id': (_targetValue$id = targetValue.id) !== null && _targetValue$id !== void 0 ? _targetValue$id : '',
192
204
  // 必须
193
- "network_link.connect_type": typeJudge.connect,
205
+ 'network_link.destination_device_ipv4': valus['network_link.destination_device_ipv4'],
194
206
  // 必须
195
- support_templates: typeJudge.support
207
+ // destination_id, // 目的端口
208
+ // destination_type, // 必须
209
+ 'network_link.destination_ipv4': valus['network_link.destination_ipv4'],
210
+ // 目的IP
211
+ 'network_link.actual_bandwidth': valus['network_link.actual_bandwidth'],
212
+ // 实际带宽
213
+ use: valus.use,
214
+ // 用途
215
+ 'network_link.connect_type': valus['network_link.connect_type'] // 必须
216
+
196
217
  };
197
218
 
198
- if (sourceId !== "") {
199
- obj["source_id"] = sourceId; // 源端口
219
+ if (sourceId !== '') {
220
+ var _sourceValue$portsDoc3, _sourceValue$portsDoc4;
200
221
 
201
- obj["source_type"] = sourceType;
222
+ obj['source_id'] = sourceId; // 源端口
223
+
224
+ obj['source_type'] = (_sourceValue$portsDoc3 = (_sourceValue$portsDoc4 = sourceValue.portsDoc[sourceId]) === null || _sourceValue$portsDoc4 === void 0 ? void 0 : _sourceValue$portsDoc4.type) !== null && _sourceValue$portsDoc3 !== void 0 ? _sourceValue$portsDoc3 : '';
202
225
  }
203
226
 
204
- if (destinationId !== "") {
205
- obj["destination_id"] = destinationId; // 目的端口
227
+ if (destinationId) {
228
+ var _targetValue$portsDoc3, _targetValue$portsDoc4;
229
+
230
+ obj['destination_id'] = destinationId; // 目的端口
206
231
 
207
- obj["destination_type"] = destinationType;
232
+ obj['destination_type'] = (_targetValue$portsDoc3 = (_targetValue$portsDoc4 = targetValue.portsDoc[destinationId]) === null || _targetValue$portsDoc4 === void 0 ? void 0 : _targetValue$portsDoc4.type) !== null && _targetValue$portsDoc3 !== void 0 ? _targetValue$portsDoc3 : '';
208
233
  } else {
209
- obj["destination_id"] = ""; // 目的端口
234
+ obj['destination_id'] = ''; // 目的端口
210
235
 
211
- obj["destination_type"] = "";
236
+ obj['destination_type'] = 'ip';
212
237
  }
213
238
 
239
+ console.log('保存数据-obj', obj);
240
+
214
241
  if (isAdd) {
215
- obj["network_link.network_category"] = "CAN";
216
- obj["network_link.work_mode"] = "AandS"; // 工作模式
242
+ obj['network_link.network_category'] = 'CAN';
243
+ obj['network_link.work_mode'] = 'AandS'; // 工作模式
217
244
 
218
245
  obj.rated_bandwidth = ratedBandwidth; // 额定带宽
219
246
 
220
- obj["network_link.role"] = "master";
221
- }
222
-
223
- console.log("保存数据-obj", obj);
224
-
225
- if (isAdd) {
247
+ obj['network_link.role'] = 'master';
248
+ Object.assign(obj, {
249
+ 'network_link.is_crucial': false,
250
+ support_templates: 'm.ethernet_link',
251
+ 'network_link.connect_type': 'phy'
252
+ });
226
253
  onSave(obj);
227
254
  } else {
228
255
  _Dialog.confirm({
229
- title: "提示",
230
- content: "链路信息已修改,是否保存修改内容?",
256
+ title: '提示',
257
+ content: '链路信息已修改,是否保存修改内容?',
231
258
  onOk: function () {
232
259
  var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
233
260
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -256,18 +283,6 @@ export default function EditLinkInfo(props) {
256
283
  });
257
284
  };
258
285
 
259
- var targetIpComp = function targetIpComp(targetValue) {
260
- return targetValue.ipAddress && targetValue.ciType !== "customNode" ? /*#__PURE__*/React.createElement("div", {
261
- className: styles.label
262
- }, targetValue.ipAddress) : /*#__PURE__*/React.createElement(_Input, {
263
- placeholder: "\u8BF7\u8F93\u5165",
264
- name: "network_link.destination_ipv4",
265
- maxLength: 128
266
- });
267
- }; // 目的没编辑/删除权限时,在添加链路抽屉中链接方式默认出口,物理/聚合置灰不可选
268
-
269
-
270
- var disableCreatePhyAggLink = target.ciType === "customNode" || !targetValue.ipAddress || targetValue.ports.length === 0 || !lineData.target || isAdd && !(lineData.target.ciData.permission.writeable || lineData.target.ciData.permission.deleteable);
271
286
  return /*#__PURE__*/React.createElement("div", {
272
287
  className: styles.editForm
273
288
  }, /*#__PURE__*/React.createElement(_Form, {
@@ -297,7 +312,7 @@ export default function EditLinkInfo(props) {
297
312
  label: "\u6E90\u8282\u70B9IP"
298
313
  }), /*#__PURE__*/React.createElement("div", {
299
314
  className: styles.label
300
- }, (_sourceValue$ipAddres2 = sourceValue.ipAddress) !== null && _sourceValue$ipAddres2 !== void 0 ? _sourceValue$ipAddres2 : "-"))), /*#__PURE__*/React.createElement(Col, {
315
+ }, (_field$getValue = field.getValue('network_link.source_device_ipv4')) !== null && _field$getValue !== void 0 ? _field$getValue : '-'))), /*#__PURE__*/React.createElement(Col, {
301
316
  span: "12"
302
317
  }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
303
318
  labelAlign: labelAlign,
@@ -305,7 +320,9 @@ export default function EditLinkInfo(props) {
305
320
  pattern: /^((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))$/,
306
321
  patternTrigger: "onBlur",
307
322
  patternMessage: "IP\u5730\u5740\u683C\u5F0F\u4E0D\u6B63\u786E"
308
- }), targetIpComp(target)))), /*#__PURE__*/React.createElement(Row, {
323
+ }), /*#__PURE__*/React.createElement("div", {
324
+ className: styles.label
325
+ }, (_field$getValue2 = field.getValue('network_link.destination_device_ipv4')) !== null && _field$getValue2 !== void 0 ? _field$getValue2 : '-')))), /*#__PURE__*/React.createElement(Row, {
309
326
  gutter: "16"
310
327
  }, /*#__PURE__*/React.createElement(Col, {
311
328
  span: "12"
@@ -319,25 +336,53 @@ export default function EditLinkInfo(props) {
319
336
  disabled: sourceValue.ports.length === 0,
320
337
  className: styles.selectList,
321
338
  onChange: function onChange(v) {
322
- portsHandleChange("source_id", v);
339
+ portsHandleChange('source_id', v);
323
340
  },
324
341
  dataSource: sourceValue.ports
325
- }) : "-")), /*#__PURE__*/React.createElement(Col, {
342
+ }) : '-')), /*#__PURE__*/React.createElement(Col, {
326
343
  span: "12"
327
344
  }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
328
345
  labelAlign: labelAlign,
329
346
  label: "\u76EE\u7684\u7AEF\u53E3",
330
- required: valus["connect_type"] !== "exit",
347
+ required: !!field.getValue('network_link.destination_device_id'),
331
348
  requiredMessage: "\u76EE\u7684\u7AEF\u53E3\u4E0D\u80FD\u4E3A\u7A7A"
332
- }), targetValue.ipAddress ? /*#__PURE__*/React.createElement(_Select, {
333
- name: "destination_id",
334
- disabled: targetValue.ports.length === 0,
349
+ }), field.getValue('network_link.destination_device_id') ? /*#__PURE__*/React.createElement(_Select, {
350
+ name: "destination_id" // disabled={targetValue.ports.length === 0}
351
+ ,
335
352
  className: styles.selectList,
336
353
  onChange: function onChange(v) {
337
- portsHandleChange("destination_id", v);
354
+ portsHandleChange('destination_id', v);
338
355
  },
339
356
  dataSource: targetValue.ports
340
- }) : "-"))), /*#__PURE__*/React.createElement(Row, {
357
+ }) : '-'))), /*#__PURE__*/React.createElement(Row, {
358
+ gutter: "16"
359
+ }, /*#__PURE__*/React.createElement(Col, {
360
+ span: "12"
361
+ }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
362
+ labelAlign: labelAlign,
363
+ label: "\u6E90\u7AEFIP",
364
+ pattern: /^((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))$/,
365
+ patternTrigger: "onBlur",
366
+ patternMessage: "IP\u5730\u5740\u683C\u5F0F\u4E0D\u6B63\u786E"
367
+ }), /*#__PURE__*/React.createElement(_Input, {
368
+ placeholder: "\u8BF7\u8F93\u5165",
369
+ name: "network_link.source_ipv4",
370
+ maxLength: 128
371
+ }))), /*#__PURE__*/React.createElement(Col, {
372
+ span: "12"
373
+ }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
374
+ labelAlign: labelAlign,
375
+ label: "\u76EE\u7684\u7AEFIP",
376
+ required: !field.getValue('network_link.destination_device_id'),
377
+ requiredMessage: "\u76EE\u7684\u7AEFIP\u4E0D\u80FD\u4E3A\u7A7A",
378
+ pattern: /^((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))$/,
379
+ patternTrigger: "onBlur",
380
+ patternMessage: "IP\u5730\u5740\u683C\u5F0F\u4E0D\u6B63\u786E"
381
+ }), /*#__PURE__*/React.createElement(_Input, {
382
+ placeholder: "\u8BF7\u8F93\u5165",
383
+ name: "network_link.destination_ipv4",
384
+ maxLength: 128
385
+ })))), /*#__PURE__*/React.createElement(Row, {
341
386
  gutter: "16"
342
387
  }, /*#__PURE__*/React.createElement(Col, {
343
388
  span: "12"
@@ -353,7 +398,7 @@ export default function EditLinkInfo(props) {
353
398
  label: "\u8D44\u6E90\u7C7B\u578B"
354
399
  }), /*#__PURE__*/React.createElement("div", {
355
400
  className: styles.label
356
- }, (_targetValue$portsDoc5 = (_targetValue$portsDoc6 = targetValue.portsDoc[valus.destination_id]) === null || _targetValue$portsDoc6 === void 0 ? void 0 : _targetValue$portsDoc6.typeName) !== null && _targetValue$portsDoc5 !== void 0 ? _targetValue$portsDoc5 : targetValue.ciName)))), /*#__PURE__*/React.createElement(Row, {
401
+ }, (_targetValue$portsDoc5 = (_targetValue$portsDoc6 = targetValue.portsDoc[valus.destination_id]) === null || _targetValue$portsDoc6 === void 0 ? void 0 : _targetValue$portsDoc6.typeName) !== null && _targetValue$portsDoc5 !== void 0 ? _targetValue$portsDoc5 : targetValue.id ? '网络接口' : 'IP地址')))), /*#__PURE__*/React.createElement(Row, {
357
402
  gutter: "16"
358
403
  }, /*#__PURE__*/React.createElement(Col, {
359
404
  span: "24"
@@ -375,33 +420,13 @@ export default function EditLinkInfo(props) {
375
420
  gutter: "16"
376
421
  }, /*#__PURE__*/React.createElement(Col, {
377
422
  span: "24"
378
- }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
379
- labelAlign: labelAlign,
380
- label: "\u94FE\u63A5\u65B9\u5F0F"
381
- }), /*#__PURE__*/React.createElement(RadioGroup, {
382
- name: "connect_type",
383
- disabled: !isAdd,
384
- onChange: function onChange(v) {
385
- connectHandleChange(v);
386
- }
387
- }, /*#__PURE__*/React.createElement(_Radio, {
388
- id: "phy",
389
- value: "phy",
390
- disabled: disableCreatePhyAggLink
391
- }, "\u7269\u7406/\u805A\u5408"), /*#__PURE__*/React.createElement(_Radio, {
392
- id: "exit",
393
- value: "exit"
394
- }, "\u51FA\u53E3"))))), /*#__PURE__*/React.createElement(Row, {
395
- gutter: "16"
396
- }, /*#__PURE__*/React.createElement(Col, {
397
- span: "24"
398
423
  }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
399
424
  labelAlign: labelAlign,
400
425
  label: "\u5B9E\u9645\u5E26\u5BBD\uFF08Mbps\uFF09"
401
426
  }), /*#__PURE__*/React.createElement(_NumberPicker, {
402
427
  hasTrigger: false,
403
428
  style: {
404
- width: "100%"
429
+ width: '100%'
405
430
  },
406
431
  max: 1000000,
407
432
  name: "network_link.actual_bandwidth",
@@ -415,7 +440,7 @@ export default function EditLinkInfo(props) {
415
440
  label: "\u7528\u9014"
416
441
  }), /*#__PURE__*/React.createElement(_Input.TextArea, {
417
442
  style: {
418
- width: "100%"
443
+ width: '100%'
419
444
  },
420
445
  name: "use",
421
446
  placeholder: "\u8BF7\u8F93\u5165",
@@ -424,11 +449,10 @@ export default function EditLinkInfo(props) {
424
449
  className: styles.footer
425
450
  }, /*#__PURE__*/React.createElement(_Button, {
426
451
  className: styles.button,
427
- disabled: !sourceValue.ipAddress,
428
452
  type: "primary",
429
453
  loading: loading,
430
454
  onClick: saveHandleChange
431
- }, isAdd ? "确定" : "保存"), /*#__PURE__*/React.createElement(_Button, {
455
+ }, isAdd ? '确定' : '保存'), /*#__PURE__*/React.createElement(_Button, {
432
456
  className: styles.button,
433
457
  onClick: onClose
434
458
  }, "\u53D6\u6D88")));
@@ -0,0 +1,104 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { useRef, useState } from 'react';
4
+ import topoService from '@riil-frontend/component-topology-common/es/services/topo';
5
+ import rlog from '@riil-frontend/component-topology-utils/es/rlog';
6
+ import { getNodes } from "../../../../../../../utils/htElementUtils";
7
+ import { getCiTypes } from "../../../../../../../utils/topoData";
8
+ export default function useAddLink(props) {
9
+ var topo = props.topo;
10
+ var store = topo.store;
11
+
12
+ var _useState = useState(false),
13
+ loadingConnectableNodes = _useState[0],
14
+ setLoadingConnectableNodes = _useState[1];
15
+
16
+ var linkDispatchers = store.useModelDispatchers('topoLinkMod');
17
+ var htNodesConnectableRef = useRef(null);
18
+
19
+ var getCiTypesConnectable = /*#__PURE__*/function () {
20
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
21
+ var ciNodes, ciTypes, ciTypesConnectable, nodes, ciIds, isWriteable;
22
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
23
+ while (1) {
24
+ switch (_context.prev = _context.next) {
25
+ case 0:
26
+ ciNodes = [];
27
+ setLoadingConnectableNodes(true);
28
+ _context.prev = 2;
29
+ ciTypes = getCiTypes(topo.dataModel.getData());
30
+ _context.next = 6;
31
+ return topoService.networkLink.getCiTypesConnectable(ciTypes);
32
+
33
+ case 6:
34
+ ciTypesConnectable = _context.sent;
35
+ nodes = getNodes(topo.getDataModel());
36
+ ciIds = [];
37
+
38
+ isWriteable = function isWriteable(node) {
39
+ var _node$a;
40
+
41
+ return ['delete', 'write'].indexOf(node.a('operation')) >= 0 || ((_node$a = node.a('permission')) === null || _node$a === void 0 ? void 0 : _node$a.writeable);
42
+ };
43
+
44
+ nodes.forEach(function (node) {
45
+ // rlog.debug("过滤属性", node.a("operation"));
46
+ if (ciTypesConnectable[node.a('ciType')] && isWriteable(node)) {
47
+ ciIds.push(node.id);
48
+ ciNodes.push(node);
49
+ }
50
+ });
51
+ linkDispatchers.update({
52
+ ciConnectable: ciIds
53
+ });
54
+ _context.next = 17;
55
+ break;
56
+
57
+ case 14:
58
+ _context.prev = 14;
59
+ _context.t0 = _context["catch"](2);
60
+ rlog.error('查询可创建链路节点失败', _context.t0);
61
+
62
+ case 17:
63
+ setLoadingConnectableNodes(false);
64
+ return _context.abrupt("return", ciNodes);
65
+
66
+ case 19:
67
+ case "end":
68
+ return _context.stop();
69
+ }
70
+ }
71
+ }, _callee, null, [[2, 14]]);
72
+ }));
73
+
74
+ return function getCiTypesConnectable() {
75
+ return _ref.apply(this, arguments);
76
+ };
77
+ }();
78
+
79
+ function setConnectableNodes(ciNodes) {
80
+ topo.historyManager.setDisabled(true);
81
+ topo.view.topoClient.emitEvent('topo_link_set_connectable_nodes', ciNodes);
82
+ topo.historyManager.setDisabled(false);
83
+ } // 进入划线模式,置灰不可用的节点
84
+
85
+
86
+ function enterAddLinkMode() {
87
+ getCiTypesConnectable().then(function (ciNodes) {
88
+ // rlog.debug("设置可连线节点", ciIdsConnectable, ciNodes);
89
+ htNodesConnectableRef.current = ciNodes;
90
+ setConnectableNodes(ciNodes);
91
+ });
92
+ }
93
+
94
+ function resetConnectableNodes() {
95
+ rlog.info('选择第二个节点,重置置灰', htNodesConnectableRef.current);
96
+ setConnectableNodes(htNodesConnectableRef.current);
97
+ }
98
+
99
+ return {
100
+ enterAddLinkMode: enterAddLinkMode,
101
+ loadingConnectableNodes: loadingConnectableNodes,
102
+ resetConnectableNodes: resetConnectableNodes
103
+ };
104
+ }
@@ -1,5 +1,6 @@
1
1
  import _Form from "@alifd/next/es/form";
2
2
  import _Select from "@alifd/next/es/select";
3
+ import _Loading from "@alifd/next/es/loading";
3
4
  import _extends from "@babel/runtime/helpers/extends";
4
5
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
6
  import _regeneratorRuntime from "@babel/runtime/regenerator";
@@ -21,7 +22,11 @@ export default function BindExitLinkSelect(props) {
21
22
 
22
23
  var _useState = useState([]),
23
24
  associatedlinks = _useState[0],
24
- setAssociatedlinks = _useState[1]; // const [isLine, setIsLine] = useState(false);
25
+ setAssociatedlinks = _useState[1];
26
+
27
+ var _useState2 = useState(false),
28
+ loading = _useState2[0],
29
+ setLoading = _useState2[1]; // const [isLine, setIsLine] = useState(false);
25
30
 
26
31
 
27
32
  var getLinkByNodes = /*#__PURE__*/function () {
@@ -75,6 +80,8 @@ export default function BindExitLinkSelect(props) {
75
80
  while (1) {
76
81
  switch (_context2.prev = _context2.next) {
77
82
  case 0:
83
+ topo.historyManager.beginTransaction();
84
+ setLoading(true);
78
85
  data = associatedlinks.find(function (link) {
79
86
  return link.id === value;
80
87
  });
@@ -88,10 +95,8 @@ export default function BindExitLinkSelect(props) {
88
95
  interfaceTarget: data.attributes["network_link.destination_device_id"],
89
96
  metrics: [],
90
97
  name: data.attributes.name,
91
- "network_link.connect_type": "exit",
92
98
  "network_link.destination_ipv4": data.attributes["network_link.destination_ipv4"],
93
99
  operation: "delete",
94
- connect_type: "exit",
95
100
  source: data.attributes.source_id,
96
101
  target: data.attributes.destination_id,
97
102
  type: "link"
@@ -104,10 +109,10 @@ export default function BindExitLinkSelect(props) {
104
109
  topo.resourceConfig.updateConfig(_extends({}, config, {
105
110
  exportLinkIdList: exportLinkIdList
106
111
  }));
107
- _context2.next = 11;
112
+ _context2.next = 13;
108
113
  return editDispatchers.fetchDataByConfig();
109
114
 
110
- case 11:
115
+ case 13:
111
116
  _yield$editDispatcher = _context2.sent;
112
117
  elements = _yield$editDispatcher.elements;
113
118
  target = edge.getTarget();
@@ -121,8 +126,10 @@ export default function BindExitLinkSelect(props) {
121
126
  edge.setTag(data.id);
122
127
  console.log("bindExitLink------------", target, target.getTag(), data["network_link.destination_ipv4"], exitLink);
123
128
  rlog.debug("fetchDataByConfig", elements);
129
+ setLoading(false);
130
+ topo.historyManager.endTransaction();
124
131
 
125
- case 20:
132
+ case 24:
126
133
  case "end":
127
134
  return _context2.stop();
128
135
  }
@@ -140,7 +147,10 @@ export default function BindExitLinkSelect(props) {
140
147
  style: {
141
148
  marginBottom: 0
142
149
  }
143
- }, /*#__PURE__*/React.createElement(_Select, {
150
+ }, /*#__PURE__*/React.createElement(_Loading, {
151
+ visible: loading,
152
+ fullScreen: true
153
+ }), /*#__PURE__*/React.createElement(_Select, {
144
154
  style: {
145
155
  width: 232
146
156
  },