Disable markdown option when JSON or XML is detected in TextVisualizerDialog#17970
Conversation
|
@copilot Refactor so DashboardUIHelpers.MarkdownFormat isn't always enabled. Enable it when nothing else matches. |
|
@copilot Include a comment that it isn't possible to reliably detect markdown so enable when content is unknown so folks can switch to it if they want. |
Refactored in the latest commit. Markdown is no longer added upfront — it's only enabled in the |
Added in commit |
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17970Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17970" |
There was a problem hiding this comment.
Pull request overview
This pull request updates the Aspire Dashboard’s TextVisualizerDialog so the Markdown format option is only enabled when the content format is unknown, and is disabled when the content is auto-detected as JSON or XML (where Markdown rendering is not meaningful).
Changes:
- Refactored
OnParametersSet()to only enable Markdown when neither JSON nor XML is detected. - Updated component tests to assert Markdown is excluded from enabled options for JSON/XML inputs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Aspire.Dashboard/Components/Dialogs/TextVisualizerDialog.razor.cs | Adjusts enabled format options so Markdown is not enabled when JSON/XML is auto-detected. |
| tests/Aspire.Dashboard.Components.Tests/Controls/TextVisualizerDialogTests.cs | Updates assertions to match the new enabled-options behavior for JSON and XML inputs. |
…rDialog Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>
Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>
Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>
399770c to
08cb563
Compare
|
❓ CLI E2E Tests unknown — 110 passed, 0 failed, 3 unknown (commit View all recordings
📹 Recordings uploaded automatically from CI run #27124509108 |
Description
When the TextVisualizerDialog detects content as JSON or XML, the markdown format option remains enabled in the format selector despite being nonsensical for structured data. This refactors
OnParametersSetso that markdown is only added toEnabledOptionswhen no structured format (JSON/XML) is detected, rather than always enabling it upfront. Markdown can't be reliably detected from content, so it is enabled when the format is unknown to let users switch to markdown rendering if they want.TextVisualizerDialog.razor.cs: Only addMarkdownFormattoEnabledOptionsin theelsebranch when neither JSON nor XML is auto-detected, with a comment explaining the rationaleTextVisualizerDialogTests.cs: Update assertions to expect markdown excluded from enabled options for JSON/XML contentChecklist
<remarks />and<code />elements on your triple slash comments?