diff --git a/src/app/[orgId]/settings/resources/[resourceId]/rules/page.tsx b/src/app/[orgId]/settings/resources/[resourceId]/rules/page.tsx
index e6fa31ac..a8edbdff 100644
--- a/src/app/[orgId]/settings/resources/[resourceId]/rules/page.tsx
+++ b/src/app/[orgId]/settings/resources/[resourceId]/rules/page.tsx
@@ -58,7 +58,7 @@ import {
import { ListResourceRulesResponse } from "@server/routers/resource/listResourceRules";
import { SwitchInput } from "@app/components/SwitchInput";
import { Alert, AlertDescription, AlertTitle } from "@app/components/ui/alert";
-import { ArrowUpDown, Check, InfoIcon, X } from "lucide-react";
+import { ArrowUpDown, Check, InfoIcon, X, ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight } from "lucide-react";
import {
InfoSection,
InfoSections,
@@ -99,6 +99,10 @@ export default function ResourceRules(props: {
const [loading, setLoading] = useState(false);
const [pageLoading, setPageLoading] = useState(true);
const [rulesEnabled, setRulesEnabled] = useState(resource.applyRules);
+ const [pagination, setPagination] = useState({
+ pageIndex: 0,
+ pageSize: 25
+ });
const router = useRouter();
const t = useTranslations();
@@ -558,11 +562,10 @@ export default function ResourceRules(props: {
getSortedRowModel: getSortedRowModel(),
getFilteredRowModel: getFilteredRowModel(),
state: {
- pagination: {
- pageIndex: 0,
- pageSize: 1000
- }
- }
+ pagination
+ },
+ onPaginationChange: setPagination,
+ manualPagination: false
});
if (pageLoading) {
@@ -784,6 +787,84 @@ export default function ResourceRules(props: {
{/* {t('rulesOrder')} */}
{/* */}
+
+ {/* Pagination Controls */}
+ {rules.length > 0 && (
+
+
+ Showing {table.getState().pagination.pageIndex * table.getState().pagination.pageSize + 1} to{" "}
+ {Math.min(
+ (table.getState().pagination.pageIndex + 1) * table.getState().pagination.pageSize,
+ table.getFilteredRowModel().rows.length
+ )}{" "}
+ of {table.getFilteredRowModel().rows.length} rules
+
+
+
+
Rows per page
+
+
+
+ Page {table.getState().pagination.pageIndex + 1} of{" "}
+ {table.getPageCount()}
+
+
+
+
+
+
+
+
+
+ )}
diff --git a/src/components/ruleTemplate/TemplateRulesManager.tsx b/src/components/ruleTemplate/TemplateRulesManager.tsx
index 1a9b4b7e..578b5d78 100644
--- a/src/components/ruleTemplate/TemplateRulesManager.tsx
+++ b/src/components/ruleTemplate/TemplateRulesManager.tsx
@@ -45,7 +45,7 @@ import {
TableRow
} from "@app/components/ui/table";
import { isValidCIDR, isValidIP, isValidUrlGlobPattern } from "@server/lib/validators";
-import { ArrowUpDown, Trash2 } from "lucide-react";
+import { ArrowUpDown, Trash2, ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight } from "lucide-react";
const addRuleSchema = z.object({
action: z.enum(["ACCEPT", "DROP"]),
@@ -75,6 +75,10 @@ export function TemplateRulesManager({ templateId, orgId }: TemplateRulesManager
const [rules, setRules] = useState([]);
const [loading, setLoading] = useState(true);
const [addingRule, setAddingRule] = useState(false);
+ const [pagination, setPagination] = useState({
+ pageIndex: 0,
+ pageSize: 25
+ });
const RuleAction = {
ACCEPT: t('alwaysAllow'),
@@ -324,11 +328,10 @@ export function TemplateRulesManager({ templateId, orgId }: TemplateRulesManager
getSortedRowModel: getSortedRowModel(),
getFilteredRowModel: getFilteredRowModel(),
state: {
- pagination: {
- pageIndex: 0,
- pageSize: 1000
- }
- }
+ pagination
+ },
+ onPaginationChange: setPagination,
+ manualPagination: false
});
if (loading) {
@@ -475,6 +478,84 @@ export function TemplateRulesManager({ templateId, orgId }: TemplateRulesManager
+
+ {/* Pagination Controls */}
+ {rules.length > 0 && (
+
+
+ Showing {table.getState().pagination.pageIndex * table.getState().pagination.pageSize + 1} to{" "}
+ {Math.min(
+ (table.getState().pagination.pageIndex + 1) * table.getState().pagination.pageSize,
+ table.getFilteredRowModel().rows.length
+ )}{" "}
+ of {table.getFilteredRowModel().rows.length} rules
+
+
+
+
Rows per page
+
+
+
+ Page {table.getState().pagination.pageIndex + 1} of{" "}
+ {table.getPageCount()}
+
+
+
+
+
+
+
+
+
+ )}
);
}