-
Notifications
You must be signed in to change notification settings - Fork 28
Show deployed version on the web viewer #257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ on: | |
| paths: | ||
| - 'src/PlanViewer.Core/**' | ||
| - 'src/PlanViewer.Web/**' | ||
| - 'src/PlanViewer.App/PlanViewer.App.csproj' | ||
| - '.github/workflows/deploy-web.yml' | ||
| workflow_dispatch: | ||
|
|
||
|
|
@@ -36,6 +37,17 @@ jobs: | |
| - name: Install WASM workload | ||
| run: dotnet workload install wasm-tools | ||
|
|
||
| - name: Sync web version with app version | ||
| shell: pwsh | ||
| run: | | ||
| $appVersion = ([xml](Get-Content src/PlanViewer.App/PlanViewer.App.csproj)).Project.PropertyGroup.Version | Where-Object { $_ } | ||
| Write-Host "App version: $appVersion" | ||
| $webCsproj = 'src/PlanViewer.Web/PlanViewer.Web.csproj' | ||
| $content = Get-Content $webCsproj -Raw | ||
| $content = [regex]::Replace($content, '<Version>[^<]+</Version>', "<Version>$appVersion</Version>") | ||
| Set-Content -Path $webCsproj -Value $content -NoNewline | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Generated by Claude Code |
||
| Write-Host "Synced web csproj to $appVersion" | ||
|
|
||
| - name: Publish Blazor WASM | ||
| run: dotnet publish src/PlanViewer.Web/PlanViewer.Web.csproj -c Release -o publish | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ | |
| <div class="landing-content"> | ||
| <h2>Free SQL Server Query Plan Analysis</h2> | ||
| <p class="privacy">Paste or upload a .sqlplan file. Your plan XML never leaves your browser.</p> | ||
| <p class="powered-by">Powered by the same analysis engine in the <a href="https://github.com/erikdarlingdata/PerformanceStudio" target="_blank" rel="noopener">Performance Studio</a> app.</p> | ||
| <p class="powered-by">Powered by the same analysis engine in the <a href="https://github.com/erikdarlingdata/PerformanceStudio" target="_blank" rel="noopener">Performance Studio</a> app. <span class="app-version">@AppVersion</span></p> | ||
|
|
||
| @if (errorMessage != null) | ||
| { | ||
|
|
@@ -57,6 +57,7 @@ else | |
| { | ||
| <span class="toolbar-version">@result.SqlServerBuild</span> | ||
| } | ||
| <span class="toolbar-app-version" title="Performance Studio web viewer version">@AppVersion</span> | ||
| @if (shareUrl != null) | ||
| { | ||
| <span class="share-url"><a href="@shareUrl" target="_blank">@shareUrl</a></span> | ||
|
|
@@ -1664,6 +1665,13 @@ else | |
| @code { | ||
| private const string ShareApiBase = "https://stats.erikdarling.com"; | ||
|
|
||
| private static readonly string AppVersion = GetAppVersion(); | ||
| private static string GetAppVersion() | ||
| { | ||
| var v = typeof(Index).Assembly.GetName().Version; | ||
| return v == null ? "?" : $"v{v.Major}.{v.Minor}.{v.Build}"; | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Generated by Claude Code |
||
| } | ||
|
|
||
| private string activeTab = "paste"; | ||
| private string planXml = ""; | ||
| private string? errorMessage; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -451,6 +451,23 @@ textarea::placeholder { | |
| color: var(--text-muted); | ||
| } | ||
|
|
||
| .toolbar-app-version { | ||
| font-size: 0.75rem; | ||
| font-weight: 600; | ||
| color: var(--text-muted); | ||
| padding: 0.1rem 0.4rem; | ||
| border-radius: 3px; | ||
| background: rgba(0, 0, 0, 0.05); | ||
| margin-left: auto; | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Generated by Claude Code |
||
| } | ||
|
|
||
| .app-version { | ||
| font-size: 0.8rem; | ||
| font-weight: 600; | ||
| color: var(--text-muted); | ||
| margin-left: 0.25rem; | ||
| } | ||
|
|
||
| /* === Statement Tabs === */ | ||
| .statement-tabs { | ||
| display: flex; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
([xml]...).Project.PropertyGroup.Version | Where-Object { $_ }assumesPlanViewer.App.csprojhas exactly one<PropertyGroup>carrying<Version>. If a conditional second PropertyGroup is ever added (common when adding<PropertyGroup Condition="...">blocks),.PropertyGroupbecomes an array,.Versionbecomes a collection, and$appVersioninterpolates as a space-separated string into the regex replace — producing an invalid<Version>1.7.3 </Version>or similar. Safer:Select-Xml -Path ... -XPath '/Project/PropertyGroup/Version[1]/text()' | ForEach-Object { $_.Node.Value }.Generated by Claude Code