Sources tab: searches, company boards and the prune by region, in the app

What a pull reads can now be changed on a page instead of only the command
line: try a search and see its first ten results before saving it, edit or
remove one, follow a company's ATS board, switch any board or search on or
off, and preview and apply a prune by region. Each row shows its open roles
and the countries they are in.

The page and `app companies`/`app searches` call the same functions in
app/jobs/sources.py. Switching a target off closes its open roles, and the
pull's settle closes them again if a batch in flight reopened them. Roles
pulled before `country` existed are backfilled at startup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-24 15:15:04 +02:00
1 parent 047f7cd8ad
commit 6b40702a9a
16 files changed
+1068 -92

No files matched your search

+15 -3
View File
@@ -1,18 +1,21 @@
"""The tabs: eight pages, declared once.
"""The tabs: nine pages, declared once.
`TABS` is the whole navigation. `base.html` renders it, every page marks
itself active by its own `path`, and adding a tab is one entry here plus one
template.
Every page is a shell. Roles, Applications, Agents and Companies are filled
and driven by `static/roles.js` from the JSON routes in `web/api.py`; Jobs,
and driven by `static/roles.js` from the JSON routes in `web/api.py`, Sources
by `static/sources.js`; Jobs,
Schedules and Account are shells around the modules' own elements. What the
server renders is only what a select needs to offer, so the options cannot
drift from what the store accepts.
`FUNCTIONS` is `plugins.ats`'s, not `app`'s: the nine job functions are the
classifier's vocabulary, and this reaches `plugins/` the same way `app.cli`
does, since a plugin is app-agnostic and never reaches back into `app`.
does, since a plugin is app-agnostic and never reaches back into `app`. The
Jobindex areas and Adzuna countries on the Sources tab come from
`plugins.search` for the same reason.
"""
from __future__ import annotations
@@ -32,6 +35,7 @@ if str(_ROOT) not in sys.path:
sys.path.insert(0, str(_ROOT))
from plugins.ats import FUNCTIONS # noqa: E402
from plugins.search import ADZUNA_COUNTRIES, JOBINDEX_AREAS # noqa: E402
TEMPLATE_DIR = Path(__file__).resolve().parent.parent / "templates"
STATIC_DIR = Path(__file__).resolve().parent.parent / "static"
@@ -50,6 +54,7 @@ TABS: tuple[Tab, ...] = (
Tab("/applications", "Applications", "applications.html"),
Tab("/agents", "Agents", "agents.html"),
Tab("/companies", "Companies", "companies.html"),
Tab("/sources", "Sources", "sources.html"),
Tab("/jobs", "Jobs", "jobs.html"),
Tab("/schedules", "Schedules", "schedules.html"),
Tab("/messages", "Messages", "messages.html"),
@@ -61,6 +66,8 @@ TABS: tuple[Tab, ...] = (
FUNCTION_OPTIONS = [(f, f.replace("/", " / ").capitalize()) for f in FUNCTIONS]
REMOTE_OPTIONS = [(r, r.capitalize()) for r in REMOTE if r]
STATUS_OPTIONS = [(s, s.capitalize()) for s in STATUSES]
AREA_OPTIONS = list(JOBINDEX_AREAS.items())
COUNTRY_OPTIONS = [(c, c.upper()) for c in sorted(ADZUNA_COUNTRIES)]
def asset(path: str) -> str:
@@ -107,6 +114,11 @@ def companies(request: Request) -> HTMLResponse:
return page(request, "companies.html")
@router.get("/sources", response_class=HTMLResponse)
def sources(request: Request) -> HTMLResponse:
return page(request, "sources.html", areas=AREA_OPTIONS, countries=COUNTRY_OPTIONS)
@router.get("/jobs", response_class=HTMLResponse)
def jobs(request: Request) -> HTMLResponse:
return page(request, "jobs.html")