diff --git a/src/components/activity/RecordView.jsx b/src/components/activity/RecordView.jsx index 8727fa0..cf51f37 100644 --- a/src/components/activity/RecordView.jsx +++ b/src/components/activity/RecordView.jsx @@ -2,7 +2,6 @@ import { useEffect, useState } from 'react' import { AssetStateBadge, Avatar, - Button, EmployeeStatusBadge, EmptyState, HistoryActionBadge, @@ -17,11 +16,16 @@ import { FileLinks, imageSources } from './FieldValue' /** * Renders a record view straight from the backend response: the columns are * whatever `config.fields` returns, in that order, with the backend's own - * labels. Paging, sorting and search are handled by the server. + * labels. Sorting and search are handled by the server; instead of page + * buttons, a "Rows" selector sets how many records the server returns + * (search_query.limit), so picking 5 shows 5 rows and picking 100 shows 100. * `toolbar` adds controls (e.g. a filter) next to the search box. A field with * `sortable: false` can't be sorted. A rich column (see api/richColumns.js) * shows several fields in one cell and sorts by its `sort_key`. */ +/** How many rows the "Rows" selector can ask the server for. */ +const ROW_OPTIONS = [5, 10, 25, 50, 100] + export default function RecordView({ fields, rows, @@ -29,7 +33,7 @@ export default function RecordView({ loading, error, query, - setPage, + setLimit, setSearch, setSort, rowKey = 'instance_id', @@ -61,8 +65,6 @@ export default function RecordView({ setSort(sortKey(field), dir) } - const page = pagination?.page ?? 1 - const totalPages = pagination?.total_pages ?? 1 const total = pagination?.total_count ?? rows.length return ( @@ -143,26 +145,26 @@ export default function RecordView({ - {totalPages > 1 && ( + {total > 0 && (