Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
branding: {
companyName: 'Some demo',
},
pages: {
customPage: {
label: "Custom page",
handler: async (request, response, context) => {
return {
text: 'I am fetched from the backend',
}
},
component: AdminBro.bundle('./components/some-stats'),
},
anotherPage: {
label: "TypeScript page",
component: AdminBro.bundle('./components/test-component'),
},
},
dashboard: {
handler: async (request, response, data) => {
const categories = await CategoryModel.find({}).limit(5)
return {
usersCount: await UserModel.countDocuments(),
pagesCount: await PageModel.countDocuments(),
categories: await Promise.all(categories.map(async c => {
const comments = await CommentModel.countDocuments({ category: c._id })
return {
title: c.title,
comments,
_id: c._id,
}
}))
],
version: {
admin: true,
},
branding: {
companyName: 'Some demo',
},
pages: {
customPage: {
label: "Custom page",
handler: async (request, response, context) => {
return {
text: 'I am fetched from the backend',
}
},
component: AdminBro.bundle('./components/some-stats'),
},
anotherPage: {
label: "TypeScript page",
component: AdminBro.bundle('./components/test-component'),
},
},
dashboard: {
handler: async (request, response, data) => {
const categories = await CategoryModel.find({}).limit(5)
return {
usersCount: await UserModel.countDocuments(),
pagesCount: await PageModel.countDocuments(),
categories: await Promise.all(categories.map(async c => {
const comments = await CommentModel.countDocuments({ category: c._id })
return {
title: c.title,
handler: async (request, response, data) => {
const categories = await CategoryModel.find({}).limit(5)
return {
usersCount: await UserModel.countDocuments(),
pagesCount: await PageModel.countDocuments(),
categories: await Promise.all(categories.map(async c => {
const comments = await CommentModel.countDocuments({ category: c._id })
return {
title: c.title,
comments,
_id: c._id,
}
}))
}
},
component: AdminBro.bundle('./components/dashboard'),
},
}
const AdminBro = require('admin-bro')
const { sort, timestamps } = require('./sort')
module.exports = {
name: 'Article (customize field)',
sort,
properties: {
...timestamps,
_id: { isVisible: false },
content: {
type: 'richtext',
},
published: {
label: 'Published (custom render)',
components: {
list: AdminBro.bundle('../components/article-in-list')
}
},
}
}
},
edit: { isAccessible: isAdmin },
delete: { isAccessible: isAdmin },
},
},
},
],
branding: {
logo: '/static/images/logo.svg',
companyName: 'AZTEC',
softwareBrothers: false,
},
dashboard: {
handler: async () => {
},
component: AdminBro.bundle('../components/dashboard'),
},
};
};