feature/adding-Thymeleaf-frontend#12
Conversation
📝 WalkthroughWalkthroughThis PR performs minor UI and documentation updates: removes MinIO startup instructions from the README, fixes a product name spelling from "MiniIO" to "MinIO" in the documents list template, removes debug logging from the ticket upload controller, and adds an explicit file input field to the ticket upload form. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/main/resources/templates/tickets/detail.html (1)
116-116: Consider visually hiding the native file input to avoid duplicate UI affordances.The
requirednative<input type="file">now sits alongside the custom dropzone, which gives users two visibly different "pick a file" controls. Sincedocument-upload.jsalready populatesfileInput.filesvia theDataTransferAPI for drop/paste (seedocument-upload.js:30-39), the native input only needs to be reachable — not visually prominent. Visually hiding it (while keeping it focusable and form-submittable) typically yields a cleaner UX and avoids confusion, whilerequiredstill works for native-picker, drop, and paste paths.One common pattern:
♻️ Optional UX refinement
- <input id="file" name="file" type="file" required data-document-file-input> + <input id="file" name="file" type="file" required data-document-file-input class="visually-hidden">…paired with a
.visually-hiddenutility inapp.css(or equivalent) and wiring the dropzone's click/keydown to callfileInput.click()so selection still opens the native picker.Otherwise, the change itself is correct and aligns with the JS expectations (
form.querySelector("[data-document-file-input]")) that would otherwise short-circuit init.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/resources/templates/tickets/detail.html` at line 116, The native file input (<input id="file" name="file" type="file" required data-document-file-input>) is visually duplicating the custom dropzone; visually hide it while keeping it focusable and form-submittable by adding a utility class (e.g., "visually-hidden") to that element and defining the corresponding CSS in app.css (hide visually but not from assistive tech or form submission). Also ensure the dropzone click/keydown handlers in document-upload.js still call fileInput.click() (the code that populates fileInput.files via DataTransfer should continue to work) so the native picker remains reachable and the required attribute still validates.src/main/java/org/group1/projectbackend/controller/web/TicketViewController.java (1)
119-122:ex.printStackTrace()still present — inconsistent with PR summary, and should use a proper logger.The summary states that runtime debug output was removed from
uploadDocument, butex.printStackTrace()on line 120 still dumps the stack toSystem.err. For a web controller, prefer an SLF4J logger so the error is captured in the application's structured logs (with correlation context) instead of raw stderr, and consider logging atwarn/errorwith the exception as the last argument to preserve the stack trace.♻️ Proposed change
+import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @@ public class TicketViewController { + private static final Logger log = LoggerFactory.getLogger(TicketViewController.class); @@ } catch (RuntimeException ex) { - ex.printStackTrace(); + log.warn("Failed to upload document for ticket {}", id, ex); redirectAttributes.addFlashAttribute("documentError", "Dokumentet kunde inte laddas upp: " + ex.getMessage()); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/org/group1/projectbackend/controller/web/TicketViewController.java` around lines 119 - 122, Replace the direct stderr dump in the TicketViewController catch block by removing ex.printStackTrace() and instead log the failure via the class SLF4J logger (e.g. the Logger instance on TicketViewController) at error/warn level, passing a clear message (including any ticketId or context available in uploadDocument) and the exception as the last argument so the stack trace is preserved; keep the redirectAttributes.addFlashAttribute call intact. If the logger is not present, add a private static final Logger using LoggerFactory.getLogger(TicketViewController.class).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@src/main/java/org/group1/projectbackend/controller/web/TicketViewController.java`:
- Around line 119-122: Replace the direct stderr dump in the
TicketViewController catch block by removing ex.printStackTrace() and instead
log the failure via the class SLF4J logger (e.g. the Logger instance on
TicketViewController) at error/warn level, passing a clear message (including
any ticketId or context available in uploadDocument) and the exception as the
last argument so the stack trace is preserved; keep the
redirectAttributes.addFlashAttribute call intact. If the logger is not present,
add a private static final Logger using
LoggerFactory.getLogger(TicketViewController.class).
In `@src/main/resources/templates/tickets/detail.html`:
- Line 116: The native file input (<input id="file" name="file" type="file"
required data-document-file-input>) is visually duplicating the custom dropzone;
visually hide it while keeping it focusable and form-submittable by adding a
utility class (e.g., "visually-hidden") to that element and defining the
corresponding CSS in app.css (hide visually but not from assistive tech or form
submission). Also ensure the dropzone click/keydown handlers in
document-upload.js still call fileInput.click() (the code that populates
fileInput.files via DataTransfer should continue to work) so the native picker
remains reachable and the required attribute still validates.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 659a3d6f-d1a0-4712-84b5-49fbbd2bca50
📒 Files selected for processing (4)
README.mdsrc/main/java/org/group1/projectbackend/controller/web/TicketViewController.javasrc/main/resources/templates/documents/list.htmlsrc/main/resources/templates/tickets/detail.html
💤 Files with no reviewable changes (1)
- README.md
Summary by CodeRabbit
Documentation
Bug Fixes
New Features