diff --git a/src/app/(dashboard)/dashboard/providers/[id]/page.js b/src/app/(dashboard)/dashboard/providers/[id]/page.js
index 494f055c..845ae3a1 100644
--- a/src/app/(dashboard)/dashboard/providers/[id]/page.js
+++ b/src/app/(dashboard)/dashboard/providers/[id]/page.js
@@ -863,6 +863,28 @@ export default function ProviderDetailPage() {
});
};
+ // Enable/disable all selected connections in parallel, keeping the selection.
+ const handleBulkToggleActive = async (newActive) => {
+ const idsToUpdate = [...selectedConnectionIds];
+ if (idsToUpdate.length === 0) return;
+ const settled = await Promise.allSettled(
+ idsToUpdate.map((id) =>
+ fetch(`/api/providers/${id}`, {
+ method: "PUT",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ isActive: newActive }),
+ }).then((res) => {
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
+ }),
+ ),
+ );
+ const failed = settled.filter((r) => r.status === "rejected").length;
+ setConnections((prev) =>
+ prev.map((c) => (idsToUpdate.includes(c.id) ? { ...c, isActive: newActive } : c)),
+ );
+ if (failed > 0) alert(`Updated ${idsToUpdate.length - failed} connection(s), ${failed} failed.`);
+ };
+
const handleOAuthSuccess = () => {
fetchConnections();
setShowOAuthModal(false);
@@ -960,6 +982,9 @@ export default function ProviderDetailPage() {
const selectedConnections = connections.filter((conn) => selectedConnectionIds.includes(conn.id));
const allSelected = connections.length > 0 && selectedConnectionIds.length === connections.length;
+ const allSelectedDisabled =
+ selectedConnections.length > 0 &&
+ selectedConnections.every((c) => (c.isActive ?? true) === false);
const toggleSelectConnection = (connectionId) => {
setSelectedConnectionIds((prev) => (
@@ -1676,6 +1701,16 @@ export default function ProviderDetailPage() {
Delete Selected ({selectedConnectionIds.length})
)}
+ {selectedConnectionIds.length > 0 && (
+
+ )}
{selectedConnectionIds.length > 0 && (