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
+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,
|
||||
});
|
||||
})();
|
||||
Reference in new issue
Block a user