@riil-frontend/component-topology 3.4.0 → 3.5.0-a.2
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/index.js +7 -7
- package/es/constants/ResourceTypeLimit.js +28 -2
- package/es/core/components/AlarmListPanel/components/AlarmListItem.js +6 -1
- package/es/core/components/TopoView/topoView.js +7 -3
- package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +29 -1
- package/es/core/models/Alarm.js +1 -4
- package/es/core/models/DataModel.js +20 -0
- package/es/core/models/TopoApp.js +1 -1
- package/es/hooks/useManageStatus.js +43 -0
- package/es/hooks/useTopoEdit.js +0 -5
- package/es/models/topoAlarm.js +1 -4
- package/es/models/topoConfig.js +2 -2
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +1 -3
- package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +1 -3
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +64 -32
- package/es/topoCenter/getTopoData.js +53 -9
- package/es/topoCenter/hooks/editor/useDeleteEdges.js +2 -0
- package/es/topoCenter/store/topoTreeMod.js +6 -19
- package/es/topoCenter/utils/linPermissionUtil.js +3 -17
- package/es/topoCenter/utils/resourcePermissionUtil.js +84 -0
- package/es/utils/ResourceConfigUtil.js +1 -1
- package/es/utils/htElementUtils.js +11 -0
- package/lib/constants/ResourceTypeLimit.js +37 -3
- package/lib/core/components/AlarmListPanel/components/AlarmListItem.js +6 -1
- package/lib/core/components/TopoView/topoView.js +7 -2
- package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +32 -1
- package/lib/core/models/Alarm.js +1 -4
- package/lib/core/models/DataModel.js +20 -0
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/hooks/useManageStatus.js +50 -0
- package/lib/hooks/useTopoEdit.js +0 -5
- package/lib/models/topoAlarm.js +0 -6
- package/lib/models/topoConfig.js +1 -1
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +1 -4
- package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +1 -3
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +64 -32
- package/lib/topoCenter/getTopoData.js +55 -9
- package/lib/topoCenter/hooks/editor/useDeleteEdges.js +2 -0
- package/lib/topoCenter/store/topoTreeMod.js +7 -20
- package/lib/topoCenter/utils/linPermissionUtil.js +4 -18
- package/lib/topoCenter/utils/resourcePermissionUtil.js +98 -0
- package/lib/utils/ResourceConfigUtil.js +1 -1
- package/lib/utils/htElementUtils.js +19 -6
- package/package.json +3 -3
|
@@ -1,6 +1,32 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
var excludeTypes = ['data_center', 'manage_assets', 'network_link', 'access_link']; // 过滤模型树
|
|
3
|
+
|
|
4
|
+
export function filterModelTree(modelTree) {
|
|
5
|
+
return modelTree.filter(function (node) {
|
|
6
|
+
return !excludeTypes.includes(node.code);
|
|
7
|
+
}).map(function (node) {
|
|
8
|
+
return _extends({}, node, {
|
|
9
|
+
childs: filterModelTree(node.childs || []).filter(function (child) {
|
|
10
|
+
return child.monitorable;
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export function getCiModels(modelTree) {
|
|
16
|
+
var list = [];
|
|
17
|
+
filterModelTree(modelTree).forEach(function (domainModel) {
|
|
18
|
+
list.push.apply(list, domainModel.childs);
|
|
19
|
+
});
|
|
20
|
+
return list;
|
|
21
|
+
} // 资源选择组件过滤类型
|
|
22
|
+
|
|
1
23
|
export var filterCiTypes = function filterCiTypes(tree) {
|
|
2
|
-
return tree.filter(function (
|
|
3
|
-
return
|
|
24
|
+
return tree.filter(function (node) {
|
|
25
|
+
return !excludeTypes.includes(node.value);
|
|
26
|
+
}).map(function (node) {
|
|
27
|
+
return _extends({}, node, {
|
|
28
|
+
children: filterCiTypes(node.children || [])
|
|
29
|
+
});
|
|
4
30
|
});
|
|
5
31
|
};
|
|
6
32
|
export var getNetworkTopoCommonResListProps = function getNetworkTopoCommonResListProps() {
|
|
@@ -5,6 +5,11 @@ import { Link } from "react-router-dom";
|
|
|
5
5
|
import styles from "./index.module.scss";
|
|
6
6
|
import { PAGE_TYPE } from "../constants/uicbb";
|
|
7
7
|
|
|
8
|
+
var alarmLink = function alarmLink(alarmInfo) {
|
|
9
|
+
console.log("alarmLink", alarmInfo);
|
|
10
|
+
return "/default/pagecenter/" + PAGE_TYPE.ALERT_DETAIL + "/view/" + alarmInfo.alertId + "?alertId=" + alarmInfo.alertId + "&resId=" + alarmInfo.ciId + "&title=" + alarmInfo.alertObject + "&ruleId=" + alarmInfo.ruleId + "&ciCode=" + alarmInfo.ciTypeCode + "&ciType=" + alarmInfo.ciType;
|
|
11
|
+
};
|
|
12
|
+
|
|
8
13
|
function AlarmListItem(props) {
|
|
9
14
|
// 传入参数
|
|
10
15
|
var topo = props.topo,
|
|
@@ -17,7 +22,7 @@ function AlarmListItem(props) {
|
|
|
17
22
|
className: styles["alarm-color-icon"] + " alarm-color-icon-lv" + alarmInfo.alertLevel
|
|
18
23
|
})
|
|
19
24
|
}, /*#__PURE__*/React.createElement(Link, {
|
|
20
|
-
to:
|
|
25
|
+
to: alarmLink(alarmInfo)
|
|
21
26
|
}, "" + alarmInfo.alertObject + alarmInfo.alertTitle));
|
|
22
27
|
}
|
|
23
28
|
|
|
@@ -4,7 +4,7 @@ import PropTypes from "prop-types";
|
|
|
4
4
|
import classnames from "classnames";
|
|
5
5
|
import TopoGraph, { TopoEvent } from "@riil-frontend/component-topology-graph";
|
|
6
6
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
7
|
-
import {
|
|
7
|
+
import { useCbbEventListener } from "@riil-frontend/component-riil-event-emitter";
|
|
8
8
|
import useTopoEdit from "../../../hooks/useTopoEdit";
|
|
9
9
|
import useSelection from "../../../hooks/useSelection";
|
|
10
10
|
import showMessage from "../../utils/showMessage";
|
|
@@ -16,6 +16,7 @@ import PropertyView from "../../editor/components/settings/PropertyView";
|
|
|
16
16
|
import BackgroundView from "../../editor/components/BackgroundView";
|
|
17
17
|
import { updateEdgeExpanded } from "../../utils/edgeUtil";
|
|
18
18
|
import styles from "./TopoView.module.scss";
|
|
19
|
+
import useManageStatus from "../../../hooks/useManageStatus";
|
|
19
20
|
|
|
20
21
|
var Topology = function Topology(props) {
|
|
21
22
|
var _classnames, _graphViewProps$creat;
|
|
@@ -65,7 +66,6 @@ var Topology = function Topology(props) {
|
|
|
65
66
|
tData = _useState[0],
|
|
66
67
|
setTData = _useState[1];
|
|
67
68
|
|
|
68
|
-
var titleBarRef = useRef();
|
|
69
69
|
var topoEdit = useTopoEdit({
|
|
70
70
|
topo: topo,
|
|
71
71
|
topoId: topoId,
|
|
@@ -81,10 +81,14 @@ var Topology = function Topology(props) {
|
|
|
81
81
|
var onExitEdit = topoEdit.onExitEdit,
|
|
82
82
|
onBindData = topoEdit.onBindData,
|
|
83
83
|
onDeleteElement = topoEdit.onDeleteElement,
|
|
84
|
-
onSaveTopo = topoEdit.onSaveTopo;
|
|
84
|
+
onSaveTopo = topoEdit.onSaveTopo;
|
|
85
|
+
var titleBarRef = useRef(); // useAlarm({
|
|
85
86
|
// topo,
|
|
86
87
|
// });
|
|
87
88
|
|
|
89
|
+
useManageStatus({
|
|
90
|
+
topo: topo
|
|
91
|
+
});
|
|
88
92
|
useCbbEventListener("topo", {
|
|
89
93
|
name: "topo",
|
|
90
94
|
onMessage: function onMessage(data) {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import _Box from "@alifd/next/es/box";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _Dialog from "@alifd/next/es/dialog";
|
|
2
4
|
import _Button from "@alifd/next/es/button";
|
|
5
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
6
|
import React from "react";
|
|
4
7
|
import classnames from "classnames";
|
|
5
8
|
import TitleWidget from "../../../components/titlebar/widgets/TitleWidget";
|
|
@@ -32,7 +35,32 @@ export default function TopoEditorTitleBar(props) {
|
|
|
32
35
|
}, "\u4FDD\u5B58"), /*#__PURE__*/React.createElement(_Button, {
|
|
33
36
|
className: styles.button,
|
|
34
37
|
onClick: function onClick() {
|
|
35
|
-
|
|
38
|
+
_Dialog.confirm({
|
|
39
|
+
title: "提示",
|
|
40
|
+
content: "若现在退出,图上修改的内容将不会保存!",
|
|
41
|
+
onOk: function () {
|
|
42
|
+
var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
43
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
44
|
+
while (1) {
|
|
45
|
+
switch (_context.prev = _context.next) {
|
|
46
|
+
case 0:
|
|
47
|
+
topo.exitEditMode();
|
|
48
|
+
|
|
49
|
+
case 1:
|
|
50
|
+
case "end":
|
|
51
|
+
return _context.stop();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, _callee);
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
function onOk() {
|
|
58
|
+
return _onOk.apply(this, arguments);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return onOk;
|
|
62
|
+
}()
|
|
63
|
+
});
|
|
36
64
|
}
|
|
37
65
|
}, "\u9000\u51FA"))));
|
|
38
66
|
}
|
package/es/core/models/Alarm.js
CHANGED
|
@@ -501,10 +501,7 @@ var Alarm = /*#__PURE__*/function () {
|
|
|
501
501
|
return handleAlarmEvent;
|
|
502
502
|
}();
|
|
503
503
|
|
|
504
|
-
_proto.
|
|
505
|
-
// rlog.debug("alart----------------alarmList", alarmList);
|
|
506
|
-
this.topo.topoClient.loadAlarm(alarmList);
|
|
507
|
-
};
|
|
504
|
+
_proto.updateGraphAlarm = function updateGraphAlarm() {};
|
|
508
505
|
|
|
509
506
|
_proto.getState = function getState() {
|
|
510
507
|
return this.topo.store.getModelState("topoAlarm");
|
|
@@ -19,6 +19,26 @@ var DataModel = /*#__PURE__*/function () {
|
|
|
19
19
|
return [].concat(this.getGroups(), this.getNodes(), this.getEdges(), this.getEdgeGroups());
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
_proto.useDatas = function useDatas() {
|
|
23
|
+
var topo = this.topo;
|
|
24
|
+
|
|
25
|
+
var _topo$store$useModelS = topo.store.useModelState('topoMod'),
|
|
26
|
+
data = _topo$store$useModelS.data;
|
|
27
|
+
|
|
28
|
+
if (data) {
|
|
29
|
+
return this.getDatas();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return [];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
_proto.useResources = function useResources() {
|
|
36
|
+
var datas = this.useDatas();
|
|
37
|
+
return datas.filter(function (item) {
|
|
38
|
+
return item.type !== 'group';
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
|
|
22
42
|
_proto.getDataById = function getDataById(id) {
|
|
23
43
|
return this.getDatas().find(function (item) {
|
|
24
44
|
return item.id === id;
|
|
@@ -20,7 +20,7 @@ import { updateEdgeExpanded } from "../utils/edgeUtil";
|
|
|
20
20
|
import PluginManager from "./PluginManager";
|
|
21
21
|
import topoFactory from "./topoFactory"; // eslint-disable-next-line no-undef
|
|
22
22
|
|
|
23
|
-
var version = typeof "3.
|
|
23
|
+
var version = typeof "3.5.0-a.2" === 'string' ? "3.5.0-a.2" : null;
|
|
24
24
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
|
25
25
|
/**
|
|
26
26
|
* 拓扑显示和编辑
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { setElementRuntimeStyle } from "../utils/htElementUtils";
|
|
3
|
+
import { useEventListener, useCbbEventListener } from '@riil-frontend/component-riil-event-emitter';
|
|
4
|
+
/**
|
|
5
|
+
* 监听监控状态推送
|
|
6
|
+
* 节点、连线监控状态置灰
|
|
7
|
+
*
|
|
8
|
+
* @param {*} props
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export default function useManageStatus(props) {
|
|
12
|
+
var topo = props.topo;
|
|
13
|
+
var topoModState = topo.store.useModelState('topoMod');
|
|
14
|
+
var graphLoaded = topoModState.graphLoaded;
|
|
15
|
+
var resources = topo.dataModel.useResources();
|
|
16
|
+
useEffect(function () {
|
|
17
|
+
// 启动监听
|
|
18
|
+
return function () {// 注销监听
|
|
19
|
+
};
|
|
20
|
+
}, []);
|
|
21
|
+
useEffect(function () {
|
|
22
|
+
// 首次加载和监控状态变化后,更新节点和连线置灰状态
|
|
23
|
+
if (graphLoaded) {
|
|
24
|
+
resources.forEach(function (resource) {
|
|
25
|
+
var type = resource.type,
|
|
26
|
+
id = resource.id,
|
|
27
|
+
manageStatus = resource.manageStatus,
|
|
28
|
+
permission = resource.permission;
|
|
29
|
+
var isMonite = manageStatus === 3;
|
|
30
|
+
var readable = !!(permission !== null && permission !== void 0 && permission.readable);
|
|
31
|
+
var showNotMoniteStatus = !isMonite && readable;
|
|
32
|
+
var element = topo.getDataModel().getDataByTag(id);
|
|
33
|
+
if (!element) return;
|
|
34
|
+
|
|
35
|
+
if (type === 'node') {
|
|
36
|
+
setElementRuntimeStyle(element, 'opacity', showNotMoniteStatus ? 0.3 : undefined);
|
|
37
|
+
} else {
|
|
38
|
+
setElementRuntimeStyle(element, 'color', showNotMoniteStatus ? '#C9CED2' : undefined);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}, [graphLoaded, resources]);
|
|
43
|
+
}
|
package/es/hooks/useTopoEdit.js
CHANGED
|
@@ -335,11 +335,6 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
335
335
|
case 'link':
|
|
336
336
|
if (onLineDelete) {
|
|
337
337
|
onLineDelete(data);
|
|
338
|
-
} // 临时放这里,仅拓扑中心有
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
if (topo.linkDynamicStyleExecutor) {
|
|
342
|
-
topo.linkDynamicStyleExecutor.execute();
|
|
343
338
|
}
|
|
344
339
|
|
|
345
340
|
break;
|
package/es/models/topoAlarm.js
CHANGED
|
@@ -5,12 +5,9 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
5
5
|
/**
|
|
6
6
|
* 告警
|
|
7
7
|
*/
|
|
8
|
-
import topoServer from "@riil-frontend/component-topology-common/es/services/topo";
|
|
9
|
-
import { getLatestMetrics } from "@riil-frontend/component-topology-common/es/services/metric";
|
|
10
|
-
import { getCiMeta } from "@riil-frontend/component-topology-common/es/services/model";
|
|
11
8
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
12
9
|
import _ from "lodash";
|
|
13
|
-
import {
|
|
10
|
+
import { sortList } from "../utils/topoData";
|
|
14
11
|
var showAlarmStatus = ["toDeal", "dealing", "change"];
|
|
15
12
|
export default {
|
|
16
13
|
// 定义 model 的初始 state
|
package/es/models/topoConfig.js
CHANGED
|
@@ -13,7 +13,7 @@ import { removeFromArray } from "../utils/format";
|
|
|
13
13
|
import { DEFAULT_GROUP } from "../utils/template";
|
|
14
14
|
import { combTopoData, getCiTypes } from "../utils/topoData";
|
|
15
15
|
import { saveTopo as _saveTopo, resToConditions, getLayoutId } from "../core/models/topoData";
|
|
16
|
-
import {
|
|
16
|
+
import { buildData as buildTopoData } from "../topoCenter/getTopoData";
|
|
17
17
|
|
|
18
18
|
var newGroupWithUUID = function newGroupWithUUID(group) {
|
|
19
19
|
if (group === void 0) {
|
|
@@ -331,7 +331,7 @@ export default function (topoApp) {
|
|
|
331
331
|
data = _context4.sent;
|
|
332
332
|
rlog.debug("getTopoByConditions--------data", data);
|
|
333
333
|
_context4.next = 11;
|
|
334
|
-
return
|
|
334
|
+
return buildTopoData(data);
|
|
335
335
|
|
|
336
336
|
case 11:
|
|
337
337
|
data = _context4.sent;
|
|
@@ -20,10 +20,8 @@ export default function LinkDataTab(props) {
|
|
|
20
20
|
linkGroups = _topo$store$useModelS.linkGroups;
|
|
21
21
|
var linkData = [].concat(links, linkGroups).find(function (item) {
|
|
22
22
|
return item.id === edge.getTag();
|
|
23
|
-
});
|
|
24
|
-
|
|
23
|
+
});
|
|
25
24
|
useEffect(function () {
|
|
26
|
-
rlog.debug("LinkDataTab--edge-linkData", edge, linkData);
|
|
27
25
|
setLink(linkData);
|
|
28
26
|
}, [edge, linkData]);
|
|
29
27
|
var permission = getLinkPermission(edge, nodes, link);
|
package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js
CHANGED
|
@@ -7,9 +7,7 @@ import { getLinkPermission } from "../../../../../../topoCenter/utils/linPermiss
|
|
|
7
7
|
import { getNodes } from "../../../../../../utils/htElementUtils.js";
|
|
8
8
|
export default function LinkPropertyView(props) {
|
|
9
9
|
var edge = props.edge,
|
|
10
|
-
topo = props.topo;
|
|
11
|
-
console.log("LinkPropertyView-----", edge, edge.getSource()); // 无权限不显示数据页签
|
|
12
|
-
// const operation = props.edge.a('operation');
|
|
10
|
+
topo = props.topo; // 无权限不显示数据页签
|
|
13
11
|
|
|
14
12
|
var _topo$store$useModelS = topo.store.useModelState("topoMod").data,
|
|
15
13
|
links = _topo$store$useModelS.links,
|
|
@@ -23,6 +23,10 @@ function AddLinkDrawer(props) {
|
|
|
23
23
|
lineData = props.lineData;
|
|
24
24
|
var store = topo.store;
|
|
25
25
|
|
|
26
|
+
var _topo$store$useModel = topo.store.useModel("topoMod"),
|
|
27
|
+
topoState = _topo$store$useModel[0],
|
|
28
|
+
topoDispatchers = _topo$store$useModel[1];
|
|
29
|
+
|
|
26
30
|
var _store$useModel = store.useModel("topoConfig"),
|
|
27
31
|
editState = _store$useModel[0],
|
|
28
32
|
editDispatchers = _store$useModel[1];
|
|
@@ -33,8 +37,6 @@ function AddLinkDrawer(props) {
|
|
|
33
37
|
|
|
34
38
|
var addLinkIsOpen = editState.addLinkIsOpen,
|
|
35
39
|
currentLink = editState.currentLink;
|
|
36
|
-
var ciConnectable = linkState.ciConnectable; // // rlog.debug("addLinkDrawer--init-addLinkIsOpen", addLinkIsOpen, currentLink);
|
|
37
|
-
// const [visible, { setTrue, setFalse }] = useBoolean();
|
|
38
40
|
|
|
39
41
|
var _useState = useState(),
|
|
40
42
|
link = _useState[0],
|
|
@@ -46,12 +48,16 @@ function AddLinkDrawer(props) {
|
|
|
46
48
|
|
|
47
49
|
var _useState3 = useState(false),
|
|
48
50
|
loading = _useState3[0],
|
|
49
|
-
setLoading = _useState3[1];
|
|
51
|
+
setLoading = _useState3[1];
|
|
52
|
+
|
|
53
|
+
var _useState4 = useState(),
|
|
54
|
+
sourceIFDoc = _useState4[0],
|
|
55
|
+
setSourceIFDoc = _useState4[1]; // 保存后更新拓扑图状态
|
|
50
56
|
|
|
51
57
|
|
|
52
|
-
var
|
|
53
|
-
ciIdsConnectable =
|
|
54
|
-
setCiIdsConnectable =
|
|
58
|
+
var _useState5 = useState([]),
|
|
59
|
+
ciIdsConnectable = _useState5[0],
|
|
60
|
+
setCiIdsConnectable = _useState5[1];
|
|
55
61
|
|
|
56
62
|
var linkNodesRef = useRef();
|
|
57
63
|
|
|
@@ -193,6 +199,7 @@ function AddLinkDrawer(props) {
|
|
|
193
199
|
|
|
194
200
|
case 6:
|
|
195
201
|
targetPorts = _context3.sent;
|
|
202
|
+
setSourceIFDoc(sourcePorts.portsDoc);
|
|
196
203
|
connect_type = currentLink.attributes["network_link.connect_type"] === "exit" ? "exit" : "phy";
|
|
197
204
|
setLink({
|
|
198
205
|
source: {
|
|
@@ -220,7 +227,7 @@ function AddLinkDrawer(props) {
|
|
|
220
227
|
})
|
|
221
228
|
});
|
|
222
229
|
|
|
223
|
-
case
|
|
230
|
+
case 10:
|
|
224
231
|
case "end":
|
|
225
232
|
return _context3.stop();
|
|
226
233
|
}
|
|
@@ -243,23 +250,17 @@ function AddLinkDrawer(props) {
|
|
|
243
250
|
|
|
244
251
|
var getCiTypesConnectable = /*#__PURE__*/function () {
|
|
245
252
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
246
|
-
var
|
|
253
|
+
var ciTypesConnectable, nodes, ciIds, ciNodes;
|
|
247
254
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
248
255
|
while (1) {
|
|
249
256
|
switch (_context4.prev = _context4.next) {
|
|
250
257
|
case 0:
|
|
251
|
-
|
|
252
|
-
// 加载哪些ci类型可创建链路
|
|
253
|
-
|
|
254
|
-
_context4.next = 3;
|
|
258
|
+
_context4.next = 2;
|
|
255
259
|
return topoService.networkLink.getCiTypesConnectable(RESOURCE_LIMIT_TYPES);
|
|
256
260
|
|
|
257
|
-
case
|
|
261
|
+
case 2:
|
|
258
262
|
ciTypesConnectable = _context4.sent;
|
|
259
|
-
nodes = getNodes(topo.getDataModel());
|
|
260
|
-
// const tags = topo.getTag();
|
|
261
|
-
// rlog.debug("加载哪些ci类型可创建链路", ciTypesConnectable, topo, nodes);
|
|
262
|
-
|
|
263
|
+
nodes = getNodes(topo.getDataModel());
|
|
263
264
|
ciIds = [];
|
|
264
265
|
ciNodes = [];
|
|
265
266
|
nodes.map(function (node) {
|
|
@@ -275,7 +276,7 @@ function AddLinkDrawer(props) {
|
|
|
275
276
|
setCiIdsConnectable(ciIds);
|
|
276
277
|
return _context4.abrupt("return", ciNodes);
|
|
277
278
|
|
|
278
|
-
case
|
|
279
|
+
case 10:
|
|
279
280
|
case "end":
|
|
280
281
|
return _context4.stop();
|
|
281
282
|
}
|
|
@@ -375,9 +376,36 @@ function AddLinkDrawer(props) {
|
|
|
375
376
|
}
|
|
376
377
|
};
|
|
377
378
|
|
|
379
|
+
var mergeExitLinkData = function mergeExitLinkData(data, attributes) {
|
|
380
|
+
return {
|
|
381
|
+
id: data.id,
|
|
382
|
+
name: data.name,
|
|
383
|
+
source: data["network_link.source_device_id"],
|
|
384
|
+
target: data["network_link.destination_device_id"],
|
|
385
|
+
operation: data.operation,
|
|
386
|
+
interfaceSource: data["source_id"],
|
|
387
|
+
interfaceTarget: data["destination_id"],
|
|
388
|
+
ciType: data.ciType,
|
|
389
|
+
attributes: _extends({}, attributes, {
|
|
390
|
+
display_name: data.display_name,
|
|
391
|
+
name: data.name,
|
|
392
|
+
"network_link.actual_bandwidth": data["network_link.actual_bandwidth"],
|
|
393
|
+
"network_link.connect_type": data["network_link.connect_type"],
|
|
394
|
+
"network_link.destination_ipv4": data["network_link.destination_ipv4"],
|
|
395
|
+
"network_link.source_device_id": data["network_link.source_device_id"],
|
|
396
|
+
source_id: data.source_id,
|
|
397
|
+
support_templates: data.support_templates,
|
|
398
|
+
use: data.use,
|
|
399
|
+
source_id_object: {
|
|
400
|
+
displayName: sourceIFDoc[data.source_id].label
|
|
401
|
+
}
|
|
402
|
+
})
|
|
403
|
+
};
|
|
404
|
+
};
|
|
405
|
+
|
|
378
406
|
var onSave = /*#__PURE__*/function () {
|
|
379
407
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
|
|
380
|
-
var parm, result, linkType, config, exportLinkIdList, _yield$editDispatcher, elements, linkData, edge, aobj, target;
|
|
408
|
+
var parm, result, linkType, config, exportLinkIdList, _yield$editDispatcher, elements, linkData, edge, aobj, target, links, linkAttrKey, newLinkData, newLinks, newData;
|
|
381
409
|
|
|
382
410
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
383
411
|
while (1) {
|
|
@@ -413,10 +441,7 @@ function AddLinkDrawer(props) {
|
|
|
413
441
|
result = _context5.sent;
|
|
414
442
|
|
|
415
443
|
case 13:
|
|
416
|
-
setLoading(false);
|
|
417
|
-
// Message.success("保存成功");
|
|
418
|
-
// }
|
|
419
|
-
|
|
444
|
+
setLoading(false);
|
|
420
445
|
linkType = data["network_link.connect_type"];
|
|
421
446
|
_context5.prev = 15;
|
|
422
447
|
|
|
@@ -425,9 +450,7 @@ function AddLinkDrawer(props) {
|
|
|
425
450
|
break;
|
|
426
451
|
}
|
|
427
452
|
|
|
428
|
-
config = topo.resourceConfig.getConfigFromHt(); //
|
|
429
|
-
// console.log("save success", data, result);
|
|
430
|
-
// 新建后显示到图上
|
|
453
|
+
config = topo.resourceConfig.getConfigFromHt(); // 新建后显示到图上
|
|
431
454
|
|
|
432
455
|
if (!isAddMode) {
|
|
433
456
|
_context5.next = 31;
|
|
@@ -465,12 +488,7 @@ function AddLinkDrawer(props) {
|
|
|
465
488
|
break;
|
|
466
489
|
|
|
467
490
|
case 31:
|
|
468
|
-
// console.log(
|
|
469
|
-
// "保存编辑信息",
|
|
470
|
-
// data,
|
|
471
|
-
// linkType,
|
|
472
|
-
// topo.getGraphView().dm().sm().ld()
|
|
473
|
-
// );
|
|
491
|
+
// console.log("保存编辑信息", data, linkType);
|
|
474
492
|
if (linkType === "exit") {
|
|
475
493
|
edge = topo.getGraphView().dm().sm().ld();
|
|
476
494
|
aobj = edge.getAttrObject();
|
|
@@ -480,6 +498,20 @@ function AddLinkDrawer(props) {
|
|
|
480
498
|
if (target.getTag() === undefined) {
|
|
481
499
|
target.a("name", data["network_link.destination_ipv4"]);
|
|
482
500
|
}
|
|
501
|
+
|
|
502
|
+
links = topoState.data.links;
|
|
503
|
+
linkAttrKey = links.findIndex(function (item) {
|
|
504
|
+
return item.id === aobj.id;
|
|
505
|
+
});
|
|
506
|
+
newLinkData = mergeExitLinkData(edge.getAttrObject(), links[linkAttrKey]);
|
|
507
|
+
newLinks = clone(links);
|
|
508
|
+
newLinks.splice(linkAttrKey, 1, newLinkData);
|
|
509
|
+
newData = _extends({}, topoState.data, {
|
|
510
|
+
links: newLinks
|
|
511
|
+
});
|
|
512
|
+
topoDispatchers.update({
|
|
513
|
+
data: newData
|
|
514
|
+
});
|
|
483
515
|
}
|
|
484
516
|
|
|
485
517
|
_Message.success("保存成功");
|
|
@@ -3,6 +3,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
import topoService from "@riil-frontend/component-topology-common/es/services/topo";
|
|
5
5
|
import { getLinksDetail } from "../core/models/utils/linkUtils";
|
|
6
|
+
import { addTopoDataResourcePermission } from "./utils/resourcePermissionUtil";
|
|
6
7
|
export function addLinkData(_x) {
|
|
7
8
|
return _addLinkData.apply(this, arguments);
|
|
8
9
|
}
|
|
@@ -49,30 +50,73 @@ function _addLinkData() {
|
|
|
49
50
|
return _addLinkData.apply(this, arguments);
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
export
|
|
53
|
-
return
|
|
53
|
+
export function buildData(_x2) {
|
|
54
|
+
return _buildData.apply(this, arguments);
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
var
|
|
57
|
+
function _buildData() {
|
|
58
|
+
_buildData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(data) {
|
|
59
|
+
var newData;
|
|
59
60
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
60
61
|
while (1) {
|
|
61
62
|
switch (_context2.prev = _context2.next) {
|
|
62
63
|
case 0:
|
|
63
64
|
_context2.next = 2;
|
|
64
|
-
return
|
|
65
|
+
return addLinkData(data);
|
|
65
66
|
|
|
66
67
|
case 2:
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
newData = _context2.sent;
|
|
69
|
+
newData = addTopoDataResourcePermission(newData);
|
|
70
|
+
return _context2.abrupt("return", newData);
|
|
69
71
|
|
|
70
|
-
case
|
|
72
|
+
case 5:
|
|
71
73
|
case "end":
|
|
72
74
|
return _context2.stop();
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
}, _callee2);
|
|
76
78
|
}));
|
|
79
|
+
return _buildData.apply(this, arguments);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export default function getTopoData(_x3) {
|
|
83
|
+
return _getTopoData.apply(this, arguments);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function _getTopoData() {
|
|
87
|
+
_getTopoData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id) {
|
|
88
|
+
var data;
|
|
89
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
90
|
+
while (1) {
|
|
91
|
+
switch (_context3.prev = _context3.next) {
|
|
92
|
+
case 0:
|
|
93
|
+
_context3.next = 2;
|
|
94
|
+
return topoService.getTopoData(id);
|
|
95
|
+
|
|
96
|
+
case 2:
|
|
97
|
+
data = _context3.sent;
|
|
98
|
+
|
|
99
|
+
if (data) {
|
|
100
|
+
_context3.next = 5;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return _context3.abrupt("return", data);
|
|
105
|
+
|
|
106
|
+
case 5:
|
|
107
|
+
_context3.next = 7;
|
|
108
|
+
return buildData(data);
|
|
109
|
+
|
|
110
|
+
case 7:
|
|
111
|
+
data = _context3.sent;
|
|
112
|
+
return _context3.abrupt("return", data);
|
|
113
|
+
|
|
114
|
+
case 9:
|
|
115
|
+
case "end":
|
|
116
|
+
return _context3.stop();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}, _callee3);
|
|
120
|
+
}));
|
|
77
121
|
return _getTopoData.apply(this, arguments);
|
|
78
122
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import _Message from "@alifd/next/es/message";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
5
|
import topoServer from '@riil-frontend/component-topology-common/es/services/topo';
|
|
5
6
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
|
6
|
-
import { treeMockData, topoInteData } from "../../utils/topoMocks";
|
|
7
7
|
import { formatTree, loopTree, loopTreeFun, findParentIdsById, treeNodeCount } from "../../utils/tree";
|
|
8
8
|
|
|
9
9
|
var clone = function clone(data) {
|
|
@@ -20,7 +20,6 @@ export default function (topoApp) {
|
|
|
20
20
|
treeData: [],
|
|
21
21
|
// 是否加载数据
|
|
22
22
|
loaded: false,
|
|
23
|
-
topoInteData: topoInteData,
|
|
24
23
|
selectedNode: [],
|
|
25
24
|
defId: '',
|
|
26
25
|
drawVisible: false,
|
|
@@ -263,25 +262,13 @@ export default function (topoApp) {
|
|
|
263
262
|
|
|
264
263
|
case 4:
|
|
265
264
|
resTreeData = _context5.sent;
|
|
265
|
+
_context5.next = 7;
|
|
266
|
+
return _this4.refreshTree();
|
|
266
267
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
// treeData,
|
|
270
|
-
// conditions,
|
|
271
|
-
// (parent, index, arr) => {
|
|
272
|
-
// arr[index].showDefault = true;
|
|
273
|
-
// }
|
|
274
|
-
// );
|
|
275
|
-
//
|
|
276
|
-
// treeData = formatTree(treeData, state.functionAuth.permissions);
|
|
277
|
-
//
|
|
278
|
-
// this.update({
|
|
279
|
-
// treeData,
|
|
280
|
-
// defId: conditions,
|
|
281
|
-
// });
|
|
282
|
-
|
|
268
|
+
case 7:
|
|
269
|
+
_Message.success('设置成功');
|
|
283
270
|
|
|
284
|
-
case
|
|
271
|
+
case 8:
|
|
285
272
|
case "end":
|
|
286
273
|
return _context5.stop();
|
|
287
274
|
}
|