npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nxus-admin

v4.1.0-3

Published

Administration components for Nxus applications

Downloads

43

Readme

nxus-admin

Admin

Extends NxusModule

The Base Admin class provides a web interface for managing Nxus applications and data.

getAdminUrl

Returns String the root Url where the admin interface is available.

page

Registers a page with the admin interface. Pages can be defined two different ways.

Template Partials

admin.page('/route', 'partial-name')

Route Handlers

admin.page('/route', () => { // return a response to be rendered within admin template }) admin.page({route: '/route', directHandler: true}, (req, res) => {...})

Options

The first argument can either be a string or an options hash. If an options hash, it must include a route attribute.

Other options include:

  • route: Required. The route to the page.
  • method: the HTTP method to use for the route.
  • label: the nav label to use. Defaults to a title version of the route.
  • nav: set to false to skip creating a nav item: useful for routes with no display.
  • directHandler: if true, the handler is a full route handler. Otherwise, wrapped to send reponse
  • order: the order of the nav menu.
  • icon: the icon class to use for the page in the nav and other places.

Parameters

  • opts (String | Object) The route or options for the page
  • responder (String | Function) The string partial name or handler function for the route

help

Registers help text for the admin interface.

Parameters

  • section String The nav section
  • welcome String The template partial name to render as welcome and help
  • detail String? An additional partial to render on the help detail

addNav

Register an admin nav menu item, wraps web-nav for relative URls and menu name

Parameters

  • label String Label for nav item
  • route String Either a relative (joined with adminUrl) or absolute URL to link to
  • opts Object nav menu options for web-nav, e.g. icon, order (optional, default {})

manage

Create an AdminController for a given model. Takes either the model identity, or an object to pass to the constructor of AdminController with at least {model: 'identity'}

Parameters

  • opts (String | Object) The model identity or options object. (optional, default {})

AdminController

Extends EditController

A base class for admin model controllers. Overrides the EditController options defaults to provide admin prefixes for routes ("/admin/model-identity") and templates ("model-identity-admin"), and by default wraps templates in 'admin-page' rather than 'page'.

Parameters (in addition to EditController parameters)

  • icon - [deprecated] icon class for nav - defaults to fa-files-o
  • order - optional ordering for nav
  • uploadType - dataManager import type (e.g. csv, json), if set an Import action is available.
  • uploadOptions - options to pass to dataManager parser
  • downloadType - dataManager download type. If set, a Download action is available.

Parameters

  • opts

addNav

Register an admin nav menu item under this model

Parameters

  • label String Label for nav item
  • route String Either a relative (joined with adminUrl) or absolute URL to link to
  • opts Object nav menu options for web-nav, e.g. icon, order (optional, default {})

addAction

Register an admin action item for this model, wrapping web-actions

Parameters

  • page String Template suffix: 'list', 'edit', 'create', 'detail'
  • label String Label for action
  • route String Sub-route for action
  • opts Object options for web-actions, e.g. icon, template (optional, default {})

addInstanceAction

Register an admin instance action item for this model's list page, wrapping web-actions

Parameters

  • label String Label for action
  • route String Sub-route for action
  • opts Object options for web-actions, e.g. icon, template (optional, default {})

_formatDownloadRecord

Override in subclass to do additional formatting of records for download

Parameters

Returns Object formatted record