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.
This commit is contained in:
1 parent
ac98dd9d32
commit
d1d4e0f02b
3 files changed
+119
-10
No files matched your search
@@ -0,0 +1,19 @@
|
||||
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;
|
||||
}
|
||||
Reference in new issue
Block a user