Initial commit: Portal Auth Admin Dashboard
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
63
templates/table.html
Normal file
63
templates/table.html
Normal file
@@ -0,0 +1,63 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}{{ table_name }} — Portal Auth Admin{% endblock %}
|
||||
{% block content %}
|
||||
<div class="table-page">
|
||||
<div class="table-header">
|
||||
<h1>Table: <code>{{ table_name }}</code></h1>
|
||||
<div class="table-header-actions">
|
||||
{% if table_name == 'users' %}
|
||||
<a href="{{ url_for('user_new') }}" class="btn-primary">Add user</a>
|
||||
{% endif %}
|
||||
<a href="{{ url_for('index') }}" class="back">← Dashboard</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-wrapper">
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
{% for key in columns %}
|
||||
<th>{{ key }}</th>
|
||||
{% endfor %}
|
||||
{% if table_name in ['users', 'sessions', 'api_tokens'] %}
|
||||
<th class="actions">Actions</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for row in rows %}
|
||||
<tr>
|
||||
{% for key in columns %}
|
||||
<td title="{{ row.get(key, '') }}">{{ (row.get(key, ''))[:80] }}{% if row.get(key, '') and (row.get(key, ''))|length > 80 %}…{% endif %}</td>
|
||||
{% endfor %}
|
||||
{% if table_name == 'users' and raw_rows %}
|
||||
<td class="actions">
|
||||
<a href="{{ url_for('table_edit_user', name='users', pk=raw_rows[loop.index0].id) }}">Edit</a>
|
||||
<a href="{{ url_for('user_password', pk=raw_rows[loop.index0].id) }}">Password</a>
|
||||
</td>
|
||||
{% elif table_name == 'sessions' and raw_rows %}
|
||||
<td class="actions">
|
||||
<form method="post" action="{{ url_for('session_delete') }}" class="inline-form" onsubmit="return confirm('Revoke this session?');">
|
||||
<input type="hidden" name="session_id" value="{{ raw_rows[loop.index0].session_id }}">
|
||||
<button type="submit">Revoke</button>
|
||||
</form>
|
||||
</td>
|
||||
{% elif table_name == 'api_tokens' and raw_rows %}
|
||||
<td class="actions">
|
||||
<form method="post" action="{{ url_for('api_token_toggle', pk=raw_rows[loop.index0].id) }}" class="inline-form">
|
||||
<button type="submit">{{ 'Deactivate' if row.is_active == 'True' else 'Activate' }}</button>
|
||||
</form>
|
||||
<form method="post" action="{{ url_for('api_token_delete', pk=raw_rows[loop.index0].id) }}" class="inline-form" onsubmit="return confirm('Delete this token?');">
|
||||
<button type="submit" class="danger">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% if not rows %}
|
||||
<p class="empty">No rows.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user