()
| 2070 | } |
| 2071 | |
| 2072 | async function loadUsers() { |
| 2073 | const data = await api("/api/users"); |
| 2074 | state.users = data.users && data.users.length ? data.users.map(normalizeUser) : [normalizeUser("user_demo")]; |
| 2075 | const ids = state.users.map((user) => user.user_id); |
| 2076 | const current = state.users.find((user) => user.is_current) || state.users[0]; |
| 2077 | if (!ids.includes(state.currentUser)) state.currentUser = current.user_id; |
| 2078 | $("userSelect").innerHTML = state.users.map((user) => `<option value="${escapeHtml(user.user_id)}">${escapeHtml(user.label)}</option>`).join(""); |
| 2079 | $("userSelect").value = state.currentUser; |
| 2080 | if ($("profileUserId")) $("profileUserId").value = state.currentUser; |
| 2081 | } |
| 2082 | |
| 2083 | async function loadHealth() { |
| 2084 | const data = await api("/api/health"); |
no test coverage detected