Skip to content

fix(admin): align admin.dashboard factory with HTTP plugin patterns, remove duplicated merge logic#144

Merged
intel352 merged 2 commits intofeat/issue-89-admin-pluginfrom
copilot/sub-pr-132
Feb 23, 2026
Merged

fix(admin): align admin.dashboard factory with HTTP plugin patterns, remove duplicated merge logic#144
intel352 merged 2 commits intofeat/issue-89-admin-pluginfrom
copilot/sub-pr-132

Conversation

Copy link
Contributor

Copilot AI commented Feb 23, 2026

The admin.dashboard module factory was incomplete compared to the HTTP plugin's staticFileServerFactory: missing spaFallback, cacheMaxAge, router support, and config.ResolvePathInConfig path resolution. Additionally, mergeAdminConfig/injectUIRoot were duplicated between cmd/server/main.go and the admin plugin's wiring hook, resulting in double execution with a defensive skip.

Changes

plugins/admin/plugin.go

  • admin.dashboard factory: add config.ResolvePathInConfig for relative path resolution; spaFallback (defaults true), cacheMaxAge, and router config params — matching staticFileServerFactory in the HTTP plugin
  • injectUIRoot: extend to also override root on admin.dashboard modules (previously only static.fileserver)

plugins/admin/plugin_test.go

  • Add TestWiringHookInjectsUIDirForAdminDashboard: verifies UIDir override applies to admin.dashboard modules

cmd/server/main.go

  • Remove duplicated mergeAdminConfig + injectUIRoot functions and their call in setup() — the admin plugin's wiring hook is now the single merge point
// admin.dashboard factory now mirrors staticFileServerFactory:
spaFallback := true  // on by default for SPA admin UI
if sf, ok := cfg["spaFallback"].(bool); ok {
    spaFallback = sf
}
root = config.ResolvePathInConfig(cfg, root)
sfs := module.NewStaticFileServer(name, root, prefix, opts...)
if routerName, ok := cfg["router"].(string); ok && routerName != "" {
    sfs.SetRouterName(routerName)
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…tion

Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Copilot AI changed the title [WIP] Add admin plugin to serve admin UI and config fix(admin): align admin.dashboard factory with HTTP plugin patterns, remove duplicated merge logic Feb 23, 2026
Copilot AI requested a review from intel352 February 23, 2026 14:40
@intel352 intel352 marked this pull request as ready for review February 23, 2026 16:22
@intel352 intel352 merged commit 2ed92af into feat/issue-89-admin-plugin Feb 23, 2026
@intel352 intel352 deleted the copilot/sub-pr-132 branch February 23, 2026 16:22
intel352 added a commit that referenced this pull request Feb 23, 2026
…) (#132)

* feat: admin as plugin — serve admin UI and config as engine plugin (#89)

Create plugins/admin/ EnginePlugin that encapsulates admin concerns:

- admin.dashboard module type: serves admin UI static files via StaticFileServer
- admin.config_loader module type: dependency anchor for admin config loading
- Wiring hook merges embedded admin/config.yaml into the engine config
- WithUIDir() overrides static file root (replaces --admin-ui-dir flag logic)
- Capability contracts: admin-ui, admin-config
- Module schemas for UI palette integration
- Register plugin in cmd/server/main.go alongside existing 17 plugins
- 15 tests covering plugin interface, factories, schemas, wiring, and config merge

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(admin): align admin.dashboard factory with HTTP plugin patterns, remove duplicated merge logic (#144)

* Initial plan

* fix: address review comments on admin plugin factory and code duplication

Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
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