How to use the admin-bro.bundle function in admin-bro

To help you get started, we’ve selected a few admin-bro examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SoftwareBrothers / admin-bro-example-app / admin / index.js View on Github external
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,
          }
        }))
github SoftwareBrothers / admin-bro-example-app / admin / index.js View on Github external
],
  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,
github SoftwareBrothers / admin-bro-example-app / admin / index.js View on Github external
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'),
  },
}
github SoftwareBrothers / admin-bro-example-app / admin / resources / article.js View on Github external
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')
      }
    },
  }
}
github AztecProtocol / AZTEC / packages / admin-panel / helpers / getBroOptions.js View on Github external
},
                        edit: { isAccessible: isAdmin },
                        delete: { isAccessible: isAdmin },
                    },
                },
            },
        ],
        branding: {
            logo: '/static/images/logo.svg',
            companyName: 'AZTEC',
            softwareBrothers: false,
        },
        dashboard: {
            handler: async () => {
            },
            component: AdminBro.bundle('../components/dashboard'),
        },
    };
};