The top bar is Roles and Applications plus health's cog. Behind the cog,
/settings/{ranking,searches,companies,pulls,messages,account} share one row
of sub-tabs, an underlined row on a desktop and pills on a phone. The old
paths answer 301 with their query string.
Ranking edits the first enabled agent, or creates one, with the intent,
the weights and the gates under Advanced. The order menu on Roles reads
Newest and Best match with one enabled agent, and names them with several.
config.yaml keeps the Copenhagen starter; the other two are commented
examples in config.example.yaml.
roles.js is split into roles.js, applications.js, ranking.js and
companies.js; count, cell, debounce, the company list and the affinity
control live once in app.js. app.css gets the phone frame after health and
newsdesk: one-row bar, edge-to-edge panels, 44px targets and 16px fields on
a coarse pointer, hover only where there is one, safe areas. The app is
installable from a manifest and roledesk-coloured icons. Every lede touched
is written for the person using the app.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
67 lines
2.2 KiB
JavaScript
67 lines
2.2 KiB
JavaScript
/* The Pulls page: a button per kind.
|
|
*
|
|
* The list comes from `/api/jobs/kinds`, which is the registry, so a new
|
|
* `@job` in `app/jobs.py` is a new button and this file is not edited. What
|
|
* the queue is doing is `<desk-jobs>`'s business, and it draws itself.
|
|
*
|
|
* Failures are the server's sentence through `api()`, which toasts it -- so
|
|
* there is no error handling here beyond keeping the button usable.
|
|
*/
|
|
|
|
(function () {
|
|
"use strict";
|
|
|
|
const host = document.getElementById("kinds");
|
|
if (!host) return;
|
|
|
|
async function start(kind, button) {
|
|
button.disabled = true;
|
|
try {
|
|
const job = await window.api("/api/jobs", { method: "POST", body: { kind } });
|
|
window.toast.good(`${job.label || kind}: queued.`);
|
|
} catch (e) {
|
|
/* already toasted */
|
|
} finally {
|
|
button.disabled = false;
|
|
}
|
|
}
|
|
|
|
async function draw() {
|
|
let kinds;
|
|
try {
|
|
kinds = await window.api("/api/jobs/kinds");
|
|
} catch (e) {
|
|
host.innerHTML = '<span class="muted">could not read the job kinds</span>';
|
|
return;
|
|
}
|
|
if (!kinds.length) {
|
|
host.innerHTML = '<span class="muted">nothing is registered</span>';
|
|
return;
|
|
}
|
|
host.innerHTML = "";
|
|
kinds.forEach((k) => {
|
|
const button = document.createElement("button");
|
|
button.type = "button";
|
|
button.textContent = k.label || k.kind;
|
|
button.title = k.solo ? `${k.kind} -- one at a time` : k.kind;
|
|
button.dataset.kind = k.kind;
|
|
button.addEventListener("click", () => start(k.kind, button));
|
|
host.appendChild(button);
|
|
});
|
|
}
|
|
|
|
/* `<desk-jobs>` takes up no space while the queue is idle, so the line that
|
|
says so is the app's to show and hide. Off the same socket the element
|
|
reads, through live.js, rather than by asking the element: it keeps to a
|
|
shadow root and owes nobody an answer about its own height. */
|
|
document.addEventListener("app:jobs", (e) => {
|
|
const idle = document.getElementById("idle");
|
|
if (!idle) return;
|
|
const state = e.detail || {};
|
|
const busy = (state.running || []).length + (state.queued || []).length;
|
|
idle.hidden = busy > 0;
|
|
});
|
|
|
|
document.addEventListener("DOMContentLoaded", draw);
|
|
})();
|