Skip to content

Commit

Permalink
Fix more type definitions to require pageSize
Browse files Browse the repository at this point in the history
- note: to take advantage of the new table pagination defaults, consider removing the initially set `pageSize` state
  • Loading branch information
cee-chen committed Aug 15, 2023
1 parent 7c08114 commit c6daf9b
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ interface BaseDataTableProps {
rowRenderers: DeprecatedRowRenderer[];
hasCrudPermissions?: boolean;
unitCountText: string;
pagination: EuiDataGridPaginationProps;
pagination: EuiDataGridPaginationProps & { pageSize: number };
totalItems: number;
rowHeightsOptions?: EuiDataGridRowHeightsOptions;
isEventRenderedView?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type TableProps = Required<EuiBasicTableProps<CspFinding>>;
interface Props {
loading: boolean;
items: CspFinding[];
pagination: Pagination;
pagination: Pagination & { pageSize: number };
sorting: TableProps['sorting'];
setTableOptions(options: CriteriaWithPagination<CspFinding>): void;
onAddFilter: OnAddFilter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { EmptyState } from '../../../../components/empty_state';
export interface ResourceFindingsTableProps {
items: CspFinding[];
loading: boolean;
pagination: Pagination;
pagination: Pagination & { pageSize: number };
sorting: Required<EuiBasicTableProps<CspFinding>>['sorting'];
setTableOptions(options: CriteriaWithPagination<CspFinding>): void;
onAddFilter: OnAddFilter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const StyledCondition = styled.span`
interface ExceptionsUtilityComponentProps {
dataTestSubj?: string;
exceptionsTitle?: string;
pagination: Pagination;
pagination: Pagination & { pageSize: number };
// Corresponds to last time exception items were fetched
lastUpdated: string | number | null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface ListExceptionItemsProps {
exceptions: ExceptionListItemSchema[];
listType: ExceptionListTypeEnum;
lastUpdated: string | number | null;
pagination: Pagination;
pagination: Pagination & { pageSize: number };
emptyViewerTitle?: string;
emptyViewerBody?: string;
emptyViewerButtonText?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const useListExceptionItems = ({

const [exceptions, setExceptions] = useState<ExceptionListItemSchema[]>([]);
const [exceptionListReferences, setExceptionListReferences] = useState<RuleReferences>({});
const [pagination, setPagination] = useState<Pagination>({
const [pagination, setPagination] = useState<Pagination & { pageSize: number }>({
pageIndex: 0,
pageSize: 0,
totalItemCount: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const RuleErrorLog = (props: RuleErrorLogProps) => {

const isOnLastPage = useMemo(() => {
const { pageIndex, pageSize } = pagination;
return (pageIndex + 1) * pageSize >= MAX_RESULTS;
return (pageIndex + 1) * pageSize! >= MAX_RESULTS;
}, [pagination]);

const formattedSort = useMemo(() => {
Expand Down

0 comments on commit c6daf9b

Please sign in to comment.