@riil-frontend/component-topology 12.1.0-dev.9 → 13.0.0-dev.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/index.css +1 -1
- package/build/index.js +2 -2
- package/es/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +11 -3
- package/es/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +2 -2
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +15 -5
- package/es/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +27 -2
- package/es/core/editor/components/Toolbar/widgets/FontSizeWidget.js +28 -3
- package/es/core/editor/components/Toolbar/widgets/FontStyleButton.js +52 -6
- package/es/core/editor/utils/edgeTypeStyleUtil.js +32 -11
- package/es/core/hooks/useTopoEdit.js +4 -0
- package/es/core/models/TopoApp.js +31 -23
- package/es/core/models/utils/linkUtils.js +28 -36
- package/es/core/utils/edgeUtil.js +1 -2
- package/es/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js +2 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +1 -1
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.module.scss +1 -1
- package/es/networkTopo/models/EdgeGroupTagTipBuilder.js +7 -7
- package/es/networkTopo/utils/edgeGroupTagUtil.js +2 -2
- package/es/utils/htElementUtils.js +4 -36
- package/lib/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +12 -3
- package/lib/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +2 -2
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +14 -5
- package/lib/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +28 -3
- package/lib/core/editor/components/Toolbar/widgets/FontSizeWidget.js +28 -3
- package/lib/core/editor/components/Toolbar/widgets/FontStyleButton.js +56 -6
- package/lib/core/editor/utils/edgeTypeStyleUtil.js +33 -10
- package/lib/core/hooks/useTopoEdit.js +4 -0
- package/lib/core/models/TopoApp.js +29 -22
- package/lib/core/models/utils/linkUtils.js +27 -36
- package/lib/core/utils/edgeUtil.js +1 -3
- package/lib/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js +2 -3
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +1 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopo.module.scss +1 -1
- package/lib/networkTopo/models/EdgeGroupTagTipBuilder.js +6 -6
- package/lib/networkTopo/utils/edgeGroupTagUtil.js +2 -2
- package/lib/utils/htElementUtils.js +4 -40
- package/package.json +2 -2
- package/es/core/editor/components/Toolbar/widgets/components/FontFamilySelect.js +0 -29
- package/es/core/editor/components/Toolbar/widgets/components/FontSizeSelect.js +0 -29
- package/es/core/editor/components/Toolbar/widgets/components/FontStyleSelect.js +0 -71
- package/lib/core/editor/components/Toolbar/widgets/components/FontFamilySelect.js +0 -38
- package/lib/core/editor/components/Toolbar/widgets/components/FontSizeSelect.js +0 -38
- package/lib/core/editor/components/Toolbar/widgets/components/FontStyleSelect.js +0 -83
@@ -115,14 +115,8 @@ export function getNodeData(element) {
|
|
115
115
|
export function getEdges(dataModel) {
|
116
116
|
return getElements(dataModel).filter(isValidEdge);
|
117
117
|
}
|
118
|
-
|
119
|
-
|
120
|
-
* @param {ht.Edge} edge
|
121
|
-
* @returns
|
122
|
-
*/
|
123
|
-
|
124
|
-
export function isEdgeGroup(edge) {
|
125
|
-
return isEdge(edge) && edge.a('x.edgegroup.isEdgeGroup');
|
118
|
+
export function isEdgeGroupExpanded(edge) {
|
119
|
+
return isEdge(edge) && edge.getEdgeGroup() && !!edge.s("edge.expanded");
|
126
120
|
}
|
127
121
|
/**
|
128
122
|
* 是否连线组代理
|
@@ -131,19 +125,7 @@ export function isEdgeGroup(edge) {
|
|
131
125
|
*/
|
132
126
|
|
133
127
|
export function isEdgeGroupAgent(edge) {
|
134
|
-
return
|
135
|
-
}
|
136
|
-
/**
|
137
|
-
* TODO
|
138
|
-
* @param {*} edge
|
139
|
-
* @returns
|
140
|
-
*/
|
141
|
-
|
142
|
-
export function isEdgeGroupExpanded(edge) {
|
143
|
-
return isEdge(edge) && edge.getEdgeGroup() && !!edge.s("edge.expanded");
|
144
|
-
}
|
145
|
-
export function isEdgeVisible(edge) {
|
146
|
-
return edge.s('2d.visible') || edge.s('2d.visible') === undefined;
|
128
|
+
return isEdge(edge) && edge.getEdgeGroup() && edge.isEdgeGroupAgent();
|
147
129
|
}
|
148
130
|
/**
|
149
131
|
* 获得两个节点间的连线列表
|
@@ -209,12 +191,6 @@ export function getEdgeGroupByNodeTags(dataModel, nodeTag1, nodeTag2) {
|
|
209
191
|
|
210
192
|
return getEdgeGroupByNodes(node1, node2);
|
211
193
|
}
|
212
|
-
/**
|
213
|
-
* 获得连线组连线列表
|
214
|
-
* @param {*} dataModel
|
215
|
-
* @returns
|
216
|
-
*/
|
217
|
-
|
218
194
|
export function getEdgeGroups(dataModel) {
|
219
195
|
var edgeGroups = [];
|
220
196
|
getEdges(dataModel).forEach(function (edge) {
|
@@ -226,19 +202,11 @@ export function getEdgeGroups(dataModel) {
|
|
226
202
|
});
|
227
203
|
return edgeGroups;
|
228
204
|
}
|
229
|
-
/**
|
230
|
-
* 获得连线组连线列表
|
231
|
-
* @param {*} dataModel
|
232
|
-
* @returns
|
233
|
-
*/
|
234
|
-
|
235
205
|
export function getEdgeGroupAgents(dataModel) {
|
236
206
|
return getEdges(dataModel).filter(isEdgeGroupAgent);
|
237
207
|
}
|
238
208
|
export function getEdgeDatas(dataModel) {
|
239
|
-
return getEdges(dataModel).
|
240
|
-
return !isEdgeGroup(edge);
|
241
|
-
}).map(function (element) {
|
209
|
+
return getEdges(dataModel).map(function (element) {
|
242
210
|
var _element$getSource, _element$getTarget;
|
243
211
|
|
244
212
|
return _extends({}, element.getAttrObject(), {
|
@@ -17,6 +17,8 @@ var _icon = _interopRequireDefault(require("@alifd/next/lib/icon"));
|
|
17
17
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
19
19
|
|
20
|
+
var _componentNoDataPage = _interopRequireDefault(require("@riil-frontend/component-no-data-page"));
|
21
|
+
|
20
22
|
var _Collapse = _interopRequireDefault(require("../../../../../../components/collapse/Collapse"));
|
21
23
|
|
22
24
|
var _CiTypeImagePanel = _interopRequireDefault(require("./CiTypeImagePanel"));
|
@@ -130,12 +132,16 @@ function ImagePanel(props) {
|
|
130
132
|
}].filter(function (panel) {
|
131
133
|
return !panel.hidden;
|
132
134
|
});
|
135
|
+
|
136
|
+
if (!panels.length) {
|
137
|
+
return /*#__PURE__*/_react["default"].createElement(_componentNoDataPage["default"], null);
|
138
|
+
}
|
139
|
+
|
133
140
|
return /*#__PURE__*/_react["default"].createElement(_Collapse["default"], {
|
134
141
|
accordion: true,
|
135
142
|
defaultExpandedKeys: ['资源图片'],
|
136
143
|
style: {
|
137
|
-
border: 'none'
|
138
|
-
minWidth: '300px'
|
144
|
+
border: 'none'
|
139
145
|
},
|
140
146
|
fullheight: true,
|
141
147
|
noContentPadding: true
|
@@ -164,6 +170,9 @@ function ImagePanel(props) {
|
|
164
170
|
width: '100%'
|
165
171
|
}
|
166
172
|
})), /*#__PURE__*/_react["default"].createElement(_box["default"], {
|
167
|
-
flex: 1
|
173
|
+
flex: 1,
|
174
|
+
style: {
|
175
|
+
minWidth: '300px'
|
176
|
+
}
|
168
177
|
}, renderImageContent()));
|
169
178
|
}
|
@@ -53,14 +53,14 @@ function EdgeColorButton(props) {
|
|
53
53
|
});
|
54
54
|
};
|
55
55
|
|
56
|
-
var
|
56
|
+
var getLines = function getLines(list) {
|
57
57
|
return list.filter(_edgeUtil.isCustomEdge);
|
58
58
|
};
|
59
59
|
|
60
60
|
(0, _react.useEffect)(function () {
|
61
61
|
if (graphLoaded) {
|
62
62
|
var edges = (0, _edgeTypeStyleUtil.getEdgesBySelection)(topo);
|
63
|
-
var list =
|
63
|
+
var list = getLines(edges);
|
64
64
|
setLineWidth(1); // eslint-disable-next-line eqeqeq
|
65
65
|
|
66
66
|
if (selection.length == 1 && list.length === 1) {
|
@@ -48,11 +48,20 @@ var LINE_TYPE_OPTIONS = [{
|
|
48
48
|
value: 'doublearc',
|
49
49
|
label: '双弧线',
|
50
50
|
icon: 'topo_linear_icon_arcline'
|
51
|
-
}
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
}
|
51
|
+
} // {
|
52
|
+
// value: 'points',
|
53
|
+
// label: '自由线形',
|
54
|
+
// icon: 'topo_linear_icon_pointsline',
|
55
|
+
// },
|
56
|
+
];
|
57
|
+
|
58
|
+
if (localStorage.getItem('topo.test.edge.customType') === 'true') {
|
59
|
+
LINE_TYPE_OPTIONS.push({
|
60
|
+
value: 'points',
|
61
|
+
label: '自由线形',
|
62
|
+
icon: 'topo_linear_icon_pointsline'
|
63
|
+
});
|
64
|
+
}
|
56
65
|
|
57
66
|
var LineType = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
58
67
|
var value = props.value,
|
@@ -7,9 +7,9 @@ exports["default"] = void 0;
|
|
7
7
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
9
9
|
|
10
|
-
var
|
10
|
+
var _DropdownMenu = _interopRequireDefault(require("./components/DropdownMenu"));
|
11
11
|
|
12
|
-
var _textStyleSettingRouter = _interopRequireDefault(require("./components/textStyleSetting/textStyleSettingRouter"));
|
12
|
+
var _textStyleSettingRouter = _interopRequireDefault(require("./components/textStyleSetting/textStyleSettingRouter.js"));
|
13
13
|
|
14
14
|
var _WidgetBox = _interopRequireDefault(require("./WidgetBox"));
|
15
15
|
|
@@ -17,6 +17,31 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
17
17
|
|
18
18
|
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; }
|
19
19
|
|
20
|
+
function FontFamilySelect(props) {
|
21
|
+
var value = props.value,
|
22
|
+
onChange = props.onChange;
|
23
|
+
var items = ['宋体', '微软雅黑', '黑体', 'Arial'];
|
24
|
+
return /*#__PURE__*/_react["default"].createElement(_DropdownMenu["default"], {
|
25
|
+
value: (items.includes(value) ? value : null) || '',
|
26
|
+
valueRender: function valueRender(val) {
|
27
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
28
|
+
style: {
|
29
|
+
width: 48
|
30
|
+
}
|
31
|
+
}, val || '微软雅黑');
|
32
|
+
},
|
33
|
+
onSelect: onChange
|
34
|
+
}, items.map(function (item) {
|
35
|
+
return /*#__PURE__*/_react["default"].createElement(_DropdownMenu["default"].Item, {
|
36
|
+
key: item
|
37
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
38
|
+
style: {
|
39
|
+
fontFamily: item
|
40
|
+
}
|
41
|
+
}, item));
|
42
|
+
}));
|
43
|
+
}
|
44
|
+
|
20
45
|
function FontFamilyWidget(props) {
|
21
46
|
var topo = props.topo,
|
22
47
|
showLabel = props.showLabel,
|
@@ -26,7 +51,7 @@ function FontFamilyWidget(props) {
|
|
26
51
|
label: "\u5B57\u4F53",
|
27
52
|
tooltip: "\u5B57\u4F53",
|
28
53
|
showLabel: showLabel
|
29
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
54
|
+
}, /*#__PURE__*/_react["default"].createElement(FontFamilySelect, {
|
30
55
|
value: style.fontFamily,
|
31
56
|
onChange: function onChange(val) {
|
32
57
|
topo.historyManager.beginTransaction();
|
@@ -7,9 +7,9 @@ exports["default"] = void 0;
|
|
7
7
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
9
9
|
|
10
|
-
var
|
10
|
+
var _DropdownMenu = _interopRequireDefault(require("./components/DropdownMenu"));
|
11
11
|
|
12
|
-
var _textStyleSettingRouter = _interopRequireDefault(require("./components/textStyleSetting/textStyleSettingRouter"));
|
12
|
+
var _textStyleSettingRouter = _interopRequireDefault(require("./components/textStyleSetting/textStyleSettingRouter.js"));
|
13
13
|
|
14
14
|
var _WidgetBox = _interopRequireDefault(require("./WidgetBox"));
|
15
15
|
|
@@ -17,6 +17,31 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
17
17
|
|
18
18
|
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; }
|
19
19
|
|
20
|
+
function FontSizeSelect(props) {
|
21
|
+
var value = props.value,
|
22
|
+
disabled = props.disabled,
|
23
|
+
onChange = props.onChange;
|
24
|
+
var items = [12, 14, 16, 18, 20, 24, 30, 36, 48, 60, 80];
|
25
|
+
return /*#__PURE__*/_react["default"].createElement(_DropdownMenu["default"], {
|
26
|
+
value: "" + (value || ''),
|
27
|
+
valueRender: function valueRender(val) {
|
28
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
29
|
+
style: {
|
30
|
+
width: 18
|
31
|
+
}
|
32
|
+
}, val || 20);
|
33
|
+
},
|
34
|
+
disabled: disabled,
|
35
|
+
onSelect: function onSelect(val) {
|
36
|
+
return onChange(parseInt(val, 10));
|
37
|
+
}
|
38
|
+
}, items.map(function (item) {
|
39
|
+
return /*#__PURE__*/_react["default"].createElement(_DropdownMenu["default"].Item, {
|
40
|
+
key: item
|
41
|
+
}, item);
|
42
|
+
}));
|
43
|
+
}
|
44
|
+
|
20
45
|
function FontSizeWidget(props) {
|
21
46
|
var topo = props.topo,
|
22
47
|
showLabel = props.showLabel,
|
@@ -32,7 +57,7 @@ function FontSizeWidget(props) {
|
|
32
57
|
tooltip: "\u5B57\u53F7",
|
33
58
|
showLabel: showLabel,
|
34
59
|
disabled: disabled
|
35
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
60
|
+
}, /*#__PURE__*/_react["default"].createElement(FontSizeSelect, {
|
36
61
|
value: style.fontSize,
|
37
62
|
disabled: disabled,
|
38
63
|
onChange: function onChange(val) {
|
@@ -7,16 +7,39 @@ exports["default"] = void 0;
|
|
7
7
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
9
9
|
|
10
|
-
var
|
10
|
+
var _variables = _interopRequireDefault(require("@alifd/theme-19926/variables.js"));
|
11
11
|
|
12
|
-
var
|
12
|
+
var _htElementUtils = require("../../../../../utils/htElementUtils");
|
13
|
+
|
14
|
+
var _DropdownMenu = _interopRequireDefault(require("./components/DropdownMenu"));
|
15
|
+
|
16
|
+
var _textStyleSettingRouter = _interopRequireDefault(require("./components/textStyleSetting/textStyleSettingRouter.js"));
|
13
17
|
|
14
18
|
var _WidgetBox = _interopRequireDefault(require("./WidgetBox"));
|
15
19
|
|
20
|
+
var _Tooltip = _interopRequireDefault(require("../components/Tooltip"));
|
21
|
+
|
16
22
|
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
23
|
|
18
24
|
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; }
|
19
25
|
|
26
|
+
var items = [{
|
27
|
+
key: 'bold',
|
28
|
+
label: '加粗',
|
29
|
+
icon: 'bold',
|
30
|
+
tooltip: '加粗'
|
31
|
+
}, {
|
32
|
+
key: 'italic',
|
33
|
+
label: '斜体',
|
34
|
+
icon: 'Italics',
|
35
|
+
tooltip: '斜体'
|
36
|
+
}, {
|
37
|
+
key: 'underline',
|
38
|
+
label: '下划线',
|
39
|
+
icon: 'Underline',
|
40
|
+
tooltip: '下划线'
|
41
|
+
}];
|
42
|
+
|
20
43
|
function buildValue(obj) {
|
21
44
|
return Object.keys(obj).filter(function (key) {
|
22
45
|
return !!obj[key];
|
@@ -84,12 +107,39 @@ function FontStyleButton(props) {
|
|
84
107
|
tooltip: "\u6587\u5B57\u6837\u5F0F\uFF08\u52A0\u7C97\u3001\u659C\u4F53\u3001\u4E0B\u5212\u7EBF\uFF09",
|
85
108
|
disabled: disabled,
|
86
109
|
showLabel: showLabel
|
87
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
110
|
+
}, /*#__PURE__*/_react["default"].createElement(_DropdownMenu["default"], {
|
88
111
|
value: value,
|
112
|
+
valueRender: function valueRender() {
|
113
|
+
return /*#__PURE__*/_react["default"].createElement("img", {
|
114
|
+
src: "/img/topo/editor/toolbar/bold/" + (disabled ? 'Disable' : 'Normal') + ".svg",
|
115
|
+
alt: ""
|
116
|
+
});
|
117
|
+
},
|
118
|
+
multiple: true,
|
89
119
|
disabled: disabled,
|
90
|
-
|
91
|
-
|
92
|
-
|
120
|
+
onSelect: handleSelect
|
121
|
+
}, items.map(function (item) {
|
122
|
+
return /*#__PURE__*/_react["default"].createElement(_DropdownMenu["default"].Item, {
|
123
|
+
key: item.key,
|
124
|
+
disabled: fieldDisabled[item.key]
|
125
|
+
}, /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
126
|
+
trigger: /*#__PURE__*/_react["default"].createElement("div", {
|
127
|
+
style: {
|
128
|
+
display: 'flex',
|
129
|
+
alignItems: 'center'
|
130
|
+
}
|
131
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
132
|
+
src: "/img/topo/editor/toolbar/" + item.icon + "/" + (fieldDisabled[item.key] ? 'Disable' : 'Normal') + ".svg",
|
133
|
+
alt: ""
|
134
|
+
}), /*#__PURE__*/_react["default"].createElement("span", {
|
135
|
+
style: fieldDisabled[item.key] ? {} : {
|
136
|
+
color: _variables["default"]['$color-text1-4']
|
137
|
+
}
|
138
|
+
}, item.label)),
|
139
|
+
align: "r",
|
140
|
+
popupStyle: {}
|
141
|
+
}, item.tooltip));
|
142
|
+
})));
|
93
143
|
}
|
94
144
|
|
95
145
|
var _default = (0, _textStyleSettingRouter["default"])(FontStyleButton, {
|
@@ -3,6 +3,7 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.getEdgesBySelection = getEdgesBySelection;
|
5
5
|
exports.isNodeAllEdges = isNodeAllEdges;
|
6
|
+
exports.loopEdgesAndChildren = loopEdgesAndChildren;
|
6
7
|
exports.setEdgesType = setEdgesType;
|
7
8
|
exports.updateEdgesData = updateEdgesData;
|
8
9
|
|
@@ -24,14 +25,6 @@ function getEdgesBySelection(topo) {
|
|
24
25
|
return nodeIds;
|
25
26
|
};
|
26
27
|
|
27
|
-
function getVisibleEdgesInNodes(gv, nodes) {
|
28
|
-
var nodeIds = getChildrenNodeIds(nodes);
|
29
|
-
var dm = gv.getDataModel();
|
30
|
-
return (0, _htElementUtils.getEdges)(dm).filter(function (edge) {
|
31
|
-
return nodeIds.includes(edge.getSource().getId()) && nodeIds.includes(edge.getTarget().getId());
|
32
|
-
}).filter(_htElementUtils.isEdgeVisible);
|
33
|
-
}
|
34
|
-
|
35
28
|
var getSelectedEdges = function getSelectedEdges(gv) {
|
36
29
|
var selection = gv.getSelectionModel().getSelection().toArray(); // 选中的连线
|
37
30
|
|
@@ -42,8 +35,14 @@ function getEdgesBySelection(topo) {
|
|
42
35
|
var nodes = selection.filter(function (element) {
|
43
36
|
return element instanceof ht.Node;
|
44
37
|
});
|
45
|
-
|
46
|
-
|
38
|
+
var nodeIds = getChildrenNodeIds(nodes);
|
39
|
+
var dm = gv.getDataModel();
|
40
|
+
(0, _htElementUtils.getEdges)(dm).forEach(function (edge) {
|
41
|
+
if (nodeIds.find(function (nodeId) {
|
42
|
+
return nodeId === edge.getSource().getId();
|
43
|
+
}) && nodeIds.find(function (nodeId) {
|
44
|
+
return nodeId === edge.getTarget().getId();
|
45
|
+
}) && !edges.find(function (item) {
|
47
46
|
return item === edge;
|
48
47
|
})) {
|
49
48
|
edges.push(edge);
|
@@ -90,6 +89,30 @@ function isNodeAllEdges(topo) {
|
|
90
89
|
});
|
91
90
|
return inEdges;
|
92
91
|
}
|
92
|
+
/**
|
93
|
+
* 遍历连线及子连线
|
94
|
+
* @param {*} topo
|
95
|
+
* @param {*} edges
|
96
|
+
* @param {*} operateEdgeFn
|
97
|
+
*/
|
98
|
+
|
99
|
+
|
100
|
+
function loopEdgesAndChildren(topo, edges, operateEdgeFn) {
|
101
|
+
var htTopo = topo.getHtTopo();
|
102
|
+
edges.forEach(function (edge) {
|
103
|
+
operateEdgeFn(edge);
|
104
|
+
|
105
|
+
if (edge.isEdgeGroupAgent()) {
|
106
|
+
// 连线组折叠时同时设置子连线
|
107
|
+
var edgeChildren = edge.getEdgeGroup().getEdges().toArray();
|
108
|
+
htTopo.toggleEdgeGroup(edge.getSource(), edge.getTarget(), true);
|
109
|
+
edgeChildren.forEach(function (edgeChild) {
|
110
|
+
operateEdgeFn(edgeChild);
|
111
|
+
});
|
112
|
+
htTopo.toggleEdgeGroup(edge.getSource(), edge.getTarget(), false);
|
113
|
+
}
|
114
|
+
});
|
115
|
+
}
|
93
116
|
/**
|
94
117
|
* 设置连线及子连线。带回退事务控制
|
95
118
|
* @param {*} topo
|
@@ -127,6 +127,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
127
127
|
return topoDispatchers.setTopoType(_template.TPL_TREE);
|
128
128
|
|
129
129
|
case 7:
|
130
|
+
// 更新配置
|
131
|
+
// resourceConfig.updateConfig(config);
|
132
|
+
// 更新配置对应的资源、链路
|
133
|
+
// editDispatchers.fetchDataByConfig();
|
130
134
|
topo.historyManager.endTransaction();
|
131
135
|
|
132
136
|
case 8:
|
@@ -54,7 +54,7 @@ var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
|
|
54
54
|
var _CiCache = _interopRequireDefault(require("./cache/CiCache"));
|
55
55
|
|
56
56
|
// eslint-disable-next-line no-undef
|
57
|
-
var version = typeof "
|
57
|
+
var version = typeof "13.0.0-dev.1" === 'string' ? "13.0.0-dev.1" : null;
|
58
58
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
59
59
|
/**
|
60
60
|
* 拓扑显示和编辑
|
@@ -218,29 +218,37 @@ var Topo = /*#__PURE__*/function () {
|
|
218
218
|
|
219
219
|
_proto.getData = function getData() {
|
220
220
|
return {
|
221
|
-
groups:
|
222
|
-
nodes:
|
223
|
-
|
224
|
-
}).map(_htElementUtils.getNodeData),
|
221
|
+
groups: this.getGroups(),
|
222
|
+
nodes: this.getNodes(),
|
223
|
+
lines: this.getLines(),
|
225
224
|
customNodes: (0, _htElementUtils.getNodeDatas)(this.getDataModel()).filter(function (item) {
|
226
225
|
return !item.id;
|
227
226
|
}),
|
228
|
-
|
229
|
-
return !!item.id;
|
230
|
-
}),
|
231
|
-
customLines: (0, _htElementUtils.getEdgeDatas)(this.getDataModel()).filter(function (item) {
|
227
|
+
customLines: this.getEdges().filter(function (item) {
|
232
228
|
return !item.id;
|
233
229
|
})
|
234
230
|
};
|
235
|
-
}
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
231
|
+
};
|
232
|
+
|
233
|
+
_proto.getGroups = function getGroups() {
|
234
|
+
return (0, _htElementUtils.getGroupDatas)(this.getDataModel());
|
235
|
+
};
|
236
|
+
|
237
|
+
_proto.getNodes = function getNodes() {
|
238
|
+
var nodes = (0, _htElementUtils.getNodes)(this.getDataModel()).filter(function (node) {
|
239
|
+
return !!node.getTag();
|
240
|
+
});
|
241
|
+
return nodes.map(_htElementUtils.getNodeData);
|
242
|
+
};
|
241
243
|
|
242
244
|
_proto.getLines = function getLines() {
|
243
|
-
return this.
|
245
|
+
return this.getEdges().filter(function (item) {
|
246
|
+
return !!item.id;
|
247
|
+
});
|
248
|
+
};
|
249
|
+
|
250
|
+
_proto.getEdges = function getEdges() {
|
251
|
+
return (0, _htElementUtils.getEdgeDatas)(this.getDataModel());
|
244
252
|
}
|
245
253
|
/**
|
246
254
|
* 全量更新数据
|
@@ -299,19 +307,18 @@ var Topo = /*#__PURE__*/function () {
|
|
299
307
|
/*#__PURE__*/
|
300
308
|
function () {
|
301
309
|
var _addElements = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(elements) {
|
302
|
-
var
|
310
|
+
var data;
|
303
311
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
304
312
|
while (1) switch (_context5.prev = _context5.next) {
|
305
313
|
case 0:
|
306
|
-
prevData = this.getData();
|
307
314
|
data = {
|
308
|
-
groups: [].concat(
|
309
|
-
nodes: [].concat(
|
310
|
-
lines: [].concat(
|
315
|
+
groups: [].concat(this.getGroups(), elements.groups || []),
|
316
|
+
nodes: [].concat(this.getNodes(), elements.nodes || []),
|
317
|
+
lines: [].concat(this.getLines(), elements.lines || [])
|
311
318
|
};
|
312
319
|
this.updateElements(data); // TODO 更新store,触发属性、指标模型加载,更新指标
|
313
320
|
|
314
|
-
case
|
321
|
+
case 2:
|
315
322
|
case "end":
|
316
323
|
return _context5.stop();
|
317
324
|
}
|
@@ -6,7 +6,6 @@ exports.__esModule = true;
|
|
6
6
|
exports.buildTopoLinkData = buildTopoLinkData;
|
7
7
|
exports.compatibleWith = void 0;
|
8
8
|
exports.getLinksDetail = getLinksDetail;
|
9
|
-
exports.isAggLink = isAggLink;
|
10
9
|
exports.isCrucialLink = isCrucialLink;
|
11
10
|
exports.isExitLink = isExitLink;
|
12
11
|
exports.mergeExportLinkData = void 0;
|
@@ -23,6 +22,8 @@ var _keyBy = _interopRequireDefault(require("lodash/keyBy"));
|
|
23
22
|
|
24
23
|
var _lodash = _interopRequireDefault(require("lodash"));
|
25
24
|
|
25
|
+
var _services = require("../../services");
|
26
|
+
|
26
27
|
var _htElementUtils = require("../../../utils/htElementUtils");
|
27
28
|
|
28
29
|
var _CiTypeCache = _interopRequireDefault(require("../cache/CiTypeCache"));
|
@@ -55,21 +56,7 @@ function isCrucialLink(link) {
|
|
55
56
|
|
56
57
|
|
57
58
|
function isExitLink(link) {
|
58
|
-
|
59
|
-
|
60
|
-
return (link === null || link === void 0 ? void 0 : (_link$attributes = link.attributes) === null || _link$attributes === void 0 ? void 0 : _link$attributes.destination_type) === "ip";
|
61
|
-
}
|
62
|
-
/**
|
63
|
-
* 是否聚合链路
|
64
|
-
* @param {*} link
|
65
|
-
* @returns
|
66
|
-
*/
|
67
|
-
|
68
|
-
|
69
|
-
function isAggLink(link) {
|
70
|
-
var _link$attributes2, _link$attributes3;
|
71
|
-
|
72
|
-
return (link === null || link === void 0 ? void 0 : (_link$attributes2 = link.attributes) === null || _link$attributes2 === void 0 ? void 0 : _link$attributes2.destination_type) === "network.agg_interface" && (link === null || link === void 0 ? void 0 : (_link$attributes3 = link.attributes) === null || _link$attributes3 === void 0 ? void 0 : _link$attributes3.source_type) === "network.agg_interface";
|
59
|
+
return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes["destination_id"]);
|
73
60
|
}
|
74
61
|
|
75
62
|
function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc) {
|
@@ -120,7 +107,7 @@ function _getLinksDetail() {
|
|
120
107
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
121
108
|
while (1) switch (_context.prev = _context.next) {
|
122
109
|
case 0:
|
123
|
-
if (links
|
110
|
+
if (!(!links || !links.length)) {
|
124
111
|
_context.next = 2;
|
125
112
|
break;
|
126
113
|
}
|
@@ -128,6 +115,9 @@ function _getLinksDetail() {
|
|
128
115
|
return _context.abrupt("return", []);
|
129
116
|
|
130
117
|
case 2:
|
118
|
+
// const linkCis = await topoService.relation.batchQueryRelation(
|
119
|
+
// links.map((link) => link.id)
|
120
|
+
// );
|
131
121
|
linkCis = links;
|
132
122
|
interfaceIds = [].concat(linkCis.map(function (item) {
|
133
123
|
return item.attributes.source_id;
|
@@ -186,8 +176,7 @@ var plurals = {
|
|
186
176
|
2: ["phy"],
|
187
177
|
3: ["agg"],
|
188
178
|
4: ["phy", "agg"]
|
189
|
-
};
|
190
|
-
|
179
|
+
};
|
191
180
|
exports.plurals = plurals;
|
192
181
|
|
193
182
|
var showLinkByConfig = function showLinkByConfig(props) {
|
@@ -201,29 +190,31 @@ var showLinkByConfig = function showLinkByConfig(props) {
|
|
201
190
|
|
202
191
|
var gv = topo.getGraphView();
|
203
192
|
var dm = gv.getDataModel();
|
204
|
-
var edges = (0, _htElementUtils.getEdges)(dm).
|
205
|
-
return !(0, _htElementUtils.isEdgeGroup)(edge);
|
206
|
-
}); // console.log("edges", edges);
|
193
|
+
var edges = (0, _htElementUtils.getEdges)(dm); // console.log("edges", edges);
|
207
194
|
|
208
195
|
var showPhy = types.indexOf("phy") >= 0;
|
209
196
|
var showAgg = types.indexOf("agg") >= 0; // console.log("edges----types",showType, types,showPhy, showAgg);
|
210
197
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
var d = topo.dataModel.getDataById(edge.getTag()); // 判断是否聚合链路
|
218
|
-
|
219
|
-
if (isAggLink(d)) {
|
220
|
-
edge.s("x.visible", showAgg);
|
198
|
+
if (Array.isArray(edges) && edges.length > 0) {
|
199
|
+
edges.forEach(function (edge) {
|
200
|
+
if (showType === 1 || showType === true) {
|
201
|
+
// 单链路全部显示
|
202
|
+
// console.log("单链路全部显示", edge);
|
203
|
+
edge.s("2d.visible", true);
|
221
204
|
} else {
|
222
|
-
|
223
|
-
|
205
|
+
var _d$attributes, _d$attributes2;
|
206
|
+
|
207
|
+
var d = topo.dataModel.getDataById(edge.getTag()); // 判断是否聚合链路
|
208
|
+
|
209
|
+
if ((d === null || d === void 0 ? void 0 : (_d$attributes = d.attributes) === null || _d$attributes === void 0 ? void 0 : _d$attributes.destination_type) === "network.agg_interface" && (d === null || d === void 0 ? void 0 : (_d$attributes2 = d.attributes) === null || _d$attributes2 === void 0 ? void 0 : _d$attributes2.source_type) === "network.agg_interface") {
|
210
|
+
edge.s("2d.visible", showAgg);
|
211
|
+
} else {
|
212
|
+
// console.log("edge", edge, d, showAgg);
|
213
|
+
edge.s("2d.visible", showPhy);
|
214
|
+
}
|
224
215
|
}
|
225
|
-
}
|
226
|
-
}
|
216
|
+
});
|
217
|
+
}
|
227
218
|
};
|
228
219
|
|
229
220
|
exports.showLinkByConfig = showLinkByConfig;
|
@@ -10,14 +10,12 @@ var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-ut
|
|
10
10
|
|
11
11
|
var _linkUtils = require("../models/utils/linkUtils");
|
12
12
|
|
13
|
-
var _htElementUtils = require("../../utils/htElementUtils");
|
14
|
-
|
15
13
|
/**
|
16
14
|
* 是否手工连线
|
17
15
|
* @param {*} edge
|
18
16
|
*/
|
19
17
|
function isCustomEdge(edge) {
|
20
|
-
return !
|
18
|
+
return !edge.isEdgeGroupAgent() && (edge.a('type') == 'line' || !edge.a('type'));
|
21
19
|
}
|
22
20
|
/**
|
23
21
|
* 根据配置更新连线展开折叠状态
|