Files
DocsMCP/webui/app/templates/libraries.html
T
2026-06-05 23:02:55 +01:00

74 lines
3.0 KiB
HTML

{% extends "base.html" %}
{% block title %}Libraries - Context7 Docs{% endblock %}
{% block content %}
<h1>Libraries</h1>
<!-- Create Library Form -->
<div class="create-form">
<form method="post" action="/libraries/create">
<label for="new_library_id">Library ID:</label>
<input type="text" id="new_library_id" name="library_id" placeholder="e.g., foundryvtt" required>
<label for="new_name">Name:</label>
<input type="text" id="new_name" name="name" placeholder="Display name for this library" required>
<label for="new_description">Description (optional):</label>
<input type="text" id="new_description" name="description" placeholder="Brief description...">
<button type="submit" class="btn btn-primary">Create Library</button>
</form>
</div>
<hr>
<!-- Libraries Table -->
<table class="library-table">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Description</th>
<th>Source Path</th>
<th>Updated At</th>
<th>Actions</th>
</tr>
</thead>
<tbody id="libraries-body">
{% if data|length > 0 %}
{% for lib in data %}
<tr class="{% if lib.source_path and 'foundry' in (lib.source_path or '').lower() %}highlight{% endif %}">
<td><code>{{ escapeHtml(lib.id) }}</code></td>
<td><strong>{{ escapeHtml(lib.name) }}</strong></td>
<td>{{ escapeHtml(lib.description) or '-' }}</td>
<td><small>{{ escapeHtml(lib.source_path) or '-' }}</small></td>
<td><small>{{ lib.updated_at|default('N/A') }}</small></td>
<td class="actions">
<a href="/libraries/{{ lib.id }}/docs" class="btn btn-sm btn-info">View Docs</a> |
<form method="post" action="/libraries/{{ lib.id }}/ingest" style="display:inline;"
onsubmit="return confirm('Trigger ingestion for this library?');">
<button type="submit" class="btn btn-sm btn-warning">Ingest</button>
</form> |
<form method="post" action="/libraries/{{ lib.id }}/delete"
onsubmit="return confirm('Delete this library and all its contents? This cannot be undone.');">
<button type="submit" class="btn btn-sm btn-danger">Delete</button>
</form>
</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td colspan="6" style="text-align:center;">No libraries found. Create one above.</td>
</tr>
{% endif %}
</tbody>
</table>
{% if data and data[0] and data[0].get('content') %}
<!-- Docs view mode -->
<pre class="code-block">{% for chunk in data.get('content', []) %}{% if chunk|length > 0 %}{{ chunk.text | default(chunk.content) | default(chunk) }}{% endif %}{% endfor %}</pre>
<a href="/libraries" style="display:block;margin-top:20px;">← Back to Libraries</a>
{% endif %}
{% endblock %}