feat(migrations): Rename indexes and update global integration settings fields for improved clarity and functionality
feat(admin): Add API monitoring, debug console, and system health templates for enhanced admin interface docs: Add AI system cleanup summary and audit report detailing architecture, token management, and recommendations docs: Introduce credits and tokens system guide outlining configuration, data flow, and monitoring strategies
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
{% extends "admin/base_site.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}{{ page_title }} | Django Admin{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="api-monitor">
|
||||
<h1>{{ page_title }}</h1>
|
||||
|
||||
<div class="api-summary" style="margin: 20px 0; padding: 20px; border-radius: 8px; background: #f8f9fa; border: 1px solid #dee2e6;">
|
||||
<h2 style="margin: 0 0 15px 0;">API Health Overview</h2>
|
||||
<div style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px;">
|
||||
<div style="padding: 15px; background: white; border-radius: 8px; border: 1px solid #dee2e6; text-align: center;">
|
||||
<div style="font-size: 32px; font-weight: bold; color: #333;">{{ stats.total }}</div>
|
||||
<div style="color: #666; margin-top: 5px;">Total Endpoints</div>
|
||||
</div>
|
||||
<div style="padding: 15px; background: white; border-radius: 8px; border: 1px solid #28a745; text-align: center;">
|
||||
<div style="font-size: 32px; font-weight: bold; color: #28a745;">{{ stats.healthy }}</div>
|
||||
<div style="color: #666; margin-top: 5px;">Healthy</div>
|
||||
</div>
|
||||
<div style="padding: 15px; background: white; border-radius: 8px; border: 1px solid #ffc107; text-align: center;">
|
||||
<div style="font-size: 32px; font-weight: bold; color: #ffc107;">{{ stats.warnings }}</div>
|
||||
<div style="color: #666; margin-top: 5px;">Warnings</div>
|
||||
</div>
|
||||
<div style="padding: 15px; background: white; border-radius: 8px; border: 1px solid #dc3545; text-align: center;">
|
||||
<div style="font-size: 32px; font-weight: bold; color: #dc3545;">{{ stats.errors }}</div>
|
||||
<div style="color: #666; margin-top: 5px;">Errors</div>
|
||||
</div>
|
||||
</div>
|
||||
<p style="margin: 15px 0 0 0; color: #666;">Last checked: {{ checked_at|date:"Y-m-d H:i:s" }}</p>
|
||||
</div>
|
||||
|
||||
{% for group in endpoint_groups %}
|
||||
<div class="endpoint-group" style="margin: 20px 0; padding: 20px; border: 1px solid #ddd; border-radius: 8px; background: #fff;">
|
||||
<h3 style="margin: 0 0 15px 0; font-size: 18px; color: #333;">{{ group.name }}</h3>
|
||||
|
||||
<table style="width: 100%; border-collapse: collapse;">
|
||||
<thead>
|
||||
<tr style="background: #f8f9fa; border-bottom: 2px solid #dee2e6;">
|
||||
<th style="padding: 10px; text-align: left; font-weight: 600;">Endpoint</th>
|
||||
<th style="padding: 10px; text-align: center; font-weight: 600; width: 100px;">Method</th>
|
||||
<th style="padding: 10px; text-align: center; font-weight: 600; width: 100px;">Status</th>
|
||||
<th style="padding: 10px; text-align: center; font-weight: 600; width: 120px;">Response Time</th>
|
||||
<th style="padding: 10px; text-align: left; font-weight: 600; width: 150px;">Message</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for endpoint in group.endpoints %}
|
||||
<tr style="border-bottom: 1px solid #eee;">
|
||||
<td style="padding: 10px; font-family: monospace; font-size: 13px;">{{ endpoint.path }}</td>
|
||||
<td style="padding: 10px; text-align: center;">
|
||||
<span style="padding: 3px 8px; background: #6c757d; color: white; border-radius: 4px; font-size: 11px; font-weight: bold;">
|
||||
{{ endpoint.method }}
|
||||
</span>
|
||||
</td>
|
||||
<td style="padding: 10px; text-align: center;">
|
||||
<span style="padding: 3px 12px; background: {% if endpoint.status == 'healthy' %}#28a745{% elif endpoint.status == 'warning' %}#ffc107{% else %}#dc3545{% endif %}; color: white; border-radius: 4px; font-size: 11px; font-weight: bold;">
|
||||
{% if endpoint.status_code %}{{ endpoint.status_code }}{% else %}ERR{% endif %}
|
||||
</span>
|
||||
</td>
|
||||
<td style="padding: 10px; text-align: center; font-family: monospace; color: #666;">
|
||||
{{ endpoint.response_time|default:"—" }}
|
||||
</td>
|
||||
<td style="padding: 10px; color: #666; font-size: 13px;">
|
||||
{{ endpoint.message }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<div style="margin: 20px 0; padding: 15px; background: #f8f9fa; border-radius: 8px;">
|
||||
<p style="margin: 0; color: #666; font-size: 14px;">
|
||||
<strong>Note:</strong> This page tests API endpoints from the server. Authentication-required endpoints may show 401 (expected).
|
||||
<a href="{% url 'admin:monitoring_api_monitor' %}" style="margin-left: 10px;">Refresh Now</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.api-monitor {
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,61 @@
|
||||
{% extends "admin/base_site.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}{{ page_title }} | Django Admin{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="debug-console">
|
||||
<h1>{{ page_title }}</h1>
|
||||
|
||||
<div class="debug-header" style="margin: 20px 0; padding: 20px; border-radius: 8px; background: #fff3cd; border: 1px solid #ffeaa7;">
|
||||
<p style="margin: 0; color: #856404;">
|
||||
<strong>⚠ Read-Only Debug Information</strong><br>
|
||||
This page displays system configuration for debugging purposes. No sensitive data (passwords, API keys) is shown.
|
||||
</p>
|
||||
<p style="margin: 10px 0 0 0; color: #666; font-size: 14px;">
|
||||
Last checked: {{ checked_at|date:"Y-m-d H:i:s" }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{% for section in sections %}
|
||||
<div class="debug-section" style="margin: 20px 0; padding: 20px; border: 1px solid #ddd; border-radius: 8px; background: #fff;">
|
||||
<h3 style="margin: 0 0 15px 0; font-size: 18px; color: #333; padding-bottom: 10px; border-bottom: 2px solid #007bff;">
|
||||
{{ section.title }}
|
||||
</h3>
|
||||
|
||||
<table style="width: 100%; border-collapse: collapse;">
|
||||
{% for key, value in section.items.items %}
|
||||
<tr style="border-bottom: 1px solid #f0f0f0;">
|
||||
<td style="padding: 12px 10px; color: #666; width: 250px; font-weight: 600;">{{ key }}:</td>
|
||||
<td style="padding: 12px 10px; font-family: monospace; color: #333; word-break: break-all;">
|
||||
{% if value is True %}
|
||||
<span style="color: #28a745; font-weight: bold;">✓ True</span>
|
||||
{% elif value is False %}
|
||||
<span style="color: #dc3545; font-weight: bold;">✗ False</span>
|
||||
{% elif value is None %}
|
||||
<span style="color: #6c757d;">None</span>
|
||||
{% else %}
|
||||
{{ value }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<div style="margin: 20px 0; padding: 15px; background: #f8f9fa; border-radius: 8px;">
|
||||
<p style="margin: 0; color: #666; font-size: 14px;">
|
||||
<strong>Security Note:</strong> This console does not display sensitive information like API keys or passwords.
|
||||
For full configuration details, access the Django settings file directly on the server.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.debug-console {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,65 @@
|
||||
{% extends "admin/base_site.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}{{ page_title }} | Django Admin{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="system-health-monitor">
|
||||
<h1>{{ page_title }}</h1>
|
||||
|
||||
<div class="health-summary" style="margin: 20px 0; padding: 20px; border-radius: 8px; background: {% if overall_status == 'healthy' %}#d4edda{% elif overall_status == 'warning' %}#fff3cd{% else %}#f8d7da{% endif %}; border: 1px solid {% if overall_status == 'healthy' %}#c3e6cb{% elif overall_status == 'warning' %}#ffeaa7{% else %}#f5c6cb{% endif %};">
|
||||
<h2 style="margin: 0 0 10px 0; color: {% if overall_status == 'healthy' %}#155724{% elif overall_status == 'warning' %}#856404{% else %}#721c24{% endif %};">
|
||||
{% if overall_status == 'healthy' %}✓{% elif overall_status == 'warning' %}⚠{% else %}✗{% endif %} {{ overall_message }}
|
||||
</h2>
|
||||
<p style="margin: 0; color: #666;">Last checked: {{ checked_at|date:"Y-m-d H:i:s" }}</p>
|
||||
</div>
|
||||
|
||||
<div class="health-checks" style="margin: 20px 0;">
|
||||
{% for check in checks %}
|
||||
<div class="health-check" style="margin: 15px 0; padding: 20px; border: 1px solid #ddd; border-radius: 8px; background: #fff;">
|
||||
<div style="display: flex; align-items: center; margin-bottom: 10px;">
|
||||
<span style="font-size: 24px; margin-right: 10px;">
|
||||
{% if check.status == 'healthy' %}✓{% elif check.status == 'warning' %}⚠{% else %}✗{% endif %}
|
||||
</span>
|
||||
<div style="flex: 1;">
|
||||
<h3 style="margin: 0; font-size: 18px;">{{ check.name }}</h3>
|
||||
<p style="margin: 5px 0 0 0; color: {% if check.status == 'healthy' %}#28a745{% elif check.status == 'warning' %}#ffc107{% else %}#dc3545{% endif %};">
|
||||
{{ check.message }}
|
||||
</p>
|
||||
</div>
|
||||
<span class="badge" style="padding: 5px 15px; border-radius: 12px; font-size: 12px; font-weight: bold; background: {% if check.status == 'healthy' %}#28a745{% elif check.status == 'warning' %}#ffc107{% else %}#dc3545{% endif %}; color: white;">
|
||||
{{ check.status|upper }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{% if check.details %}
|
||||
<div class="details" style="margin-top: 15px; padding-top: 15px; border-top: 1px solid #eee;">
|
||||
<table style="width: 100%; font-size: 14px;">
|
||||
{% for key, value in check.details.items %}
|
||||
<tr>
|
||||
<td style="padding: 5px 10px; color: #666; width: 200px;">{{ key|title }}:</td>
|
||||
<td style="padding: 5px 10px; font-family: monospace;">{{ value }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div style="margin: 20px 0; padding: 15px; background: #f8f9fa; border-radius: 8px;">
|
||||
<p style="margin: 0; color: #666; font-size: 14px;">
|
||||
<strong>Note:</strong> This page shows real-time system health. Refresh to get latest status.
|
||||
<a href="{% url 'admin:monitoring_system_health' %}" style="margin-left: 10px;">Refresh Now</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.system-health-monitor {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user