feat: add dashboard pagination, bulk update, and quick assign - #6
Open
itheCreator1 wants to merge 2 commits into
Open
feat: add dashboard pagination, bulk update, and quick assign#6itheCreator1 wants to merge 2 commits into
itheCreator1 wants to merge 2 commits into
Conversation
…uick assign Added comprehensive dashboard improvements for better ticket management: Features: - Pagination (50 tickets per page) for better performance - Status and priority counts in filter dropdowns - Last comment preview on each ticket row - Ticket age calculation and display - Bulk update functionality (status, priority, assignment) - Quick assign dropdown for individual tickets - Database indexes for dashboard query optimization Technical Changes: - New Ticket model methods: findAllPaginated(), getCountsByStatus(), getCountsByPriority(), bulkUpdate() - New Comment model method: getLastCommentsByTicketIds() - New utility: dateHelpers.js for ticket age calculation - Enhanced ticketService with getDashboardData() and bulkUpdateTickets() - New validators: validateBulkUpdate, validateQuickAssign - Migration 010: Added indexes on tickets (status, priority, created_at) - Comprehensive audit logging for bulk operations Performance: - Parallel queries for dashboard data - Optimized comment fetching with single query - Database indexes for faster filtering and sorting - Pagination reduces initial load time 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ure with current conventions Fixes bugs found while rebasing feature/dashboard-enhancements onto main: - Bulk-update's "no change" and "unassign" assignment options both used value="" - any bulk update (even one only touching status/priority) silently unassigned every selected ticket. Unassign now uses a distinct __unassign__ sentinel. - validateBulkUpdate/validateQuickAssign rejected the empty-string default form values for status/priority/assigned_to, so submitting the form without touching every field failed validation entirely. - bulk-update and quick-assign routes were missing adminMutationLimiter and audit-context threading (actorUsername/actorRole/sessionHash), unlike every other admin mutation route. Also reworked dateHelpers.calculateTicketAge to return a translation unit + count + semantic color token instead of hardcoded English text and Bootstrap classes, since main uses Tailwind + i18n, not Bootstrap. Added unit tests for it (5 tests, 1004 -> 1009 passing) since its return contract changed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011tWtJbqWmefyKJUjXcEmfo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
feature/dashboard-enhancements(stale since Jan 2026): admin dashboard gains pagination, ticket-age badges, a bulk status/priority/assignment update form, and per-row quick-assignmain, resolving conflicts inapp.js,routes/admin.js,validators/ticketValidators.js, and a full rewrite ofviews/admin/dashboard.ejs(the branch's markup was Bootstrap 5 + hardcoded English + inline<script>; rebuilt againstmain's current Tailwind design system, i18n (t()keys added to bothlocales/en/tickets.jsonandlocales/el/tickets.json), existing badge partials, and an external CSP-safe JS file rather than inline handlers — main's Helmet CSP has no'unsafe-inline'for scripts)010_add_dashboard_indexes.sqlcollided with an unrelated migration already at that number onmain) to029_add_dashboard_indexes.sqlBugs found and fixed while rebasing
value=""; the route treated any non-undefinedassigned_toas an explicit unassign. Introduced a distinct__unassign__sentinel so "no change" ("") and "unassign" are no longer the same value.validateBulkUpdate/validateQuickAssignused bare.optional(), which only skipsundefined, not the empty string every unchanged<select>sends. Switched to.optional({ checkFalsy: true }).adminMutationLimiterand audit-context threading (actorUsername/actorRole/sessionHash), unlike every other admin mutation route — added both.dateHelpers.calculateTicketAgeto return{ unit, count, color }(a translation key + semantic badge color) instead of hardcoded English text and Bootstrap classes, sincemainuses Tailwind + i18n. Added unit tests since the contract changed.Test plan
docker-compose exec web npm test— 1009/1009 passing (was 1004; +5 newdateHelperstests)docker-compose exec web npm run lint/npx prettier --check— clean on all touched files/admin/dashboard(renders correctly, all badges/i18n/forms present), and exercisedquick-assignandbulk-updateend-to-end via curl — confirmed assignment sentinel fix (priority-only bulk update no longer wipes assignment), unassign works both ways, and audit log rows are created correctly for both endpoints🤖 Generated with Claude Code
https://claude.ai/code/session_011tWtJbqWmefyKJUjXcEmfo