@riil-frontend/component-topology 7.0.0-dev.8 → 7.0.1

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 (164) 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 +31 -31
  5. package/es/core/components/DisplaySettingDrawer/DisplaySetting.js +2 -23
  6. package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +3 -2
  7. package/es/core/components/DisplaySettingDrawer/LineExpandAllRadioGroup.js +1 -2
  8. package/es/core/components/TopoView/GraphViewPanel.js +18 -2
  9. package/es/core/editor/components/Toolbar/buttons.js +2 -2
  10. package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +10 -3
  11. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/edgeTag.js +9 -2
  12. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +7 -1
  13. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/nodeTag.js +21 -6
  14. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/textStyleUtil.js +5 -0
  15. package/es/core/editor/components/settings/PropertyView.js +11 -10
  16. package/es/core/editor/components/settings/Settings.js +8 -1
  17. package/es/core/editor/components/settings/core/PropertyViewManager.js +4 -3
  18. package/es/core/editor/components/settings/core/edgePropertyViewAdapter.js +1 -7
  19. package/es/core/editor/components/settings/propertyViews/node/data/Data.js +4 -2
  20. package/es/core/editor/components/settings/propertyViews/node/data/PlatformDisplay.js +15 -0
  21. package/es/core/editor/hooks/useKeyboardShortcut.js +1 -1
  22. package/es/core/hooks/usePolling.js +1 -6
  23. package/es/core/hooks/useTopoEdit.js +3 -1
  24. package/es/core/models/Alarm.js +12 -24
  25. package/es/core/models/TopoApp.js +5 -3
  26. package/es/core/models/utils/linkUtils.js +0 -3
  27. package/es/core/store/models/topoMod.js +7 -6
  28. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +28 -25
  29. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +4 -0
  30. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +17 -17
  31. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.module.scss +1 -0
  32. package/es/core/viewer/components/titlebar/widgets/SettingButton.js +3 -11
  33. package/es/core/viewer/components/titlebar/widgets/SettingButtonWidget.js +5 -3
  34. package/es/networkTopo/getTopoData.js +16 -27
  35. package/es/networkTopo/index.js +2 -2
  36. package/es/networkTopo/services/alert.js +55 -0
  37. package/es/networkTopo/services/authorization.js +135 -0
  38. package/es/networkTopo/services/cmdb.js +897 -0
  39. package/es/networkTopo/services/index.js +2 -26
  40. package/es/networkTopo/services/mdc.js +74 -0
  41. package/es/networkTopo/services/metric.js +68 -0
  42. package/es/networkTopo/services/model.js +1283 -0
  43. package/es/networkTopo/services/risk.js +29 -0
  44. package/es/networkTopo/services/topo/auth.js +67 -0
  45. package/es/networkTopo/services/topo/basic.js +727 -0
  46. package/es/networkTopo/services/topo/blacklist.js +60 -0
  47. package/es/networkTopo/services/topo/ciInfo.js +69 -0
  48. package/es/networkTopo/services/topo/constants.js +1 -0
  49. package/es/networkTopo/services/topo/icon.js +131 -0
  50. package/es/networkTopo/services/topo/index.js +18 -0
  51. package/es/networkTopo/services/topo/networkLink.js +33 -0
  52. package/es/networkTopo/services/topo/relation.js +27 -0
  53. package/es/networkTopo/services/topo/resourceWebUrl.js +84 -0
  54. package/es/networkTopo/store/topoTreeMod.js +5 -1
  55. package/es/networkTopo/utils/storage.js +38 -0
  56. package/es/utils/tree.js +1 -0
  57. package/lib/core/components/DisplaySettingDrawer/DisplaySetting.js +3 -24
  58. package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +3 -3
  59. package/lib/core/components/DisplaySettingDrawer/LineExpandAllRadioGroup.js +1 -2
  60. package/lib/core/components/TopoView/GraphViewPanel.js +22 -2
  61. package/lib/core/editor/components/Toolbar/buttons.js +2 -2
  62. package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +10 -3
  63. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/edgeTag.js +9 -3
  64. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +8 -1
  65. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/nodeTag.js +21 -7
  66. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/textStyleUtil.js +5 -0
  67. package/lib/core/editor/components/settings/PropertyView.js +10 -10
  68. package/lib/core/editor/components/settings/Settings.js +9 -1
  69. package/lib/core/editor/components/settings/core/PropertyViewManager.js +4 -3
  70. package/lib/core/editor/components/settings/core/edgePropertyViewAdapter.js +1 -10
  71. package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +5 -3
  72. package/lib/core/editor/components/settings/propertyViews/node/data/PlatformDisplay.js +23 -0
  73. package/lib/core/editor/hooks/useKeyboardShortcut.js +1 -1
  74. package/lib/core/hooks/usePolling.js +1 -6
  75. package/lib/core/hooks/useTopoEdit.js +3 -1
  76. package/lib/core/models/Alarm.js +12 -24
  77. package/lib/core/models/TopoApp.js +5 -3
  78. package/lib/core/models/utils/linkUtils.js +0 -5
  79. package/lib/core/store/models/topoMod.js +9 -6
  80. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +28 -26
  81. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +4 -0
  82. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +17 -17
  83. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.module.scss +1 -0
  84. package/lib/core/viewer/components/titlebar/widgets/SettingButton.js +3 -11
  85. package/lib/core/viewer/components/titlebar/widgets/SettingButtonWidget.js +5 -3
  86. package/lib/networkTopo/getTopoData.js +16 -28
  87. package/lib/networkTopo/index.js +4 -4
  88. package/lib/networkTopo/services/alert.js +66 -0
  89. package/lib/networkTopo/services/authorization.js +145 -0
  90. package/lib/networkTopo/services/cmdb.js +977 -0
  91. package/lib/networkTopo/services/index.js +3 -29
  92. package/lib/networkTopo/services/mdc.js +91 -0
  93. package/lib/networkTopo/services/metric.js +82 -0
  94. package/lib/networkTopo/services/model.js +1387 -0
  95. package/lib/networkTopo/services/risk.js +40 -0
  96. package/lib/networkTopo/services/topo/auth.js +79 -0
  97. package/lib/networkTopo/services/topo/basic.js +753 -0
  98. package/lib/networkTopo/services/topo/blacklist.js +72 -0
  99. package/lib/networkTopo/services/topo/ciInfo.js +82 -0
  100. package/lib/networkTopo/services/topo/constants.js +6 -0
  101. package/lib/networkTopo/services/topo/icon.js +144 -0
  102. package/lib/networkTopo/{components/editor/plugins/LayerConfigPlugin.js → services/topo/index.js} +33 -23
  103. package/lib/networkTopo/services/topo/networkLink.js +45 -0
  104. package/lib/networkTopo/services/topo/relation.js +39 -0
  105. package/lib/networkTopo/services/topo/resourceWebUrl.js +95 -0
  106. package/lib/networkTopo/store/topoTreeMod.js +5 -1
  107. package/lib/networkTopo/utils/storage.js +46 -0
  108. package/lib/utils/tree.js +1 -0
  109. package/package.json +3 -3
  110. package/es/core/components/DisplaySettingDrawer/EditorDisplaySetting.js +0 -122
  111. package/es/core/editor/components/settings/propertyViews/edge/addEdgeProps.js +0 -10
  112. package/es/networkTopo/components/Topology.js +0 -28
  113. package/es/networkTopo/components/editor/plugins/LayerConfigPlugin.js +0 -22
  114. package/es/networkTopo/components/editor/propertyViews/LayerRelatedResourceList.js +0 -48
  115. package/es/networkTopo/components/editor/propertyViews/edge/EdgeGroupPropertyView.js +0 -35
  116. package/es/networkTopo/components/editor/propertyViews/edge/EdgePropertyView.js +0 -43
  117. package/es/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +0 -39
  118. package/es/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +0 -31
  119. package/es/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyViewV1.js +0 -37
  120. package/es/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/Setting/index.js +0 -49
  121. package/es/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/index.js +0 -2
  122. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +0 -630
  123. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/NetworkLinkForm.js +0 -4
  124. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +0 -458
  125. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/index.module.scss +0 -34
  126. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/hooks/useAddLink.js +0 -104
  127. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/index.module.scss +0 -12
  128. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/mock.js +0 -55
  129. package/es/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/server.js +0 -187
  130. package/es/networkTopo/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +0 -178
  131. package/es/networkTopo/components/editor/propertyViews/edge/link/LinkInfoPreview.js +0 -103
  132. package/es/networkTopo/components/editor/propertyViews/edge/link/LinkInfoPreview.module.scss +0 -65
  133. package/es/networkTopo/components/editor/useEditorProps.js +0 -32
  134. package/es/networkTopo/event/index.js +0 -6
  135. package/es/networkTopo/hooks/editor/useDeleteEdges.js +0 -200
  136. package/es/networkTopo/hooks/editor/useGroupSortResources.js +0 -16
  137. package/es/networkTopo/hooks/useTopoEdit.js +0 -26
  138. package/lib/core/components/DisplaySettingDrawer/EditorDisplaySetting.js +0 -147
  139. package/lib/core/editor/components/settings/propertyViews/edge/addEdgeProps.js +0 -19
  140. package/lib/networkTopo/components/Topology.js +0 -40
  141. package/lib/networkTopo/components/editor/propertyViews/LayerRelatedResourceList.js +0 -63
  142. package/lib/networkTopo/components/editor/propertyViews/edge/EdgeGroupPropertyView.js +0 -51
  143. package/lib/networkTopo/components/editor/propertyViews/edge/EdgePropertyView.js +0 -60
  144. package/lib/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +0 -54
  145. package/lib/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +0 -42
  146. package/lib/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyViewV1.js +0 -50
  147. package/lib/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/Setting/index.js +0 -66
  148. package/lib/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/index.js +0 -11
  149. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +0 -661
  150. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/NetworkLinkForm.js +0 -12
  151. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +0 -486
  152. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/components/index.module.scss +0 -34
  153. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/hooks/useAddLink.js +0 -120
  154. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/index.module.scss +0 -12
  155. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/mock.js +0 -60
  156. package/lib/networkTopo/components/editor/propertyViews/edge/addLinkDrawer/server.js +0 -207
  157. package/lib/networkTopo/components/editor/propertyViews/edge/link/BindExitLinkSelect.js +0 -205
  158. package/lib/networkTopo/components/editor/propertyViews/edge/link/LinkInfoPreview.js +0 -121
  159. package/lib/networkTopo/components/editor/propertyViews/edge/link/LinkInfoPreview.module.scss +0 -65
  160. package/lib/networkTopo/components/editor/useEditorProps.js +0 -46
  161. package/lib/networkTopo/event/index.js +0 -11
  162. package/lib/networkTopo/hooks/editor/useDeleteEdges.js +0 -218
  163. package/lib/networkTopo/hooks/editor/useGroupSortResources.js +0 -21
  164. package/lib/networkTopo/hooks/useTopoEdit.js +0 -40
@@ -1,458 +0,0 @@
1
- import _Button from "@alifd/next/es/button";
2
- import _NumberPicker from "@alifd/next/es/number-picker";
3
- import _Input from "@alifd/next/es/input";
4
- import _Select from "@alifd/next/es/select";
5
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
6
- import _Dialog from "@alifd/next/es/dialog";
7
- import _Field from "@alifd/next/es/field";
8
- import _extends from "@babel/runtime/helpers/extends";
9
- import _Grid from "@alifd/next/es/grid";
10
- import _Form from "@alifd/next/es/form";
11
- import _Radio from "@alifd/next/es/radio";
12
- import _regeneratorRuntime from "@babel/runtime/regenerator";
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";
17
- var RadioGroup = _Radio.Group;
18
- var FormItem = _Form.Item;
19
- var Row = _Grid.Row,
20
- Col = _Grid.Col;
21
-
22
- function parseValues(values) {
23
- return _extends({}, values);
24
- }
25
- /**
26
- * 两端都有编辑/删除权限才能创建物理和聚合链路。
27
- * 目的没编辑/删除权限时,在添加链路抽屉中链接方式默认出口,物理/聚合置灰不可选
28
- * @param {*} props
29
- * @returns
30
- */
31
-
32
-
33
- export default function EditLinkInfo(props) {
34
- var _field$getValue, _field$getValue2, _sourceValue$portsDoc5, _sourceValue$portsDoc6, _targetValue$portsDoc5, _targetValue$portsDoc6;
35
-
36
- var topo = props.topo,
37
- lineData = props.lineData,
38
- onClose = props.onClose,
39
- onSave = props.onSave,
40
- isAdd = props.isAdd,
41
- loading = props.loading;
42
- var source = lineData.source,
43
- target = lineData.target,
44
- attributes = lineData.attributes;
45
-
46
- var _useState = useState(attributes),
47
- valus = _useState[0],
48
- setValus = _useState[1];
49
-
50
- var _useState2 = useState(source),
51
- sourceValue = _useState2[0],
52
- setSource = _useState2[1];
53
-
54
- var _useState3 = useState(target),
55
- targetValue = _useState3[0],
56
- setTarget = _useState3[1];
57
-
58
- var _useState4 = useState(),
59
- ratedBandwidth = _useState4[0],
60
- setRatedBandwidth = _useState4[1];
61
-
62
- var field = _Field.useField({
63
- autoUnmount: false,
64
- values: parseValues(attributes),
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
- }
74
- });
75
-
76
- useEffect(function () {
77
- setValus(attributes);
78
- setSource(source);
79
- setTarget(target);
80
- field.setValues(attributes);
81
- }, [source, target, field, attributes]);
82
- var labelAlign = 'top';
83
- var formItemLayout = {
84
- labelCol: {
85
- fixedSpan: 4
86
- }
87
- };
88
-
89
- var setDisplayNames = function setDisplayNames(vals) {
90
- if (!isAdd) {
91
- return;
92
- }
93
-
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);
135
- }
136
- };
137
-
138
- var portsHandleChange = function portsHandleChange(type, value) {
139
- var _sourceValue$portsDoc, _sourceValue$portsDoc2, _targetValue$portsDoc, _targetValue$portsDoc2;
140
-
141
- var nowValues = field.getValues();
142
- var sourceId = nowValues['source_id'];
143
- var targetId = nowValues['destination_id'];
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;
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;
146
- var actualBandwidth = 0;
147
-
148
- if (sourceRb && targetRb) {
149
- actualBandwidth = Math.min(sourceRb, targetRb);
150
- } else {
151
- actualBandwidth = sourceRb || targetRb;
152
- } // rlog.debug("network_link.actual_bandwidth", actualBandwidth);
153
-
154
-
155
- setRatedBandwidth(actualBandwidth);
156
- field.setValue('network_link.actual_bandwidth', actualBandwidth);
157
- setDisplayNames();
158
- };
159
-
160
- var checkName = function checkName(rule, value, callback) {
161
- // const { validate, getValue } = field;
162
- var displayName = value;
163
- var links = topo.getEdges();
164
- var usedNames = [];
165
- links.map(function (link) {
166
- // console.log('checkName',link.id,lineData)
167
- if (link.dtype === 'link' && link.name && link.id !== lineData.attributes.linkId) {
168
- usedNames.push(link.name);
169
- }
170
- });
171
-
172
- if (usedNames.indexOf(displayName) >= 0) {
173
- // console.log("setError", checkName, usedNames, displayName);
174
- // field.setError("display_name", "链路名称重复");
175
- return callback('链路名称重复');
176
- } else {
177
- return callback();
178
- }
179
- };
180
-
181
- var saveHandleChange = function saveHandleChange() {
182
- field.validate(function (errors, values) {
183
- if (errors) {
184
- rlog.error('saveHandleChange-error', errors, values);
185
- } else {
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 : '';
190
- var obj = {
191
- display_name: values.display_name,
192
- // 链路名称
193
- name: values.display_name,
194
- // 链路名称
195
- 'network_link.source_device_id': sourceValue.id,
196
- // 必须
197
- 'network_link.source_device_ipv4': valus['network_link.source_device_ipv4'],
198
- // 必须
199
- // source_id, // 源端口
200
- // source_type, // 必须
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 : '',
204
- // 必须
205
- 'network_link.destination_device_ipv4': valus['network_link.destination_device_ipv4'],
206
- // 必须
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
-
217
- };
218
-
219
- if (sourceId !== '') {
220
- var _sourceValue$portsDoc3, _sourceValue$portsDoc4;
221
-
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 : '';
225
- }
226
-
227
- if (destinationId) {
228
- var _targetValue$portsDoc3, _targetValue$portsDoc4;
229
-
230
- obj['destination_id'] = destinationId; // 目的端口
231
-
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 : '';
233
- } else {
234
- obj['destination_id'] = ''; // 目的端口
235
-
236
- obj['destination_type'] = 'ip';
237
- } // console.log('保存数据-obj', obj);
238
-
239
-
240
- if (isAdd) {
241
- obj['network_link.network_category'] = 'CAN';
242
- obj['network_link.work_mode'] = 'AandS'; // 工作模式
243
-
244
- obj.rated_bandwidth = ratedBandwidth; // 额定带宽
245
-
246
- obj['network_link.role'] = 'master';
247
- Object.assign(obj, {
248
- 'network_link.is_crucial': false,
249
- support_templates: 'm.ethernet_link',
250
- 'network_link.connect_type': 'phy'
251
- });
252
- onSave(obj);
253
- } else {
254
- _Dialog.confirm({
255
- title: '提示',
256
- content: '链路信息已修改,是否保存修改内容?',
257
- onOk: function () {
258
- var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
259
- return _regeneratorRuntime.wrap(function _callee$(_context) {
260
- while (1) {
261
- switch (_context.prev = _context.next) {
262
- case 0:
263
- onSave(obj);
264
-
265
- case 1:
266
- case "end":
267
- return _context.stop();
268
- }
269
- }
270
- }, _callee);
271
- }));
272
-
273
- function onOk() {
274
- return _onOk.apply(this, arguments);
275
- }
276
-
277
- return onOk;
278
- }()
279
- });
280
- }
281
- }
282
- });
283
- };
284
-
285
- return /*#__PURE__*/React.createElement("div", {
286
- className: styles.editForm
287
- }, /*#__PURE__*/React.createElement(_Form, {
288
- field: field
289
- }, /*#__PURE__*/React.createElement(Row, {
290
- gutter: "16"
291
- }, /*#__PURE__*/React.createElement(Col, {
292
- span: "12"
293
- }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
294
- labelAlign: labelAlign,
295
- label: "\u6E90\u8282\u70B9\u540D\u79F0"
296
- }), /*#__PURE__*/React.createElement("div", {
297
- className: styles.label
298
- }, sourceValue.name))), /*#__PURE__*/React.createElement(Col, {
299
- span: "12"
300
- }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
301
- labelAlign: labelAlign,
302
- label: "\u76EE\u7684\u8282\u70B9\u540D\u79F0"
303
- }), /*#__PURE__*/React.createElement("div", {
304
- className: styles.label
305
- }, targetValue.name)))), /*#__PURE__*/React.createElement(Row, {
306
- gutter: "16"
307
- }, /*#__PURE__*/React.createElement(Col, {
308
- span: "12"
309
- }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
310
- labelAlign: labelAlign,
311
- label: "\u6E90\u8282\u70B9IP"
312
- }), /*#__PURE__*/React.createElement("div", {
313
- className: styles.label
314
- }, (_field$getValue = field.getValue('network_link.source_device_ipv4')) !== null && _field$getValue !== void 0 ? _field$getValue : '-'))), /*#__PURE__*/React.createElement(Col, {
315
- span: "12"
316
- }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
317
- labelAlign: labelAlign,
318
- label: "\u76EE\u7684\u8282\u70B9IP",
319
- 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)))$/,
320
- patternTrigger: "onBlur",
321
- patternMessage: "IP\u5730\u5740\u683C\u5F0F\u4E0D\u6B63\u786E"
322
- }), /*#__PURE__*/React.createElement("div", {
323
- className: styles.label
324
- }, (_field$getValue2 = field.getValue('network_link.destination_device_ipv4')) !== null && _field$getValue2 !== void 0 ? _field$getValue2 : '-')))), /*#__PURE__*/React.createElement(Row, {
325
- gutter: "16"
326
- }, /*#__PURE__*/React.createElement(Col, {
327
- span: "12"
328
- }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
329
- labelAlign: labelAlign,
330
- label: "\u6E90\u7AEF\u53E3",
331
- required: true,
332
- requiredMessage: "\u6E90\u7AEF\u53E3\u4E0D\u80FD\u4E3A\u7A7A"
333
- }), sourceValue.ciId ? /*#__PURE__*/React.createElement(_Select, {
334
- name: "source_id",
335
- disabled: sourceValue.ports.length === 0,
336
- className: styles.selectList,
337
- onChange: function onChange(v) {
338
- portsHandleChange('source_id', v);
339
- },
340
- dataSource: sourceValue.ports
341
- }) : '-')), /*#__PURE__*/React.createElement(Col, {
342
- span: "12"
343
- }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
344
- labelAlign: labelAlign,
345
- label: "\u76EE\u7684\u7AEF\u53E3",
346
- required: !!field.getValue('network_link.destination_device_id'),
347
- requiredMessage: "\u76EE\u7684\u7AEF\u53E3\u4E0D\u80FD\u4E3A\u7A7A"
348
- }), field.getValue('network_link.destination_device_id') ? /*#__PURE__*/React.createElement(_Select, {
349
- name: "destination_id" // disabled={targetValue.ports.length === 0}
350
- ,
351
- className: styles.selectList,
352
- onChange: function onChange(v) {
353
- portsHandleChange('destination_id', v);
354
- },
355
- dataSource: targetValue.ports
356
- }) : '-'))), /*#__PURE__*/React.createElement(Row, {
357
- gutter: "16"
358
- }, /*#__PURE__*/React.createElement(Col, {
359
- span: "12"
360
- }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
361
- labelAlign: labelAlign,
362
- label: "\u6E90\u7AEFIP",
363
- 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)))$/,
364
- patternTrigger: "onBlur",
365
- patternMessage: "IP\u5730\u5740\u683C\u5F0F\u4E0D\u6B63\u786E"
366
- }), /*#__PURE__*/React.createElement(_Input, {
367
- placeholder: "\u8BF7\u8F93\u5165",
368
- name: "network_link.source_ipv4",
369
- maxLength: 128
370
- }))), /*#__PURE__*/React.createElement(Col, {
371
- span: "12"
372
- }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
373
- labelAlign: labelAlign,
374
- label: "\u76EE\u7684\u7AEFIP",
375
- required: !field.getValue('network_link.destination_device_id'),
376
- requiredMessage: "\u76EE\u7684\u7AEFIP\u4E0D\u80FD\u4E3A\u7A7A",
377
- 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)))$/,
378
- patternTrigger: "onBlur",
379
- patternMessage: "IP\u5730\u5740\u683C\u5F0F\u4E0D\u6B63\u786E"
380
- }), /*#__PURE__*/React.createElement(_Input, {
381
- placeholder: "\u8BF7\u8F93\u5165",
382
- name: "network_link.destination_ipv4",
383
- maxLength: 128
384
- })))), /*#__PURE__*/React.createElement(Row, {
385
- gutter: "16"
386
- }, /*#__PURE__*/React.createElement(Col, {
387
- span: "12"
388
- }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
389
- labelAlign: labelAlign,
390
- label: "\u8D44\u6E90\u7C7B\u578B"
391
- }), /*#__PURE__*/React.createElement("div", {
392
- className: styles.label
393
- }, (_sourceValue$portsDoc5 = (_sourceValue$portsDoc6 = sourceValue.portsDoc[valus.source_id]) === null || _sourceValue$portsDoc6 === void 0 ? void 0 : _sourceValue$portsDoc6.typeName) !== null && _sourceValue$portsDoc5 !== void 0 ? _sourceValue$portsDoc5 : sourceValue.ciName))), /*#__PURE__*/React.createElement(Col, {
394
- span: "12"
395
- }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
396
- labelAlign: labelAlign,
397
- label: "\u8D44\u6E90\u7C7B\u578B"
398
- }), /*#__PURE__*/React.createElement("div", {
399
- className: styles.label
400
- }, (_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, {
401
- gutter: "16"
402
- }, /*#__PURE__*/React.createElement(Col, {
403
- span: "24"
404
- }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
405
- labelAlign: labelAlign,
406
- label: "\u94FE\u8DEF\u540D\u79F0",
407
- required: true,
408
- requiredMessage: "\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A",
409
- requiredTrigger: "onBlur",
410
- pattern: /^[^'"\\%]+[^'"\\%]*[^'"\\%]*$/,
411
- patternTrigger: "onBlur",
412
- patternMessage: "\u4E0D\u5141\u8BB8\u8F93\u5165\u2018\u3001\u201C\u3001\\\u3001%",
413
- validator: checkName
414
- }), /*#__PURE__*/React.createElement(_Input, {
415
- placeholder: "\u8BF7\u8F93\u5165",
416
- name: "display_name",
417
- maxLength: 128
418
- })))), /*#__PURE__*/React.createElement(Row, {
419
- gutter: "16"
420
- }, /*#__PURE__*/React.createElement(Col, {
421
- span: "24"
422
- }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
423
- labelAlign: labelAlign,
424
- label: "\u5B9E\u9645\u5E26\u5BBD\uFF08Mbps\uFF09"
425
- }), /*#__PURE__*/React.createElement(_NumberPicker, {
426
- hasTrigger: false,
427
- style: {
428
- width: '100%'
429
- },
430
- max: 1000000,
431
- name: "network_link.actual_bandwidth",
432
- placeholder: "\u8BF7\u8F93\u5165"
433
- })))), /*#__PURE__*/React.createElement(Row, {
434
- gutter: "16"
435
- }, /*#__PURE__*/React.createElement(Col, {
436
- span: "24"
437
- }, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
438
- labelAlign: labelAlign,
439
- label: "\u7528\u9014"
440
- }), /*#__PURE__*/React.createElement(_Input.TextArea, {
441
- style: {
442
- width: '100%'
443
- },
444
- name: "use",
445
- placeholder: "\u8BF7\u8F93\u5165",
446
- maxLength: 300
447
- }))))), /*#__PURE__*/React.createElement("div", {
448
- className: styles.footer
449
- }, /*#__PURE__*/React.createElement(_Button, {
450
- className: styles.button,
451
- type: "primary",
452
- loading: loading,
453
- onClick: saveHandleChange
454
- }, isAdd ? '确定' : '保存'), /*#__PURE__*/React.createElement(_Button, {
455
- className: styles.button,
456
- onClick: onClose
457
- }, "\u53D6\u6D88")));
458
- }
@@ -1,34 +0,0 @@
1
- .editForm {
2
- width: 100%;
3
-
4
- .label {
5
- font-size: 12px;
6
- font-family: PingFangSC-Regular,
7
- PingFang SC;
8
- font-weight: 400;
9
- color: #4D6277;
10
- line-height: 20px;
11
- }
12
-
13
- .selectList {
14
- width: 220px;
15
- }
16
-
17
- .footer {
18
- position: absolute;
19
- bottom: 0;
20
- width: 100%;
21
- border-top: 1px solid #e8e8e8;
22
- padding: 10px 16px;
23
- text-align: right;
24
- left: 0;
25
- background: #fff;
26
- border-radius: 0 0 4px 4px;
27
-
28
- & .button {
29
- &:not(:first-child) {
30
- margin-left: 8px;
31
- }
32
- }
33
- }
34
- }
@@ -1,104 +0,0 @@
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,12 +0,0 @@
1
- @import '~@alifd/next/variables.scss';
2
-
3
- .drawer {
4
- width: 504px;
5
-
6
- :global {
7
- .#{$css-prefix}drawer-body {
8
- padding: 20px 24px 50px 20px;
9
- }
10
- }
11
-
12
- }
@@ -1,55 +0,0 @@
1
- export var lineData = {
2
- source: {
3
- id: "1",
4
- name: "锐捷交换机1",
5
- ip: "172.17.161.203",
6
- ciType: "锐捷交换机",
7
- ports: [{
8
- label: "1/0",
9
- value: "1"
10
- }, {
11
- label: "1/1",
12
- value: "2"
13
- }, {
14
- label: "1/2",
15
- value: "3"
16
- }]
17
- },
18
- target: {
19
- id: "2",
20
- name: "锐捷路由器2",
21
- ip: "172.17.161.249",
22
- ciType: "锐捷路由器",
23
- ports: [{
24
- label: "1/0",
25
- value: "1"
26
- }, {
27
- label: "1/1",
28
- value: "2"
29
- }, {
30
- label: "1/2",
31
- value: "3"
32
- }]
33
- }
34
- };
35
- var attributes = {
36
- "network_link.to_if_connect": "r691616699585134592",
37
- "network_link.destination_ipv4 ": "172.17.166.27",
38
- "network_link.work_mode": "single",
39
- support_templates: "m.physical_link ",
40
- destination_id: "o000000046d0cc17",
41
- "rated_bandwidth ": 1000,
42
- source_type: "network.interface",
43
- "network_link.connect_type ": "phy",
44
- display_name: "172.17.166.10(Gi 0/41) - 172.17.166.27(Gi 0/49) ",
45
- asset_status: "1 ",
46
- destination_type: "network.interface",
47
- "network_link.network_category": "CAN ",
48
- "network_link.source_ipv4 ": "172.17.166.10",
49
- name: "172.17.166.10(Gi 0/41) - 172.17.166.27(Gi 0/49 ) ",
50
- "distance_outlet ": 2147483647,
51
- "network_link.is_crucial": false,
52
- source_id: "o00o000046d0c3cc",
53
- "network_link.source_device_id": "o00oo00046d0c368",
54
- "network_link.destination_device_id": " 0000000046d0c95e"
55
- };