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: 44
Help us keep the lights on

Releases

2.0.0-beta.15 - Dec 11, 2018

Changed

  • Correctly specified 4.1 as the minimum required Swift version.

Removed

  • This package no longer uses the MutableLeafTagConfig. Please use useAdminPanelLeafTags() for registering this package's Leaf tags (see readme for more info).

2.0.0-beta.14 - Nov 30, 2018

Changed

  • Aligned with Reset updates.
  • Simplified the config in regards to the signer used for Reset.

2.0.0-beta.13 - Nov 12, 2018

Added

  • WYSIWYG Leaf tag (#79)
  • Strong password validator (#51)

Changed

  • Bumped to Swift 4.2
  • Aligns with community guidelines (how to register routes)

Fixed

  • Added Leaf tag Paginator (#106)
  • Signer for reset password flow can now be configured (#94)
  • Respects SwiftLint rules

2.0.0-beta.12 - Sep 5, 2018

Fixed

  • Wrong references to Reset config (baseUrl vs baseURL)

2.0.0-beta.11 - Sep 4, 2018

Changed

  • Environment label is now vertically aligned.
  • Updated names including the word URL to consistently capitalize the word.
  • Paths for the different endpoints can now be overwritten.

⚠️ This is a breaking change.