@riil-frontend/component-topology 6.0.10 → 6.0.12
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/common/hooks/useHtElements.js +4 -0
- package/es/core/editor/components/Toolbar/widgets/AddResourceButton.js +8 -11
- package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +1 -1
- package/es/core/models/TopoApp.js +1 -1
- package/es/networkTopo/services/funcAuth.js +39 -0
- package/es/networkTopo/services/index.js +2 -1
- package/es/networkTopo/store/functionAuth.js +85 -97
- package/lib/core/common/hooks/useHtElements.js +4 -0
- package/lib/core/editor/components/Toolbar/widgets/AddResourceButton.js +9 -11
- package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +1 -1
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/networkTopo/services/funcAuth.js +50 -0
- package/lib/networkTopo/services/index.js +3 -1
- package/lib/networkTopo/store/functionAuth.js +94 -109
- package/package.json +2 -2
@@ -3,7 +3,7 @@
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
4
|
|
5
5
|
exports.__esModule = true;
|
6
|
-
exports["default"] =
|
6
|
+
exports["default"] = _default;
|
7
7
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
9
9
|
|
@@ -13,117 +13,102 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
13
13
|
|
14
14
|
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
|
15
15
|
|
16
|
-
var _topo = _interopRequireDefault(require("@riil-frontend/component-topology-common/es/services/topo"));
|
17
|
-
|
18
|
-
var _authorization = _interopRequireDefault(require("@riil-frontend/component-topology-common/es/services/authorization"));
|
19
|
-
|
20
16
|
/**
|
21
17
|
* 功能权限 Model
|
22
18
|
*/
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
19
|
+
function _default(topo) {
|
20
|
+
return {
|
21
|
+
// 定义 model 的初始 state
|
22
|
+
state: {
|
23
|
+
permissions: {
|
24
|
+
createTopo: false,
|
25
|
+
manageNavTree: false,
|
26
|
+
setTopoPermission: false
|
27
|
+
}
|
28
|
+
},
|
29
|
+
// 定义改变该模型状态的纯函数
|
30
|
+
reducers: {
|
31
|
+
update: function update(prevState, payload) {
|
32
|
+
return (0, _extends2["default"])({}, prevState, payload);
|
33
|
+
}
|
34
|
+
},
|
35
|
+
// 定义处理该模型副作用的函数
|
36
|
+
effects: function effects(dispatch) {
|
37
|
+
return {
|
38
|
+
init: function init(payload, rootState) {
|
39
|
+
var _this = this;
|
40
|
+
|
41
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
42
|
+
var permissions;
|
43
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
44
|
+
while (1) {
|
45
|
+
switch (_context.prev = _context.next) {
|
46
|
+
case 0:
|
47
|
+
_context.next = 2;
|
48
|
+
return _this.getPermissions();
|
49
|
+
|
50
|
+
case 2:
|
51
|
+
permissions = _context.sent;
|
52
|
+
|
53
|
+
if (permissions) {
|
54
|
+
_this.update({
|
55
|
+
permissions: permissions
|
56
|
+
});
|
57
|
+
}
|
58
|
+
|
59
|
+
case 4:
|
60
|
+
case "end":
|
61
|
+
return _context.stop();
|
62
|
+
}
|
65
63
|
}
|
66
|
-
}
|
67
|
-
}
|
68
|
-
}
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
case 2:
|
89
|
-
funcResult = _context2.sent;
|
90
|
-
permissions = {};
|
91
|
-
funcResult.forEach(function (func) {
|
92
|
-
permissions[func.func.replace('topo_', '')] = func.passed === 'PASS';
|
93
|
-
});
|
94
|
-
return _context2.abrupt("return", permissions);
|
95
|
-
|
96
|
-
case 6:
|
97
|
-
case "end":
|
98
|
-
return _context2.stop();
|
64
|
+
}, _callee);
|
65
|
+
}))();
|
66
|
+
},
|
67
|
+
getPermissions: function getPermissions() {
|
68
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
69
|
+
var permissions;
|
70
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
71
|
+
while (1) {
|
72
|
+
switch (_context2.prev = _context2.next) {
|
73
|
+
case 0:
|
74
|
+
_context2.next = 2;
|
75
|
+
return topo.serverApi.getFuncAuth();
|
76
|
+
|
77
|
+
case 2:
|
78
|
+
permissions = _context2.sent;
|
79
|
+
return _context2.abrupt("return", permissions);
|
80
|
+
|
81
|
+
case 4:
|
82
|
+
case "end":
|
83
|
+
return _context2.stop();
|
84
|
+
}
|
99
85
|
}
|
100
|
-
}
|
101
|
-
}
|
102
|
-
}
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
86
|
+
}, _callee2);
|
87
|
+
}))();
|
88
|
+
},
|
89
|
+
checkAuth: function checkAuth(name, rootState) {
|
90
|
+
return rootState.functionAuth.permissions[name];
|
91
|
+
},
|
92
|
+
refresh: function refresh() {
|
93
|
+
var _this2 = this;
|
94
|
+
|
95
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
96
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
97
|
+
while (1) {
|
98
|
+
switch (_context3.prev = _context3.next) {
|
99
|
+
case 0:
|
100
|
+
_context3.next = 2;
|
101
|
+
return _this2.init();
|
102
|
+
|
103
|
+
case 2:
|
104
|
+
case "end":
|
105
|
+
return _context3.stop();
|
106
|
+
}
|
121
107
|
}
|
122
|
-
}
|
123
|
-
}
|
124
|
-
}
|
125
|
-
}
|
126
|
-
}
|
127
|
-
}
|
128
|
-
}
|
129
|
-
exports["default"] = _default;
|
108
|
+
}, _callee3);
|
109
|
+
}))();
|
110
|
+
}
|
111
|
+
};
|
112
|
+
}
|
113
|
+
};
|
114
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@riil-frontend/component-topology",
|
3
|
-
"version": "6.0.
|
3
|
+
"version": "6.0.12",
|
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@6.0.
|
119
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@6.0.12/build/index.html",
|
120
120
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
121
121
|
}
|