Page MenuHomeDevCentral

Add incident history page with date filter
ClosedPublic

Authored by Chenani-MohamedAmine on Thu, Feb 26, 14:38.
Tags
None
Referenced Files
F24684506: D3980.id10326.diff
Thu, Mar 5, 04:36
F24684371: D3980.id10326.diff
Thu, Mar 5, 04:22
F24672773: D3980.id10328.diff
Wed, Mar 4, 12:04
Unknown Object (File)
Wed, Mar 4, 04:47
Unknown Object (File)
Wed, Mar 4, 03:07
Unknown Object (File)
Tue, Mar 3, 13:32
Unknown Object (File)
Tue, Mar 3, 12:48
Unknown Object (File)
Tue, Mar 3, 02:56
Subscribers

Details

Summary

StatusPage.vue only shows the 5 most recent resolved incidents.
This adds a dedicated /incidents route with an IncidentHistory view
that lists all past incidents with a date range filter
(last 7 days / 30 days / 90 days / all).

Reuses the existing useIncidents composable and IncidentTimeline
component for consistency with StatusPage.

Test Plan
  1. Visit /incidents — page renders with title, filter buttons, and empty state message when no incidents exist
  2. Create an incident via admin dashboard
  3. Verify incident appears on /incidents under "Last 7 Days" and "All" filters
  4. Verify "Last 30 Days" and "Last 90 Days" filters work
  5. Click "Back to status" — navigates to /
  6. Verify the same incident renders on StatusPage under Active Incidents using the same IncidentTimeline component

Diff Detail

Repository
rSP ServPulse
Lint
Lint Passed
Unit
No Test Coverage
Branch
feature/T2253-incident-history
Build Status
Buildable 6385
Build 6669: arc lint + arc unit

Event Timeline

Chenani-MohamedAmine created this revision.
ieli requested changes to this revision.Fri, Feb 27, 05:05
ieli added inline comments.
frontend/src/router/index.js
39–54

Entire file indentation issue...

⚠️ The project uses 2-space indentation, but this change introduces 4-space indentation, similar to previous task.

46–50

❌ Missing tests: Please add a test file (e.g., frontend/src/router/__tests__/router.test.js) to verify:

  • Route /incidents resolves to the correct component
  • Navigation works correctly
  • ...

See existing test patterns in frontend/src/components/__tests__/ for reference.

This revision now requires changes to proceed.Fri, Feb 27, 05:05
  • Reverted to 2-space indentation to match project style
  • Added router tests in frontend/src/components/__tests__/router.test.js

"Past Incidents" section in StatusPage.vue shows 5 most recent. Add a "View all" link to /incidents when incidents are more than 5.

frontend/src/views/IncidentHistory.vue
56

Uses incident.created_at for filtering, but IncidentTimeline.vue (line 25) displays incident.start_date. Change to start_date for consistency.

frontend/src/components/__tests__/router.test.js
9–19

The routes use mock components ({ template: '<div>Incident History</div>' }). This tests routing works but not the actual IncidentHistory.vue component behavior. Add a new test file IncidentHistory.test.js that tests: filter buttons, empty state, loading state, and date filtering logic.

ieli requested changes to this revision.Sat, Feb 28, 05:16
This revision now requires changes to proceed.Sat, Feb 28, 05:16
  • Added component tests (IncidentHistory.test.js)
  • Updated docs/architecture.md with IncidentHistory.vue in diagram
In D3980#61784, @ieli wrote:

"Past Incidents" section in StatusPage.vue shows 5 most recent. Add a "View all" link to /incidents when incidents are more than 5.

⚠️ Add a "View all" link to /incidents WHEN there are more than 5 resolved incidents.

frontend/src/components/__tests__/IncidentHistory.test.js
25

Mock uses created_at but component filters on start_date. Tests pass because broken filtering returns empty array, matching the "empty state" test expectation. Change created_at to start_date.

I just noticed that IncidentHistory.test.js tests a view but is in components/__tests__/.
Move the file to views/__tests__/ for consistency.

frontend/src/views/IncidentHistory.vue
24

Log the error instead of silently swallowing it.

ieli requested changes to this revision.Tue, Mar 3, 07:00
This revision now requires changes to proceed.Tue, Mar 3, 07:00
  • Added "View all" link in StatusPage when resolved incidents > 5
  • Changed created_at to start_date in test mock data
  • Moved IncidentHistory.test.js to views/__tests__/
  • Added error logging in getById catch handler

Good job!

Next would be T2250. A strange behavior when loading another page got introduced at some point that I'd like to explore through T2250.

This revision is now accepted and ready to land.Tue, Mar 3, 15:19