@riil-frontend/component-topology 3.1.13 → 3.4.0
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.js +36 -36
- package/demo/CHANGELOG/CHANGELOG.md +5 -0
- package/es/components/MultiResourceDrawer/index.js +2 -2
- package/es/components/NetworkTopoResourceSelectDrawer/NetworkTopoResourceSelectDrawer.js +9 -0
- package/es/components/NetworkTopoResourceSelectDrawer/index.js +2 -0
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +8 -3
- package/es/components/ResourceSelectDrawer/ResourceSelectList.js +9 -6
- package/es/components/SingleResourceDrawer/SelectDrawer.js +1 -1
- package/es/constants/ResourceTypeLimit.js +12 -1
- package/es/core/common/icons/icon.js +3 -28
- package/es/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +1 -1
- package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +148 -10
- package/es/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +4 -5
- package/es/core/editor/components/settings/propertyViews/index.js +1 -5
- package/es/core/editor/components/settings/propertyViews/layer/DataTab/LayerAddResourceDrawer.js +1 -1
- package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +2 -1
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/topoData.js +21 -18
- package/es/core/models/utils/linkUtils.js +14 -14
- package/es/hooks/useResourceConfig.js +3 -2
- package/es/hooks/useSelection.js +16 -14
- package/es/models/topoConfig.js +20 -16
- package/es/models/topoMod.js +1 -0
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +14 -8
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +16 -3
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Setting/index.js +3 -3
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +145 -97
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +61 -21
- package/es/topoCenter/components/editor/propertyViews/edge/link/LinkInfoPreview.js +26 -7
- package/es/topoCenter/event/index.js +1 -0
- package/es/topoCenter/hooks/editor/useDeleteEdges.js +46 -24
- package/es/topoCenter/services/link.js +51 -0
- package/es/topoCenter/utils/linPermissionUtil.js +24 -13
- package/es/utils/ResourceConfigUtil.js +38 -16
- package/es/utils/topoData.js +6 -7
- package/lib/components/MultiResourceDrawer/index.js +2 -2
- package/lib/components/NetworkTopoResourceSelectDrawer/NetworkTopoResourceSelectDrawer.js +20 -0
- package/lib/components/NetworkTopoResourceSelectDrawer/index.js +11 -0
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +8 -3
- package/lib/components/ResourceSelectDrawer/ResourceSelectList.js +10 -5
- package/lib/components/SingleResourceDrawer/SelectDrawer.js +2 -2
- package/lib/constants/ResourceTypeLimit.js +19 -2
- package/lib/core/common/icons/icon.js +3 -35
- package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +2 -2
- package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +160 -9
- package/lib/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +3 -5
- package/lib/core/editor/components/settings/propertyViews/index.js +1 -5
- package/lib/core/editor/components/settings/propertyViews/layer/DataTab/LayerAddResourceDrawer.js +2 -2
- package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +3 -2
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/topoData.js +24 -17
- package/lib/core/models/utils/linkUtils.js +12 -12
- package/lib/hooks/useResourceConfig.js +3 -2
- package/lib/hooks/useSelection.js +15 -11
- package/lib/models/topoConfig.js +24 -16
- package/lib/models/topoMod.js +1 -0
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +19 -9
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +17 -2
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Setting/index.js +2 -2
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +145 -113
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +60 -22
- package/lib/topoCenter/components/editor/propertyViews/edge/link/LinkInfoPreview.js +27 -7
- package/lib/topoCenter/event/index.js +2 -1
- package/lib/topoCenter/hooks/editor/useDeleteEdges.js +46 -24
- package/lib/topoCenter/services/link.js +52 -0
- package/lib/topoCenter/utils/linPermissionUtil.js +24 -13
- package/lib/utils/ResourceConfigUtil.js +36 -14
- package/lib/utils/topoData.js +6 -7
- package/package.json +3 -3
- package/es/core/common/icons/defaultIcons.js +0 -44
- package/es/core/common/icons/networkTopoCiTypeIcons.js +0 -9
- package/lib/core/common/icons/defaultIcons.js +0 -53
- package/lib/core/common/icons/networkTopoCiTypeIcons.js +0 -22
package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js
CHANGED
|
@@ -8,9 +8,11 @@ import _Field from "@alifd/next/es/field";
|
|
|
8
8
|
import _extends from "@babel/runtime/helpers/extends";
|
|
9
9
|
import _Grid from "@alifd/next/es/grid";
|
|
10
10
|
import _Form from "@alifd/next/es/form";
|
|
11
|
+
import _Radio from "@alifd/next/es/radio";
|
|
11
12
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
12
13
|
import React, { useState, useEffect } from "react";
|
|
13
14
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
15
|
+
var RadioGroup = _Radio.Group;
|
|
14
16
|
var FormItem = _Form.Item;
|
|
15
17
|
var Row = _Grid.Row,
|
|
16
18
|
Col = _Grid.Col; // import LindInfoPreview from "../../link/LindInfoPreview";
|
|
@@ -36,9 +38,9 @@ export default function EditLinkInfo(props) {
|
|
|
36
38
|
|
|
37
39
|
var _topo$store$useModel2 = topo.store.useModel("topoBizMod"),
|
|
38
40
|
bizState = _topo$store$useModel2[0],
|
|
39
|
-
bizDispatchers = _topo$store$useModel2[1];
|
|
41
|
+
bizDispatchers = _topo$store$useModel2[1]; // const { resAndMetrics } = topoState;
|
|
42
|
+
// const { resAndMetrics } = bizState;
|
|
40
43
|
|
|
41
|
-
var resAndMetrics = topoState.resAndMetrics; // const { resAndMetrics } = bizState;
|
|
42
44
|
|
|
43
45
|
var source = lineData.source,
|
|
44
46
|
target = lineData.target,
|
|
@@ -56,9 +58,13 @@ export default function EditLinkInfo(props) {
|
|
|
56
58
|
targetValue = _useState3[0],
|
|
57
59
|
setTarget = _useState3[1];
|
|
58
60
|
|
|
61
|
+
var _useState4 = useState(true),
|
|
62
|
+
connectEnable = _useState4[0],
|
|
63
|
+
setConnectEnable = _useState4[1];
|
|
64
|
+
|
|
59
65
|
var fieldOnChange = function fieldOnChange(name, value) {
|
|
60
|
-
var newValues = field.getValues();
|
|
61
|
-
|
|
66
|
+
var newValues = field.getValues(); // rlog.debug("Field-onChange", newValues, name, value);
|
|
67
|
+
|
|
62
68
|
setValus(newValues);
|
|
63
69
|
};
|
|
64
70
|
|
|
@@ -83,7 +89,8 @@ export default function EditLinkInfo(props) {
|
|
|
83
89
|
}
|
|
84
90
|
};
|
|
85
91
|
|
|
86
|
-
var linkTypeJudge = function linkTypeJudge(sourceType, destinationType) {
|
|
92
|
+
var linkTypeJudge = function linkTypeJudge(sourceType, destinationType, type) {
|
|
93
|
+
console.log("linkTypeJudge", sourceType, destinationType, type);
|
|
87
94
|
var connect = "phy";
|
|
88
95
|
var support = "m.physical_link";
|
|
89
96
|
|
|
@@ -92,8 +99,9 @@ export default function EditLinkInfo(props) {
|
|
|
92
99
|
support = "m.agg_link";
|
|
93
100
|
}
|
|
94
101
|
|
|
95
|
-
if (
|
|
102
|
+
if (type === "exit") {
|
|
96
103
|
connect = "exit";
|
|
104
|
+
support = "m.exit_link";
|
|
97
105
|
}
|
|
98
106
|
|
|
99
107
|
return {
|
|
@@ -102,6 +110,10 @@ export default function EditLinkInfo(props) {
|
|
|
102
110
|
};
|
|
103
111
|
};
|
|
104
112
|
|
|
113
|
+
var connectHandleChange = function connectHandleChange(v) {
|
|
114
|
+
field.setValue("connect_type", v);
|
|
115
|
+
};
|
|
116
|
+
|
|
105
117
|
var portsHandleChange = function portsHandleChange(type, value) {
|
|
106
118
|
var _sourceValue$portsDoc, _sourceValue$portsDoc2, _targetValue$portsDoc, _targetValue$portsDoc2;
|
|
107
119
|
|
|
@@ -116,9 +128,9 @@ export default function EditLinkInfo(props) {
|
|
|
116
128
|
actualBandwidth = Math.min(sourceRb, targetRb);
|
|
117
129
|
} else {
|
|
118
130
|
actualBandwidth = sourceRb || targetRb;
|
|
119
|
-
}
|
|
131
|
+
} // rlog.debug("network_link.actual_bandwidth", actualBandwidth);
|
|
132
|
+
|
|
120
133
|
|
|
121
|
-
rlog.debug("network_link.actual_bandwidth", actualBandwidth);
|
|
122
134
|
field.setValue("network_link.actual_bandwidth", actualBandwidth);
|
|
123
135
|
};
|
|
124
136
|
|
|
@@ -127,14 +139,15 @@ export default function EditLinkInfo(props) {
|
|
|
127
139
|
if (errors) {
|
|
128
140
|
rlog.debug("saveHandleChange-error", errors, values);
|
|
129
141
|
} else {
|
|
130
|
-
var _sourceValue$portsDoc3, _sourceValue$portsDoc4, _targetValue$portsDoc3, _targetValue$portsDoc4, _sourceValue$ipAddres, _targetValue$
|
|
142
|
+
var _valus$destination_id, _sourceValue$portsDoc3, _sourceValue$portsDoc4, _targetValue$portsDoc3, _targetValue$portsDoc4, _targetValue$ipAddres, _sourceValue$ipAddres, _targetValue$id;
|
|
131
143
|
|
|
132
144
|
rlog.debug("saveHandleChange", valus, source, target);
|
|
133
145
|
var sourceId = valus["source_id"];
|
|
134
|
-
var destinationId = valus["destination_id"];
|
|
146
|
+
var destinationId = (_valus$destination_id = valus["destination_id"]) !== null && _valus$destination_id !== void 0 ? _valus$destination_id : "";
|
|
135
147
|
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 : "";
|
|
136
148
|
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 : "";
|
|
137
|
-
var typeJudge = linkTypeJudge(sourceType, destinationType);
|
|
149
|
+
var typeJudge = linkTypeJudge(sourceType, destinationType, valus["network_link.connect_type"]);
|
|
150
|
+
var destination_ipv4 = valus["network_link.connect_type"] !== "exit" ? (_targetValue$ipAddres = targetValue.ipAddress) !== null && _targetValue$ipAddres !== void 0 ? _targetValue$ipAddres : valus["network_link.destination_ipv4"] : valus["network_link.destination_ipv4"];
|
|
138
151
|
var obj = {
|
|
139
152
|
display_name: valus["display_name"],
|
|
140
153
|
// 链路名称
|
|
@@ -142,7 +155,7 @@ export default function EditLinkInfo(props) {
|
|
|
142
155
|
// 链路名称
|
|
143
156
|
"network_link.source_ipv4": (_sourceValue$ipAddres = sourceValue.ipAddress) !== null && _sourceValue$ipAddres !== void 0 ? _sourceValue$ipAddres : valus["network_link.source_ipv4"],
|
|
144
157
|
// 源IP
|
|
145
|
-
"network_link.destination_ipv4":
|
|
158
|
+
"network_link.destination_ipv4": destination_ipv4,
|
|
146
159
|
// 目的IP
|
|
147
160
|
// source_id, // 源端口
|
|
148
161
|
// destination_id, // 目的端口
|
|
@@ -154,7 +167,7 @@ export default function EditLinkInfo(props) {
|
|
|
154
167
|
// destination_type, // 必须
|
|
155
168
|
"network_link.source_device_id": sourceValue.id,
|
|
156
169
|
// 必须
|
|
157
|
-
"network_link.destination_device_id": targetValue.id,
|
|
170
|
+
"network_link.destination_device_id": (_targetValue$id = targetValue.id) !== null && _targetValue$id !== void 0 ? _targetValue$id : "",
|
|
158
171
|
// 必须
|
|
159
172
|
"network_link.connect_type": typeJudge.connect,
|
|
160
173
|
// 必须
|
|
@@ -171,6 +184,10 @@ export default function EditLinkInfo(props) {
|
|
|
171
184
|
obj["destination_id"] = destinationId; // 目的端口
|
|
172
185
|
|
|
173
186
|
obj["destination_type"] = destinationType;
|
|
187
|
+
} else {
|
|
188
|
+
obj["destination_id"] = ""; // 目的端口
|
|
189
|
+
|
|
190
|
+
obj["destination_type"] = "";
|
|
174
191
|
}
|
|
175
192
|
|
|
176
193
|
if (isAdd) {
|
|
@@ -207,6 +224,16 @@ export default function EditLinkInfo(props) {
|
|
|
207
224
|
});
|
|
208
225
|
};
|
|
209
226
|
|
|
227
|
+
var targetIpComp = function targetIpComp(targetValue) {
|
|
228
|
+
return targetValue.ipAddress && targetValue.ciType !== "customNode" ? /*#__PURE__*/React.createElement("div", {
|
|
229
|
+
className: styles.label
|
|
230
|
+
}, targetValue.ipAddress) : /*#__PURE__*/React.createElement(_Input, {
|
|
231
|
+
placeholder: "\u8BF7\u8F93\u5165",
|
|
232
|
+
name: "network_link.destination_ipv4",
|
|
233
|
+
maxLength: 128
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
|
|
210
237
|
return /*#__PURE__*/React.createElement("div", {
|
|
211
238
|
className: styles.editForm
|
|
212
239
|
}, /*#__PURE__*/React.createElement(_Form, {
|
|
@@ -245,13 +272,7 @@ export default function EditLinkInfo(props) {
|
|
|
245
272
|
}, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
|
|
246
273
|
labelAlign: labelAlign,
|
|
247
274
|
label: "\u76EE\u7684\u8282\u70B9IP"
|
|
248
|
-
}),
|
|
249
|
-
className: styles.label
|
|
250
|
-
}, targetValue.ipAddress) : /*#__PURE__*/React.createElement(_Input, {
|
|
251
|
-
placeholder: "\u8BF7\u8F93\u5165",
|
|
252
|
-
name: "network_link.destination_ipv4",
|
|
253
|
-
maxLength: 128
|
|
254
|
-
})))), /*#__PURE__*/React.createElement(Row, {
|
|
275
|
+
}), targetIpComp(target)))), /*#__PURE__*/React.createElement(Row, {
|
|
255
276
|
gutter: "16"
|
|
256
277
|
}, /*#__PURE__*/React.createElement(Col, {
|
|
257
278
|
span: "12"
|
|
@@ -273,7 +294,7 @@ export default function EditLinkInfo(props) {
|
|
|
273
294
|
}, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
|
|
274
295
|
labelAlign: labelAlign,
|
|
275
296
|
label: "\u76EE\u7684\u7AEF\u53E3",
|
|
276
|
-
required:
|
|
297
|
+
required: valus["connect_type"] !== "exit",
|
|
277
298
|
requiredMessage: "\u76EE\u7684\u7AEF\u53E3\u4E0D\u80FD\u4E3A\u7A7A"
|
|
278
299
|
}), targetValue.ipAddress ? /*#__PURE__*/React.createElement(_Select, {
|
|
279
300
|
name: "destination_id",
|
|
@@ -320,6 +341,25 @@ export default function EditLinkInfo(props) {
|
|
|
320
341
|
gutter: "16"
|
|
321
342
|
}, /*#__PURE__*/React.createElement(Col, {
|
|
322
343
|
span: "24"
|
|
344
|
+
}, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
|
|
345
|
+
labelAlign: labelAlign,
|
|
346
|
+
label: "\u94FE\u63A5\u65B9\u5F0F"
|
|
347
|
+
}), /*#__PURE__*/React.createElement(RadioGroup, {
|
|
348
|
+
name: "connect_type",
|
|
349
|
+
onChange: function onChange(v) {
|
|
350
|
+
connectHandleChange(v);
|
|
351
|
+
}
|
|
352
|
+
}, /*#__PURE__*/React.createElement(_Radio, {
|
|
353
|
+
id: "phy",
|
|
354
|
+
value: "phy",
|
|
355
|
+
disabled: target.ciType === "customNode"
|
|
356
|
+
}, "\u7269\u7406/\u805A\u5408"), /*#__PURE__*/React.createElement(_Radio, {
|
|
357
|
+
id: "exit",
|
|
358
|
+
value: "exit"
|
|
359
|
+
}, "\u51FA\u53E3"))))), /*#__PURE__*/React.createElement(Row, {
|
|
360
|
+
gutter: "16"
|
|
361
|
+
}, /*#__PURE__*/React.createElement(Col, {
|
|
362
|
+
span: "24"
|
|
323
363
|
}, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
|
|
324
364
|
labelAlign: labelAlign,
|
|
325
365
|
label: "\u5B9E\u9645\u5E26\u5BBD\uFF08Mbps\uFF09"
|
|
@@ -3,6 +3,7 @@ import _Collapse from "@alifd/next/es/collapse";
|
|
|
3
3
|
import React, { useEffect } from "react";
|
|
4
4
|
import styles from "./LinkInfoPreview.module.scss";
|
|
5
5
|
import { formatMetric } from "../../../../../../core/models/attributeFormatter";
|
|
6
|
+
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
6
7
|
var CollapsePanel = _Collapse.Panel;
|
|
7
8
|
export default function LindInfoPreview(props) {
|
|
8
9
|
var topo = props.topo,
|
|
@@ -28,8 +29,13 @@ export default function LindInfoPreview(props) {
|
|
|
28
29
|
}, {
|
|
29
30
|
label: "目的端口",
|
|
30
31
|
name: "destination_id"
|
|
31
|
-
},
|
|
32
|
-
|
|
32
|
+
}, {
|
|
33
|
+
label: "取值端口",
|
|
34
|
+
name: "network_link.value_port"
|
|
35
|
+
}, {
|
|
36
|
+
label: "链接方式",
|
|
37
|
+
name: "network_link.connect_type"
|
|
38
|
+
}, {
|
|
33
39
|
label: "实际带宽",
|
|
34
40
|
name: "network_link.actual_bandwidth"
|
|
35
41
|
}, {
|
|
@@ -40,14 +46,27 @@ export default function LindInfoPreview(props) {
|
|
|
40
46
|
var getValue = function getValue(name) {
|
|
41
47
|
var value;
|
|
42
48
|
|
|
43
|
-
if (data
|
|
44
|
-
|
|
49
|
+
if (data) {
|
|
50
|
+
if (data.attributes[name + "_object"]) {
|
|
51
|
+
value = data.attributes[name + "_object"].displayName;
|
|
52
|
+
} else {
|
|
53
|
+
value = data.attributes[name];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
var attrMeta = topo.ciTyeCache.getCiType("network_link").attributeMap[name];
|
|
57
|
+
value = formatMetric(value, attrMeta);
|
|
58
|
+
|
|
59
|
+
if (name === "network_link.value_port") {
|
|
60
|
+
value = "源端口";
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (name === "network_link.connect_type") {
|
|
64
|
+
value = data.attributes[name] === "exit" ? "出口" : "物理/聚合";
|
|
65
|
+
}
|
|
45
66
|
} else {
|
|
46
|
-
value =
|
|
67
|
+
value = "-";
|
|
47
68
|
}
|
|
48
69
|
|
|
49
|
-
var attrMeta = topo.ciTyeCache.getCiType("network_link").attributeMap[name];
|
|
50
|
-
value = formatMetric(value, attrMeta);
|
|
51
70
|
return value;
|
|
52
71
|
};
|
|
53
72
|
|
|
@@ -2,4 +2,5 @@ var TopoCenterEvent = function TopoCenterEvent() {};
|
|
|
2
2
|
|
|
3
3
|
TopoCenterEvent.TOPO_LINK_ENTER_CREATE_MODE = "topo_link_enter_create_mode";
|
|
4
4
|
TopoCenterEvent.TOPO_LINK_CREATED = "topo_link_created";
|
|
5
|
+
TopoCenterEvent.TOPO_LINK_SELECT_SOURCE_NODE = "topo_link_select_source_node";
|
|
5
6
|
export { TopoCenterEvent as default };
|
|
@@ -41,31 +41,24 @@ export default (function (_ref) {
|
|
|
41
41
|
return deleteable;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
var isAgg = isAggLink(link);
|
|
48
|
-
|
|
49
|
-
if (!checkLinkDeleteable(link)) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
var htTopo = topo.getHtTopo();
|
|
54
|
-
confirmDeleteLink( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
55
|
-
var success, edgesInNodes, edgeGroupData, edgeData, _topo$store$getModel, topoState, topoDispatchers, _topoState$data, links, linkGroups;
|
|
44
|
+
var doDeleteLink = /*#__PURE__*/function () {
|
|
45
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(link, edge) {
|
|
46
|
+
var id, isAgg, success, htTopo, edgesInNodes, edgeGroupData, edgeData, _topo$store$getModel, topoState, topoDispatchers, _topoState$data, links, linkGroups;
|
|
56
47
|
|
|
57
48
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
58
49
|
while (1) {
|
|
59
50
|
switch (_context.prev = _context.next) {
|
|
60
51
|
case 0:
|
|
61
|
-
|
|
52
|
+
id = link.id;
|
|
53
|
+
isAgg = isAggLink(link);
|
|
54
|
+
_context.next = 4;
|
|
62
55
|
return linkService.deleteLink(id);
|
|
63
56
|
|
|
64
|
-
case
|
|
57
|
+
case 4:
|
|
65
58
|
success = _context.sent;
|
|
66
59
|
|
|
67
60
|
if (success) {
|
|
68
|
-
_context.next =
|
|
61
|
+
_context.next = 8;
|
|
69
62
|
break;
|
|
70
63
|
}
|
|
71
64
|
|
|
@@ -73,9 +66,10 @@ export default (function (_ref) {
|
|
|
73
66
|
|
|
74
67
|
return _context.abrupt("return");
|
|
75
68
|
|
|
76
|
-
case
|
|
77
|
-
_Message.success('删除成功');
|
|
69
|
+
case 8:
|
|
70
|
+
_Message.success('删除成功');
|
|
78
71
|
|
|
72
|
+
htTopo = topo.getHtTopo(); // 获取两个节点间的连线数据列表
|
|
79
73
|
|
|
80
74
|
edgesInNodes = htTopo.getEdgeDatasInNodes(edge.getSource(), edge.getTarget());
|
|
81
75
|
|
|
@@ -99,28 +93,56 @@ export default (function (_ref) {
|
|
|
99
93
|
|
|
100
94
|
_topo$store$getModel = topo.store.getModel('topoMod'), topoState = _topo$store$getModel[0], topoDispatchers = _topo$store$getModel[1];
|
|
101
95
|
_topoState$data = topoState.data, links = _topoState$data.links, linkGroups = _topoState$data.linkGroups;
|
|
102
|
-
_context.next =
|
|
96
|
+
_context.next = 16;
|
|
103
97
|
return topoDispatchers.update({
|
|
104
98
|
data: _extends({}, topoState.data, {
|
|
105
|
-
links: links.filter(function (
|
|
106
|
-
return
|
|
99
|
+
links: links.filter(function (item) {
|
|
100
|
+
return item.id !== id;
|
|
107
101
|
}),
|
|
108
|
-
linkGroups: linkGroups.filter(function (
|
|
109
|
-
return
|
|
102
|
+
linkGroups: linkGroups.filter(function (item) {
|
|
103
|
+
return item.id !== id;
|
|
110
104
|
})
|
|
111
105
|
})
|
|
112
106
|
});
|
|
113
107
|
|
|
114
|
-
case
|
|
108
|
+
case 16:
|
|
115
109
|
// 刷新链路动态线宽
|
|
116
110
|
topo.linkDynamicStyleExecutor.execute();
|
|
117
111
|
|
|
118
|
-
case
|
|
112
|
+
case 17:
|
|
119
113
|
case "end":
|
|
120
114
|
return _context.stop();
|
|
121
115
|
}
|
|
122
116
|
}
|
|
123
117
|
}, _callee);
|
|
118
|
+
}));
|
|
119
|
+
|
|
120
|
+
return function doDeleteLink(_x, _x2) {
|
|
121
|
+
return _ref2.apply(this, arguments);
|
|
122
|
+
};
|
|
123
|
+
}();
|
|
124
|
+
|
|
125
|
+
var deleteLink = function deleteLink(edge) {
|
|
126
|
+
var id = edge.getTag();
|
|
127
|
+
var link = topo.dataModel.getDataById(id);
|
|
128
|
+
|
|
129
|
+
if (!checkLinkDeleteable(link)) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
confirmDeleteLink( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
134
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
135
|
+
while (1) {
|
|
136
|
+
switch (_context2.prev = _context2.next) {
|
|
137
|
+
case 0:
|
|
138
|
+
doDeleteLink(link, edge);
|
|
139
|
+
|
|
140
|
+
case 1:
|
|
141
|
+
case "end":
|
|
142
|
+
return _context2.stop();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}, _callee2);
|
|
124
146
|
})));
|
|
125
147
|
};
|
|
126
148
|
/**
|
|
@@ -139,5 +139,56 @@ export default {
|
|
|
139
139
|
}
|
|
140
140
|
}, _callee4, null, [[0, 7]]);
|
|
141
141
|
}))();
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* 查询可关联链路
|
|
146
|
+
*
|
|
147
|
+
* @param {array} ciIds
|
|
148
|
+
*/
|
|
149
|
+
queryAssociatedlinks: function queryAssociatedlinks(ids, type) {
|
|
150
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
151
|
+
var stag, ttag, condition, parm, jsonParm, result;
|
|
152
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
153
|
+
while (1) {
|
|
154
|
+
switch (_context5.prev = _context5.next) {
|
|
155
|
+
case 0:
|
|
156
|
+
// const idtxt = `'${ids[0]}','${ids[1]}'`;
|
|
157
|
+
stag = ids[0];
|
|
158
|
+
ttag = ids[1];
|
|
159
|
+
condition = "type('network_link') && network_link.connect_type = 'exit' && network_link.source_device_id ='" + stag + "'";
|
|
160
|
+
|
|
161
|
+
if (ttag) {
|
|
162
|
+
condition = "type('network_link') && network_link.connect_type = 'exit' && network_link.source_device_id ='" + stag + "' && network_link.destination_device_id='" + ttag + "'";
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
parm = {
|
|
166
|
+
condition: condition,
|
|
167
|
+
sort: "name asc",
|
|
168
|
+
currentPage: 1,
|
|
169
|
+
pageSize: 99
|
|
170
|
+
};
|
|
171
|
+
jsonParm = JSON.stringify(parm);
|
|
172
|
+
console.log("queryAssociatedlinks", ids, parm, jsonParm);
|
|
173
|
+
_context5.prev = 7;
|
|
174
|
+
_context5.next = 10;
|
|
175
|
+
return getRequest().post("/mdc/v1/api/cmdb/commonQueryCiData", jsonParm);
|
|
176
|
+
|
|
177
|
+
case 10:
|
|
178
|
+
result = _context5.sent;
|
|
179
|
+
return _context5.abrupt("return", result);
|
|
180
|
+
|
|
181
|
+
case 14:
|
|
182
|
+
_context5.prev = 14;
|
|
183
|
+
_context5.t0 = _context5["catch"](7);
|
|
184
|
+
rlog.error("查询可关联链路", _context5.t0);
|
|
185
|
+
|
|
186
|
+
case 17:
|
|
187
|
+
case "end":
|
|
188
|
+
return _context5.stop();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}, _callee5, null, [[7, 14]]);
|
|
192
|
+
}))();
|
|
142
193
|
}
|
|
143
194
|
};
|
|
@@ -1,24 +1,35 @@
|
|
|
1
|
+
var isWriteable = function isWriteable(link, source, target, linkType) {
|
|
2
|
+
if (linkType === "exit") {
|
|
3
|
+
return ["write", "delete"].indexOf(source === null || source === void 0 ? void 0 : source.operation) !== -1;
|
|
4
|
+
} else {
|
|
5
|
+
return [source, target].filter(function (node) {
|
|
6
|
+
return ["write", "delete"].indexOf(node === null || node === void 0 ? void 0 : node.operation) !== -1;
|
|
7
|
+
}).length === 2;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
1
10
|
/**
|
|
2
11
|
* 获得链路权限
|
|
3
|
-
*
|
|
4
|
-
* @param {*} link
|
|
5
|
-
* @param {*} nodes
|
|
6
|
-
* @returns
|
|
12
|
+
*
|
|
13
|
+
* @param {*} link
|
|
14
|
+
* @param {*} nodes
|
|
15
|
+
* @returns
|
|
7
16
|
*/
|
|
8
|
-
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export function getLinkPermission(edge, nodes, link) {
|
|
9
20
|
var source = nodes.find(function (node) {
|
|
10
|
-
return node.id ===
|
|
21
|
+
return node.id === edge.getSource().getTag();
|
|
11
22
|
});
|
|
12
23
|
var target = nodes.find(function (node) {
|
|
13
|
-
return node.id ===
|
|
14
|
-
});
|
|
24
|
+
return node.id === edge.getTarget().getTag();
|
|
25
|
+
}); // console.log("getLinkPermission", edge, source, target, link);
|
|
26
|
+
|
|
27
|
+
var linkType = link ? link.attributes["network_link.connect_type"] : edge.a("network_link.connect_type");
|
|
15
28
|
return {
|
|
16
|
-
readable: source.operation || target.operation,
|
|
17
|
-
writeable:
|
|
18
|
-
return ['write', 'delete'].indexOf(node.operation) !== -1;
|
|
19
|
-
}).length === 2,
|
|
29
|
+
readable: (source === null || source === void 0 ? void 0 : source.operation) || (target === null || target === void 0 ? void 0 : target.operation),
|
|
30
|
+
writeable: isWriteable(edge, source, target, linkType),
|
|
20
31
|
deleteable: [source, target].filter(function (node) {
|
|
21
|
-
return [
|
|
32
|
+
return ["write", "delete"].indexOf(node === null || node === void 0 ? void 0 : node.operation) !== -1;
|
|
22
33
|
}).length >= 1
|
|
23
34
|
};
|
|
24
35
|
}
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import sortBy from
|
|
2
|
-
import { getGroupChildrenNodes, getGroups, getLayerChildrenNodes, getLayers, getNodes } from "./htElementUtils";
|
|
1
|
+
import sortBy from "lodash/sortBy";
|
|
2
|
+
import { getEdges, getGroupChildrenNodes, getGroups, getLayerChildrenNodes, getLayers, getNodes } from "./htElementUtils";
|
|
3
3
|
/**
|
|
4
4
|
* 从拓扑图解析出拓扑资源配置
|
|
5
|
-
*
|
|
6
|
-
* @param {ht.DataModel} dataModel
|
|
5
|
+
*
|
|
6
|
+
* @param {ht.DataModel} dataModel
|
|
7
7
|
* @returns {{layers, groups, resources}}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
function getResourceConfigFromHt(
|
|
11
|
-
|
|
10
|
+
function getResourceConfigFromHt(topo) {
|
|
11
|
+
var htTopo = topo.getHtTopo();
|
|
12
|
+
var dataModel = topo.getDataModel(); // 获得分层
|
|
13
|
+
|
|
12
14
|
var layerElements = getLayers(dataModel);
|
|
13
15
|
var layers = layerElements.map(function (layerElement) {
|
|
14
16
|
return {
|
|
15
17
|
id: layerElement.getTag(),
|
|
16
|
-
tag: layerElement.a(
|
|
17
|
-
name: layerElement.s(
|
|
18
|
-
order: layerElement.a(
|
|
18
|
+
tag: layerElement.a("tag"),
|
|
19
|
+
name: layerElement.s("label"),
|
|
20
|
+
order: layerElement.a("order"),
|
|
19
21
|
resources: {
|
|
20
22
|
"static": getLayerChildrenNodes(layerElement).filter(function (node) {
|
|
21
23
|
return !!node.getTag();
|
|
@@ -32,7 +34,7 @@ function getResourceConfigFromHt(dataModel) {
|
|
|
32
34
|
var viewNodes = getNodes(dataModel).filter(function (node) {
|
|
33
35
|
return !node.getParent();
|
|
34
36
|
}).filter(function (node) {
|
|
35
|
-
return node.a(
|
|
37
|
+
return node.a("type") === "node";
|
|
36
38
|
}).filter(function (node) {
|
|
37
39
|
return !!node.getTag();
|
|
38
40
|
});
|
|
@@ -43,20 +45,40 @@ function getResourceConfigFromHt(dataModel) {
|
|
|
43
45
|
}; // console.error('getResourceConfigFromHt', {
|
|
44
46
|
// viewNodes,
|
|
45
47
|
// });
|
|
48
|
+
// 查询出口链路列表
|
|
49
|
+
|
|
50
|
+
var exportLinkIdList = [];
|
|
51
|
+
var edges = getEdges(dataModel);
|
|
52
|
+
console.log(" 查询出口链路列表-edges", edges, dataModel);
|
|
53
|
+
edges.forEach(function (edge) {
|
|
54
|
+
var edgeData = htTopo.getEdgeData(edge); // eslint-disable-next-line no-underscore-dangle
|
|
55
|
+
|
|
56
|
+
var id = edgeData._attrObject.id;
|
|
57
|
+
|
|
58
|
+
if (id) {
|
|
59
|
+
var linkData = topo.dataModel.getDataById(id);
|
|
60
|
+
var connectType = linkData === null || linkData === void 0 ? void 0 : linkData.attributes["network_link.connect_type"];
|
|
46
61
|
|
|
62
|
+
if (connectType === "exit" && !exportLinkIdList.includes(id)) {
|
|
63
|
+
exportLinkIdList.push(id);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
});
|
|
47
67
|
return {
|
|
48
|
-
layers: sortBy(layers,
|
|
49
|
-
groups: sortBy([].concat(layers, groups),
|
|
50
|
-
resources: resources
|
|
68
|
+
layers: sortBy(layers, "order"),
|
|
69
|
+
groups: sortBy([].concat(layers, groups), "order"),
|
|
70
|
+
resources: resources,
|
|
71
|
+
exportLinkIdList: exportLinkIdList // 出口链路id列表
|
|
72
|
+
|
|
51
73
|
};
|
|
52
74
|
}
|
|
53
75
|
|
|
54
76
|
function getGroupConfigByElement(groupElement) {
|
|
55
77
|
return {
|
|
56
78
|
id: groupElement.getTag(),
|
|
57
|
-
tag: groupElement.a(
|
|
58
|
-
name: groupElement.a(
|
|
59
|
-
order: groupElement.a(
|
|
79
|
+
tag: groupElement.a("tag"),
|
|
80
|
+
name: groupElement.a("name"),
|
|
81
|
+
order: groupElement.a("order"),
|
|
60
82
|
resources: {
|
|
61
83
|
"static": getGroupChildrenNodes(groupElement).filter(function (node) {
|
|
62
84
|
return !!node.getTag();
|
package/es/utils/topoData.js
CHANGED
|
@@ -268,7 +268,7 @@ export function buildTopoGraphData() {// TODO 构造拓扑图数据移到这里
|
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
function buildGlobal(_ref2) {
|
|
271
|
-
var _result$config, _engine$viewProps, _result$global2, _engine$options$viewe, _engine$options$edito, _engine$options$edito2;
|
|
271
|
+
var _result$config, _engine$viewProps, _result$global2, _result$customGlobal, _result$customGlobal2, _engine$options$viewe, _engine$options$edito, _engine$options$edito2;
|
|
272
272
|
|
|
273
273
|
var result = _ref2.data,
|
|
274
274
|
permission = _ref2.permission,
|
|
@@ -295,14 +295,14 @@ function buildGlobal(_ref2) {
|
|
|
295
295
|
};
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
return
|
|
298
|
+
return {
|
|
299
299
|
// 背景图
|
|
300
300
|
backgroundImgUrl: (_engine$viewProps = engine.viewProps) !== null && _engine$viewProps !== void 0 && _engine$viewProps.hideBackground ? null : getBackgroundImageUrl(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.background),
|
|
301
301
|
control: _extends({
|
|
302
302
|
editable: topoPermissionUtil.isEditable(permission),
|
|
303
303
|
// 是否可编辑----控制[编辑]按钮
|
|
304
304
|
moveable: true
|
|
305
|
-
}, (result === null || result === void 0 ? void 0 : (_result$global2 = result.global) === null || _result$global2 === void 0 ? void 0 : _result$global2.control) || {}),
|
|
305
|
+
}, (result === null || result === void 0 ? void 0 : (_result$global2 = result.global) === null || _result$global2 === void 0 ? void 0 : _result$global2.control) || {}, (result === null || result === void 0 ? void 0 : (_result$customGlobal = result.customGlobal) === null || _result$customGlobal === void 0 ? void 0 : _result$customGlobal.control) || {}),
|
|
306
306
|
topoDisplayConfig: _extends({
|
|
307
307
|
// alarmSwitch: (result.global || {}).alarmSwitch ?? true,
|
|
308
308
|
showLog: false,
|
|
@@ -315,9 +315,8 @@ function buildGlobal(_ref2) {
|
|
|
315
315
|
// 是否显示链路名称
|
|
316
316
|
nodeLabelStyle: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.nodeLabelStyle,
|
|
317
317
|
edgeFlow: edgeFlow
|
|
318
|
-
}, (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.topoDisplayConfig) || {}),
|
|
319
|
-
linkTo: linkTo
|
|
320
|
-
}, result.global || {}, {
|
|
318
|
+
}, (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.topoDisplayConfig) || {}, (result === null || result === void 0 ? void 0 : (_result$customGlobal2 = result.customGlobal) === null || _result$customGlobal2 === void 0 ? void 0 : _result$customGlobal2.topoDisplayConfig) || {}),
|
|
319
|
+
linkTo: linkTo,
|
|
321
320
|
viewMode: {
|
|
322
321
|
// 右键菜单
|
|
323
322
|
contextMenu: mergeContextmenu(buildViewerContextMenu(engine), (_engine$options$viewe = engine.options.viewer) === null || _engine$options$viewe === void 0 ? void 0 : _engine$options$viewe.contextmenu, engine)
|
|
@@ -330,7 +329,7 @@ function buildGlobal(_ref2) {
|
|
|
330
329
|
icons: getEditorIcons(engine),
|
|
331
330
|
// 获取默认节点图标,可选参数。如果无返回值则继续使用内部默认
|
|
332
331
|
getDefaultNodeIcon: engine.options.getDefaultNodeIcon
|
|
333
|
-
}
|
|
332
|
+
};
|
|
334
333
|
}
|
|
335
334
|
/**
|
|
336
335
|
* 将从后端接收的数据转化为topo组件中需要的数据
|
|
@@ -11,7 +11,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
11
11
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _NetworkTopoResourceSelectDrawer = _interopRequireDefault(require("../NetworkTopoResourceSelectDrawer"));
|
|
15
15
|
|
|
16
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
17
|
|
|
@@ -56,7 +56,7 @@ var MultiResourceDrawer = function MultiResourceDrawer(props) {
|
|
|
56
56
|
};
|
|
57
57
|
}();
|
|
58
58
|
|
|
59
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
59
|
+
return /*#__PURE__*/_react["default"].createElement(_NetworkTopoResourceSelectDrawer["default"], {
|
|
60
60
|
visible: visible,
|
|
61
61
|
getExcludeIds: getExcludeIds,
|
|
62
62
|
onOk: onDrawerSave,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports["default"] = NetworkTopoResourceSelectDrawer;
|
|
7
|
+
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _ResourceTypeLimit = require("../../constants/ResourceTypeLimit");
|
|
13
|
+
|
|
14
|
+
var _ResourceSelectDrawer = _interopRequireDefault(require("../ResourceSelectDrawer/ResourceSelectDrawer"));
|
|
15
|
+
|
|
16
|
+
function NetworkTopoResourceSelectDrawer(props) {
|
|
17
|
+
return /*#__PURE__*/_react["default"].createElement(_ResourceSelectDrawer["default"], (0, _extends2["default"])({
|
|
18
|
+
commonResListProps: (0, _ResourceTypeLimit.getNetworkTopoCommonResListProps)()
|
|
19
|
+
}, props));
|
|
20
|
+
}
|