sumba 1.2.8 → 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/hook/waibu-mpa.sumba@after-build-pages-menu.js +12 -0
- package/bajo/intl/en-US.json +2 -0
- package/bajo/intl/id.json +2 -0
- package/index.js +2 -0
- package/package.json +1 -1
- package/waibuDb/schema/download.js +26 -0
- package/waibuMpa/extend/waibuAdmin/route/download/@action.js +11 -0
- package/waibuMpa/route/help/trouble-tickets/details/@id.js +3 -2
- package/waibuMpa/route/info/license.js +10 -0
- package/waibuMpa/route/your-stuff/download/@action.js +2 -1
- package/waibuMpa/route/your-stuff/download/get.js +12 -0
- package/waibuDb/schema/download.json +0 -16
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
async function afterBuildPagesMenu (pages, req) {
|
|
2
|
+
if (!this.config.license) return
|
|
3
|
+
const { find } = this.lib._
|
|
4
|
+
const item = find(pages, { title: 'help' })
|
|
5
|
+
if (!item) return
|
|
6
|
+
item.children.push(
|
|
7
|
+
{ title: '-' },
|
|
8
|
+
{ title: 'license', href: 'sumba:/info/license' }
|
|
9
|
+
)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default afterBuildPagesMenu
|
package/bajo/intl/en-US.json
CHANGED
|
@@ -106,6 +106,8 @@
|
|
|
106
106
|
"contactFormSubmitted": "Contact form successfully submitted",
|
|
107
107
|
"currentApiKey": "Current API Key",
|
|
108
108
|
"downloadList": "Download List",
|
|
109
|
+
"manageDownload": "Manage Download",
|
|
110
|
+
"license": "License",
|
|
109
111
|
"field": {
|
|
110
112
|
"currentPassword": "Current Password",
|
|
111
113
|
"newPassword": "New Password",
|
package/bajo/intl/id.json
CHANGED
|
@@ -107,6 +107,8 @@
|
|
|
107
107
|
"contactFormSubmitted": "Form kontak sukses dikirim",
|
|
108
108
|
"currentApiKey": "Kunci API Saat Ini",
|
|
109
109
|
"downloadList": "Daftar Unduh",
|
|
110
|
+
"manageDownload": "Kelola Unduhan",
|
|
111
|
+
"license": "Lisensi",
|
|
110
112
|
"field": {
|
|
111
113
|
"currentPassword": "Kata Sandi Saat Ini",
|
|
112
114
|
"newPassword": "Kata Sandi Baru",
|
package/index.js
CHANGED
|
@@ -10,6 +10,7 @@ async function factory (pkgName) {
|
|
|
10
10
|
this.dependencies = ['bajo-extra', 'bajo-common-db', 'bajo-config']
|
|
11
11
|
this.config = {
|
|
12
12
|
multiSite: false,
|
|
13
|
+
license: false,
|
|
13
14
|
waibu: {
|
|
14
15
|
title: 'Sumba',
|
|
15
16
|
prefix: 'site'
|
|
@@ -169,6 +170,7 @@ async function factory (pkgName) {
|
|
|
169
170
|
{ title: 'manageUser', href: `waibuAdmin:/${prefix}/user/list` },
|
|
170
171
|
{ title: 'manageTeam', href: `waibuAdmin:/${prefix}/team/list` },
|
|
171
172
|
{ title: 'manageTeamUser', href: `waibuAdmin:/${prefix}/team-user/list` },
|
|
173
|
+
{ title: 'manageDownload', href: `waibuAdmin:/${prefix}/download/list` },
|
|
172
174
|
{ title: 'resetUserPassword', href: `waibuAdmin:/${prefix}/reset-user-password` }
|
|
173
175
|
]
|
|
174
176
|
}]
|
package/package.json
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
async function download () {
|
|
2
|
+
return {
|
|
3
|
+
common: {
|
|
4
|
+
disabled: ['create', 'update', 'get'],
|
|
5
|
+
formatter: {
|
|
6
|
+
description: async function (val, rec) {
|
|
7
|
+
const sentence = `<c:a target="_blank" href="sumba:/your-stuff/download/get/${rec.file}" content="${val}" @click.stop />`
|
|
8
|
+
return await this.component.buildSentence(sentence)
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
view: {
|
|
13
|
+
list: {
|
|
14
|
+
fields: ['description', 'type', 'size', 'status', 'updatedAt'],
|
|
15
|
+
stat: {
|
|
16
|
+
aggregate: [
|
|
17
|
+
{ fields: ['type'], group: 'type', aggregate: ['count'] },
|
|
18
|
+
{ fields: ['status'], group: 'status', aggregate: ['count'] }
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default download
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const action = {
|
|
2
|
+
method: ['GET', 'POST'],
|
|
3
|
+
title: 'manageDownload',
|
|
4
|
+
handler: async function (req, reply) {
|
|
5
|
+
const { importModule } = this.app.bajo
|
|
6
|
+
const crudSkel = await importModule('waibuAdmin:/lib/crud-skel.js')
|
|
7
|
+
return await crudSkel.call(this, 'SumbaDownload', req, reply)
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default action
|
|
@@ -27,10 +27,11 @@ const id = {
|
|
|
27
27
|
schema.view.fields = ['createdAt']
|
|
28
28
|
schema.view.label = { createdAt: 'conversation' }
|
|
29
29
|
schema.view.formatter = {
|
|
30
|
-
createdAt: (val, rec)
|
|
30
|
+
createdAt: async function (val, rec) {
|
|
31
31
|
const message = this.app.bajoMarkdown ? this.app.bajoMarkdown.parseContent(rec.message) : rec.message
|
|
32
32
|
const isMe = rec.userId === req.user.id
|
|
33
|
-
|
|
33
|
+
const sentence = `<c:div margin="bottom-3"><c:badge background="color:${isMe ? 'primary' : 'secondary'}" t:content="${isMe ? 'you' : 'us'}" /> <small>${req.format(val, 'datetime')}</small></c:div>`
|
|
34
|
+
return (await this.component.buildSentence(sentence)) + message
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
return await reply.view('sumba.template:/help/trouble-tickets/details.html', { list, schema, master, form, error })
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
async function license (req, reply) {
|
|
2
|
+
if (!this.config.license) throw this.error('_notFound')
|
|
3
|
+
const { fs } = this.lib
|
|
4
|
+
const base = `${this.app.main.dir.pkg}/../LICENSE`
|
|
5
|
+
let tpl = `${base}.${req.lang}.md`
|
|
6
|
+
if (!fs.existsSync(tpl)) tpl = `${base}.md`
|
|
7
|
+
return await reply.view(tpl, { page: { title: req.t('license') }, license: this.config.license })
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default license
|
|
@@ -5,7 +5,8 @@ const download = {
|
|
|
5
5
|
const crudSkel = await importModule('waibuAdmin:/lib/crud-skel.js')
|
|
6
6
|
const layoutTpl = 'main.layout:/with-addons.html'
|
|
7
7
|
const tpl = 'waibuAdmin.template:/crud/list-notitle.html'
|
|
8
|
-
|
|
8
|
+
const options = { forceShowId: false, hidden: ['id'] }
|
|
9
|
+
return await crudSkel.call(this, 'SumbaDownload', req, reply, { tpl, layoutTpl, title: req.t('downloadList'), options })
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const get = {
|
|
2
|
+
method: ['GET'],
|
|
3
|
+
url: '/your-stuff/download/get/*',
|
|
4
|
+
handler: async function (req, reply) {
|
|
5
|
+
const { importModule } = this.app.bajo
|
|
6
|
+
const handler = await importModule('waibu:/lib/handle-download.js')
|
|
7
|
+
const file = `${this.downloadDir}/${req.params['*']}`
|
|
8
|
+
return await handler.call(this, file, req, reply)
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default get
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"common": {
|
|
3
|
-
"disabled": ["create", "update", "get"]
|
|
4
|
-
},
|
|
5
|
-
"view": {
|
|
6
|
-
"list": {
|
|
7
|
-
"fields": ["description", "type", "size", "status", "createdAt", "updatedAt"],
|
|
8
|
-
"stat": {
|
|
9
|
-
"aggregate": [
|
|
10
|
-
{ "fields": ["type"], "group": "type", "aggregate": ["count"] },
|
|
11
|
-
{ "fields": ["status"], "group": "status", "aggregate": ["count"] }
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|