@riil-frontend/component-topology 2.15.18 → 2.15.21
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/components/ResourceSelectDrawer/ResourceSelectDrawer.js +2 -0
- package/es/components/ResourceSelectDrawer/ResourceSelectList.js +4 -1
- package/es/core/components/TopoView/topoView.js +2 -3
- package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +1 -3
- package/es/core/editor/components/settings/propertyViews/edge/edgeGroup/EdgeGroupSetting.js +1 -3
- package/es/core/editor/components/settings/propertyViews/group/SettingTab/Setting.js +3 -4
- package/es/core/editor/components/settings/propertyViews/layer/SettingTab/Setting.js +4 -4
- package/es/core/editor/components/settings/propertyViews/multipleElements/MultipleElementPropertyView.js +1 -3
- package/es/core/editor/components/settings/propertyViews/node/NodePropertyView.js +1 -3
- package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +5 -0
- package/es/core/editor/components/settings/propertyViews/text/TextPropertyView.js +5 -7
- package/es/core/models/TopoApp.js +8 -14
- package/es/core/models/topoFactory.js +25 -0
- package/es/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.js +3 -2
- package/es/core/viewer/components/plugins/BaseInfo/index.js +71 -17
- package/es/hooks/useTopoEdit.js +16 -5
- package/es/topoCenter/components/Topology.js +4 -1
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Setting/index.js +1 -3
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +2 -0
- package/lib/components/ResourceSelectDrawer/ResourceSelectList.js +4 -1
- package/lib/core/components/TopoView/topoView.js +2 -3
- package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +1 -3
- package/lib/core/editor/components/settings/propertyViews/edge/edgeGroup/EdgeGroupSetting.js +1 -3
- package/lib/core/editor/components/settings/propertyViews/group/SettingTab/Setting.js +3 -4
- package/lib/core/editor/components/settings/propertyViews/layer/SettingTab/Setting.js +4 -4
- package/lib/core/editor/components/settings/propertyViews/multipleElements/MultipleElementPropertyView.js +1 -3
- package/lib/core/editor/components/settings/propertyViews/node/NodePropertyView.js +1 -3
- package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +5 -0
- package/lib/core/editor/components/settings/propertyViews/text/TextPropertyView.js +5 -7
- package/lib/core/models/TopoApp.js +8 -13
- package/lib/core/models/topoFactory.js +30 -0
- package/lib/core/viewer/components/plugins/BaseInfo/components/ResourceOverview/index.js +3 -2
- package/lib/core/viewer/components/plugins/BaseInfo/index.js +71 -17
- package/lib/hooks/useTopoEdit.js +16 -5
- package/lib/topoCenter/components/Topology.js +4 -1
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Setting/index.js +1 -3
- package/package.json +2 -2
|
@@ -65,15 +65,13 @@ function TextPropertyView(props) {
|
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
if (
|
|
69
|
-
|
|
70
|
-
_onChange(name, DEFAULT_TEXT_VALUE, newValues);
|
|
68
|
+
if (name === 'styleMap.text' && !value) {
|
|
69
|
+
_onChange(name, DEFAULT_TEXT_VALUE, newValues);
|
|
71
70
|
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
_onChange(name, value, newValues);
|
|
71
|
+
return;
|
|
76
72
|
}
|
|
73
|
+
|
|
74
|
+
_onChange(name, value, newValues);
|
|
77
75
|
}
|
|
78
76
|
});
|
|
79
77
|
|
|
@@ -45,14 +45,11 @@ var _edgeUtil = require("../utils/edgeUtil");
|
|
|
45
45
|
|
|
46
46
|
var _PluginManager = _interopRequireDefault(require("./PluginManager"));
|
|
47
47
|
|
|
48
|
+
var _topoFactory = _interopRequireDefault(require("./topoFactory"));
|
|
49
|
+
|
|
48
50
|
// eslint-disable-next-line no-undef
|
|
49
|
-
var version = typeof "2.15.
|
|
51
|
+
var version = typeof "2.15.21" === 'string' ? "2.15.21" : null;
|
|
50
52
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
|
51
|
-
var topoDebug = {};
|
|
52
|
-
window.topoDebug = topoDebug;
|
|
53
|
-
var htTopo = {};
|
|
54
|
-
window.htTopo = htTopo;
|
|
55
|
-
var n = 0;
|
|
56
53
|
/**
|
|
57
54
|
* 拓扑显示和编辑
|
|
58
55
|
*/
|
|
@@ -62,7 +59,6 @@ var Topo = /*#__PURE__*/function () {
|
|
|
62
59
|
* @type TopoGraphView
|
|
63
60
|
*/
|
|
64
61
|
function Topo(options) {
|
|
65
|
-
this.version = version;
|
|
66
62
|
this.options = void 0;
|
|
67
63
|
this.id = void 0;
|
|
68
64
|
this.view = void 0;
|
|
@@ -73,6 +69,8 @@ var Topo = /*#__PURE__*/function () {
|
|
|
73
69
|
this.ciTyeCache = _CiTyeCache["default"];
|
|
74
70
|
this.dictCache = _DictCache["default"];
|
|
75
71
|
this.test = void 0;
|
|
72
|
+
this.uid = void 0;
|
|
73
|
+
this.version = version;
|
|
76
74
|
this.options = (0, _extends2["default"])({
|
|
77
75
|
enableDefaultAlarmLoader: true,
|
|
78
76
|
enableDefaultMetricLoader: true,
|
|
@@ -85,9 +83,6 @@ var Topo = /*#__PURE__*/function () {
|
|
|
85
83
|
}
|
|
86
84
|
|
|
87
85
|
this.initialize(options);
|
|
88
|
-
this.debugId = options.name || "t" + n++;
|
|
89
|
-
topoDebug[this.debugId] = this;
|
|
90
|
-
htTopo[this.debugId] = this.getHtTopo.bind(this);
|
|
91
86
|
}
|
|
92
87
|
|
|
93
88
|
var _proto = Topo.prototype;
|
|
@@ -107,6 +102,7 @@ var Topo = /*#__PURE__*/function () {
|
|
|
107
102
|
this.alarm.init(this); // 指标
|
|
108
103
|
|
|
109
104
|
this.test = new _Test["default"](this);
|
|
105
|
+
this.uid = _topoFactory["default"].add(options.name, this);
|
|
110
106
|
}
|
|
111
107
|
/**
|
|
112
108
|
* TODO 移除
|
|
@@ -127,10 +123,9 @@ var Topo = /*#__PURE__*/function () {
|
|
|
127
123
|
return topoDispatchers.exit();
|
|
128
124
|
|
|
129
125
|
case 3:
|
|
130
|
-
|
|
131
|
-
delete htTopo[this.debugId];
|
|
126
|
+
_topoFactory["default"].remove(this.uid);
|
|
132
127
|
|
|
133
|
-
case
|
|
128
|
+
case 4:
|
|
134
129
|
case "end":
|
|
135
130
|
return _context.stop();
|
|
136
131
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
var n = 0;
|
|
6
|
+
|
|
7
|
+
var TopoFactory = /*#__PURE__*/function () {
|
|
8
|
+
function TopoFactory() {
|
|
9
|
+
this.map = {};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
var _proto = TopoFactory.prototype;
|
|
13
|
+
|
|
14
|
+
_proto.add = function add(name, topo) {
|
|
15
|
+
var uid = name || "" + n++;
|
|
16
|
+
this.map[uid] = topo;
|
|
17
|
+
return uid;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
_proto.remove = function remove(name) {
|
|
21
|
+
delete this.map[name];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return TopoFactory;
|
|
25
|
+
}();
|
|
26
|
+
|
|
27
|
+
var topoFactory = new TopoFactory();
|
|
28
|
+
window.topoFactory = topoFactory;
|
|
29
|
+
var _default = topoFactory;
|
|
30
|
+
exports["default"] = _default;
|
|
@@ -51,12 +51,13 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
51
51
|
|
|
52
52
|
// 基本信息
|
|
53
53
|
function BaseInfoRender(type, data) {
|
|
54
|
+
var _itemCols$type;
|
|
55
|
+
|
|
54
56
|
var itemCols = {
|
|
55
57
|
node: [{
|
|
56
58
|
label: '资源名称:',
|
|
57
59
|
objKey: 'resource',
|
|
58
60
|
render: function render(valueData, key) {
|
|
59
|
-
console.log('资源名称:', valueData, key);
|
|
60
61
|
var display_name = valueData.display_name,
|
|
61
62
|
link = valueData.link;
|
|
62
63
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -111,7 +112,7 @@ function BaseInfoRender(type, data) {
|
|
|
111
112
|
};
|
|
112
113
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
113
114
|
className: _indexModule["default"]['base-info']
|
|
114
|
-
}, itemCols[type].map(function (_ref, key) {
|
|
115
|
+
}, (_itemCols$type = itemCols[type]) === null || _itemCols$type === void 0 ? void 0 : _itemCols$type.map(function (_ref, key) {
|
|
115
116
|
var label = _ref.label,
|
|
116
117
|
objKey = _ref.objKey,
|
|
117
118
|
style = _ref.style,
|
|
@@ -123,8 +123,11 @@ function BaseInfo(props) {
|
|
|
123
123
|
userId = _useState4[0],
|
|
124
124
|
setUserId = _useState4[1];
|
|
125
125
|
|
|
126
|
+
var _useState5 = (0, _react.useState)(null),
|
|
127
|
+
paramData = _useState5[0],
|
|
128
|
+
setParamData = _useState5[1];
|
|
129
|
+
|
|
126
130
|
(0, _react.useEffect)(function () {
|
|
127
|
-
getUser();
|
|
128
131
|
var notifier = topo.view.topoClient.notifier;
|
|
129
132
|
notifier.on(_componentTopologyGraph.TopoEvent.EVENT_DOUBLE_CLICK, openOverview);
|
|
130
133
|
notifier.on('topo_element_click', changeOverview);
|
|
@@ -140,12 +143,51 @@ function BaseInfo(props) {
|
|
|
140
143
|
}, []); // 解决切换拓扑图隐藏概览
|
|
141
144
|
|
|
142
145
|
(0, _react.useEffect)(function () {
|
|
143
|
-
setVisible(false);
|
|
146
|
+
setVisible(false);
|
|
147
|
+
setParamData(null); // TODO 其他数据重置
|
|
144
148
|
}, [topoId]);
|
|
145
149
|
|
|
146
150
|
function getUser() {
|
|
147
151
|
return _getUser.apply(this, arguments);
|
|
148
|
-
}
|
|
152
|
+
} // function changeOverview (node) {
|
|
153
|
+
// const data = node.getAttrObject()
|
|
154
|
+
// console.log('单击切换基本信息', data);
|
|
155
|
+
// setVisible(prev => {
|
|
156
|
+
// prev && openOverview(data)
|
|
157
|
+
// return prev
|
|
158
|
+
// })
|
|
159
|
+
// }
|
|
160
|
+
// function openOverview (data) {
|
|
161
|
+
// console.log('双击打开基本信息', data);
|
|
162
|
+
// const {
|
|
163
|
+
// id,
|
|
164
|
+
// name,
|
|
165
|
+
// type,
|
|
166
|
+
// ciType,
|
|
167
|
+
// ciName,
|
|
168
|
+
// operation,
|
|
169
|
+
// } = data
|
|
170
|
+
// // 仅展示资源和链路的概览
|
|
171
|
+
// if (!['node', 'link', 'linkGroup'].includes(type)) return
|
|
172
|
+
// // 应用拓扑中没有链路详情
|
|
173
|
+
// if (topo.options.resourceOverviewDrawer?.getData && type === 'link') return
|
|
174
|
+
// // 没有权限不显示
|
|
175
|
+
// if (!operation) return
|
|
176
|
+
// setActiveData({
|
|
177
|
+
// id,
|
|
178
|
+
// name,
|
|
179
|
+
// type: type === 'linkGroup' ? 'link' : type,
|
|
180
|
+
// ciType,
|
|
181
|
+
// ciName
|
|
182
|
+
// })
|
|
183
|
+
// const { metrics } = topo.ciTyeCache.getCiType(ciType)
|
|
184
|
+
// topoDispatchers.update({
|
|
185
|
+
// id,
|
|
186
|
+
// metricCodes: metrics.slice(0, 6).map(item => item.code), // 需要展示的关键指标 code
|
|
187
|
+
// })
|
|
188
|
+
// setVisible(true)
|
|
189
|
+
// }
|
|
190
|
+
|
|
149
191
|
|
|
150
192
|
function _getUser() {
|
|
151
193
|
_getUser = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
@@ -171,25 +213,41 @@ function BaseInfo(props) {
|
|
|
171
213
|
return _getUser.apply(this, arguments);
|
|
172
214
|
}
|
|
173
215
|
|
|
216
|
+
function onChangeActive(activeNode) {
|
|
217
|
+
console.log('切换基本信息资源', activeNode);
|
|
218
|
+
activeNode && openOverview((0, _extends2["default"])({}, activeNode, {
|
|
219
|
+
type: 'node'
|
|
220
|
+
}));
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
(0, _react.useEffect)(function () {
|
|
224
|
+
(visible || (paramData === null || paramData === void 0 ? void 0 : paramData.isVisible)) && paramData && init(paramData);
|
|
225
|
+
}, [paramData, visible]);
|
|
226
|
+
|
|
174
227
|
function changeOverview(node) {
|
|
175
228
|
var data = node.getAttrObject();
|
|
176
229
|
console.log('单击切换基本信息', data);
|
|
177
|
-
|
|
178
|
-
prev && openOverview(data);
|
|
179
|
-
return prev;
|
|
180
|
-
});
|
|
230
|
+
setParamData(data);
|
|
181
231
|
}
|
|
182
232
|
|
|
183
233
|
function openOverview(data) {
|
|
234
|
+
console.log('双击打开基本信息', data);
|
|
235
|
+
setParamData((0, _extends2["default"])({}, data, {
|
|
236
|
+
isVisible: true
|
|
237
|
+
}));
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function init(data) {
|
|
184
241
|
var _topo$options$resourc;
|
|
185
242
|
|
|
186
|
-
console.log('
|
|
243
|
+
console.log('初始化基本信息', data);
|
|
187
244
|
var id = data.id,
|
|
188
245
|
name = data.name,
|
|
189
246
|
type = data.type,
|
|
190
247
|
ciType = data.ciType,
|
|
191
248
|
ciName = data.ciName,
|
|
192
|
-
operation = data.operation
|
|
249
|
+
operation = data.operation,
|
|
250
|
+
isVisible = data.isVisible; // 仅展示资源和链路的概览
|
|
193
251
|
|
|
194
252
|
if (!['node', 'link', 'linkGroup'].includes(type)) return; // 应用拓扑中没有链路详情
|
|
195
253
|
|
|
@@ -213,15 +271,11 @@ function BaseInfo(props) {
|
|
|
213
271
|
return item.code;
|
|
214
272
|
}) // 需要展示的关键指标 code
|
|
215
273
|
|
|
216
|
-
});
|
|
217
|
-
setVisible(true);
|
|
218
|
-
}
|
|
274
|
+
}); // 显示隐藏
|
|
219
275
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
type: 'node'
|
|
224
|
-
}));
|
|
276
|
+
isVisible && setVisible(true); // userId
|
|
277
|
+
|
|
278
|
+
userId || getUser();
|
|
225
279
|
}
|
|
226
280
|
|
|
227
281
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_drawer["default"], {
|
package/lib/hooks/useTopoEdit.js
CHANGED
|
@@ -852,7 +852,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
852
852
|
|
|
853
853
|
var bindNodeResource = /*#__PURE__*/function () {
|
|
854
854
|
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(params) {
|
|
855
|
-
var id, oldResId, newResId, node, groupElement, config, groupId, groupTag, _yield$editDispatcher, elements,
|
|
855
|
+
var id, oldResId, newResId, node, groupElement, config, groupId, groupTag, _yield$editDispatcher, elements, nodeRelatedDatas, replaceOrAddRes;
|
|
856
856
|
|
|
857
857
|
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
858
858
|
while (1) {
|
|
@@ -881,7 +881,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
881
881
|
|
|
882
882
|
groupTag = groupElement.a('tag'); // 容器临时id
|
|
883
883
|
|
|
884
|
-
config.groups = groups.map(function (g) {
|
|
884
|
+
config.groups = config.groups.map(function (g) {
|
|
885
885
|
// 匹配到容器,替换资源或增加
|
|
886
886
|
if (g.id === groupId || g.tag === groupTag) {
|
|
887
887
|
return (0, _extends2["default"])({}, g, {
|
|
@@ -908,15 +908,26 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
908
908
|
_yield$editDispatcher = _context7.sent;
|
|
909
909
|
elements = _yield$editDispatcher.topoDataTrans;
|
|
910
910
|
// 过滤出关联的节点和连线,通知ht更新
|
|
911
|
-
|
|
912
|
-
|
|
911
|
+
nodeRelatedDatas = (0, _format.filterElementsByNodeId)(elements, newResId);
|
|
912
|
+
|
|
913
|
+
if (nodeRelatedDatas.length) {
|
|
914
|
+
_context7.next = 17;
|
|
915
|
+
break;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
_message["default"].error('关联资源失败');
|
|
919
|
+
|
|
920
|
+
return _context7.abrupt("return", false);
|
|
921
|
+
|
|
922
|
+
case 17:
|
|
923
|
+
saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_SINGLE, nodeRelatedDatas);
|
|
913
924
|
node.a('customName', null); // 临时放这里,仅拓扑中心有
|
|
914
925
|
|
|
915
926
|
if (topo.linkDynamicStyleExecutor) {
|
|
916
927
|
topo.linkDynamicStyleExecutor.execute();
|
|
917
928
|
}
|
|
918
929
|
|
|
919
|
-
case
|
|
930
|
+
case 20:
|
|
920
931
|
case "end":
|
|
921
932
|
return _context7.stop();
|
|
922
933
|
}
|
|
@@ -63,7 +63,10 @@ function NetworkTopologyFull(props) {
|
|
|
63
63
|
graphViewProps: (0, _extends2["default"])({}, props.graphViewProps, {
|
|
64
64
|
onElementsDelete: topoEdit.onElementsDelete,
|
|
65
65
|
createHtTopoProps: {
|
|
66
|
-
elementChangeLayerByDrag: true
|
|
66
|
+
elementChangeLayerByDrag: true,
|
|
67
|
+
editor: {
|
|
68
|
+
useNewElementsDeleteEvent: true
|
|
69
|
+
}
|
|
67
70
|
}
|
|
68
71
|
})
|
|
69
72
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riil-frontend/component-topology",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.21",
|
|
4
4
|
"description": "拓扑",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "build-scripts start",
|
|
@@ -110,6 +110,6 @@
|
|
|
110
110
|
"access": "public"
|
|
111
111
|
},
|
|
112
112
|
"license": "MIT",
|
|
113
|
-
"homepage": "https://unpkg.com/@riil-frontend/component-topology@2.15.
|
|
113
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@2.15.21/build/index.html",
|
|
114
114
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
|
115
115
|
}
|