Skip to content

Commit

Permalink
feat(ui): Save and persist ORT run data table's page size
Browse files Browse the repository at this point in the history
Resolves #1954.

Signed-off-by: Jyrki Keisala <[email protected]>
  • Loading branch information
Etsija committed Feb 7, 2025
1 parent 4956fa4 commit 9dc6e28
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import {
import { config } from '@/config';
import { getStatusBackgroundColor } from '@/helpers/get-status-class';
import { toast } from '@/lib/toast';
import { useTablePrefsStore } from '@/store/table-prefs.store';

type RepositoryTableProps = {
repoId: string;
Expand Down Expand Up @@ -241,6 +242,7 @@ export const RepositoryRunsTable = ({
pageSize,
search,
}: RepositoryTableProps) => {
const setRunPageSize = useTablePrefsStore((state) => state.setRunPageSize);
const {
data: runs,
error: runsError,
Expand Down Expand Up @@ -298,6 +300,7 @@ export const RepositoryRunsTable = ({
};
}}
setPageSizeOptions={(size) => {
setRunPageSize(size);
return {
search: { ...search, page: 1, pageSize: size },
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,17 @@ import {
} from '@/components/ui/tooltip';
import { toast } from '@/lib/toast';
import { paginationSearchParameterSchema } from '@/schemas';
import { useTablePrefsStore } from '@/store/table-prefs.store';
import { RepositoryRunsTable } from '../../-components/repository-runs-table';

const defaultPageSize = 10;
const defaultPageSize = useTablePrefsStore.getState().repoPageSize;

const RepositoryRunsComponent = () => {
const runPageSize = useTablePrefsStore.getState().runPageSize;
const params = Route.useParams();
const search = Route.useSearch();
const pageIndex = search.page ? search.page - 1 : 0;
const pageSize = search.pageSize ? search.pageSize : defaultPageSize;
const pageSize = search.pageSize ? search.pageSize : runPageSize;

const {
data: repo,
Expand Down

0 comments on commit 9dc6e28

Please sign in to comment.