New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@signallabs/admin

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@signallabs/admin

Admin UI App.

latest
Source
npmnpm
Version
5.12.1
Version published
Maintainers
1
Created
Source

Admin UI app

View changelog

A KeystoneJS app which provides an Admin UI for content management.

Usage

const { Keystone } = require('@keystonejs/keystone');
const { GraphQLApp } = require('@keystonejs/app-graphql');
const { AdminUIApp } = require('@keystonejs/app-admin-ui');

const authStrategy = keystone.createAuthStrategy({...});

module.exports = {
  keystone: new Keystone(),
  apps: [
    new GraphQLApp(),
    new AdminUIApp({
      adminPath: '/admin',
      authStrategy,
    }),
  ],
};

Config

OptionTypeDefaultRequiredDescription
adminPathString/adminfalseThe path of the Admin UI.
apiPathString/admin/apifalseThe path of the API provided to the Admin UI.
graphiqlPathString/admin/apifalseThe path of the graphiql app, an in-browser IDE for exploring GraphQL.
authStrategyObjectnullfalseSee Authentication Guides
hooksString./admin-ui/falsePath to customization hooks. See below for more information.
enableDefaultRouteBoolfalsefalseIf enabled, the path of the Admin UI app will be set to /.
schemaNameStringpublicfalse
isAccessAllowedFunctiontruefalseControls which users have access to the Admin UI.
adminMetaObject{}falseProvides additional adminMeta. Useful for Hooks and other customizations

hooks

Customization hooks allow you to modify various areas of the Admin UI to better suit your development needs. The index.js file at the given path should export a single config object containing your chosen hooks. All are optional.

If omitted, Keystone will look under ./admin-ui/ for a hooks config export.

Usage

new AdminUIApp({ hooks: require.resolve('./custom-hooks-path') });

The following hooks are available. Each is a function that takes no arguments.

export default {
  logo,
  pages,
};

The logo to display on the signin screen.

Should return a React component.

export default {
  logo: () => <MyAwesomeLogo />,
};

pages

Allows grouping list pages in the sidebar or defining completely new pages.

Should return an array of objects, which may contain the following properties:

NameTypeDescription
labelStringThe page name to display in the sidebar.
pathStringThe page path.
component`FunctionClass`
childrenArrayAn array of either Keystone list keys or objects with listKey and label properties.
export default {
  pages: () => [
    // Custom pages
    {
      label: 'A new dashboard',
      path: '',
      component: Dashboard,
    },
    {
      label: 'About this project',
      path: 'about',
      component: About,
    },
    // Ordering existing list pages
    {
      label: 'Blog',
      children: [
        { listKey: 'Post' },
        { listKey: 'PostCategory', label: 'Categories' },
        { listKey: 'Comment' },
      ],
    },
    {
      label: 'People',
      children: ['User'],
    },
  ],
};

isAccessAllowed

This function takes the same arguments as a shorthand imperative boolean access control. It must return either true or false.

Important: If omitted, all users with accounts will be able to access the Admin UI. The example below would restrict access to users with the isAdmin permission.

Usage

new AdminUIApp({
  /*...config */
  isAccessAllowed: ({ authentication: { item: user, listKey: list } }) => !!user && !!user.isAdmin,
}),

FAQs

Package last updated on 30 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts