@riil-frontend/component-topology 11.0.34 → 11.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/1.js +2 -2
- package/build/2.js +1 -1
- package/build/index.css +4 -2
- package/build/index.js +52 -45
- package/es/components/MultiResourceDrawer/index.js +22 -26
- package/es/components/ResourceList/ResourceSelect.js +55 -58
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +30 -34
- package/es/components/SingleResourceDrawer/SelectDrawer.js +24 -28
- package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +29 -33
- package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +92 -108
- package/es/core/components/titlebar/widgets/TitleWidget.js +5 -3
- package/es/core/editor/components/BackgroundView/UploadDialog/index.js +17 -18
- package/es/core/editor/components/BackgroundView/index.js +149 -178
- package/es/core/editor/components/CustomIconPlugin/RenameDialog.js +26 -30
- package/es/core/editor/components/CustomIconPlugin/UploadIconDialog.js +33 -34
- package/es/core/editor/components/CustomIconPlugin/utils/svgToShape.js +20 -24
- package/es/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +13 -17
- package/es/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +45 -56
- package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +60 -70
- package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +60 -70
- package/es/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +17 -21
- package/es/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +27 -31
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +21 -25
- package/es/core/editor/components/settings/propertyViews/view/BackgroundSize.js +16 -20
- package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +37 -55
- package/es/core/editor/hooks/useKeyboardShortcut.js +2 -2
- package/es/core/editor/hooks/useNewElementTheme.js +2 -2
- package/es/core/editor/store/background.js +8 -10
- package/es/core/editor/store/topoEdit.js +4 -6
- package/es/core/editor/utils/edgeTypeStyleUtil.js +2 -4
- package/es/core/hooks/usePolling.js +130 -142
- package/es/core/hooks/useResourceConfig.js +76 -100
- package/es/core/hooks/useTopoEdit.js +526 -619
- package/es/core/models/Alarm.js +319 -402
- package/es/core/models/AttributeMetricDisplay.js +115 -143
- package/es/core/models/PluginManager.js +4 -3
- package/es/core/models/SelectionModel.js +4 -5
- package/es/core/models/TopoApp.js +279 -436
- package/es/core/models/TopoGraphView.js +28 -41
- package/es/core/models/cache/CiCache.js +34 -39
- package/es/core/models/cache/CiTypeCache.js +47 -61
- package/es/core/models/cache/DictCache.js +36 -42
- package/es/core/models/graph/Background.js +21 -26
- package/es/core/models/plugins/resourceWebControllUrl.js +84 -103
- package/es/core/models/tagstips/ElementTagTipConfig.js +44 -58
- package/es/core/models/topoData.js +73 -77
- package/es/core/models/utils/linkUtils.js +46 -51
- package/es/core/models/utils/nodeNameVisibleUtil.js +4 -4
- package/es/core/services/alarm.js +14 -16
- package/es/core/services/background.js +59 -67
- package/es/core/services/cmdb/metric.js +14 -18
- package/es/core/services/cmdb.js +23 -27
- package/es/core/services/index.js +48 -68
- package/es/core/services/overview.js +131 -151
- package/es/core/services/topo/basic.js +37 -41
- package/es/core/services/topo/tagtip.js +15 -19
- package/es/core/store/models/ciModel.js +58 -62
- package/es/core/store/models/customIcon.js +126 -145
- package/es/core/store/models/displayConfig.js +15 -19
- package/es/core/store/models/selection.js +4 -6
- package/es/core/store/models/topoAlarm.js +162 -145
- package/es/core/store/models/topoBaseInfoOverview.js +4 -6
- package/es/core/store/models/topoBizMod.js +9 -11
- package/es/core/store/models/topoConfig.js +215 -231
- package/es/core/store/models/topoGraphView.js +4 -6
- package/es/core/store/models/topoMod.js +373 -395
- package/es/core/utils/imageUtil.js +23 -27
- package/es/core/utils/saveSerialize.js +14 -18
- package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +62 -66
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +20 -25
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +363 -409
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +112 -131
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +40 -46
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +219 -275
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +113 -118
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +63 -68
- package/es/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +45 -54
- package/es/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +32 -44
- package/es/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +36 -43
- package/es/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +23 -27
- package/es/networkTopo/components/Link/hook.js +85 -96
- package/es/networkTopo/components/Link/index.js +104 -126
- package/es/networkTopo/components/Link/setting.js +48 -52
- package/es/networkTopo/getTopoData.js +73 -92
- package/es/networkTopo/hooks/viewer/useRelateTopo.js +34 -39
- package/es/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
- package/es/networkTopo/models/TopoCenter.js +28 -46
- package/es/networkTopo/services/alert.js +18 -22
- package/es/networkTopo/services/authorization.js +45 -55
- package/es/networkTopo/services/cmdb.js +548 -696
- package/es/networkTopo/services/funcAuth.js +22 -24
- package/es/networkTopo/services/link.js +107 -117
- package/es/networkTopo/services/mdc.js +33 -48
- package/es/networkTopo/services/metric.js +38 -47
- package/es/networkTopo/services/model.js +616 -809
- package/es/networkTopo/services/risk.js +9 -11
- package/es/networkTopo/services/topo/auth.js +27 -33
- package/es/networkTopo/services/topo/basic.js +251 -289
- package/es/networkTopo/services/topo/blacklist.js +20 -24
- package/es/networkTopo/services/topo/ciInfo.js +27 -31
- package/es/networkTopo/services/topo/icon.js +49 -59
- package/es/networkTopo/services/topo/networkLink.js +32 -36
- package/es/networkTopo/services/topo/relation.js +9 -11
- package/es/networkTopo/services/topo/resourceWebUrl.js +36 -42
- package/es/networkTopo/store/functionAuth.js +31 -37
- package/es/networkTopo/store/topoCenter.js +142 -152
- package/es/networkTopo/store/topoLinkMod.js +4 -6
- package/es/networkTopo/store/topoTreeMod.js +170 -182
- package/es/networkTopo/utils/exportData.js +57 -61
- package/lib/components/MultiResourceDrawer/index.js +22 -26
- package/lib/components/ResourceList/ResourceSelect.js +54 -58
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +33 -37
- package/lib/components/SingleResourceDrawer/SelectDrawer.js +24 -28
- package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +36 -40
- package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +92 -108
- package/lib/core/components/titlebar/widgets/TitleWidget.js +5 -3
- package/lib/core/editor/components/BackgroundView/UploadDialog/index.js +18 -18
- package/lib/core/editor/components/BackgroundView/index.js +148 -177
- package/lib/core/editor/components/CustomIconPlugin/RenameDialog.js +28 -32
- package/lib/core/editor/components/CustomIconPlugin/UploadIconDialog.js +34 -34
- package/lib/core/editor/components/CustomIconPlugin/utils/svgToShape.js +23 -28
- package/lib/core/editor/components/GroupAddResourceDrawerPlugin/GroupAddResourceDrawer.js +14 -18
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/hooks/useCanvasThemeConfig.js +45 -56
- package/lib/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundSetting.js +60 -70
- package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +60 -70
- package/lib/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +18 -22
- package/lib/core/editor/components/settings/propertyViews/node/data/BindResourceDrawer.js +32 -36
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +21 -25
- package/lib/core/editor/components/settings/propertyViews/view/BackgroundSize.js +18 -22
- package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +41 -59
- package/lib/core/editor/hooks/useKeyboardShortcut.js +2 -2
- package/lib/core/editor/hooks/useNewElementTheme.js +2 -2
- package/lib/core/editor/store/background.js +8 -10
- package/lib/core/editor/store/topoEdit.js +4 -6
- package/lib/core/editor/utils/edgeTypeStyleUtil.js +2 -4
- package/lib/core/hooks/usePolling.js +129 -141
- package/lib/core/hooks/useResourceConfig.js +76 -100
- package/lib/core/hooks/useTopoEdit.js +517 -610
- package/lib/core/models/Alarm.js +313 -396
- package/lib/core/models/AttributeMetricDisplay.js +118 -146
- package/lib/core/models/PluginManager.js +4 -3
- package/lib/core/models/SelectionModel.js +4 -5
- package/lib/core/models/TopoApp.js +279 -436
- package/lib/core/models/TopoGraphView.js +28 -41
- package/lib/core/models/cache/CiCache.js +39 -44
- package/lib/core/models/cache/CiTypeCache.js +48 -62
- package/lib/core/models/cache/DictCache.js +39 -45
- package/lib/core/models/graph/Background.js +22 -27
- package/lib/core/models/plugins/resourceWebControllUrl.js +82 -101
- package/lib/core/models/tagstips/ElementTagTipConfig.js +44 -58
- package/lib/core/models/topoData.js +73 -78
- package/lib/core/models/utils/linkUtils.js +45 -51
- package/lib/core/models/utils/nodeNameVisibleUtil.js +4 -4
- package/lib/core/services/alarm.js +18 -20
- package/lib/core/services/background.js +70 -78
- package/lib/core/services/cmdb/metric.js +14 -19
- package/lib/core/services/cmdb.js +24 -29
- package/lib/core/services/index.js +53 -72
- package/lib/core/services/overview.js +131 -151
- package/lib/core/services/topo/basic.js +37 -41
- package/lib/core/services/topo/tagtip.js +16 -21
- package/lib/core/store/models/ciModel.js +66 -70
- package/lib/core/store/models/customIcon.js +126 -145
- package/lib/core/store/models/displayConfig.js +15 -19
- package/lib/core/store/models/selection.js +4 -6
- package/lib/core/store/models/topoAlarm.js +163 -145
- package/lib/core/store/models/topoBaseInfoOverview.js +4 -6
- package/lib/core/store/models/topoBizMod.js +9 -11
- package/lib/core/store/models/topoConfig.js +222 -238
- package/lib/core/store/models/topoGraphView.js +4 -6
- package/lib/core/store/models/topoMod.js +375 -397
- package/lib/core/utils/imageUtil.js +26 -31
- package/lib/core/utils/saveSerialize.js +13 -18
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +62 -66
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +21 -26
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +364 -410
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +114 -133
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/LinkTopoCard.js +44 -50
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +220 -274
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useAlarmAndRiskData.js +113 -118
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/hooks/useMetricModels.js +63 -68
- package/lib/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +40 -50
- package/lib/core/viewer/components/plugins/ResourceDetail/getCiDisplayMetricModels.js +35 -47
- package/lib/core/viewer/components/plugins/ResourceDetail/hooks/useUserId.js +36 -43
- package/lib/core/viewer/components/plugins/ResourceWebControllUrlSettingDialog.js +24 -28
- package/lib/networkTopo/components/Link/hook.js +86 -98
- package/lib/networkTopo/components/Link/index.js +105 -127
- package/lib/networkTopo/components/Link/setting.js +48 -52
- package/lib/networkTopo/getTopoData.js +73 -92
- package/lib/networkTopo/hooks/viewer/useRelateTopo.js +35 -40
- package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
- package/lib/networkTopo/models/TopoCenter.js +28 -46
- package/lib/networkTopo/services/alert.js +18 -22
- package/lib/networkTopo/services/authorization.js +55 -65
- package/lib/networkTopo/services/cmdb.js +551 -700
- package/lib/networkTopo/services/funcAuth.js +24 -26
- package/lib/networkTopo/services/link.js +108 -118
- package/lib/networkTopo/services/mdc.js +35 -51
- package/lib/networkTopo/services/metric.js +37 -47
- package/lib/networkTopo/services/model.js +615 -809
- package/lib/networkTopo/services/risk.js +11 -13
- package/lib/networkTopo/services/topo/auth.js +27 -33
- package/lib/networkTopo/services/topo/basic.js +252 -290
- package/lib/networkTopo/services/topo/blacklist.js +20 -24
- package/lib/networkTopo/services/topo/ciInfo.js +34 -38
- package/lib/networkTopo/services/topo/icon.js +59 -69
- package/lib/networkTopo/services/topo/networkLink.js +32 -36
- package/lib/networkTopo/services/topo/relation.js +11 -13
- package/lib/networkTopo/services/topo/resourceWebUrl.js +44 -50
- package/lib/networkTopo/store/functionAuth.js +31 -37
- package/lib/networkTopo/store/topoCenter.js +142 -152
- package/lib/networkTopo/store/topoLinkMod.js +4 -6
- package/lib/networkTopo/store/topoTreeMod.js +166 -178
- package/lib/networkTopo/utils/exportData.js +63 -68
- package/package.json +4 -3
@@ -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,119 +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, _yield$editDispatcher3, 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
|
-
_yield$editDispatcher3 = _context12.sent;
|
587
|
-
elements = _yield$editDispatcher3.elements;
|
588
|
-
saveBind(TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements); // 临时放这里,仅拓扑中心有
|
589
|
-
|
590
|
-
if (topo.linkDynamicStyleExecutor) {
|
591
|
-
topo.linkDynamicStyleExecutor.execute();
|
592
|
-
}
|
593
|
-
|
594
|
-
case 10:
|
595
|
-
case "end":
|
596
|
-
return _context12.stop();
|
597
|
-
}
|
598
|
-
}
|
599
|
-
}, _callee12);
|
600
|
-
}));
|
601
|
-
return _bindViewResources.apply(this, arguments);
|
602
|
-
}
|
603
|
-
|
604
561
|
function addLayerResources(_x9, _x10) {
|
605
|
-
return _addLayerResources.
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
topo.getHtTopo().addElements(newElements); // 临时放这里,仅拓扑中心有
|
635
|
-
|
636
|
-
if (topo.linkDynamicStyleExecutor) {
|
637
|
-
topo.linkDynamicStyleExecutor.execute();
|
638
|
-
}
|
562
|
+
return (_addLayerResources = _addLayerResources || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(group, newResourceIds) {
|
563
|
+
var _yield$editDispatcher3, elements, newElements;
|
564
|
+
|
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
|
-
|
592
|
+
topo.historyManager.endTransaction();
|
593
|
+
topo.getHtTopo().getGraphView().fitContent(undefined, undefined, true); // 添加资源后隐藏资源面板
|
642
594
|
|
643
|
-
|
644
|
-
|
645
|
-
|
595
|
+
topoEditDispatchers.update({
|
596
|
+
resourceTabActiveKey: null
|
597
|
+
});
|
646
598
|
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
}
|
599
|
+
case 14:
|
600
|
+
case "end":
|
601
|
+
return _context8.stop();
|
651
602
|
}
|
652
|
-
},
|
653
|
-
}));
|
654
|
-
return _addLayerResources.apply(this, arguments);
|
603
|
+
}, _callee8);
|
604
|
+
}))).apply(this, arguments);
|
655
605
|
}
|
656
606
|
|
657
607
|
function addResourceToFirstLayer(_x11) {
|
658
|
-
return _addResourceToFirstLayer.
|
659
|
-
}
|
660
|
-
|
661
|
-
function _addResourceToFirstLayer() {
|
662
|
-
_addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(data) {
|
608
|
+
return (_addResourceToFirstLayer = _addResourceToFirstLayer || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(data) {
|
663
609
|
var group;
|
664
|
-
return _regeneratorRuntime.wrap(function
|
665
|
-
while (1) {
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
return _context14.stop();
|
675
|
-
}
|
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();
|
676
620
|
}
|
677
|
-
},
|
678
|
-
}));
|
679
|
-
return _addResourceToFirstLayer.apply(this, arguments);
|
621
|
+
}, _callee9);
|
622
|
+
}))).apply(this, arguments);
|
680
623
|
}
|
681
624
|
|
682
625
|
function getAddResourceType() {
|
@@ -705,109 +648,91 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
705
648
|
*/
|
706
649
|
|
707
650
|
|
708
|
-
var onSaveComboRes =
|
709
|
-
|
710
|
-
return _regeneratorRuntime.wrap(function
|
711
|
-
while (1) {
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
topo.historyManager.beginTransaction();
|
716
|
-
|
717
|
-
if (!(getAddResourceType() === "addToFirstLayer")) {
|
718
|
-
_context5.next = 7;
|
719
|
-
break;
|
720
|
-
}
|
721
|
-
|
722
|
-
_context5.next = 5;
|
723
|
-
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();
|
724
658
|
|
725
|
-
|
726
|
-
|
659
|
+
if (!(getAddResourceType() === "addToFirstLayer")) {
|
660
|
+
_context10.next = 7;
|
727
661
|
break;
|
662
|
+
}
|
728
663
|
|
729
|
-
|
730
|
-
|
731
|
-
return bindViewResources(data);
|
664
|
+
_context10.next = 5;
|
665
|
+
return addResourceToFirstLayer(data);
|
732
666
|
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
topoEditDispatchers.update({
|
737
|
-
resourceTabActiveKey: null
|
738
|
-
});
|
667
|
+
case 5:
|
668
|
+
_context10.next = 9;
|
669
|
+
break;
|
739
670
|
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
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();
|
744
685
|
}
|
745
|
-
},
|
746
|
-
}));
|
686
|
+
}, _callee10);
|
687
|
+
}))).apply(this, arguments);
|
688
|
+
};
|
747
689
|
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
}();
|
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;
|
752
693
|
|
753
|
-
|
754
|
-
|
755
|
-
|
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
|
+
};
|
756
721
|
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
if (onSave) {
|
765
|
-
// 自定义保存
|
766
|
-
saveConfig = /*#__PURE__*/function () {
|
767
|
-
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
768
|
-
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
769
|
-
while (1) {
|
770
|
-
switch (_context6.prev = _context6.next) {
|
771
|
-
case 0:
|
772
|
-
_context6.next = 2;
|
773
|
-
return editDispatchers.saveTopo({
|
774
|
-
id: id,
|
775
|
-
layout: layout,
|
776
|
-
serialize: serialize
|
777
|
-
});
|
778
|
-
|
779
|
-
case 2:
|
780
|
-
case "end":
|
781
|
-
return _context6.stop();
|
782
|
-
}
|
783
|
-
}
|
784
|
-
}, _callee6);
|
785
|
-
}));
|
786
|
-
|
787
|
-
return function saveConfig() {
|
788
|
-
return _ref7.apply(this, arguments);
|
789
|
-
};
|
790
|
-
}();
|
791
|
-
|
792
|
-
onSave({
|
793
|
-
topo: topo,
|
794
|
-
data: data,
|
795
|
-
saveConfig: saveConfig
|
796
|
-
});
|
797
|
-
}
|
722
|
+
onSave({
|
723
|
+
topo: topo,
|
724
|
+
data: data,
|
725
|
+
saveConfig: saveConfig
|
726
|
+
});
|
727
|
+
}
|
798
728
|
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
}
|
729
|
+
case 3:
|
730
|
+
case "end":
|
731
|
+
return _context12.stop();
|
803
732
|
}
|
804
|
-
},
|
805
|
-
}));
|
806
|
-
|
807
|
-
return function onSaveTopo(_x13) {
|
808
|
-
return _ref6.apply(this, arguments);
|
809
|
-
};
|
810
|
-
}();
|
733
|
+
}, _callee12);
|
734
|
+
}))).apply(this, arguments);
|
735
|
+
};
|
811
736
|
|
812
737
|
var saveBind = function saveBind(type, data) {
|
813
738
|
var eventData = {
|
@@ -830,284 +755,266 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
830
755
|
*/
|
831
756
|
|
832
757
|
|
833
|
-
var bindNodeResource =
|
834
|
-
|
835
|
-
var
|
758
|
+
var bindNodeResource = function bindNodeResource(_x14) {
|
759
|
+
return (_ref8 = _ref8 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(params) {
|
760
|
+
var _doBind;
|
836
761
|
|
837
|
-
|
838
|
-
while (1) {
|
839
|
-
switch (_context9.prev = _context9.next) {
|
840
|
-
case 0:
|
841
|
-
replaceOrAddRes = function _replaceOrAddRes(resources, oldResId, newResId) {
|
842
|
-
return _extends({}, resources, {
|
843
|
-
"static": [].concat(resources["static"].filter(function (item) {
|
844
|
-
return item !== oldResId;
|
845
|
-
}), [newResId])
|
846
|
-
});
|
847
|
-
};
|
762
|
+
var id, oldResId, newResId, node, parentGroupElement, htTopo, config, groupId, groupTag, _yield$editDispatcher4, elements, newData, doBind, replaceOrAddRes;
|
848
763
|
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
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
|
-
linkGroups: newLinkElements.filter(function (item) {
|
881
|
-
return item.type === "linkGroup";
|
882
|
-
})
|
883
|
-
};
|
884
|
-
htTopo.createElements(createElementsData); // 切换前图上如果存在集群内的节点,切换节点为集群后,移到集群内
|
885
|
-
|
886
|
-
groupElement = dm.getDataByTag(newData.id);
|
887
|
-
existedGroupChildren.forEach(function (groupChildData) {
|
888
|
-
var nodeElement = dm.getDataByTag(groupChildData.id);
|
889
|
-
nodeElement.setParent(groupElement);
|
890
|
-
});
|
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);
|
891
795
|
} else {
|
892
|
-
|
893
|
-
groups: [],
|
894
|
-
nodes: [newData],
|
895
|
-
links: newLinkElements.filter(function (item) {
|
896
|
-
return item.type === "link";
|
897
|
-
}),
|
898
|
-
linkGroups: newLinkElements.filter(function (item) {
|
899
|
-
return item.type === "linkGroup";
|
900
|
-
})
|
901
|
-
};
|
902
|
-
htTopo.createElements(createElementsData);
|
796
|
+
newGroupChildren.push(groupChildData);
|
903
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
|
+
}
|
904
829
|
|
905
|
-
|
906
|
-
|
907
|
-
newElement = dm.getDataByTag(newData.id);
|
830
|
+
rlog.debug("批量创建元素", createElementsData); // 恢复图标、大小、位置
|
908
831
|
|
909
|
-
|
910
|
-
newElement.setSize(node.getSize());
|
911
|
-
newElement.setPosition(node.getPosition());
|
912
|
-
newElement.setImage(node.getImage());
|
913
|
-
} // 选中
|
832
|
+
newElement = dm.getDataByTag(newData.id);
|
914
833
|
|
834
|
+
if (newElement) {
|
835
|
+
newElement.setSize(node.getSize());
|
836
|
+
newElement.setPosition(node.getPosition());
|
837
|
+
newElement.setImage(node.getImage());
|
838
|
+
} // 选中
|
915
839
|
|
916
|
-
sm = htTopo.getGraphView().sm();
|
917
|
-
sm.setSelection([newElement]); // 移除旧节点
|
918
840
|
|
919
|
-
|
920
|
-
|
921
|
-
// 删除关联在节点上的出口链路
|
841
|
+
sm = htTopo.getGraphView().sm();
|
842
|
+
sm.setSelection([newElement]); // 移除旧节点
|
922
843
|
|
923
|
-
|
924
|
-
|
844
|
+
dm.remove(node); // saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, newDatas);
|
845
|
+
// node.a("customName", null);
|
846
|
+
// 删除关联在节点上的出口链路
|
925
847
|
|
926
|
-
|
927
|
-
|
928
|
-
if (topo.linkDynamicStyleExecutor) {
|
929
|
-
topo.linkDynamicStyleExecutor.execute();
|
930
|
-
}
|
848
|
+
_context13.next = 12;
|
849
|
+
return deleteExLink(node);
|
931
850
|
|
932
|
-
|
933
|
-
|
934
|
-
|
851
|
+
case 12:
|
852
|
+
// 临时放这里,仅拓扑中心有
|
853
|
+
if (topo.linkDynamicStyleExecutor) {
|
854
|
+
topo.linkDynamicStyleExecutor.execute();
|
935
855
|
}
|
936
|
-
}
|
937
|
-
}, _callee8);
|
938
|
-
}));
|
939
|
-
return _doBind.apply(this, arguments);
|
940
|
-
};
|
941
856
|
|
942
|
-
|
943
|
-
|
944
|
-
|
857
|
+
case 13:
|
858
|
+
case "end":
|
859
|
+
return _context13.stop();
|
860
|
+
}
|
861
|
+
}, _callee13);
|
862
|
+
}))).apply(this, arguments);
|
863
|
+
};
|
945
864
|
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
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); // 节点所属容器
|
950
869
|
|
951
|
-
|
952
|
-
|
953
|
-
|
870
|
+
parentGroupElement = node.getParent();
|
871
|
+
htTopo = topo.getHtTopo();
|
872
|
+
config = resourceConfig.getConfig();
|
954
873
|
|
955
|
-
|
956
|
-
|
957
|
-
|
874
|
+
if (parentGroupElement) {
|
875
|
+
// 在容器中
|
876
|
+
groupId = parentGroupElement.getTag(); // 容器业务id
|
958
877
|
|
959
|
-
|
878
|
+
groupTag = parentGroupElement.a("tag"); // 容器临时id
|
960
879
|
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
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
|
+
} // 未匹配到容器
|
968
887
|
|
969
888
|
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
889
|
+
return g;
|
890
|
+
});
|
891
|
+
} else {
|
892
|
+
// 在画布上
|
893
|
+
config.resources = replaceOrAddRes(config.resources, oldResId, newResId);
|
894
|
+
}
|
976
895
|
|
977
|
-
|
978
|
-
|
896
|
+
_context14.next = 12;
|
897
|
+
return resourceConfig.updateConfig(config);
|
979
898
|
|
980
|
-
|
981
|
-
|
982
|
-
|
899
|
+
case 12:
|
900
|
+
_context14.next = 14;
|
901
|
+
return editDispatchers.fetchDataByConfig();
|
983
902
|
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
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
|
+
});
|
990
909
|
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
910
|
+
if (newData) {
|
911
|
+
_context14.next = 22;
|
912
|
+
break;
|
913
|
+
}
|
995
914
|
|
996
|
-
|
915
|
+
_Message.error("关联资源失败");
|
997
916
|
|
998
|
-
|
999
|
-
|
1000
|
-
|
917
|
+
rlog.warn("关联资源失败");
|
918
|
+
topo.historyManager.endTransaction();
|
919
|
+
return _context14.abrupt("return", false);
|
1001
920
|
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
921
|
+
case 22:
|
922
|
+
_context14.next = 24;
|
923
|
+
return doBind();
|
1005
924
|
|
1006
|
-
|
1007
|
-
|
925
|
+
case 24:
|
926
|
+
topo.historyManager.endTransaction();
|
1008
927
|
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
}
|
928
|
+
case 25:
|
929
|
+
case "end":
|
930
|
+
return _context14.stop();
|
1013
931
|
}
|
1014
|
-
},
|
1015
|
-
}));
|
1016
|
-
|
1017
|
-
return function bindNodeResource(_x14) {
|
1018
|
-
return _ref8.apply(this, arguments);
|
1019
|
-
};
|
1020
|
-
}();
|
932
|
+
}, _callee14);
|
933
|
+
}))).apply(this, arguments);
|
934
|
+
};
|
1021
935
|
/**
|
1022
936
|
* 关联IP的图片节点
|
1023
937
|
*/
|
1024
938
|
|
1025
939
|
|
1026
940
|
function relateNodeIp(_x15, _x16) {
|
1027
|
-
return _relateNodeIp.
|
1028
|
-
}
|
1029
|
-
|
1030
|
-
function _relateNodeIp() {
|
1031
|
-
_relateNodeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(txtValue, nodeElement) {
|
941
|
+
return (_relateNodeIp = _relateNodeIp || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(txtValue, nodeElement) {
|
1032
942
|
var dm, isUnique, ip, configObj, configData, _elements, newLinkElements, newLink, newLinkGroup, createElementsData, _htTopo;
|
1033
943
|
|
1034
944
|
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
1035
|
-
while (1) {
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
}
|
1042
|
-
|
1043
|
-
return _context15.abrupt("return");
|
1044
|
-
|
1045
|
-
case 2:
|
1046
|
-
// if (txtValue === nodeElement.a('bindIp')) {
|
1047
|
-
// return;
|
1048
|
-
// }
|
1049
|
-
// 根据配置查询拓扑数据
|
1050
|
-
dm = topo.getDataModel(); // 执行唯一性验证
|
1051
|
-
|
1052
|
-
isUnique = isUniqueIp(dm, txtValue, nodeElement); // 获取关联链路
|
1053
|
-
|
1054
|
-
if (!isUnique) {
|
1055
|
-
_context15.next = 23;
|
1056
|
-
break;
|
1057
|
-
}
|
1058
|
-
|
1059
|
-
ip = buildIpNode(txtValue);
|
1060
|
-
_context15.next = 8;
|
1061
|
-
return deleteExLink(nodeElement);
|
945
|
+
while (1) switch (_context15.prev = _context15.next) {
|
946
|
+
case 0:
|
947
|
+
if (txtValue) {
|
948
|
+
_context15.next = 2;
|
949
|
+
break;
|
950
|
+
}
|
1062
951
|
|
1063
|
-
|
1064
|
-
nodeElement.a(ip);
|
1065
|
-
nodeElement.setName(txtValue);
|
1066
|
-
nodeElement.setTag("ip:" + txtValue); // 获取配置
|
952
|
+
return _context15.abrupt("return");
|
1067
953
|
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
954
|
+
case 2:
|
955
|
+
// if (txtValue === nodeElement.a('bindIp')) {
|
956
|
+
// return;
|
957
|
+
// }
|
958
|
+
// 根据配置查询拓扑数据
|
959
|
+
dm = topo.getDataModel(); // 执行唯一性验证
|
1071
960
|
|
1072
|
-
|
1073
|
-
_context15.next = 16;
|
1074
|
-
return editDispatchers.fetchDataByConfig();
|
961
|
+
isUnique = isUniqueIp(dm, txtValue, nodeElement); // 获取关联链路
|
1075
962
|
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
newLinkElements = findUNExistedLinkElements(_elements); // console.log("configData", configData, newLinkElements);
|
963
|
+
if (!isUnique) {
|
964
|
+
_context15.next = 23;
|
965
|
+
break;
|
966
|
+
}
|
1081
967
|
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
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
|
+
}
|
1102
1011
|
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
}
|
1012
|
+
case 23:
|
1013
|
+
case "end":
|
1014
|
+
return _context15.stop();
|
1107
1015
|
}
|
1108
1016
|
}, _callee15);
|
1109
|
-
}));
|
1110
|
-
return _relateNodeIp.apply(this, arguments);
|
1017
|
+
}))).apply(this, arguments);
|
1111
1018
|
}
|
1112
1019
|
|
1113
1020
|
var onEvent = function onEvent(e) {
|