@riil-frontend/component-topology 12.0.0-dev.33 → 12.0.0-dev.35
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.js +3 -3
- package/es/core/editor/components/Toolbar/widgets/Layout/index.js +2 -2
- package/es/core/editor/utils/edgeTypeStyleUtil.js +0 -23
- package/es/core/hooks/useTopoEdit.js +0 -4
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/utils/linkUtils.js +20 -13
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +4 -6
- package/lib/core/editor/components/Toolbar/widgets/Layout/index.js +1 -1
- package/lib/core/editor/utils/edgeTypeStyleUtil.js +0 -25
- package/lib/core/hooks/useTopoEdit.js +0 -4
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/utils/linkUtils.js +21 -13
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +4 -6
- package/package.json +2 -2
@@ -7,7 +7,7 @@ import React, { useState, useMemo } from 'react';
|
|
7
7
|
import LayoutSettings from "./components/LayoutSettings";
|
8
8
|
import WidgetBox from "../WidgetBox";
|
9
9
|
import DropdownButton from "../components/DropdownButton";
|
10
|
-
import { isGroup, isLayer } from "../../../../../../utils/htElementDataUtil";
|
10
|
+
import { isGroup, isLayer, isNode } from "../../../../../../utils/htElementDataUtil";
|
11
11
|
|
12
12
|
function Layout(props) {
|
13
13
|
var topo = props.topo,
|
@@ -147,7 +147,7 @@ function isLayoutEnabled(props) {
|
|
147
147
|
} //中心节点布局,选中一个节点不是分层的情况下,按钮亮起
|
148
148
|
|
149
149
|
|
150
|
-
if (topoShowType !== 'layers' && selection.length === 1) {
|
150
|
+
if (topoShowType !== 'layers' && selection.length === 1 && (isNode(selection[0]) || isGroup(selection[0]))) {
|
151
151
|
return true;
|
152
152
|
}
|
153
153
|
|
@@ -77,29 +77,6 @@ export function isNodeAllEdges(topo) {
|
|
77
77
|
});
|
78
78
|
return inEdges;
|
79
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
|
-
}
|
103
80
|
/**
|
104
81
|
* 设置连线及子连线。带回退事务控制
|
105
82
|
* @param {*} topo
|
@@ -95,10 +95,6 @@ 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();
|
102
98
|
topo.historyManager.endTransaction();
|
103
99
|
|
104
100
|
case 8:
|
@@ -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 "12.0.0-dev.
|
27
|
+
var version = typeof "12.0.0-dev.35" === 'string' ? "12.0.0-dev.35" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
@@ -2,8 +2,7 @@ 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";
|
6
|
-
import { queryCisByIds, queryModelAsset } from "../../services"; // 查询所有连线
|
5
|
+
import _ from "lodash"; // 查询所有连线
|
7
6
|
|
8
7
|
import { getEdges } from "../../../utils/htElementUtils";
|
9
8
|
import CiTypeCache from "../cache/CiTypeCache";
|
@@ -32,7 +31,20 @@ export function isCrucialLink(link) {
|
|
32
31
|
*/
|
33
32
|
|
34
33
|
export function isExitLink(link) {
|
35
|
-
|
34
|
+
var _link$attributes;
|
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";
|
36
48
|
}
|
37
49
|
export function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc) {
|
38
50
|
var linkCiMap = keyBy(links, "id");
|
@@ -83,7 +95,7 @@ function _getLinksDetail() {
|
|
83
95
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
84
96
|
while (1) switch (_context.prev = _context.next) {
|
85
97
|
case 0:
|
86
|
-
if (
|
98
|
+
if (links !== null && links !== void 0 && links.length) {
|
87
99
|
_context.next = 2;
|
88
100
|
break;
|
89
101
|
}
|
@@ -91,9 +103,6 @@ function _getLinksDetail() {
|
|
91
103
|
return _context.abrupt("return", []);
|
92
104
|
|
93
105
|
case 2:
|
94
|
-
// const linkCis = await topoService.relation.batchQueryRelation(
|
95
|
-
// links.map((link) => link.id)
|
96
|
-
// );
|
97
106
|
linkCis = links;
|
98
107
|
interfaceIds = [].concat(linkCis.map(function (item) {
|
99
108
|
return item.attributes.source_id;
|
@@ -171,17 +180,15 @@ export var showLinkByConfig = function showLinkByConfig(props) {
|
|
171
180
|
if (showType === 1 || showType === true) {
|
172
181
|
// 单链路全部显示
|
173
182
|
// console.log("单链路全部显示", edge);
|
174
|
-
edge.s("
|
183
|
+
edge.s("x.visible", true);
|
175
184
|
} else {
|
176
|
-
var _d$attributes, _d$attributes2;
|
177
|
-
|
178
185
|
var d = topo.dataModel.getDataById(edge.getTag()); // 判断是否聚合链路
|
179
186
|
|
180
|
-
if ((d
|
181
|
-
edge.s("
|
187
|
+
if (isAggLink(d)) {
|
188
|
+
edge.s("x.visible", showAgg);
|
182
189
|
} else {
|
183
190
|
// console.log("edge", edge, d, showAgg);
|
184
|
-
edge.s("
|
191
|
+
edge.s("x.visible", showPhy);
|
185
192
|
}
|
186
193
|
}
|
187
194
|
});
|
@@ -35,11 +35,9 @@ function formatUrl(url) {
|
|
35
35
|
|
36
36
|
var prefix = '/default/pagecenter';
|
37
37
|
|
38
|
-
if (((_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.pathname.indexOf(prefix))
|
38
|
+
if (((_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.pathname.indexOf(prefix)) !== '-1' && (url === null || url === void 0 ? void 0 : url.indexOf(prefix)) !== '-1') {
|
39
39
|
return url.split(prefix)[1];
|
40
|
-
} else {
|
41
|
-
return url;
|
42
|
-
}
|
40
|
+
} else {}
|
43
41
|
}
|
44
42
|
/**
|
45
43
|
* 资源概览。
|
@@ -337,9 +335,9 @@ export default function ResourceOverview(props) {
|
|
337
335
|
type: record.icon,
|
338
336
|
size: "xs",
|
339
337
|
className: styles['alarm-color-icon'] + " " + record.className
|
340
|
-
}), /*#__PURE__*/React.createElement(
|
338
|
+
}), /*#__PURE__*/React.createElement("a", {
|
341
339
|
className: styles.link,
|
342
|
-
|
340
|
+
href: formatUrl(record.link)
|
343
341
|
}, value));
|
344
342
|
}
|
345
343
|
}, {
|
@@ -162,7 +162,7 @@ function isLayoutEnabled(props) {
|
|
162
162
|
} //中心节点布局,选中一个节点不是分层的情况下,按钮亮起
|
163
163
|
|
164
164
|
|
165
|
-
if (topoShowType !== 'layers' && selection.length === 1) {
|
165
|
+
if (topoShowType !== 'layers' && selection.length === 1 && ((0, _htElementDataUtil.isNode)(selection[0]) || (0, _htElementDataUtil.isGroup)(selection[0]))) {
|
166
166
|
return true;
|
167
167
|
}
|
168
168
|
|
@@ -3,7 +3,6 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.getEdgesBySelection = getEdgesBySelection;
|
5
5
|
exports.isNodeAllEdges = isNodeAllEdges;
|
6
|
-
exports.loopEdgesAndChildren = loopEdgesAndChildren;
|
7
6
|
exports.setEdgesType = setEdgesType;
|
8
7
|
exports.updateEdgesData = updateEdgesData;
|
9
8
|
|
@@ -89,30 +88,6 @@ function isNodeAllEdges(topo) {
|
|
89
88
|
});
|
90
89
|
return inEdges;
|
91
90
|
}
|
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
|
-
}
|
116
91
|
/**
|
117
92
|
* 设置连线及子连线。带回退事务控制
|
118
93
|
* @param {*} topo
|
@@ -127,10 +127,6 @@ 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();
|
134
130
|
topo.historyManager.endTransaction();
|
135
131
|
|
136
132
|
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 "12.0.0-dev.
|
57
|
+
var version = typeof "12.0.0-dev.35" === 'string' ? "12.0.0-dev.35" : null;
|
58
58
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
59
59
|
/**
|
60
60
|
* 拓扑显示和编辑
|
@@ -6,6 +6,7 @@ exports.__esModule = true;
|
|
6
6
|
exports.buildTopoLinkData = buildTopoLinkData;
|
7
7
|
exports.compatibleWith = void 0;
|
8
8
|
exports.getLinksDetail = getLinksDetail;
|
9
|
+
exports.isAggLink = isAggLink;
|
9
10
|
exports.isCrucialLink = isCrucialLink;
|
10
11
|
exports.isExitLink = isExitLink;
|
11
12
|
exports.mergeExportLinkData = void 0;
|
@@ -22,8 +23,6 @@ var _keyBy = _interopRequireDefault(require("lodash/keyBy"));
|
|
22
23
|
|
23
24
|
var _lodash = _interopRequireDefault(require("lodash"));
|
24
25
|
|
25
|
-
var _services = require("../../services");
|
26
|
-
|
27
26
|
var _htElementUtils = require("../../../utils/htElementUtils");
|
28
27
|
|
29
28
|
var _CiTypeCache = _interopRequireDefault(require("../cache/CiTypeCache"));
|
@@ -56,7 +55,21 @@ function isCrucialLink(link) {
|
|
56
55
|
|
57
56
|
|
58
57
|
function isExitLink(link) {
|
59
|
-
|
58
|
+
var _link$attributes;
|
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";
|
60
73
|
}
|
61
74
|
|
62
75
|
function mergeLinksData(links, linkCis, nodes, interfaceCiMap, interfaceDoc) {
|
@@ -107,7 +120,7 @@ function _getLinksDetail() {
|
|
107
120
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
108
121
|
while (1) switch (_context.prev = _context.next) {
|
109
122
|
case 0:
|
110
|
-
if (
|
123
|
+
if (links !== null && links !== void 0 && links.length) {
|
111
124
|
_context.next = 2;
|
112
125
|
break;
|
113
126
|
}
|
@@ -115,9 +128,6 @@ function _getLinksDetail() {
|
|
115
128
|
return _context.abrupt("return", []);
|
116
129
|
|
117
130
|
case 2:
|
118
|
-
// const linkCis = await topoService.relation.batchQueryRelation(
|
119
|
-
// links.map((link) => link.id)
|
120
|
-
// );
|
121
131
|
linkCis = links;
|
122
132
|
interfaceIds = [].concat(linkCis.map(function (item) {
|
123
133
|
return item.attributes.source_id;
|
@@ -200,17 +210,15 @@ var showLinkByConfig = function showLinkByConfig(props) {
|
|
200
210
|
if (showType === 1 || showType === true) {
|
201
211
|
// 单链路全部显示
|
202
212
|
// console.log("单链路全部显示", edge);
|
203
|
-
edge.s("
|
213
|
+
edge.s("x.visible", true);
|
204
214
|
} else {
|
205
|
-
var _d$attributes, _d$attributes2;
|
206
|
-
|
207
215
|
var d = topo.dataModel.getDataById(edge.getTag()); // 判断是否聚合链路
|
208
216
|
|
209
|
-
if ((d
|
210
|
-
edge.s("
|
217
|
+
if (isAggLink(d)) {
|
218
|
+
edge.s("x.visible", showAgg);
|
211
219
|
} else {
|
212
220
|
// console.log("edge", edge, d, showAgg);
|
213
|
-
edge.s("
|
221
|
+
edge.s("x.visible", showPhy);
|
214
222
|
}
|
215
223
|
}
|
216
224
|
});
|
@@ -69,11 +69,9 @@ function formatUrl(url) {
|
|
69
69
|
|
70
70
|
var prefix = '/default/pagecenter';
|
71
71
|
|
72
|
-
if (((_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.pathname.indexOf(prefix))
|
72
|
+
if (((_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.pathname.indexOf(prefix)) !== '-1' && (url === null || url === void 0 ? void 0 : url.indexOf(prefix)) !== '-1') {
|
73
73
|
return url.split(prefix)[1];
|
74
|
-
} else {
|
75
|
-
return url;
|
76
|
-
}
|
74
|
+
} else {}
|
77
75
|
}
|
78
76
|
/**
|
79
77
|
* 资源概览。
|
@@ -371,9 +369,9 @@ function ResourceOverview(props) {
|
|
371
369
|
type: record.icon,
|
372
370
|
size: "xs",
|
373
371
|
className: _indexModule["default"]['alarm-color-icon'] + " " + record.className
|
374
|
-
}), /*#__PURE__*/_react["default"].createElement(
|
372
|
+
}), /*#__PURE__*/_react["default"].createElement("a", {
|
375
373
|
className: _indexModule["default"].link,
|
376
|
-
|
374
|
+
href: formatUrl(record.link)
|
377
375
|
}, value));
|
378
376
|
}
|
379
377
|
}, {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@riil-frontend/component-topology",
|
3
|
-
"version": "12.0.0-dev.
|
3
|
+
"version": "12.0.0-dev.35",
|
4
4
|
"description": "拓扑",
|
5
5
|
"scripts": {
|
6
6
|
"start": "build-scripts start",
|
@@ -123,6 +123,6 @@
|
|
123
123
|
"access": "public"
|
124
124
|
},
|
125
125
|
"license": "MIT",
|
126
|
-
"homepage": "https://unpkg.com/@riil-frontend/component-topology@12.0.0-dev.
|
126
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@12.0.0-dev.35/build/index.html",
|
127
127
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
128
128
|
}
|