Another Method for Admin screens with Grails

I came from a background of making sites with Django and after I starting going head-first into Grails, one of the things I missed was a really good and easy to make an admin section. You know — something that “just works” to do some basic CRUD. I know that there is the scaffolding plugin but the problem with that is that it’s not always robust and it’s not easily configurable. I want my admin pages to be look nice as well as being robust.

A little while ago I bumped into the admin-interface plugin, which pretty much does everything that I had hoped for. There is a bit of configuration but it’s not much more than what you had to do in Django. I have a very simple github project for you to play with.

If you look at the bottom of the Config.groovy you will see some simple configurations:

The AuthorAdmin and BookAdmin are little descriptor files that say what fields should appear to be and what order. I found that admin-interface really isn’t that smart — that the fields aren’t listed in any sensible order so I think that file is quite necessary. It’s not even smart enough to remove dateCreated and lastUpdate which Scaffolding does just fine! My sample Author file looked like this:

Admin page with random order

You just have to add the field to the list. This isn’t quite the magic I was hoping for, but it’s only small change, as oppose to generating GSPs or editing them to put in a field.

It’s not like these files are complicated. See below for the Author’s admin file:

And then admin page looks immediately better:

Much better!

I didn’t do it in my example but it can use Spring Security to define what role has access to the Admin section. You can also define the URL and put different domains in logical groups. These are things that this plugin does better than Scaffolding.

I think the admin-interface plugin can easily replace the scaffolding plugin and have happier users too.

About the Author

Object Partners profile.
Leave a Reply

Your email address will not be published.

Related Blog Posts
Natively Compiled Java on Google App Engine
Google App Engine is a platform-as-a-service product that is marketed as a way to get your applications into the cloud without necessarily knowing all of the infrastructure bits and pieces to do so. Google App […]
Building Better Data Visualization Experiences: Part 2 of 2
If you don't have a Ph.D. in data science, the raw data might be difficult to comprehend. This is where data visualization comes in.
Unleashing Feature Flags onto Kafka Consumers
Feature flags are a tool to strategically enable or disable functionality at runtime. They are often used to drive different user experiences but can also be useful in real-time data systems. In this post, we’ll […]
A security model for developers
Software security is more important than ever, but developing secure applications is more confusing than ever. TLS, mTLS, RBAC, SAML, OAUTH, OWASP, GDPR, SASL, RSA, JWT, cookie, attack vector, DDoS, firewall, VPN, security groups, exploit, […]