@nocobase/plugin-client 1.9.0-beta.8 → 2.0.0-alpha.10
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/dist/client/index.js +1 -1
- package/dist/collections/desktopRoutes.js +1 -2
- package/dist/collections/mobileRoutes.js +1 -2
- package/dist/externalVersion.js +6 -6
- package/dist/locale/de-DE.js +9 -1
- package/dist/locale/en-US.js +104 -3
- package/dist/locale/es-ES.js +9 -1
- package/dist/locale/fr-FR.js +9 -1
- package/dist/locale/it-IT.js +9 -1
- package/dist/locale/ja-JP.js +9 -1
- package/dist/locale/ko-KR.js +9 -1
- package/dist/locale/nl-NL.js +9 -1
- package/dist/locale/pt-BR.js +9 -1
- package/dist/locale/ru-RU.js +8 -0
- package/dist/locale/tr-TR.js +8 -0
- package/dist/locale/uk-UA.js +9 -1
- package/dist/locale/zh-CN.js +294 -3
- package/dist/locale/zh-TW.js +9 -1
- package/dist/node_modules/cronstrue/package.json +1 -1
- package/dist/server/server.js +62 -19
- package/package.json +8 -8
package/dist/server/server.js
CHANGED
|
@@ -66,22 +66,6 @@ class PluginClientServer extends import_server.Plugin {
|
|
|
66
66
|
async beforeLoad() {
|
|
67
67
|
}
|
|
68
68
|
async install() {
|
|
69
|
-
const uiSchemas = this.db.getRepository("uiSchemas");
|
|
70
|
-
await uiSchemas.insert({
|
|
71
|
-
type: "void",
|
|
72
|
-
"x-uid": "nocobase-admin-menu",
|
|
73
|
-
"x-component": "Menu",
|
|
74
|
-
"x-designer": "Menu.Designer",
|
|
75
|
-
"x-initializer": "MenuItemInitializers",
|
|
76
|
-
"x-component-props": {
|
|
77
|
-
mode: "mix",
|
|
78
|
-
theme: "dark",
|
|
79
|
-
// defaultSelectedUid: 'u8',
|
|
80
|
-
onSelect: "{{ onSelect }}",
|
|
81
|
-
sideMenuRefScopeKey: "sideMenuRef"
|
|
82
|
-
},
|
|
83
|
-
properties: {}
|
|
84
|
-
});
|
|
85
69
|
}
|
|
86
70
|
async load() {
|
|
87
71
|
this.app.localeManager.setLocaleFn("antd", async (lang) => (0, import_antd.getAntdLocale)(lang));
|
|
@@ -188,6 +172,7 @@ class PluginClientServer extends import_server.Plugin {
|
|
|
188
172
|
actions: ["desktopRoutes:list", "roles.desktopRoutes:*"]
|
|
189
173
|
});
|
|
190
174
|
this.app.acl.allow("desktopRoutes", "listAccessible", "loggedIn");
|
|
175
|
+
this.app.acl.allow("desktopRoutes", "getAccessible", "loggedIn");
|
|
191
176
|
}
|
|
192
177
|
/**
|
|
193
178
|
* used to implement: roles with permission (allowNewMenu is true) can directly access the newly created menu
|
|
@@ -199,7 +184,31 @@ class PluginClientServer extends import_server.Plugin {
|
|
|
199
184
|
instance.allowNewMenu === void 0 ? ["admin", "member"].includes(instance.name) : !!instance.allowNewMenu
|
|
200
185
|
);
|
|
201
186
|
});
|
|
202
|
-
this.
|
|
187
|
+
this.db.on("desktopRoutes.afterDestroy", async (instance, { transaction }) => {
|
|
188
|
+
const r = this.db.getRepository("flowModels");
|
|
189
|
+
if (r) {
|
|
190
|
+
await r.destroy({
|
|
191
|
+
filter: {
|
|
192
|
+
uid: instance.get("schemaUid")
|
|
193
|
+
},
|
|
194
|
+
transaction
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
this.db.on("desktopRoutes.afterCreate", async (instance, { transaction }) => {
|
|
199
|
+
const r = this.db.getRepository("flowModels");
|
|
200
|
+
if (r) {
|
|
201
|
+
await r.create({
|
|
202
|
+
transaction,
|
|
203
|
+
values: {
|
|
204
|
+
uid: instance.get("schemaUid"),
|
|
205
|
+
name: instance.get("schemaUid"),
|
|
206
|
+
schema: {
|
|
207
|
+
use: "RouteModel"
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}
|
|
203
212
|
const addNewMenuRoles = await this.app.db.getRepository("roles").find({
|
|
204
213
|
filter: {
|
|
205
214
|
allowNewMenu: true
|
|
@@ -255,10 +264,12 @@ class PluginClientServer extends import_server.Plugin {
|
|
|
255
264
|
this.app.resourceManager.registerActionHandler("desktopRoutes:listAccessible", async (ctx, next) => {
|
|
256
265
|
const desktopRoutesRepository = ctx.db.getRepository("desktopRoutes");
|
|
257
266
|
const rolesRepository = ctx.db.getRepository("roles");
|
|
267
|
+
const { filter } = ctx.action.params;
|
|
258
268
|
if (ctx.state.currentRoles.includes("root")) {
|
|
259
269
|
ctx.body = await desktopRoutesRepository.find({
|
|
260
270
|
tree: true,
|
|
261
|
-
|
|
271
|
+
sort: "sort",
|
|
272
|
+
filter
|
|
262
273
|
});
|
|
263
274
|
return await next();
|
|
264
275
|
}
|
|
@@ -271,8 +282,9 @@ class PluginClientServer extends import_server.Plugin {
|
|
|
271
282
|
const ids = (await Promise.all(desktopRoutesId)).flat();
|
|
272
283
|
const result = await desktopRoutesRepository.find({
|
|
273
284
|
tree: true,
|
|
274
|
-
|
|
285
|
+
sort: "sort",
|
|
275
286
|
filter: {
|
|
287
|
+
...filter,
|
|
276
288
|
id: ids
|
|
277
289
|
}
|
|
278
290
|
});
|
|
@@ -280,6 +292,37 @@ class PluginClientServer extends import_server.Plugin {
|
|
|
280
292
|
}
|
|
281
293
|
await next();
|
|
282
294
|
});
|
|
295
|
+
this.app.resourceManager.registerActionHandler("desktopRoutes:getAccessible", async (ctx, next) => {
|
|
296
|
+
const desktopRoutesRepository = ctx.db.getRepository("desktopRoutes");
|
|
297
|
+
const rolesRepository = ctx.db.getRepository("roles");
|
|
298
|
+
const { filter } = ctx.action.params;
|
|
299
|
+
if (ctx.state.currentRoles.includes("root")) {
|
|
300
|
+
ctx.body = await desktopRoutesRepository.findOne({
|
|
301
|
+
sort: "sort",
|
|
302
|
+
...ctx.action.params
|
|
303
|
+
});
|
|
304
|
+
return await next();
|
|
305
|
+
}
|
|
306
|
+
const roles = await rolesRepository.find({
|
|
307
|
+
filterByTk: ctx.state.currentRoles,
|
|
308
|
+
appends: ["desktopRoutes"]
|
|
309
|
+
});
|
|
310
|
+
const desktopRoutesId = roles.flatMap((x) => x.get("desktopRoutes")).map((item) => item.id);
|
|
311
|
+
if (desktopRoutesId && desktopRoutesId.length > 0) {
|
|
312
|
+
const ids = (await Promise.all(desktopRoutesId)).flat();
|
|
313
|
+
const result = await desktopRoutesRepository.findOne({
|
|
314
|
+
filter: {
|
|
315
|
+
...filter,
|
|
316
|
+
id: ids
|
|
317
|
+
},
|
|
318
|
+
...ctx.action.params
|
|
319
|
+
});
|
|
320
|
+
ctx.body = result;
|
|
321
|
+
} else {
|
|
322
|
+
ctx.body = null;
|
|
323
|
+
}
|
|
324
|
+
await next();
|
|
325
|
+
});
|
|
283
326
|
this.app.resourceManager.registerActionHandler("roles.desktopRoutes:set", async (ctx, next) => {
|
|
284
327
|
let { values } = ctx.action.params;
|
|
285
328
|
if (values.length) {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "WEB 客户端",
|
|
5
5
|
"description": "Provides a client interface for the NocoBase server",
|
|
6
6
|
"description.zh-CN": "为 NocoBase 服务端提供客户端界面",
|
|
7
|
-
"version": "
|
|
7
|
+
"version": "2.0.0-alpha.10",
|
|
8
8
|
"main": "./dist/server/index.js",
|
|
9
9
|
"license": "AGPL-3.0",
|
|
10
10
|
"devDependencies": {
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"koa-static": "^5.0.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@nocobase/client": "
|
|
18
|
-
"@nocobase/database": "
|
|
19
|
-
"@nocobase/plugin-localization": "
|
|
20
|
-
"@nocobase/server": "
|
|
21
|
-
"@nocobase/test": "
|
|
22
|
-
"@nocobase/utils": "
|
|
17
|
+
"@nocobase/client": "2.x",
|
|
18
|
+
"@nocobase/database": "2.x",
|
|
19
|
+
"@nocobase/plugin-localization": "2.x",
|
|
20
|
+
"@nocobase/server": "2.x",
|
|
21
|
+
"@nocobase/test": "2.x",
|
|
22
|
+
"@nocobase/utils": "2.x"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "6422cfb6fa6c8450de2efa3294fd29a28b228990"
|
|
25
25
|
}
|