feat(dashboard): show version on settings page#305
Conversation
Render the same string as `gomodel --version` (via `version.Info()`) in a small muted footer at the bottom of the Settings panel. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe admin dashboard now displays the application version by extending the ChangesAdmin Dashboard Version Display
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Greptile SummaryDisplays the build-time version string (from
Confidence Score: 5/5Safe to merge — the change is narrow, tested, and touches only the admin settings view with no effect on request routing or data handling. Four small, focused changes: a struct field addition, a template interpolation, a CSS rule, and two test assertions. The version string is produced by a trivial fmt.Sprintf over build-time vars, is HTML-escaped by html/template, and is exercised by the new tests. No existing behavior is altered. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Browser
participant Handler as dashboard.Handler
participant Template as html/template
participant Version as internal/version
Browser->>Handler: GET /admin/dashboard
Handler->>Version: version.Info()
Version-->>Handler: "gomodel dev (commit: none, built: unknown, go1.x)"
Handler->>Template: "ExecuteTemplate("layout", templateData{BasePath, Version})"
Template-->>Handler: "rendered HTML with {{.Version}} replaced and HTML-escaped"
Handler-->>Browser: 200 text/html with settings-version-footer
Reviews (1): Last reviewed commit: "feat(dashboard): show version on setting..." | Re-trigger Greptile |
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
internal/admin/dashboard/dashboard.go (1)
112-122:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winLocal variable
versionshadows the newly importedversionpackageThe short-variable declaration on line 118 (
if version := versions[normalizedPath]; version != "") now shadows thegomodel/internal/versionpackage imported on line 16. This is a new collision introduced by this PR. There is no runtime bug because the package is never called insideassetURL, but it confuses readers and static-analysis tools.🔧 Suggested rename
- if version := versions[normalizedPath]; version != "" { - return urlPath + "?v=" + version + if hash := versions[normalizedPath]; hash != "" { + return urlPath + "?v=" + hash }🤖 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 `@internal/admin/dashboard/dashboard.go` around lines 112 - 122, The local short declaration "version" in the assetURL function shadows the imported package named version; rename the local variable used for the map lookup (e.g., change the short var from "version" to "ver" or "v") in the if statement that reads versions[normalizedPath] and update its use in the return expression so the package name is not shadowed (refer to function assetURL and its parameter versions for where to make this change).
🤖 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.
Outside diff comments:
In `@internal/admin/dashboard/dashboard.go`:
- Around line 112-122: The local short declaration "version" in the assetURL
function shadows the imported package named version; rename the local variable
used for the map lookup (e.g., change the short var from "version" to "ver" or
"v") in the if statement that reads versions[normalizedPath] and update its use
in the return expression so the package name is not shadowed (refer to function
assetURL and its parameter versions for where to make this change).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: e2dcacc8-243c-45af-a67a-64fc08be86e0
📒 Files selected for processing (4)
internal/admin/dashboard/dashboard.gointernal/admin/dashboard/dashboard_test.gointernal/admin/dashboard/static/css/dashboard.cssinternal/admin/dashboard/templates/page-settings.html
Rename the local variable in assetURL's cache-buster lookup so it no longer shadows the imported gomodel/internal/version package. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
gomodel --versionprints (viaversion.Info()) in a small muted, right-aligned, monospaced footer at the bottom of the Dashboard → Settings panel.VersionintotemplateDataso it's sourced from the existinginternal/versionpackage — picked up automatically from build-time-ldflagsin release builds, no hardcoding..monoutility class; only ~5 lines of new CSS and a single<p>in the template.Test plan
go test ./internal/admin/dashboard/...(added two assertions:settings-version-footerelement andgomodelprefix appear in rendered HTML)gomodel dev (commit: none, built: unknown, go1.x))🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Style