@riil-frontend/component-topology 10.0.29 → 10.0.30
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 +1 -1
- package/es/core/models/AttributeMetricDisplay.js +1 -1
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js +2 -3
- package/es/core/viewer/components/plugins/ResourceDetail/components/DrawerTitle.js +3 -1
- package/es/core/viewer/contextmenu/buildLinkContextmenu.js +1 -1
- package/es/core/viewer/contextmenu/buildNodeContextmenu.js +4 -4
- package/es/networkTopo/utils/resourcePermissionUtil.js +2 -22
- package/es/utils/clusterUtil.js +3 -1
- package/es/utils/topoData.js +3 -1
- package/lib/core/models/AttributeMetricDisplay.js +1 -1
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js +2 -3
- package/lib/core/viewer/components/plugins/ResourceDetail/components/DrawerTitle.js +3 -1
- package/lib/core/viewer/contextmenu/buildLinkContextmenu.js +1 -1
- package/lib/core/viewer/contextmenu/buildNodeContextmenu.js +4 -4
- package/lib/networkTopo/utils/resourcePermissionUtil.js +2 -22
- package/lib/utils/clusterUtil.js +3 -1
- package/lib/utils/topoData.js +3 -1
- package/package.json +2 -2
@@ -144,7 +144,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
144
144
|
_proto.filterCiFiledConfigItems = function filterCiFiledConfigItems(data, ciTypeItemConfigs) {
|
145
145
|
// 无权限不显示标注、悬浮框
|
146
146
|
var filterByPermission = function filterByPermission(resource, items) {
|
147
|
-
return resource.
|
147
|
+
return resource.permission.readable ? items : [];
|
148
148
|
};
|
149
149
|
|
150
150
|
var list = filterByPermission(data, ciTypeItemConfigs); // 未监控不显示指标
|
@@ -24,7 +24,7 @@ import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
|
|
24
24
|
import SelectionModel from "./SelectionModel";
|
25
25
|
import CiCache from "./cache/CiCache"; // eslint-disable-next-line no-undef
|
26
26
|
|
27
|
-
var version = typeof "10.0.
|
27
|
+
var version = typeof "10.0.30" === 'string' ? "10.0.30" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
package/es/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js
CHANGED
@@ -141,10 +141,9 @@ function useElementDetailManager(props) {
|
|
141
141
|
var resourceData = topo.dataModel.getDataById(id); // 如果是资源/链路,没有权限不显示
|
142
142
|
|
143
143
|
if (resourceData) {
|
144
|
-
var
|
145
|
-
permission = resourceData.permission;
|
144
|
+
var permission = resourceData.permission;
|
146
145
|
|
147
|
-
if (!
|
146
|
+
if (!(permission !== null && permission !== void 0 && permission.readable)) {
|
148
147
|
return;
|
149
148
|
}
|
150
149
|
} // 自定义显示方法
|
@@ -46,9 +46,11 @@ function NodeDrawerTitle(_ref) {
|
|
46
46
|
return detailManager.openByDataId(key);
|
47
47
|
}
|
48
48
|
}, isAvailableArray(filterNodes) && filterNodes.length ? filterNodes.map(function (item) {
|
49
|
+
var _item$permission;
|
50
|
+
|
49
51
|
return /*#__PURE__*/React.createElement(_MenuButton.Item, {
|
50
52
|
key: item.id,
|
51
|
-
disabled: !item.
|
53
|
+
disabled: !((_item$permission = item.permission) !== null && _item$permission !== void 0 && _item$permission.readable)
|
52
54
|
}, item.name);
|
53
55
|
}) : /*#__PURE__*/React.createElement("div", {
|
54
56
|
className: styles['not-data']
|
@@ -6,7 +6,7 @@ export default function buildContextMenu(topoApp) {
|
|
6
6
|
// id: 'Resource.detail',
|
7
7
|
// icon: '/img/topo/contextmenu/Topology_resources_menu_icon_overview.svg',
|
8
8
|
// visible: (data) => {
|
9
|
-
// return !!data.
|
9
|
+
// return !!data.permission?.readable;
|
10
10
|
// }
|
11
11
|
// },
|
12
12
|
// { label: '监控策略', id: 'monitoring_strategy' },
|
@@ -10,14 +10,14 @@ export default function buildNodeContextmenu(topoApp) {
|
|
10
10
|
// id: 'Resource.detail',
|
11
11
|
// icon: '/img/topo/contextmenu/Topology_resources_menu_icon_overview.svg',
|
12
12
|
// visible: (data) => {
|
13
|
-
// return isResource(data) && !!data.
|
13
|
+
// return isResource(data) && !!data.permission?.readable;
|
14
14
|
// }
|
15
15
|
// },
|
16
16
|
// {
|
17
17
|
// label: 'Web控制台',
|
18
18
|
// icon: '/img/topo/contextmenu/Topology_resources_menu_icon_webconsole.svg',
|
19
19
|
// visible: (data) => {
|
20
|
-
// return isResource(data) && !!data.
|
20
|
+
// return isResource(data) && !!data.permission?.readable;
|
21
21
|
// },
|
22
22
|
// items: [
|
23
23
|
// {
|
@@ -47,7 +47,7 @@ export default function buildNodeContextmenu(topoApp) {
|
|
47
47
|
// const {domain} = ciMeta;
|
48
48
|
// // 是否有该页签,与资源详情保持一致
|
49
49
|
// const hasTab = domain === 'network' || domain === 'server';
|
50
|
-
// return !!data.
|
50
|
+
// return !!data.permission?.readable && hasTab;
|
51
51
|
// }
|
52
52
|
// },
|
53
53
|
// {
|
@@ -66,7 +66,7 @@ export default function buildNodeContextmenu(topoApp) {
|
|
66
66
|
// const {domain} = ciMeta;
|
67
67
|
// // 是否有该页签,与资源详情保持一致
|
68
68
|
// const hasTab = domain === 'network' || domain === 'server';
|
69
|
-
// return !!data.
|
69
|
+
// return !!data.permission?.readable && hasTab;
|
70
70
|
// }
|
71
71
|
// },
|
72
72
|
// { label: '打开属性设置', id: 'openSet' },
|
@@ -12,6 +12,7 @@ export function parseBasicPermission(operation) {
|
|
12
12
|
}
|
13
13
|
/**
|
14
14
|
* 获得链路权限
|
15
|
+
* 关键链路使用权限中心配置,普通链路根据两端权限计算
|
15
16
|
*
|
16
17
|
* @param {*} link
|
17
18
|
* @param {*} source
|
@@ -20,28 +21,7 @@ export function parseBasicPermission(operation) {
|
|
20
21
|
*/
|
21
22
|
|
22
23
|
export function getLinkPermission(link, source, target) {
|
23
|
-
|
24
|
-
if (isCrucialLink(link)) {
|
25
|
-
return parseBasicPermission(link === null || link === void 0 ? void 0 : link.operation);
|
26
|
-
}
|
27
|
-
|
28
|
-
var deviceNodes = target ? [source, target] : [source];
|
29
|
-
|
30
|
-
var isWriteable = function isWriteable() {
|
31
|
-
return deviceNodes.filter(function (node) {
|
32
|
-
return ['write', 'delete'].indexOf(node === null || node === void 0 ? void 0 : node.operation) !== -1;
|
33
|
-
}).length === deviceNodes.length;
|
34
|
-
};
|
35
|
-
|
36
|
-
return {
|
37
|
-
readable: !!(source !== null && source !== void 0 && source.operation) || !!(target !== null && target !== void 0 && target.operation),
|
38
|
-
// 一端设备有权限可查看
|
39
|
-
writeable: isWriteable(),
|
40
|
-
// 两端设备都有编辑权限可编辑(出口链路仅验证一端)
|
41
|
-
deleteable: deviceNodes.filter(function (node) {
|
42
|
-
return ['write', 'delete'].includes(node === null || node === void 0 ? void 0 : node.operation);
|
43
|
-
}).length >= 1
|
44
|
-
};
|
24
|
+
return parseBasicPermission(link === null || link === void 0 ? void 0 : link.operation);
|
45
25
|
}
|
46
26
|
/**
|
47
27
|
* 适配接口
|
package/es/utils/clusterUtil.js
CHANGED
@@ -21,13 +21,15 @@ export function processCluster(topoData) {
|
|
21
21
|
}
|
22
22
|
export function buildClusterGroups(nodes) {
|
23
23
|
return findClusters(nodes).map(function (n) {
|
24
|
+
var _n$permission;
|
25
|
+
|
24
26
|
return _extends({
|
25
27
|
tag: null,
|
26
28
|
parentId: n.groupId,
|
27
29
|
parentTag: n.groupTag
|
28
30
|
}, n, {
|
29
31
|
elementTemplate: 'cluster',
|
30
|
-
expandable: !!n.
|
32
|
+
expandable: !!((_n$permission = n.permission) !== null && _n$permission !== void 0 && _n$permission.readable),
|
31
33
|
// 无权限禁用展开折叠
|
32
34
|
styles: {
|
33
35
|
showExpanded: false // 是否默认展开
|
package/es/utils/topoData.js
CHANGED
@@ -77,8 +77,10 @@ function updateNodeInfo(topoEngine, topoData) {
|
|
77
77
|
|
78
78
|
|
79
79
|
var tfLink = function tfLink(engine, link) {
|
80
|
+
var _link$permission;
|
81
|
+
|
80
82
|
return _extends({}, link, {
|
81
|
-
name: link.
|
83
|
+
name: (_link$permission = link.permission) !== null && _link$permission !== void 0 && _link$permission.readable ? link.name : "未知",
|
82
84
|
metrics: [],
|
83
85
|
attributes: []
|
84
86
|
});
|
@@ -161,7 +161,7 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
161
161
|
_proto.filterCiFiledConfigItems = function filterCiFiledConfigItems(data, ciTypeItemConfigs) {
|
162
162
|
// 无权限不显示标注、悬浮框
|
163
163
|
var filterByPermission = function filterByPermission(resource, items) {
|
164
|
-
return resource.
|
164
|
+
return resource.permission.readable ? items : [];
|
165
165
|
};
|
166
166
|
|
167
167
|
var list = filterByPermission(data, ciTypeItemConfigs); // 未监控不显示指标
|
@@ -56,7 +56,7 @@ var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
|
|
56
56
|
var _CiCache = _interopRequireDefault(require("./cache/CiCache"));
|
57
57
|
|
58
58
|
// eslint-disable-next-line no-undef
|
59
|
-
var version = typeof "10.0.
|
59
|
+
var version = typeof "10.0.30" === 'string' ? "10.0.30" : null;
|
60
60
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
61
61
|
/**
|
62
62
|
* 拓扑显示和编辑
|
package/lib/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js
CHANGED
@@ -153,10 +153,9 @@ function useElementDetailManager(props) {
|
|
153
153
|
var resourceData = topo.dataModel.getDataById(id); // 如果是资源/链路,没有权限不显示
|
154
154
|
|
155
155
|
if (resourceData) {
|
156
|
-
var
|
157
|
-
permission = resourceData.permission;
|
156
|
+
var permission = resourceData.permission;
|
158
157
|
|
159
|
-
if (!
|
158
|
+
if (!(permission !== null && permission !== void 0 && permission.readable)) {
|
160
159
|
return;
|
161
160
|
}
|
162
161
|
} // 自定义显示方法
|
@@ -61,9 +61,11 @@ function NodeDrawerTitle(_ref) {
|
|
61
61
|
return detailManager.openByDataId(key);
|
62
62
|
}
|
63
63
|
}, (0, _utils.isAvailableArray)(filterNodes) && filterNodes.length ? filterNodes.map(function (item) {
|
64
|
+
var _item$permission;
|
65
|
+
|
64
66
|
return /*#__PURE__*/_react["default"].createElement(_menuButton["default"].Item, {
|
65
67
|
key: item.id,
|
66
|
-
disabled: !item.
|
68
|
+
disabled: !((_item$permission = item.permission) !== null && _item$permission !== void 0 && _item$permission.readable)
|
67
69
|
}, item.name);
|
68
70
|
}) : /*#__PURE__*/_react["default"].createElement("div", {
|
69
71
|
className: _indexModule["default"]['not-data']
|
@@ -11,7 +11,7 @@ function buildContextMenu(topoApp) {
|
|
11
11
|
// id: 'Resource.detail',
|
12
12
|
// icon: '/img/topo/contextmenu/Topology_resources_menu_icon_overview.svg',
|
13
13
|
// visible: (data) => {
|
14
|
-
// return !!data.
|
14
|
+
// return !!data.permission?.readable;
|
15
15
|
// }
|
16
16
|
// },
|
17
17
|
// { label: '监控策略', id: 'monitoring_strategy' },
|
@@ -15,14 +15,14 @@ function buildNodeContextmenu(topoApp) {
|
|
15
15
|
// id: 'Resource.detail',
|
16
16
|
// icon: '/img/topo/contextmenu/Topology_resources_menu_icon_overview.svg',
|
17
17
|
// visible: (data) => {
|
18
|
-
// return isResource(data) && !!data.
|
18
|
+
// return isResource(data) && !!data.permission?.readable;
|
19
19
|
// }
|
20
20
|
// },
|
21
21
|
// {
|
22
22
|
// label: 'Web控制台',
|
23
23
|
// icon: '/img/topo/contextmenu/Topology_resources_menu_icon_webconsole.svg',
|
24
24
|
// visible: (data) => {
|
25
|
-
// return isResource(data) && !!data.
|
25
|
+
// return isResource(data) && !!data.permission?.readable;
|
26
26
|
// },
|
27
27
|
// items: [
|
28
28
|
// {
|
@@ -52,7 +52,7 @@ function buildNodeContextmenu(topoApp) {
|
|
52
52
|
// const {domain} = ciMeta;
|
53
53
|
// // 是否有该页签,与资源详情保持一致
|
54
54
|
// const hasTab = domain === 'network' || domain === 'server';
|
55
|
-
// return !!data.
|
55
|
+
// return !!data.permission?.readable && hasTab;
|
56
56
|
// }
|
57
57
|
// },
|
58
58
|
// {
|
@@ -71,7 +71,7 @@ function buildNodeContextmenu(topoApp) {
|
|
71
71
|
// const {domain} = ciMeta;
|
72
72
|
// // 是否有该页签,与资源详情保持一致
|
73
73
|
// const hasTab = domain === 'network' || domain === 'server';
|
74
|
-
// return !!data.
|
74
|
+
// return !!data.permission?.readable && hasTab;
|
75
75
|
// }
|
76
76
|
// },
|
77
77
|
// { label: '打开属性设置', id: 'openSet' },
|
@@ -26,6 +26,7 @@ function parseBasicPermission(operation) {
|
|
26
26
|
}
|
27
27
|
/**
|
28
28
|
* 获得链路权限
|
29
|
+
* 关键链路使用权限中心配置,普通链路根据两端权限计算
|
29
30
|
*
|
30
31
|
* @param {*} link
|
31
32
|
* @param {*} source
|
@@ -35,28 +36,7 @@ function parseBasicPermission(operation) {
|
|
35
36
|
|
36
37
|
|
37
38
|
function getLinkPermission(link, source, target) {
|
38
|
-
|
39
|
-
if ((0, _linkUtils.isCrucialLink)(link)) {
|
40
|
-
return parseBasicPermission(link === null || link === void 0 ? void 0 : link.operation);
|
41
|
-
}
|
42
|
-
|
43
|
-
var deviceNodes = target ? [source, target] : [source];
|
44
|
-
|
45
|
-
var isWriteable = function isWriteable() {
|
46
|
-
return deviceNodes.filter(function (node) {
|
47
|
-
return ['write', 'delete'].indexOf(node === null || node === void 0 ? void 0 : node.operation) !== -1;
|
48
|
-
}).length === deviceNodes.length;
|
49
|
-
};
|
50
|
-
|
51
|
-
return {
|
52
|
-
readable: !!(source !== null && source !== void 0 && source.operation) || !!(target !== null && target !== void 0 && target.operation),
|
53
|
-
// 一端设备有权限可查看
|
54
|
-
writeable: isWriteable(),
|
55
|
-
// 两端设备都有编辑权限可编辑(出口链路仅验证一端)
|
56
|
-
deleteable: deviceNodes.filter(function (node) {
|
57
|
-
return ['write', 'delete'].includes(node === null || node === void 0 ? void 0 : node.operation);
|
58
|
-
}).length >= 1
|
59
|
-
};
|
39
|
+
return parseBasicPermission(link === null || link === void 0 ? void 0 : link.operation);
|
60
40
|
}
|
61
41
|
/**
|
62
42
|
* 适配接口
|
package/lib/utils/clusterUtil.js
CHANGED
@@ -43,13 +43,15 @@ function processCluster(topoData) {
|
|
43
43
|
|
44
44
|
function buildClusterGroups(nodes) {
|
45
45
|
return findClusters(nodes).map(function (n) {
|
46
|
+
var _n$permission;
|
47
|
+
|
46
48
|
return (0, _extends2["default"])({
|
47
49
|
tag: null,
|
48
50
|
parentId: n.groupId,
|
49
51
|
parentTag: n.groupTag
|
50
52
|
}, n, {
|
51
53
|
elementTemplate: 'cluster',
|
52
|
-
expandable: !!n.
|
54
|
+
expandable: !!((_n$permission = n.permission) !== null && _n$permission !== void 0 && _n$permission.readable),
|
53
55
|
// 无权限禁用展开折叠
|
54
56
|
styles: {
|
55
57
|
showExpanded: false // 是否默认展开
|
package/lib/utils/topoData.js
CHANGED
@@ -115,8 +115,10 @@ function updateNodeInfo(topoEngine, topoData) {
|
|
115
115
|
|
116
116
|
|
117
117
|
var tfLink = function tfLink(engine, link) {
|
118
|
+
var _link$permission;
|
119
|
+
|
118
120
|
return (0, _extends2["default"])({}, link, {
|
119
|
-
name: link.
|
121
|
+
name: (_link$permission = link.permission) !== null && _link$permission !== void 0 && _link$permission.readable ? link.name : "未知",
|
120
122
|
metrics: [],
|
121
123
|
attributes: []
|
122
124
|
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@riil-frontend/component-topology",
|
3
|
-
"version": "10.0.
|
3
|
+
"version": "10.0.30",
|
4
4
|
"description": "拓扑",
|
5
5
|
"scripts": {
|
6
6
|
"start": "build-scripts start",
|
@@ -116,6 +116,6 @@
|
|
116
116
|
"access": "public"
|
117
117
|
},
|
118
118
|
"license": "MIT",
|
119
|
-
"homepage": "https://unpkg.com/@riil-frontend/component-topology@10.0.
|
119
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@10.0.30/build/index.html",
|
120
120
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
121
121
|
}
|