Skip to content

feat(site): add connection log page #18708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2025
Merged

Conversation

ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Jul 2, 2025

This is the fourth PR for moving connection events out of the audit log.

This PR adds /connectionlog to the frontend. This page is identical in structure to the audit log, but with different filters and contents.

The connection log lists sessions, and the time they start. If we support tracking the end time of a session, and we've received a disconnect event for that session, the end timestamp is also included.

Demo:

connectionlogdemo2.mov
image image

Since the styling is identical to that of the audit log, I've continued to use MUI table components. When the audit log is migrated off MUI/restyled, this table can be too, relatively easily.

Future PRs:

  • Write a query to delete old events from the audit log, call it from dbpurge.
  • Write documentation for the endpoint / feature


return (
<Filter
// TODO(ethanndickson): Add docs
Copy link
Member Author

@ethanndickson ethanndickson Jul 2, 2025

Choose a reason for hiding this comment

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

Will be done in this PR stack.

@ethanndickson ethanndickson force-pushed the ethan/fe-connection-log branch from f9333f1 to 5de8705 Compare July 2, 2025 05:56
@ethanndickson ethanndickson requested a review from Copilot July 2, 2025 06:06
Copilot

This comment was marked as outdated.

@ethanndickson ethanndickson force-pushed the ethan/fe-connection-log branch 3 times, most recently from 3accbf8 to 7de824c Compare July 2, 2025 06:46
@ethanndickson ethanndickson marked this pull request as ready for review July 2, 2025 07:07
@ethanndickson ethanndickson marked this pull request as draft July 2, 2025 07:07
@ethanndickson
Copy link
Member Author

This is ready for review, but marked as a draft so it's not merged early.

@ethanndickson ethanndickson force-pushed the ethan/fe-connection-log branch from 7de824c to 20092f6 Compare July 2, 2025 08:24
@ethanndickson ethanndickson force-pushed the ethan/populate-connection-log-count branch from 33d8acb to 1e3334b Compare July 2, 2025 09:31
@ethanndickson ethanndickson force-pushed the ethan/fe-connection-log branch from 20092f6 to 57acd96 Compare July 2, 2025 09:31
@ethanndickson ethanndickson force-pushed the ethan/populate-connection-log-count branch from 1e3334b to 332f8da Compare July 2, 2025 09:46
@ethanndickson ethanndickson force-pushed the ethan/fe-connection-log branch from 57acd96 to 24dee7a Compare July 2, 2025 09:46
@ethanndickson ethanndickson force-pushed the ethan/populate-connection-log-count branch from 6cd9d68 to 6fa4d22 Compare July 10, 2025 05:58
@ethanndickson ethanndickson force-pushed the ethan/fe-connection-log branch from 9239251 to 7f2dccd Compare July 10, 2025 05:58
@ethanndickson ethanndickson force-pushed the ethan/populate-connection-log-count branch from 6fa4d22 to 769b7a5 Compare July 10, 2025 10:28
@ethanndickson ethanndickson force-pushed the ethan/fe-connection-log branch 2 times, most recently from d6ec519 to 15aac3f Compare July 10, 2025 10:37
@ethanndickson ethanndickson force-pushed the ethan/populate-connection-log-count branch from 769b7a5 to fc195c3 Compare July 10, 2025 10:50
@ethanndickson ethanndickson force-pushed the ethan/fe-connection-log branch from 15aac3f to c505c02 Compare July 10, 2025 10:50
@ethanndickson ethanndickson requested a review from Copilot July 10, 2025 10:51
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new Connection Log page in the frontend, mirroring the existing audit log structure but showing connection sessions, start/end times, and status codes.

  • Added utilities and API endpoints for fetching and color-coding connection logs.
  • Created ConnectionLogPage and related components (row, description, filter, help tooltip) plus stories and tests.
  • Updated router, permissions, and navigation (Navbar, MobileMenu, DeploymentDropdown) to include the new page.

Reviewed Changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
site/src/utils/http.ts Added httpStatusColor helper for status code color mapping
site/src/utils/connection.ts Added connectionTypeToFriendlyName and connectionTypeIsWeb
site/src/api/queries/connectionlog.ts & api/api.ts New paginatedConnectionLogs query and API.getConnectionLogs
site/src/testHelpers/entities.ts New mocks for connection log entitlements and entries
site/src/router.tsx Registered /connectionlog route
site/src/pages/ConnectionLogPage/**/* New page components, stories, filter, tooltip & tests
site/src/modules/permissions/index.ts Added viewAnyConnectionLog permission
site/src/modules/dashboard/Navbar/**/* Updated navigation to show Connection Log links
site/src/components/StatusPill/StatusPill.tsx Enhanced StatusPill to handle HTTP/SSH codes
site/src/components/Filter/UserFilter.tsx Added placeholder prop to UserMenu
site/src/pages/AuditPage/**/* Refactored to reuse new StatusPill for HTTP codes
Comments suppressed due to low confidence (2)

site/src/pages/ConnectionLogPage/ConnectionLogPage.tsx:28

  • [nitpick] The variable name connectionlogsQuery is lower-camel but the second word isn’t capitalized (connectionLogsQuery). Renaming for consistent camelCase improves readability.
	const connectionlogsQuery = usePaginatedQuery(

site/src/pages/ConnectionLogPage/ConnectionLogRow/ConnectionLogDescription/ConnectionLogDescription.tsx:1

  • There are no unit tests covering ConnectionLogDescription. Adding tests for each connection type and various status_code paths (e.g., redirect, error, unauthenticated) would ensure correct rendering logic.
import Link from "@mui/material/Link";

@ethanndickson ethanndickson force-pushed the ethan/populate-connection-log-count branch from fc195c3 to df2d839 Compare July 14, 2025 02:04
@ethanndickson ethanndickson force-pushed the ethan/fe-connection-log branch from c505c02 to 9238f25 Compare July 14, 2025 02:04
@ethanndickson ethanndickson force-pushed the ethan/populate-connection-log-count branch from df2d839 to 78cc56b Compare July 14, 2025 06:13
@ethanndickson ethanndickson force-pushed the ethan/fe-connection-log branch from 9238f25 to 823dc41 Compare July 14, 2025 06:13
@ethanndickson ethanndickson force-pushed the ethan/populate-connection-log-count branch from 78cc56b to e61fc41 Compare July 15, 2025 03:33
@ethanndickson ethanndickson force-pushed the ethan/fe-connection-log branch from 823dc41 to e364d00 Compare July 15, 2025 03:33
@ethanndickson ethanndickson force-pushed the ethan/populate-connection-log-count branch from e61fc41 to 4055dd7 Compare July 15, 2025 04:00
@ethanndickson ethanndickson force-pushed the ethan/fe-connection-log branch from e364d00 to cf9592b Compare July 15, 2025 04:00
Copy link
Member Author

ethanndickson commented Jul 15, 2025

Merge activity

  • Jul 15, 4:35 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 15, 4:45 AM UTC: Graphite couldn't merge this pull request because a downstack PR feat: add connectionlogs API #18628 failed to merge.
  • Jul 15, 4:55 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 15, 5:05 AM UTC: Graphite rebased this pull request as part of a merge.
  • Jul 15, 5:11 AM UTC: @ethanndickson merged this pull request with Graphite.

@ethanndickson ethanndickson changed the base branch from ethan/populate-connection-log-count to graphite-base/18708 July 15, 2025 04:56
@ethanndickson ethanndickson changed the base branch from graphite-base/18708 to main July 15, 2025 05:03
@ethanndickson ethanndickson force-pushed the ethan/fe-connection-log branch from cf9592b to 397ecab Compare July 15, 2025 05:04
@ethanndickson ethanndickson merged commit b5260d5 into main Jul 15, 2025
30 of 32 checks passed
@ethanndickson ethanndickson deleted the ethan/fe-connection-log branch July 15, 2025 05:11
@github-actions github-actions bot locked and limited conversation to collaborators Jul 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants