fix: filter observer autocomplete to is_observer nodes

The Route UI's observer search was hitting GET /api/v1/nodes without
the observer filter, showing all nodes instead of only observer nodes.
The backend already supports ?observer=true via an indexed column —
just needed to pass the param from handleObsSearch and handleObsKeydown.
This commit is contained in:
Louis King
2026-07-13 16:08:51 +01:00
parent 1e87b7abb5
commit 8a1b6d787a
@@ -647,7 +647,7 @@ export async function render(container, params, router) {
_obsSearchTimer = setTimeout(async () => {
const myId = ++_obsSearchId;
try {
const data = await apiGet('/api/v1/nodes', { search: q, limit: 10 });
const data = await apiGet('/api/v1/nodes', { search: q, limit: 10, observer: true });
if (myId !== _obsSearchId) return;
modalState.obsResults = data.items || [];
renderPage(routes);
@@ -679,11 +679,11 @@ export async function render(container, params, router) {
const query = e.target.value.trim();
if (query.length < 2) return;
clearTimeout(_obsSearchTimer);
const myId = ++_obsSearchId;
try {
const data = await apiGet('/api/v1/nodes', { search: query, limit: 10 });
if (myId !== _obsSearchId) return;
modalState.obsResults = data.items || [];
const myId = ++_obsSearchId;
try {
const data = await apiGet('/api/v1/nodes', { search: query, limit: 10, observer: true });
if (myId !== _obsSearchId) return;
modalState.obsResults = data.items || [];
renderPage(routes);
const filtered = modalState.obsResults.filter(
n => !modalState.observerNodes.some(on => on.public_key === n.public_key)