5

I am using a gobuffalo framework to create a website with a postgres database, and I am trying to find a good admin dashboard to accompany it. Something like Rail's ActiveAdmin would be awesome. Does anyone have any suggestions?

Libby
  • 932
  • 8
  • 15
  • 1
    If you need an admin dashboard, write one. – Adrian Aug 21 '17 at 15:52
  • 1
    I think the goal is that Rails' ActiveAdmin is an admin dashboard scaffolding tool that reduces several developer work days to 0 developer work days. The OP is wondering if such an admin dashboard scaffolding tool exists in golang. – Him Aug 21 '17 at 17:08

2 Answers2

5

I ended up using qor/admin to generate the dashboard. It came with views that were already setup. The only code I needed was to tell qor which models I wanted to show. For anyone else trying to implement this in gobuffalo.io, here is how you can generate the routes

func App() *buffalo.App {
    if app == nil {
        app = buffalo.Automatic(buffalo.Options{
            Env:         ENV,
            SessionName: "_liam_session",
        })

        app.GET("/", HomeHandler)
        app.ANY("/admin/{path:.+}", buffalo.WrapHandler(http.StripPrefix("/admin", Other())))
        app.ServeFiles("/assets", packr.NewBox("../public/assets"))
    }
    return app
}

func Other() http.Handler {
    f := func(res http.ResponseWriter, req *http.Request) {
        fmt.Fprintln(res, req.URL.String())
        fmt.Fprintln(res, req.Method)
    }
    mux := mux.NewRouter()
    mux.HandleFunc("/foo", f).Methods("GET")
    mux.HandleFunc("/bar", f).Methods("DELETE")
    return mux
}
Libby
  • 932
  • 8
  • 15
2

I use templates for this and it works well. You can generate the views and potentially the handlers and model with basic admin views for CRUD actions very quickly, which is nice. Obviously for each admin view you're going to want to customise it to some extent but as a starting point it works very well.

This is the tool I'm using (if you've used rails it should be familiar), you should also be able to knock something together with go generate (for code), a tool like genny, or just your own solution using text/template to output what you need. I've used this approach on a few projects now, I recommend if you find yourself creating dashboards which then need to be customised later. Most apps have a certain amount of boilerplate for each resource (create, update, delete, index).

Kenny Grant
  • 9,360
  • 2
  • 33
  • 47