171 lines
8.9 KiB
HTML
171 lines
8.9 KiB
HTML
{% extends "base.html" %}
|
|
{% load static i18n %}
|
|
|
|
{% block title %}{% trans "Sources" %}{% endblock %}
|
|
|
|
{% block content %}
|
|
|
|
<div class="container-fluid">
|
|
<nav aria-label="breadcrumb">
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item"><a href="{% url 'settings' %}" class="text-decoration-none text-secondary">{% trans "Settings" %}</a></li>
|
|
<li class="breadcrumb-item active" aria-current="page" style="
|
|
color: #F43B5E; /* Rosy Accent Color */
|
|
font-weight: 600;
|
|
">{% trans "Sources Settings" %}</li>
|
|
</ol>
|
|
</nav>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h1 class="h3 mb-0">{% trans "Integration Sources" %}</h1>
|
|
<a href="{% url 'source_create' %}" class="btn btn-main-action">
|
|
{% trans "Create Source for Integration" %} <i class="fas fa-plus"></i>
|
|
</a>
|
|
</div>
|
|
|
|
<!-- Search and Filters -->
|
|
<div class="card mb-4">
|
|
<div class="card-body">
|
|
<form method="get" class="row g-3">
|
|
<div class="col-md-8">
|
|
<div class="input-group">
|
|
<span class="input-group-text">
|
|
<i class="fas fa-search"></i>
|
|
</span>
|
|
<input type="text" class="form-control" name="q"
|
|
placeholder="Search sources..." value="{{ search_query }}">
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<button type="submit" class="btn btn-outline-primary">
|
|
<i class="fas fa-search"></i> {% trans "Search" %}
|
|
</button>
|
|
{% if search_query %}
|
|
<a href="{% url 'source_list' %}" class="btn btn-outline-secondary">
|
|
<i class="fas fa-times"></i> {% trans "Clear" %}
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Results Summary -->
|
|
{% if search_query %}
|
|
<div class="alert alert-info">
|
|
Found {{ total_sources }} source{{ total_sources|pluralize }} matching "{{ search_query }}"
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Sources Table -->
|
|
<div class="card">
|
|
<div class="card-body">
|
|
{% if page_obj %}
|
|
<div class="table-responsive">
|
|
<table class="table table-hover">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>{% trans "Name" %}</th>
|
|
<th>{% trans "Type" %}</th>
|
|
<th>{% trans "Status" %}</th>
|
|
<th>{% trans "API Key" %}</th>
|
|
<th>{% trans "Created" %}</th>
|
|
<th>{% trans "Actions" %}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
{% for source in page_obj %}
|
|
<tr>
|
|
<td>
|
|
<a href="{% url 'source_detail' source.pk %}" class="text-decoration-none text-primary-theme">
|
|
<strong>{{ source.name }}</strong>
|
|
</a>
|
|
|
|
</td>
|
|
<td>
|
|
<span class="badge bg-primary-theme">{{ source.source_type }}</span>
|
|
</td>
|
|
<td>
|
|
{% if source.is_active %}
|
|
<span class="badge bg-primary-theme">{% trans "Active" %}</span>
|
|
{% else %}
|
|
<span class="badge bg-primary-theme">{% trans "Inactive" %}</span>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
<code class="small text-primary-theme">{{ source.api_key|truncatechars:20 }}</code>
|
|
</td>
|
|
<td>
|
|
<small class="text-muted">{{ source.created_at|date:"M d, Y" }}</small>
|
|
</td>
|
|
<td>
|
|
<div class="btn-group" role="group">
|
|
<a href="{% url 'source_detail' source.pk %}"
|
|
class="btn btn-sm btn-outline-primary" title="View">
|
|
<i class="fas fa-eye"></i>
|
|
</a>
|
|
<a href="{% url 'source_update' source.pk %}"
|
|
class="btn btn-sm btn-outline-secondary" title="Edit">
|
|
<i class="fas fa-edit"></i>
|
|
</a>
|
|
{% comment %} <button type="button"
|
|
class="btn btn-sm btn-outline-warning"
|
|
hx-post="{% url 'toggle_source_status' source.pk %}"
|
|
hx-confirm="Are you sure you want to {{ source.is_active|yesno:'deactivate,activate' }} this source?"
|
|
title="{{ source.is_active|yesno:'Deactivate,Activate' }}">
|
|
<i class="fas fa-{{ source.is_active|yesno:'pause,play' }}"></i>
|
|
</button> {% endcomment %}
|
|
{% comment %} <a href="{% url 'source_delete' source.pk %}"
|
|
class="btn btn-sm btn-outline-danger" title="Delete">
|
|
<i class="fas fa-trash"></i>
|
|
</a> {% endcomment %}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
|
|
{% include "includes/paginator.html" %}
|
|
{% else %}
|
|
<div class="text-center py-5">
|
|
<i class="fas fa-database fa-3x text-muted mb-3"></i>
|
|
<h5 class="text-muted">{% trans "No sources found" %}</h5>
|
|
<p class="text-muted">
|
|
{% if search_query %}
|
|
{% blocktrans with query=query %}No sources match your search criteria "{{ query }}".{% endblocktrans %}
|
|
{% else %}
|
|
{% trans "Get started by creating your first source." %}
|
|
{% endif %}
|
|
</p>
|
|
<a href="{% url 'source_create' %}" class="btn btn-main-action">
|
|
<i class="fas fa-plus"></i> {% trans "Create Source" %}
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block customJS %}
|
|
<script>
|
|
// Auto-refresh after status toggle
|
|
document.body.addEventListener('htmx:afterRequest', function(evt) {
|
|
if (evt.detail.successful) {
|
|
// Reload the page after a short delay to show updated status
|
|
setTimeout(() => {
|
|
window.location.reload();
|
|
}, 500);
|
|
}
|
|
});
|
|
</script>
|
|
{% endblock %}
|