Commit graph

71 commits

Author SHA1 Message Date
8752dfec49 fix: netbox url field type, gaiia ipRange→block, remove unknown webhook log 2026-02-14 17:44:01 -06:00
243b773e39 i18n: wrap all user-facing strings in gettext() 2026-02-14 17:44:01 -06:00
e68ebdb62d
fix: sync AgentLive.Index modal state to URL for browser navigation
Update AgentLive.Index to properly handle browser back/forward buttons
by syncing the setup token modal to URL parameters.

Changes:
- Update handle_params/3 to read modal param and set modal state
- Update show_setup handler to use push_patch with ?modal=setup
- Update close_token_modal handler to use push_patch (remove modal param)
- Update handle_agent_creation_success to use push_patch after creating agent

Behavior:
- Browser back button now closes the setup modal without navigating away
- URL reflects current modal state (?modal=setup)
- Bookmarkable URLs restore exact modal state (can share agent setup URL)
- After creating agent, modal opens via URL state

Follows idiomatic Phoenix LiveView pattern using push_patch/2 and
handle_params/3 as documented in CLAUDE.md.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-12 09:28:39 -06:00
c5d8d73a0c
add row_link to table component for proper anchor tags
Replace phx-click JS.navigate with real <.link navigate> elements
on table rows so users can Ctrl+Click to open in new tabs, use
right-click context menus, and navigate via keyboard. Adds row_link
attr to <.table> core component and applies it to all agent tables.
Converts device list custom table from phx-click to inner links.
2026-02-11 08:46:03 -06:00
fbce65070a
Add agent restart and self-update commands
Add server-initiated restart and self-update capabilities for remote
agents. Restart broadcasts on the lifecycle PubSub topic causing the
agent to exit cleanly for Docker to restart. Self-update fetches the
latest release from GitHub, finds the matching binary for the agent's
architecture, and sends the download URL with SHA256 checksum.

- Add restart_agent/1 and update_agent/3 to Agents context
- Handle :restart_requested and :update_requested in AgentChannel
- Add superuser-only Restart and Update buttons on agent show page
- Add ReleaseChecker module for GitHub Releases API with 5-min cache
- Add arch field to AgentHeartbeat protobuf for architecture detection
- Store arch in agent metadata from heartbeat
2026-02-10 13:06:10 -06:00
c066399e18
Allow superadmins to view and edit any agent regardless of org
The admin agents page links to /agents/:id but the show and edit
pages were scoped to the current user's organization, causing 404s
for agents belonging to other orgs.
2026-02-10 12:19:20 -06:00
5c59777baa
Live-ticking relative timestamps on agents page 2026-02-10 10:24:21 -06:00
481fc6d4a2
Add absolute format to timestamp component to fix render flash 2026-02-10 10:19:54 -06:00
d1cd567cd5
Show full timestamp below relative time in Last Seen column 2026-02-10 10:07:44 -06:00
e9afac3e9d
Show full timestamp below relative time on Last Seen card 2026-02-10 09:55:34 -06:00
07a9366892
clean up agent view 2026-02-10 09:48:09 -06:00
ba56dee1ca
remove date helper 2026-02-10 09:15:41 -06:00
fce1a8b229
Show full version timestamp with friendly date on agents page 2026-02-10 09:04:56 -06:00
94405f0716
fix agents updates 2026-02-10 08:08:34 -06:00
144e04b998
change metadata version to version 2026-02-09 17:39:33 -06:00
41594e5a96
fix bugs on agents screen 2026-02-09 14:03:40 -06:00
ae9b393137
Fix agent page jumping by using streams for real-time updates
- Convert agent_tokens from assign to stream to prevent full page re-renders
- Update handle_info callbacks to only update the specific agent that changed
- Only update stats when agent status changes, not device counts
- Prevents IP address from temporarily disappearing during updates
2026-02-09 13:39:59 -06:00
f7b5e63429
live update agent status 2026-02-09 12:58:54 -06:00
623fe07081
wip 2026-02-09 12:44:37 -06:00
6f6627a54d
refactor: consolidate device count calculations in agent_live
Remove duplicate device counting logic by consolidating three identical
implementations into a single reusable function.

**Changes:**
- Refactor agent_live/index.ex mount/3 to use calculate_device_counts/1
- Delete duplicate calculate_cloud_poller_counts/1 function
- Replace all usages with calculate_device_counts/1

**Before:**
- Lines 31-47: Inline counting for agent_tokens and cloud_pollers
- Lines 312-318: calculate_device_counts/1
- Lines 320-326: calculate_cloud_poller_counts/1 (identical logic)

**After:**
- Single calculate_device_counts/1 function used everywhere
- ~20 lines removed

**Benefits:**
- Eliminates triple duplication of counting logic
- Single source of truth for device counting
- Easier to maintain and test

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-04 17:53:18 -06:00
ecf6edaf85
update docker compose instructions 2026-02-03 13:00:51 -06:00
9a60bfec58
feat: migrate user settings and agent management to gettext
Migrates all remaining user settings and agent management flash messages to gettext:

User Settings:
- session_manager.ex: mobile device removal, alert preferences, browser session revocation, revoke all sessions
- totp_manager.ex: device creation, verification, deletion, recovery code generation
- api_token_manager.ex: token creation, deletion, validation errors
- user_auth.ex: policy consent acceptance message

Agent Management:
- agent_live/edit.ex: agent update success
- agent_live/index.ex: agent/cloud poller creation, token regeneration, agent deletion, global default settings

All flash messages now use domain-specific helpers (t_auth, t_equipment) for proper internationalization.

Tests passing: 4165 tests, 0 failures
2026-02-02 13:20:54 -06:00
3633ff1626
more gettext 2026-02-02 13:10:08 -06:00
b241d9df91
show cloud poller device count 2026-02-01 13:41:01 -06:00
b30f2cf5af
filter more honeybadger alerts, format dates to users time zone, email template cleanup 2026-02-01 09:27:42 -06:00
6ca22c5dd0 enhance user auditing 2026-01-30 17:38:07 -06:00
5256929186 simplify docker compose template 2026-01-30 17:19:55 -06:00
8e739283ad refactoring 2026-01-29 10:03:43 -06:00
3bb89670bd
enable agent debugging 2026-01-27 13:25:04 -06:00
19a818647b
documentation updates 2026-01-26 16:36:52 -06:00
756a6b4cd4
poller agent fix and trigger device rediscovery 2026-01-26 14:51:32 -06:00
74f2970664
ui tweaks 2026-01-26 13:34:52 -06:00
902d21eeee
poller detail screen fix 2026-01-26 12:46:14 -06:00
5f1bbab420
cloud poller fixes 2026-01-26 11:57:32 -06:00
c41b479ed8
more tests 2026-01-26 11:01:47 -06:00
21802eede4
adjust timestamps to be relative 2026-01-25 14:52:13 -06:00
277d3be2bd
remove agent version display 2026-01-25 12:22:47 -06:00
6516f509e9
cleanup: remove debug logging from agent creation (again)
The user had manually added debug logging in commit 66fd6fa.
Now that the cloud poller checkbox issue is fixed, removing the debug output.
2026-01-25 09:10:47 -06:00
97cdb8e46c
fix: handle cloud pollers in agent show page and fix NoResultsError
Two issues fixed:
1. Cloud pollers (organization_id = nil) were causing access denied errors
   when superadmins tried to view them. Now allows access if user is
   superadmin and agent is a cloud poller.

2. Ecto.NoResultsError was being raised without required :queryable option,
   causing KeyError crash. Now properly raises with queryable parameter.

Error was:
  KeyError: key :queryable not found in []
  (ecto 3.13.5) lib/ecto/exceptions.ex:203: Ecto.NoResultsError.exception/1
  (towerops) lib/towerops_web/live/agent_live/show.ex:16: mount/3
2026-01-25 09:09:50 -06:00
66fd6fa3b6
cloud poller id 2026-01-25 08:52:35 -06:00
1d638c0c83
cleanup: remove debug logging from agent creation
The checkbox issue has been fixed, no longer need the debug output.
2026-01-25 08:39:35 -06:00
e27cc5495a
fix: handle checkbox 'on' value for cloud poller creation
HTML checkboxes send value='on' when checked, not 'true'. Updated
parse_agent_params to accept both 'on' and 'true' values for the
is_cloud_poller field.

Added debug logging to help diagnose future form submission issues.
2026-01-25 08:22:31 -06:00
67614cb93f
improve cloud poller display 2026-01-24 13:33:01 -06:00
e6054129b2
remote agent/cloud improvements 2026-01-24 09:16:41 -06:00
f084e09ea1
add multiple cloud agents 2026-01-23 18:04:01 -06:00
c54b5d81bb
more dark mode 2026-01-20 17:23:11 -06:00
2324b75e47
fix device identification 2026-01-18 13:35:33 -06:00
9c2f08317f
feat: remove organization slug from sites and devices URLs
- Created new on_mount hook :load_default_organization that automatically loads user's first organization
- Moved sites and devices routes to root path (/ sites, /devices) instead of /orgs/:org_slug
- Updated all navigation links and route references throughout the app
- Dashboard, alerts, and agents still use org-specific routes (/orgs/:org_slug)
- Users can still switch organizations via org selector for other pages
2026-01-18 13:06:23 -06:00
16bfd7667d
fix: pass timezone attribute to all layout components 2026-01-18 12:49:01 -06:00
442a79baa7
fix: use proper function head for default values with multiple clauses 2026-01-18 12:41:39 -06:00