@riil-frontend/component-topology 11.0.33 → 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/BackgroundView/index.module.scss +2 -1
- 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 +525 -623
- 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/BackgroundView/index.module.scss +2 -1
- 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 -615
- 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,125 +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, result, _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
|
-
result = _context12.sent;
|
624
|
-
console.log("fetchDataByConfig", result);
|
625
|
-
|
626
|
-
if (result) {
|
627
|
-
_elements = result.elements;
|
628
|
-
saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, _elements); // 临时放这里,仅拓扑中心有
|
629
|
-
|
630
|
-
if (topo.linkDynamicStyleExecutor) {
|
631
|
-
topo.linkDynamicStyleExecutor.execute();
|
632
|
-
}
|
633
|
-
}
|
634
|
-
|
635
|
-
case 9:
|
636
|
-
case "end":
|
637
|
-
return _context12.stop();
|
638
|
-
}
|
639
|
-
}
|
640
|
-
}, _callee12);
|
641
|
-
}));
|
642
|
-
return _bindViewResources.apply(this, arguments);
|
643
|
-
}
|
644
|
-
|
645
598
|
function addLayerResources(_x9, _x10) {
|
646
|
-
return _addLayerResources.
|
647
|
-
}
|
648
|
-
|
649
|
-
function _addLayerResources() {
|
650
|
-
_addLayerResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(group, newResourceIds) {
|
599
|
+
return (_addLayerResources = _addLayerResources || (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(group, newResourceIds) {
|
651
600
|
var _yield$editDispatcher3, elements, newElements;
|
652
601
|
|
653
|
-
return _regenerator["default"].wrap(function
|
654
|
-
while (1) {
|
655
|
-
|
656
|
-
|
657
|
-
topo.historyManager.beginTransaction(); // 构造新的配置
|
602
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
603
|
+
while (1) switch (_context8.prev = _context8.next) {
|
604
|
+
case 0:
|
605
|
+
topo.historyManager.beginTransaction(); // 构造新的配置
|
658
606
|
|
659
|
-
|
660
|
-
|
607
|
+
_context8.next = 3;
|
608
|
+
return resourceConfig.addLayerStaticResources(group, newResourceIds);
|
661
609
|
|
662
|
-
|
663
|
-
|
664
|
-
|
610
|
+
case 3:
|
611
|
+
_context8.next = 5;
|
612
|
+
return editDispatchers.fetchDataByConfig();
|
665
613
|
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
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);
|
671
619
|
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
620
|
+
_rlog["default"].debug("添加分层资源", {
|
621
|
+
layer: group,
|
622
|
+
newElements: newElements
|
623
|
+
});
|
676
624
|
|
677
|
-
|
625
|
+
topo.getHtTopo().addElements(newElements); // 临时放这里,仅拓扑中心有
|
678
626
|
|
679
|
-
|
680
|
-
|
681
|
-
|
627
|
+
if (topo.linkDynamicStyleExecutor) {
|
628
|
+
topo.linkDynamicStyleExecutor.execute();
|
629
|
+
}
|
682
630
|
|
683
|
-
|
684
|
-
|
631
|
+
topo.historyManager.endTransaction();
|
632
|
+
topo.getHtTopo().getGraphView().fitContent(undefined, undefined, true); // 添加资源后隐藏资源面板
|
685
633
|
|
686
|
-
|
687
|
-
|
688
|
-
|
634
|
+
topoEditDispatchers.update({
|
635
|
+
resourceTabActiveKey: null
|
636
|
+
});
|
689
637
|
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
}
|
638
|
+
case 14:
|
639
|
+
case "end":
|
640
|
+
return _context8.stop();
|
694
641
|
}
|
695
|
-
},
|
696
|
-
}));
|
697
|
-
return _addLayerResources.apply(this, arguments);
|
642
|
+
}, _callee8);
|
643
|
+
}))).apply(this, arguments);
|
698
644
|
}
|
699
645
|
|
700
646
|
function addResourceToFirstLayer(_x11) {
|
701
|
-
return _addResourceToFirstLayer
|
702
|
-
}
|
703
|
-
|
704
|
-
function _addResourceToFirstLayer() {
|
705
|
-
_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) {
|
706
648
|
var group;
|
707
|
-
return _regenerator["default"].wrap(function
|
708
|
-
while (1) {
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
return _context14.stop();
|
718
|
-
}
|
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();
|
719
659
|
}
|
720
|
-
},
|
721
|
-
}));
|
722
|
-
return _addResourceToFirstLayer.apply(this, arguments);
|
660
|
+
}, _callee9);
|
661
|
+
}))).apply(this, arguments);
|
723
662
|
}
|
724
663
|
|
725
664
|
function getAddResourceType() {
|
@@ -748,110 +687,92 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
748
687
|
*/
|
749
688
|
|
750
689
|
|
751
|
-
var onSaveComboRes =
|
752
|
-
|
753
|
-
return _regenerator["default"].wrap(function
|
754
|
-
while (1) {
|
755
|
-
|
756
|
-
|
757
|
-
_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);
|
758
696
|
|
759
|
-
|
697
|
+
topo.historyManager.beginTransaction();
|
760
698
|
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
699
|
+
if (!(getAddResourceType() === "addToFirstLayer")) {
|
700
|
+
_context10.next = 7;
|
701
|
+
break;
|
702
|
+
}
|
765
703
|
|
766
|
-
|
767
|
-
|
704
|
+
_context10.next = 5;
|
705
|
+
return addResourceToFirstLayer(data);
|
768
706
|
|
769
|
-
|
770
|
-
|
771
|
-
|
707
|
+
case 5:
|
708
|
+
_context10.next = 9;
|
709
|
+
break;
|
772
710
|
|
773
|
-
|
774
|
-
|
775
|
-
|
711
|
+
case 7:
|
712
|
+
_context10.next = 9;
|
713
|
+
return bindViewResources(data);
|
776
714
|
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
715
|
+
case 9:
|
716
|
+
topo.historyManager.endTransaction();
|
717
|
+
topo.getHtTopo().fitContent();
|
718
|
+
topoEditDispatchers.update({
|
719
|
+
resourceTabActiveKey: null
|
720
|
+
});
|
783
721
|
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
}
|
722
|
+
case 12:
|
723
|
+
case "end":
|
724
|
+
return _context10.stop();
|
788
725
|
}
|
789
|
-
},
|
790
|
-
}));
|
726
|
+
}, _callee10);
|
727
|
+
}))).apply(this, arguments);
|
728
|
+
};
|
791
729
|
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
}();
|
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;
|
796
733
|
|
797
|
-
|
798
|
-
|
799
|
-
|
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
|
+
};
|
800
761
|
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
if (onSave) {
|
809
|
-
// 自定义保存
|
810
|
-
saveConfig = /*#__PURE__*/function () {
|
811
|
-
var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
812
|
-
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
813
|
-
while (1) {
|
814
|
-
switch (_context6.prev = _context6.next) {
|
815
|
-
case 0:
|
816
|
-
_context6.next = 2;
|
817
|
-
return editDispatchers.saveTopo({
|
818
|
-
id: id,
|
819
|
-
layout: layout,
|
820
|
-
serialize: serialize
|
821
|
-
});
|
822
|
-
|
823
|
-
case 2:
|
824
|
-
case "end":
|
825
|
-
return _context6.stop();
|
826
|
-
}
|
827
|
-
}
|
828
|
-
}, _callee6);
|
829
|
-
}));
|
830
|
-
|
831
|
-
return function saveConfig() {
|
832
|
-
return _ref7.apply(this, arguments);
|
833
|
-
};
|
834
|
-
}();
|
835
|
-
|
836
|
-
onSave({
|
837
|
-
topo: topo,
|
838
|
-
data: data,
|
839
|
-
saveConfig: saveConfig
|
840
|
-
});
|
841
|
-
}
|
762
|
+
onSave({
|
763
|
+
topo: topo,
|
764
|
+
data: data,
|
765
|
+
saveConfig: saveConfig
|
766
|
+
});
|
767
|
+
}
|
842
768
|
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
}
|
769
|
+
case 3:
|
770
|
+
case "end":
|
771
|
+
return _context12.stop();
|
847
772
|
}
|
848
|
-
},
|
849
|
-
}));
|
850
|
-
|
851
|
-
return function onSaveTopo(_x13) {
|
852
|
-
return _ref6.apply(this, arguments);
|
853
|
-
};
|
854
|
-
}();
|
773
|
+
}, _callee12);
|
774
|
+
}))).apply(this, arguments);
|
775
|
+
};
|
855
776
|
|
856
777
|
var saveBind = function saveBind(type, data) {
|
857
778
|
var eventData = {
|
@@ -876,289 +797,270 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
876
797
|
*/
|
877
798
|
|
878
799
|
|
879
|
-
var bindNodeResource =
|
880
|
-
|
881
|
-
var
|
800
|
+
var bindNodeResource = function bindNodeResource(_x14) {
|
801
|
+
return (_ref8 = _ref8 || (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(params) {
|
802
|
+
var _doBind;
|
882
803
|
|
883
|
-
|
884
|
-
while (1) {
|
885
|
-
switch (_context9.prev = _context9.next) {
|
886
|
-
case 0:
|
887
|
-
replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
|
888
|
-
return (0, _extends2["default"])({}, resources, {
|
889
|
-
"static": [].concat(resources["static"].filter(function (item) {
|
890
|
-
return item !== oldResId;
|
891
|
-
}), [newResId])
|
892
|
-
});
|
893
|
-
};
|
804
|
+
var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher4, elements, newData, doBind, replaceOrAddRes;
|
894
805
|
|
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
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
linkGroups: newLinkElements.filter(function (item) {
|
927
|
-
return item.type === "linkGroup";
|
928
|
-
})
|
929
|
-
};
|
930
|
-
htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
|
931
|
-
|
932
|
-
groupElement = dm.getDataByTag(newData.id);
|
933
|
-
existedGroupChildren.forEach(function (groupChildData) {
|
934
|
-
var nodeElement = dm.getDataByTag(groupChildData.id);
|
935
|
-
nodeElement.setParent(groupElement);
|
936
|
-
});
|
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);
|
937
837
|
} else {
|
938
|
-
|
939
|
-
groups: [],
|
940
|
-
nodes: [newData],
|
941
|
-
links: newLinkElements.filter(function (item) {
|
942
|
-
return item.type === "link";
|
943
|
-
}),
|
944
|
-
linkGroups: newLinkElements.filter(function (item) {
|
945
|
-
return item.type === "linkGroup";
|
946
|
-
})
|
947
|
-
};
|
948
|
-
htTopo.createElements(createElementsData);
|
838
|
+
newGroupChildren.push(groupChildData);
|
949
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
|
+
}
|
950
871
|
|
951
|
-
|
872
|
+
_rlog["default"].debug("批量创建元素", createElementsData); // 恢复图标、大小、位置
|
952
873
|
|
953
874
|
|
954
|
-
|
875
|
+
newElement = dm.getDataByTag(newData.id);
|
955
876
|
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
877
|
+
if (newElement) {
|
878
|
+
newElement.setSize(node.getSize());
|
879
|
+
newElement.setPosition(node.getPosition());
|
880
|
+
newElement.setImage(node.getImage());
|
881
|
+
} // 选中
|
961
882
|
|
962
883
|
|
963
|
-
|
964
|
-
|
884
|
+
sm = htTopo.getGraphView().sm();
|
885
|
+
sm.setSelection([newElement]); // 移除旧节点
|
965
886
|
|
966
|
-
|
967
|
-
|
968
|
-
|
887
|
+
dm.remove(node); // saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, newDatas);
|
888
|
+
// node.a("customName", null);
|
889
|
+
// 删除关联在节点上的出口链路
|
969
890
|
|
970
|
-
|
971
|
-
|
891
|
+
_context13.next = 12;
|
892
|
+
return deleteExLink(node);
|
972
893
|
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
}
|
978
|
-
|
979
|
-
case 13:
|
980
|
-
case "end":
|
981
|
-
return _context8.stop();
|
894
|
+
case 12:
|
895
|
+
// 临时放这里,仅拓扑中心有
|
896
|
+
if (topo.linkDynamicStyleExecutor) {
|
897
|
+
topo.linkDynamicStyleExecutor.execute();
|
982
898
|
}
|
983
|
-
}
|
984
|
-
}, _callee8);
|
985
|
-
}));
|
986
|
-
return _doBind.apply(this, arguments);
|
987
|
-
};
|
988
899
|
|
989
|
-
|
990
|
-
|
991
|
-
|
900
|
+
case 13:
|
901
|
+
case "end":
|
902
|
+
return _context13.stop();
|
903
|
+
}
|
904
|
+
}, _callee13);
|
905
|
+
}))).apply(this, arguments);
|
906
|
+
};
|
992
907
|
|
993
|
-
|
994
|
-
|
908
|
+
topo.historyManager.beginTransaction();
|
909
|
+
id = params.id, oldResId = params.oldResId, newResId = params.newResId;
|
995
910
|
|
996
|
-
|
911
|
+
_rlog["default"].debug("bindNodeResource", params);
|
997
912
|
|
998
|
-
|
913
|
+
node = topo.getDataModel().getDataById(id); // 节点所属容器
|
999
914
|
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
915
|
+
parentGroupElement = node.getParent();
|
916
|
+
htTopo = topo.getHtTopo();
|
917
|
+
config = resourceConfig.getConfig();
|
1003
918
|
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
919
|
+
if (parentGroupElement) {
|
920
|
+
// 在容器中
|
921
|
+
groupId = parentGroupElement.getTag(); // 容器业务id
|
1007
922
|
|
1008
|
-
|
923
|
+
groupTag = parentGroupElement.a("tag"); // 容器临时id
|
1009
924
|
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
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
|
+
} // 未匹配到容器
|
1017
932
|
|
1018
933
|
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
934
|
+
return g;
|
935
|
+
});
|
936
|
+
} else {
|
937
|
+
// 在画布上
|
938
|
+
config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
|
939
|
+
}
|
1025
940
|
|
1026
|
-
|
1027
|
-
|
941
|
+
_context14.next = 12;
|
942
|
+
return resourceConfig.updateConfig(config);
|
1028
943
|
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
944
|
+
case 12:
|
945
|
+
_context14.next = 14;
|
946
|
+
return editDispatchers.fetchDataByConfig();
|
1032
947
|
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
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
|
+
});
|
1039
954
|
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
955
|
+
if (newData) {
|
956
|
+
_context14.next = 22;
|
957
|
+
break;
|
958
|
+
}
|
1044
959
|
|
1045
|
-
|
960
|
+
_message["default"].error("关联资源失败");
|
1046
961
|
|
1047
|
-
|
962
|
+
_rlog["default"].warn("关联资源失败");
|
1048
963
|
|
1049
|
-
|
1050
|
-
|
964
|
+
topo.historyManager.endTransaction();
|
965
|
+
return _context14.abrupt("return", false);
|
1051
966
|
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
967
|
+
case 22:
|
968
|
+
_context14.next = 24;
|
969
|
+
return doBind();
|
1055
970
|
|
1056
|
-
|
1057
|
-
|
971
|
+
case 24:
|
972
|
+
topo.historyManager.endTransaction();
|
1058
973
|
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
}
|
974
|
+
case 25:
|
975
|
+
case "end":
|
976
|
+
return _context14.stop();
|
1063
977
|
}
|
1064
|
-
},
|
1065
|
-
}));
|
1066
|
-
|
1067
|
-
return function bindNodeResource(_x14) {
|
1068
|
-
return _ref8.apply(this, arguments);
|
1069
|
-
};
|
1070
|
-
}();
|
978
|
+
}, _callee14);
|
979
|
+
}))).apply(this, arguments);
|
980
|
+
};
|
1071
981
|
/**
|
1072
982
|
* 关联IP的图片节点
|
1073
983
|
*/
|
1074
984
|
|
1075
985
|
|
1076
986
|
function relateNodeIp(_x15, _x16) {
|
1077
|
-
return _relateNodeIp.
|
1078
|
-
|
1079
|
-
|
1080
|
-
function _relateNodeIp() {
|
1081
|
-
_relateNodeIp = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(txtValue, nodeElement) {
|
1082
|
-
var dm, isUnique, ip, configObj, configData, _elements2, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
987
|
+
return (_relateNodeIp = _relateNodeIp || (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(txtValue, nodeElement) {
|
988
|
+
var dm, isUnique, ip, configObj, configData, _elements, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
1083
989
|
|
1084
990
|
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
1085
|
-
while (1) {
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
}
|
1092
|
-
|
1093
|
-
return _context15.abrupt("return");
|
1094
|
-
|
1095
|
-
case 2:
|
1096
|
-
// if (txtValue === nodeElement.a('bindIp')) {
|
1097
|
-
// return;
|
1098
|
-
// }
|
1099
|
-
// 根据配置查询拓扑数据
|
1100
|
-
dm = topo.getDataModel(); // 执行唯一性验证
|
1101
|
-
|
1102
|
-
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
|
1103
|
-
|
1104
|
-
if (!isUnique) {
|
1105
|
-
_context15.next = 24;
|
1106
|
-
break;
|
1107
|
-
}
|
1108
|
-
|
1109
|
-
ip = (0, _exitLinkUtil.buildIpNode)(txtValue);
|
1110
|
-
_context15.next = 8;
|
1111
|
-
return deleteExLink(nodeElement);
|
1112
|
-
|
1113
|
-
case 8:
|
1114
|
-
nodeElement.a(ip);
|
1115
|
-
nodeElement.setName(txtValue);
|
1116
|
-
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
1117
|
-
|
1118
|
-
configObj = topo.resourceConfig.getConfig();
|
1119
|
-
_context15.next = 14;
|
1120
|
-
return resourceConfig.updateConfig(configObj);
|
991
|
+
while (1) switch (_context15.prev = _context15.next) {
|
992
|
+
case 0:
|
993
|
+
if (txtValue) {
|
994
|
+
_context15.next = 2;
|
995
|
+
break;
|
996
|
+
}
|
1121
997
|
|
1122
|
-
|
1123
|
-
_context15.next = 16;
|
1124
|
-
return editDispatchers.fetchDataByConfig();
|
998
|
+
return _context15.abrupt("return");
|
1125
999
|
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1000
|
+
case 2:
|
1001
|
+
// if (txtValue === nodeElement.a('bindIp')) {
|
1002
|
+
// return;
|
1003
|
+
// }
|
1004
|
+
// 根据配置查询拓扑数据
|
1005
|
+
dm = topo.getDataModel(); // 执行唯一性验证
|
1131
1006
|
|
1132
|
-
|
1133
|
-
return item.type === "link";
|
1134
|
-
});
|
1135
|
-
newLinkGroup = newLinkElements.filter(function (item) {
|
1136
|
-
return item.type === "linkGroup";
|
1137
|
-
}); // const newData = elements.find((item) => item.id === `ip:${txtValue}`);
|
1138
|
-
// console.log("newData",newLinkElements, newLink);
|
1139
|
-
|
1140
|
-
createElementsData = {
|
1141
|
-
groups: [],
|
1142
|
-
nodes: [],
|
1143
|
-
links: newLink,
|
1144
|
-
linkGroups: newLinkGroup
|
1145
|
-
};
|
1146
|
-
console.log("createElementsData", createElementsData);
|
1007
|
+
isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, txtValue, nodeElement); // 获取关联链路
|
1147
1008
|
|
1148
|
-
|
1149
|
-
|
1009
|
+
if (!isUnique) {
|
1010
|
+
_context15.next = 23;
|
1011
|
+
break;
|
1012
|
+
}
|
1150
1013
|
|
1151
|
-
|
1152
|
-
|
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
|
+
}
|
1153
1057
|
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
}
|
1058
|
+
case 23:
|
1059
|
+
case "end":
|
1060
|
+
return _context15.stop();
|
1158
1061
|
}
|
1159
1062
|
}, _callee15);
|
1160
|
-
}));
|
1161
|
-
return _relateNodeIp.apply(this, arguments);
|
1063
|
+
}))).apply(this, arguments);
|
1162
1064
|
}
|
1163
1065
|
|
1164
1066
|
var onEvent = function onEvent(e) {
|