@riil-frontend/component-topology 11.0.39 → 11.0.40
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.css +4 -2
- package/build/index.js +49 -34
- package/es/components/MultiResourceDrawer/index.js +16 -18
- package/es/components/ResourceList/ResourceSelect.js +48 -50
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +24 -26
- package/es/components/SingleResourceDrawer/SelectDrawer.js +18 -20
- package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +23 -25
- package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +78 -84
- package/es/core/components/titlebar/widgets/TitleWidget.js +5 -3
- package/es/core/editor/components/BackgroundView/UploadDialog/index.js +15 -17
- package/es/core/editor/components/BackgroundView/index.js +119 -129
- package/es/core/editor/components/CustomIconPlugin/RenameDialog.js +20 -22
- package/es/core/editor/components/CustomIconPlugin/UploadIconDialog.js +31 -33
- package/es/core/editor/components/CustomIconPlugin/utils/svgToShape.js +15 -17
- package/es/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +7 -9
- package/es/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +37 -41
- package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +50 -54
- package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +50 -54
- package/es/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +11 -13
- package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +21 -23
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +15 -17
- package/es/core/editor/components/settings/propertyViews/view/BackgroundSize.js +10 -12
- package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +21 -27
- package/es/core/editor/hooks/useKeyboardShortcut.js +2 -2
- package/es/core/editor/hooks/useNewElementTheme.js +2 -2
- package/es/core/editor/store/background.js +8 -10
- package/es/core/editor/store/topoEdit.js +4 -6
- package/es/core/editor/utils/edgeTypeStyleUtil.js +2 -4
- package/es/core/hooks/usePolling.js +117 -121
- package/es/core/hooks/useResourceConfig.js +58 -66
- package/es/core/hooks/useTopoEdit.js +477 -507
- package/es/core/models/Alarm.js +281 -298
- package/es/core/models/AttributeMetricDisplay.js +101 -107
- package/es/core/models/PluginManager.js +4 -3
- package/es/core/models/SelectionModel.js +4 -5
- package/es/core/models/TopoApp.js +205 -240
- package/es/core/models/TopoGraphView.js +18 -21
- package/es/core/models/cache/CiCache.js +28 -27
- package/es/core/models/cache/CiTypeCache.js +37 -41
- package/es/core/models/cache/DictCache.js +33 -35
- package/es/core/models/graph/Background.js +15 -17
- package/es/core/models/plugins/resourceWebControllUrl.js +76 -82
- package/es/core/models/tagstips/ElementTagTipConfig.js +34 -38
- package/es/core/models/topoData.js +68 -70
- package/es/core/models/utils/linkUtils.js +41 -43
- package/es/core/models/utils/nodeNameVisibleUtil.js +4 -4
- package/es/core/services/alarm.js +14 -16
- package/es/core/services/background.js +59 -67
- package/es/core/services/cmdb/metric.js +9 -11
- package/es/core/services/cmdb.js +18 -20
- package/es/core/services/index.js +39 -45
- package/es/core/services/overview.js +131 -151
- package/es/core/services/topo/basic.js +37 -41
- package/es/core/services/topo/tagtip.js +10 -12
- package/es/core/store/models/ciModel.js +58 -62
- package/es/core/store/models/customIcon.js +120 -134
- package/es/core/store/models/displayConfig.js +15 -19
- package/es/core/store/models/selection.js +4 -6
- package/es/core/store/models/topoAlarm.js +162 -145
- package/es/core/store/models/topoBaseInfoOverview.js +4 -6
- package/es/core/store/models/topoBizMod.js +9 -11
- package/es/core/store/models/topoConfig.js +215 -231
- package/es/core/store/models/topoGraphView.js +4 -6
- package/es/core/store/models/topoMod.js +373 -395
- package/es/core/utils/imageUtil.js +18 -20
- package/es/core/utils/saveSerialize.js +9 -11
- package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +56 -58
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +15 -17
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +343 -357
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +86 -92
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +41 -43
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +189 -205
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +109 -111
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +57 -59
- package/es/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +33 -37
- package/es/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +25 -29
- package/es/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +32 -36
- package/es/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +17 -19
- package/es/networkTopo/components/Link/hook.js +73 -77
- package/es/networkTopo/components/Link/index.js +86 -94
- package/es/networkTopo/components/Link/setting.js +42 -44
- package/es/networkTopo/getTopoData.js +63 -69
- package/es/networkTopo/hooks/viewer/useRelateTopo.js +30 -32
- package/es/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
- package/es/networkTopo/models/TopoCenter.js +18 -22
- package/es/networkTopo/services/alert.js +18 -22
- package/es/networkTopo/services/authorization.js +45 -55
- package/es/networkTopo/services/cmdb.js +422 -470
- package/es/networkTopo/services/funcAuth.js +22 -24
- package/es/networkTopo/services/link.js +107 -117
- package/es/networkTopo/services/mdc.js +18 -24
- package/es/networkTopo/services/metric.js +23 -27
- package/es/networkTopo/services/model.js +445 -509
- package/es/networkTopo/services/risk.js +9 -11
- package/es/networkTopo/services/topo/auth.js +27 -33
- package/es/networkTopo/services/topo/basic.js +251 -289
- package/es/networkTopo/services/topo/blacklist.js +20 -24
- package/es/networkTopo/services/topo/ciInfo.js +27 -31
- package/es/networkTopo/services/topo/icon.js +49 -59
- package/es/networkTopo/services/topo/networkLink.js +32 -36
- package/es/networkTopo/services/topo/relation.js +9 -11
- package/es/networkTopo/services/topo/resourceWebUrl.js +36 -42
- package/es/networkTopo/store/functionAuth.js +31 -37
- package/es/networkTopo/store/topoCenter.js +142 -152
- package/es/networkTopo/store/topoLinkMod.js +4 -6
- package/es/networkTopo/store/topoTreeMod.js +170 -182
- package/es/networkTopo/utils/exportData.js +52 -54
- package/lib/components/MultiResourceDrawer/index.js +16 -18
- package/lib/components/ResourceList/ResourceSelect.js +48 -50
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +27 -29
- package/lib/components/SingleResourceDrawer/SelectDrawer.js +18 -20
- package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +30 -32
- package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +78 -84
- package/lib/core/components/titlebar/widgets/TitleWidget.js +5 -3
- package/lib/core/editor/components/BackgroundView/UploadDialog/index.js +15 -17
- package/lib/core/editor/components/BackgroundView/index.js +118 -128
- package/lib/core/editor/components/CustomIconPlugin/RenameDialog.js +22 -24
- package/lib/core/editor/components/CustomIconPlugin/UploadIconDialog.js +31 -33
- package/lib/core/editor/components/CustomIconPlugin/utils/svgToShape.js +19 -21
- package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +8 -10
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +37 -41
- package/lib/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +50 -54
- package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +50 -54
- package/lib/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +12 -14
- package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +26 -28
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +15 -17
- package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +12 -14
- package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +25 -31
- package/lib/core/editor/hooks/useKeyboardShortcut.js +2 -2
- package/lib/core/editor/hooks/useNewElementTheme.js +2 -2
- package/lib/core/editor/store/background.js +8 -10
- package/lib/core/editor/store/topoEdit.js +4 -6
- package/lib/core/editor/utils/edgeTypeStyleUtil.js +2 -4
- package/lib/core/hooks/usePolling.js +116 -120
- package/lib/core/hooks/useResourceConfig.js +58 -66
- package/lib/core/hooks/useTopoEdit.js +469 -499
- package/lib/core/models/Alarm.js +275 -292
- package/lib/core/models/AttributeMetricDisplay.js +104 -110
- package/lib/core/models/PluginManager.js +4 -3
- package/lib/core/models/SelectionModel.js +4 -5
- package/lib/core/models/TopoApp.js +205 -240
- package/lib/core/models/TopoGraphView.js +18 -21
- package/lib/core/models/cache/CiCache.js +33 -32
- package/lib/core/models/cache/CiTypeCache.js +38 -42
- package/lib/core/models/cache/DictCache.js +33 -35
- package/lib/core/models/graph/Background.js +16 -18
- package/lib/core/models/plugins/resourceWebControllUrl.js +74 -80
- package/lib/core/models/tagstips/ElementTagTipConfig.js +34 -38
- package/lib/core/models/topoData.js +69 -71
- package/lib/core/models/utils/linkUtils.js +41 -43
- package/lib/core/models/utils/nodeNameVisibleUtil.js +4 -4
- package/lib/core/services/alarm.js +18 -20
- package/lib/core/services/background.js +70 -78
- package/lib/core/services/cmdb/metric.js +10 -12
- package/lib/core/services/cmdb.js +20 -22
- package/lib/core/services/index.js +45 -51
- package/lib/core/services/overview.js +131 -151
- package/lib/core/services/topo/basic.js +37 -41
- package/lib/core/services/topo/tagtip.js +12 -14
- package/lib/core/store/models/ciModel.js +66 -70
- package/lib/core/store/models/customIcon.js +120 -134
- package/lib/core/store/models/displayConfig.js +15 -19
- package/lib/core/store/models/selection.js +4 -6
- package/lib/core/store/models/topoAlarm.js +163 -145
- package/lib/core/store/models/topoBaseInfoOverview.js +4 -6
- package/lib/core/store/models/topoBizMod.js +9 -11
- package/lib/core/store/models/topoConfig.js +222 -238
- package/lib/core/store/models/topoGraphView.js +4 -6
- package/lib/core/store/models/topoMod.js +375 -397
- package/lib/core/utils/imageUtil.js +22 -24
- package/lib/core/utils/saveSerialize.js +9 -11
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +56 -58
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +15 -17
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +344 -358
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +86 -92
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +41 -43
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +190 -206
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +109 -111
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +57 -59
- package/lib/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +29 -33
- package/lib/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +25 -29
- package/lib/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +32 -36
- package/lib/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +18 -20
- package/lib/networkTopo/components/Link/hook.js +73 -77
- package/lib/networkTopo/components/Link/index.js +87 -95
- package/lib/networkTopo/components/Link/setting.js +42 -44
- package/lib/networkTopo/getTopoData.js +63 -69
- package/lib/networkTopo/hooks/viewer/useRelateTopo.js +31 -33
- package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
- package/lib/networkTopo/models/TopoCenter.js +18 -22
- package/lib/networkTopo/services/alert.js +18 -22
- package/lib/networkTopo/services/authorization.js +55 -65
- package/lib/networkTopo/services/cmdb.js +422 -470
- package/lib/networkTopo/services/funcAuth.js +24 -26
- package/lib/networkTopo/services/link.js +108 -118
- package/lib/networkTopo/services/mdc.js +21 -27
- package/lib/networkTopo/services/metric.js +27 -31
- package/lib/networkTopo/services/model.js +445 -509
- package/lib/networkTopo/services/risk.js +11 -13
- package/lib/networkTopo/services/topo/auth.js +27 -33
- package/lib/networkTopo/services/topo/basic.js +252 -290
- package/lib/networkTopo/services/topo/blacklist.js +20 -24
- package/lib/networkTopo/services/topo/ciInfo.js +34 -38
- package/lib/networkTopo/services/topo/icon.js +59 -69
- package/lib/networkTopo/services/topo/networkLink.js +32 -36
- package/lib/networkTopo/services/topo/relation.js +11 -13
- package/lib/networkTopo/services/topo/resourceWebUrl.js +44 -50
- package/lib/networkTopo/store/functionAuth.js +31 -37
- package/lib/networkTopo/store/topoCenter.js +142 -152
- package/lib/networkTopo/store/topoLinkMod.js +4 -6
- package/lib/networkTopo/store/topoTreeMod.js +166 -178
- package/lib/networkTopo/utils/exportData.js +59 -61
- package/lib/utils/htElementDataUtil.js +4 -2
- package/package.json +2 -2
@@ -106,38 +106,36 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
106
106
|
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_ref) {
|
107
107
|
var target, direction, config;
|
108
108
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
109
|
-
while (1) {
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
topo.historyManager.beginTransaction(); // 从拓扑图获取分层和资源配置
|
109
|
+
while (1) switch (_context.prev = _context.next) {
|
110
|
+
case 0:
|
111
|
+
target = _ref.target, direction = _ref.direction;
|
112
|
+
topo.historyManager.beginTransaction(); // 从拓扑图获取分层和资源配置
|
114
113
|
|
115
|
-
|
114
|
+
config = resourceConfig.getConfigFromHt(topo.getDataModel());
|
116
115
|
|
117
|
-
|
118
|
-
|
119
|
-
|
116
|
+
_rlog["default"].info("onLayerAdd", {
|
117
|
+
config: config
|
118
|
+
}); // 如果非分层拓扑且有分层,切换到分层模板,设置方向
|
120
119
|
|
121
120
|
|
122
|
-
|
123
|
-
_context.next = 7;
|
124
|
-
break;
|
125
|
-
}
|
126
|
-
|
121
|
+
if (!(!isLayerTopo && config.layers.length)) {
|
127
122
|
_context.next = 7;
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
123
|
+
break;
|
124
|
+
}
|
125
|
+
|
126
|
+
_context.next = 7;
|
127
|
+
return topoDispatchers.setTopoType(_template.TPL_TREE);
|
128
|
+
|
129
|
+
case 7:
|
130
|
+
// 更新配置
|
131
|
+
// resourceConfig.updateConfig(config);
|
132
|
+
// 更新配置对应的资源、链路
|
133
|
+
// editDispatchers.fetchDataByConfig();
|
134
|
+
topo.historyManager.endTransaction();
|
135
|
+
|
136
|
+
case 8:
|
137
|
+
case "end":
|
138
|
+
return _context.stop();
|
141
139
|
}
|
142
140
|
}, _callee);
|
143
141
|
}));
|
@@ -151,42 +149,40 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
151
149
|
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(layerElement) {
|
152
150
|
var config;
|
153
151
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
154
|
-
while (1) {
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
emitEvent(_componentTopologyGraph.TopoEvent.EVENT_TRIGGER_DELETE, layerElement); // 获取资源配置
|
159
|
-
|
160
|
-
config = resourceConfig.getConfigFromHt(topo.getDataModel());
|
152
|
+
while (1) switch (_context2.prev = _context2.next) {
|
153
|
+
case 0:
|
154
|
+
topo.historyManager.beginTransaction();
|
155
|
+
emitEvent(_componentTopologyGraph.TopoEvent.EVENT_TRIGGER_DELETE, layerElement); // 获取资源配置
|
161
156
|
|
162
|
-
|
163
|
-
config: config
|
164
|
-
}); // 如果没有分层,将拓扑类型切换为空白模板
|
157
|
+
config = resourceConfig.getConfigFromHt(topo.getDataModel());
|
165
158
|
|
159
|
+
_rlog["default"].info("deleteLayer", {
|
160
|
+
config: config
|
161
|
+
}); // 如果没有分层,将拓扑类型切换为空白模板
|
166
162
|
|
167
|
-
if (config.layers.length) {
|
168
|
-
_context2.next = 7;
|
169
|
-
break;
|
170
|
-
}
|
171
163
|
|
164
|
+
if (config.layers.length) {
|
172
165
|
_context2.next = 7;
|
173
|
-
|
166
|
+
break;
|
167
|
+
}
|
174
168
|
|
175
|
-
|
176
|
-
|
177
|
-
return resourceConfig.updateConfig(config);
|
169
|
+
_context2.next = 7;
|
170
|
+
return topoDispatchers.setTopoType(_template.TPL_BLANK);
|
178
171
|
|
179
|
-
|
180
|
-
|
181
|
-
|
172
|
+
case 7:
|
173
|
+
_context2.next = 9;
|
174
|
+
return resourceConfig.updateConfig(config);
|
182
175
|
|
183
|
-
|
184
|
-
|
176
|
+
case 9:
|
177
|
+
_context2.next = 11;
|
178
|
+
return editDispatchers.fetchDataByConfig();
|
185
179
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
180
|
+
case 11:
|
181
|
+
topo.historyManager.endTransaction();
|
182
|
+
|
183
|
+
case 12:
|
184
|
+
case "end":
|
185
|
+
return _context2.stop();
|
190
186
|
}
|
191
187
|
}, _callee2);
|
192
188
|
}));
|
@@ -217,15 +213,13 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
217
213
|
onOk: function () {
|
218
214
|
var _onOk = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
219
215
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
220
|
-
while (1) {
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
return _context3.stop();
|
228
|
-
}
|
216
|
+
while (1) switch (_context3.prev = _context3.next) {
|
217
|
+
case 0:
|
218
|
+
deleteLayer(layerElement);
|
219
|
+
|
220
|
+
case 1:
|
221
|
+
case "end":
|
222
|
+
return _context3.stop();
|
229
223
|
}
|
230
224
|
}, _callee3);
|
231
225
|
}));
|
@@ -391,35 +385,33 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
391
385
|
|
392
386
|
var config, edges, exportLinkIdList;
|
393
387
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
394
|
-
while (1) {
|
395
|
-
|
396
|
-
|
397
|
-
config = resourceConfig.getConfig(); // console.log("删除关联在节点上的出口链路- node, config", node, config);
|
398
|
-
|
399
|
-
edges = (_node$getEdges$toArra = (_node$getEdges = node.getEdges()) === null || _node$getEdges === void 0 ? void 0 : _node$getEdges.toArray()) !== null && _node$getEdges$toArra !== void 0 ? _node$getEdges$toArra : []; // const exLink = [];
|
400
|
-
|
401
|
-
if (!(edges.length > 0)) {
|
402
|
-
_context4.next = 8;
|
403
|
-
break;
|
404
|
-
}
|
388
|
+
while (1) switch (_context4.prev = _context4.next) {
|
389
|
+
case 0:
|
390
|
+
config = resourceConfig.getConfig(); // console.log("删除关联在节点上的出口链路- node, config", node, config);
|
405
391
|
|
406
|
-
|
392
|
+
edges = (_node$getEdges$toArra = (_node$getEdges = node.getEdges()) === null || _node$getEdges === void 0 ? void 0 : _node$getEdges.toArray()) !== null && _node$getEdges$toArra !== void 0 ? _node$getEdges$toArra : []; // const exLink = [];
|
407
393
|
|
408
|
-
|
409
|
-
if (edge.a("dtype") === "link" && exportLinkIdList.indexOf(edge.getTag()) >= 0) {
|
410
|
-
// exLink.push(edge);
|
411
|
-
topo.getGraphView().dm().remove(edge);
|
412
|
-
exportLinkIdList.splice(config.exportLinkIdList.indexOf(edge.getTag()), 1);
|
413
|
-
}
|
414
|
-
});
|
415
|
-
config.exportLinkIdList = exportLinkIdList;
|
394
|
+
if (!(edges.length > 0)) {
|
416
395
|
_context4.next = 8;
|
417
|
-
|
396
|
+
break;
|
397
|
+
}
|
418
398
|
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
399
|
+
exportLinkIdList = [].concat(config.exportLinkIdList); //console.log("删除关联在节点上的出口链路- edges", edges,exportLinkIdList);
|
400
|
+
|
401
|
+
edges.map(function (edge) {
|
402
|
+
if (edge.a("dtype") === "link" && exportLinkIdList.indexOf(edge.getTag()) >= 0) {
|
403
|
+
// exLink.push(edge);
|
404
|
+
topo.getGraphView().dm().remove(edge);
|
405
|
+
exportLinkIdList.splice(config.exportLinkIdList.indexOf(edge.getTag()), 1);
|
406
|
+
}
|
407
|
+
});
|
408
|
+
config.exportLinkIdList = exportLinkIdList;
|
409
|
+
_context4.next = 8;
|
410
|
+
return resourceConfig.updateConfig(config);
|
411
|
+
|
412
|
+
case 8:
|
413
|
+
case "end":
|
414
|
+
return _context4.stop();
|
423
415
|
}
|
424
416
|
}, _callee4);
|
425
417
|
}));
|
@@ -511,43 +503,41 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
511
503
|
var id, tag, _yield$editDispatcher2, elements, nodeElements, newLinkElements, updateElements;
|
512
504
|
|
513
505
|
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
514
|
-
while (1) {
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
topo.linkDynamicStyleExecutor.execute();
|
542
|
-
}
|
506
|
+
while (1) switch (_context10.prev = _context10.next) {
|
507
|
+
case 0:
|
508
|
+
id = group.id, tag = group.tag;
|
509
|
+
|
510
|
+
_rlog["default"].debug("bindGroupResources--id, tag", id, tag);
|
511
|
+
|
512
|
+
topo.historyManager.beginTransaction();
|
513
|
+
_context10.next = 5;
|
514
|
+
return resourceConfig.updateGroupResources(group, resources);
|
515
|
+
|
516
|
+
case 5:
|
517
|
+
_context10.next = 7;
|
518
|
+
return editDispatchers.fetchDataByConfig();
|
519
|
+
|
520
|
+
case 7:
|
521
|
+
_yield$editDispatcher2 = _context10.sent;
|
522
|
+
elements = _yield$editDispatcher2.elements;
|
523
|
+
// 区域里的子区域及子区域的节点、新增的链路
|
524
|
+
nodeElements = (0, _topoData.findGroupChildren)(elements, group);
|
525
|
+
newLinkElements = findUNExistedLinkElements(elements);
|
526
|
+
updateElements = [].concat(nodeElements, newLinkElements);
|
527
|
+
|
528
|
+
if (updateElements.length) {
|
529
|
+
saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_CONTAINER, updateElements); // 临时放这里,仅拓扑中心有
|
530
|
+
|
531
|
+
if (topo.linkDynamicStyleExecutor) {
|
532
|
+
topo.linkDynamicStyleExecutor.execute();
|
543
533
|
}
|
534
|
+
}
|
544
535
|
|
545
|
-
|
536
|
+
topo.historyManager.endTransaction();
|
546
537
|
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
}
|
538
|
+
case 14:
|
539
|
+
case "end":
|
540
|
+
return _context10.stop();
|
551
541
|
}
|
552
542
|
}, _callee10);
|
553
543
|
}));
|
@@ -566,24 +556,22 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
566
556
|
_addGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(group, newResourceIds) {
|
567
557
|
var groupConfig, resources, groupData;
|
568
558
|
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
569
|
-
while (1) {
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
resources
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
return _context11.stop();
|
586
|
-
}
|
559
|
+
while (1) switch (_context11.prev = _context11.next) {
|
560
|
+
case 0:
|
561
|
+
groupConfig = resourceConfig.getGroupConfigByElement(group);
|
562
|
+
resources = {
|
563
|
+
"static": [].concat(groupConfig.resources["static"], newResourceIds)
|
564
|
+
};
|
565
|
+
groupData = {
|
566
|
+
id: group.getTag(),
|
567
|
+
tag: group.a("tag")
|
568
|
+
};
|
569
|
+
_context11.next = 5;
|
570
|
+
return bindGroupResources(groupData, resources);
|
571
|
+
|
572
|
+
case 5:
|
573
|
+
case "end":
|
574
|
+
return _context11.stop();
|
587
575
|
}
|
588
576
|
}, _callee11);
|
589
577
|
}));
|
@@ -606,36 +594,34 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
606
594
|
var config, result, _elements;
|
607
595
|
|
608
596
|
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
609
|
-
while (1) {
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
topo.linkDynamicStyleExecutor.execute();
|
632
|
-
}
|
597
|
+
while (1) switch (_context12.prev = _context12.next) {
|
598
|
+
case 0:
|
599
|
+
// console.log("关联视图的资源", data);
|
600
|
+
config = resourceConfig.getConfig();
|
601
|
+
config.resources = data;
|
602
|
+
_context12.next = 4;
|
603
|
+
return resourceConfig.updateConfig(config);
|
604
|
+
|
605
|
+
case 4:
|
606
|
+
_context12.next = 6;
|
607
|
+
return editDispatchers.fetchDataByConfig();
|
608
|
+
|
609
|
+
case 6:
|
610
|
+
result = _context12.sent;
|
611
|
+
console.log("fetchDataByConfig", result);
|
612
|
+
|
613
|
+
if (result) {
|
614
|
+
_elements = result.elements;
|
615
|
+
saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, _elements); // 临时放这里,仅拓扑中心有
|
616
|
+
|
617
|
+
if (topo.linkDynamicStyleExecutor) {
|
618
|
+
topo.linkDynamicStyleExecutor.execute();
|
633
619
|
}
|
620
|
+
}
|
634
621
|
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
}
|
622
|
+
case 9:
|
623
|
+
case "end":
|
624
|
+
return _context12.stop();
|
639
625
|
}
|
640
626
|
}, _callee12);
|
641
627
|
}));
|
@@ -651,46 +637,44 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
651
637
|
var _yield$editDispatcher3, elements, newElements;
|
652
638
|
|
653
639
|
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
654
|
-
while (1) {
|
655
|
-
|
656
|
-
|
657
|
-
topo.historyManager.beginTransaction(); // 构造新的配置
|
658
|
-
|
659
|
-
_context13.next = 3;
|
660
|
-
return resourceConfig.addLayerStaticResources(group, newResourceIds);
|
661
|
-
|
662
|
-
case 3:
|
663
|
-
_context13.next = 5;
|
664
|
-
return editDispatchers.fetchDataByConfig();
|
665
|
-
|
666
|
-
case 5:
|
667
|
-
_yield$editDispatcher3 = _context13.sent;
|
668
|
-
elements = _yield$editDispatcher3.elements;
|
669
|
-
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
670
|
-
newElements = findUNExistedElements(elements);
|
671
|
-
|
672
|
-
_rlog["default"].debug("添加分层资源", {
|
673
|
-
layer: group,
|
674
|
-
newElements: newElements
|
675
|
-
});
|
640
|
+
while (1) switch (_context13.prev = _context13.next) {
|
641
|
+
case 0:
|
642
|
+
topo.historyManager.beginTransaction(); // 构造新的配置
|
676
643
|
|
677
|
-
|
644
|
+
_context13.next = 3;
|
645
|
+
return resourceConfig.addLayerStaticResources(group, newResourceIds);
|
678
646
|
|
679
|
-
|
680
|
-
|
681
|
-
|
647
|
+
case 3:
|
648
|
+
_context13.next = 5;
|
649
|
+
return editDispatchers.fetchDataByConfig();
|
682
650
|
|
683
|
-
|
684
|
-
|
651
|
+
case 5:
|
652
|
+
_yield$editDispatcher3 = _context13.sent;
|
653
|
+
elements = _yield$editDispatcher3.elements;
|
654
|
+
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
655
|
+
newElements = findUNExistedElements(elements);
|
685
656
|
|
686
|
-
|
687
|
-
|
688
|
-
|
657
|
+
_rlog["default"].debug("添加分层资源", {
|
658
|
+
layer: group,
|
659
|
+
newElements: newElements
|
660
|
+
});
|
689
661
|
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
662
|
+
topo.getHtTopo().addElements(newElements); // 临时放这里,仅拓扑中心有
|
663
|
+
|
664
|
+
if (topo.linkDynamicStyleExecutor) {
|
665
|
+
topo.linkDynamicStyleExecutor.execute();
|
666
|
+
}
|
667
|
+
|
668
|
+
topo.historyManager.endTransaction();
|
669
|
+
topo.getHtTopo().getGraphView().fitContent(undefined, undefined, true); // 添加资源后隐藏资源面板
|
670
|
+
|
671
|
+
topoEditDispatchers.update({
|
672
|
+
resourceTabActiveKey: null
|
673
|
+
});
|
674
|
+
|
675
|
+
case 14:
|
676
|
+
case "end":
|
677
|
+
return _context13.stop();
|
694
678
|
}
|
695
679
|
}, _callee13);
|
696
680
|
}));
|
@@ -705,17 +689,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
705
689
|
_addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(data) {
|
706
690
|
var group;
|
707
691
|
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
708
|
-
while (1) {
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
return _context14.stop();
|
718
|
-
}
|
692
|
+
while (1) switch (_context14.prev = _context14.next) {
|
693
|
+
case 0:
|
694
|
+
group = resourceConfig.getGroups()[0];
|
695
|
+
_context14.next = 3;
|
696
|
+
return addLayerResources(group, data);
|
697
|
+
|
698
|
+
case 3:
|
699
|
+
case "end":
|
700
|
+
return _context14.stop();
|
719
701
|
}
|
720
702
|
}, _callee14);
|
721
703
|
}));
|
@@ -751,40 +733,38 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
751
733
|
var onSaveComboRes = /*#__PURE__*/function () {
|
752
734
|
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(data) {
|
753
735
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
754
|
-
while (1) {
|
755
|
-
|
756
|
-
|
757
|
-
_rlog["default"].debug("关联资源-----onSaveComboRes", data);
|
736
|
+
while (1) switch (_context5.prev = _context5.next) {
|
737
|
+
case 0:
|
738
|
+
_rlog["default"].debug("关联资源-----onSaveComboRes", data);
|
758
739
|
|
759
|
-
|
740
|
+
topo.historyManager.beginTransaction();
|
760
741
|
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
742
|
+
if (!(getAddResourceType() === "addToFirstLayer")) {
|
743
|
+
_context5.next = 7;
|
744
|
+
break;
|
745
|
+
}
|
765
746
|
|
766
|
-
|
767
|
-
|
747
|
+
_context5.next = 5;
|
748
|
+
return addResourceToFirstLayer(data);
|
768
749
|
|
769
|
-
|
770
|
-
|
771
|
-
|
750
|
+
case 5:
|
751
|
+
_context5.next = 9;
|
752
|
+
break;
|
772
753
|
|
773
|
-
|
774
|
-
|
775
|
-
|
754
|
+
case 7:
|
755
|
+
_context5.next = 9;
|
756
|
+
return bindViewResources(data);
|
776
757
|
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
758
|
+
case 9:
|
759
|
+
topo.historyManager.endTransaction();
|
760
|
+
topo.getHtTopo().fitContent();
|
761
|
+
topoEditDispatchers.update({
|
762
|
+
resourceTabActiveKey: null
|
763
|
+
});
|
783
764
|
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
}
|
765
|
+
case 12:
|
766
|
+
case "end":
|
767
|
+
return _context5.stop();
|
788
768
|
}
|
789
769
|
}, _callee5);
|
790
770
|
}));
|
@@ -799,51 +779,47 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
799
779
|
var id, config, serialize, _config$layout, template, layout, saveConfig;
|
800
780
|
|
801
781
|
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
802
|
-
while (1) {
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
}
|
828
|
-
}, _callee6);
|
829
|
-
}));
|
830
|
-
|
831
|
-
return function saveConfig() {
|
832
|
-
return _ref7.apply(this, arguments);
|
833
|
-
};
|
834
|
-
}();
|
835
|
-
|
836
|
-
onSave({
|
837
|
-
topo: topo,
|
838
|
-
data: data,
|
839
|
-
saveConfig: saveConfig
|
840
|
-
});
|
841
|
-
}
|
782
|
+
while (1) switch (_context7.prev = _context7.next) {
|
783
|
+
case 0:
|
784
|
+
id = data.id, config = data.config, serialize = data.serialize;
|
785
|
+
_config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
|
786
|
+
|
787
|
+
if (onSave) {
|
788
|
+
// 自定义保存
|
789
|
+
saveConfig = /*#__PURE__*/function () {
|
790
|
+
var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
791
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
792
|
+
while (1) switch (_context6.prev = _context6.next) {
|
793
|
+
case 0:
|
794
|
+
_context6.next = 2;
|
795
|
+
return editDispatchers.saveTopo({
|
796
|
+
id: id,
|
797
|
+
layout: layout,
|
798
|
+
serialize: serialize
|
799
|
+
});
|
800
|
+
|
801
|
+
case 2:
|
802
|
+
case "end":
|
803
|
+
return _context6.stop();
|
804
|
+
}
|
805
|
+
}, _callee6);
|
806
|
+
}));
|
842
807
|
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
808
|
+
return function saveConfig() {
|
809
|
+
return _ref7.apply(this, arguments);
|
810
|
+
};
|
811
|
+
}();
|
812
|
+
|
813
|
+
onSave({
|
814
|
+
topo: topo,
|
815
|
+
data: data,
|
816
|
+
saveConfig: saveConfig
|
817
|
+
});
|
818
|
+
}
|
819
|
+
|
820
|
+
case 3:
|
821
|
+
case "end":
|
822
|
+
return _context7.stop();
|
847
823
|
}
|
848
824
|
}, _callee7);
|
849
825
|
}));
|
@@ -881,185 +857,181 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
881
857
|
var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
|
882
858
|
|
883
859
|
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
884
|
-
while (1) {
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
_doBind = function
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
if (ele) {
|
915
|
-
existedGroupChildren.push(groupChildData);
|
916
|
-
} else {
|
917
|
-
newGroupChildren.push(groupChildData);
|
918
|
-
}
|
919
|
-
});
|
920
|
-
createElementsData = {
|
921
|
-
groups: [newData],
|
922
|
-
nodes: newGroupChildren,
|
923
|
-
links: newLinkElements.filter(function (item) {
|
924
|
-
return item.type === "link";
|
925
|
-
}),
|
926
|
-
linkGroups: newLinkElements.filter(function (item) {
|
927
|
-
return item.type === "linkGroup";
|
928
|
-
})
|
929
|
-
};
|
930
|
-
htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
|
931
|
-
|
932
|
-
groupElement = dm.getDataByTag(newData.id);
|
933
|
-
existedGroupChildren.forEach(function (groupChildData) {
|
934
|
-
var nodeElement = dm.getDataByTag(groupChildData.id);
|
935
|
-
nodeElement.setParent(groupElement);
|
936
|
-
});
|
860
|
+
while (1) switch (_context9.prev = _context9.next) {
|
861
|
+
case 0:
|
862
|
+
replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
|
863
|
+
return (0, _extends2["default"])({}, resources, {
|
864
|
+
"static": [].concat(resources["static"].filter(function (item) {
|
865
|
+
return item !== oldResId;
|
866
|
+
}), [newResId])
|
867
|
+
});
|
868
|
+
};
|
869
|
+
|
870
|
+
_doBind = function _doBind3() {
|
871
|
+
_doBind = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
872
|
+
var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
|
873
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
874
|
+
while (1) switch (_context8.prev = _context8.next) {
|
875
|
+
case 0:
|
876
|
+
dm = htTopo.getGraphView().dm(); // 创建
|
877
|
+
|
878
|
+
newLinkElements = findUNExistedLinkElements(elements);
|
879
|
+
createElementsData = null;
|
880
|
+
|
881
|
+
if (newData.type === "group") {
|
882
|
+
groupChildren = (0, _topoData.findGroupChildren)(elements, newData);
|
883
|
+
newGroupChildren = [];
|
884
|
+
existedGroupChildren = [];
|
885
|
+
groupChildren.forEach(function (groupChildData) {
|
886
|
+
var ele = dm.getDataByTag(groupChildData.id);
|
887
|
+
|
888
|
+
if (ele) {
|
889
|
+
existedGroupChildren.push(groupChildData);
|
937
890
|
} else {
|
938
|
-
|
939
|
-
groups: [],
|
940
|
-
nodes: [newData],
|
941
|
-
links: newLinkElements.filter(function (item) {
|
942
|
-
return item.type === "link";
|
943
|
-
}),
|
944
|
-
linkGroups: newLinkElements.filter(function (item) {
|
945
|
-
return item.type === "linkGroup";
|
946
|
-
})
|
947
|
-
};
|
948
|
-
htTopo.createElements(createElementsData);
|
891
|
+
newGroupChildren.push(groupChildData);
|
949
892
|
}
|
893
|
+
});
|
894
|
+
createElementsData = {
|
895
|
+
groups: [newData],
|
896
|
+
nodes: newGroupChildren,
|
897
|
+
links: newLinkElements.filter(function (item) {
|
898
|
+
return item.type === "link";
|
899
|
+
}),
|
900
|
+
linkGroups: newLinkElements.filter(function (item) {
|
901
|
+
return item.type === "linkGroup";
|
902
|
+
})
|
903
|
+
};
|
904
|
+
htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
|
905
|
+
|
906
|
+
groupElement = dm.getDataByTag(newData.id);
|
907
|
+
existedGroupChildren.forEach(function (groupChildData) {
|
908
|
+
var nodeElement = dm.getDataByTag(groupChildData.id);
|
909
|
+
nodeElement.setParent(groupElement);
|
910
|
+
});
|
911
|
+
} else {
|
912
|
+
createElementsData = {
|
913
|
+
groups: [],
|
914
|
+
nodes: [newData],
|
915
|
+
links: newLinkElements.filter(function (item) {
|
916
|
+
return item.type === "link";
|
917
|
+
}),
|
918
|
+
linkGroups: newLinkElements.filter(function (item) {
|
919
|
+
return item.type === "linkGroup";
|
920
|
+
})
|
921
|
+
};
|
922
|
+
htTopo.createElements(createElementsData);
|
923
|
+
}
|
950
924
|
|
951
|
-
|
952
|
-
|
925
|
+
_rlog["default"].debug("批量创建元素", createElementsData); // 恢复图标、大小、位置
|
953
926
|
|
954
|
-
newElement = dm.getDataByTag(newData.id);
|
955
927
|
|
956
|
-
|
957
|
-
newElement.setSize(node.getSize());
|
958
|
-
newElement.setPosition(node.getPosition());
|
959
|
-
newElement.setImage(node.getImage());
|
960
|
-
} // 选中
|
928
|
+
newElement = dm.getDataByTag(newData.id);
|
961
929
|
|
930
|
+
if (newElement) {
|
931
|
+
newElement.setSize(node.getSize());
|
932
|
+
newElement.setPosition(node.getPosition());
|
933
|
+
newElement.setImage(node.getImage());
|
934
|
+
} // 选中
|
962
935
|
|
963
|
-
sm = htTopo.getGraphView().sm();
|
964
|
-
sm.setSelection([newElement]); // 移除旧节点
|
965
936
|
|
966
|
-
|
967
|
-
|
968
|
-
// 删除关联在节点上的出口链路
|
937
|
+
sm = htTopo.getGraphView().sm();
|
938
|
+
sm.setSelection([newElement]); // 移除旧节点
|
969
939
|
|
970
|
-
|
971
|
-
|
940
|
+
dm.remove(node); // saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, newDatas);
|
941
|
+
// node.a("customName", null);
|
942
|
+
// 删除关联在节点上的出口链路
|
972
943
|
|
973
|
-
|
974
|
-
|
975
|
-
if (topo.linkDynamicStyleExecutor) {
|
976
|
-
topo.linkDynamicStyleExecutor.execute();
|
977
|
-
}
|
944
|
+
_context8.next = 12;
|
945
|
+
return deleteExLink(node);
|
978
946
|
|
979
|
-
|
980
|
-
|
981
|
-
|
947
|
+
case 12:
|
948
|
+
// 临时放这里,仅拓扑中心有
|
949
|
+
if (topo.linkDynamicStyleExecutor) {
|
950
|
+
topo.linkDynamicStyleExecutor.execute();
|
982
951
|
}
|
983
|
-
}
|
984
|
-
}, _callee8);
|
985
|
-
}));
|
986
|
-
return _doBind.apply(this, arguments);
|
987
|
-
};
|
988
952
|
|
989
|
-
|
990
|
-
|
991
|
-
|
953
|
+
case 13:
|
954
|
+
case "end":
|
955
|
+
return _context8.stop();
|
956
|
+
}
|
957
|
+
}, _callee8);
|
958
|
+
}));
|
959
|
+
return _doBind.apply(this, arguments);
|
960
|
+
};
|
992
961
|
|
993
|
-
|
994
|
-
|
962
|
+
doBind = function _doBind2() {
|
963
|
+
return _doBind.apply(this, arguments);
|
964
|
+
};
|
995
965
|
|
996
|
-
|
966
|
+
topo.historyManager.beginTransaction();
|
967
|
+
id = params.id, oldResId = params.oldResId, newResId = params.newResId;
|
997
968
|
|
998
|
-
|
969
|
+
_rlog["default"].debug("bindNodeResource", params);
|
999
970
|
|
1000
|
-
|
1001
|
-
htTopo = topo.getHtTopo();
|
1002
|
-
config = resourceConfig.getConfig();
|
971
|
+
node = topo.getDataModel().getDataById(id); // 节点所属容器
|
1003
972
|
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
973
|
+
parentGroupElement = node.getParent();
|
974
|
+
htTopo = topo.getHtTopo();
|
975
|
+
config = resourceConfig.getConfig();
|
1007
976
|
|
1008
|
-
|
977
|
+
if (parentGroupElement) {
|
978
|
+
// 在容器中
|
979
|
+
groupId = parentGroupElement.getTag(); // 容器业务id
|
1009
980
|
|
1010
|
-
|
1011
|
-
// 匹配到容器,替换资源或增加
|
1012
|
-
if (g.id === groupId || g.tag === groupTag) {
|
1013
|
-
return (0, _extends2["default"])({}, g, {
|
1014
|
-
resources: replaceOrAddRes(g.resources, oldResId, newResId)
|
1015
|
-
});
|
1016
|
-
} // 未匹配到容器
|
981
|
+
groupTag = parentGroupElement.a("tag"); // 容器临时id
|
1017
982
|
|
983
|
+
config.groups = config.groups.map(function (g) {
|
984
|
+
// 匹配到容器,替换资源或增加
|
985
|
+
if (g.id === groupId || g.tag === groupTag) {
|
986
|
+
return (0, _extends2["default"])({}, g, {
|
987
|
+
resources: replaceOrAddRes(g.resources, oldResId, newResId)
|
988
|
+
});
|
989
|
+
} // 未匹配到容器
|
1018
990
|
|
1019
|
-
return g;
|
1020
|
-
});
|
1021
|
-
} else {
|
1022
|
-
// 在画布上
|
1023
|
-
config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
|
1024
|
-
}
|
1025
991
|
|
1026
|
-
|
1027
|
-
|
992
|
+
return g;
|
993
|
+
});
|
994
|
+
} else {
|
995
|
+
// 在画布上
|
996
|
+
config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
|
997
|
+
}
|
998
|
+
|
999
|
+
_context9.next = 13;
|
1000
|
+
return resourceConfig.updateConfig(config);
|
1028
1001
|
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1002
|
+
case 13:
|
1003
|
+
_context9.next = 15;
|
1004
|
+
return editDispatchers.fetchDataByConfig();
|
1032
1005
|
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1006
|
+
case 15:
|
1007
|
+
_yield$editDispatcher = _context9.sent;
|
1008
|
+
elements = _yield$editDispatcher.elements;
|
1009
|
+
newData = elements.find(function (item) {
|
1010
|
+
return item.id === newResId;
|
1011
|
+
});
|
1039
1012
|
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1013
|
+
if (newData) {
|
1014
|
+
_context9.next = 23;
|
1015
|
+
break;
|
1016
|
+
}
|
1044
1017
|
|
1045
|
-
|
1018
|
+
_message["default"].error("关联资源失败");
|
1046
1019
|
|
1047
|
-
|
1020
|
+
_rlog["default"].warn("关联资源失败");
|
1048
1021
|
|
1049
|
-
|
1050
|
-
|
1022
|
+
topo.historyManager.endTransaction();
|
1023
|
+
return _context9.abrupt("return", false);
|
1051
1024
|
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1025
|
+
case 23:
|
1026
|
+
_context9.next = 25;
|
1027
|
+
return doBind();
|
1055
1028
|
|
1056
|
-
|
1057
|
-
|
1029
|
+
case 25:
|
1030
|
+
topo.historyManager.endTransaction();
|
1058
1031
|
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
}
|
1032
|
+
case 26:
|
1033
|
+
case "end":
|
1034
|
+
return _context9.stop();
|
1063
1035
|
}
|
1064
1036
|
}, _callee9);
|
1065
1037
|
}));
|
@@ -1082,79 +1054,77 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1082
1054
|
var dm, isUnique, ip, configObj, configData, _elements2, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
1083
1055
|
|
1084
1056
|
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
1085
|
-
while (1) {
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
}
|
1092
|
-
|
1093
|
-
return _context15.abrupt("return");
|
1094
|
-
|
1095
|
-
case 2:
|
1096
|
-
// if (txtValue === nodeElement.a('bindIp')) {
|
1097
|
-
// return;
|
1098
|
-
// }
|
1099
|
-
// 根据配置查询拓扑数据
|
1100
|
-
dm = topo.getDataModel(); // 执行唯一性验证
|
1101
|
-
|
1102
|
-
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
|
1103
|
-
|
1104
|
-
if (!isUnique) {
|
1105
|
-
_context15.next = 24;
|
1106
|
-
break;
|
1107
|
-
}
|
1108
|
-
|
1109
|
-
ip = (0, _exitLinkUtil.buildIpNode)(txtValue);
|
1110
|
-
_context15.next = 8;
|
1111
|
-
return deleteExLink(nodeElement);
|
1057
|
+
while (1) switch (_context15.prev = _context15.next) {
|
1058
|
+
case 0:
|
1059
|
+
if (txtValue) {
|
1060
|
+
_context15.next = 2;
|
1061
|
+
break;
|
1062
|
+
}
|
1112
1063
|
|
1113
|
-
|
1114
|
-
nodeElement.a(ip);
|
1115
|
-
nodeElement.setName(txtValue);
|
1116
|
-
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
1064
|
+
return _context15.abrupt("return");
|
1117
1065
|
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1066
|
+
case 2:
|
1067
|
+
// if (txtValue === nodeElement.a('bindIp')) {
|
1068
|
+
// return;
|
1069
|
+
// }
|
1070
|
+
// 根据配置查询拓扑数据
|
1071
|
+
dm = topo.getDataModel(); // 执行唯一性验证
|
1121
1072
|
|
1122
|
-
|
1123
|
-
_context15.next = 16;
|
1124
|
-
return editDispatchers.fetchDataByConfig();
|
1073
|
+
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
|
1125
1074
|
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
newLinkElements = findUNExistedLinkElements(_elements2); // console.log("configData", configData, newLinkElements);
|
1075
|
+
if (!isUnique) {
|
1076
|
+
_context15.next = 24;
|
1077
|
+
break;
|
1078
|
+
}
|
1131
1079
|
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1080
|
+
ip = (0, _exitLinkUtil.buildIpNode)(txtValue);
|
1081
|
+
_context15.next = 8;
|
1082
|
+
return deleteExLink(nodeElement);
|
1083
|
+
|
1084
|
+
case 8:
|
1085
|
+
nodeElement.a(ip);
|
1086
|
+
nodeElement.setName(txtValue);
|
1087
|
+
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
1088
|
+
|
1089
|
+
configObj = topo.resourceConfig.getConfig();
|
1090
|
+
_context15.next = 14;
|
1091
|
+
return resourceConfig.updateConfig(configObj);
|
1092
|
+
|
1093
|
+
case 14:
|
1094
|
+
_context15.next = 16;
|
1095
|
+
return editDispatchers.fetchDataByConfig();
|
1096
|
+
|
1097
|
+
case 16:
|
1098
|
+
configData = _context15.sent;
|
1099
|
+
// console.log("configData",configObj, configData);
|
1100
|
+
_elements2 = configData.elements;
|
1101
|
+
newLinkElements = findUNExistedLinkElements(_elements2); // console.log("configData", configData, newLinkElements);
|
1102
|
+
|
1103
|
+
newLink = newLinkElements.filter(function (item) {
|
1104
|
+
return item.type === "link";
|
1105
|
+
});
|
1106
|
+
newLinkGroup = newLinkElements.filter(function (item) {
|
1107
|
+
return item.type === "linkGroup";
|
1108
|
+
}); // const newData = elements.find((item) => item.id === `ip:${txtValue}`);
|
1109
|
+
// console.log("newData",newLinkElements, newLink);
|
1110
|
+
|
1111
|
+
createElementsData = {
|
1112
|
+
groups: [],
|
1113
|
+
nodes: [],
|
1114
|
+
links: newLink,
|
1115
|
+
linkGroups: newLinkGroup
|
1116
|
+
};
|
1117
|
+
console.log("createElementsData", createElementsData);
|
1118
|
+
|
1119
|
+
if ([].concat(newLink, newLinkGroup).length > 0) {
|
1120
|
+
_htTopo = topo.getHtTopo();
|
1121
|
+
|
1122
|
+
_htTopo.createElements(createElementsData);
|
1123
|
+
}
|
1153
1124
|
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
}
|
1125
|
+
case 24:
|
1126
|
+
case "end":
|
1127
|
+
return _context15.stop();
|
1158
1128
|
}
|
1159
1129
|
}, _callee15);
|
1160
1130
|
}));
|