Show Viewing as on Roles as a select, also with one agent
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
6124b00062
commit
4b722744a7
5 files changed
+9
-16
No files matched your search
+3
-6
@@ -410,16 +410,15 @@
|
||||
$("#rail-toggle").setAttribute("aria-expanded", String(state.railOpen));
|
||||
}
|
||||
|
||||
/* Viewing as: a select with two or more agents, the name with one, and
|
||||
/* Viewing as: a select of the enabled agents, also when there is one, and
|
||||
with none a sentence and the way to make one. Nothing until the agents
|
||||
are in, so a page with agents never says it has none. */
|
||||
function renderAgent() {
|
||||
const agents = state.agents;
|
||||
const select = $("#agent");
|
||||
select.hidden = agents.length < 2;
|
||||
$("#agent-one").hidden = agents.length !== 1;
|
||||
select.hidden = !agents.length;
|
||||
$("#agent-none").hidden = !state.agentsLoaded || agents.length > 0;
|
||||
if (agents.length > 1) {
|
||||
if (agents.length) {
|
||||
// Rebuilt only when the agents changed, since the rail is drawn again on
|
||||
// every filter and a rebuild shuts a select that is open.
|
||||
const key = agents.map((a) => `${a.id}:${a.name}`).join("\n");
|
||||
@@ -430,8 +429,6 @@
|
||||
select.value = String(state.filter.agent);
|
||||
// A long name is cut at the rail's edge; the whole of it is a hover away.
|
||||
select.title = select.selectedOptions[0]?.text || "";
|
||||
} else if (agents.length === 1) {
|
||||
$("#agent-one").textContent = agents[0].name;
|
||||
} else if (state.agentsLoaded) {
|
||||
$("#agent-none").innerHTML = `No search agent is enabled, so nothing is ranked.
|
||||
<a href="/settings/agents">Search agents</a> sets one up.`;
|
||||
|
||||
Reference in new issue
Block a user