@riil-frontend/component-topology 3.3.0 → 3.5.0-a.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/1.js +2 -2
- package/build/2.js +1 -1
- package/build/index.js +17 -17
- 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 +38 -1
- package/es/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +1 -1
- package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +29 -16
- package/es/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +0 -1
- 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/editor/components/titlebar/TopoEditorTitleBar.js +29 -1
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/utils/linkUtils.js +15 -16
- package/es/hooks/useTopoEdit.js +0 -5
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +12 -10
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +3 -4
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +94 -59
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +19 -15
- package/es/topoCenter/hooks/editor/useDeleteEdges.js +2 -0
- package/es/topoCenter/services/link.js +22 -14
- package/es/topoCenter/store/topoTreeMod.js +6 -19
- package/es/topoCenter/utils/linPermissionUtil.js +3 -4
- 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 +53 -2
- package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +2 -2
- package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +30 -15
- package/lib/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +0 -1
- 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/editor/components/titlebar/TopoEditorTitleBar.js +32 -1
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/utils/linkUtils.js +13 -14
- package/lib/hooks/useTopoEdit.js +0 -5
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +16 -12
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +3 -4
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +94 -59
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +17 -16
- package/lib/topoCenter/hooks/editor/useDeleteEdges.js +2 -0
- package/lib/topoCenter/services/link.js +22 -14
- package/lib/topoCenter/store/topoTreeMod.js +7 -20
- package/lib/topoCenter/utils/linPermissionUtil.js +3 -4
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import React, { useRef } from 'react';
|
|
4
|
-
import
|
|
4
|
+
import NetworkTopoResourceSelectDrawer from "../NetworkTopoResourceSelectDrawer";
|
|
5
5
|
|
|
6
6
|
var MultiResourceDrawer = function MultiResourceDrawer(props) {
|
|
7
7
|
var visible = props.visible,
|
|
@@ -42,7 +42,7 @@ var MultiResourceDrawer = function MultiResourceDrawer(props) {
|
|
|
42
42
|
};
|
|
43
43
|
}();
|
|
44
44
|
|
|
45
|
-
return /*#__PURE__*/React.createElement(
|
|
45
|
+
return /*#__PURE__*/React.createElement(NetworkTopoResourceSelectDrawer, {
|
|
46
46
|
visible: visible,
|
|
47
47
|
getExcludeIds: getExcludeIds,
|
|
48
48
|
onOk: onDrawerSave,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { getNetworkTopoCommonResListProps } from "../../constants/ResourceTypeLimit";
|
|
4
|
+
import ResourceSelectDrawer from "../ResourceSelectDrawer/ResourceSelectDrawer";
|
|
5
|
+
export default function NetworkTopoResourceSelectDrawer(props) {
|
|
6
|
+
return /*#__PURE__*/React.createElement(ResourceSelectDrawer, _extends({
|
|
7
|
+
commonResListProps: getNetworkTopoCommonResListProps()
|
|
8
|
+
}, props));
|
|
9
|
+
}
|
|
@@ -15,12 +15,14 @@ import styles from "./ResourceSelectDrawer.module.scss";
|
|
|
15
15
|
|
|
16
16
|
function ResourceSelectDrawer(props) {
|
|
17
17
|
var visible = props.visible,
|
|
18
|
+
title = props.title,
|
|
18
19
|
selectionMode = props.selectionMode,
|
|
19
20
|
limitTypes = props.limitTypes,
|
|
20
21
|
excludeIds = props.excludeIds,
|
|
21
22
|
getExcludeIds = props.getExcludeIds,
|
|
22
23
|
onOk = props.onOk,
|
|
23
|
-
onClose = props.onClose
|
|
24
|
+
onClose = props.onClose,
|
|
25
|
+
commonResListProps = props.commonResListProps;
|
|
24
26
|
var resourceSelectRef = useRef();
|
|
25
27
|
|
|
26
28
|
var _useState = useState(false),
|
|
@@ -84,7 +86,7 @@ function ResourceSelectDrawer(props) {
|
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
return /*#__PURE__*/React.createElement(Drawer, {
|
|
87
|
-
title:
|
|
89
|
+
title: title,
|
|
88
90
|
visible: visible,
|
|
89
91
|
loading: loading,
|
|
90
92
|
onSave: handleOk,
|
|
@@ -98,12 +100,14 @@ function ResourceSelectDrawer(props) {
|
|
|
98
100
|
ref: resourceSelectRef,
|
|
99
101
|
selectionMode: selectionMode,
|
|
100
102
|
limitTypes: limitTypes,
|
|
101
|
-
excludeIds: finalExcludeIds
|
|
103
|
+
excludeIds: finalExcludeIds,
|
|
104
|
+
commonResListProps: commonResListProps
|
|
102
105
|
}));
|
|
103
106
|
}
|
|
104
107
|
|
|
105
108
|
ResourceSelectDrawer.propTypes = {
|
|
106
109
|
visible: PropTypes.bool,
|
|
110
|
+
title: PropTypes.string,
|
|
107
111
|
limitTypes: PropTypes.array,
|
|
108
112
|
excludeIds: PropTypes.array,
|
|
109
113
|
selectionMode: PropTypes.any,
|
|
@@ -112,6 +116,7 @@ ResourceSelectDrawer.propTypes = {
|
|
|
112
116
|
};
|
|
113
117
|
ResourceSelectDrawer.defaultProps = {
|
|
114
118
|
visible: true,
|
|
119
|
+
title: '添加资源',
|
|
115
120
|
excludeIds: [],
|
|
116
121
|
onOk: function onOk() {},
|
|
117
122
|
onClose: function onClose() {}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
+
var _excluded = ["selectionMode", "limitTypes", "excludeIds", "commonResListProps"];
|
|
2
4
|
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
3
5
|
import { getRequest } from '@riil-frontend/component-topology-common';
|
|
4
6
|
import CommonResList from '@riil-frontend/component-common-res-list';
|
|
5
7
|
import NoDataPage from '@riil-frontend/component-no-data-page';
|
|
6
|
-
import {
|
|
8
|
+
import { filterCiTypes } from "../../constants/ResourceTypeLimit";
|
|
7
9
|
|
|
8
10
|
function ResourceSelectList(props, ref) {
|
|
9
11
|
var selectionMode = props.selectionMode,
|
|
10
12
|
limitTypes = props.limitTypes,
|
|
11
|
-
excludeIds = props.excludeIds
|
|
13
|
+
excludeIds = props.excludeIds,
|
|
14
|
+
commonResListProps = props.commonResListProps,
|
|
15
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
12
16
|
|
|
13
17
|
var tableProps = _extends({}, selectionMode ? {
|
|
14
18
|
rowSelection: {
|
|
@@ -18,17 +22,16 @@ function ResourceSelectList(props, ref) {
|
|
|
18
22
|
emptyContent: /*#__PURE__*/React.createElement(NoDataPage, null)
|
|
19
23
|
});
|
|
20
24
|
|
|
21
|
-
return /*#__PURE__*/React.createElement(CommonResList, {
|
|
25
|
+
return /*#__PURE__*/React.createElement(CommonResList, _extends({
|
|
22
26
|
ref: ref,
|
|
23
|
-
|
|
24
|
-
limitTypes: limitTypes || RESOURCE_LIMIT_TYPES,
|
|
27
|
+
limitTypes: limitTypes,
|
|
25
28
|
defaultCondition: excludeIds.length ? "!id('" + excludeIds.join('\',\'') + "')" : undefined,
|
|
26
29
|
request: getRequest(),
|
|
27
30
|
tableProps: tableProps,
|
|
28
31
|
paginationProps: {
|
|
29
32
|
type: 'simple'
|
|
30
33
|
}
|
|
31
|
-
});
|
|
34
|
+
}, otherProps, commonResListProps || {}));
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
export default /*#__PURE__*/React.forwardRef(ResourceSelectList);
|
|
@@ -2,7 +2,7 @@ import _Message from "@alifd/next/es/message";
|
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
import React, { useRef } from 'react';
|
|
5
|
-
import ResourceSelectDrawer from "../
|
|
5
|
+
import ResourceSelectDrawer from "../NetworkTopoResourceSelectDrawer";
|
|
6
6
|
|
|
7
7
|
var SingleSelectDrawer = function SingleSelectDrawer(props) {
|
|
8
8
|
var visible = props.visible,
|
|
@@ -1,4 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
var excludeTypes = ['data_center', 'manage_assets', 'network_link', 'access_link']; // 过滤模型树
|
|
3
|
+
|
|
4
|
+
export function filterModelTree(modelTree) {
|
|
5
|
+
return modelTree.filter(function (node) {
|
|
6
|
+
return !excludeTypes.includes(node.code);
|
|
7
|
+
}).map(function (node) {
|
|
8
|
+
return _extends({}, node, {
|
|
9
|
+
childs: filterModelTree(node.childs || []).filter(function (child) {
|
|
10
|
+
return child.monitorable;
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export function getCiModels(modelTree) {
|
|
16
|
+
var list = [];
|
|
17
|
+
filterModelTree(modelTree).forEach(function (domainModel) {
|
|
18
|
+
list.push.apply(list, domainModel.childs);
|
|
19
|
+
});
|
|
20
|
+
return list;
|
|
21
|
+
} // 资源选择组件过滤类型
|
|
22
|
+
|
|
23
|
+
export var filterCiTypes = function filterCiTypes(tree) {
|
|
24
|
+
return tree.filter(function (node) {
|
|
25
|
+
return !excludeTypes.includes(node.value);
|
|
26
|
+
}).map(function (node) {
|
|
27
|
+
return _extends({}, node, {
|
|
28
|
+
children: filterCiTypes(node.children || [])
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
export var getNetworkTopoCommonResListProps = function getNetworkTopoCommonResListProps() {
|
|
33
|
+
return {
|
|
34
|
+
innerTreeFilters: ['monitorable', 'discoverable'],
|
|
35
|
+
filterCiRes: filterCiTypes
|
|
36
|
+
};
|
|
37
|
+
}; // 拓扑中心资源类型限制
|
|
38
|
+
|
|
2
39
|
export var RESOURCE_LIMIT_TYPES = [// 网络设备
|
|
3
40
|
'common_network', 'switch', 'switch_cluster', 'router', // 操作系统
|
|
4
41
|
'linux', 'windows', // 数据库
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import React, { useState, useEffect } from 'react';
|
|
4
|
-
import ResourceSelectDrawer from "../../../../components/
|
|
4
|
+
import ResourceSelectDrawer from "../../../../components/NetworkTopoResourceSelectDrawer";
|
|
5
5
|
|
|
6
6
|
var GroupAddResourceDrawer = function GroupAddResourceDrawer(props) {
|
|
7
7
|
var group = props.group,
|
|
@@ -40,7 +40,7 @@ export default function CommonEdgePropertyView(props) {
|
|
|
40
40
|
|
|
41
41
|
var getLinkByNodes = /*#__PURE__*/function () {
|
|
42
42
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(id) {
|
|
43
|
-
var result;
|
|
43
|
+
var result, hasLinkIds, axlink;
|
|
44
44
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
45
45
|
while (1) {
|
|
46
46
|
switch (_context.prev = _context.next) {
|
|
@@ -50,11 +50,19 @@ export default function CommonEdgePropertyView(props) {
|
|
|
50
50
|
|
|
51
51
|
case 2:
|
|
52
52
|
result = _context.sent;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
hasLinkIds = topo.getLines().map(function (line) {
|
|
54
|
+
return line.id;
|
|
55
|
+
});
|
|
56
|
+
axlink = [];
|
|
57
|
+
result.data.map(function (exLink) {
|
|
58
|
+
if (hasLinkIds.indexOf(exLink.id) < 0) {
|
|
59
|
+
axlink.push(exLink);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
rlog.debug("出口链路列表", result.data, axlink);
|
|
63
|
+
setAssociatedlinks(axlink);
|
|
64
|
+
|
|
65
|
+
case 8:
|
|
58
66
|
case "end":
|
|
59
67
|
return _context.stop();
|
|
60
68
|
}
|
|
@@ -71,6 +79,7 @@ export default function CommonEdgePropertyView(props) {
|
|
|
71
79
|
autoUnmount: false,
|
|
72
80
|
values: parseValues(values, edge),
|
|
73
81
|
onChange: function onChange(name, value) {
|
|
82
|
+
rlog.debug("CommonEdgePropertyView", name, value);
|
|
74
83
|
var newValues = field.getValues();
|
|
75
84
|
|
|
76
85
|
_onChange(name, value, newValues);
|
|
@@ -95,14 +104,17 @@ export default function CommonEdgePropertyView(props) {
|
|
|
95
104
|
};
|
|
96
105
|
|
|
97
106
|
var bindExitLink = /*#__PURE__*/function () {
|
|
98
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(
|
|
99
|
-
var exitLink, aobj, config, exconfig, exportLinkIdList, _yield$editDispatcher, elements;
|
|
107
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(value) {
|
|
108
|
+
var data, exitLink, aobj, config, exconfig, exportLinkIdList, _yield$editDispatcher, elements;
|
|
100
109
|
|
|
101
110
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
102
111
|
while (1) {
|
|
103
112
|
switch (_context2.prev = _context2.next) {
|
|
104
113
|
case 0:
|
|
105
|
-
|
|
114
|
+
data = associatedlinks.find(function (link) {
|
|
115
|
+
return link.id === value;
|
|
116
|
+
});
|
|
117
|
+
rlog.debug("bindExitLink--- v, edge", data, edge);
|
|
106
118
|
exitLink = {
|
|
107
119
|
attributes: [],
|
|
108
120
|
ciType: "network_link",
|
|
@@ -131,15 +143,15 @@ export default function CommonEdgePropertyView(props) {
|
|
|
131
143
|
topo.resourceConfig.updateConfig(_extends({}, config, {
|
|
132
144
|
exportLinkIdList: exportLinkIdList
|
|
133
145
|
}));
|
|
134
|
-
_context2.next =
|
|
146
|
+
_context2.next = 14;
|
|
135
147
|
return editDispatchers.fetchDataByConfig();
|
|
136
148
|
|
|
137
|
-
case
|
|
149
|
+
case 14:
|
|
138
150
|
_yield$editDispatcher = _context2.sent;
|
|
139
151
|
elements = _yield$editDispatcher.elements;
|
|
140
|
-
rlog.debug(
|
|
152
|
+
rlog.debug("fetchDataByConfig", elements);
|
|
141
153
|
|
|
142
|
-
case
|
|
154
|
+
case 17:
|
|
143
155
|
case "end":
|
|
144
156
|
return _context2.stop();
|
|
145
157
|
}
|
|
@@ -212,13 +224,14 @@ export default function CommonEdgePropertyView(props) {
|
|
|
212
224
|
style: {
|
|
213
225
|
width: 232
|
|
214
226
|
},
|
|
227
|
+
disabled: associatedlinks.length < 1,
|
|
215
228
|
onChange: function onChange(v) {
|
|
216
229
|
bindExitLink(v);
|
|
217
230
|
}
|
|
218
|
-
}, associatedlinks.map(function (
|
|
231
|
+
}, associatedlinks.map(function (item, index) {
|
|
219
232
|
return /*#__PURE__*/React.createElement(_Select.Option, {
|
|
220
|
-
value:
|
|
233
|
+
value: item.id,
|
|
221
234
|
key: index
|
|
222
|
-
},
|
|
235
|
+
}, item.attributes.display_name);
|
|
223
236
|
}))))))));
|
|
224
237
|
}
|
|
@@ -15,10 +15,6 @@ var propertyPanelMap = {
|
|
|
15
15
|
multiple: MultipleElementPropertyView
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
if (localStorage.getItem('topo.debug') === 'true') {
|
|
19
|
-
Object.assign(propertyPanelMap, {
|
|
20
|
-
view: ViewPropertyView
|
|
21
|
-
});
|
|
22
|
-
}
|
|
18
|
+
if (localStorage.getItem('topo.debug') === 'true') {}
|
|
23
19
|
|
|
24
20
|
export default propertyPanelMap;
|
package/es/core/editor/components/settings/propertyViews/layer/DataTab/LayerAddResourceDrawer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import React, { useState, useEffect } from 'react';
|
|
4
|
-
import ResourceSelectDrawer from "../../../../../../../components/
|
|
4
|
+
import ResourceSelectDrawer from "../../../../../../../components/NetworkTopoResourceSelectDrawer";
|
|
5
5
|
|
|
6
6
|
var LayerAddResourceDrawer = function LayerAddResourceDrawer(props) {
|
|
7
7
|
var visible = props.visible,
|
|
@@ -2,7 +2,7 @@ import _Message from "@alifd/next/es/message";
|
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
import React, { useState, useEffect } from 'react';
|
|
5
|
-
import ResourceSelectDrawer from "../../../../../../../components/
|
|
5
|
+
import ResourceSelectDrawer from "../../../../../../../components/NetworkTopoResourceSelectDrawer";
|
|
6
6
|
/**
|
|
7
7
|
* 关联、重新关联资源
|
|
8
8
|
* @param props
|
|
@@ -60,6 +60,7 @@ var BindResourceDrawer = function BindResourceDrawer(props) {
|
|
|
60
60
|
|
|
61
61
|
return /*#__PURE__*/React.createElement(ResourceSelectDrawer, {
|
|
62
62
|
visible: visible,
|
|
63
|
+
title: "\u5173\u8054\u8D44\u6E90",
|
|
63
64
|
getExcludeIds: topoEditApi.getAllNodeResourceIds,
|
|
64
65
|
selectionMode: "single",
|
|
65
66
|
onOk: handleSave,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import _Box from "@alifd/next/es/box";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _Dialog from "@alifd/next/es/dialog";
|
|
2
4
|
import _Button from "@alifd/next/es/button";
|
|
5
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
6
|
import React from "react";
|
|
4
7
|
import classnames from "classnames";
|
|
5
8
|
import TitleWidget from "../../../components/titlebar/widgets/TitleWidget";
|
|
@@ -32,7 +35,32 @@ export default function TopoEditorTitleBar(props) {
|
|
|
32
35
|
}, "\u4FDD\u5B58"), /*#__PURE__*/React.createElement(_Button, {
|
|
33
36
|
className: styles.button,
|
|
34
37
|
onClick: function onClick() {
|
|
35
|
-
|
|
38
|
+
_Dialog.confirm({
|
|
39
|
+
title: "提示",
|
|
40
|
+
content: "若现在退出,图上修改的内容将不会保存!",
|
|
41
|
+
onOk: function () {
|
|
42
|
+
var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
43
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
44
|
+
while (1) {
|
|
45
|
+
switch (_context.prev = _context.next) {
|
|
46
|
+
case 0:
|
|
47
|
+
topo.exitEditMode();
|
|
48
|
+
|
|
49
|
+
case 1:
|
|
50
|
+
case "end":
|
|
51
|
+
return _context.stop();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, _callee);
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
function onOk() {
|
|
58
|
+
return _onOk.apply(this, arguments);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return onOk;
|
|
62
|
+
}()
|
|
63
|
+
});
|
|
36
64
|
}
|
|
37
65
|
}, "\u9000\u51FA"))));
|
|
38
66
|
}
|
|
@@ -20,7 +20,7 @@ import { updateEdgeExpanded } from "../utils/edgeUtil";
|
|
|
20
20
|
import PluginManager from "./PluginManager";
|
|
21
21
|
import topoFactory from "./topoFactory"; // eslint-disable-next-line no-undef
|
|
22
22
|
|
|
23
|
-
var version = typeof "3.
|
|
23
|
+
var version = typeof "3.5.0-a.1" === 'string' ? "3.5.0-a.1" : null;
|
|
24
24
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
|
25
25
|
/**
|
|
26
26
|
* 拓扑显示和编辑
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
-
import topoService from
|
|
5
|
-
import keyBy from
|
|
4
|
+
import topoService from "@riil-frontend/component-topology-common/es/services/topo";
|
|
5
|
+
import keyBy from "lodash/keyBy";
|
|
6
6
|
import { queryCisByIds } from "../../services";
|
|
7
7
|
var interfaceTypeMap = {
|
|
8
|
-
|
|
9
|
-
displayName:
|
|
8
|
+
"network.interface": {
|
|
9
|
+
displayName: "网络接口"
|
|
10
10
|
},
|
|
11
|
-
|
|
12
|
-
displayName:
|
|
11
|
+
"network.agg_interface": {
|
|
12
|
+
displayName: "聚合接口"
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
export function isAggLink(link) {
|
|
16
|
-
return link.attributes[
|
|
16
|
+
return link.attributes["network_link.connect_type"] === "agg";
|
|
17
17
|
}
|
|
18
18
|
export function mergeLinksData(links, linkCis, nodes, interfaceCis) {
|
|
19
|
-
var linkCiMap = keyBy(linkCis,
|
|
19
|
+
var linkCiMap = keyBy(linkCis, "id");
|
|
20
20
|
return links.map(function (link) {
|
|
21
21
|
var _nodes$find, _nodes$find2, _interfaceCis$find, _interfaceCis$find2;
|
|
22
22
|
|
|
23
23
|
var linkCi = linkCiMap[link.id];
|
|
24
24
|
|
|
25
|
-
var attributes = _extends({}, linkCi === null || linkCi === void 0 ? void 0 : linkCi.attributes);
|
|
25
|
+
var attributes = _extends({}, linkCi === null || linkCi === void 0 ? void 0 : linkCi.attributes); // 翻译
|
|
26
26
|
|
|
27
|
-
console.log('mergeLinksData', link, attributes); // 翻译
|
|
28
27
|
|
|
29
28
|
return _extends({}, link, {
|
|
30
29
|
id: linkCi.id,
|
|
@@ -32,14 +31,14 @@ export function mergeLinksData(links, linkCis, nodes, interfaceCis) {
|
|
|
32
31
|
name: linkCi === null || linkCi === void 0 ? void 0 : linkCi.attributes.name,
|
|
33
32
|
attributes: _extends({}, attributes, {
|
|
34
33
|
// 源/目的设备
|
|
35
|
-
|
|
34
|
+
"network_link.source_device_id_object": {
|
|
36
35
|
displayName: (_nodes$find = nodes.find(function (node) {
|
|
37
|
-
return node.id === attributes[
|
|
36
|
+
return node.id === attributes["network_link.source_device_id"];
|
|
38
37
|
})) === null || _nodes$find === void 0 ? void 0 : _nodes$find.name
|
|
39
38
|
},
|
|
40
|
-
|
|
39
|
+
"network_link.destination_device_id_object": {
|
|
41
40
|
displayName: (_nodes$find2 = nodes.find(function (node) {
|
|
42
|
-
return node.id === attributes[
|
|
41
|
+
return node.id === attributes["network_link.destination_device_id"];
|
|
43
42
|
})) === null || _nodes$find2 === void 0 ? void 0 : _nodes$find2.name
|
|
44
43
|
},
|
|
45
44
|
// 源/目的接口类型
|
|
@@ -49,12 +48,12 @@ export function mergeLinksData(links, linkCis, nodes, interfaceCis) {
|
|
|
49
48
|
source_id_object: {
|
|
50
49
|
displayName: (_interfaceCis$find = interfaceCis.find(function (node) {
|
|
51
50
|
return node.id === attributes.source_id;
|
|
52
|
-
})) === null || _interfaceCis$find === void 0 ? void 0 : _interfaceCis$find.attributes[
|
|
51
|
+
})) === null || _interfaceCis$find === void 0 ? void 0 : _interfaceCis$find.attributes["display_name"]
|
|
53
52
|
},
|
|
54
53
|
destination_id_object: {
|
|
55
54
|
displayName: (_interfaceCis$find2 = interfaceCis.find(function (node) {
|
|
56
55
|
return node.id === attributes.destination_id;
|
|
57
|
-
})) === null || _interfaceCis$find2 === void 0 ? void 0 : _interfaceCis$find2.attributes[
|
|
56
|
+
})) === null || _interfaceCis$find2 === void 0 ? void 0 : _interfaceCis$find2.attributes["display_name"]
|
|
58
57
|
}
|
|
59
58
|
})
|
|
60
59
|
});
|
package/es/hooks/useTopoEdit.js
CHANGED
|
@@ -335,11 +335,6 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
335
335
|
case 'link':
|
|
336
336
|
if (onLineDelete) {
|
|
337
337
|
onLineDelete(data);
|
|
338
|
-
} // 临时放这里,仅拓扑中心有
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
if (topo.linkDynamicStyleExecutor) {
|
|
342
|
-
topo.linkDynamicStyleExecutor.execute();
|
|
343
338
|
}
|
|
344
339
|
|
|
345
340
|
break;
|
|
@@ -4,31 +4,33 @@ import LindInfoPreview from "../../link/LinkInfoPreview";
|
|
|
4
4
|
import styles from "../../link/LinkInfoPreview.module.scss";
|
|
5
5
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
6
6
|
import { getLinkPermission } from "../../../../../../utils/linPermissionUtil";
|
|
7
|
+
import { useState, useEffect } from "react";
|
|
7
8
|
export default function LinkDataTab(props) {
|
|
8
9
|
var topo = props.topo,
|
|
9
|
-
edge = props.edge
|
|
10
|
-
|
|
10
|
+
edge = props.edge;
|
|
11
|
+
var nodes = topo.dataModel.getNodes();
|
|
12
|
+
|
|
13
|
+
var _useState = useState(),
|
|
14
|
+
link = _useState[0],
|
|
15
|
+
setLink = _useState[1]; // 节点间只有连线组时,显示连线组的数据
|
|
11
16
|
|
|
12
|
-
var nodes = topo.dataModel.getNodes(); //rlog.debug("LinkDataTab--edge", edge, nodes);
|
|
13
|
-
// const disabled = ["delete", "write"].indexOf(operation) < 0;
|
|
14
|
-
//rlog.debug("LinkDataTab--", permission);
|
|
15
|
-
// 节点间只有连线组时,显示连线组的数据
|
|
16
17
|
|
|
17
18
|
var _topo$store$useModelS = topo.store.useModelState("topoMod").data,
|
|
18
19
|
links = _topo$store$useModelS.links,
|
|
19
20
|
linkGroups = _topo$store$useModelS.linkGroups;
|
|
20
|
-
var
|
|
21
|
+
var linkData = [].concat(links, linkGroups).find(function (item) {
|
|
21
22
|
return item.id === edge.getTag();
|
|
22
23
|
});
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
useEffect(function () {
|
|
25
|
+
setLink(linkData);
|
|
26
|
+
}, [edge, linkData]);
|
|
27
|
+
var permission = getLinkPermission(edge, nodes, link);
|
|
25
28
|
|
|
26
29
|
var _topo$store$useModel = topo.store.useModel("topoConfig"),
|
|
27
30
|
editState = _topo$store$useModel[0],
|
|
28
31
|
editDispatchers = _topo$store$useModel[1];
|
|
29
32
|
|
|
30
33
|
var openEditLinkDrawer = function openEditLinkDrawer() {
|
|
31
|
-
rlog.debug("openEditLinkDrawer-link", link);
|
|
32
34
|
editDispatchers.update({
|
|
33
35
|
addLinkIsOpen: true,
|
|
34
36
|
currentLink: link
|
package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js
CHANGED
|
@@ -6,18 +6,17 @@ import Setting from "./Setting";
|
|
|
6
6
|
import { getLinkPermission } from "../../../../../../topoCenter/utils/linPermissionUtil.js";
|
|
7
7
|
import { getNodes } from "../../../../../../utils/htElementUtils.js";
|
|
8
8
|
export default function LinkPropertyView(props) {
|
|
9
|
-
console.log("LinkPropertyView", props);
|
|
10
9
|
var edge = props.edge,
|
|
11
10
|
topo = props.topo; // 无权限不显示数据页签
|
|
12
|
-
// const operation = props.edge.a('operation');
|
|
13
11
|
|
|
14
12
|
var _topo$store$useModelS = topo.store.useModelState("topoMod").data,
|
|
15
13
|
links = _topo$store$useModelS.links,
|
|
16
14
|
linkGroups = _topo$store$useModelS.linkGroups;
|
|
17
15
|
var link = [].concat(links, linkGroups).find(function (item) {
|
|
18
16
|
return item.id === edge.getTag();
|
|
19
|
-
});
|
|
20
|
-
|
|
17
|
+
}); // console.log("LinkPropertyView--getLinkPermission", links, link);
|
|
18
|
+
|
|
19
|
+
var operation = getLinkPermission(edge, topo.getNodes(topo.dataModel), link);
|
|
21
20
|
|
|
22
21
|
if (!operation) {
|
|
23
22
|
return /*#__PURE__*/React.createElement(Setting, props);
|