@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
@@ -4,6 +4,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
4
4
|
import _Button from "@alifd/next/es/button";
|
5
5
|
import _Icon from "@alifd/next/es/icon";
|
6
6
|
import React, { useMemo, useState } from 'react';
|
7
|
+
import NoDataPage from '@riil-frontend/component-no-data-page';
|
7
8
|
import Collapse from "../../../../../../components/collapse/Collapse";
|
8
9
|
import CiTypeImagePanel from "./CiTypeImagePanel";
|
9
10
|
import CustomImagePanel from "./CustomImagePanel";
|
@@ -106,12 +107,16 @@ export default function ImagePanel(props) {
|
|
106
107
|
}].filter(function (panel) {
|
107
108
|
return !panel.hidden;
|
108
109
|
});
|
110
|
+
|
111
|
+
if (!panels.length) {
|
112
|
+
return /*#__PURE__*/React.createElement(NoDataPage, null);
|
113
|
+
}
|
114
|
+
|
109
115
|
return /*#__PURE__*/React.createElement(Collapse, {
|
110
116
|
accordion: true,
|
111
117
|
defaultExpandedKeys: ['资源图片'],
|
112
118
|
style: {
|
113
|
-
border: 'none'
|
114
|
-
minWidth: '300px'
|
119
|
+
border: 'none'
|
115
120
|
},
|
116
121
|
fullheight: true,
|
117
122
|
noContentPadding: true
|
@@ -140,6 +145,9 @@ export default function ImagePanel(props) {
|
|
140
145
|
width: '100%'
|
141
146
|
}
|
142
147
|
})), /*#__PURE__*/React.createElement(_Box, {
|
143
|
-
flex: 1
|
148
|
+
flex: 1,
|
149
|
+
style: {
|
150
|
+
minWidth: '300px'
|
151
|
+
}
|
144
152
|
}, renderImageContent()));
|
145
153
|
}
|
@@ -36,14 +36,14 @@ function EdgeColorButton(props) {
|
|
36
36
|
});
|
37
37
|
};
|
38
38
|
|
39
|
-
var
|
39
|
+
var getLines = function getLines(list) {
|
40
40
|
return list.filter(isCustomEdge);
|
41
41
|
};
|
42
42
|
|
43
43
|
useEffect(function () {
|
44
44
|
if (graphLoaded) {
|
45
45
|
var edges = getEdgesBySelection(topo);
|
46
|
-
var list =
|
46
|
+
var list = getLines(edges);
|
47
47
|
setLineWidth(1); // eslint-disable-next-line eqeqeq
|
48
48
|
|
49
49
|
if (selection.length == 1 && list.length === 1) {
|
@@ -32,11 +32,21 @@ var LINE_TYPE_OPTIONS = [{
|
|
32
32
|
value: 'doublearc',
|
33
33
|
label: '双弧线',
|
34
34
|
icon: 'topo_linear_icon_arcline'
|
35
|
-
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
}
|
35
|
+
} // {
|
36
|
+
// value: 'points',
|
37
|
+
// label: '自由线形',
|
38
|
+
// icon: 'topo_linear_icon_pointsline',
|
39
|
+
// },
|
40
|
+
];
|
41
|
+
|
42
|
+
if (localStorage.getItem('topo.test.edge.customType') === 'true') {
|
43
|
+
LINE_TYPE_OPTIONS.push({
|
44
|
+
value: 'points',
|
45
|
+
label: '自由线形',
|
46
|
+
icon: 'topo_linear_icon_pointsline'
|
47
|
+
});
|
48
|
+
}
|
49
|
+
|
40
50
|
var LineType = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
41
51
|
var value = props.value,
|
42
52
|
onChange = props.onChange,
|
@@ -1,8 +1,33 @@
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
2
|
-
import
|
3
|
-
import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter";
|
2
|
+
import DropdownMenu from "./components/DropdownMenu";
|
3
|
+
import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter.js";
|
4
4
|
import WidgetBox from "./WidgetBox";
|
5
5
|
|
6
|
+
function FontFamilySelect(props) {
|
7
|
+
var value = props.value,
|
8
|
+
onChange = props.onChange;
|
9
|
+
var items = ['宋体', '微软雅黑', '黑体', 'Arial'];
|
10
|
+
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
11
|
+
value: (items.includes(value) ? value : null) || '',
|
12
|
+
valueRender: function valueRender(val) {
|
13
|
+
return /*#__PURE__*/React.createElement("div", {
|
14
|
+
style: {
|
15
|
+
width: 48
|
16
|
+
}
|
17
|
+
}, val || '微软雅黑');
|
18
|
+
},
|
19
|
+
onSelect: onChange
|
20
|
+
}, items.map(function (item) {
|
21
|
+
return /*#__PURE__*/React.createElement(DropdownMenu.Item, {
|
22
|
+
key: item
|
23
|
+
}, /*#__PURE__*/React.createElement("div", {
|
24
|
+
style: {
|
25
|
+
fontFamily: item
|
26
|
+
}
|
27
|
+
}, item));
|
28
|
+
}));
|
29
|
+
}
|
30
|
+
|
6
31
|
function FontFamilyWidget(props) {
|
7
32
|
var topo = props.topo,
|
8
33
|
showLabel = props.showLabel,
|
@@ -1,8 +1,33 @@
|
|
1
|
-
import React, { useEffect } from 'react';
|
2
|
-
import
|
3
|
-
import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter";
|
1
|
+
import React, { useEffect, useState } from 'react';
|
2
|
+
import DropdownMenu from "./components/DropdownMenu";
|
3
|
+
import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter.js";
|
4
4
|
import WidgetBox from "./WidgetBox";
|
5
5
|
|
6
|
+
function FontSizeSelect(props) {
|
7
|
+
var value = props.value,
|
8
|
+
disabled = props.disabled,
|
9
|
+
onChange = props.onChange;
|
10
|
+
var items = [12, 14, 16, 18, 20, 24, 30, 36, 48, 60, 80];
|
11
|
+
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
12
|
+
value: "" + (value || ''),
|
13
|
+
valueRender: function valueRender(val) {
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
15
|
+
style: {
|
16
|
+
width: 18
|
17
|
+
}
|
18
|
+
}, val || 20);
|
19
|
+
},
|
20
|
+
disabled: disabled,
|
21
|
+
onSelect: function onSelect(val) {
|
22
|
+
return onChange(parseInt(val, 10));
|
23
|
+
}
|
24
|
+
}, items.map(function (item) {
|
25
|
+
return /*#__PURE__*/React.createElement(DropdownMenu.Item, {
|
26
|
+
key: item
|
27
|
+
}, item);
|
28
|
+
}));
|
29
|
+
}
|
30
|
+
|
6
31
|
function FontSizeWidget(props) {
|
7
32
|
var topo = props.topo,
|
8
33
|
showLabel = props.showLabel,
|
@@ -1,7 +1,26 @@
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
2
|
-
import
|
3
|
-
import
|
2
|
+
import variables from '@alifd/theme-19926/variables.js';
|
3
|
+
import { isText } from "../../../../../utils/htElementUtils";
|
4
|
+
import DropdownMenu from "./components/DropdownMenu";
|
5
|
+
import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter.js";
|
4
6
|
import WidgetBox from "./WidgetBox";
|
7
|
+
import Tooltip from "../components/Tooltip";
|
8
|
+
var items = [{
|
9
|
+
key: 'bold',
|
10
|
+
label: '加粗',
|
11
|
+
icon: 'bold',
|
12
|
+
tooltip: '加粗'
|
13
|
+
}, {
|
14
|
+
key: 'italic',
|
15
|
+
label: '斜体',
|
16
|
+
icon: 'Italics',
|
17
|
+
tooltip: '斜体'
|
18
|
+
}, {
|
19
|
+
key: 'underline',
|
20
|
+
label: '下划线',
|
21
|
+
icon: 'Underline',
|
22
|
+
tooltip: '下划线'
|
23
|
+
}];
|
5
24
|
|
6
25
|
function buildValue(obj) {
|
7
26
|
return Object.keys(obj).filter(function (key) {
|
@@ -70,12 +89,39 @@ function FontStyleButton(props) {
|
|
70
89
|
tooltip: "\u6587\u5B57\u6837\u5F0F\uFF08\u52A0\u7C97\u3001\u659C\u4F53\u3001\u4E0B\u5212\u7EBF\uFF09",
|
71
90
|
disabled: disabled,
|
72
91
|
showLabel: showLabel
|
73
|
-
}, /*#__PURE__*/React.createElement(
|
92
|
+
}, /*#__PURE__*/React.createElement(DropdownMenu, {
|
74
93
|
value: value,
|
94
|
+
valueRender: function valueRender() {
|
95
|
+
return /*#__PURE__*/React.createElement("img", {
|
96
|
+
src: "/img/topo/editor/toolbar/bold/" + (disabled ? 'Disable' : 'Normal') + ".svg",
|
97
|
+
alt: ""
|
98
|
+
});
|
99
|
+
},
|
100
|
+
multiple: true,
|
75
101
|
disabled: disabled,
|
76
|
-
|
77
|
-
|
78
|
-
|
102
|
+
onSelect: handleSelect
|
103
|
+
}, items.map(function (item) {
|
104
|
+
return /*#__PURE__*/React.createElement(DropdownMenu.Item, {
|
105
|
+
key: item.key,
|
106
|
+
disabled: fieldDisabled[item.key]
|
107
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
108
|
+
trigger: /*#__PURE__*/React.createElement("div", {
|
109
|
+
style: {
|
110
|
+
display: 'flex',
|
111
|
+
alignItems: 'center'
|
112
|
+
}
|
113
|
+
}, /*#__PURE__*/React.createElement("img", {
|
114
|
+
src: "/img/topo/editor/toolbar/" + item.icon + "/" + (fieldDisabled[item.key] ? 'Disable' : 'Normal') + ".svg",
|
115
|
+
alt: ""
|
116
|
+
}), /*#__PURE__*/React.createElement("span", {
|
117
|
+
style: fieldDisabled[item.key] ? {} : {
|
118
|
+
color: variables['$color-text1-4']
|
119
|
+
}
|
120
|
+
}, item.label)),
|
121
|
+
align: "r",
|
122
|
+
popupStyle: {}
|
123
|
+
}, item.tooltip));
|
124
|
+
})));
|
79
125
|
}
|
80
126
|
|
81
127
|
export default textStyleSettingRouter(FontStyleButton, {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { getEdges, getEdgesBetweenNodes
|
1
|
+
import { getEdges, getEdgesBetweenNodes } from "../../../utils/htElementUtils";
|
2
2
|
var ht = window.ht;
|
3
3
|
export function getEdgesBySelection(topo) {
|
4
4
|
var getChildrenNodeIds = function getChildrenNodeIds(nodes) {
|
@@ -14,14 +14,6 @@ export function getEdgesBySelection(topo) {
|
|
14
14
|
return nodeIds;
|
15
15
|
};
|
16
16
|
|
17
|
-
function getVisibleEdgesInNodes(gv, nodes) {
|
18
|
-
var nodeIds = getChildrenNodeIds(nodes);
|
19
|
-
var dm = gv.getDataModel();
|
20
|
-
return getEdges(dm).filter(function (edge) {
|
21
|
-
return nodeIds.includes(edge.getSource().getId()) && nodeIds.includes(edge.getTarget().getId());
|
22
|
-
}).filter(isEdgeVisible);
|
23
|
-
}
|
24
|
-
|
25
17
|
var getSelectedEdges = function getSelectedEdges(gv) {
|
26
18
|
var selection = gv.getSelectionModel().getSelection().toArray(); // 选中的连线
|
27
19
|
|
@@ -32,8 +24,14 @@ export function getEdgesBySelection(topo) {
|
|
32
24
|
var nodes = selection.filter(function (element) {
|
33
25
|
return element instanceof ht.Node;
|
34
26
|
});
|
35
|
-
|
36
|
-
|
27
|
+
var nodeIds = getChildrenNodeIds(nodes);
|
28
|
+
var dm = gv.getDataModel();
|
29
|
+
getEdges(dm).forEach(function (edge) {
|
30
|
+
if (nodeIds.find(function (nodeId) {
|
31
|
+
return nodeId === edge.getSource().getId();
|
32
|
+
}) && nodeIds.find(function (nodeId) {
|
33
|
+
return nodeId === edge.getTarget().getId();
|
34
|
+
}) && !edges.find(function (item) {
|
37
35
|
return item === edge;
|
38
36
|
})) {
|
39
37
|
edges.push(edge);
|
@@ -79,6 +77,29 @@ export function isNodeAllEdges(topo) {
|
|
79
77
|
});
|
80
78
|
return inEdges;
|
81
79
|
}
|
80
|
+
/**
|
81
|
+
* 遍历连线及子连线
|
82
|
+
* @param {*} topo
|
83
|
+
* @param {*} edges
|
84
|
+
* @param {*} operateEdgeFn
|
85
|
+
*/
|
86
|
+
|
87
|
+
export function loopEdgesAndChildren(topo, edges, operateEdgeFn) {
|
88
|
+
var htTopo = topo.getHtTopo();
|
89
|
+
edges.forEach(function (edge) {
|
90
|
+
operateEdgeFn(edge);
|
91
|
+
|
92
|
+
if (edge.isEdgeGroupAgent()) {
|
93
|
+
// 连线组折叠时同时设置子连线
|
94
|
+
var edgeChildren = edge.getEdgeGroup().getEdges().toArray();
|
95
|
+
htTopo.toggleEdgeGroup(edge.getSource(), edge.getTarget(), true);
|
96
|
+
edgeChildren.forEach(function (edgeChild) {
|
97
|
+
operateEdgeFn(edgeChild);
|
98
|
+
});
|
99
|
+
htTopo.toggleEdgeGroup(edge.getSource(), edge.getTarget(), false);
|
100
|
+
}
|
101
|
+
});
|
102
|
+
}
|
82
103
|
/**
|
83
104
|
* 设置连线及子连线。带回退事务控制
|
84
105
|
* @param {*} topo
|
@@ -95,6 +95,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
95
95
|
return topoDispatchers.setTopoType(TPL_TREE);
|
96
96
|
|
97
97
|
case 7:
|
98
|
+
// 更新配置
|
99
|
+
// resourceConfig.updateConfig(config);
|
100
|
+
// 更新配置对应的资源、链路
|
101
|
+
// editDispatchers.fetchDataByConfig();
|
98
102
|
topo.historyManager.endTransaction();
|
99
103
|
|
100
104
|
case 8:
|
@@ -10,7 +10,7 @@ import Alarm from "./Alarm";
|
|
10
10
|
import TopoGraphView from "./TopoGraphView";
|
11
11
|
import createStore from "../store/createStore";
|
12
12
|
import buildProvider from "../components/buildProvider";
|
13
|
-
import { getEdgeDatas, getGroupDatas, getNodeData, getNodeDatas, getNodes } from "../../utils/htElementUtils";
|
13
|
+
import { getEdgeDatas, getGroupDatas, getNodeData, getNodeDatas, getNodes as _getNodes } from "../../utils/htElementUtils";
|
14
14
|
import Test from "../test/Test";
|
15
15
|
import { formatGroups } from "../../utils/topoData";
|
16
16
|
import DictCache from "./cache/DictCache";
|
@@ -24,7 +24,7 @@ import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
|
|
24
24
|
import SelectionModel from "./SelectionModel";
|
25
25
|
import CiCache from "./cache/CiCache"; // eslint-disable-next-line no-undef
|
26
26
|
|
27
|
-
var version = typeof "
|
27
|
+
var version = typeof "13.0.0-dev.1" === 'string' ? "13.0.0-dev.1" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
@@ -188,29 +188,38 @@ var Topo = /*#__PURE__*/function () {
|
|
188
188
|
|
189
189
|
_proto.getData = function getData() {
|
190
190
|
return {
|
191
|
-
groups:
|
192
|
-
nodes:
|
193
|
-
|
194
|
-
}).map(getNodeData),
|
191
|
+
groups: this.getGroups(),
|
192
|
+
nodes: this.getNodes(),
|
193
|
+
lines: this.getLines(),
|
195
194
|
customNodes: getNodeDatas(this.getDataModel()).filter(function (item) {
|
196
195
|
return !item.id;
|
197
196
|
}),
|
198
|
-
|
199
|
-
return !!item.id;
|
200
|
-
}),
|
201
|
-
customLines: getEdgeDatas(this.getDataModel()).filter(function (item) {
|
197
|
+
customLines: this.getEdges().filter(function (item) {
|
202
198
|
return !item.id;
|
203
199
|
})
|
204
200
|
};
|
205
|
-
}
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
201
|
+
};
|
202
|
+
|
203
|
+
_proto.getGroups = function getGroups() {
|
204
|
+
return getGroupDatas(this.getDataModel());
|
205
|
+
};
|
206
|
+
|
207
|
+
_proto.getNodes = function getNodes() {
|
208
|
+
var nodes = _getNodes(this.getDataModel()).filter(function (node) {
|
209
|
+
return !!node.getTag();
|
210
|
+
});
|
211
|
+
|
212
|
+
return nodes.map(getNodeData);
|
213
|
+
};
|
211
214
|
|
212
215
|
_proto.getLines = function getLines() {
|
213
|
-
return this.
|
216
|
+
return this.getEdges().filter(function (item) {
|
217
|
+
return !!item.id;
|
218
|
+
});
|
219
|
+
};
|
220
|
+
|
221
|
+
_proto.getEdges = function getEdges() {
|
222
|
+
return getEdgeDatas(this.getDataModel());
|
214
223
|
}
|
215
224
|
/**
|
216
225
|
* 全量更新数据
|
@@ -269,19 +278,18 @@ var Topo = /*#__PURE__*/function () {
|
|
269
278
|
/*#__PURE__*/
|
270
279
|
function () {
|
271
280
|
var _addElements = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(elements) {
|
272
|
-
var
|
281
|
+
var data;
|
273
282
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
274
283
|
while (1) switch (_context5.prev = _context5.next) {
|
275
284
|
case 0:
|
276
|
-
prevData = this.getData();
|
277
285
|
data = {
|
278
|
-
groups: [].concat(
|
279
|
-
nodes: [].concat(
|
280
|
-
lines: [].concat(
|
286
|
+
groups: [].concat(this.getGroups(), elements.groups || []),
|
287
|
+
nodes: [].concat(this.getNodes(), elements.nodes || []),
|
288
|
+
lines: [].concat(this.getLines(), elements.lines || [])
|
281
289
|
};
|
282
290
|
this.updateElements(data); // TODO 更新store,触发属性、指标模型加载,更新指标
|
283
291
|
|
284
|
-
case
|
292
|
+
case 2:
|
285
293
|
case "end":
|
286
294
|
return _context5.stop();
|
287
295
|
}
|
@@ -2,9 +2,10 @@ 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
4
|
import keyBy from "lodash/keyBy";
|
5
|
-
import _ from "lodash";
|
5
|
+
import _ from "lodash";
|
6
|
+
import { queryCisByIds, queryModelAsset } from "../../services"; // 查询所有连线
|
6
7
|
|
7
|
-
import { getEdges
|
8
|
+
import { getEdges } from "../../../utils/htElementUtils";
|
8
9
|
import CiTypeCache from "../cache/CiTypeCache";
|
9
10
|
import CiCache from "../cache/CiCache"; // const interfaceTypeMap = {
|
10
11
|
// "network.interface": {
|
@@ -31,20 +32,7 @@ export function isCrucialLink(link) {
|
|
31
32
|
*/
|
32
33
|
|
33
34
|
export function isExitLink(link) {
|
34
|
-
|
35
|
-
|
36
|
-
return (link === null || link === void 0 ? void 0 : (_link$attributes = link.attributes) === null || _link$attributes === void 0 ? void 0 : _link$attributes.destination_type) === "ip";
|
37
|
-
}
|
38
|
-
/**
|
39
|
-
* 是否聚合链路
|
40
|
-
* @param {*} link
|
41
|
-
* @returns
|
42
|
-
*/
|
43
|
-
|
44
|
-
export function isAggLink(link) {
|
45
|
-
var _link$attributes2, _link$attributes3;
|
46
|
-
|
47
|
-
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";
|
35
|
+
return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes["destination_id"]);
|
48
36
|
}
|
49
37
|
export function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc) {
|
50
38
|
var linkCiMap = keyBy(links, "id");
|
@@ -95,7 +83,7 @@ function _getLinksDetail() {
|
|
95
83
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
96
84
|
while (1) switch (_context.prev = _context.next) {
|
97
85
|
case 0:
|
98
|
-
if (links
|
86
|
+
if (!(!links || !links.length)) {
|
99
87
|
_context.next = 2;
|
100
88
|
break;
|
101
89
|
}
|
@@ -103,6 +91,9 @@ function _getLinksDetail() {
|
|
103
91
|
return _context.abrupt("return", []);
|
104
92
|
|
105
93
|
case 2:
|
94
|
+
// const linkCis = await topoService.relation.batchQueryRelation(
|
95
|
+
// links.map((link) => link.id)
|
96
|
+
// );
|
106
97
|
linkCis = links;
|
107
98
|
interfaceIds = [].concat(linkCis.map(function (item) {
|
108
99
|
return item.attributes.source_id;
|
@@ -158,8 +149,7 @@ export var plurals = {
|
|
158
149
|
2: ["phy"],
|
159
150
|
3: ["agg"],
|
160
151
|
4: ["phy", "agg"]
|
161
|
-
};
|
162
|
-
|
152
|
+
};
|
163
153
|
export var showLinkByConfig = function showLinkByConfig(props) {
|
164
154
|
var _plurals$compatibleWi;
|
165
155
|
|
@@ -171,29 +161,31 @@ export var showLinkByConfig = function showLinkByConfig(props) {
|
|
171
161
|
|
172
162
|
var gv = topo.getGraphView();
|
173
163
|
var dm = gv.getDataModel();
|
174
|
-
var edges = getEdges(dm).
|
175
|
-
return !isEdgeGroup(edge);
|
176
|
-
}); // console.log("edges", edges);
|
164
|
+
var edges = getEdges(dm); // console.log("edges", edges);
|
177
165
|
|
178
166
|
var showPhy = types.indexOf("phy") >= 0;
|
179
167
|
var showAgg = types.indexOf("agg") >= 0; // console.log("edges----types",showType, types,showPhy, showAgg);
|
180
168
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
var d = topo.dataModel.getDataById(edge.getTag()); // 判断是否聚合链路
|
188
|
-
|
189
|
-
if (isAggLink(d)) {
|
190
|
-
edge.s("x.visible", showAgg);
|
169
|
+
if (Array.isArray(edges) && edges.length > 0) {
|
170
|
+
edges.forEach(function (edge) {
|
171
|
+
if (showType === 1 || showType === true) {
|
172
|
+
// 单链路全部显示
|
173
|
+
// console.log("单链路全部显示", edge);
|
174
|
+
edge.s("2d.visible", true);
|
191
175
|
} else {
|
192
|
-
|
193
|
-
|
176
|
+
var _d$attributes, _d$attributes2;
|
177
|
+
|
178
|
+
var d = topo.dataModel.getDataById(edge.getTag()); // 判断是否聚合链路
|
179
|
+
|
180
|
+
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") {
|
181
|
+
edge.s("2d.visible", showAgg);
|
182
|
+
} else {
|
183
|
+
// console.log("edge", edge, d, showAgg);
|
184
|
+
edge.s("2d.visible", showPhy);
|
185
|
+
}
|
194
186
|
}
|
195
|
-
}
|
196
|
-
}
|
187
|
+
});
|
188
|
+
}
|
197
189
|
};
|
198
190
|
export var mergeExportLinkData = function mergeExportLinkData(props) {
|
199
191
|
var source = props.source,
|
@@ -1,13 +1,12 @@
|
|
1
1
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
2
2
|
import { showLinkByConfig } from "../models/utils/linkUtils";
|
3
|
-
import { isEdgeGroup } from "../../utils/htElementUtils";
|
4
3
|
/**
|
5
4
|
* 是否手工连线
|
6
5
|
* @param {*} edge
|
7
6
|
*/
|
8
7
|
|
9
8
|
export function isCustomEdge(edge) {
|
10
|
-
return !
|
9
|
+
return !edge.isEdgeGroupAgent() && (edge.a('type') == 'line' || !edge.a('type'));
|
11
10
|
}
|
12
11
|
/**
|
13
12
|
* 根据配置更新连线展开折叠状态
|
package/es/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import React, { useMemo } from 'react';
|
2
2
|
import DefaultDetailContent from "../../ResourceDetail/DefaultDetailContent";
|
3
|
-
import { isEdgeGroupAgent } from "../../../../../../utils/htElementUtils";
|
4
3
|
|
5
4
|
function useElementDetailManager(props) {
|
6
5
|
var topo = props.topo,
|
@@ -63,8 +62,9 @@ function useElementDetailManager(props) {
|
|
63
62
|
}
|
64
63
|
|
65
64
|
function openByHtElement(htElement) {
|
65
|
+
var isEdgeGroupAgent = htElement instanceof ht.Edge && htElement.isEdgeGroupAgent() && !htElement.s('edge.expanded');
|
66
66
|
open({
|
67
|
-
id: isEdgeGroupAgent
|
67
|
+
id: isEdgeGroupAgent || !htElement.getTag() ? "ht:" + htElement.getId() : htElement.getTag(),
|
68
68
|
htElement: htElement
|
69
69
|
});
|
70
70
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { getEdgeGroups } from "../../utils/htElementUtils";
|
2
2
|
import { getEdgeGroupLinkIdConfig } from "../utils/edgeGroupTagUtil";
|
3
3
|
|
4
4
|
var EdgeGroupTagTipBuilder = /*#__PURE__*/function () {
|
@@ -16,11 +16,11 @@ var EdgeGroupTagTipBuilder = /*#__PURE__*/function () {
|
|
16
16
|
|
17
17
|
var topo = this.topo;
|
18
18
|
var dm = this.topo.getDataModel();
|
19
|
-
var
|
20
|
-
|
21
|
-
|
22
|
-
var linkId = getEdgeGroupLinkIdConfig(
|
23
|
-
var edgeGroupId = [
|
19
|
+
var edgeGroupsTagsTips = getEdgeGroups(dm).map(function (edgeGroup) {
|
20
|
+
var edge = edgeGroup.getEdges().getArray()[0]; // 获取配置的链路
|
21
|
+
|
22
|
+
var linkId = getEdgeGroupLinkIdConfig(edge, topo);
|
23
|
+
var edgeGroupId = [edge.getSourceAgent().getId(), edge.getTargetAgent().getId()];
|
24
24
|
var data = {
|
25
25
|
tags: [],
|
26
26
|
tips: []
|
@@ -31,7 +31,7 @@ var EdgeGroupTagTipBuilder = /*#__PURE__*/function () {
|
|
31
31
|
}
|
32
32
|
|
33
33
|
return {
|
34
|
-
htId:
|
34
|
+
htId: edge.getId(),
|
35
35
|
edgeGroupId: edgeGroupId,
|
36
36
|
tags: data.tags,
|
37
37
|
tips: data.tips,
|
@@ -55,8 +55,8 @@ export function getEdgeGroupLinkIdConfig(edgeGroup, topo) {
|
|
55
55
|
});
|
56
56
|
}
|
57
57
|
export function getEdgeGroupConfigId(edgeGroup) {
|
58
|
-
var sourceNode = edgeGroup.
|
59
|
-
var targetNode = edgeGroup.
|
58
|
+
var sourceNode = edgeGroup.getSourceAgent();
|
59
|
+
var targetNode = edgeGroup.getTargetAgent();
|
60
60
|
var sourceId = sourceNode.a('uuid');
|
61
61
|
var targetId = targetNode.a('uuid');
|
62
62
|
return [sourceId, targetId].sort().join(',');
|