@riil-frontend/component-topology 11.0.34 → 12.0.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/1.js +2 -2
- package/build/2.js +1 -1
- package/build/index.css +4 -2
- package/build/index.js +57 -34
- package/es/components/BatchAttrMetric/setting.js +1 -1
- 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 +17 -18
- 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 +33 -34
- 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 +36 -32
- 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/copyElementUtil.js +171 -0
- 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 +473 -503
- 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 +20 -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/metricUtil.js +5 -0
- 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 +39 -41
- 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 +107 -109
- 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/BatchAttrMetric/setting.js +1 -1
- 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 +18 -18
- 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 +34 -34
- 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 +37 -34
- 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/copyElementUtil.js +182 -0
- 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 +465 -495
- 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 +22 -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/metricUtil.js +5 -0
- 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 +39 -41
- 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 +107 -109
- 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 +5 -3
@@ -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,32 +594,30 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
606
594
|
var config, _yield$editDispatcher3, 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
|
-
}
|
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
|
+
_yield$editDispatcher3 = _context12.sent;
|
611
|
+
elements = _yield$editDispatcher3.elements;
|
612
|
+
saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements); // 临时放这里,仅拓扑中心有
|
613
|
+
|
614
|
+
if (topo.linkDynamicStyleExecutor) {
|
615
|
+
topo.linkDynamicStyleExecutor.execute();
|
616
|
+
}
|
630
617
|
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
}
|
618
|
+
case 10:
|
619
|
+
case "end":
|
620
|
+
return _context12.stop();
|
635
621
|
}
|
636
622
|
}, _callee12);
|
637
623
|
}));
|
@@ -647,46 +633,44 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
647
633
|
var _yield$editDispatcher4, elements, newElements;
|
648
634
|
|
649
635
|
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
650
|
-
while (1) {
|
651
|
-
|
652
|
-
|
653
|
-
topo.historyManager.beginTransaction(); // 构造新的配置
|
654
|
-
|
655
|
-
_context13.next = 3;
|
656
|
-
return resourceConfig.addLayerStaticResources(group, newResourceIds);
|
657
|
-
|
658
|
-
case 3:
|
659
|
-
_context13.next = 5;
|
660
|
-
return editDispatchers.fetchDataByConfig();
|
661
|
-
|
662
|
-
case 5:
|
663
|
-
_yield$editDispatcher4 = _context13.sent;
|
664
|
-
elements = _yield$editDispatcher4.elements;
|
665
|
-
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
666
|
-
newElements = findUNExistedElements(elements);
|
667
|
-
|
668
|
-
_rlog["default"].debug("添加分层资源", {
|
669
|
-
layer: group,
|
670
|
-
newElements: newElements
|
671
|
-
});
|
636
|
+
while (1) switch (_context13.prev = _context13.next) {
|
637
|
+
case 0:
|
638
|
+
topo.historyManager.beginTransaction(); // 构造新的配置
|
672
639
|
|
673
|
-
|
640
|
+
_context13.next = 3;
|
641
|
+
return resourceConfig.addLayerStaticResources(group, newResourceIds);
|
674
642
|
|
675
|
-
|
676
|
-
|
677
|
-
|
643
|
+
case 3:
|
644
|
+
_context13.next = 5;
|
645
|
+
return editDispatchers.fetchDataByConfig();
|
678
646
|
|
679
|
-
|
680
|
-
|
647
|
+
case 5:
|
648
|
+
_yield$editDispatcher4 = _context13.sent;
|
649
|
+
elements = _yield$editDispatcher4.elements;
|
650
|
+
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
651
|
+
newElements = findUNExistedElements(elements);
|
681
652
|
|
682
|
-
|
683
|
-
|
684
|
-
|
653
|
+
_rlog["default"].debug("添加分层资源", {
|
654
|
+
layer: group,
|
655
|
+
newElements: newElements
|
656
|
+
});
|
685
657
|
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
658
|
+
topo.getHtTopo().addElements(newElements); // 临时放这里,仅拓扑中心有
|
659
|
+
|
660
|
+
if (topo.linkDynamicStyleExecutor) {
|
661
|
+
topo.linkDynamicStyleExecutor.execute();
|
662
|
+
}
|
663
|
+
|
664
|
+
topo.historyManager.endTransaction();
|
665
|
+
topo.getHtTopo().getGraphView().fitContent(undefined, undefined, true); // 添加资源后隐藏资源面板
|
666
|
+
|
667
|
+
topoEditDispatchers.update({
|
668
|
+
resourceTabActiveKey: null
|
669
|
+
});
|
670
|
+
|
671
|
+
case 14:
|
672
|
+
case "end":
|
673
|
+
return _context13.stop();
|
690
674
|
}
|
691
675
|
}, _callee13);
|
692
676
|
}));
|
@@ -701,17 +685,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
701
685
|
_addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(data) {
|
702
686
|
var group;
|
703
687
|
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
704
|
-
while (1) {
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
return _context14.stop();
|
714
|
-
}
|
688
|
+
while (1) switch (_context14.prev = _context14.next) {
|
689
|
+
case 0:
|
690
|
+
group = resourceConfig.getGroups()[0];
|
691
|
+
_context14.next = 3;
|
692
|
+
return addLayerResources(group, data);
|
693
|
+
|
694
|
+
case 3:
|
695
|
+
case "end":
|
696
|
+
return _context14.stop();
|
715
697
|
}
|
716
698
|
}, _callee14);
|
717
699
|
}));
|
@@ -747,40 +729,38 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
747
729
|
var onSaveComboRes = /*#__PURE__*/function () {
|
748
730
|
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(data) {
|
749
731
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
750
|
-
while (1) {
|
751
|
-
|
752
|
-
|
753
|
-
_rlog["default"].debug("关联资源-----onSaveComboRes", data);
|
732
|
+
while (1) switch (_context5.prev = _context5.next) {
|
733
|
+
case 0:
|
734
|
+
_rlog["default"].debug("关联资源-----onSaveComboRes", data);
|
754
735
|
|
755
|
-
|
736
|
+
topo.historyManager.beginTransaction();
|
756
737
|
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
738
|
+
if (!(getAddResourceType() === "addToFirstLayer")) {
|
739
|
+
_context5.next = 7;
|
740
|
+
break;
|
741
|
+
}
|
761
742
|
|
762
|
-
|
763
|
-
|
743
|
+
_context5.next = 5;
|
744
|
+
return addResourceToFirstLayer(data);
|
764
745
|
|
765
|
-
|
766
|
-
|
767
|
-
|
746
|
+
case 5:
|
747
|
+
_context5.next = 9;
|
748
|
+
break;
|
768
749
|
|
769
|
-
|
770
|
-
|
771
|
-
|
750
|
+
case 7:
|
751
|
+
_context5.next = 9;
|
752
|
+
return bindViewResources(data);
|
772
753
|
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
754
|
+
case 9:
|
755
|
+
topo.historyManager.endTransaction();
|
756
|
+
topo.getHtTopo().fitContent();
|
757
|
+
topoEditDispatchers.update({
|
758
|
+
resourceTabActiveKey: null
|
759
|
+
});
|
779
760
|
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
}
|
761
|
+
case 12:
|
762
|
+
case "end":
|
763
|
+
return _context5.stop();
|
784
764
|
}
|
785
765
|
}, _callee5);
|
786
766
|
}));
|
@@ -795,51 +775,47 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
795
775
|
var id, config, serialize, _config$layout, template, layout, saveConfig;
|
796
776
|
|
797
777
|
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
798
|
-
while (1) {
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
}
|
824
|
-
}, _callee6);
|
825
|
-
}));
|
826
|
-
|
827
|
-
return function saveConfig() {
|
828
|
-
return _ref7.apply(this, arguments);
|
829
|
-
};
|
830
|
-
}();
|
831
|
-
|
832
|
-
onSave({
|
833
|
-
topo: topo,
|
834
|
-
data: data,
|
835
|
-
saveConfig: saveConfig
|
836
|
-
});
|
837
|
-
}
|
778
|
+
while (1) switch (_context7.prev = _context7.next) {
|
779
|
+
case 0:
|
780
|
+
id = data.id, config = data.config, serialize = data.serialize;
|
781
|
+
_config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
|
782
|
+
|
783
|
+
if (onSave) {
|
784
|
+
// 自定义保存
|
785
|
+
saveConfig = /*#__PURE__*/function () {
|
786
|
+
var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
787
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
788
|
+
while (1) switch (_context6.prev = _context6.next) {
|
789
|
+
case 0:
|
790
|
+
_context6.next = 2;
|
791
|
+
return editDispatchers.saveTopo({
|
792
|
+
id: id,
|
793
|
+
layout: layout,
|
794
|
+
serialize: serialize
|
795
|
+
});
|
796
|
+
|
797
|
+
case 2:
|
798
|
+
case "end":
|
799
|
+
return _context6.stop();
|
800
|
+
}
|
801
|
+
}, _callee6);
|
802
|
+
}));
|
838
803
|
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
804
|
+
return function saveConfig() {
|
805
|
+
return _ref7.apply(this, arguments);
|
806
|
+
};
|
807
|
+
}();
|
808
|
+
|
809
|
+
onSave({
|
810
|
+
topo: topo,
|
811
|
+
data: data,
|
812
|
+
saveConfig: saveConfig
|
813
|
+
});
|
814
|
+
}
|
815
|
+
|
816
|
+
case 3:
|
817
|
+
case "end":
|
818
|
+
return _context7.stop();
|
843
819
|
}
|
844
820
|
}, _callee7);
|
845
821
|
}));
|
@@ -877,185 +853,181 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
877
853
|
var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
|
878
854
|
|
879
855
|
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
880
|
-
while (1) {
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
_doBind = function
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
if (ele) {
|
911
|
-
existedGroupChildren.push(groupChildData);
|
912
|
-
} else {
|
913
|
-
newGroupChildren.push(groupChildData);
|
914
|
-
}
|
915
|
-
});
|
916
|
-
createElementsData = {
|
917
|
-
groups: [newData],
|
918
|
-
nodes: newGroupChildren,
|
919
|
-
links: newLinkElements.filter(function (item) {
|
920
|
-
return item.type === "link";
|
921
|
-
}),
|
922
|
-
linkGroups: newLinkElements.filter(function (item) {
|
923
|
-
return item.type === "linkGroup";
|
924
|
-
})
|
925
|
-
};
|
926
|
-
htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
|
927
|
-
|
928
|
-
groupElement = dm.getDataByTag(newData.id);
|
929
|
-
existedGroupChildren.forEach(function (groupChildData) {
|
930
|
-
var nodeElement = dm.getDataByTag(groupChildData.id);
|
931
|
-
nodeElement.setParent(groupElement);
|
932
|
-
});
|
856
|
+
while (1) switch (_context9.prev = _context9.next) {
|
857
|
+
case 0:
|
858
|
+
replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
|
859
|
+
return (0, _extends2["default"])({}, resources, {
|
860
|
+
"static": [].concat(resources["static"].filter(function (item) {
|
861
|
+
return item !== oldResId;
|
862
|
+
}), [newResId])
|
863
|
+
});
|
864
|
+
};
|
865
|
+
|
866
|
+
_doBind = function _doBind3() {
|
867
|
+
_doBind = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
868
|
+
var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
|
869
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
870
|
+
while (1) switch (_context8.prev = _context8.next) {
|
871
|
+
case 0:
|
872
|
+
dm = htTopo.getGraphView().dm(); // 创建
|
873
|
+
|
874
|
+
newLinkElements = findUNExistedLinkElements(elements);
|
875
|
+
createElementsData = null;
|
876
|
+
|
877
|
+
if (newData.type === "group") {
|
878
|
+
groupChildren = (0, _topoData.findGroupChildren)(elements, newData);
|
879
|
+
newGroupChildren = [];
|
880
|
+
existedGroupChildren = [];
|
881
|
+
groupChildren.forEach(function (groupChildData) {
|
882
|
+
var ele = dm.getDataByTag(groupChildData.id);
|
883
|
+
|
884
|
+
if (ele) {
|
885
|
+
existedGroupChildren.push(groupChildData);
|
933
886
|
} else {
|
934
|
-
|
935
|
-
groups: [],
|
936
|
-
nodes: [newData],
|
937
|
-
links: newLinkElements.filter(function (item) {
|
938
|
-
return item.type === "link";
|
939
|
-
}),
|
940
|
-
linkGroups: newLinkElements.filter(function (item) {
|
941
|
-
return item.type === "linkGroup";
|
942
|
-
})
|
943
|
-
};
|
944
|
-
htTopo.createElements(createElementsData);
|
887
|
+
newGroupChildren.push(groupChildData);
|
945
888
|
}
|
889
|
+
});
|
890
|
+
createElementsData = {
|
891
|
+
groups: [newData],
|
892
|
+
nodes: newGroupChildren,
|
893
|
+
links: newLinkElements.filter(function (item) {
|
894
|
+
return item.type === "link";
|
895
|
+
}),
|
896
|
+
linkGroups: newLinkElements.filter(function (item) {
|
897
|
+
return item.type === "linkGroup";
|
898
|
+
})
|
899
|
+
};
|
900
|
+
htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
|
901
|
+
|
902
|
+
groupElement = dm.getDataByTag(newData.id);
|
903
|
+
existedGroupChildren.forEach(function (groupChildData) {
|
904
|
+
var nodeElement = dm.getDataByTag(groupChildData.id);
|
905
|
+
nodeElement.setParent(groupElement);
|
906
|
+
});
|
907
|
+
} else {
|
908
|
+
createElementsData = {
|
909
|
+
groups: [],
|
910
|
+
nodes: [newData],
|
911
|
+
links: newLinkElements.filter(function (item) {
|
912
|
+
return item.type === "link";
|
913
|
+
}),
|
914
|
+
linkGroups: newLinkElements.filter(function (item) {
|
915
|
+
return item.type === "linkGroup";
|
916
|
+
})
|
917
|
+
};
|
918
|
+
htTopo.createElements(createElementsData);
|
919
|
+
}
|
946
920
|
|
947
|
-
|
948
|
-
|
921
|
+
_rlog["default"].debug("批量创建元素", createElementsData); // 恢复图标、大小、位置
|
949
922
|
|
950
|
-
newElement = dm.getDataByTag(newData.id);
|
951
923
|
|
952
|
-
|
953
|
-
newElement.setSize(node.getSize());
|
954
|
-
newElement.setPosition(node.getPosition());
|
955
|
-
newElement.setImage(node.getImage());
|
956
|
-
} // 选中
|
924
|
+
newElement = dm.getDataByTag(newData.id);
|
957
925
|
|
926
|
+
if (newElement) {
|
927
|
+
newElement.setSize(node.getSize());
|
928
|
+
newElement.setPosition(node.getPosition());
|
929
|
+
newElement.setImage(node.getImage());
|
930
|
+
} // 选中
|
958
931
|
|
959
|
-
sm = htTopo.getGraphView().sm();
|
960
|
-
sm.setSelection([newElement]); // 移除旧节点
|
961
932
|
|
962
|
-
|
963
|
-
|
964
|
-
// 删除关联在节点上的出口链路
|
933
|
+
sm = htTopo.getGraphView().sm();
|
934
|
+
sm.setSelection([newElement]); // 移除旧节点
|
965
935
|
|
966
|
-
|
967
|
-
|
936
|
+
dm.remove(node); // saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, newDatas);
|
937
|
+
// node.a("customName", null);
|
938
|
+
// 删除关联在节点上的出口链路
|
968
939
|
|
969
|
-
|
970
|
-
|
971
|
-
if (topo.linkDynamicStyleExecutor) {
|
972
|
-
topo.linkDynamicStyleExecutor.execute();
|
973
|
-
}
|
940
|
+
_context8.next = 12;
|
941
|
+
return deleteExLink(node);
|
974
942
|
|
975
|
-
|
976
|
-
|
977
|
-
|
943
|
+
case 12:
|
944
|
+
// 临时放这里,仅拓扑中心有
|
945
|
+
if (topo.linkDynamicStyleExecutor) {
|
946
|
+
topo.linkDynamicStyleExecutor.execute();
|
978
947
|
}
|
979
|
-
}
|
980
|
-
}, _callee8);
|
981
|
-
}));
|
982
|
-
return _doBind.apply(this, arguments);
|
983
|
-
};
|
984
948
|
|
985
|
-
|
986
|
-
|
987
|
-
|
949
|
+
case 13:
|
950
|
+
case "end":
|
951
|
+
return _context8.stop();
|
952
|
+
}
|
953
|
+
}, _callee8);
|
954
|
+
}));
|
955
|
+
return _doBind.apply(this, arguments);
|
956
|
+
};
|
988
957
|
|
989
|
-
|
990
|
-
|
958
|
+
doBind = function _doBind2() {
|
959
|
+
return _doBind.apply(this, arguments);
|
960
|
+
};
|
991
961
|
|
992
|
-
|
962
|
+
topo.historyManager.beginTransaction();
|
963
|
+
id = params.id, oldResId = params.oldResId, newResId = params.newResId;
|
993
964
|
|
994
|
-
|
965
|
+
_rlog["default"].debug("bindNodeResource", params);
|
995
966
|
|
996
|
-
|
997
|
-
htTopo = topo.getHtTopo();
|
998
|
-
config = resourceConfig.getConfig();
|
967
|
+
node = topo.getDataModel().getDataById(id); // 节点所属容器
|
999
968
|
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
969
|
+
parentGroupElement = node.getParent();
|
970
|
+
htTopo = topo.getHtTopo();
|
971
|
+
config = resourceConfig.getConfig();
|
1003
972
|
|
1004
|
-
|
973
|
+
if (parentGroupElement) {
|
974
|
+
// 在容器中
|
975
|
+
groupId = parentGroupElement.getTag(); // 容器业务id
|
1005
976
|
|
1006
|
-
|
1007
|
-
// 匹配到容器,替换资源或增加
|
1008
|
-
if (g.id === groupId || g.tag === groupTag) {
|
1009
|
-
return (0, _extends2["default"])({}, g, {
|
1010
|
-
resources: replaceOrAddRes(g.resources, oldResId, newResId)
|
1011
|
-
});
|
1012
|
-
} // 未匹配到容器
|
977
|
+
groupTag = parentGroupElement.a("tag"); // 容器临时id
|
1013
978
|
|
979
|
+
config.groups = config.groups.map(function (g) {
|
980
|
+
// 匹配到容器,替换资源或增加
|
981
|
+
if (g.id === groupId || g.tag === groupTag) {
|
982
|
+
return (0, _extends2["default"])({}, g, {
|
983
|
+
resources: replaceOrAddRes(g.resources, oldResId, newResId)
|
984
|
+
});
|
985
|
+
} // 未匹配到容器
|
1014
986
|
|
1015
|
-
return g;
|
1016
|
-
});
|
1017
|
-
} else {
|
1018
|
-
// 在画布上
|
1019
|
-
config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
|
1020
|
-
}
|
1021
987
|
|
1022
|
-
|
1023
|
-
|
988
|
+
return g;
|
989
|
+
});
|
990
|
+
} else {
|
991
|
+
// 在画布上
|
992
|
+
config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
|
993
|
+
}
|
994
|
+
|
995
|
+
_context9.next = 13;
|
996
|
+
return resourceConfig.updateConfig(config);
|
1024
997
|
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
998
|
+
case 13:
|
999
|
+
_context9.next = 15;
|
1000
|
+
return editDispatchers.fetchDataByConfig();
|
1028
1001
|
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1002
|
+
case 15:
|
1003
|
+
_yield$editDispatcher = _context9.sent;
|
1004
|
+
elements = _yield$editDispatcher.elements;
|
1005
|
+
newData = elements.find(function (item) {
|
1006
|
+
return item.id === newResId;
|
1007
|
+
});
|
1035
1008
|
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1009
|
+
if (newData) {
|
1010
|
+
_context9.next = 23;
|
1011
|
+
break;
|
1012
|
+
}
|
1040
1013
|
|
1041
|
-
|
1014
|
+
_message["default"].error("关联资源失败");
|
1042
1015
|
|
1043
|
-
|
1016
|
+
_rlog["default"].warn("关联资源失败");
|
1044
1017
|
|
1045
|
-
|
1046
|
-
|
1018
|
+
topo.historyManager.endTransaction();
|
1019
|
+
return _context9.abrupt("return", false);
|
1047
1020
|
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1021
|
+
case 23:
|
1022
|
+
_context9.next = 25;
|
1023
|
+
return doBind();
|
1051
1024
|
|
1052
|
-
|
1053
|
-
|
1025
|
+
case 25:
|
1026
|
+
topo.historyManager.endTransaction();
|
1054
1027
|
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
}
|
1028
|
+
case 26:
|
1029
|
+
case "end":
|
1030
|
+
return _context9.stop();
|
1059
1031
|
}
|
1060
1032
|
}, _callee9);
|
1061
1033
|
}));
|
@@ -1078,78 +1050,76 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1078
1050
|
var dm, isUnique, ip, configObj, configData, _elements, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
1079
1051
|
|
1080
1052
|
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
1081
|
-
while (1) {
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
}
|
1088
|
-
|
1089
|
-
return _context15.abrupt("return");
|
1090
|
-
|
1091
|
-
case 2:
|
1092
|
-
// if (txtValue === nodeElement.a('bindIp')) {
|
1093
|
-
// return;
|
1094
|
-
// }
|
1095
|
-
// 根据配置查询拓扑数据
|
1096
|
-
dm = topo.getDataModel(); // 执行唯一性验证
|
1097
|
-
|
1098
|
-
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
|
1099
|
-
|
1100
|
-
if (!isUnique) {
|
1101
|
-
_context15.next = 23;
|
1102
|
-
break;
|
1103
|
-
}
|
1104
|
-
|
1105
|
-
ip = (0, _exitLinkUtil.buildIpNode)(txtValue);
|
1106
|
-
_context15.next = 8;
|
1107
|
-
return deleteExLink(nodeElement);
|
1053
|
+
while (1) switch (_context15.prev = _context15.next) {
|
1054
|
+
case 0:
|
1055
|
+
if (txtValue) {
|
1056
|
+
_context15.next = 2;
|
1057
|
+
break;
|
1058
|
+
}
|
1108
1059
|
|
1109
|
-
|
1110
|
-
nodeElement.a(ip);
|
1111
|
-
nodeElement.setName(txtValue);
|
1112
|
-
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
1060
|
+
return _context15.abrupt("return");
|
1113
1061
|
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1062
|
+
case 2:
|
1063
|
+
// if (txtValue === nodeElement.a('bindIp')) {
|
1064
|
+
// return;
|
1065
|
+
// }
|
1066
|
+
// 根据配置查询拓扑数据
|
1067
|
+
dm = topo.getDataModel(); // 执行唯一性验证
|
1117
1068
|
|
1118
|
-
|
1119
|
-
_context15.next = 16;
|
1120
|
-
return editDispatchers.fetchDataByConfig();
|
1069
|
+
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
|
1121
1070
|
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
newLinkElements = findUNExistedLinkElements(_elements); // console.log("configData", configData, newLinkElements);
|
1071
|
+
if (!isUnique) {
|
1072
|
+
_context15.next = 23;
|
1073
|
+
break;
|
1074
|
+
}
|
1127
1075
|
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1076
|
+
ip = (0, _exitLinkUtil.buildIpNode)(txtValue);
|
1077
|
+
_context15.next = 8;
|
1078
|
+
return deleteExLink(nodeElement);
|
1079
|
+
|
1080
|
+
case 8:
|
1081
|
+
nodeElement.a(ip);
|
1082
|
+
nodeElement.setName(txtValue);
|
1083
|
+
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
1084
|
+
|
1085
|
+
configObj = topo.resourceConfig.getConfig();
|
1086
|
+
_context15.next = 14;
|
1087
|
+
return resourceConfig.updateConfig(configObj);
|
1088
|
+
|
1089
|
+
case 14:
|
1090
|
+
_context15.next = 16;
|
1091
|
+
return editDispatchers.fetchDataByConfig();
|
1092
|
+
|
1093
|
+
case 16:
|
1094
|
+
configData = _context15.sent;
|
1095
|
+
// console.log("configData",configObj, configData);
|
1096
|
+
_elements = configData.elements;
|
1097
|
+
newLinkElements = findUNExistedLinkElements(_elements); // console.log("configData", configData, newLinkElements);
|
1098
|
+
|
1099
|
+
newLink = newLinkElements.filter(function (item) {
|
1100
|
+
return item.type === "link";
|
1101
|
+
});
|
1102
|
+
newLinkGroup = newLinkElements.filter(function (item) {
|
1103
|
+
return item.type === "linkGroup";
|
1104
|
+
}); // const newData = elements.find((item) => item.id === `ip:${txtValue}`);
|
1105
|
+
// console.log("newData",newLinkElements, newLink);
|
1106
|
+
|
1107
|
+
createElementsData = {
|
1108
|
+
groups: [],
|
1109
|
+
nodes: [],
|
1110
|
+
links: newLink,
|
1111
|
+
linkGroups: newLinkGroup
|
1112
|
+
}; // console.log("createElementsData", createElementsData);
|
1113
|
+
|
1114
|
+
if ([].concat(newLink, newLinkGroup).length > 0) {
|
1115
|
+
_htTopo = topo.getHtTopo();
|
1116
|
+
|
1117
|
+
_htTopo.createElements(createElementsData);
|
1118
|
+
}
|
1148
1119
|
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
}
|
1120
|
+
case 23:
|
1121
|
+
case "end":
|
1122
|
+
return _context15.stop();
|
1153
1123
|
}
|
1154
1124
|
}, _callee15);
|
1155
1125
|
}));
|