Mar 6, 2015

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

Mike Hostetler profile.

Mike Hostetler

Principal Technologist

Mike has almost 20 years of experience in technology. He started in networking and Unix administration, and grew into technical support and QA testing. But he has always done some development on the side and decided a few years ago to pursue it full-time. His history of working with users gives Mike a unique perspective on writing software.

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Blog Posts
Structuring SwiftUI Previews for API Calls
SwiftUI, together with Combine and Xcode 11+, provide a powerful toolset for quickly creating an app with a native UI. In Xcode 11+, the preview pane was introduced in order to provide live snapshots of […]
Seamlessly Integrating Micro Apps with iFrame
A recent client wanted to upgrade a small portion of their legacy application with a more modern UI and extra functionality, like fuzzy text search. There are a few approaches to incremental upgrades of legacy […]
Consul on Docker EE
[markdown]”Consul is a service networking solution to connect and secure services across any runtime platform and public or private cloud” – [https://consul.io](https://consul.io) This post details a way to run a Consul cluster on Docker EE […]
Passing the AWS Machine Learning Speciality Exam
The Amazon Machine Learning Specialty Exam is a 3-hour, 65 question test. It is designed to test your skills in AWS specific Data Engineering and Machine Learning Practices along with Machine Learning in general. I […]