Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

remove pagination

Kiran K73e37d5a8a9d
diff --git a/apps/web/ui/webhooks/webhook-events.tsx b/apps/web/ui/webhooks/webhook-events.tsx
index b46673cd94..41c50e8929 100644
--- a/apps/web/ui/webhooks/webhook-events.tsx
+++ b/apps/web/ui/webhooks/webhook-events.tsx
@@ -1,8 +1,6 @@
"use client";
import { WebhookEventProps } from "@/lib/types";
-import { usePagination } from "@dub/ui/src/hooks/use-pagination";
-import { nFormatter, PAGINATION_LIMIT } from "@dub/utils";
import { CircleCheck, Clock4 } from "lucide-react";
import { PropsWithChildren } from "react";
@@ -11,17 +9,9 @@ export type EventListProps = PropsWithChildren<{
totalEvents: number;
}>;
-const buttonClassName = [
- "flex h-7 items-center justify-center gap-2 whitespace-nowrap rounded-md border border-gray-200 bg-white px-2 text-sm text-gray-600",
- "outline-none hover:bg-gray-50 focus-visible:border-gray-500",
- "disabled:cursor-not-allowed disabled:border-gray-200 disabled:text-gray-400 disabled:bg-white",
-].join(" ");
-
const isSuccess = (status: number) => status >= 200 && status < 300;
export function WebhookEventList({ events, totalEvents }: EventListProps) {
- const { pagination, setPagination } = usePagination(PAGINATION_LIMIT);
-
return (
<div className="rounded-xl border border-gray-200">
{/* Webhook Events */}
@@ -47,57 +37,6 @@ export function WebhookEventList({ events, totalEvents }: EventListProps) {
</div>
))}
</div>
-
- {/* Pagination */}
- <div className="sticky bottom-0 flex items-center justify-between gap-2 rounded-b-[inherit] border-t border-gray-200 bg-white px-3.5 py-2 text-sm leading-6 text-gray-600">
- <div>
- <span className="hidden sm:inline-block">Viewing</span>{" "}
- <span className="font-medium">
- {pagination.pageIndex * pagination.pageSize + 1}-
- {Math.min(
- pagination.pageIndex * pagination.pageSize + pagination.pageSize,
- totalEvents,
- )}
- </span>{" "}
- of{" "}
- <span className="font-medium">
- {nFormatter(totalEvents, { full: true })}
- </span>{" "}
- events
- </div>
- <div className="flex items-center gap-2">
- <button
- type="button"
- className={buttonClassName}
- onClick={() =>
- setPagination({
- pageIndex: pagination.pageIndex - 1,
- pageSize: pagination.pageSize,
- })
- }
- disabled={pagination.pageIndex === 0}
- >
- Previous
- </button>
- <button
- type="button"
- className={buttonClassName}
- onClick={() =>
- setPagination({
- pageIndex: pagination.pageIndex + 1,
- pageSize: pagination.pageSize,
- })
- }
- disabled={
- pagination.pageIndex * pagination.pageSize +
- pagination.pageSize >=
- totalEvents
- }
- >
- Next
- </button>
- </div>
- </div>
</div>
);
}
diff --git a/packages/tinybird/pipes/get_webhook_events.pipe b/packages/tinybird/pipes/get_webhook_events.pipe
new file mode 100644
index 0000000000..3309bc1b7b
--- /dev/null
+++ b/packages/tinybird/pipes/get_webhook_events.pipe
@@ -0,0 +1,25 @@
+DESCRIPTION >
+ Get webhook events
+
+TOKEN "get_webhook_events_endpoint_read_6029" READ
+
+NODE endpoint
+SQL >
+
+ %
+ SELECT *
+ FROM dub_webhook_events
+ WHERE
+ webhook_id
+ = {{
+ String(
+ webhookId,
+ 'wh_fjs8YfXkgsFL7eF7LOBvbluDb',
+ description="The ID of the webhook",
+ required=True,
+ )
+ }}
+ ORDER BY timestamp DESC
+ limit 100
+
+