Skip to content

Conversation

@JamesNK
Copy link
Member

@JamesNK JamesNK commented Jul 7, 2025

Description

I can't reproduce the issue with console logs. I think the problem is long lines can wrap, which means they have unequal height, which the Blazor virtualize control doesn't support.

This change adds an option to turn off wrapping. People who have the problem can try out turning this on and see whether the issue disappears.

image

Contributes to #7969

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@JamesNK JamesNK requested a review from adamint July 7, 2025 01:07
Copilot AI review requested due to automatic review settings July 7, 2025 01:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a user toggle to disable wrapping of long console log lines and persists that setting in local storage.

  • Adds CSS rules and a wrapper class to control log line wrapping
  • Introduces new resource keys and XLF entries for “Wrap log lines” and “No wrap log lines”
  • Updates the ConsoleLogs page and LogViewer control to surface the new toggle and persist its state

Reviewed Changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
wwwroot/css/app.css Adds .wrap-log-container styles for no-wrap
Resources/ConsoleLogs.resx & *.xlf Adds new resource keys for wrap/no-wrap
Components/Pages/ConsoleLogs.razor.cs Adds _noWrapLogs, toggle handler, and settings
Components/Pages/ConsoleLogs.razor Passes NoWrapLogs parameter to LogViewer
Components/Controls/LogViewer.razor.cs Declares new NoWrapLogs parameter
Components/Controls/LogViewer.razor Applies wrap-log-container class when toggled
Files not reviewed (1)
  • src/Aspire.Dashboard/Resources/ConsoleLogs.Designer.cs: Language not supported
Comments suppressed due to low confidence (3)

src/Aspire.Dashboard/Components/Controls/LogViewer.razor:13

  • [nitpick] The class name wrap-log-container is misleading since it actually disables wrapping. Consider renaming to no-wrap-log-container for clarity.
    <div class="@($"log-container console-container {(NoWrapLogs ? "wrap-log-container" : null)}")" id="logContainer">

src/Aspire.Dashboard/Components/Controls/LogViewer.razor.cs:43

  • Please add an XML doc comment summarizing the purpose of the NoWrapLogs parameter to maintain documentation consistency with other component parameters.
    public bool NoWrapLogs { get; set; }

src/Aspire.Dashboard/Components/Pages/ConsoleLogs.razor.cs:417

  • The new ToggleWrapLogsAsync behavior is not covered by existing tests. Consider adding a unit or integration test to verify the wrap toggle persists and updates the UI correctly.
    private async Task ToggleWrapLogsAsync(bool noWrapLogs)

@adityamandaleeka
Copy link
Member

I generally dislike having options like "don't do X." Can the option instead be "Wrap log lines" and just default to enabled?

@JamesNK
Copy link
Member Author

JamesNK commented Jul 7, 2025

The text changes depending on the current state. The default state is wrapping long lines, and then you click No wrap log lines option to switch. The text then changes to Wrap log lines.

Alernatively the UI could be a checkbox like UTC timestamp.

@adamint adamint enabled auto-merge (squash) July 9, 2025 19:24
@adamint adamint merged commit 4a2125f into main Jul 9, 2025
252 checks passed
@adamint adamint deleted the jamesnk/wraploglines branch July 9, 2025 19:47
@danmoseley
Copy link
Member

/backport to release/9.4

@github-actions
Copy link
Contributor

@github-actions github-actions bot locked and limited conversation to collaborators Aug 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants