Split the All tag into two company overrides: All countries and All roles (WP L)
Fetching has two filters, and a company now overrides each on its own.
All countries (companies.all_countries) is the old All roles tag: its big
boards are read with the agents' wide reach. All roles (companies.all_roles,
new meaning) drops the agents' fetch terms and any later role filter.
- Migration 24 copies the old tag to all_countries and keeps all_roles for
those companies, and moves a board's {"terms": false} to its company.
- The runner no longer reads {"terms": false}; the plan leaves the terms out
for a company set to All roles.
- POST /api/companies/{key}/all-countries and /all-roles, each queueing a
pull when turned on; CompanyOut carries both.
- Two toggles replace All on the Companies row, the reader and the Roles
strip; the reach line states countries and role types in plain words;
the filter select gets both options.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
795ca3628c
commit
e52857dea5
23 files changed
+602
-215
No files matched your search
+15
-4
@@ -1113,9 +1113,10 @@ table.applications td[data-label="Saved"] { white-space: nowrap; color: var(--di
|
||||
.affinity button[data-value="-1"][aria-pressed="true"] {
|
||||
color: var(--accent-fg); background: var(--error); border-color: var(--error);
|
||||
}
|
||||
/* The All roles tag, global and apart from the stances: green, the colour
|
||||
the app gives what widens (`--good`). */
|
||||
.affinity button[data-value="all"][aria-pressed="true"] {
|
||||
/* The two fetch overrides, All countries and All roles, global and apart
|
||||
from the stances: green, the colour the app gives what widens (`--good`). */
|
||||
.affinity button[data-value="countries"][aria-pressed="true"],
|
||||
.affinity button[data-value="roles"][aria-pressed="true"] {
|
||||
color: var(--accent-fg); background: var(--good); border-color: var(--good);
|
||||
}
|
||||
|
||||
@@ -1308,8 +1309,18 @@ table.applications td[data-label="Saved"] { white-space: nowrap; color: var(--di
|
||||
font-size: .96rem; text-decoration: none; color: inherit;
|
||||
}
|
||||
.crow .name { font-weight: 600; }
|
||||
/* A company row has one control more: the All roles tag after the stances. */
|
||||
/* A company row has one control more: the two fetch overrides after the stances. */
|
||||
#companies-list .crow { grid-template-columns: 1fr auto auto auto; }
|
||||
.affinity button[data-value="countries"], .affinity button[data-value="roles"] {
|
||||
white-space: nowrap;
|
||||
}
|
||||
/* At 390px their words do not fit beside the name and the stances, so they
|
||||
take a line of their own above the board's reach, which they set. */
|
||||
@media (max-width: 640px) {
|
||||
#companies-list .crow > .affinity[aria-label="Fetch overrides"] {
|
||||
grid-column: 1 / -1; justify-self: start;
|
||||
}
|
||||
}
|
||||
/* Only a name that is a link: the Watchlist draws one without a page to
|
||||
open as text, which must not look as if it led somewhere. */
|
||||
@media (hover: hover) {
|
||||
|
||||
+61
-30
@@ -16,7 +16,8 @@
|
||||
* Beside `api` on `window`, the few helpers more than one page script uses:
|
||||
* `count`, `cell`, `debounce`, `safeUrl`, and the company list with its
|
||||
* affinity control (`loadCompanies`, `companies`, `affinityControl`,
|
||||
* `setAffinity`) and the All roles tag beside it (`allRolesControl`). One
|
||||
* `setAffinity`) and the two fetch overrides beside it, All countries and
|
||||
* All roles (`overridesControl`). One
|
||||
* copy each, since two copies of a helper is one of them
|
||||
* being fixed.
|
||||
*
|
||||
@@ -184,55 +185,85 @@
|
||||
if (onChange) await onChange(updated);
|
||||
}
|
||||
|
||||
/* The All roles tag, one more toggle in the affinity buttons' fragment
|
||||
beside them, in a group of its own since it is global rather than an
|
||||
agent's stance: every board of the company is read with the agents'
|
||||
wide reach, Europe today, rather than their places (app/jobs/reach.py). On queues a pull on the server, as the other
|
||||
reopening switches do; off asks nothing, since no role closes until the
|
||||
next pull reads the board with its filter again. `onChange` runs after
|
||||
the server accepted it, with the company it answered. */
|
||||
function allRolesControl(companyKey, current, onChange) {
|
||||
/* The two fetch overrides, one more pair of toggles in the affinity
|
||||
buttons' fragment beside them, in a group of their own since they are
|
||||
global rather than an agent's stance (app/jobs/reach.py). Fetching has
|
||||
two filters, and by default a company follows the agents on both:
|
||||
- All countries reads its big boards (300 roles or more) with the
|
||||
agents' wide reach, Europe today, rather than their places.
|
||||
- All roles reads them with no role-type narrowing: none of the agents'
|
||||
fetch terms, which only apply with the wide reach, and none of the
|
||||
role filters that may come later.
|
||||
On queues a pull on the server, as the other reopening switches do; off
|
||||
asks nothing, since no role closes until the next pull reads the board
|
||||
with its filters again. `company` is the shared list's row;
|
||||
`onChange` runs after the server accepted a switch, with the company it
|
||||
answered. */
|
||||
const OVERRIDES = [
|
||||
{ value: "countries", field: "all_countries", path: "all-countries", text: "All countries",
|
||||
on: "All countries is on: this company's big boards are read across the agents' wide "
|
||||
+ "reach (Europe), not only the agents' places. The default is the agents' places. "
|
||||
+ "Boards under 300 roles are read whole either way. Turning it off asks nothing "
|
||||
+ "first: no role closes until the next pull reads the board again.",
|
||||
off: "All countries: read this company's big boards across the agents' wide reach "
|
||||
+ "(Europe) instead of the agents' places, the default. Boards under 300 roles are "
|
||||
+ "read whole already. Turning it on queues a pull.",
|
||||
said: (on) => (on ? "all countries in the agents' wide reach" : "the agents' places") },
|
||||
{ value: "roles", field: "all_roles", path: "all-roles", text: "All roles",
|
||||
on: "All roles is on: this company's boards are read with no role-type narrowing, "
|
||||
+ "none of the agents' fetch terms. The default follows the terms, which only apply "
|
||||
+ "with All countries or on a host that cannot ask for each country. Turning it off "
|
||||
+ "asks nothing first.",
|
||||
off: "All roles: no role-type narrowing for this company, none of the agents' fetch "
|
||||
+ "terms, the default, nor later role filters. The terms only apply with All "
|
||||
+ "countries or on a host that cannot ask for each country, so on its own this "
|
||||
+ "changes nothing today. Turning it on queues a pull.",
|
||||
said: (on) => (on ? "every role type" : "the agents' terms") },
|
||||
];
|
||||
|
||||
function overridesControl(companyKey, company, onChange) {
|
||||
const span = document.createElement("span");
|
||||
span.className = "affinity";
|
||||
span.setAttribute("role", "group");
|
||||
span.setAttribute("aria-label", "Company tag");
|
||||
const button = document.createElement("button");
|
||||
button.type = "button";
|
||||
button.dataset.value = "all";
|
||||
button.textContent = "All";
|
||||
button.title = current
|
||||
? "All roles within the agents' wide reach (Europe), not only their places. Turning it "
|
||||
+ "off asks nothing first: no role closes until the next pull reads the board again."
|
||||
: "All roles: read this company's boards for all roles within the agents' wide reach "
|
||||
+ "(Europe), not only their places. Turning it on queues a pull.";
|
||||
button.setAttribute("aria-label", "All roles");
|
||||
button.setAttribute("aria-pressed", String(Boolean(current)));
|
||||
button.addEventListener("click", () => setAllRoles(companyKey, !current, onChange));
|
||||
span.appendChild(button);
|
||||
span.setAttribute("aria-label", "Fetch overrides");
|
||||
for (const o of OVERRIDES) {
|
||||
const current = Boolean(company && company[o.field]);
|
||||
const button = document.createElement("button");
|
||||
button.type = "button";
|
||||
button.dataset.value = o.value;
|
||||
button.textContent = o.text;
|
||||
button.title = current ? o.on : o.off;
|
||||
button.setAttribute("aria-label", o.text);
|
||||
button.setAttribute("aria-pressed", String(current));
|
||||
button.addEventListener("click", () => setOverride(companyKey, o, !current, onChange));
|
||||
span.appendChild(button);
|
||||
}
|
||||
return span;
|
||||
}
|
||||
|
||||
async function setAllRoles(companyKey, on, onChange) {
|
||||
async function setOverride(companyKey, o, on, onChange) {
|
||||
if (!companyKey) return;
|
||||
let updated;
|
||||
try {
|
||||
updated = await api(`/api/companies/${encodeURIComponent(companyKey)}/all-roles`, {
|
||||
updated = await api(`/api/companies/${encodeURIComponent(companyKey)}/${o.path}`, {
|
||||
method: "POST", body: { on },
|
||||
});
|
||||
} catch (err) {
|
||||
return;
|
||||
}
|
||||
const company = companies.get(companyKey);
|
||||
if (company) company.all_roles = Boolean(updated.all_roles);
|
||||
if (company) {
|
||||
company.all_countries = Boolean(updated.all_countries);
|
||||
company.all_roles = Boolean(updated.all_roles);
|
||||
}
|
||||
window.toast.info(on
|
||||
? `${updated.name}: all roles within the agents' wide reach. `
|
||||
+ "Reading now, or with the pull right after."
|
||||
: `${updated.name}: back to its reach from the next pull.`);
|
||||
? `${updated.name}: ${o.said(true)}. Reading now, or with the pull right after.`
|
||||
: `${updated.name}: back to ${o.said(false)} from the next pull.`);
|
||||
if (onChange) await onChange(updated);
|
||||
}
|
||||
|
||||
Object.assign(window, {
|
||||
api, count, cell, debounce, safeUrl, companies, loadCompanies, affinityControl, setAffinity,
|
||||
allRolesControl,
|
||||
overridesControl,
|
||||
});
|
||||
})();
|
||||
+23
-15
@@ -5,8 +5,8 @@
|
||||
* joined with each company's board subscription — its id and whether it is
|
||||
* on — so nothing here fetches `/api/sources` as well. The affinity buttons
|
||||
* are `affinityControl`, the same ones the Roles tab and the read page draw,
|
||||
* and beside them `allRolesControl`, the All roles tag, which is global and
|
||||
* drawn with or without an agent.
|
||||
* and beside them `overridesControl`, the two fetch overrides All countries
|
||||
* and All roles, which are global and drawn with or without an agent.
|
||||
*
|
||||
* Liked and hidden are per search agent, so the `#c-agent` select above the
|
||||
* list says whose the list shows and whose the buttons set. It opens on the
|
||||
@@ -20,18 +20,20 @@
|
||||
* `/api/companies/{key}/board`, which reads the board once before keeping
|
||||
* it; Detach stops reading it and keeps the company.
|
||||
*
|
||||
* A row with a board says what a pull asks it for ("reads DK, SE · agents",
|
||||
* `reach` from app/jobs/reach.py), and its editor has a second line that
|
||||
* sets the board's own reach: the agents', or its own countries and remote,
|
||||
* posted to `/api/sources/{id}/reach`. All roles within the agents' wide
|
||||
* reach (Europe) is the company's All roles tag instead, which the board's
|
||||
* own countries win over.
|
||||
* A row with a board says what a pull asks it for, countries first and role
|
||||
* types second ("reads follows agents: DK, SE, remote · all roles", `reach`
|
||||
* from app/jobs/reach.py), so the row shows whether the company follows the
|
||||
* agents' filters or overrides them. Its editor has a second line that sets
|
||||
* the board's own reach: the agents', or its own countries and remote,
|
||||
* posted to `/api/sources/{id}/reach`. The wide reach (Europe) and no role
|
||||
* narrowing are the company's two overrides instead, and the board's own
|
||||
* countries win over All countries.
|
||||
*/
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
api, count, debounce, safeUrl, companies, loadCompanies, affinityControl, allRolesControl,
|
||||
api, count, debounce, safeUrl, companies, loadCompanies, affinityControl, overridesControl,
|
||||
} = window;
|
||||
const $ = (sel, root = document) => root.querySelector(sel);
|
||||
|
||||
@@ -212,8 +214,8 @@
|
||||
}
|
||||
|
||||
/** The open row's reach editor, for a row with a board: the agents' reach
|
||||
or the board's own countries and remote. The wide reach is the
|
||||
company's All roles tag, which the editor points to. */
|
||||
or the board's own countries and remote. The editor points to the
|
||||
company's two overrides, which are set beside the stars. */
|
||||
function reachEditor(company, rerender) {
|
||||
if (company.subscription_id == null) return null;
|
||||
const own = company.reach_params || {};
|
||||
@@ -244,9 +246,14 @@
|
||||
shown();
|
||||
const note = document.createElement("span");
|
||||
note.className = "muted small";
|
||||
note.textContent = company.all_roles
|
||||
? "The All roles tag is on; a reach set here wins over it."
|
||||
: "All roles within the agents' wide reach (Europe): the All tag beside the stars.";
|
||||
note.textContent = [
|
||||
company.all_countries
|
||||
? "All countries is on; countries set here win over it."
|
||||
: "All countries, beside the stars, reads the agents' wide reach (Europe).",
|
||||
company.all_roles
|
||||
? "All roles is on: no fetch terms."
|
||||
: "All roles drops the agents' fetch terms.",
|
||||
].join(" ");
|
||||
form.append(mode, codes, remote, save, note);
|
||||
form.addEventListener("submit", async (event) => {
|
||||
event.preventDefault();
|
||||
@@ -309,6 +316,7 @@
|
||||
case "favourite": return company.affinity === 2;
|
||||
case "liked": return company.affinity === 1;
|
||||
case "hidden": return company.affinity === -1;
|
||||
case "all_countries": return company.all_countries === true;
|
||||
case "all_roles": return company.all_roles === true;
|
||||
case "on": return company.on === true;
|
||||
case "off": return company.on === false;
|
||||
@@ -343,7 +351,7 @@
|
||||
if (agent != null) {
|
||||
row.appendChild(affinityControl(company.key, company.affinity, async () => render(), agent));
|
||||
}
|
||||
row.appendChild(allRolesControl(company.key, company.all_roles, async () => {
|
||||
row.appendChild(overridesControl(company.key, company, async () => {
|
||||
await loadCompanies(agentId());
|
||||
render();
|
||||
}));
|
||||
|
||||
+10
-10
@@ -81,7 +81,7 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
const { api, esc, debounce, safeUrl, companies, loadCompanies, affinityControl, allRolesControl,
|
||||
const { api, esc, debounce, safeUrl, companies, loadCompanies, affinityControl, overridesControl,
|
||||
judgeButtons, loadTracked, chipInput } = window;
|
||||
const $ = (sel, root = document) => root.querySelector(sel);
|
||||
|
||||
@@ -1071,19 +1071,19 @@
|
||||
el.querySelector(".strip-drop").onclick = dropCompany;
|
||||
}
|
||||
const slot = el.querySelector(".affinity-slot");
|
||||
const drawn = `${affinity}:${company ? company.all_roles : ""}`;
|
||||
const drawn = `${affinity}:${company ? `${company.all_countries}:${company.all_roles}` : ""}`;
|
||||
if (slot.dataset.affinity !== drawn) {
|
||||
slot.dataset.affinity = drawn;
|
||||
slot.replaceChildren(affinityControl(key, affinity,
|
||||
(updated) => affinityChanged(key, company, updated), state.filter.agent));
|
||||
// The All roles tag needs a company row, which a first stance makes.
|
||||
if (company) slot.append(" ", allRolesControl(key, company.all_roles, renderStrip));
|
||||
// The two overrides need a company row, which a first stance makes.
|
||||
if (company) slot.append(" ", overridesControl(key, company, renderStrip));
|
||||
// What ★ does, before; what it did, after.
|
||||
el.querySelector(".strip-note").textContent = affinity === 2
|
||||
? "★ Favourite: roles from every place the agent's required gates allow are listed. "
|
||||
+ "All fetches them from a big board."
|
||||
+ "All countries fetches them from a big board."
|
||||
: "★ Favourite also lists this company's roles outside your places, as far as the "
|
||||
+ "agent's required gates allow. All fetches them from a big board.";
|
||||
+ "agent's required gates allow. All countries fetches them from a big board.";
|
||||
}
|
||||
const n = state.total;
|
||||
el.querySelector(".strip-count").textContent = state.loaded
|
||||
@@ -1362,9 +1362,9 @@
|
||||
}
|
||||
|
||||
/* The company's ★ ▲ ⊘, the one place a company is judged outside the
|
||||
Companies page, and its All roles tag beside them. A company seen only
|
||||
through a search has no row until its first change creates one, so the
|
||||
list is reloaded then, and the tag, which needs a row, waits for it. A
|
||||
Companies page, and its two fetch overrides beside them. A company seen
|
||||
only through a search has no row until its first change creates one, so
|
||||
the list is reloaded then, and the overrides, which need a row, wait for it. A
|
||||
change dims or undims its rows in the feed. */
|
||||
function renderAffinity(slot, r) {
|
||||
const company = companies.get(r.company_key);
|
||||
@@ -1375,7 +1375,7 @@
|
||||
renderFeed();
|
||||
}, state.filter.agent));
|
||||
if (company) {
|
||||
slot.append(" ", allRolesControl(r.company_key, company.all_roles,
|
||||
slot.append(" ", overridesControl(r.company_key, company,
|
||||
async () => renderAffinity(slot, r)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user