Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Aspire.Dashboard/Components/Pages/Resources.razor
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
Virtualize="true"
GenerateHeader="GenerateHeaderOption.Sticky"
ItemSize="46"
OverscanCount="100"
ItemsProvider="@GetData"
ResizableColumns="true"
GridTemplateColumns="@_manager.GetGridTemplateColumns()"
Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Dashboard/Components/Pages/StructuredLogs.razor
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
RowClass="@GetRowClass"
GenerateHeader="GenerateHeaderOption.Sticky"
ItemSize="46"
OverscanCount="100"
ResizableColumns="true"
ItemsProvider="@GetData"
TGridItem="OtlpLogEntry"
Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Dashboard/Components/Pages/TraceDetail.razor
Original file line number Diff line number Diff line change
Expand Up @@ -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)))">
Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Dashboard/Components/Pages/Traces.razor
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
Virtualize="true"
GenerateHeader="GenerateHeaderOption.Sticky"
ItemSize="46"
OverscanCount="100"
ResizableColumns="true"
ItemsProvider="@GetData"
TGridItem="OtlpTrace"
Expand Down
26 changes: 22 additions & 4 deletions src/Aspire.Dashboard/wwwroot/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ window.getIsScrolledToContent = function () {
window.setIsScrolledToContent = function (value) {
if (isScrolledToContent != value) {
isScrolledToContent = value;
console.log(`isScrolledToContent=${isScrolledToContent}`);
}
}

Expand All @@ -82,17 +83,30 @@ 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.
// This ensures that the logs are scrolled to the bottom when there are new logs
// 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) {
Expand All @@ -108,14 +122,18 @@ 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;
}
}

const marginOfError = 5;
const containerScrollBottom = lastScrollHeight - container.clientHeight;
const difference = containerScrollBottom - container.scrollTop;

return difference < marginOfError;
var atBottom = difference < marginOfError;
return atBottom;
}

window.buttonOpenLink = function (element) {
Expand Down
Loading