@riil-frontend/component-topology 11.0.30 → 11.0.31
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/Toolbar/widgets/IconSelect/index.module.scss +1 -1
- 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 +511 -476
- 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 +13 -11
- 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 +32 -28
- 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/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 +109 -107
- 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 +314 -274
- 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/Toolbar/widgets/IconSelect/index.module.scss +1 -1
- 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 +503 -468
- 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 +15 -13
- 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 +38 -34
- 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/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 +109 -107
- 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 +317 -277
- 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/package.json +3 -3
@@ -76,34 +76,36 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
76
76
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
77
77
|
var target, direction, config;
|
78
78
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
79
|
-
while (1)
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
79
|
+
while (1) {
|
80
|
+
switch (_context.prev = _context.next) {
|
81
|
+
case 0:
|
82
|
+
target = _ref.target, direction = _ref.direction;
|
83
|
+
topo.historyManager.beginTransaction(); // 从拓扑图获取分层和资源配置
|
84
|
+
|
85
|
+
config = resourceConfig.getConfigFromHt(topo.getDataModel());
|
86
|
+
rlog.info("onLayerAdd", {
|
87
|
+
config: config
|
88
|
+
}); // 如果非分层拓扑且有分层,切换到分层模板,设置方向
|
89
|
+
|
90
|
+
if (!(!isLayerTopo && config.layers.length)) {
|
91
|
+
_context.next = 7;
|
92
|
+
break;
|
93
|
+
}
|
88
94
|
|
89
|
-
if (!(!isLayerTopo && config.layers.length)) {
|
90
95
|
_context.next = 7;
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
case 8:
|
105
|
-
case "end":
|
106
|
-
return _context.stop();
|
96
|
+
return topoDispatchers.setTopoType(TPL_TREE);
|
97
|
+
|
98
|
+
case 7:
|
99
|
+
// 更新配置
|
100
|
+
// resourceConfig.updateConfig(config);
|
101
|
+
// 更新配置对应的资源、链路
|
102
|
+
// editDispatchers.fetchDataByConfig();
|
103
|
+
topo.historyManager.endTransaction();
|
104
|
+
|
105
|
+
case 8:
|
106
|
+
case "end":
|
107
|
+
return _context.stop();
|
108
|
+
}
|
107
109
|
}
|
108
110
|
}, _callee);
|
109
111
|
}));
|
@@ -117,38 +119,40 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
117
119
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(layerElement) {
|
118
120
|
var config;
|
119
121
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
120
|
-
while (1)
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
122
|
+
while (1) {
|
123
|
+
switch (_context2.prev = _context2.next) {
|
124
|
+
case 0:
|
125
|
+
topo.historyManager.beginTransaction();
|
126
|
+
emitEvent(TopoEvent.EVENT_TRIGGER_DELETE, layerElement); // 获取资源配置
|
127
|
+
|
128
|
+
config = resourceConfig.getConfigFromHt(topo.getDataModel());
|
129
|
+
rlog.info("deleteLayer", {
|
130
|
+
config: config
|
131
|
+
}); // 如果没有分层,将拓扑类型切换为空白模板
|
132
|
+
|
133
|
+
if (config.layers.length) {
|
134
|
+
_context2.next = 7;
|
135
|
+
break;
|
136
|
+
}
|
129
137
|
|
130
|
-
if (config.layers.length) {
|
131
138
|
_context2.next = 7;
|
132
|
-
|
133
|
-
}
|
139
|
+
return topoDispatchers.setTopoType(TPL_BLANK);
|
134
140
|
|
135
|
-
|
136
|
-
|
141
|
+
case 7:
|
142
|
+
_context2.next = 9;
|
143
|
+
return resourceConfig.updateConfig(config);
|
137
144
|
|
138
|
-
|
139
|
-
|
140
|
-
|
145
|
+
case 9:
|
146
|
+
_context2.next = 11;
|
147
|
+
return editDispatchers.fetchDataByConfig();
|
141
148
|
|
142
|
-
|
143
|
-
|
144
|
-
return editDispatchers.fetchDataByConfig();
|
149
|
+
case 11:
|
150
|
+
topo.historyManager.endTransaction();
|
145
151
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
case "end":
|
151
|
-
return _context2.stop();
|
152
|
+
case 12:
|
153
|
+
case "end":
|
154
|
+
return _context2.stop();
|
155
|
+
}
|
152
156
|
}
|
153
157
|
}, _callee2);
|
154
158
|
}));
|
@@ -179,13 +183,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
179
183
|
onOk: function () {
|
180
184
|
var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
181
185
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
182
|
-
while (1)
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
186
|
+
while (1) {
|
187
|
+
switch (_context3.prev = _context3.next) {
|
188
|
+
case 0:
|
189
|
+
deleteLayer(layerElement);
|
190
|
+
|
191
|
+
case 1:
|
192
|
+
case "end":
|
193
|
+
return _context3.stop();
|
194
|
+
}
|
189
195
|
}
|
190
196
|
}, _callee3);
|
191
197
|
}));
|
@@ -351,33 +357,35 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
351
357
|
|
352
358
|
var config, edges, exportLinkIdList;
|
353
359
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
354
|
-
while (1)
|
355
|
-
|
356
|
-
|
360
|
+
while (1) {
|
361
|
+
switch (_context4.prev = _context4.next) {
|
362
|
+
case 0:
|
363
|
+
config = resourceConfig.getConfig(); // console.log("删除关联在节点上的出口链路- node, config", node, config);
|
357
364
|
|
358
|
-
|
365
|
+
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 = [];
|
359
366
|
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
367
|
+
if (!(edges.length > 0)) {
|
368
|
+
_context4.next = 8;
|
369
|
+
break;
|
370
|
+
}
|
364
371
|
|
365
|
-
|
372
|
+
exportLinkIdList = [].concat(config.exportLinkIdList); //console.log("删除关联在节点上的出口链路- edges", edges,exportLinkIdList);
|
366
373
|
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
374
|
+
edges.map(function (edge) {
|
375
|
+
if (edge.a("dtype") === "link" && exportLinkIdList.indexOf(edge.getTag()) >= 0) {
|
376
|
+
// exLink.push(edge);
|
377
|
+
topo.getGraphView().dm().remove(edge);
|
378
|
+
exportLinkIdList.splice(config.exportLinkIdList.indexOf(edge.getTag()), 1);
|
379
|
+
}
|
380
|
+
});
|
381
|
+
config.exportLinkIdList = exportLinkIdList;
|
382
|
+
_context4.next = 8;
|
383
|
+
return resourceConfig.updateConfig(config);
|
384
|
+
|
385
|
+
case 8:
|
386
|
+
case "end":
|
387
|
+
return _context4.stop();
|
388
|
+
}
|
381
389
|
}
|
382
390
|
}, _callee4);
|
383
391
|
}));
|
@@ -468,39 +476,41 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
468
476
|
var id, tag, _yield$editDispatcher2, elements, nodeElements, newLinkElements, updateElements;
|
469
477
|
|
470
478
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
471
|
-
while (1)
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
topo.linkDynamicStyleExecutor
|
479
|
+
while (1) {
|
480
|
+
switch (_context10.prev = _context10.next) {
|
481
|
+
case 0:
|
482
|
+
id = group.id, tag = group.tag;
|
483
|
+
rlog.debug("bindGroupResources--id, tag", id, tag);
|
484
|
+
topo.historyManager.beginTransaction();
|
485
|
+
_context10.next = 5;
|
486
|
+
return resourceConfig.updateGroupResources(group, resources);
|
487
|
+
|
488
|
+
case 5:
|
489
|
+
_context10.next = 7;
|
490
|
+
return editDispatchers.fetchDataByConfig();
|
491
|
+
|
492
|
+
case 7:
|
493
|
+
_yield$editDispatcher2 = _context10.sent;
|
494
|
+
elements = _yield$editDispatcher2.elements;
|
495
|
+
// 区域里的子区域及子区域的节点、新增的链路
|
496
|
+
nodeElements = findGroupChildren(elements, group);
|
497
|
+
newLinkElements = findUNExistedLinkElements(elements);
|
498
|
+
updateElements = [].concat(nodeElements, newLinkElements);
|
499
|
+
|
500
|
+
if (updateElements.length) {
|
501
|
+
saveBind(TopoEvent.DATA_TYPE_RESOURCE_CONTAINER, updateElements); // 临时放这里,仅拓扑中心有
|
502
|
+
|
503
|
+
if (topo.linkDynamicStyleExecutor) {
|
504
|
+
topo.linkDynamicStyleExecutor.execute();
|
505
|
+
}
|
496
506
|
}
|
497
|
-
}
|
498
507
|
|
499
|
-
|
508
|
+
topo.historyManager.endTransaction();
|
500
509
|
|
501
|
-
|
502
|
-
|
503
|
-
|
510
|
+
case 14:
|
511
|
+
case "end":
|
512
|
+
return _context10.stop();
|
513
|
+
}
|
504
514
|
}
|
505
515
|
}, _callee10);
|
506
516
|
}));
|
@@ -519,22 +529,24 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
519
529
|
_addGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(group, newResourceIds) {
|
520
530
|
var groupConfig, resources, groupData;
|
521
531
|
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
522
|
-
while (1)
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
532
|
+
while (1) {
|
533
|
+
switch (_context11.prev = _context11.next) {
|
534
|
+
case 0:
|
535
|
+
groupConfig = resourceConfig.getGroupConfigByElement(group);
|
536
|
+
resources = {
|
537
|
+
"static": [].concat(groupConfig.resources["static"], newResourceIds)
|
538
|
+
};
|
539
|
+
groupData = {
|
540
|
+
id: group.getTag(),
|
541
|
+
tag: group.a("tag")
|
542
|
+
};
|
543
|
+
_context11.next = 5;
|
544
|
+
return bindGroupResources(groupData, resources);
|
545
|
+
|
546
|
+
case 5:
|
547
|
+
case "end":
|
548
|
+
return _context11.stop();
|
549
|
+
}
|
538
550
|
}
|
539
551
|
}, _callee11);
|
540
552
|
}));
|
@@ -554,33 +566,39 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
554
566
|
|
555
567
|
function _bindViewResources() {
|
556
568
|
_bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(data) {
|
557
|
-
var config,
|
569
|
+
var config, result, _elements;
|
558
570
|
|
559
571
|
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
560
|
-
while (1)
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
572
|
+
while (1) {
|
573
|
+
switch (_context12.prev = _context12.next) {
|
574
|
+
case 0:
|
575
|
+
// console.log("关联视图的资源", data);
|
576
|
+
config = resourceConfig.getConfig();
|
577
|
+
config.resources = data;
|
578
|
+
_context12.next = 4;
|
579
|
+
return resourceConfig.updateConfig(config);
|
580
|
+
|
581
|
+
case 4:
|
582
|
+
_context12.next = 6;
|
583
|
+
return editDispatchers.fetchDataByConfig();
|
584
|
+
|
585
|
+
case 6:
|
586
|
+
result = _context12.sent;
|
587
|
+
console.log("fetchDataByConfig", result);
|
588
|
+
|
589
|
+
if (result) {
|
590
|
+
_elements = result.elements;
|
591
|
+
saveBind(TopoEvent.DATA_TYPE_RESOURCE_COMBO, _elements); // 临时放这里,仅拓扑中心有
|
592
|
+
|
593
|
+
if (topo.linkDynamicStyleExecutor) {
|
594
|
+
topo.linkDynamicStyleExecutor.execute();
|
595
|
+
}
|
596
|
+
}
|
580
597
|
|
581
|
-
|
582
|
-
|
583
|
-
|
598
|
+
case 9:
|
599
|
+
case "end":
|
600
|
+
return _context12.stop();
|
601
|
+
}
|
584
602
|
}
|
585
603
|
}, _callee12);
|
586
604
|
}));
|
@@ -593,45 +611,47 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
593
611
|
|
594
612
|
function _addLayerResources() {
|
595
613
|
_addLayerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(group, newResourceIds) {
|
596
|
-
var _yield$
|
614
|
+
var _yield$editDispatcher3, elements, newElements;
|
597
615
|
|
598
616
|
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
599
|
-
while (1)
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
if (topo.linkDynamicStyleExecutor) {
|
622
|
-
topo.linkDynamicStyleExecutor.execute();
|
623
|
-
}
|
617
|
+
while (1) {
|
618
|
+
switch (_context13.prev = _context13.next) {
|
619
|
+
case 0:
|
620
|
+
topo.historyManager.beginTransaction(); // 构造新的配置
|
621
|
+
|
622
|
+
_context13.next = 3;
|
623
|
+
return resourceConfig.addLayerStaticResources(group, newResourceIds);
|
624
|
+
|
625
|
+
case 3:
|
626
|
+
_context13.next = 5;
|
627
|
+
return editDispatchers.fetchDataByConfig();
|
628
|
+
|
629
|
+
case 5:
|
630
|
+
_yield$editDispatcher3 = _context13.sent;
|
631
|
+
elements = _yield$editDispatcher3.elements;
|
632
|
+
// 2022-11-10 修复 添加资源后分层重新布局问题,仅布局新增资源。替换api topo.updateElements(data)
|
633
|
+
newElements = findUNExistedElements(elements);
|
634
|
+
rlog.debug("添加分层资源", {
|
635
|
+
layer: group,
|
636
|
+
newElements: newElements
|
637
|
+
});
|
638
|
+
topo.getHtTopo().addElements(newElements); // 临时放这里,仅拓扑中心有
|
624
639
|
|
625
|
-
|
626
|
-
|
640
|
+
if (topo.linkDynamicStyleExecutor) {
|
641
|
+
topo.linkDynamicStyleExecutor.execute();
|
642
|
+
}
|
627
643
|
|
628
|
-
|
629
|
-
|
630
|
-
});
|
644
|
+
topo.historyManager.endTransaction();
|
645
|
+
topo.getHtTopo().getGraphView().fitContent(undefined, undefined, true); // 添加资源后隐藏资源面板
|
631
646
|
|
632
|
-
|
633
|
-
|
634
|
-
|
647
|
+
topoEditDispatchers.update({
|
648
|
+
resourceTabActiveKey: null
|
649
|
+
});
|
650
|
+
|
651
|
+
case 14:
|
652
|
+
case "end":
|
653
|
+
return _context13.stop();
|
654
|
+
}
|
635
655
|
}
|
636
656
|
}, _callee13);
|
637
657
|
}));
|
@@ -646,15 +666,17 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
646
666
|
_addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(data) {
|
647
667
|
var group;
|
648
668
|
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
649
|
-
while (1)
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
669
|
+
while (1) {
|
670
|
+
switch (_context14.prev = _context14.next) {
|
671
|
+
case 0:
|
672
|
+
group = resourceConfig.getGroups()[0];
|
673
|
+
_context14.next = 3;
|
674
|
+
return addLayerResources(group, data);
|
675
|
+
|
676
|
+
case 3:
|
677
|
+
case "end":
|
678
|
+
return _context14.stop();
|
679
|
+
}
|
658
680
|
}
|
659
681
|
}, _callee14);
|
660
682
|
}));
|
@@ -690,37 +712,39 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
690
712
|
var onSaveComboRes = /*#__PURE__*/function () {
|
691
713
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
|
692
714
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
693
|
-
while (1)
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
715
|
+
while (1) {
|
716
|
+
switch (_context5.prev = _context5.next) {
|
717
|
+
case 0:
|
718
|
+
rlog.debug("关联资源-----onSaveComboRes", data);
|
719
|
+
topo.historyManager.beginTransaction();
|
720
|
+
|
721
|
+
if (!(getAddResourceType() === "addToFirstLayer")) {
|
722
|
+
_context5.next = 7;
|
723
|
+
break;
|
724
|
+
}
|
702
725
|
|
703
|
-
|
704
|
-
|
726
|
+
_context5.next = 5;
|
727
|
+
return addResourceToFirstLayer(data);
|
705
728
|
|
706
|
-
|
707
|
-
|
708
|
-
|
729
|
+
case 5:
|
730
|
+
_context5.next = 9;
|
731
|
+
break;
|
709
732
|
|
710
|
-
|
711
|
-
|
712
|
-
|
733
|
+
case 7:
|
734
|
+
_context5.next = 9;
|
735
|
+
return bindViewResources(data);
|
713
736
|
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
737
|
+
case 9:
|
738
|
+
topo.historyManager.endTransaction();
|
739
|
+
topo.getHtTopo().fitContent();
|
740
|
+
topoEditDispatchers.update({
|
741
|
+
resourceTabActiveKey: null
|
742
|
+
});
|
720
743
|
|
721
|
-
|
722
|
-
|
723
|
-
|
744
|
+
case 12:
|
745
|
+
case "end":
|
746
|
+
return _context5.stop();
|
747
|
+
}
|
724
748
|
}
|
725
749
|
}, _callee5);
|
726
750
|
}));
|
@@ -735,47 +759,51 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
735
759
|
var id, config, serialize, _config$layout, template, layout, saveConfig;
|
736
760
|
|
737
761
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
738
|
-
while (1)
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
_context6.
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
762
|
+
while (1) {
|
763
|
+
switch (_context7.prev = _context7.next) {
|
764
|
+
case 0:
|
765
|
+
id = data.id, config = data.config, serialize = data.serialize;
|
766
|
+
_config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
|
767
|
+
|
768
|
+
if (onSave) {
|
769
|
+
// 自定义保存
|
770
|
+
saveConfig = /*#__PURE__*/function () {
|
771
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
772
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
773
|
+
while (1) {
|
774
|
+
switch (_context6.prev = _context6.next) {
|
775
|
+
case 0:
|
776
|
+
_context6.next = 2;
|
777
|
+
return editDispatchers.saveTopo({
|
778
|
+
id: id,
|
779
|
+
layout: layout,
|
780
|
+
serialize: serialize
|
781
|
+
});
|
782
|
+
|
783
|
+
case 2:
|
784
|
+
case "end":
|
785
|
+
return _context6.stop();
|
786
|
+
}
|
787
|
+
}
|
788
|
+
}, _callee6);
|
789
|
+
}));
|
790
|
+
|
791
|
+
return function saveConfig() {
|
792
|
+
return _ref7.apply(this, arguments);
|
793
|
+
};
|
794
|
+
}();
|
795
|
+
|
796
|
+
onSave({
|
797
|
+
topo: topo,
|
798
|
+
data: data,
|
799
|
+
saveConfig: saveConfig
|
800
|
+
});
|
801
|
+
}
|
775
802
|
|
776
|
-
|
777
|
-
|
778
|
-
|
803
|
+
case 3:
|
804
|
+
case "end":
|
805
|
+
return _context7.stop();
|
806
|
+
}
|
779
807
|
}
|
780
808
|
}, _callee7);
|
781
809
|
}));
|
@@ -811,177 +839,181 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
811
839
|
var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher, elements, newData, doBind, _doBind, replaceOrAddRes;
|
812
840
|
|
813
841
|
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
814
|
-
while (1)
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
_doBind =
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
842
|
+
while (1) {
|
843
|
+
switch (_context9.prev = _context9.next) {
|
844
|
+
case 0:
|
845
|
+
replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
|
846
|
+
return _extends({}, resources, {
|
847
|
+
"static": [].concat(resources["static"].filter(function (item) {
|
848
|
+
return item !== oldResId;
|
849
|
+
}), [newResId])
|
850
|
+
});
|
851
|
+
};
|
852
|
+
|
853
|
+
_doBind = function _doBind3() {
|
854
|
+
_doBind = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
855
|
+
var dm, newLinkElements, createElementsData, groupChildren, newGroupChildren, existedGroupChildren, groupElement, newElement, sm;
|
856
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
857
|
+
while (1) {
|
858
|
+
switch (_context8.prev = _context8.next) {
|
859
|
+
case 0:
|
860
|
+
dm = htTopo.getGraphView().dm(); // 创建
|
861
|
+
|
862
|
+
newLinkElements = findUNExistedLinkElements(elements);
|
863
|
+
createElementsData = null;
|
864
|
+
|
865
|
+
if (newData.type === "group") {
|
866
|
+
groupChildren = findGroupChildren(elements, newData);
|
867
|
+
newGroupChildren = [];
|
868
|
+
existedGroupChildren = [];
|
869
|
+
groupChildren.forEach(function (groupChildData) {
|
870
|
+
var ele = dm.getDataByTag(groupChildData.id);
|
871
|
+
|
872
|
+
if (ele) {
|
873
|
+
existedGroupChildren.push(groupChildData);
|
874
|
+
} else {
|
875
|
+
newGroupChildren.push(groupChildData);
|
876
|
+
}
|
877
|
+
});
|
878
|
+
createElementsData = {
|
879
|
+
groups: [newData],
|
880
|
+
nodes: newGroupChildren,
|
881
|
+
links: newLinkElements.filter(function (item) {
|
882
|
+
return item.type === "link";
|
883
|
+
}),
|
884
|
+
linkGroups: newLinkElements.filter(function (item) {
|
885
|
+
return item.type === "linkGroup";
|
886
|
+
})
|
887
|
+
};
|
888
|
+
htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
|
889
|
+
|
890
|
+
groupElement = dm.getDataByTag(newData.id);
|
891
|
+
existedGroupChildren.forEach(function (groupChildData) {
|
892
|
+
var nodeElement = dm.getDataByTag(groupChildData.id);
|
893
|
+
nodeElement.setParent(groupElement);
|
894
|
+
});
|
844
895
|
} else {
|
845
|
-
|
896
|
+
createElementsData = {
|
897
|
+
groups: [],
|
898
|
+
nodes: [newData],
|
899
|
+
links: newLinkElements.filter(function (item) {
|
900
|
+
return item.type === "link";
|
901
|
+
}),
|
902
|
+
linkGroups: newLinkElements.filter(function (item) {
|
903
|
+
return item.type === "linkGroup";
|
904
|
+
})
|
905
|
+
};
|
906
|
+
htTopo.createElements(createElementsData);
|
846
907
|
}
|
847
|
-
});
|
848
|
-
createElementsData = {
|
849
|
-
groups: [newData],
|
850
|
-
nodes: newGroupChildren,
|
851
|
-
links: newLinkElements.filter(function (item) {
|
852
|
-
return item.type === "link";
|
853
|
-
}),
|
854
|
-
linkGroups: newLinkElements.filter(function (item) {
|
855
|
-
return item.type === "linkGroup";
|
856
|
-
})
|
857
|
-
};
|
858
|
-
htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
|
859
|
-
|
860
|
-
groupElement = dm.getDataByTag(newData.id);
|
861
|
-
existedGroupChildren.forEach(function (groupChildData) {
|
862
|
-
var nodeElement = dm.getDataByTag(groupChildData.id);
|
863
|
-
nodeElement.setParent(groupElement);
|
864
|
-
});
|
865
|
-
} else {
|
866
|
-
createElementsData = {
|
867
|
-
groups: [],
|
868
|
-
nodes: [newData],
|
869
|
-
links: newLinkElements.filter(function (item) {
|
870
|
-
return item.type === "link";
|
871
|
-
}),
|
872
|
-
linkGroups: newLinkElements.filter(function (item) {
|
873
|
-
return item.type === "linkGroup";
|
874
|
-
})
|
875
|
-
};
|
876
|
-
htTopo.createElements(createElementsData);
|
877
|
-
}
|
878
|
-
|
879
|
-
rlog.debug("批量创建元素", createElementsData); // 恢复图标、大小、位置
|
880
|
-
|
881
|
-
newElement = dm.getDataByTag(newData.id);
|
882
|
-
|
883
|
-
if (newElement) {
|
884
|
-
newElement.setSize(node.getSize());
|
885
|
-
newElement.setPosition(node.getPosition());
|
886
|
-
newElement.setImage(node.getImage());
|
887
|
-
} // 选中
|
888
|
-
|
889
|
-
|
890
|
-
sm = htTopo.getGraphView().sm();
|
891
|
-
sm.setSelection([newElement]); // 移除旧节点
|
892
908
|
|
893
|
-
|
894
|
-
// node.a("customName", null);
|
895
|
-
// 删除关联在节点上的出口链路
|
909
|
+
rlog.debug("批量创建元素", createElementsData); // 恢复图标、大小、位置
|
896
910
|
|
897
|
-
|
898
|
-
return deleteExLink(node);
|
911
|
+
newElement = dm.getDataByTag(newData.id);
|
899
912
|
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
913
|
+
if (newElement) {
|
914
|
+
newElement.setSize(node.getSize());
|
915
|
+
newElement.setPosition(node.getPosition());
|
916
|
+
newElement.setImage(node.getImage());
|
917
|
+
} // 选中
|
905
918
|
|
906
|
-
case 13:
|
907
|
-
case "end":
|
908
|
-
return _context8.stop();
|
909
|
-
}
|
910
|
-
}, _callee8);
|
911
|
-
}));
|
912
|
-
return _doBind.apply(this, arguments);
|
913
|
-
};
|
914
919
|
|
915
|
-
|
916
|
-
|
917
|
-
};
|
920
|
+
sm = htTopo.getGraphView().sm();
|
921
|
+
sm.setSelection([newElement]); // 移除旧节点
|
918
922
|
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
node = topo.getDataModel().getDataById(id); // 节点所属容器
|
923
|
+
dm.remove(node); // saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, newDatas);
|
924
|
+
// node.a("customName", null);
|
925
|
+
// 删除关联在节点上的出口链路
|
923
926
|
|
924
|
-
|
925
|
-
|
926
|
-
config = resourceConfig.getConfig();
|
927
|
+
_context8.next = 12;
|
928
|
+
return deleteExLink(node);
|
927
929
|
|
928
|
-
|
929
|
-
|
930
|
-
|
930
|
+
case 12:
|
931
|
+
// 临时放这里,仅拓扑中心有
|
932
|
+
if (topo.linkDynamicStyleExecutor) {
|
933
|
+
topo.linkDynamicStyleExecutor.execute();
|
934
|
+
}
|
931
935
|
|
932
|
-
|
936
|
+
case 13:
|
937
|
+
case "end":
|
938
|
+
return _context8.stop();
|
939
|
+
}
|
940
|
+
}
|
941
|
+
}, _callee8);
|
942
|
+
}));
|
943
|
+
return _doBind.apply(this, arguments);
|
944
|
+
};
|
945
|
+
|
946
|
+
doBind = function _doBind2() {
|
947
|
+
return _doBind.apply(this, arguments);
|
948
|
+
};
|
949
|
+
|
950
|
+
topo.historyManager.beginTransaction();
|
951
|
+
id = params.id, oldResId = params.oldResId, newResId = params.newResId;
|
952
|
+
rlog.debug("bindNodeResource", params);
|
953
|
+
node = topo.getDataModel().getDataById(id); // 节点所属容器
|
954
|
+
|
955
|
+
parentGroupElement = node.getParent();
|
956
|
+
htTopo = topo.getHtTopo();
|
957
|
+
config = resourceConfig.getConfig();
|
958
|
+
|
959
|
+
if (parentGroupElement) {
|
960
|
+
// 在容器中
|
961
|
+
groupId = parentGroupElement.getTag(); // 容器业务id
|
962
|
+
|
963
|
+
groupTag = parentGroupElement.a("tag"); // 容器临时id
|
964
|
+
|
965
|
+
config.groups = config.groups.map(function (g) {
|
966
|
+
// 匹配到容器,替换资源或增加
|
967
|
+
if (g.id === groupId || g.tag === groupTag) {
|
968
|
+
return _extends({}, g, {
|
969
|
+
resources: replaceOrAddRes(g.resources, oldResId, newResId)
|
970
|
+
});
|
971
|
+
} // 未匹配到容器
|
972
|
+
|
973
|
+
|
974
|
+
return g;
|
975
|
+
});
|
976
|
+
} else {
|
977
|
+
// 在画布上
|
978
|
+
config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
|
979
|
+
}
|
933
980
|
|
934
|
-
|
935
|
-
|
936
|
-
if (g.id === groupId || g.tag === groupTag) {
|
937
|
-
return _extends({}, g, {
|
938
|
-
resources: replaceOrAddRes(g.resources, oldResId, newResId)
|
939
|
-
});
|
940
|
-
} // 未匹配到容器
|
981
|
+
_context9.next = 13;
|
982
|
+
return resourceConfig.updateConfig(config);
|
941
983
|
|
984
|
+
case 13:
|
985
|
+
_context9.next = 15;
|
986
|
+
return editDispatchers.fetchDataByConfig();
|
942
987
|
|
943
|
-
|
988
|
+
case 15:
|
989
|
+
_yield$editDispatcher = _context9.sent;
|
990
|
+
elements = _yield$editDispatcher.elements;
|
991
|
+
newData = elements.find(function (item) {
|
992
|
+
return item.id === newResId;
|
944
993
|
});
|
945
|
-
} else {
|
946
|
-
// 在画布上
|
947
|
-
config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
|
948
|
-
}
|
949
|
-
|
950
|
-
_context9.next = 13;
|
951
|
-
return resourceConfig.updateConfig(config);
|
952
|
-
|
953
|
-
case 13:
|
954
|
-
_context9.next = 15;
|
955
|
-
return editDispatchers.fetchDataByConfig();
|
956
994
|
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
return item.id === newResId;
|
962
|
-
});
|
963
|
-
|
964
|
-
if (newData) {
|
965
|
-
_context9.next = 23;
|
966
|
-
break;
|
967
|
-
}
|
995
|
+
if (newData) {
|
996
|
+
_context9.next = 23;
|
997
|
+
break;
|
998
|
+
}
|
968
999
|
|
969
|
-
|
1000
|
+
_Message.error("关联资源失败");
|
970
1001
|
|
971
|
-
|
972
|
-
|
973
|
-
|
1002
|
+
rlog.warn("关联资源失败");
|
1003
|
+
topo.historyManager.endTransaction();
|
1004
|
+
return _context9.abrupt("return", false);
|
974
1005
|
|
975
|
-
|
976
|
-
|
977
|
-
|
1006
|
+
case 23:
|
1007
|
+
_context9.next = 25;
|
1008
|
+
return doBind();
|
978
1009
|
|
979
|
-
|
980
|
-
|
1010
|
+
case 25:
|
1011
|
+
topo.historyManager.endTransaction();
|
981
1012
|
|
982
|
-
|
983
|
-
|
984
|
-
|
1013
|
+
case 26:
|
1014
|
+
case "end":
|
1015
|
+
return _context9.stop();
|
1016
|
+
}
|
985
1017
|
}
|
986
1018
|
}, _callee9);
|
987
1019
|
}));
|
@@ -1001,79 +1033,82 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1001
1033
|
|
1002
1034
|
function _relateNodeIp() {
|
1003
1035
|
_relateNodeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(txtValue, nodeElement) {
|
1004
|
-
var dm, isUnique, ip, configObj, configData,
|
1036
|
+
var dm, isUnique, ip, configObj, configData, _elements2, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
1005
1037
|
|
1006
1038
|
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
1007
|
-
while (1)
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1039
|
+
while (1) {
|
1040
|
+
switch (_context15.prev = _context15.next) {
|
1041
|
+
case 0:
|
1042
|
+
if (txtValue) {
|
1043
|
+
_context15.next = 2;
|
1044
|
+
break;
|
1045
|
+
}
|
1013
1046
|
|
1014
|
-
|
1047
|
+
return _context15.abrupt("return");
|
1015
1048
|
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1049
|
+
case 2:
|
1050
|
+
// if (txtValue === nodeElement.a('bindIp')) {
|
1051
|
+
// return;
|
1052
|
+
// }
|
1053
|
+
// 根据配置查询拓扑数据
|
1054
|
+
dm = topo.getDataModel(); // 执行唯一性验证
|
1022
1055
|
|
1023
|
-
|
1056
|
+
isUnique = isUniqueIp(dm, txtValue, nodeElement); // 获取关联链路
|
1024
1057
|
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1058
|
+
if (!isUnique) {
|
1059
|
+
_context15.next = 24;
|
1060
|
+
break;
|
1061
|
+
}
|
1029
1062
|
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
case 16:
|
1048
|
-
configData = _context15.sent;
|
1049
|
-
// console.log("configData",configObj, configData);
|
1050
|
-
_elements = configData.elements;
|
1051
|
-
newLinkElements = findUNExistedLinkElements(_elements); // console.log("configData", configData, newLinkElements);
|
1052
|
-
|
1053
|
-
newLink = newLinkElements.filter(function (item) {
|
1054
|
-
return item.type === "link";
|
1055
|
-
});
|
1056
|
-
newLinkGroup = newLinkElements.filter(function (item) {
|
1057
|
-
return item.type === "linkGroup";
|
1058
|
-
}); // const newData = elements.find((item) => item.id === `ip:${txtValue}`);
|
1059
|
-
// console.log("newData",newLinkElements, newLink);
|
1060
|
-
|
1061
|
-
createElementsData = {
|
1062
|
-
groups: [],
|
1063
|
-
nodes: [],
|
1064
|
-
links: newLink,
|
1065
|
-
linkGroups: newLinkGroup
|
1066
|
-
}; // console.log("createElementsData", createElementsData);
|
1067
|
-
|
1068
|
-
if ([].concat(newLink, newLinkGroup).length > 0) {
|
1069
|
-
_htTopo = topo.getHtTopo();
|
1070
|
-
|
1071
|
-
_htTopo.createElements(createElementsData);
|
1072
|
-
}
|
1063
|
+
ip = buildIpNode(txtValue);
|
1064
|
+
_context15.next = 8;
|
1065
|
+
return deleteExLink(nodeElement);
|
1066
|
+
|
1067
|
+
case 8:
|
1068
|
+
nodeElement.a(ip);
|
1069
|
+
nodeElement.setName(txtValue);
|
1070
|
+
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
1071
|
+
|
1072
|
+
configObj = topo.resourceConfig.getConfig();
|
1073
|
+
_context15.next = 14;
|
1074
|
+
return resourceConfig.updateConfig(configObj);
|
1075
|
+
|
1076
|
+
case 14:
|
1077
|
+
_context15.next = 16;
|
1078
|
+
return editDispatchers.fetchDataByConfig();
|
1073
1079
|
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1080
|
+
case 16:
|
1081
|
+
configData = _context15.sent;
|
1082
|
+
// console.log("configData",configObj, configData);
|
1083
|
+
_elements2 = configData.elements;
|
1084
|
+
newLinkElements = findUNExistedLinkElements(_elements2); // console.log("configData", configData, newLinkElements);
|
1085
|
+
|
1086
|
+
newLink = newLinkElements.filter(function (item) {
|
1087
|
+
return item.type === "link";
|
1088
|
+
});
|
1089
|
+
newLinkGroup = newLinkElements.filter(function (item) {
|
1090
|
+
return item.type === "linkGroup";
|
1091
|
+
}); // const newData = elements.find((item) => item.id === `ip:${txtValue}`);
|
1092
|
+
// console.log("newData",newLinkElements, newLink);
|
1093
|
+
|
1094
|
+
createElementsData = {
|
1095
|
+
groups: [],
|
1096
|
+
nodes: [],
|
1097
|
+
links: newLink,
|
1098
|
+
linkGroups: newLinkGroup
|
1099
|
+
};
|
1100
|
+
console.log("createElementsData", createElementsData);
|
1101
|
+
|
1102
|
+
if ([].concat(newLink, newLinkGroup).length > 0) {
|
1103
|
+
_htTopo = topo.getHtTopo();
|
1104
|
+
|
1105
|
+
_htTopo.createElements(createElementsData);
|
1106
|
+
}
|
1107
|
+
|
1108
|
+
case 24:
|
1109
|
+
case "end":
|
1110
|
+
return _context15.stop();
|
1111
|
+
}
|
1077
1112
|
}
|
1078
1113
|
}, _callee15);
|
1079
1114
|
}));
|