If you have FormComponents in a ListView you need to call setReuseItems(true) on the ListView. Otherwise the ListItems will be recreated before rendering which results in them losing their "converted input" (what Wicket calls the submitted value). Instead of simply calling setReuseItems(true) on the ListView, which would've solved the problem, it was instead replaced by a proper FormComponent for dealing with this exact case (a CheckboxMultipleChoice component). This reduces the amount of code required and more clearly communicates intent. The change required some minor test refactoring. Fixes #33 --- Now requires at least one project type to be selected before saving. Fixes #34 --- ## How to test 1. Go to "Admin" / "Match" / "Application periods" 2. Click create new 3. Submit without selecting any types 4. See that there's proper feedback 5. Leave name blank and select some types 6. Submit 7. See that the project type selection sticks around Co-authored-by: Nico Athanassiadis <nico@dsv.su.se> Reviewed-on: #47 Reviewed-by: Nico Athanassiadis <nico@dsv.su.se> Co-authored-by: Andreas Svanberg <andreass@dsv.su.se> Co-committed-by: Andreas Svanberg <andreass@dsv.su.se>
Working with the API
The API is protected by OAuth 2 acting as a resource server verifying tokens using token introspection.
When developing it uses a locally running instance of an
authorization server
that is run inside Docker. It can be started with docker compose -f docker-compose.yml up
.
Since there is no frontend to interact with the authorization server there's a helper script in
GetToken.java that can be run directly with java GetToken.java
to run through the authorization flow
and get an access token.
Once the token has been obtained go to the Swagger UI to interact with the API. Click the "Authorize" button in the top right and paste the access token to log in.
Code formatting
This project uses prettier-java
to format all Java code. To reformat the code run
./mvnw validate frontend:npm@reformat -pl .
.
Yes it's a mouthful but unfortunately the prettier-maven-plugin
does not work due to an outstanding issue.
An easier way to reformat code is to set IntelliJ to do it on save. Go to
Settings -> Language & Frameworks -> JavaScript -> Prettier
and then check
Automatic Prettier Configuration
, set Run for files
to **/*.{java}
,
and finally check Run on save
.
The formatting is validated by CI, but you should do it beforehand with a simple ./mvnw verify -pl .
.