Skip to content

Add audit logging integration for UI flag operations#2

Merged
rishabhrao merged 11 commits intomasterfrom
feat/audit-logging
Feb 18, 2026
Merged

Add audit logging integration for UI flag operations#2
rishabhrao merged 11 commits intomasterfrom
feat/audit-logging

Conversation

@rishabhrao
Copy link
Member

Summary

  • Extracts user_id from configurable HTTP request header on all mutating routes
  • Passes audit: [user_id: ...] to all FunWithFlags.enable/disable/clear calls
  • Passes user_id: to export_flags and import_flags
  • Updates Utils.create_flag_with_name to accept and forward audit opts

Depends on: invideoio/fun_with_flags#feat/audit-logging

Files changed

  • lib/fun_with_flags/ui/router.exaudit_opts/1 helper, all route handlers updated
  • lib/fun_with_flags/ui/utils.excreate_flag_with_name/2 accepts opts
  • README.md — audit logging section added

Test plan

  • Send requests to the dashboard with X-User-Id header and verify audit logs contain the user_id
  • Verify flag operations without the header still work (user_id is nil)
  • Run existing UI test suite (mix test)

Extract user_id from configurable HTTP header and pass audit context
to all FunWithFlags API calls. Works with the new audit logging feature
in fun_with_flags core.

Key changes:
- Add audit_opts/1 helper that reads user_id from request header
- All route handlers now pass audit opts to enable/disable/clear calls
- Export and import pass user_id to FunWithFlags API
- Utils.create_flag_with_name accepts optional opts for audit context
- README updated with audit logging section
This commit introduces a new audit logs page that displays audit log entries for flag operations. Key changes include:

- New `AuditLogFormatter` module for formatting audit log records.
- Updated router to handle the `/audit_logs` route and fetch relevant audit entries.
- New templates for displaying audit logs, including pagination and search functionality.
- Integration of audit log links in the navigation across various pages.

Additionally, JavaScript functionality is added to convert UTC timestamps to local time in the audit log table.
This commit introduces a theme selection option in the settings page, allowing users to choose between light, dark, and system color schemes. Key changes include:

- New theme selection dropdown in the settings template.
- JavaScript functionality to apply the selected theme immediately and save preferences in local storage.
- CSS styles for dark theme to ensure proper styling across various UI components.

Additionally, the theme is applied on page load to prevent a flash of the default theme.
This commit adds a new option to hide the flag column in the audit log table based on the `hide_flag_column` assign. Key changes include:

- Updated the router to pass the `hide_flag_column` flag.
- Modified the audit log template to conditionally render the flag column based on the new assign.

This improves the flexibility of the audit log display, allowing for a cleaner view when flag information is not needed.
This commit improves the display of UTC timestamps in the audit logs by implementing a custom formatting function. Key changes include:

- Replaced the default locale string conversion with a more detailed format that includes the day, month, year, and time in a 12-hour format with AM/PM indication.
- Introduced an array for month names and a padding function for single-digit minutes and seconds.

This enhancement provides a clearer and more user-friendly representation of timestamps in the audit log table.
@rishabhrao rishabhrao merged commit 3eee739 into master Feb 18, 2026
8 checks passed
@rishabhrao rishabhrao deleted the feat/audit-logging branch February 18, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants