Files
9router/src/app/(dashboard)/dashboard/providers/utils.js
T
openhands d1d4e0f02b feat(providers): add status filter to providers dashboard
Adds a client-side status filter (All / Active / Inactive / No
connection) to the Providers page, applied over the already-fetched
provider + connection list. Status derives from getProviderStats
(total, allDisabled); noAuth providers count as Active. Filter composes
with the existing search across all provider sections. Part of #3699.
2026-09-03 09:39:01 +07:00

20 lines
742 B
JavaScript

export const STATUS_FILTER_OPTIONS = [
{ value: "all", label: "All" },
{ value: "active", label: "Active" },
{ value: "inactive", label: "Inactive" },
{ value: "none", label: "No connection" },
];
// noAuth providers (e.g. free proxies) are always usable even though they
// never have a stored connection record, so they never fall into "none".
export function getConnectionStatus(stats, isNoAuth = false) {
if (isNoAuth) return "active";
if (!stats || stats.total === 0) return "none";
return stats.allDisabled ? "inactive" : "active";
}
export function matchesStatusFilter(statusFilter, stats, isNoAuth = false) {
if (statusFilter === "all") return true;
return getConnectionStatus(stats, isNoAuth) === statusFilter;
}