Skip to content

Develop#33

Merged
x42en merged 7 commits into
mainfrom
develop
May 17, 2026
Merged

Develop#33
x42en merged 7 commits into
mainfrom
develop

Conversation

@x42en

@x42en x42en commented May 17, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces new functionality for tracking and displaying user login activity, as well as improvements to session and application data handling. The most significant changes include the introduction of a new login_history table in the database, new API endpoints and types for fetching login and activity statistics, and a new UI component for displaying application icons associated with users. Additionally, the sessions API now supports searching, and user and application data structures have been updated to include relevant login information.

Database and Backend Enhancements:

  • Added a new login_history table to track user logins, including fields for user_id, application_id, session_id, timestamp, IP address, and user agent. Also added a last_login_at column to the user table, and created indexes and a foreign key for efficient queries.
  • Updated the migration journal to include the new schema changes for login history.

API Additions and Improvements:

  • Added new API functions and types in frontend/src/api/stats.ts for retrieving active user counts, login series data, and application activity statistics, supporting both real and mock data.
  • Added getUserLoginHistory function to frontend/src/api/applications.ts to fetch paginated login history for a specific user and application.
  • Enhanced the listSessions API in frontend/src/api/sessions.ts to support searching sessions by user name, email, or IP address.

Frontend/UI Components:

  • Introduced a new AppIconStack.vue component to display application icons associated with a user, with support for popover display and overflow handling.

Data Structure Updates:

  • Updated user application summaries in the user API to include lastLoginAt and subscriptionPlanName fields for richer user detail responses.
  • Updated application API type imports to include LoginHistoryResponse.

x42en added 7 commits May 17, 2026 01:31
Introduces a new `login_history` table to track successful OAuth token
issuances, enabling detailed user activity monitoring and application
usage analytics.

Key changes:
- Added `login_history` table to track user, application, session,
  IP, and user agent for every login event.
- Implemented `recordLogin` service to capture login events during
  the OAuth flow.
- Denormalized `last_login_at` on the `user` table for efficient
  "last seen" lookups in admin listings.
- Added new admin API endpoints for retrieving application activity
  statistics, login series data, and paginated user login history.
- Enhanced frontend with new UI components: `Sparkline` for activity
  trends, `AppIconStack` for application visualization, and a
  refactored `DataTable` with improved sorting and density controls.
- Updated admin views (Dashboard, Applications, Users, Sessions) to
  display real-time activity, login history, and enriched user/session
  metadata.
…apping

Update the `/active-users` endpoint to return a `count` property instead of `online` to align with standard naming conventions. Refactor the application statistics response to map sparkline data points to a simple array of numbers, improving the API's data structure for client-side consumption.
Convert Date objects to ISO strings and cast to timestamptz in SQL queries to ensure consistent date handling and prevent potential type mismatches during database execution.
Add support for displaying the most recent IP address and user agent
information in the Application Detail and Dashboard views. This includes
updating i18n translations, extending TypeScript interfaces, and
refactoring the admin API to fetch and return login metadata using
`selectDistinctOn`.
…tory

Implement a `databaseHooks` listener on session creation to automatically
populate the login history table. This ensures that all direct session
creations (including admin logins and social provider callbacks) are
captured with their associated IP address and user agent.

The hook is designed to be non-blocking and "fire-and-forget" to ensure
that any failures in recording the history do not prevent the user from
successfully creating a session.
Implement advanced features for the `DataTable` component, including
built-in search functionality, server-driven pagination, and improved
responsive column handling.

- Add `searchable` and `pagination` props to `DataTable` component.
- Implement debounced search in `DashboardView` to optimize API calls.
- Update `sessions` and `users` admin routes to support filtering and
  searching via database queries.
- Refactor responsive column logic to use explicit Tailwind classes,
  ensuring compatibility with JIT compilation.
- Add internationalization support for new table controls.
- Update user and session APIs to return enriched data including
  `lastLoginAt` and application details.
Refactor the `AppIconStack` component to use a Teleport-based popover
with manual positioning and global event listeners to prevent overflow
and clipping issues. Enhance `DataTable` by adding a `clickableRows`
prop for better user interaction.

- Implement `Teleport` and `fixed` positioning for `AppIconStack`
  popovers.
- Add `clickableRows` prop to `DataTable` to toggle `cursor-pointer`.
- Update user administration to display human-readable subscription
  plan names instead of UUIDs.
- Add left-join to `subscriptionPlans` in the user routes API to
  enrich application data.
- Update `UserDetailView` and `UsersView` to utilize new plan name
  fields and row click navigation.
@x42en x42en self-assigned this May 17, 2026
@x42en x42en added bug Something isn't working enhancement New feature or request labels May 17, 2026
@x42en x42en merged commit 3a811dd into main May 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant