Files
api7-demo/web/templates/users.html
d.viti ed660dce5a
Some checks failed
Helm Chart Build / lint-only (push) Has been skipped
Helm Chart Build / build-helm (push) Successful in 9s
Build and Deploy / build-api (push) Successful in 33s
Build and Deploy / build-web (push) Failing after 41s
Add LLM endpoints, web frontend, and rate limiting config
- Added OpenAI-compatible LLM endpoints to API backend - Introduced web
frontend with Jinja2 templates and static assets - Implemented API proxy
routes in web service - Added sample db.json data for items, users,
orders, reviews, categories, llm_requests - Updated ADC and Helm configs
for separate AI and standard rate limiting - Upgraded FastAPI, Uvicorn,
and added httpx, Jinja2, python-multipart dependencies - Added API
configuration modal and client-side JS for web app
2025-10-07 17:29:12 +02:00

70 lines
1.8 KiB
HTML

{% extends "base.html" %}
{% block title %}Users - API Demo{% endblock %}
{% block content %}
<div class="page-header">
<h1>👥 Users</h1>
<p>Manage user accounts</p>
</div>
<div class="table-container">
<table class="data-table">
<thead>
<tr>
<th>ID</th>
<th>Username</th>
<th>Email</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody id="users-table-body">
<tr>
<td colspan="5" class="loading">Loading users...</td>
</tr>
</tbody>
</table>
</div>
{% endblock %}
{% block scripts %}
<script>
const API_BASE = '/api';
async function loadUsers() {
try {
const response = await fetch(`${API_BASE}/users`);
const users = await response.json();
const tbody = document.getElementById('users-table-body');
tbody.innerHTML = users.map(user => `
<tr>
<td>${user.id}</td>
<td>${user.username}</td>
<td>${user.email}</td>
<td>
<span class="badge ${user.active ? 'badge-success' : 'badge-danger'}">
${user.active ? 'Active' : 'Inactive'}
</span>
</td>
<td>
<button class="btn btn-sm" onclick="viewUser(${user.id})">View</button>
</td>
</tr>
`).join('');
} catch (error) {
console.error('Error loading users:', error);
document.getElementById('users-table-body').innerHTML =
'<tr><td colspan="5" class="error">Failed to load users</td></tr>';
}
}
function viewUser(id) {
alert(`View user details for ID: ${id}\n\nAPI Endpoint: /api/users/${id}`);
}
loadUsers();
</script>
{% endblock %}