fix: address user feedback on sources, raw_posts and workers UI/UX

This commit is contained in:
Your Name
2026-07-18 23:28:02 +05:00
parent 8bca008f74
commit 89a7ff7723
6 changed files with 205 additions and 232 deletions
+5 -3
View File
@@ -1966,22 +1966,23 @@ async def logout(request: Request):
@app.get("/sources", response_class=HTMLResponse)
async def sources_list(request: Request, q: str = "", status_filter: str = "", page: int = 1, per_page: int = 50):
async def sources_list(request: Request, q: str = "", status_filter: str = "", active_filter: str = "", page: int = 1, per_page: int = 50):
user = await get_current_user(request)
if not user:
return redirect("/login")
pool = await get_pool()
table_filters = parse_table_filters(request, SOURCE_FIELD_SPECS)
table_sorts = parse_table_sorts(request, SOURCE_FIELD_SPECS)
filter_clauses, filter_args = build_filter_sql(table_filters, SOURCE_FIELD_SPECS, 3)
filter_clauses, filter_args = build_filter_sql(table_filters, SOURCE_FIELD_SPECS, 4)
where_parts = [
"s.archived_at IS NULL",
"($1='' OR s.name ILIKE '%' || $1 || '%' OR COALESCE(s.tag,'') ILIKE '%' || $1 || '%' OR s.url ILIKE '%' || $1 || '%' OR COALESCE(s.external_id,'') ILIKE '%' || $1 || '%')",
"($2='' OR s.status=$2)",
"($3='' OR ($3='on' AND s.active=TRUE) OR ($3='off' AND s.active=FALSE))",
*filter_clauses,
]
where_sql = " AND ".join(where_parts)
base_args = [q.strip(), status_filter.strip(), *filter_args]
base_args = [q.strip(), status_filter.strip(), active_filter.strip(), *filter_args]
total = int(
await pool.fetchval(
f"""
@@ -2029,6 +2030,7 @@ async def sources_list(request: Request, q: str = "", status_filter: str = "", p
sources=sources,
q=q,
status_filter=status_filter,
active_filter=active_filter,
pagination=pager,
table_filters=table_filters,
table_sorts=table_sorts,