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