-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
This ticket focuses on creating a central hub for users to view and manage their activity. A new "Dashboard" or "Scan History" page will be created to list all past and currently running scans initiated by the logged-in user. This provides essential visibility into their work and easy access to completed reports.
Implementation Tips
- Django View: Create a new class-based view, likely a ListView, in scans/views.py. This view will fetch all ScanJob objects from the database that are associated with the currently logged-in user (request.user).
- QuerySet: The core logic will be ScanJob.objects.filter(user=request.user).order_by('-created_at'). This retrieves all jobs for that user and orders them with the most recent first.
- Template: Create a new template (scan_history.html) to render the list of jobs. Use a standard HTML to display the information in a clean, organized way.
- Status Indicators: In the template, use conditional formatting to display the status of each job clearly. For example, you could use colored badges: a blue badge for "In Progress," a green one for "Completed," and a red one for "Failed."
- Links to Results: Each row in the table for a "Completed" scan should include a link that directs the user to the detailed results page for that specific scan.
- A new page is accessible from the main navigation (e.g., "My Scans").
- The page lists all scans initiated by the currently logged-in user.
- The list displays key information for each scan (Company Name, Date, Status).
- The status for each scan is clearly visible and easy to understand.
- Completed scans provide a direct link to their detailed report page.
- If a user has no scans, a friendly message is displayed.
- Write a test to ensure an unauthenticated user is redirected to the login page.
- Write a test for a logged-in user. Create several mock ScanJob objects for this user. Make a GET request to the history page and assert that the response contains the company names of the created jobs.
- Write a test to ensure a user can only see their own scans and not scans initiated by other users.
Acceptance Criteria (Checklist)
Unit Tests
View Tests:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels