crates/server: update templates with improved dashboard and styling
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I07f9de61588f61aae003f78c30fd6d326a6a6964
This commit is contained in:
parent
92153bf9aa
commit
b4d3c9d501
14 changed files with 1139 additions and 609 deletions
|
|
@ -12,8 +12,9 @@
|
|||
<h1>Projects</h1>
|
||||
|
||||
{% if is_admin %}
|
||||
<p class="action-bar"><a href="/projects/new" class="btn">New Project (Setup Wizard)</a></p>
|
||||
<details>
|
||||
<summary>New Project</summary>
|
||||
<summary>Quick create (no probe)</summary>
|
||||
<div class="form-card">
|
||||
<form id="create-project-form">
|
||||
<div class="form-group">
|
||||
|
|
@ -36,8 +37,16 @@
|
|||
{% endif %}
|
||||
|
||||
{% if projects.is_empty() %}
|
||||
<p class="empty">No projects yet.</p>
|
||||
<div class="empty">
|
||||
<div class="empty-title">No projects yet</div>
|
||||
{% if is_admin %}
|
||||
<div class="empty-hint">Create a project using the button above to get started.</div>
|
||||
{% else %}
|
||||
<div class="empty-hint">Projects will appear here once an administrator creates them.</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th>Name</th><th>Repository</th><th>Created</th></tr>
|
||||
|
|
@ -52,7 +61,8 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if total_pages > 1 %}
|
||||
<div class="pagination">
|
||||
{% if has_prev %}
|
||||
<a href="/projects?offset={{ prev_offset }}&limit={{ limit }}">« Previous</a>
|
||||
|
|
@ -62,6 +72,8 @@
|
|||
<a href="/projects?offset={{ next_offset }}&limit={{ limit }}">Next »</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
{% if is_admin %}
|
||||
|
|
@ -79,14 +91,13 @@ document.getElementById('create-project-form')?.addEventListener('submit', async
|
|||
description: document.getElementById('project-desc').value || null,
|
||||
}),
|
||||
});
|
||||
if (res.ok) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
const err = await res.json();
|
||||
msg.innerHTML = '<div class="flash-message flash-error">' + (err.error || 'Error') + '</div>';
|
||||
if (!res.ok) {
|
||||
const err = await res.json().catch(() => ({ error: res.statusText }));
|
||||
throw new Error(err.error || err.message || 'Unknown error');
|
||||
}
|
||||
} catch(e) {
|
||||
msg.innerHTML = '<div class="flash-message flash-error">Request failed</div>';
|
||||
window.location.reload();
|
||||
} catch(err) {
|
||||
showError(msg, err.message);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue