sumba 1.2.8 → 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/package.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
async function download () {
|
|
2
|
+
return {
|
|
3
|
+
common: {
|
|
4
|
+
disabled: ['create', 'update', 'get'],
|
|
5
|
+
hidden: ['id'],
|
|
6
|
+
formatter: {
|
|
7
|
+
description: async function (val, rec) {
|
|
8
|
+
const sentence = `<c:a target="_blank" href="sumba:/your-stuff/download/get/${rec.file}" content="${val}" />`
|
|
9
|
+
return await this.component.buildSentence(sentence)
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
view: {
|
|
14
|
+
list: {
|
|
15
|
+
fields: ['description', 'type', 'size', 'status', 'updatedAt'],
|
|
16
|
+
stat: {
|
|
17
|
+
aggregate: [
|
|
18
|
+
{ fields: ['type'], group: 'type', aggregate: ['count'] },
|
|
19
|
+
{ fields: ['status'], group: 'status', aggregate: ['count'] }
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default download
|
|
@@ -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,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
|
-
}
|