@riil-frontend/component-topology 2.15.8 → 2.15.11
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 +1 -1
- package/build/index.css +1 -1
- package/build/index.js +23 -23
- package/es/core/editor/components/settings/propertyViews/layer/DataTab/NodeList.js +4 -1
- package/es/core/models/TopoApp.js +1 -1
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +10 -4
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +4 -3
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +59 -44
- package/es/topoCenter/hooks/editor/useDeleteEdges.js +16 -2
- package/es/topoCenter/utils/linPermissionUtil.js +24 -0
- package/lib/core/editor/components/settings/propertyViews/layer/DataTab/NodeList.js +4 -1
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +12 -4
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +4 -3
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +61 -44
- package/lib/topoCenter/hooks/editor/useDeleteEdges.js +18 -3
- package/lib/topoCenter/utils/linPermissionUtil.js +29 -0
- package/package.json +2 -3
|
@@ -10,7 +10,10 @@ export default function LayerResourceList(props) {
|
|
|
10
10
|
var topo = props.topo,
|
|
11
11
|
layer = props.layer;
|
|
12
12
|
var nodes = getLayerChildrenNodes(layer);
|
|
13
|
-
var
|
|
13
|
+
var relateDataNodes = nodes.filter(function (node) {
|
|
14
|
+
return !!node.getTag();
|
|
15
|
+
});
|
|
16
|
+
var data = relateDataNodes.map(function (node) {
|
|
14
17
|
return {
|
|
15
18
|
title: node.a('name'),
|
|
16
19
|
img: getIconById(node.getImage(), topo)
|
|
@@ -19,7 +19,7 @@ import GraphDataModel from "./GraphDataModel";
|
|
|
19
19
|
import { updateEdgeExpanded } from "../utils/edgeUtil";
|
|
20
20
|
import PluginManager from "./PluginManager"; // eslint-disable-next-line no-undef
|
|
21
21
|
|
|
22
|
-
var version = typeof "2.15.
|
|
22
|
+
var version = typeof "2.15.11" === 'string' ? "2.15.11" : null;
|
|
23
23
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
|
24
24
|
var topoDebug = {};
|
|
25
25
|
window.topoDebug = topoDebug;
|
|
@@ -2,12 +2,18 @@ import _Button from "@alifd/next/es/button";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import LindInfoPreview from "../../link/LindInfoPreview";
|
|
4
4
|
import styles from "../../link/LindInfoPreview.module.scss";
|
|
5
|
+
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
6
|
+
import { getLinkPermission } from "../../../../../../utils/linPermissionUtil";
|
|
5
7
|
export default function LinkDataTab(props) {
|
|
6
8
|
var topo = props.topo,
|
|
7
9
|
edge = props.edge,
|
|
8
|
-
editorProps = props.editorProps;
|
|
9
|
-
|
|
10
|
-
var
|
|
10
|
+
editorProps = props.editorProps; // const operation = props.edge.a("operation");
|
|
11
|
+
|
|
12
|
+
var nodes = topo.dataModel.getNodes(); //rlog.debug("LinkDataTab--edge", edge, nodes);
|
|
13
|
+
// const disabled = ["delete", "write"].indexOf(operation) < 0;
|
|
14
|
+
|
|
15
|
+
var permission = getLinkPermission(edge.getAttrObject(), nodes); //rlog.debug("LinkDataTab--", permission);
|
|
16
|
+
// 节点间只有连线组时,显示连线组的数据
|
|
11
17
|
|
|
12
18
|
var _topo$store$useModelS = topo.store.useModelState("topoMod").data,
|
|
13
19
|
links = _topo$store$useModelS.links,
|
|
@@ -38,7 +44,7 @@ export default function LinkDataTab(props) {
|
|
|
38
44
|
}, /*#__PURE__*/React.createElement(_Button, {
|
|
39
45
|
className: styles.button,
|
|
40
46
|
type: "primary",
|
|
41
|
-
disabled:
|
|
47
|
+
disabled: !permission.writeable,
|
|
42
48
|
onClick: openEditLinkDrawer
|
|
43
49
|
}, "\u7F16\u8F91")));
|
|
44
50
|
}
|
|
@@ -245,7 +245,7 @@ function AddLinkDrawer(props) {
|
|
|
245
245
|
rlog.debug("加载哪些ci类型可创建链路", ciTypesConnectable, topo, nodes);
|
|
246
246
|
ciIds = [];
|
|
247
247
|
nodes.map(function (node) {
|
|
248
|
-
if (ciTypesConnectable[node.ciType]) {
|
|
248
|
+
if (ciTypesConnectable[node.ciType] && ["delete", "write"].indexOf(node.operation) >= 0) {
|
|
249
249
|
ciIds.push(node.id);
|
|
250
250
|
}
|
|
251
251
|
});
|
|
@@ -336,7 +336,7 @@ function AddLinkDrawer(props) {
|
|
|
336
336
|
} // 切换到连线组状态
|
|
337
337
|
|
|
338
338
|
|
|
339
|
-
htTopo.toggleEdgeGroup(source, target,
|
|
339
|
+
htTopo.toggleEdgeGroup(source, target, false);
|
|
340
340
|
} else {
|
|
341
341
|
// 物理、出口链路
|
|
342
342
|
if (edgesInNodes.length === 1 && !htTopo.getEdgeData(edgesInNodes[0])) {
|
|
@@ -345,7 +345,7 @@ function AddLinkDrawer(props) {
|
|
|
345
345
|
htTopo.createEdge(source, target, linkData);
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
-
htTopo.toggleEdgeGroup(source, target,
|
|
348
|
+
htTopo.toggleEdgeGroup(source, target, true);
|
|
349
349
|
} // TODO 选中
|
|
350
350
|
|
|
351
351
|
|
|
@@ -466,6 +466,7 @@ function AddLinkDrawer(props) {
|
|
|
466
466
|
lineData: link,
|
|
467
467
|
topo: topo,
|
|
468
468
|
onClose: closeDrawer,
|
|
469
|
+
addLinkIsOpen: addLinkIsOpen,
|
|
469
470
|
onSave: onSave,
|
|
470
471
|
loading: loading,
|
|
471
472
|
isAdd: isAddMode
|
package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js
CHANGED
|
@@ -25,6 +25,7 @@ export default function EditLinkInfo(props) {
|
|
|
25
25
|
var topo = props.topo,
|
|
26
26
|
lineData = props.lineData,
|
|
27
27
|
onClose = props.onClose,
|
|
28
|
+
addLinkIsOpen = props.addLinkIsOpen,
|
|
28
29
|
onSave = props.onSave,
|
|
29
30
|
isAdd = props.isAdd,
|
|
30
31
|
loading = props.loading;
|
|
@@ -41,45 +42,57 @@ export default function EditLinkInfo(props) {
|
|
|
41
42
|
|
|
42
43
|
var source = lineData.source,
|
|
43
44
|
target = lineData.target,
|
|
44
|
-
attributes = lineData.attributes;
|
|
45
|
+
attributes = lineData.attributes; // rlog.debug("lineData-----init", source, target, targetValue.portsDoc);
|
|
45
46
|
|
|
46
47
|
var _useState = useState(attributes),
|
|
47
48
|
valus = _useState[0],
|
|
48
49
|
setValus = _useState[1];
|
|
49
50
|
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
onChange: function onChange(name, value) {
|
|
54
|
-
if (name === "source_id" || name === "destination_id") {
|
|
55
|
-
var _parseInt, _source$portsDoc$sour, _parseInt2, _target$portsDoc$targ;
|
|
51
|
+
var _useState2 = useState(source),
|
|
52
|
+
sourceValue = _useState2[0],
|
|
53
|
+
setSource = _useState2[1];
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
var _useState3 = useState(target),
|
|
56
|
+
targetValue = _useState3[0],
|
|
57
|
+
setTarget = _useState3[1];
|
|
60
58
|
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
var fieldOnChange = function fieldOnChange(name, value) {
|
|
60
|
+
if (name === "source_id" || name === "destination_id") {
|
|
61
|
+
var _parseInt, _sourceValue$portsDoc, _parseInt2, _targetValue$portsDoc;
|
|
63
62
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
63
|
+
var nowValues = field.getValues();
|
|
64
|
+
var sourceId = nowValues["source_id"];
|
|
65
|
+
var targetId = nowValues["destination_id"];
|
|
66
|
+
var sourceRb = (_parseInt = parseInt((_sourceValue$portsDoc = sourceValue.portsDoc[sourceId]) === null || _sourceValue$portsDoc === void 0 ? void 0 : _sourceValue$portsDoc.ratedBandwidth, 10)) !== null && _parseInt !== void 0 ? _parseInt : 0;
|
|
67
|
+
var targetRb = (_parseInt2 = parseInt((_targetValue$portsDoc = targetValue.portsDoc[targetId]) === null || _targetValue$portsDoc === void 0 ? void 0 : _targetValue$portsDoc.ratedBandwidth, 10)) !== null && _parseInt2 !== void 0 ? _parseInt2 : null;
|
|
70
68
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
if (sourceRb && targetRb) {
|
|
70
|
+
field.setValue("network_link.actual_bandwidth", Math.min(sourceRb, targetRb));
|
|
71
|
+
} else {
|
|
72
|
+
field.setValue("network_link.actual_bandwidth", sourceRb || targetRb);
|
|
73
|
+
}
|
|
76
74
|
}
|
|
75
|
+
|
|
76
|
+
var newValues = field.getValues();
|
|
77
|
+
rlog.debug("Field-onChange", newValues, name, value);
|
|
78
|
+
setValus(newValues); // if (values[name] !== value) {
|
|
79
|
+
// onChange(name, value, newValues);
|
|
80
|
+
// }
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
var field = _Field.useField({
|
|
84
|
+
autoUnmount: false,
|
|
85
|
+
values: parseValues(attributes),
|
|
86
|
+
onChange: fieldOnChange
|
|
77
87
|
});
|
|
78
88
|
|
|
79
89
|
useEffect(function () {
|
|
80
90
|
setValus(attributes);
|
|
91
|
+
rlog.debug("useEffect", source, target);
|
|
92
|
+
setSource(source);
|
|
93
|
+
setTarget(target);
|
|
81
94
|
field.setValues(attributes);
|
|
82
|
-
}, [
|
|
95
|
+
}, [addLinkIsOpen]); // const [editState, editDispatchers] = store.useModel("topoCreateMod");
|
|
83
96
|
|
|
84
97
|
var labelAlign = "top";
|
|
85
98
|
var formItemLayout = {
|
|
@@ -114,22 +127,22 @@ export default function EditLinkInfo(props) {
|
|
|
114
127
|
if (errors) {
|
|
115
128
|
rlog.debug("saveHandleChange-error", errors, values);
|
|
116
129
|
} else {
|
|
117
|
-
var
|
|
130
|
+
var _sourceValue$portsDoc2, _sourceValue$portsDoc3, _targetValue$portsDoc2, _targetValue$portsDoc3, _sourceValue$ipAddres, _targetValue$ipAddres;
|
|
118
131
|
|
|
119
132
|
rlog.debug("saveHandleChange", valus, source, target);
|
|
120
133
|
var sourceId = valus["source_id"];
|
|
121
134
|
var destinationId = valus["destination_id"];
|
|
122
|
-
var sourceType = (
|
|
123
|
-
var destinationType = (
|
|
135
|
+
var sourceType = (_sourceValue$portsDoc2 = (_sourceValue$portsDoc3 = sourceValue.portsDoc[sourceId]) === null || _sourceValue$portsDoc3 === void 0 ? void 0 : _sourceValue$portsDoc3.type) !== null && _sourceValue$portsDoc2 !== void 0 ? _sourceValue$portsDoc2 : "";
|
|
136
|
+
var destinationType = (_targetValue$portsDoc2 = (_targetValue$portsDoc3 = targetValue.portsDoc[destinationId]) === null || _targetValue$portsDoc3 === void 0 ? void 0 : _targetValue$portsDoc3.type) !== null && _targetValue$portsDoc2 !== void 0 ? _targetValue$portsDoc2 : "";
|
|
124
137
|
var typeJudge = linkTypeJudge(sourceType, destinationType);
|
|
125
138
|
var obj = {
|
|
126
139
|
display_name: valus["display_name"],
|
|
127
140
|
// 链路名称
|
|
128
141
|
name: valus["display_name"],
|
|
129
142
|
// 链路名称
|
|
130
|
-
"network_link.source_ipv4": (
|
|
143
|
+
"network_link.source_ipv4": (_sourceValue$ipAddres = sourceValue.ipAddress) !== null && _sourceValue$ipAddres !== void 0 ? _sourceValue$ipAddres : valus["network_link.source_ipv4"],
|
|
131
144
|
// 源IP
|
|
132
|
-
"network_link.destination_ipv4": (
|
|
145
|
+
"network_link.destination_ipv4": (_targetValue$ipAddres = targetValue.ipAddress) !== null && _targetValue$ipAddres !== void 0 ? _targetValue$ipAddres : valus["network_link.destination_ipv4"],
|
|
133
146
|
// 目的IP
|
|
134
147
|
// source_id, // 源端口
|
|
135
148
|
// destination_id, // 目的端口
|
|
@@ -139,9 +152,9 @@ export default function EditLinkInfo(props) {
|
|
|
139
152
|
// 用途
|
|
140
153
|
// source_type, // 必须
|
|
141
154
|
// destination_type, // 必须
|
|
142
|
-
"network_link.source_device_id":
|
|
155
|
+
"network_link.source_device_id": sourceValue.id,
|
|
143
156
|
// 必须
|
|
144
|
-
"network_link.destination_device_id":
|
|
157
|
+
"network_link.destination_device_id": targetValue.id,
|
|
145
158
|
// 必须
|
|
146
159
|
"network_link.connect_type": typeJudge.connect,
|
|
147
160
|
// 必须
|
|
@@ -207,23 +220,23 @@ export default function EditLinkInfo(props) {
|
|
|
207
220
|
label: "\u6E90\u8282\u70B9\u540D\u79F0"
|
|
208
221
|
}), /*#__PURE__*/React.createElement("div", {
|
|
209
222
|
className: styles.label
|
|
210
|
-
},
|
|
223
|
+
}, sourceValue.name))), /*#__PURE__*/React.createElement(Col, {
|
|
211
224
|
span: "12"
|
|
212
225
|
}, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
|
|
213
226
|
labelAlign: labelAlign,
|
|
214
227
|
label: "\u76EE\u7684\u8282\u70B9\u540D\u79F0"
|
|
215
228
|
}), /*#__PURE__*/React.createElement("div", {
|
|
216
229
|
className: styles.label
|
|
217
|
-
},
|
|
230
|
+
}, targetValue.name)))), /*#__PURE__*/React.createElement(Row, {
|
|
218
231
|
gutter: "4"
|
|
219
232
|
}, /*#__PURE__*/React.createElement(Col, {
|
|
220
233
|
span: "12"
|
|
221
234
|
}, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
|
|
222
235
|
labelAlign: labelAlign,
|
|
223
236
|
label: "\u6E90\u8282\u70B9IP"
|
|
224
|
-
}),
|
|
237
|
+
}), sourceValue.ipAddress ? /*#__PURE__*/React.createElement("div", {
|
|
225
238
|
className: styles.label
|
|
226
|
-
},
|
|
239
|
+
}, sourceValue.ipAddress) : /*#__PURE__*/React.createElement(_Input, {
|
|
227
240
|
placeholder: "\u8BF7\u8F93\u5165",
|
|
228
241
|
name: "network_link.source_ipv4",
|
|
229
242
|
maxLength: 128
|
|
@@ -232,9 +245,9 @@ export default function EditLinkInfo(props) {
|
|
|
232
245
|
}, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
|
|
233
246
|
labelAlign: labelAlign,
|
|
234
247
|
label: "\u76EE\u7684\u8282\u70B9IP"
|
|
235
|
-
}),
|
|
248
|
+
}), targetValue.ipAddress ? /*#__PURE__*/React.createElement("div", {
|
|
236
249
|
className: styles.label
|
|
237
|
-
},
|
|
250
|
+
}, targetValue.ipAddress) : /*#__PURE__*/React.createElement(_Input, {
|
|
238
251
|
placeholder: "\u8BF7\u8F93\u5165",
|
|
239
252
|
name: "network_link.destination_ipv4",
|
|
240
253
|
maxLength: 128
|
|
@@ -247,11 +260,12 @@ export default function EditLinkInfo(props) {
|
|
|
247
260
|
label: "\u6E90\u7AEF\u53E3",
|
|
248
261
|
required: true,
|
|
249
262
|
requiredMessage: "\u6E90\u7AEF\u53E3\u4E0D\u80FD\u4E3A\u7A7A"
|
|
250
|
-
}),
|
|
263
|
+
}), sourceValue.ipAddress ? /*#__PURE__*/React.createElement(_Select, {
|
|
251
264
|
name: "source_id",
|
|
265
|
+
disabled: sourceValue.ports.length === 0,
|
|
252
266
|
className: styles.selectList,
|
|
253
267
|
onChange: portsHandleChange,
|
|
254
|
-
dataSource:
|
|
268
|
+
dataSource: sourceValue.ports
|
|
255
269
|
}) : "-")), /*#__PURE__*/React.createElement(Col, {
|
|
256
270
|
span: "12"
|
|
257
271
|
}, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
|
|
@@ -259,11 +273,12 @@ export default function EditLinkInfo(props) {
|
|
|
259
273
|
label: "\u76EE\u7684\u7AEF\u53E3",
|
|
260
274
|
required: true,
|
|
261
275
|
requiredMessage: "\u76EE\u7684\u7AEF\u53E3\u4E0D\u80FD\u4E3A\u7A7A"
|
|
262
|
-
}),
|
|
276
|
+
}), targetValue.ipAddress ? /*#__PURE__*/React.createElement(_Select, {
|
|
263
277
|
name: "destination_id",
|
|
278
|
+
disabled: targetValue.ports.length === 0,
|
|
264
279
|
className: styles.selectList,
|
|
265
280
|
onChange: portsHandleChange,
|
|
266
|
-
dataSource:
|
|
281
|
+
dataSource: targetValue.ports
|
|
267
282
|
}) : "-"))), /*#__PURE__*/React.createElement(Row, {
|
|
268
283
|
gutter: "4"
|
|
269
284
|
}, /*#__PURE__*/React.createElement(Col, {
|
|
@@ -273,14 +288,14 @@ export default function EditLinkInfo(props) {
|
|
|
273
288
|
label: "\u8D44\u6E90\u7C7B\u578B"
|
|
274
289
|
}), /*#__PURE__*/React.createElement("div", {
|
|
275
290
|
className: styles.label
|
|
276
|
-
},
|
|
291
|
+
}, sourceValue.ciName))), /*#__PURE__*/React.createElement(Col, {
|
|
277
292
|
span: "12"
|
|
278
293
|
}, /*#__PURE__*/React.createElement(FormItem, _extends({}, formItemLayout, {
|
|
279
294
|
labelAlign: labelAlign,
|
|
280
295
|
label: "\u8D44\u6E90\u7C7B\u578B"
|
|
281
296
|
}), /*#__PURE__*/React.createElement("div", {
|
|
282
297
|
className: styles.label
|
|
283
|
-
},
|
|
298
|
+
}, targetValue.ciName)))), /*#__PURE__*/React.createElement(Row, {
|
|
284
299
|
gutter: "4"
|
|
285
300
|
}, /*#__PURE__*/React.createElement(Col, {
|
|
286
301
|
span: "24"
|
|
@@ -330,7 +345,7 @@ export default function EditLinkInfo(props) {
|
|
|
330
345
|
className: styles.footer
|
|
331
346
|
}, /*#__PURE__*/React.createElement(_Button, {
|
|
332
347
|
className: styles.button,
|
|
333
|
-
disabled: !
|
|
348
|
+
disabled: !sourceValue.ipAddress,
|
|
334
349
|
type: "primary",
|
|
335
350
|
loading: loading,
|
|
336
351
|
onClick: saveHandleChange
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _Message from "@alifd/next/es/message";
|
|
3
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _Message from "@alifd/next/es/message";
|
|
4
4
|
import _Dialog from "@alifd/next/es/dialog";
|
|
5
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
|
7
7
|
import linkService from "../../services/link";
|
|
8
|
+
import { getLinkPermission } from "../../utils/linPermissionUtil";
|
|
8
9
|
/**
|
|
9
10
|
* 删除连线
|
|
10
11
|
*/
|
|
@@ -26,11 +27,24 @@ export default (function (_ref) {
|
|
|
26
27
|
});
|
|
27
28
|
};
|
|
28
29
|
|
|
30
|
+
function checkLinkDeleteable(link) {
|
|
31
|
+
var _getLinkPermission = getLinkPermission(link, topo.dataModel.getNodes()),
|
|
32
|
+
deleteable = _getLinkPermission.deleteable;
|
|
33
|
+
|
|
34
|
+
if (deleteable) {
|
|
35
|
+
return deleteable;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
_Message.notice('无删除权限');
|
|
39
|
+
|
|
40
|
+
return deleteable;
|
|
41
|
+
}
|
|
42
|
+
|
|
29
43
|
var deleteLink = function deleteLink(edge) {
|
|
30
44
|
var id = edge.getTag();
|
|
31
45
|
var link = topo.dataModel.getDataById(id);
|
|
32
46
|
|
|
33
|
-
if (!link
|
|
47
|
+
if (!checkLinkDeleteable(link)) {
|
|
34
48
|
return;
|
|
35
49
|
}
|
|
36
50
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获得链路权限
|
|
3
|
+
*
|
|
4
|
+
* @param {*} link
|
|
5
|
+
* @param {*} nodes
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export function getLinkPermission(link, nodes) {
|
|
9
|
+
var source = nodes.find(function (node) {
|
|
10
|
+
return node.id === link.source;
|
|
11
|
+
});
|
|
12
|
+
var target = nodes.find(function (node) {
|
|
13
|
+
return node.id === link.target;
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
readable: source.operation || target.operation,
|
|
17
|
+
writeable: [source, target].filter(function (node) {
|
|
18
|
+
return ['write', 'delete'].indexOf(node.operation) !== -1;
|
|
19
|
+
}).length === 2,
|
|
20
|
+
deleteable: [source, target].filter(function (node) {
|
|
21
|
+
return ['write', 'delete'].indexOf(node.operation) !== -1;
|
|
22
|
+
}).length >= 1
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -24,7 +24,10 @@ function LayerResourceList(props) {
|
|
|
24
24
|
var topo = props.topo,
|
|
25
25
|
layer = props.layer;
|
|
26
26
|
var nodes = (0, _htElementUtils.getLayerChildrenNodes)(layer);
|
|
27
|
-
var
|
|
27
|
+
var relateDataNodes = nodes.filter(function (node) {
|
|
28
|
+
return !!node.getTag();
|
|
29
|
+
});
|
|
30
|
+
var data = relateDataNodes.map(function (node) {
|
|
28
31
|
return {
|
|
29
32
|
title: node.a('name'),
|
|
30
33
|
img: (0, _icon.getIconById)(node.getImage(), topo)
|
|
@@ -46,7 +46,7 @@ var _edgeUtil = require("../utils/edgeUtil");
|
|
|
46
46
|
var _PluginManager = _interopRequireDefault(require("./PluginManager"));
|
|
47
47
|
|
|
48
48
|
// eslint-disable-next-line no-undef
|
|
49
|
-
var version = typeof "2.15.
|
|
49
|
+
var version = typeof "2.15.11" === 'string' ? "2.15.11" : null;
|
|
50
50
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
|
51
51
|
var topoDebug = {};
|
|
52
52
|
window.topoDebug = topoDebug;
|
|
@@ -13,12 +13,20 @@ var _LindInfoPreview = _interopRequireDefault(require("../../link/LindInfoPrevie
|
|
|
13
13
|
|
|
14
14
|
var _LindInfoPreviewModule = _interopRequireDefault(require("../../link/LindInfoPreview.module.scss"));
|
|
15
15
|
|
|
16
|
+
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
|
|
17
|
+
|
|
18
|
+
var _linPermissionUtil = require("../../../../../../utils/linPermissionUtil");
|
|
19
|
+
|
|
16
20
|
function LinkDataTab(props) {
|
|
17
21
|
var topo = props.topo,
|
|
18
22
|
edge = props.edge,
|
|
19
|
-
editorProps = props.editorProps;
|
|
20
|
-
|
|
21
|
-
var
|
|
23
|
+
editorProps = props.editorProps; // const operation = props.edge.a("operation");
|
|
24
|
+
|
|
25
|
+
var nodes = topo.dataModel.getNodes(); //rlog.debug("LinkDataTab--edge", edge, nodes);
|
|
26
|
+
// const disabled = ["delete", "write"].indexOf(operation) < 0;
|
|
27
|
+
|
|
28
|
+
var permission = (0, _linPermissionUtil.getLinkPermission)(edge.getAttrObject(), nodes); //rlog.debug("LinkDataTab--", permission);
|
|
29
|
+
// 节点间只有连线组时,显示连线组的数据
|
|
22
30
|
|
|
23
31
|
var _topo$store$useModelS = topo.store.useModelState("topoMod").data,
|
|
24
32
|
links = _topo$store$useModelS.links,
|
|
@@ -49,7 +57,7 @@ function LinkDataTab(props) {
|
|
|
49
57
|
}, /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
50
58
|
className: _LindInfoPreviewModule["default"].button,
|
|
51
59
|
type: "primary",
|
|
52
|
-
disabled:
|
|
60
|
+
disabled: !permission.writeable,
|
|
53
61
|
onClick: openEditLinkDrawer
|
|
54
62
|
}, "\u7F16\u8F91")));
|
|
55
63
|
}
|
|
@@ -278,7 +278,7 @@ function AddLinkDrawer(props) {
|
|
|
278
278
|
|
|
279
279
|
ciIds = [];
|
|
280
280
|
nodes.map(function (node) {
|
|
281
|
-
if (ciTypesConnectable[node.ciType]) {
|
|
281
|
+
if (ciTypesConnectable[node.ciType] && ["delete", "write"].indexOf(node.operation) >= 0) {
|
|
282
282
|
ciIds.push(node.id);
|
|
283
283
|
}
|
|
284
284
|
});
|
|
@@ -375,7 +375,7 @@ function AddLinkDrawer(props) {
|
|
|
375
375
|
} // 切换到连线组状态
|
|
376
376
|
|
|
377
377
|
|
|
378
|
-
htTopo.toggleEdgeGroup(source, target,
|
|
378
|
+
htTopo.toggleEdgeGroup(source, target, false);
|
|
379
379
|
} else {
|
|
380
380
|
// 物理、出口链路
|
|
381
381
|
if (edgesInNodes.length === 1 && !htTopo.getEdgeData(edgesInNodes[0])) {
|
|
@@ -384,7 +384,7 @@ function AddLinkDrawer(props) {
|
|
|
384
384
|
htTopo.createEdge(source, target, linkData);
|
|
385
385
|
}
|
|
386
386
|
|
|
387
|
-
htTopo.toggleEdgeGroup(source, target,
|
|
387
|
+
htTopo.toggleEdgeGroup(source, target, true);
|
|
388
388
|
} // TODO 选中
|
|
389
389
|
|
|
390
390
|
|
|
@@ -507,6 +507,7 @@ function AddLinkDrawer(props) {
|
|
|
507
507
|
lineData: link,
|
|
508
508
|
topo: topo,
|
|
509
509
|
onClose: closeDrawer,
|
|
510
|
+
addLinkIsOpen: addLinkIsOpen,
|
|
510
511
|
onSave: onSave,
|
|
511
512
|
loading: loading,
|
|
512
513
|
isAdd: isAddMode
|