Viewing as leads the Roles rail; settings get a rail, agent cards, one Sources section at a time
A search agent is a persona, and every like or pass belongs to the one being viewed. The rail now opens on Viewing as: a full-width chooser, the name alone with one agent, a note with none, remembered in the URL and localStorage. The vote buttons, the reader's affinity control, the feed, the tag counts and the reader fetch all carry that agent; before, votes sent none and every one landed on the default agent. Best first and Newest first are back as the segmented control under Order, independent of the agent. The rail selects no longer clip descenders: Chrome ignores line-height on a select, so the fixed box is gone in favour of padding and a min-height. Settings render inside a sticky rail (Search agents; Sources with Job boards, Company boards, Runs, Messages; Account), a strip under the header on a phone, so Runs is one click away however long the company list gets. Sources shows one section at a time, chosen by the fragment, so the old redirects still land. Search agents are cards, newest first: name, an On/Off switch with its word, the intent in full, the weights, Edit in place, New agent on top, and a link to Roles as that agent. Switching one on rescores it. replace_scores writes nothing for an agent deleted while score was running, instead of failing the run on the foreign key. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
063771d617
commit
c4f2bcc0c9
20 files changed
+836
-326
No files matched your search
@@ -55,6 +55,18 @@ def test_the_roles_page_is_the_rail_the_feed_and_a_shut_reader(client: TestClien
|
||||
assert "/static/roles.js" in page and "/static/judge.js" in page
|
||||
|
||||
|
||||
def test_the_rail_opens_on_viewing_as_then_filters_then_order(client: TestClient) -> None:
|
||||
rail = client.get("/").text.split('<aside id="rail"', 1)[1].split("</aside>", 1)[0]
|
||||
for part in ('id="agent"', 'id="agent-one"', 'id="agent-none"', 'href="/settings/agents"'):
|
||||
assert part in rail, part
|
||||
headings = [rail.index(h) for h in ("Viewing as", "<h3>Filters</h3>", "<h3>Order</h3>",
|
||||
"<h3>Tags")]
|
||||
assert headings == sorted(headings)
|
||||
# The agent is not an order any more: the segmented control is the order.
|
||||
assert rail.index('id="sort"') > rail.index("<h3>Order</h3>")
|
||||
assert rail.count('id="agent"') == 1
|
||||
|
||||
|
||||
def test_a_role_address_is_the_same_page_with_its_reader_open(
|
||||
client: TestClient, store: Store) -> None:
|
||||
store.upsert_role(posting("1", company="Acme"))
|
||||
|
||||
@@ -506,6 +506,15 @@ def test_tag_counts_orders_by_count_then_tag_and_respects_muted(store: Store) ->
|
||||
assert store.tag_counts() == [("python", 3, 2), ("backend", 2, 1)] # no agent, nothing hidden
|
||||
|
||||
|
||||
def test_scores_for_an_agent_deleted_mid_run_are_dropped_not_an_error(store: Store) -> None:
|
||||
store.upsert_role(posting("a"))
|
||||
uid = store.roles()[0].uid
|
||||
agent = store.save_agent("A")
|
||||
store.delete_agent(agent.id)
|
||||
assert store.replace_scores(agent.id, [(uid, 0.9, "")]) == 0
|
||||
assert store.scores(agent.id) == {}
|
||||
|
||||
|
||||
def test_a_vote_moves_the_served_score_and_the_order(store: Store) -> None:
|
||||
for sid in ("a", "b", "c"):
|
||||
store.upsert_role(posting(sid))
|
||||
|
||||
+45
-6
@@ -17,6 +17,7 @@ from app.config import Config, ServerConfig
|
||||
from app.main import create_app
|
||||
from app.storage import Store
|
||||
from app.web import MOVED, SETTINGS, TABS
|
||||
from app.web.pages import SECTIONS
|
||||
from auth import AuthConfig
|
||||
from desk.models import Item
|
||||
|
||||
@@ -512,7 +513,7 @@ def test_every_page_renders_with_the_whole_nav(client: TestClient) -> None:
|
||||
assert '<link rel="manifest" href="/static/manifest.json">' in res.text
|
||||
|
||||
|
||||
def test_the_cog_and_one_sub_tab_are_current_on_a_settings_page(client: TestClient) -> None:
|
||||
def test_the_cog_and_one_rail_entry_are_current_on_a_settings_page(client: TestClient) -> None:
|
||||
page = client.get("/settings/sources").text
|
||||
assert 'class="icon active"' in page
|
||||
for tab in SETTINGS:
|
||||
@@ -523,6 +524,38 @@ def test_the_cog_and_one_sub_tab_are_current_on_a_settings_page(client: TestClie
|
||||
assert 'class="icon active"' not in client.get("/").text
|
||||
|
||||
|
||||
def test_every_settings_page_has_the_rail_and_not_the_tab_row(client: TestClient) -> None:
|
||||
"""The rail replaces the `<h1>Settings</h1>` and the sub-tab row: every
|
||||
page, then the Sources sections indented under Sources, from any page."""
|
||||
for tab in SETTINGS:
|
||||
page = client.get(tab.path).text
|
||||
assert '<aside class="settings-rail"' in page, tab.path
|
||||
assert 'class="subtabs"' not in page and "<h1>Settings</h1>" not in page
|
||||
rail = page[page.index('<aside class="settings-rail"'):page.index("</aside>")]
|
||||
assert [rail.index(f'href="{t.path}"') for t in SETTINGS] == sorted(
|
||||
rail.index(f'href="{t.path}"') for t in SETTINGS)
|
||||
for anchor, label in SECTIONS["/settings/sources"]:
|
||||
link = f'href="/settings/sources#{anchor}" data-section="{anchor}">{label}</a>'
|
||||
assert rail.index('href="/settings/sources"') < rail.index(link) \
|
||||
< rail.index('href="/settings/account"')
|
||||
|
||||
|
||||
def test_a_moved_section_is_one_the_sources_page_shows(client: TestClient) -> None:
|
||||
"""Every old path that lands on a fragment of Sources names a section of
|
||||
`SECTIONS`, and each is a `<section data-section>` on the page, which is
|
||||
what sources.js shows one of."""
|
||||
anchors = [anchor for anchor, _ in SECTIONS["/settings/sources"]]
|
||||
assert anchors == ["job-boards", "company-boards", "runs", "messages"]
|
||||
for to in MOVED.values():
|
||||
path, _, anchor = to.partition("#")
|
||||
if anchor:
|
||||
assert path == "/settings/sources" and anchor in anchors, to
|
||||
page = client.get("/settings/sources").text
|
||||
assert page.count("data-section>") == len(anchors)
|
||||
for anchor in anchors:
|
||||
assert f'<section class="card" id="{anchor}" data-section>' in page
|
||||
|
||||
|
||||
def test_settings_is_search_agents(client: TestClient) -> None:
|
||||
res = client.get("/settings", follow_redirects=False)
|
||||
assert res.status_code == 302 and res.headers["location"] == "/settings/agents"
|
||||
@@ -553,7 +586,7 @@ def test_each_page_loads_only_its_own_script(client: TestClient) -> None:
|
||||
for path, container, own in [
|
||||
("/", 'id="roles-list"', ["roles.js"]),
|
||||
("/applications", 'id="applications-list"', ["applications.js"]),
|
||||
("/settings/agents", 'id="agent-form"', ["agents.js"]),
|
||||
("/settings/agents", 'id="agents-list"', ["agents.js"]),
|
||||
("/settings/sources", 'id="searches-list"',
|
||||
["sources.js", "companies.js", "jobs.js", "messages.js"])]:
|
||||
page = client.get(path).text
|
||||
@@ -569,8 +602,13 @@ def test_each_page_loads_only_its_own_script(client: TestClient) -> None:
|
||||
|
||||
|
||||
def test_the_agents_page_lists_and_edits_search_agents(client: TestClient) -> None:
|
||||
"""A card per agent, filled by agents.js, and the form as a `<template>`
|
||||
it clones into the card being edited, or a new one on top."""
|
||||
page = client.get("/settings/agents").text
|
||||
assert 'id="agents-list"' in page and 'id="agents-count"' in page
|
||||
assert page.index('id="a-new"') < page.index('id="agents-list"')
|
||||
template = page[page.index('<template id="agent-form-template">'):page.index("</template>")]
|
||||
assert 'id="agent-form"' in template and 'id="a-cancel"' in template
|
||||
assert 'id="a-name"' in page and 'placeholder="My search"' in page
|
||||
assert 'id="a-intent"' in page and "<details" in page and 'id="a-gates"' in page
|
||||
for weight in ("a-fit", "a-recency", "a-affinity", "a-taste"):
|
||||
@@ -581,11 +619,12 @@ def test_the_agents_page_lists_and_edits_search_agents(client: TestClient) -> No
|
||||
|
||||
|
||||
def test_the_sources_page_has_a_section_per_plugin(client: TestClient) -> None:
|
||||
"""Job boards, company boards and the runs, in that order, with the
|
||||
message log at the end of the runs and a jump row to each section."""
|
||||
"""Job boards, company boards, the runs and the message log, in that
|
||||
order, each linked from the rail; no jump row any more."""
|
||||
page = client.get("/settings/sources").text
|
||||
for anchor in ("job-boards", "company-boards", "runs"):
|
||||
assert f'href="#{anchor}"' in page and f'id="{anchor}"' in page
|
||||
assert '<aside class="settings-rail"' in page and 'class="jump"' not in page
|
||||
for anchor in ("job-boards", "company-boards", "runs", "messages"):
|
||||
assert f'href="/settings/sources#{anchor}"' in page and f'id="{anchor}"' in page
|
||||
assert page.index('id="job-boards"') < page.index('id="company-boards"') \
|
||||
< page.index('id="runs"') < page.index('id="messages"')
|
||||
# Job boards: the Jobindex areas and the Adzuna countries, from plugins.search.
|
||||
|
||||
Reference in new issue
Block a user