Skip to content

feat(dashboard): show version on settings page#305

Merged
SantiagoDePolonia merged 2 commits intomainfrom
feat/version-on-the-settings-page-dashboard
May 7, 2026
Merged

feat(dashboard): show version on settings page#305
SantiagoDePolonia merged 2 commits intomainfrom
feat/version-on-the-settings-page-dashboard

Conversation

@SantiagoDePolonia
Copy link
Copy Markdown
Contributor

@SantiagoDePolonia SantiagoDePolonia commented May 7, 2026

Summary

  • Render the same string gomodel --version prints (via version.Info()) in a small muted, right-aligned, monospaced footer at the bottom of the Dashboard → Settings panel.
  • Wires Version into templateData so it's sourced from the existing internal/version package — picked up automatically from build-time -ldflags in release builds, no hardcoding.
  • Reuses the existing .mono utility 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-footer element and gomodel prefix appear in rendered HTML)
  • Visit Dashboard → Settings and confirm version appears at the bottom in dev (gomodel dev (commit: none, built: unknown, go1.x))
  • Confirm a release build shows the injected version/commit/date

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Application version is now shown in the admin dashboard settings footer, giving users quick visibility of the running version.
  • Style

    • Added footer styling for the settings page to align and visually mute the version display for clarity.

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>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8984d829-8e4e-4da5-82eb-89f3fedf24bc

📥 Commits

Reviewing files that changed from the base of the PR and between b2d4ec9 and b564dad.

📒 Files selected for processing (1)
  • internal/admin/dashboard/dashboard.go

📝 Walkthrough

Walkthrough

The admin dashboard now displays the application version by extending the templateData struct with a Version field, importing the version module, passing version information to the template, adding a styled footer element to the settings page, and asserting version rendering in tests.

Changes

Admin Dashboard Version Display

Layer / File(s) Summary
Data Contract
internal/admin/dashboard/dashboard.go
templateData struct extended with Version string field to carry version information.
Backend Integration
internal/admin/dashboard/dashboard.go
Import gomodel/internal/version, update Index handler to pass version.Info() into templateData, and refactor assetURL to use a local v variable for the asset hash.
Presentation Layer
internal/admin/dashboard/templates/page-settings.html, internal/admin/dashboard/static/css/dashboard.css
Template renders version in a footer paragraph with classes settings-version-footer and mono; CSS defines styling for the footer with top margin, muted color, small font, and right alignment.
Test Coverage
internal/admin/dashboard/dashboard_test.go
TestIndex_ReturnsHTML assertions expanded to verify settings-version-footer element presence and gomodel version string in rendered HTML.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A version footer hops into view,
The dashboard now shows what's brand new—
Backend feeds the string, the template displays,
CSS tucks it right, aligned in small ways,
Tests nod and say the footer's true.

🚥 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding version display to the dashboard settings page.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feat/version-on-the-settings-page-dashboard

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 and usage tips.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 7, 2026

Greptile Summary

Displays the build-time version string (from internal/version) as a muted, right-aligned monospaced footer at the bottom of the Dashboard → Settings panel, with no hardcoding.

  • Adds Version string to templateData populated once per Index request via version.Info(), making the existing build-time -ldflags variables automatically available to every template.
  • Inserts a single <p class=\"settings-version-footer mono\">{{.Version}}</p> into page-settings.html and a matching CSS rule into dashboard.css; Go's html/template engine auto-escapes the value so there is no injection risk.
  • Backs the change with two focused test assertions that verify the element class and the gomodel prefix appear in the rendered HTML.

Confidence Score: 5/5

Safe 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

Filename Overview
internal/admin/dashboard/dashboard.go Adds version.Info() to templateData and wires it to every Index render; change is minimal and correct.
internal/admin/dashboard/dashboard_test.go Two new assertions for settings-version-footer and gomodel prefix; both compare against the lowercased body, which is already the existing pattern — assertions are correct.
internal/admin/dashboard/static/css/dashboard.css Adds .settings-version-footer utility class with muted color, right-alignment, and 12 px font; clean addition that complements the existing .mono class used alongside it.
internal/admin/dashboard/templates/page-settings.html Appends a single <p> with {{.Version}} inside the settings Alpine template; html/template auto-escapes the value, so no injection risk.

Sequence Diagram

sequenceDiagram
    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
Loading

Reviews (1): Last reviewed commit: "feat(dashboard): show version on setting..." | Re-trigger Greptile

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 7, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/admin/dashboard/dashboard.go 66.66% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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 win

Local variable version shadows the newly imported version package

The short-variable declaration on line 118 (if version := versions[normalizedPath]; version != "") now shadows the gomodel/internal/version package imported on line 16. This is a new collision introduced by this PR. There is no runtime bug because the package is never called inside assetURL, 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

📥 Commits

Reviewing files that changed from the base of the PR and between 4378574 and b2d4ec9.

📒 Files selected for processing (4)
  • internal/admin/dashboard/dashboard.go
  • internal/admin/dashboard/dashboard_test.go
  • internal/admin/dashboard/static/css/dashboard.css
  • internal/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>
@SantiagoDePolonia SantiagoDePolonia merged commit fbb05fc into main May 7, 2026
19 checks passed
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