feat(activity-log): set descending timestamps as the default sorting order BE-11343 (#66)

pull/12292/merge
andres-portainer 3 weeks ago committed by GitHub
parent 2f3d4a5511
commit 1061601714

@ -33,7 +33,8 @@ export function useTableStateWithStorage<T extends BasicTableSettings>(
}
export function useTableStateWithoutStorage(
defaultSortKey?: string
defaultSortKey?: string,
defaultSortDesc: boolean = false
): BasicTableSettings & {
setSearch: (search: string) => void;
search: string;
@ -41,7 +42,7 @@ export function useTableStateWithoutStorage(
const [search, setSearch] = useState('');
const [pageSize, setPageSize] = useState(10);
const [sortBy, setSortBy] = useState(
defaultSortKey ? { id: defaultSortKey, desc: false } : undefined
defaultSortKey ? { id: defaultSortKey, desc: defaultSortDesc } : undefined
);
return {

@ -17,7 +17,7 @@ export function ActivityLogsView() {
{ start: Date; end: Date | null } | undefined
>(undefined);
const [page, setPage] = useState(0);
const tableState = useTableStateWithoutStorage('Timestamp');
const tableState = useTableStateWithoutStorage('Timestamp', true);
const offset = page * tableState.pageSize;
const query = {

Loading…
Cancel
Save