Every way a company gets a board is set_board, and an unreadable host keeps its slug

`app.jobs.sources.set_board` attaches a board to an existing company,
replaces the one it has (closing the old board's open roles) or creates
the company, with row and subscription changed in one transaction by
`Store.set_company_board`. A board that lists zero roles is kept. `add`,
`discover --add`, the seed importer (moved out of app/cli.py) and the new
`POST|DELETE /api/companies/{key}/board` all go through it; a seed re-run
attaches a board to a row that never had one. A company's subscription is
rewritten in place, and detaching hides it.

`companies.ats_slug` (migration 9) keeps the slug of a host the app
cannot read yet, and discovery returns such a host before probing slugs.
The Companies rows get Set board / Change, the host select is rendered
from `plugins.ats.HOSTS`, and a row with nothing found reads "board not
found" and is in the "Not readable yet" filter.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-29 14:04:52 +02:00
1 parent 0558ef19ed
commit 3b209d628a
18 files changed
+1038 -178

No files matched your search

+13 -1
View File
@@ -1200,6 +1200,17 @@ table.applications td[data-label="Saved"] { white-space: nowrap; color: var(--di
gap: .4rem; font-size: .8rem; color: var(--dim);
}
.srow[data-muted="true"], .crow[data-hidden="true"] { opacity: .6; }
/* A company row's Set board / Change editor: its own line under `.sub`,
wrapping like `.sub` does, the boxes styled as `.source-form`'s. */
.crow .board-edit {
grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center;
gap: .4rem; padding-top: .25rem;
}
.crow .board-edit select, .crow .board-edit input {
background: var(--bg); border: 1px solid var(--line);
border-radius: .3rem; padding: .35rem .5rem;
}
.crow .board-edit input { flex: 1 1 8rem; min-width: 0; }
.linky {
padding: 0; border: 0; background: none; font-size: .8rem;
@@ -1282,7 +1293,8 @@ table.list select { padding: .25rem .4rem; }
button, .top nav a { min-height: 2.75rem; }
.top nav a { display: inline-flex; align-items: center; justify-content: center; }
.filters input[type="search"], .filters input[type="text"], .filters select,
.agent-form input, .source-form select { min-height: 2.75rem; }
.agent-form input, .source-form select,
.crow .board-edit input, .crow .board-edit select { min-height: 2.75rem; }
.affinity button { min-width: 2.75rem; }
.check input { width: 1.25rem; height: 1.25rem; }
}
+102 -7
View File
@@ -11,6 +11,12 @@
* server's default, the enabled agent with the lowest id; with no agent at
* all there is nothing to like, and the section says so instead of drawing
* the buttons.
*
* Each row's "Set board" (no board yet) or "Change" (a board) opens a small
* editor in the row: the host select, with the options the server rendered
* into the Follow form's `#b-host`, and a slug. Saving posts to
* `/api/companies/{key}/board`, which reads the board once before keeping
* it; Detach stops reading it and keeps the company.
*/
(function () {
"use strict";
@@ -21,6 +27,9 @@
/** @type {object[]} the search agents, by id */
let agents = [];
/** The key of the row whose board editor is open, or null. One at a time. */
let editing = null;
/** The id in `#c-agent`, or null while there is no agent to pick. */
function agentId() {
const value = $("#c-agent").value;
@@ -45,7 +54,7 @@
// ---------------------------------------------------------------- the list
function subLine(company) {
function subLine(company, rerender) {
const sub = document.createElement("span");
sub.className = "sub";
if (company.board) {
@@ -57,11 +66,15 @@
// Followed, but its careers site runs on nothing the app reads yet.
const badge = document.createElement("span");
badge.className = "badge";
badge.textContent = company.ats || "own site";
badge.textContent = company.ats
? (company.ats_slug ? `${company.ats}:${company.ats_slug}` : company.ats)
: "own site";
sub.appendChild(badge);
sub.append(" · not readable yet");
} else {
sub.append("from job boards");
// Every row comes from the seed, Follow or discover: none of them
// found where this company posts its roles.
sub.append("board not found");
}
if (company.careers_url && !company.board) {
const link = document.createElement("a");
@@ -72,11 +85,92 @@
sub.append(" · ");
sub.appendChild(link);
}
sub.append(` · ${count(company.open_roles, "open role")}`);
sub.append(` · ${count(company.open_roles, "open role")} `);
const edit = document.createElement("button");
edit.type = "button";
edit.className = "linky";
edit.textContent = company.subscription_id == null ? "Set board" : "Change";
edit.setAttribute("aria-expanded", String(editing === company.key));
edit.addEventListener("click", () => {
editing = editing === company.key ? null : company.key;
rerender();
});
sub.appendChild(edit);
return sub;
}
/** The board switch, or nothing for a company known only from a search:
/** The open row's board editor: host and slug, Save, Cancel, and Detach
for a row that has a board. */
function boardEditor(company, rerender) {
const form = document.createElement("form");
form.className = "board-edit";
form.autocomplete = "off";
const host = document.createElement("select");
host.setAttribute("aria-label", `${company.name}'s board host`);
for (const option of $("#b-host").options) host.appendChild(option.cloneNode(true));
const known = [...host.options].map((o) => o.value);
const current = company.board || company.ats;
if (known.includes(current)) host.value = current;
const slug = document.createElement("input");
slug.type = "text";
slug.required = true;
slug.spellcheck = false;
slug.placeholder = "slug";
slug.value = company.ats_slug || "";
slug.setAttribute("aria-label", `${company.name}'s slug on that host`);
const save = document.createElement("button");
save.type = "submit";
save.textContent = company.subscription_id == null ? "Set board" : "Change board";
const cancel = document.createElement("button");
cancel.type = "button";
cancel.className = "linky";
cancel.textContent = "Cancel";
cancel.addEventListener("click", () => { editing = null; rerender(); });
form.append(host, slug, save, cancel);
async function done() {
editing = null;
await loadCompanies(agentId());
rerender();
}
form.addEventListener("submit", async (event) => {
event.preventDefault();
save.disabled = true;
try {
const result = await api(`/api/companies/${encodeURIComponent(company.key)}/board`,
{ method: "POST", body: { board: `${host.value}:${slug.value.trim()}` } });
const closed = result.closed ? `, ${count(result.closed, "old role")} closed` : "";
window.toast.info(`${company.name}: reading ${result.source.target}, `
+ `${count(result.found, "role")} listed${closed}.`);
await done();
} catch (err) {
save.disabled = false;
}
});
if (company.subscription_id != null) {
const detach = document.createElement("button");
detach.type = "button";
detach.className = "linky";
detach.textContent = "Detach";
detach.addEventListener("click", async () => {
detach.disabled = true;
try {
const result = await api(`/api/companies/${encodeURIComponent(company.key)}/board`,
{ method: "DELETE" });
window.toast.info(`${company.name}: board detached, `
+ `${count(result.closed, "open role")} closed.`);
await done();
} catch (err) {
detach.disabled = false;
}
});
form.append(detach);
}
return form;
}
/** The board switch, or nothing for a company with no board:
there is no subscription to switch. */
function onSwitch(company, rerender) {
if (company.subscription_id == null) return null;
@@ -109,7 +203,7 @@
case "hidden": return company.affinity === -1;
case "on": return company.on === true;
case "off": return company.on === false;
case "unreadable": return company.subscription_id == null && Boolean(company.ats || company.careers_url);
case "unreadable": return company.subscription_id == null;
default: return true;
}
}
@@ -140,7 +234,8 @@
if (agent != null) {
row.appendChild(affinityControl(company.key, company.affinity, async () => render(), agent));
}
row.appendChild(subLine(company));
row.appendChild(subLine(company, render));
if (editing === company.key) row.appendChild(boardEditor(company, render));
body.appendChild(row);
}
const open = rows.reduce((sum, c) => sum + c.open_roles, 0);