Add quotation marks in dashboard around arguments with spaces in them#10404
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR ensures that dashboard launch arguments containing spaces are displayed with surrounding quotation marks, improving readability. It also removes a duplicate using directive and adds playground examples to cover single and multiple argument scenarios.
- Wrapped arguments with spaces in quotes in the Razor component
- Removed redundant
@usingin SourceColumnDisplay.razor - Added playground executables to test argument quoting behavior
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Aspire.Dashboard/Components/ResourcesGridColumns/SourceColumnDisplay.razor | Remove duplicate @using and add conditional logic to quote values with spaces |
| playground/Stress/Stress.AppHost/Program.cs | Add example executables for testing arguments with and without spaces |
Comments suppressed due to low confidence (1)
src/Aspire.Dashboard/Components/ResourcesGridColumns/SourceColumnDisplay.razor:23
- Consider adding unit tests to verify that arguments with spaces are correctly wrapped in quotes and that single-word arguments remain unquoted.
if (launchArgument.Value.Contains(' '))
| @@ -21,7 +20,14 @@ | |||
| { | |||
| if (launchArgument.IsShown) | |||
| { | |||
There was a problem hiding this comment.
[nitpick] The nested if-else duplicates the <span> markup; consider extracting the display value into a variable (e.g., displayValue) and rendering a single <span> for cleaner, DRY code.
src/Aspire.Dashboard/Components/ResourcesGridColumns/SourceColumnDisplay.razor
Outdated
Show resolved
Hide resolved
| <span class="subtext">@FormatValue(launchArgument.Value)</span> | ||
|
|
||
| static string FormatValue(string value) | ||
| { | ||
| return " " + (value.Contains(' ') ? $"\"{value}\"" : value); |
There was a problem hiding this comment.
I don't think a space turns into a non-breaking space. Double check before/after that args are still properly spaced.
| <span class="subtext">@FormatValue(launchArgument.Value)</span> | |
| static string FormatValue(string value) | |
| { | |
| return " " + (value.Contains(' ') ? $"\"{value}\"" : value); | |
| <span class="subtext"> @FormatValue(launchArgument.Value)</span> | |
| static string FormatValue(string value) | |
| { | |
| return (value.Contains(' ') ? $"\"{value}\"" : value); |
Description
Before:

After:

Fixes #10048
Checklist
<remarks />and<code />elements on your triple slash comments?doc-ideatemplatebreaking-changetemplatediagnostictemplate