Skip to content

feat: add Thymeleaf frontend with ticket management views and styles#10

Merged
VonAdamo merged 3 commits into
mainfrom
feature/adding-Thymeleaf-frontend
Apr 23, 2026
Merged

feat: add Thymeleaf frontend with ticket management views and styles#10
VonAdamo merged 3 commits into
mainfrom
feature/adding-Thymeleaf-frontend

Conversation

@VonAdamo

@VonAdamo VonAdamo commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

Release Notes

  • New Features
    • Home page with navigation menu
    • Ticket listing page displaying ticket details and status
    • Ticket detail view with comment system and status updates
    • Ticket creation form with priority selection
    • Enhanced user interface with improved styling and responsive design

@coderabbitai

coderabbitai Bot commented Apr 23, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@VonAdamo has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 41 minutes and 18 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 41 minutes and 18 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0632227c-1796-427f-a64c-9dd3f6b6a879

📥 Commits

Reviewing files that changed from the base of the PR and between df09c30 and 0bd83dc.

📒 Files selected for processing (5)
  • src/main/java/org/group1/projectbackend/config/DataInitializer.java
  • src/main/java/org/group1/projectbackend/controller/web/TicketViewController.java
  • src/main/resources/static/css/app.css
  • src/main/resources/templates/tickets/detail.html
  • src/main/resources/templates/tickets/new.html
📝 Walkthrough

Walkthrough

This PR integrates Thymeleaf templating support and introduces a web view layer for ticket management. Changes include a home page controller, ticket listing/detail/creation views with corresponding Spring MVC controllers, service method extensions, and a complete CSS stylesheet for styling.

Changes

Cohort / File(s) Summary
Dependencies & Configuration
pom.xml, src/main/resources/application.properties
Added Thymeleaf starter dependency; disabled template and static resource caching for development.
Database Initialization
src/main/java/org/group1/projectbackend/config/DataInitializer.java
Extended seed data from single user to five users with unique username/email/password/full_name values.
Web Controllers
src/main/java/org/group1/projectbackend/controller/web/HomeController.java, src/main/java/org/group1/projectbackend/controller/web/TicketViewController.java
Added HomeController for root path; added TicketViewController handling GET/POST for ticket CRUD operations (list, detail, create, update status, add comments).
Service Layer
src/main/java/org/group1/projectbackend/service/SupportTicketService.java, src/main/java/org/group1/projectbackend/service/impl/SupportTicketServiceImpl.java
Added getAllTickets() method to retrieve all support tickets as TicketResponse objects.
Styling
src/main/resources/static/css/app.css
New comprehensive CSS stylesheet defining theme variables, layout, card components, badges, form styling, responsive behavior, and accessibility support.
View Templates
src/main/resources/templates/fragments/layout.html, src/main/resources/templates/index.html, src/main/resources/templates/tickets/list.html, src/main/resources/templates/tickets/detail.html, src/main/resources/templates/tickets/new.html
Added Thymeleaf templates: reusable header fragment, home page, ticket listing table, ticket detail with comment form and list, and ticket creation form (all in Swedish).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 Thymeleaf templates dance so fine,
With tickets listed in a line,
CSS colors bright and bold,
A web layer story to be told! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately summarizes the main changes: adding Thymeleaf frontend support with ticket management views and CSS styling across multiple new controller, template, and style files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/adding-Thymeleaf-frontend

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/org/group1/projectbackend/config/DataInitializer.java (1)

18-35: ⚠️ Potential issue | 🔴 Critical

Fix the multi-row insert syntax and make seeding idempotent.

PostgreSQL does not accept repeated VALUES keywords here, so a fresh database will fail during startup. Also, the id = 1 guard means existing dev databases will never receive users 2-5.

🐛 Proposed fix
-        Integer userCount = jdbcTemplate.queryForObject(
-                "SELECT COUNT(*) FROM users WHERE id = 1",
-                Integer.class
-        );
-
-        if (userCount != null && userCount > 0) {
-            return;
-        }
-
         jdbcTemplate.update(
                 """
                 INSERT INTO users (id, username, email, password, full_name, enabled, created_at)
-                VALUES (1, 'user', 'user@example.com', 'password', 'user', true, CURRENT_TIMESTAMP)
-                VALUES (2, 'adamaj01', 'adamaj@example.com', 'password', 'Adam', true, CURRENT_TIMESTAMP)
-                VALUES (3, 'emmtra01', 'emmtra@example.com', 'password', 'Emma', true, CURRENT_TIMESTAMP)
-                VALUES (4, 'erifal01', 'erifal@example.com', 'password', 'Erika', true, CURRENT_TIMESTAMP)
-                VALUES (5, 'johjan01', 'johjan@example.com', 'password', 'Johan', true, CURRENT_TIMESTAMP)
+                VALUES
+                    (1, 'user', 'user@example.com', 'password', 'user', true, CURRENT_TIMESTAMP),
+                    (2, 'adamaj01', 'adamaj@example.com', 'password', 'Adam', true, CURRENT_TIMESTAMP),
+                    (3, 'emmtra01', 'emmtra@example.com', 'password', 'Emma', true, CURRENT_TIMESTAMP),
+                    (4, 'erifal01', 'erifal@example.com', 'password', 'Erika', true, CURRENT_TIMESTAMP),
+                    (5, 'johjan01', 'johjan@example.com', 'password', 'Johan', true, CURRENT_TIMESTAMP)
+                ON CONFLICT (id) DO NOTHING
                 """
         );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/org/group1/projectbackend/config/DataInitializer.java` around
lines 18 - 35, The current seeding in DataInitializer uses an incorrect
multi-row INSERT (repeated VALUES) and only checks for id = 1, preventing
seeding of users 2-5; change the guard using jdbcTemplate.queryForObject to
check for any existing users (e.g., COUNT(*) > 0) or check existence of each
row, and replace the INSERT SQL in jdbcTemplate.update with a single INSERT
statement that lists multiple rows using one VALUES clause with comma-separated
tuples, or preferably use INSERT ... ON CONFLICT (id) DO NOTHING to make the
operation idempotent so reruns won’t error or duplicate data.
🧹 Nitpick comments (1)
src/main/resources/application.properties (1)

16-19: Scope cache disabling to a dev profile.

These defaults disable static resource and Thymeleaf caching for every environment. If this is only for frontend iteration, move them to application-dev.properties or guard them with profile-specific config to avoid production performance regressions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/resources/application.properties` around lines 16 - 19, The three
properties spring.web.resources.cache.period, spring.web.resources.chain.cache,
and spring.thymeleaf.cache should not be globally disabled in
application.properties; move them into a profile-specific file (e.g., create
application-dev.properties) or add profile-scoped equivalents so they only apply
when the "dev" profile is active, then remove or revert them from
application.properties; update any docs or run configurations to activate the
"dev" profile during local/frontend iteration as needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/main/java/org/group1/projectbackend/controller/web/TicketViewController.java`:
- Around line 63-74: The createComment method currently accepts a
client-provided userId and trusts it; remove the `@RequestParam` Long userId and
instead obtain the authenticated user on the server (e.g., add a Principal or
Authentication parameter to the controller method), resolve that principal to an
internal user id (for example via a UserService method like
findByUsername(principal.getName()) and getId()), set that id on
CreateCommentDto, and then call commentService.createComment(comment) as before;
update imports and any method signature references to use
Principal/Authentication and remove reliance on the request-supplied userId.
- Around line 50-58: The createTicket handler in TicketViewController builds a
CreateTicketRequest manually from individual `@RequestParam` values so Spring
validation on DTO constraints isn't applied; change the method signature to
accept a validated form object (e.g., replace individual `@RequestParam` params
with a single `@Valid` CreateTicketRequest parameter and add BindingResult if you
need to handle errors) or explicitly validate the constructed
CreateTicketRequest before calling
supportTicketService.createTicket(principal.getName(), request) so
`@NotBlank/`@Size/@NotNull annotations on CreateTicketRequest are enforced.

In `@src/main/resources/static/css/app.css`:
- Line 125: Replace the quoted SFMono-Regular font name in the font-family
declarations to satisfy Stylelint's font-family-name-quotes rule: find
occurrences of the declaration string font-family: "SFMono-Regular", Consolas,
"Liberation Mono", monospace; (and the similar lines at the other reported
locations) and remove the quotes around SFMono-Regular so it becomes
font-family: SFMono-Regular, Consolas, "Liberation Mono", monospace;; apply the
same change at the other reported lines (the other font-family declarations
referencing "SFMono-Regular").

In `@src/main/resources/templates/tickets/detail.html`:
- Around line 70-72: Remove the client-controlled hidden field name="userId"
from the form in the tickets detail template (the form with
th:action="@{/tickets/{id}/comments(id=${ticket.id()})}") so the browser cannot
assert comment ownership; then update the server-side POST handler that
processes POST /tickets/{id}/comments (the controller method that creates/saves
comments) to derive the commenter from the authenticated principal/session
instead of relying on any submitted userId value, setting the comment's owner
from that authenticated user before persisting.

---

Outside diff comments:
In `@src/main/java/org/group1/projectbackend/config/DataInitializer.java`:
- Around line 18-35: The current seeding in DataInitializer uses an incorrect
multi-row INSERT (repeated VALUES) and only checks for id = 1, preventing
seeding of users 2-5; change the guard using jdbcTemplate.queryForObject to
check for any existing users (e.g., COUNT(*) > 0) or check existence of each
row, and replace the INSERT SQL in jdbcTemplate.update with a single INSERT
statement that lists multiple rows using one VALUES clause with comma-separated
tuples, or preferably use INSERT ... ON CONFLICT (id) DO NOTHING to make the
operation idempotent so reruns won’t error or duplicate data.

---

Nitpick comments:
In `@src/main/resources/application.properties`:
- Around line 16-19: The three properties spring.web.resources.cache.period,
spring.web.resources.chain.cache, and spring.thymeleaf.cache should not be
globally disabled in application.properties; move them into a profile-specific
file (e.g., create application-dev.properties) or add profile-scoped equivalents
so they only apply when the "dev" profile is active, then remove or revert them
from application.properties; update any docs or run configurations to activate
the "dev" profile during local/frontend iteration as needed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c93385cb-d7cc-4a9e-b831-fc7176f16414

📥 Commits

Reviewing files that changed from the base of the PR and between b0a68bf and df09c30.

📒 Files selected for processing (13)
  • pom.xml
  • src/main/java/org/group1/projectbackend/config/DataInitializer.java
  • src/main/java/org/group1/projectbackend/controller/web/HomeController.java
  • src/main/java/org/group1/projectbackend/controller/web/TicketViewController.java
  • src/main/java/org/group1/projectbackend/service/SupportTicketService.java
  • src/main/java/org/group1/projectbackend/service/impl/SupportTicketServiceImpl.java
  • src/main/resources/application.properties
  • src/main/resources/static/css/app.css
  • src/main/resources/templates/fragments/layout.html
  • src/main/resources/templates/index.html
  • src/main/resources/templates/tickets/detail.html
  • src/main/resources/templates/tickets/list.html
  • src/main/resources/templates/tickets/new.html

Comment thread src/main/resources/static/css/app.css Outdated
Comment thread src/main/resources/templates/tickets/detail.html Outdated
@VonAdamo
VonAdamo merged commit 81e4e23 into main Apr 23, 2026
2 checks passed
This was referenced Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant