waibu-db 1.2.9 → 1.2.11
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
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
|
@@ -42,6 +42,7 @@ async function factory (pkgName) {
|
|
|
42
42
|
ensureDir: true,
|
|
43
43
|
fields
|
|
44
44
|
}
|
|
45
|
+
options.filter.sort = 'id:1'
|
|
45
46
|
const dmodel = 'SumbaDownload'
|
|
46
47
|
try {
|
|
47
48
|
await recordUpdate(dmodel, id, { status: 'PROCESSING' })
|
|
@@ -52,6 +53,46 @@ async function factory (pkgName) {
|
|
|
52
53
|
await recordUpdate(dmodel, id, { status: 'FAIL' })
|
|
53
54
|
}
|
|
54
55
|
}
|
|
56
|
+
|
|
57
|
+
adminMenu = async (locals, req) => {
|
|
58
|
+
const { getPluginPrefix } = this.app.waibu
|
|
59
|
+
const { pascalCase } = this.lib.aneka
|
|
60
|
+
const { getAppTitle } = this.app.waibuMpa
|
|
61
|
+
const { camelCase, map, pick, groupBy, keys, kebabCase, filter, get } = this.lib._
|
|
62
|
+
|
|
63
|
+
const prefix = getPluginPrefix(this.name)
|
|
64
|
+
const schemas = filter(this.app.dobo.schemas, s => {
|
|
65
|
+
const byModelFind = !s.disabled.includes('find')
|
|
66
|
+
let modelDisabled = get(this, `app.${s.ns}.config.waibuAdmin.modelDisabled`)
|
|
67
|
+
if (modelDisabled) {
|
|
68
|
+
const allModels = map(filter(this.app.dobo.schemas, { ns: s.ns }), 'name')
|
|
69
|
+
if (modelDisabled === 'all') modelDisabled = allModels
|
|
70
|
+
else modelDisabled = map(modelDisabled, m => pascalCase(`${this.app[s.ns].alias} ${m}`))
|
|
71
|
+
} else modelDisabled = []
|
|
72
|
+
const byDbDisabled = !modelDisabled.includes(s.name)
|
|
73
|
+
return byModelFind && byDbDisabled
|
|
74
|
+
})
|
|
75
|
+
const omenu = groupBy(map(schemas, s => {
|
|
76
|
+
const item = pick(s, ['name', 'ns'])
|
|
77
|
+
item.nsTitle = getAppTitle(s.ns)
|
|
78
|
+
return item
|
|
79
|
+
}), 'nsTitle')
|
|
80
|
+
const menu = []
|
|
81
|
+
for (const k of keys(omenu).sort()) {
|
|
82
|
+
const items = omenu[k]
|
|
83
|
+
const plugin = this.app[items[0].ns]
|
|
84
|
+
menu.push({
|
|
85
|
+
title: k,
|
|
86
|
+
children: map(items, item => {
|
|
87
|
+
return {
|
|
88
|
+
title: camelCase(item.name.slice(plugin.alias.length)),
|
|
89
|
+
href: `waibuAdmin:/${prefix}/${kebabCase(item.name)}/list`
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
return menu
|
|
95
|
+
}
|
|
55
96
|
}
|
|
56
97
|
}
|
|
57
98
|
|
package/package.json
CHANGED
|
@@ -12,8 +12,10 @@ async function form () {
|
|
|
12
12
|
const xModels = get(schema, 'view.x.model', [])
|
|
13
13
|
const xOns = get(schema, 'view.x.on', [])
|
|
14
14
|
for (const l of schema.view.layout) {
|
|
15
|
+
const fields = filter(l.fields, f => schema.view.fields.includes(f))
|
|
16
|
+
if (fields.length === 0) continue
|
|
15
17
|
body.push(`<c:fieldset ${schema.view.card === false ? '' : 'card'} ${l.name[0] !== '_' ? ('t:legend="' + l.name + '"') : ''} grid-gutter="2">`)
|
|
16
|
-
for (const f of
|
|
18
|
+
for (const f of fields) {
|
|
17
19
|
const w = schema.view.widget[f]
|
|
18
20
|
let prop = find(schema.properties, { name: f })
|
|
19
21
|
if (!prop) prop = find(schema.view.calcFields, { name: f })
|
|
@@ -21,7 +23,8 @@ async function form () {
|
|
|
21
23
|
const attr = [`x-ref="${w.name}"`]
|
|
22
24
|
if (xModels.includes(w.name)) attr.push(`x-model="${w.name}"`)
|
|
23
25
|
forOwn(w.attr, (v, k) => {
|
|
24
|
-
attr.push(
|
|
26
|
+
if (v === true) attr.push(k)
|
|
27
|
+
else attr.push(`${k}="${v}"`)
|
|
25
28
|
})
|
|
26
29
|
const xon = filter(xOns, { field: w.name })
|
|
27
30
|
for (const o of xon) {
|
|
@@ -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
|