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