Swiftpack.co - Package - nodes-vapor/admin-panel

! Please note !

This package is being replaced by the AdminPanel provider. This package will most likely not be maintained anymore.

Admin Panel ✍️

Swift Version Vapor Version Linux Build Status macOS Build Status codebeat badge codecov Readme Score GitHub license

Build easy customizable admin features for your app!

Features

  • Admin user system with roles
  • Welcome mails
  • Reset password
  • Dashboard with easy graphs
  • SSO logins

image

📦 Installation

Update your Package.swift file.

.Package(url: "https://github.com/nodes-vapor/admin-panel.git", majorVersion: 1)

Getting started 🚀

Configs

Create config adminpanel.json

{
    "name": "Nodes Admin Panel",
    "unauthorizedPath": "/admin/login",
    "loginSuccessPath": "admin/dashboard",
    "loadRoutes": true,
    "loadDashboardRoute": true,
    "profileImageFallbackUrl": "https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg",
    "welcomeMailViewPath": "Emails/welcome",
    "resetPasswordViewPath": "Emails/reset-password",
    "autoLoginFirstUser": false,
    "ssoRedirectUrl": "https://mysso.com",
    "ssoCallbackPath": "/admin/ssocallback",
    "roles": [
        {
            "title": "Super admin",
            "slug": "super-admin",
            "is_default": false
        },
        {
            "title": "Admin",
            "slug": "admin",
            "is_default": false
        },
        {
            "title": "User",
            "slug": "user",
            "is_default": true
        }
    ]
}

Create config mail.json

{
    "smtpHost": "smtp.mailgun.org",
    "smtpPort": "465",
    "user": "",
    "password": "",
    "fromEmail": ""
}

Make sure to have config app.json setup

{
    "name": "MY-PROJECT",
    "url": "0.0.0.0:8080"
}

The url here will be used as redirect link in invite emails fx.

Add provider

In your Config+Setup.swift (or wherever you setup your providers), make sure to add the AdminPanel provider.

import AdminPanel

// ...

private func setupProviders() throws {
    // ...
    try addProvider(AdminPanel.Provider.self)
}

Seed data

Add the seeder command to your Config+Setup.swift (or wherever you setup your commands):

addConfigurable(command: AdminPanel.Seeder.init, name: "seeder")

Next, add it to your Config/droplet.json file, like this:

"commands": [
    "prepare",
     "seeder"
]

Finally, run the command in your terminal (remember to build the project first):

vapor run seeder

UI package

Prerequisites

  • node.js > v4.0
  • npm > v3.0
  • bower > 2.0

With brew

brew install node
brew install npm
brew install bower
npm install -g gulp

Setup

  • Copy the files from Sources/AdminPanel/gulp (of this repo) to the ROOT of your project
  • Copy the files from Sources/AdminPanel/Resources (of this repo) to the Resources folder in your project
  • Copy the files from Sources/AdminPanel/Public/favicon.ico (of this repo) and the favicon folder to the Public folder in your project
  • Run npm install > bower install > gulp build

Read more

Wiki: https://github.com/nodes-vapor/admin-panel/wiki

Github: https://github.com/nodes-frontend/nodes-ui

Doc: https://nodes-frontend.github.io/nodes-ui/

Using views from packages (for development)

drop.view = LeafRenderer(
    viewsDir: Droplet().workDir + "/Packages/AdminPanel-0.5.4/Sources/AdminPanel/Resources/Views"
)

🏆 Credits

This package is developed and maintained by the Vapor team at Nodes. The package owner for this project is Steffen.

📄 License

This package is open-sourced software licensed under the MIT license

Github

link
Stars: 37
Help us keep the lights on

Releases

1.0.2 - Sep 13, 2017

  • Remove the need for adding BackendUserPasswordResetToken to Node.fuzzy

1.0.1 - Aug 17, 2017

Added

  • Convenience to init the provider using SSO and a Config

1.0.0 - Aug 3, 2017

1.0.0-beta9 - Jul 18, 2017

1.0.0-beta14 - Jul 18, 2017