waibu-db 1.2.9 → 1.2.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/bajo/intl/en-US.json +1 -1
- package/bajo/intl/id.json +1 -1
- package/index.js +40 -0
- package/package.json +1 -1
- package/plugin-method/admin-menu.js +0 -45
package/bajo/intl/en-US.json
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"addMoreAfterSubmit": "Add more after submit",
|
|
29
29
|
"clonePrevious": "Clone previous",
|
|
30
30
|
"actionPermanentlyDisabled%s": "Sorry, action '%s' is permanently disabled at database level. For more information, please contact your Admin immediately, thank you!",
|
|
31
|
-
"dbModels": "Database
|
|
31
|
+
"dbModels": "Misc Database",
|
|
32
32
|
"checkAll": "Check All",
|
|
33
33
|
"uncheckAll": "Uncheck All",
|
|
34
34
|
"attachment": "Attachment",
|
package/bajo/intl/id.json
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"addMoreAfterSubmit": "Tambah lagi setelah kirim",
|
|
29
29
|
"clonePrevious": "Duplikasi sebelumnya",
|
|
30
30
|
"actionPermanentlyDisabled%s": "Sorry, action '%s' is permanently disabled at database level. For more information, please contact your Admin immediately, thank you!",
|
|
31
|
-
"dbModels": "
|
|
31
|
+
"dbModels": "Database Lainnya",
|
|
32
32
|
"checkAll": "Cek Semua",
|
|
33
33
|
"uncheckAll": "Uncheck Semua",
|
|
34
34
|
"attachment": "Attachment",
|
package/index.js
CHANGED
|
@@ -52,6 +52,46 @@ async function factory (pkgName) {
|
|
|
52
52
|
await recordUpdate(dmodel, id, { status: 'FAIL' })
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
adminMenu = async (locals, req) => {
|
|
57
|
+
const { getPluginPrefix } = this.app.waibu
|
|
58
|
+
const { pascalCase } = this.lib.aneka
|
|
59
|
+
const { getAppTitle } = this.app.waibuMpa
|
|
60
|
+
const { camelCase, map, pick, groupBy, keys, kebabCase, filter, get } = this.lib._
|
|
61
|
+
|
|
62
|
+
const prefix = getPluginPrefix(this.name)
|
|
63
|
+
const schemas = filter(this.app.dobo.schemas, s => {
|
|
64
|
+
const byModelFind = !s.disabled.includes('find')
|
|
65
|
+
let modelDisabled = get(this, `app.${s.ns}.config.waibuAdmin.modelDisabled`)
|
|
66
|
+
if (modelDisabled) {
|
|
67
|
+
const allModels = map(filter(this.app.dobo.schemas, { ns: s.ns }), 'name')
|
|
68
|
+
if (modelDisabled === 'all') modelDisabled = allModels
|
|
69
|
+
else modelDisabled = map(modelDisabled, m => pascalCase(`${this.app[s.ns].alias} ${m}`))
|
|
70
|
+
} else modelDisabled = []
|
|
71
|
+
const byDbDisabled = !modelDisabled.includes(s.name)
|
|
72
|
+
return byModelFind && byDbDisabled
|
|
73
|
+
})
|
|
74
|
+
const omenu = groupBy(map(schemas, s => {
|
|
75
|
+
const item = pick(s, ['name', 'ns'])
|
|
76
|
+
item.nsTitle = getAppTitle(s.ns)
|
|
77
|
+
return item
|
|
78
|
+
}), 'nsTitle')
|
|
79
|
+
const menu = []
|
|
80
|
+
for (const k of keys(omenu).sort()) {
|
|
81
|
+
const items = omenu[k]
|
|
82
|
+
const plugin = this.app[items[0].ns]
|
|
83
|
+
menu.push({
|
|
84
|
+
title: k,
|
|
85
|
+
children: map(items, item => {
|
|
86
|
+
return {
|
|
87
|
+
title: camelCase(item.name.slice(plugin.alias.length)),
|
|
88
|
+
href: `waibuAdmin:/${prefix}/${kebabCase(item.name)}/list`
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
return menu
|
|
94
|
+
}
|
|
55
95
|
}
|
|
56
96
|
}
|
|
57
97
|
|
package/package.json
CHANGED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
function modelsMenu (locals, req) {
|
|
2
|
-
const { getPluginPrefix } = this.app.waibu
|
|
3
|
-
const { pascalCase } = this.lib.aneka
|
|
4
|
-
const { getAppTitle } = this.app.waibuMpa
|
|
5
|
-
const { camelCase, map, pick, groupBy, keys, kebabCase, filter, get } = this.lib._
|
|
6
|
-
|
|
7
|
-
const prefix = getPluginPrefix(this.name)
|
|
8
|
-
const schemas = filter(this.app.dobo.schemas, s => {
|
|
9
|
-
const byModelFind = !s.disabled.includes('find')
|
|
10
|
-
let modelDisabled = get(this, `app.${s.ns}.config.waibuAdmin.modelDisabled`)
|
|
11
|
-
if (modelDisabled) {
|
|
12
|
-
const allModels = map(filter(this.app.dobo.schemas, { ns: s.ns }), 'name')
|
|
13
|
-
if (modelDisabled === 'all') modelDisabled = allModels
|
|
14
|
-
else modelDisabled = map(modelDisabled, m => pascalCase(`${this.app[s.ns].alias} ${m}`))
|
|
15
|
-
} else modelDisabled = []
|
|
16
|
-
const byDbDisabled = !modelDisabled.includes(s.name)
|
|
17
|
-
return byModelFind && byDbDisabled
|
|
18
|
-
})
|
|
19
|
-
const omenu = groupBy(map(schemas, s => {
|
|
20
|
-
const item = pick(s, ['name', 'ns'])
|
|
21
|
-
item.nsTitle = getAppTitle(s.ns)
|
|
22
|
-
return item
|
|
23
|
-
}), 'nsTitle')
|
|
24
|
-
const menu = []
|
|
25
|
-
for (const k of keys(omenu).sort()) {
|
|
26
|
-
const items = omenu[k]
|
|
27
|
-
const plugin = this.app[items[0].ns]
|
|
28
|
-
menu.push({
|
|
29
|
-
title: k,
|
|
30
|
-
children: map(items, item => {
|
|
31
|
-
return {
|
|
32
|
-
title: camelCase(item.name.slice(plugin.alias.length)),
|
|
33
|
-
href: `waibuAdmin:/${prefix}/${kebabCase(item.name)}/list`
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
|
-
return menu
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async function adminMenu (locals, req) {
|
|
42
|
-
return modelsMenu.call(this, locals, req)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export default adminMenu
|