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