diff --git a/src/Aspire.Dashboard/Components/Pages/Resources.razor b/src/Aspire.Dashboard/Components/Pages/Resources.razor index f2395e9c2ad..660b9abd5c7 100644 --- a/src/Aspire.Dashboard/Components/Pages/Resources.razor +++ b/src/Aspire.Dashboard/Components/Pages/Resources.razor @@ -127,6 +127,7 @@ Virtualize="true" GenerateHeader="GenerateHeaderOption.Sticky" ItemSize="46" + OverscanCount="100" ItemsProvider="@GetData" ResizableColumns="true" GridTemplateColumns="@_manager.GetGridTemplateColumns()" diff --git a/src/Aspire.Dashboard/Components/Pages/StructuredLogs.razor b/src/Aspire.Dashboard/Components/Pages/StructuredLogs.razor index 0fe48bfdff6..b3ce1a5dba2 100644 --- a/src/Aspire.Dashboard/Components/Pages/StructuredLogs.razor +++ b/src/Aspire.Dashboard/Components/Pages/StructuredLogs.razor @@ -127,6 +127,7 @@ RowClass="@GetRowClass" GenerateHeader="GenerateHeaderOption.Sticky" ItemSize="46" + OverscanCount="100" ResizableColumns="true" ItemsProvider="@GetData" TGridItem="OtlpLogEntry" diff --git a/src/Aspire.Dashboard/Components/Pages/TraceDetail.razor b/src/Aspire.Dashboard/Components/Pages/TraceDetail.razor index 0b2180fc2ec..0df4ca5625c 100644 --- a/src/Aspire.Dashboard/Components/Pages/TraceDetail.razor +++ b/src/Aspire.Dashboard/Components/Pages/TraceDetail.razor @@ -97,6 +97,7 @@ RowClass="@GetRowClass" GridTemplateColumns="@_manager.GetGridTemplateColumns()" RowSize="DataGridRowSize.Small" + OverscanCount="100" ShowHover="true" ItemKey="@(r => r.Span.SpanId)" OnRowClick="@(r => r.ExecuteOnDefault(d => OnShowPropertiesAsync(d, buttonId: null)))"> diff --git a/src/Aspire.Dashboard/Components/Pages/Traces.razor b/src/Aspire.Dashboard/Components/Pages/Traces.razor index 685a240590b..c542269473f 100644 --- a/src/Aspire.Dashboard/Components/Pages/Traces.razor +++ b/src/Aspire.Dashboard/Components/Pages/Traces.razor @@ -83,6 +83,7 @@ Virtualize="true" GenerateHeader="GenerateHeaderOption.Sticky" ItemSize="46" + OverscanCount="100" ResizableColumns="true" ItemsProvider="@GetData" TGridItem="OtlpTrace" diff --git a/src/Aspire.Dashboard/wwwroot/js/app.js b/src/Aspire.Dashboard/wwwroot/js/app.js index 90aaf815b2a..e3efba15c06 100644 --- a/src/Aspire.Dashboard/wwwroot/js/app.js +++ b/src/Aspire.Dashboard/wwwroot/js/app.js @@ -62,6 +62,7 @@ window.getIsScrolledToContent = function () { window.setIsScrolledToContent = function (value) { if (isScrolledToContent != value) { isScrolledToContent = value; + console.log(`isScrolledToContent=${isScrolledToContent}`); } } @@ -82,8 +83,11 @@ window.initializeContinuousScroll = function () { // The scroll event is used to detect when the user scrolls to view content. container.addEventListener('scroll', () => { - var v = !isScrolledToBottom(container); - setIsScrolledToContent(v); + var atBottom = isScrolledToBottom(container); + if (atBottom === null) { + return; + } + setIsScrolledToContent(!atBottom); }, { passive: true }); // The ResizeObserver reports changes in the grid size. @@ -91,8 +95,18 @@ window.initializeContinuousScroll = function () { // unless the user has scrolled to view content. const observer = new ResizeObserver(function () { lastScrollHeight = container.scrollHeight; - if (!getIsScrolledToContent()) { + + if (lastScrollHeight == container.clientHeight) { + // There is no scrollbar. This could be because there's no content, or the content might have been cleared. + // Reset to default behavior: scroll to bottom + setIsScrolledToContent(false); + return; + } + + var isScrolledToContent = getIsScrolledToContent(); + if (!isScrolledToContent) { container.scrollTop = lastScrollHeight; + return; } }); for (const child of container.children) { @@ -108,6 +122,9 @@ function isScrolledToBottom(container) { if (!getIsScrolledToContent()) { if (lastScrollHeight != container.scrollHeight) { console.log(`lastScrollHeight ${lastScrollHeight} doesn't equal container scrollHeight ${container.scrollHeight}.`); + + // Unknown because the container size changed. + return null; } } @@ -115,7 +132,8 @@ function isScrolledToBottom(container) { const containerScrollBottom = lastScrollHeight - container.clientHeight; const difference = containerScrollBottom - container.scrollTop; - return difference < marginOfError; + var atBottom = difference < marginOfError; + return atBottom; } window.buttonOpenLink = function (element) {