Skip to content

Add First & Last Button to Logs #780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2025
Merged
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
46 changes: 40 additions & 6 deletions src/components/logs/enhanced-log-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ export function EnhancedLogsViewer({
setCurrentPage((prev) => Math.min(prev + 1, totalPages));
};

const handleFirstPage = () => {
setCurrentPage(1);
};

const handleLastPage = () => {
setCurrentPage(totalPages);
};

const handleCopyAllLogs = () => {
const logText = getOriginalLogText(logsToDisplay);

Expand Down Expand Up @@ -188,23 +196,49 @@ export function EnhancedLogsViewer({
{logsToDisplay.length} logs
</div>
<div className="flex items-center space-x-2">
<button
<Button
className="bg-theme-surface-primary"
size="md"
intent="secondary"
emphasis="subtle"
onClick={handleFirstPage}
disabled={currentPage === 1}
>
First
</Button>
<Button
className="bg-theme-surface-primary"
size="md"
intent="secondary"
emphasis="subtle"
onClick={handlePreviousPage}
disabled={currentPage === 1}
className="text-sm rounded-md border border-theme-border-moderate bg-theme-surface-primary px-3 py-1 font-medium text-theme-text-secondary hover:bg-theme-surface-tertiary disabled:cursor-not-allowed disabled:opacity-50"
>
Previous
</button>
</Button>
<span className="text-sm text-theme-text-secondary">
Page {currentPage} of {totalPages}
</span>
<button
<Button
className="bg-theme-surface-primary"
size="md"
intent="secondary"
emphasis="subtle"
onClick={handleNextPage}
disabled={currentPage === totalPages}
className="text-sm rounded-md border border-theme-border-moderate bg-theme-surface-primary px-3 py-1 font-medium text-theme-text-secondary hover:bg-theme-surface-tertiary disabled:cursor-not-allowed disabled:opacity-50"
>
Next
</button>
</Button>
<Button
className="bg-theme-surface-primary"
size="md"
intent="secondary"
emphasis="subtle"
onClick={handleLastPage}
disabled={currentPage === totalPages}
>
Last
</Button>
</div>
</div>
</div>
Expand Down