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