Revert "perf: automation report"

This reverts commit 22aee54207.
pull/14829/head
feng626 2025-01-21 11:25:54 +08:00
parent 512b92587f
commit 01ac001f84
6 changed files with 440 additions and 857 deletions

View File

@ -47,8 +47,6 @@ def migrate_account_backup(apps, schema_editor):
automation_id = backup_id_old_new_map.get(str(execution.plan_id)) automation_id = backup_id_old_new_map.get(str(execution.plan_id))
if not automation_id: if not automation_id:
continue continue
snapshot = execution.snapshot
snapshot['type'] = "backup_account"
data = { data = {
'automation_id': automation_id, 'automation_id': automation_id,
'date_start': execution.date_start, 'date_start': execution.date_start,

View File

@ -1,113 +1,78 @@
{% load i18n %} {% load i18n %}
<div class="report-container"> <div class='summary'>
<div class="summary-section"> <p>{% trans 'The following is a summary of account backup tasks, please review and handle them' %}</p>
<h2> <table>
{% trans 'The following is a summary of account backup tasks, please review and handle them' %} <caption></caption>
</h2> <thead>
<table class="summary-table">
<caption></caption>
<thead>
<tr> <tr>
<th colspan="2">{% trans 'Task Summary' %}:</th> <th colspan='2'>任务汇总:</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>{% trans 'Task name' %}:</td> <td>{% trans 'Task name' %}:</td>
<td>{{ execution.automation.name }}</td> <td>{{ execution.automation.name }} </td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Date start' %}:</td> <td>{% trans 'Date start' %}:</td>
<td>{{ execution.date_start | date:"Y/m/d H:i:s" }}</td> <td>{{ execution.date_start | date:"Y/m/d H:i:s" }}</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Date end' %}:</td> <td>{% trans 'Date end' %}:</td>
<td>{{ execution.date_finished | date:"Y/m/d H:i:s" }}</td> <td>{{ execution.date_finished | date:"Y/m/d H:i:s" }}</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Time using' %}:</td> <td>{% trans 'Time using' %}:</td>
<td>{{ execution.duration }}s</td> <td>{{ execution.duration }}s</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Account count' %}:</td> <td>{% trans 'Account count' %}:</td>
<td>{{ summary.total_accounts }}</td> <td>{{ summary.total_accounts }}</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Type count' %}:</td> <td>{% trans 'Type count' %}:</td>
<td>{{ summary.total_types }}</td> <td>{{ summary.total_types }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
<style> <style>
.report-container { table {
max-width: 1200px; width: 100%;
margin: 20px auto; border-collapse: collapse;
padding: 20px; max-width: 100%;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, text-align: left;
Ubuntu, Cantarell, sans-serif; margin-top: 10px;
} padding: 20px;
h2,
h3 {
color: #2c3e50;
margin-bottom: 20px;
}
.section-header {
display: flex;
align-items: center;
margin-bottom: 15px;
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 30px;
background-color: white;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
border-radius: 8px;
}
.summary-table td:first-child {
width: 30%;
font-weight: 500;
}
th {
background-color: #f8f9fa;
padding: 12px 15px;
text-align: left;
font-weight: 600;
color: #2c3e50;
border-bottom: 2px solid #eee;
}
td {
padding: 12px 15px;
border-bottom: 1px solid #eee;
color: #34495e;
}
tr:last-child td {
border-bottom: none;
}
tr:hover {
background-color: #f8f9fa;
}
@media (max-width: 768px) {
.report-container {
padding: 10px;
} }
td,
th { th {
padding: 8px; background: #f2f2f2;
font-size: 14px;
padding: 5px;
border: 1px solid #ddd;
} }
}
</style> tr :first-child {
width: 30%;
}
td {
border: 1px solid #ddd;
padding: 5px;
font-size: 12px;
}
.result {
margin-top: 20px;
}
.result tr :first-child {
width: 10%;
}
</style>

View File

@ -1,221 +1,133 @@
{% load i18n %} {% load i18n %}
<div class="report-container"> <div class='summary'>
<div class="summary-section"> <p>{% trans 'The following is a summary of account change secret tasks, please read and process' %}</p>
<h2> <table>
{% trans 'The following is a summary of account change secret tasks, please read and process' %} <caption></caption>
</h2> <thead>
<table class="summary-table">
<caption></caption>
<thead>
<tr> <tr>
<th colspan="2">{% trans 'Task Summary' %}:</th> <th colspan='2'>任务汇总:</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>{% trans 'Task name' %}:</td> <td>{% trans 'Task name' %}:</td>
<td>{{ execution.automation.name }}</td> <td>{{ execution.automation.name }} </td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Date start' %}:</td> <td>{% trans 'Date start' %}:</td>
<td>{{ execution.date_start | date:"Y/m/d H:i:s" }}</td> <td>{{ execution.date_start | date:"Y/m/d H:i:s" }}</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Date end' %}:</td> <td>{% trans 'Date end' %}:</td>
<td>{{ execution.date_finished | date:"Y/m/d H:i:s" }}</td> <td>{{ execution.date_finished | date:"Y/m/d H:i:s" }}</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Time using' %}:</td> <td>{% trans 'Time using' %}:</td>
<td>{{ execution.duration }}s</td> <td>{{ execution.duration }}s</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Assets count' %}:</td> <td>{% trans 'Assets count' %}:</td>
<td>{{ summary.total_assets }}</td> <td>{{ summary.total_assets }}</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Asset success count' %}:</td> <td>{% trans 'Asset success count' %}:</td>
<td class="success">{{ summary.ok_assets }}</td> <td>{{ summary.ok_assets }}</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Asset failed count' %}:</td> <td>{% trans 'Asset failed count' %}:</td>
<td class="error">{{ summary.fail_assets }}</td> <td>{{ summary.fail_assets }}</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Asset not support count' %}:</td> <td>{% trans 'Asset not support count' %}:</td>
<td class="warning">{{ summary.error_assets }}</td> <td>{{ summary.error_assets }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="result-section"> <div class='result'>
{% if summary.ok_accounts %} {% if summary.ok_accounts %}
<div class="section-header"> <p>{% trans 'Success accounts' %}: {{ summary.ok_accounts }}</p>
<h3> <table>
{% trans 'Success accounts' %}: <caption></caption>
<span class="badge badge-success">{{ summary.ok_accounts }}</span> <thead>
</h3> <tr>
</div> <th>{% trans 'No.' %}</th>
<table class="data-table"> <th>{% trans 'Asset' %}</th>
<caption></caption> <th>{% trans 'Username' %}</th>
<thead> </tr>
<tr> </thead>
<th>{% trans 'No.' %}</th> <tbody>
<th>{% trans 'Asset' %}</th> {% for account in result.ok_accounts %}
<th>{% trans 'Username' %}</th> <tr>
</tr> <td>{{ forloop.counter }}</td>
</thead> <td>{{ account.asset }}</td>
<tbody> <td>{{ account.username }}</td>
{% for account in result.ok_accounts %} </tr>
<tr> {% endfor %}
<td>{{ forloop.counter }}</td> </tbody>
<td>{{ account.asset }}</td> </table>
<td>{{ account.username }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %} {% endif %}
</div> </div>
<div class='result'>
<div class="result-section">
{% if summary.fail_accounts %} {% if summary.fail_accounts %}
<div class="section-header"> <p>{% trans 'Failed accounts' %}: {{ summary.fail_accounts }}</p>
<h3> <table>
{% trans 'Failed accounts' %}: <caption></caption>
<span class="badge badge-error">{{ summary.fail_accounts }}</span> <thead>
</h3> <tr>
</div> <th>{% trans 'No.' %}</th>
<table class="data-table"> <th>{% trans 'Asset' %}</th>
<caption></caption> <th>{% trans 'Username' %}</th>
<thead> </tr>
<tr> </thead>
<th>{% trans 'No.' %}</th> <tbody>
<th>{% trans 'Asset' %}</th> {% for account in result.fail_accounts %}
<th>{% trans 'Username' %}</th> <tr>
</tr> <td>{{ forloop.counter }}</td>
</thead> <td>{{ account.asset }}</td>
<tbody> <td>{{ account.username }}</td>
{% for account in result.fail_accounts %} </tr>
<tr> {% endfor %}
<td>{{ forloop.counter }}</td> </tbody>
<td>{{ account.asset }}</td> </table>
<td>{{ account.username }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %} {% endif %}
</div>
</div> </div>
<style> <style>
.report-container { table {
max-width: 1200px; width: 100%;
margin: 20px auto; border-collapse: collapse;
padding: 20px; max-width: 100%;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, text-align: left;
Ubuntu, Cantarell, sans-serif; margin-top: 10px;
} padding: 20px;
h2,
h3 {
color: #2c3e50;
margin-bottom: 20px;
}
.section-header {
display: flex;
align-items: center;
margin-bottom: 15px;
}
.badge {
background-color: #3498db;
color: white;
padding: 3px 10px;
border-radius: 12px;
font-size: 14px;
margin-left: 10px;
}
.badge-success {
background-color: #27ae60;
}
.badge-error {
background-color: #e74c3c;
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 30px;
background-color: white;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
border-radius: 8px;
}
.summary-table td:first-child {
width: 30%;
font-weight: 500;
}
.data-table td:first-child {
width: 80px;
}
th {
background-color: #f8f9fa;
padding: 12px 15px;
text-align: left;
font-weight: 600;
color: #2c3e50;
border-bottom: 2px solid #eee;
}
td {
padding: 12px 15px;
border-bottom: 1px solid #eee;
color: #34495e;
}
tr:last-child td {
border-bottom: none;
}
.success {
color: #27ae60;
font-weight: 500;
}
.error {
color: #e74c3c;
font-weight: 500;
}
.warning {
color: #f39c12;
font-weight: 500;
}
.result-section {
margin-top: 30px;
}
tr:hover {
background-color: #f8f9fa;
}
@media (max-width: 768px) {
.report-container {
padding: 10px;
} }
td,
th { th {
padding: 8px; background: #f2f2f2;
font-size: 14px;
padding: 5px;
border: 1px solid #ddd;
} }
}
</style> tr :first-child {
width: 30%;
}
td {
border: 1px solid #ddd;
padding: 5px;
font-size: 12px;
}
.result {
margin-top: 20px;
}
.result tr :first-child {
width: 10%;
}
</style>

View File

@ -1,217 +1,124 @@
{% load i18n %} {% load i18n %}
<div class="report-container"> <div class='summary'>
<div class="summary-section"> <p>{% trans 'The following is a summary of the account check tasks. Please review and handle them' %}</p>
<h2> <table>
{% trans 'The following is a summary of the account check tasks. Please review and handle them' %} <caption></caption>
</h2> <thead>
<table class="summary-table">
<caption></caption>
<thead>
<tr> <tr>
<th colspan="2">{% trans 'Task Summary' %}:</th> <th colspan='2'>任务汇总:</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>{% trans 'Task name' %}:</td> <td>{% trans 'Task name' %}:</td>
<td>{{ execution.automation.name }}</td> <td>{{ execution.automation.name }} </td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Date start' %}:</td> <td>{% trans 'Date start' %}:</td>
<td>{{ execution.date_start | date:"Y/m/d H:i:s" }}</td> <td>{{ execution.date_start | date:"Y/m/d H:i:s" }}</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Date end' %}:</td> <td>{% trans 'Date end' %}:</td>
<td>{{ execution.date_finished | date:"Y/m/d H:i:s" }}</td> <td>{{ execution.date_finished | date:"Y/m/d H:i:s" }}</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Time using' %}:</td> <td>{% trans 'Time using' %}:</td>
<td>{{ execution.duration }}s</td> <td>{{ execution.duration }}s</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Assets count' %}:</td> <td>{% trans 'Assets count' %}:</td>
<td><span class="badge">{{ summary.assets }}</span></td> <td>{{ summary.assets }}</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Asset success count' %}:</td> <td>{% trans 'Asset success count' %}:</td>
<td class="success">{{ summary.ok_assets }}</td> <td>{{ summary.ok_assets }}</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Asset failed count' %}:</td> <td>{% trans 'Asset failed count' %}:</td>
<td class="error">{{ summary.fail_assets }}</td> <td>{{ summary.fail_assets }}</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Asset not support count' %}:</td> <td>{% trans 'Asset not support count' %}:</td>
<td class="warning">{{ summary.error_assets }}</td> <td>{{ summary.error_assets }}</td>
</tr> </tr>
<tr>
<td>{% trans 'Account count' %}:</td>
<td><span class="badge">{{ summary.accounts }}</span></td>
</tr>
<tr>
<td>{% trans 'Ok count' %}:</td>
<td class="success">{{ summary.ok }}</td>
</tr>
<tr>
<td>{% trans 'No password count' %}:</td>
<td class="warning">{{ summary.no_secret }}</td>
</tr>
</tbody>
</table>
</div>
<div class="result-section">
{% if summary.weak_password %}
<div class="section-header">
<h3>
{% trans 'Week password' %}:
<span class="badge badge-error">{{ summary.weak_password }}</span>
</h3>
</div>
<p class="section-desc">{% trans 'Account check details' %}:</p >
<table class="data-table">
<caption></caption>
<thead>
<tr> <tr>
<th>{% trans 'No.' %}</th> <td>{% trans 'Account count' %}:</td>
<th>{% trans 'Asset' %}</th> <td>{{ summary.accounts }}</td>
<th>{% trans 'Username' %}</th>
<th>{% trans 'Result' %}</th>
</tr> </tr>
</thead>
<tbody>
{% for account in result.weak_password %}
<tr> <tr>
<td>{{ forloop.counter }}</td> <td>{% trans 'Ok count' %}:</td>
<td>{{ account.asset }}</td> <td>{{ summary.ok }}</td>
<td>{{ account.username }}</td>
<td class="error">{% trans 'Week password' %}</td>
</tr> </tr>
{% endfor %} <tr>
</tbody> <td>{% trans 'No password count' %}:</td>
<td>{{ summary.no_secret }}</td>
</tr>
</tbody>
</table> </table>
</div>
<div class='result'>
{% if summary.weak_password %}
<p>{% trans 'Week password' %}: {{ summary.weak_password }}</p>
<p>{% trans 'Account check details' %}:</p>
<table>
<caption></caption>
<thead>
<tr>
<th>{% trans 'No.' %}</th>
<th>{% trans 'Asset' %}</th>
<th>{% trans 'Username' %}</th>
<th>{% trans 'Result' %}</th>
</tr>
</thead>
<tbody>
{% for account in result.weak_password %}
<tr>
<td>{{ forloop.counter }}</td>
<td>{{ account.asset }}</td>
<td>{{ account.username }}</td>
<td style="color: red">{% trans 'Week password' %}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %} {% else %}
<p class="no-data">{% trans 'No weak password' %}</p > <p>{% trans 'No weak password' %}</p>
{% endif %} {% endif %}
</div>
</div> </div>
<style> <style>
.report-container { table {
max-width: 1200px; width: 100%;
margin: 20px auto; border-collapse: collapse;
padding: 20px; max-width: 100%;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, text-align: left;
Ubuntu, Cantarell, sans-serif; margin-top: 20px;
} padding: 20px;
h2,
h3 {
color: #2c3e50;
margin-bottom: 20px;
}
.section-header {
display: flex;
align-items: center;
margin-bottom: 15px;
}
.section-desc {
color: #7f8c8d;
margin-bottom: 15px;
}
.badge {
background-color: #3498db;
color: white;
padding: 3px 10px;
border-radius: 12px;
font-size: 14px;
margin-left: 10px;
}
.badge-error {
background-color: #e74c3c;
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 30px;
background-color: white;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
border-radius: 8px;
}
.summary-table td:first-child {
width: 30%;
font-weight: 500;
}
.data-table td:first-child {
width: 80px;
}
th {
background-color: #f8f9fa;
padding: 12px 15px;
text-align: left;
font-weight: 600;
color: #2c3e50;
border-bottom: 2px solid #eee;
}
td {
padding: 12px 15px;
border-bottom: 1px solid #eee;
color: #34495e;
}
tr:last-child td {
border-bottom: none;
}
.success {
color: #27ae60;
font-weight: 500;
}
.error {
color: #e74c3c;
font-weight: 500;
}
.warning {
color: #f39c12;
font-weight: 500;
}
.no-data {
text-align: center;
color: #7f8c8d;
padding: 20px;
background-color: #f8f9fa;
border-radius: 8px;
}
.result-section {
margin-top: 30px;
}
tr:hover {
background-color: #f8f9fa;
}
@media (max-width: 768px) {
.report-container {
padding: 10px;
} }
td,
th { th {
padding: 8px; background: #f2f2f2;
font-size: 14px;
padding: 5px;
border: 1px solid #ddd;
} }
}
</style> tr :first-child {
width: 30%;
}
td {
border: 1px solid #ddd;
padding: 5px;
font-size: 12px;
}
.result tr :first-child {
width: 10%;
}
</style>

View File

@ -1,223 +1,164 @@
{% load i18n %} {% load i18n %}
<div class="report-container"> <div class='summary'>
<div class="summary-section"> <p>{% trans 'The following is a summary of the account check tasks. Please review and handle them' %}</p>
<h2> <table>
{% trans 'The following is a summary of the account check tasks. Please review and handle them' %} <caption></caption>
</h2> <thead>
<table class="summary-table">
<caption></caption>
<thead>
<tr> <tr>
<th colspan="2">{% trans 'Task Summary' %}:</th> <th colspan='2'>任务汇总:</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>{% trans 'Task name' %}:</td> <td>{% trans 'Task name' %}:</td>
<td>{{ execution.automation.name }}</td> <td>{{ execution.automation.name }} </td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Date start' %}:</td> <td>{% trans 'Date start' %}:</td>
<td>{{ execution.date_start | date:"Y/m/d H:i:s" }}</td> <td>{{ execution.date_start | date:"Y/m/d H:i:s" }}</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Date end' %}:</td> <td>{% trans 'Date end' %}:</td>
<td>{{ execution.date_finished | date:"Y/m/d H:i:s" }}</td> <td>{{ execution.date_finished | date:"Y/m/d H:i:s" }}</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Time using' %}:</td> <td>{% trans 'Time using' %}:</td>
<td>{{ execution.duration }}s</td> <td>{{ execution.duration }}s</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Assets count' %}:</td> <td>{% trans 'Assets count' %}:</td>
<td>{{ summary.total_assets }}</td> <td>{{ summary.total_assets }}</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Asset success count' %}:</td> <td>{% trans 'Asset success count' %}:</td>
<td class="success">{{ summary.ok_assets }}</td> <td>{{ summary.ok_assets }}</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Asset failed count' %}:</td> <td>{% trans 'Asset failed count' %}:</td>
<td class="error">{{ summary.fail_assets }}</td> <td>{{ summary.fail_assets }}</td>
</tr> </tr>
<tr> <tr>
<td>{% trans 'Asset not support count' %}:</td> <td>{% trans 'Asset not support count' %}:</td>
<td class="warning">{{ summary.error_assets }}</td> <td>{{ summary.error_assets }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
<div class="result-section">
{% if summary.new_accounts %}
<div class="section-header">
<h3>
{% trans 'New found accounts' %}:
<span class="badge">{{ summary.new_accounts }}</span>
</h3>
</div>
<table class="data-table">
<caption></caption>
<thead>
<tr>
<th>{% trans 'No.' %}</th>
<th>{% trans 'Asset' %}</th>
<th>{% trans 'Username' %}</th>
</tr>
</thead>
<tbody>
{% for account in result.new_accounts %}
<tr>
<td>{{ forloop.counter }}</td>
<td>{{ account.asset }}</td>
<td>{{ account.username }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="no-data">{% trans 'No new accounts found' %}</p >
{% endif %}
</div>
<div class="result-section">
{% if summary.lost_accounts %}
<div class="section-header">
<h3>
{% trans 'Lost accounts' %}:
<span class="badge">{{ summary.lost_accounts }}</span>
</h3>
</div>
<table class="data-table">
<caption></caption>
<thead>
<tr>
<th>{% trans 'No.' %}</th>
<th>{% trans 'Asset' %}</th>
<th>{% trans 'Username' %}</th>
</tr>
</thead>
<tbody>
{% for account in result.lost_accounts %}
<tr>
<td>{{ forloop.counter }}</td>
<td>{{ account.asset }}</td>
<td>{{ account.username }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
</div> </div>
<div class='result'>
{% if summary.new_accounts %}
<p>{% trans 'New found accounts' %}: {{ summary.new_accounts }}</p>
<table>
<caption></caption>
<thead>
<tr>
<th>{% trans 'No.' %}</th>
<th>{% trans 'Asset' %}</th>
<th>{% trans 'Username' %}</th>
</tr>
</thead>
<tbody>
{% for account in result.new_accounts %}
<tr>
<td>{{ forloop.counter }}</td>
<td>{{ account.asset }}</td>
<td>{{ account.username }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>{% trans 'No new accounts found' %}</p>
{% endif %}
</div>
<div class='result'>
{% if summary.lost_accounts %}
<p>{% trans 'Lost accounts' %}: {{ summary.lost_accounts }}</p>
<table>
<caption></caption>
<thead>
<tr>
<th>{% trans 'No.' %}</th>
<th>{% trans 'Asset' %}</th>
<th>{% trans 'Username' %}</th>
</tr>
</thead>
<tbody>
{% for account in result.lost_accounts %}
<tr>
<td>{{ forloop.counter }}</td>
<td>{{ account.asset }}</td>
<td>{{ account.username }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
{#<div class='result'>#}
{# <p>{% trans 'New found risks' %}: {{ summary.new_risks }}</p>#}
{# {% if summary.new_risks %}#}
{# <table>#}
{# <caption></caption>#}
{# <thead>#}
{# <tr>#}
{# <th>{% trans 'No.' %}</th>#}
{# <th>{% trans 'Asset' %}</th>#}
{# <th>{% trans 'Username' %}</th>#}
{# <th>{% trans 'Result' %}</th>#}
{# </tr>#}
{# </thead>#}
{# <tbody>#}
{# {% for risk in result.risks %}#}
{# <tr>#}
{# <td>{{ forloop.counter }}</td>#}
{# <td>{{ risk.asset }}</td>#}
{# <td>{{ risk.username }}</td>#}
{# <td>{{ risk.risk }}</td>#}
{# </tr>#}
{# {% endfor %}#}
{# </tbody>#}
{# </table>#}
{# {% endif %}#}
{#</div>#}
<style> <style>
.report-container { table {
max-width: 1200px; width: 100%;
margin: 20px auto; border-collapse: collapse;
padding: 20px; max-width: 100%;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, text-align: left;
Ubuntu, Cantarell, sans-serif; margin-top: 10px;
} padding: 20px;
h2,
h3 {
color: #2c3e50;
margin-bottom: 20px;
}
.section-header {
display: flex;
align-items: center;
margin-bottom: 15px;
}
.badge {
background-color: #3498db;
color: white;
padding: 3px 10px;
border-radius: 12px;
font-size: 14px;
margin-left: 10px;
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 30px;
background-color: white;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
border-radius: 8px;
}
.summary-table td:first-child {
width: 30%;
font-weight: 500;
}
.data-table td:first-child {
width: 80px;
}
th {
background-color: #f8f9fa;
padding: 12px 15px;
text-align: left;
font-weight: 600;
color: #2c3e50;
border-bottom: 2px solid #eee;
}
td {
padding: 12px 15px;
border-bottom: 1px solid #eee;
color: #34495e;
}
tr:last-child td {
border-bottom: none;
}
.success {
color: #27ae60;
font-weight: 500;
}
.error {
color: #e74c3c;
font-weight: 500;
}
.warning {
color: #f39c12;
font-weight: 500;
}
.no-data {
text-align: center;
color: #7f8c8d;
padding: 20px;
background-color: #f8f9fa;
border-radius: 8px;
}
.result-section {
margin-top: 30px;
}
tr:hover {
background-color: #f8f9fa;
}
@media (max-width: 768px) {
.report-container {
padding: 10px;
} }
td,
th { th {
padding: 8px; background: #f2f2f2;
font-size: 14px;
padding: 5px;
border: 1px solid #ddd;
} }
}
</style> tr :first-child {
width: 30%;
}
td {
border: 1px solid #ddd;
padding: 5px;
font-size: 12px;
}
.result {
margin-top: 20px;
}
.result tr :first-child {
width: 10%;
}
</style>

View File

@ -1,217 +1,77 @@
{% load i18n %} {% load i18n %}
<div class="report-container"> <div class='summary'>
<div class="summary-section"> <p>{% trans 'The following is a summary of account push tasks, please read and process' %}</p>
<h2> <table>
{% trans 'The following is a summary of the account check tasks. Please review and handle them' %} <caption></caption>
</h2> <thead>
<table class="summary-table"> <tr>
<caption></caption> <th colspan='2'>任务汇总:</th>
<thead> </tr>
<tr> </thead>
<th colspan="2">{% trans 'Task Summary' %}:</th> <tbody>
</tr> <tr>
</thead> <td>{% trans 'Task name' %}:</td>
<tbody> <td>{{ execution.automation.name }} </td>
<tr> </tr>
<td>{% trans 'Task name' %}:</td> <tr>
<td>{{ execution.automation.name }}</td> <td>{% trans 'Date start' %}:</td>
</tr> <td>{{ execution.date_start | date:"Y/m/d H:i:s" }}</td>
<tr> </tr>
<td>{% trans 'Date start' %}:</td> <tr>
<td>{{ execution.date_start | date:"Y/m/d H:i:s" }}</td> <td>{% trans 'Date end' %}:</td>
</tr> <td>{{ execution.date_finished | date:"Y/m/d H:i:s" }}</td>
<tr> </tr>
<td>{% trans 'Date end' %}:</td> <tr>
<td>{{ execution.date_finished | date:"Y/m/d H:i:s" }}</td> <td>{% trans 'Time using' %}:</td>
</tr> <td>{{ execution.duration }}s</td>
<tr> </tr>
<td>{% trans 'Time using' %}:</td> <tr>
<td>{{ execution.duration }}s</td> <td>{% trans 'Assets count' %}:</td>
</tr> <td>{{ summary.total_assets }}</td>
<tr> </tr>
<td>{% trans 'Assets count' %}:</td> <tr>
<td><span class="badge">{{ summary.assets }}</span></td> <td>{% trans 'Asset success count' %}:</td>
</tr> <td>{{ summary.ok_assets }}</td>
<tr> </tr>
<td>{% trans 'Asset success count' %}:</td> <tr>
<td class="success">{{ summary.ok_assets }}</td> <td>{% trans 'Asset failed count' %}:</td>
</tr> <td>{{ summary.fail_assets }}</td>
<tr> </tr>
<td>{% trans 'Asset failed count' %}:</td> <tr>
<td class="error">{{ summary.fail_assets }}</td> <td>{% trans 'Asset not support count' %}:</td>
</tr> <td>{{ summary.error_assets }}</td>
<tr> </tr>
<td>{% trans 'Asset not support count' %}:</td> </tbody>
<td class="warning">{{ summary.error_assets }}</td> </table>
</tr>
<tr>
<td>{% trans 'Account count' %}:</td>
<td><span class="badge">{{ summary.accounts }}</span></td>
</tr>
<tr>
<td>{% trans 'Ok count' %}:</td>
<td class="success">{{ summary.ok }}</td>
</tr>
<tr>
<td>{% trans 'No password count' %}:</td>
<td class="warning">{{ summary.no_secret }}</td>
</tr>
</tbody>
</table>
</div>
<div class="result-section">
{% if summary.weak_password %}
<div class="section-header">
<h3>
{% trans 'Week password' %}:
<span class="badge badge-error">{{ summary.weak_password }}</span>
</h3>
</div>
<p class="section-desc">{% trans 'Account check details' %}:</p>
<table class="data-table">
<caption></caption>
<thead>
<tr>
<th>{% trans 'No.' %}</th>
<th>{% trans 'Asset' %}</th>
<th>{% trans 'Username' %}</th>
<th>{% trans 'Result' %}</th>
</tr>
</thead>
<tbody>
{% for account in result.weak_password %}
<tr>
<td>{{ forloop.counter }}</td>
<td>{{ account.asset }}</td>
<td>{{ account.username }}</td>
<td class="error">{% trans 'Week password' %}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="no-data">{% trans 'No weak password' %}</p>
{% endif %}
</div>
</div> </div>
<style> <style>
.report-container {
max-width: 1200px;
margin: 20px auto;
padding: 20px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
Ubuntu, Cantarell, sans-serif;
}
h2,
h3 {
color: #2c3e50;
margin-bottom: 20px;
}
.section-header {
display: flex;
align-items: center;
margin-bottom: 15px;
}
.section-desc {
color: #7f8c8d;
margin-bottom: 15px;
}
.badge {
background-color: #3498db;
color: white;
padding: 3px 10px;
border-radius: 12px;
font-size: 14px;
margin-left: 10px;
}
.badge-error {
background-color: #e74c3c;
}
table { table {
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
margin-bottom: 30px; max-width: 100%;
background-color: white; text-align: left;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); margin-top: 10px;
border-radius: 8px; padding: 20px;
}
.summary-table td:first-child {
width: 30%;
font-weight: 500;
}
.data-table td:first-child {
width: 80px;
} }
th { th {
background-color: #f8f9fa; background: #f2f2f2;
padding: 12px 15px; font-size: 14px;
text-align: left; padding: 5px;
font-weight: 600; border: 1px solid #ddd;
color: #2c3e50; }
border-bottom: 2px solid #eee;
tr :first-child {
width: 30%;
} }
td { td {
padding: 12px 15px; border: 1px solid #ddd;
border-bottom: 1px solid #eee; padding: 5px;
color: #34495e; font-size: 12px;
} }
tr:last-child td { </style>
border-bottom: none;
}
.success {
color: #27ae60;
font-weight: 500;
}
.error {
color: #e74c3c;
font-weight: 500;
}
.warning {
color: #f39c12;
font-weight: 500;
}
.no-data {
text-align: center;
color: #7f8c8d;
padding: 20px;
background-color: #f8f9fa;
border-radius: 8px;
}
.result-section {
margin-top: 30px;
}
tr:hover {
background-color: #f8f9fa;
}
@media (max-width: 768px) {
.report-container {
padding: 10px;
}
td,
th {
padding: 8px;
}
}
</style>