Skip to content

[management] Add dashboard_features account setting#6742

Merged
mlsmaycon merged 2 commits into
mainfrom
feature/dashboard-features-setting
Jul 12, 2026
Merged

[management] Add dashboard_features account setting#6742
mlsmaycon merged 2 commits into
mainfrom
feature/dashboard-features-setting

Conversation

@mlsmaycon

@mlsmaycon mlsmaycon commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Describe your changes

Adds a per-account dashboard_features setting: a nullable object that overrides
which dashboard sections are shown for an account. It serializes to a single
JSON column so new sections can be added later as struct fields with no schema
change and no new pgx loader plumbing.

This is the backend for making the Agent Network menu available to existing
accounts (reusing the netbird.ai signup flow), and the general mechanism the
dashboard will use to control other sections (DNS, Reverse Proxy, Networks)
per account later. It starts with a single key, agent_network — when true the
Agent Network menu is shown for the account even without the deployment feature
flag. agent_network_only (the focused-view mode) stays a separate flag.

  • types.Settings.DashboardFeatures *DashboardFeatures (+ Copy)
  • dashboard_features / AccountDashboardFeatures in the OpenAPI spec,
    types.gen.go regenerated
  • request/response mapping in the accounts handler (PUT/GET /accounts)
  • pgx GetAccount loader updated to select, scan, and unmarshal the JSON
    column — without it the field silently reads empty in production
  • store round-trip test (set → persist → explicit false → persist) and a
    handler case setting dashboard_features.agent_network

Absent keys follow the default dashboard behavior, so the change is additive and
backward-compatible.

Issue ticket number and link

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • This change does not modify the public API, gRPC protocols, functionality behavior, CLI / service flags, or introduce a new feature — OR I have discussed it with the NetBird team beforehand (link the issue / Slack thread in the description). See CONTRIBUTING.md.

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Additive account-setting plumbing surfaced only through the dashboard; the raw
API field is generated into the API reference automatically.

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • New Features
    • Added per-account dashboard feature overrides.
    • Introduced an agent_network toggle to control Agent Network menu visibility per account.
    • Updated account settings APIs (and schema) to accept and return dashboard_features.
  • Bug Fixes
    • Ensured dashboard_features are correctly loaded from and saved to persistence.
    • Account settings responses now include the dashboard feature override values.
  • Tests
    • Added coverage for updating and persisting dashboard feature overrides.

…isibility

Introduce a nullable dashboard_features object on account settings, serialized
to a single JSON column so new dashboard sections can be added without schema
changes. Starts with agent_network (show the Agent Network menu for an account
without the deployment flag). Wires the API handler mapping, the pgx GetAccount
loader, and adds store round-trip and handler tests.
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8df83314-a127-4c55-83d5-d21525a3f228

📥 Commits

Reviewing files that changed from the base of the PR and between 8639e99 and 1e1d20b.

📒 Files selected for processing (2)
  • shared/management/http/api/openapi.yml
  • shared/management/http/api/types.gen.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • shared/management/http/api/types.gen.go
  • shared/management/http/api/openapi.yml

📝 Walkthrough

Walkthrough

Adds per-account dashboard feature overrides for Agent Network. The setting is defined in internal and generated API types, persisted in PostgreSQL, mapped through account HTTP requests and responses, and covered by handler and SQL store tests.

Changes

Dashboard feature overrides

Layer / File(s) Summary
Dashboard feature settings contracts
management/server/types/settings.go, shared/management/http/api/openapi.yml, shared/management/http/api/types.gen.go
Adds optional DashboardFeatures.AgentNetwork settings, JSON serialization, deep-copy support, and corresponding OpenAPI and generated API models.
Dashboard feature persistence
management/server/store/sql_store.go, management/server/store/sql_store_test.go
Loads settings_dashboard_features from PostgreSQL and verifies persistence of unset, true, and explicit false values.
Account API request and response mapping
management/server/http/handlers/accounts/accounts_handler.go, management/server/http/handlers/accounts/accounts_handler_test.go
Maps dashboard_features.agent_network in account updates and responses, with an HTTP handler test for the enabled setting.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: bison, braginini

Sequence Diagram(s)

sequenceDiagram
  participant AccountClient
  participant AccountsHandler
  participant SQLStore
  participant PostgreSQL
  AccountClient->>AccountsHandler: Update account with dashboard_features
  AccountsHandler->>SQLStore: Save account settings
  SQLStore->>PostgreSQL: Persist settings_dashboard_features
  PostgreSQL-->>SQLStore: Return saved account
  SQLStore-->>AccountsHandler: Load DashboardFeatures
  AccountsHandler-->>AccountClient: Return dashboard_features
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the addition of the dashboard_features account setting.
Description check ✅ Passed The description covers the change, tests, API impact, and documentation choice, with only a placeholder issue link and empty stack section.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/dashboard-features-setting

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
shared/management/http/api/openapi.yml (1)

416-418: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

OpenAPI description for agent_network omits the false behavior.

The Go type comment says the field "forces that section shown (true) or hidden (false) regardless of the deployment feature flag," but the OpenAPI description only covers the true case. Consider documenting both directions for API consumers.

📝 Suggested description update
         agent_network:
-          description: When true, the Agent Network menu is shown for the account even without the deployment feature flag.
+          description: When true, the Agent Network menu is shown for the account even without the deployment feature flag. When false, the menu is hidden regardless of the deployment feature flag. When omitted, the default behavior applies.
           type: boolean
           example: true
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@shared/management/http/api/openapi.yml` around lines 416 - 418, Update the
OpenAPI description for the agent_network property to document both behaviors:
true forces the Agent Network menu to be shown, while false forces it to be
hidden, regardless of the deployment feature flag.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@shared/management/http/api/openapi.yml`:
- Around line 416-418: Update the OpenAPI description for the agent_network
property to document both behaviors: true forces the Agent Network menu to be
shown, while false forces it to be hidden, regardless of the deployment feature
flag.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4fba649a-7bd8-4ac6-8a16-fcae056cfd32

📥 Commits

Reviewing files that changed from the base of the PR and between aa92ad3 and 8639e99.

📒 Files selected for processing (7)
  • management/server/http/handlers/accounts/accounts_handler.go
  • management/server/http/handlers/accounts/accounts_handler_test.go
  • management/server/store/sql_store.go
  • management/server/store/sql_store_test.go
  • management/server/types/settings.go
  • shared/management/http/api/openapi.yml
  • shared/management/http/api/types.gen.go

@github-actions

github-actions Bot commented Jul 12, 2026

Copy link
Copy Markdown

Release artifacts

Built for PR head 1e1d20b in workflow run #16648.

Artifact Link
All release artifacts Download
Linux packages Download
Windows packages Download
macOS packages Download
UI artifacts Download
UI macOS artifacts Download

GHCR images (amd64)

This comment is updated by the Release workflow. Artifact links expire according to the workflow retention policy.

@sonarqubecloud

Copy link
Copy Markdown

@braginini
braginini self-requested a review July 12, 2026 18:54
@mlsmaycon
mlsmaycon merged commit ecd398d into main Jul 12, 2026
48 checks passed
@mlsmaycon
mlsmaycon deleted the feature/dashboard-features-setting branch July 12, 2026 19:16
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