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

fl-admin

v11.4.1

Published

Admin panel for FounderLab apps

Downloads

350

Readme

Admin panel for FounderLab apps

This module will auto generate a full admin site to manage a backend based on Frameworkstein models. You provide the models you want to manage for and it will generate routes and form pages for them.

Screenshots

Homepage

Select a model type to edit its data.

Model list

Fields can be configured to display and edit on the list page.

Model detail

Fields can have their inputs configured for the detail page.

How it works

You call configureAdmin and configure the admin with a list of models. It examines each models fields via its schema and generates form fields to edit them. You can pass in some options to control how these form fields are rendered.

Example

    import configureAdmin from 'fl-admin'
    import StaticPage from './models/StaticPage'
    import User from './models/User'

    configureAdmin({
      models: [
        {
          Model: User,
          display: model => model.email,
          fields: {
            email: {
              listDisplay: true,
            },
            admin: {
              listDisplay: true,
            },
          },
        },
        {
          Model: Post,
          fields: {
            title: {
              listEdit: true,
            },
            content: {
              input: 'textarea',
            },
          },
        },
      ],
    })

Configuration

There are model-level and field-level configuration options. Models given to configuration functions are plain javascript objects (not instances of the model class).

Model configuration options

Values below are the defaults.

{
    Model: null,                                              // (required) The model class

    display: model.name || model.title,                       // Function that takes a model object and returns a string representation of it

    name: Model.modelName || Model.model_name || Model.name,  // String representation of the model class

    sort: 'id',                                               // Sorting for list pages

    perPage: 50,                                              // Models to show per list page

    listDelete: false,                                        // Show a delete button on the list page

    rootPath: options.rootPath, 

    path: table(Model),                                       // Path to use in the model's url

    plural: plural(Model),                                    // Plural of the model class name

    actionType: `${ACTION_PREFIX}${upper(Model)}`,            // Redux action naming scheme to use

    readOnlyFields: ['createdDate'],                          // List of fields that shouldn't be edited

    ListComponent,                                            // Specify your own component for the list page
    CreateComponent,                                          // Specify your own component for the create page
    DetailComponent,                                          // Specify your own component for the detail page
}

Field configuration options

Values below are the defaults.

{
    label: label(key),                                        // Human readable label to use for the given field
    
    InputComponent: SmartInput,                               // The component to use to edit this field. Any component that can be used with a `redux-form` field will suit.

    input: 'text',                                            // The input type, will be supplied to the input component as a `type` prop. The default `SmartInput` component knows how to render these options: 'text', 'textarea', 'date', 'datetime', 'time', 'image', 'file', 'checkbox', 'static'.

    listDisplay: false,                                       // Show this field on the listing page

    listEdit: false,                                          // Enable editing of this field on the listing page

    readOnly: false,                                          // Disable editing of this field on the detail page

    hidden: false,                                            // Hide this field on the detail page
}