Searchable comboboxes

Comboboxes, ie. html <select>, are not searchable by default. This is only ok for very short lists. After a short search i found the https://select2.org/ which was quite easy to use with Grails. I will walk through the steps needed to make it work in a new project. First create an application to run the… Continue reading Searchable comboboxes

Geb testing – revisited

I have now written a couple of domain geb tests and overcome the first practical obstacles. Internationalization Firefox and chrome browsers language is Norwegian, while htmlUnit is English. This means that labels et.c. will change with the configured language of the browser. Starting with this EmployeeListPage: And then change the title: I put code used… Continue reading Geb testing – revisited

Geb testing on linux

I started with downloading https://guides.grails.org/grails-geb-multiple-browsers/guide/index.html and followed the guide. Running the test with HtmlUnit worked at once. The Chrome test worked once the drivers had been installed. Firefox test gave a few error messages. After some searching, and re-reading the message I noticed this “The path to the driver executable must be set by the… Continue reading Geb testing on linux

Documentation – rest api

When resarching documentation for the previous blog posts I stumbled upon this project: https://github.com/grails/groovy-rest-doc where Sergio del Amo have writen a tool to help document a rest api. First I downloaded the whole code, and run integration test, then asciidoctor task. Now lets see how this works with a new project. Then create a domain… Continue reading Documentation – rest api

Documenting your Grails application – part 2

In this blog post I will try to make write some documentation with ascii-doctor work. Here’s the asciidoctor user manual: https://asciidoctor.org/docs/user-manual/ First test: Can I simply write adoc’s instead of gdoc’s? Let’s create a project and see what happens: Add the plugin to build.gradle: Reload the gradle project and the task docs will be awailable… Continue reading Documenting your Grails application – part 2

Changing log level at run-time

Sometimes you need to change log-level for parts of your application at run-time. Most likely for debugging. When researching this topic I found a useful trait that logs log-level. https://github.com/jfrosch/GrailsLoggingIssue With this I created a LogLevel controller to visualize and manipulate log-levels: The loggerList variable gets very long if not filtered. Here’s the logLevel/index.gsp: It… Continue reading Changing log level at run-time

Customizing spring security userdetails

Lately I have been working on Spring security with this configuration: with groups database stored in tenant database First problem I detected was that the PerTenantUserDetailsService implemented in https://johnny.prpr.no/spring-security-multitenant/ was annotated with @CurrentTenant, which is wrong. Furthermore I wanted to add fullName to the UserDetails, for easy lookup. This was achieved by following the plugin… Continue reading Customizing spring security userdetails

id generation in database tables

By default GORM uses theĀ nativeĀ id generation strategy of the database, whether that be an auto-increment column or a sequence. http://gorm.grails.org/latest/hibernate/manual/ Given a configuration with one database server this is good. However when adding replicas this could become problematic, since this is often auto-generated by the database server. For a fuller discussion se the links at… Continue reading id generation in database tables

Spring security core and Postgres

I am using Postgres database server. In Postgres creating a table with then name user is not allowed. One way to solve this is to map the User domain to a table with another name than user. Domain User example that works with Postgres using the table uuser: