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