bbovenzi commented on code in PR #41905:
URL: https://github.com/apache/airflow/pull/41905#discussion_r1743965474


##########
airflow/ui/src/dagsList.tsx:
##########
@@ -84,23 +89,100 @@ const columns: ColumnDef<DAG>[] = [
 
 type TableProps<TData> = {
   data: TData[];
+  total: number | undefined;
   columns: ColumnDef<TData>[];
   renderSubComponent: (props: { row: Row<TData> }) => React.ReactElement;
   getRowCanExpand: (row: Row<TData>) => boolean;
+  pagination: PaginationState;
+  setPagination: OnChangeFn<PaginationState>;
 };
 
+type PaginatorProps<TData> = {
+  table: TanStackTable<TData>;
+};
+
+function TablePaginator({ table }: PaginatorProps<DAG>) {
+  const pageInterval = 3;
+  const currentPageNumber = table.getState().pagination.pageIndex + 1;
+  const startPageNumber = Math.max(1, currentPageNumber - pageInterval);
+  const endPageNumber = Math.min(
+    table.getPageCount(),
+    startPageNumber + pageInterval * 2
+  );
+  const pageNumbers = [];
+
+  for (let index = startPageNumber; index <= endPageNumber; index++) {
+    pageNumbers.push(
+      <Button
+        borderRadius={0}
+        key={index}
+        isDisabled={index === currentPageNumber}
+        onClick={() => table.setPageIndex(index - 1)}
+      >
+        {" "}
+        {index}{" "}
+      </Button>
+    );
+  }
+
+  return (
+    <Box mt={2} mb={2}>
+      <Button
+        borderRadius={0}
+        onClick={() => table.firstPage()}
+        isDisabled={!table.getCanPreviousPage()}
+      >
+        {"<<"}

Review Comment:
   ```suggestion
           <<
   ```
   Why can't we just use the string directly?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to