perf: Perf: Optimism Gather Report Style

pull/14833/head
zhaojisen 2025-01-21 14:58:56 +08:00 committed by feng626
parent ef0df85a15
commit ad34568299
3 changed files with 86428 additions and 135 deletions

View File

@ -1,164 +1,504 @@
{% load i18n %}
{% load i18n %}
{% load static %}
{% load bootstrap3 %}
<div class='summary'>
<p>{% trans 'The following is a summary of the account check tasks. Please review and handle them' %}</p>
<table>
<caption></caption>
<thead>
<tr>
<th colspan='2'>任务汇总:</th>
</tr>
</thead>
<tbody>
<tr>
<td>{% trans 'Task name' %}:</td>
<td>{{ execution.automation.name }} </td>
</tr>
<tr>
<td>{% trans 'Date start' %}:</td>
<td>{{ execution.date_start | date:"Y/m/d H:i:s" }}</td>
</tr>
<tr>
<td>{% trans 'Date end' %}:</td>
<td>{{ execution.date_finished | date:"Y/m/d H:i:s" }}</td>
</tr>
<tr>
<td>{% trans 'Time using' %}:</td>
<td>{{ execution.duration }}s</td>
</tr>
<tr>
<td>{% trans 'Assets count' %}:</td>
<td>{{ summary.total_assets }}</td>
</tr>
<tr>
<td>{% trans 'Asset success count' %}:</td>
<td>{{ summary.ok_assets }}</td>
</tr>
<tr>
<td>{% trans 'Asset failed count' %}:</td>
<td>{{ summary.fail_assets }}</td>
</tr>
<tr>
<td>{% trans 'Asset not support count' %}:</td>
<td>{{ summary.error_assets }}</td>
</tr>
</tbody>
</table>
</div>
<div class='result'>
{% if summary.new_accounts %}
<p>{% trans 'New found accounts' %}: {{ summary.new_accounts }}</p>
<table>
<caption></caption>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}"></link>
<link href="{% static 'css/font-awesome.min.css' %}" rel="stylesheet">
<script src="{% static 'js/echarts.js' %}"></script>
<script src="{% static 'js/jquery-3.6.1.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
</head>
<body>
<div class="report-container">
<header class="header">
<img src="{% static 'img/JumpServer_white_logo.svg' %}" alt="Logo" />
<!-- Command Section -->
{% comment %} <div class="command-section">
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
操作
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>
<a href="#">
<i class="fa fa-file-excel-o" aria-hidden="true"></i>
<span class="menu-action">导出到 XLS</span>
</a>
</li>
<li>
<a href="#">
<i class="fa fa-file-pdf-o" aria-hidden="true"></i>
<span class="menu-action">导出到 PDF</span>
</a>
</li>
<li>
<a href="#">
<i class="fa fa-envelope-o" aria-hidden="true"></i>
<span class="menu-action">通过邮件发送此报表</span>
</a>
</li>
<li>
<a href="#">
<i class="fa fa-print" aria-hidden="true"></i>
<span class="menu-action">打印</span>
</a>
</li>
</ul>
</div>
</div> {% endcomment %}
</header>
<!-- Info Section -->
<div class="info-section">
<h2 class="info">
<!-- 对应报表的 name -->
密码清单
</h2>
<div class="time">
<!-- 具体的生成时间 -->
生成于星期五2025年1月20日 10:00:00 中国标准时间
</div>
</div>
<main class="main-section">
{% comment %} 摘要部分 {% endcomment %}
<div class="synopsis-section">
<div class="synopsis-item">
<h3>
{% comment %} {% trans 'New found accounts' %}: {% endcomment %}
<span> summary 1 </span>
</h3>
<div class="synopsis-item-content">
<p>
{% trans 'New found accounts' %}:
<span>100</span>
</p>
<p>
{% trans 'New found accounts' %}:
<span>100</span>
</p>
<p>
{% trans 'New found accounts' %}:
<span>100</span>
</p>
<p>
{% trans 'New found accounts' %}:
<span>100</span>
</p>
</div>
</div>
<div class="synopsis-item">
<h3>
{% comment %} {% trans 'New found accounts' %}: {% endcomment %}
<span>summary 2</span>
</h3>
<div class="synopsis-item-content-charts">
<div id="main" style="width: 600px; height: 250px;"></div>
</div>
</div>
</div>
<div class="tabel-summery-section">
<div class="new-accounts result-section table-responsive">
<div class="section-header">
<h3>
{% trans 'New found accounts' %}:
<span>{{ summary.new_accounts | default:100 }}</span>
</h3>
</div>
{% if summary.new_accounts %}
<table class="custom-table table-striped table-hover data-table">
<thead>
<tr>
<tr>
<th>{% trans 'No.' %}</th>
<th>{% trans 'Asset' %}</th>
<th>{% trans 'Username' %}</th>
</tr>
</tr>
</thead>
<tbody>
{% for account in result.new_accounts %}
<tr>
<td>{{ forloop.counter }}</td>
<td>{{ account.asset }}</td>
<td>{{ account.username }}</td>
</tr>
{% endfor %}
{% 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>
</table>
{% else %}
<p class="no-data">{% trans 'No new accounts found' %}</p>
{% endif %}
</div>
<div class="lost-accounts result-section table-responsive">
<div class="section-header">
<h3>
{% trans 'Lost accounts' %}:
<span>{{ summary.lost_accounts }}</span>
</h3>
</div>
{% if summary.lost_accounts %}
<table class="custom-table table-striped table-hover data-table">
<thead>
<tr>
<tr>
<th>{% trans 'No.' %}</th>
<th>{% trans 'Asset' %}</th>
<th>{% trans 'Username' %}</th>
</tr>
</tr>
</thead>
<tbody>
{% for account in result.lost_accounts %}
<tr>
<td>{{ forloop.counter }}</td>
<td>{{ account.asset }}</td>
<td>{{ account.username }}</td>
</tr>
{% endfor %}
{% for account in result.lost_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>
<div class="tabel-execution-section">
<h3>
{% trans 'The following is a summary of the account check tasks. Please review and handle them' %}
</h3>
<table class="execution-table custom-table">
<thead>
<tr>
<th colspan="2">{% trans 'Task Summary' %}:</th>
</tr>
</thead>
<tbody>
<tr>
<td>{% trans 'Task name' %}:</td>
<td>{{ execution.automation.name }}</td>
</tr>
<tr>
<td>{% trans 'Date start' %}:</td>
<td>{{ execution.date_start | date:"Y/m/d H:i:s" }}</td>
</tr>
<tr>
<td>{% trans 'Date end' %}:</td>
<td>{{ execution.date_finished | date:"Y/m/d H:i:s" }}</td>
</tr>
<tr>
<td>{% trans 'Time using' %}:</td>
<td>{{ execution.duration }}s</td>
</tr>
<tr>
<td>{% trans 'Assets count' %}:</td>
<td>{{ summary.total_assets }}</td>
</tr>
<tr>
<td>{% trans 'Asset success count' %}:</td>
<td class="success">{{ summary.ok_assets }}</td>
</tr>
<tr>
<td>{% trans 'Asset failed count' %}:</td>
<td class="error">{{ summary.fail_assets }}</td>
</tr>
<tr>
<td>{% trans 'Asset not support count' %}:</td>
<td class="warning">{{ summary.error_assets }}</td>
</tr>
</tbody>
</table>
{% endif %}
</div>
</div>
</main>
</div>
{% block extra_js %}
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
var myChart = echarts.init(document.getElementById('main'));
var option = {
tooltip: {},
series: [{
type: 'pie',
radius: ['50%', '70%'],
avoidLabelOverlap: false,
label: {
show: false,
position: 'center'
},
labelLine: {
show: false
},
emphasis: {
label: {
show: true,
fontSize: '13',
fontWeight: 'bold'
}
},
data: [
{ value: {{ summary.ok_assets | default:10 }}, name: '{% trans "Asset success count" %}' },
{ value: {{ summary.fail_assets | default:10 }}, name: '{% trans "Asset failed count" %}' },
{ value: {{ summary.error_assets | default:10 }}, name: '{% trans "Asset not support count" %}' }
]
}]
};
myChart.setOption(option);
window.addEventListener('resize', function() {
myChart.resize();
});
});
</script>
{% endblock %}
</body>
{#<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>
table {
width: 100%;
border-collapse: collapse;
max-width: 100%;
text-align: left;
margin-top: 10px;
padding: 20px;
}
body,
p, {
margin: 0;
padding: 0;
}
th {
background: #f2f2f2;
font-size: 14px;
padding: 5px;
border: 1px solid #ddd;
}
.report-container {
display: flex;
flex-direction: column;
}
tr :first-child {
width: 30%;
}
.report-container .header {
display: flex;
justify-content: space-between;
align-items: center;
height: 4rem;
padding: 0.3rem 1rem;
background-color: #148f76;
}
td {
border: 1px solid #ddd;
padding: 5px;
font-size: 12px;
}
.report-container .header img {
height: 100%
}
.result {
margin-top: 20px;
}
.report-container .header .command-section .btn {
padding: 2px 10px;
}
.result tr :first-child {
width: 10%;
}
.report-container .header .command-section .dropdown-menu {
left: unset;
right: 0;
}
.report-container .header .command-section .dropdown-menu a {
display: inline-flex;
align-items: center;
justify-content: flex-start;
width: 100%
}
.report-container .header .command-section .dropdown-menu a .menu-action {
margin-left: 1rem;
}
.info-section {
display: flex;
justify-content: space-between;
align-items: center;
background-color: #f5f5f5;
height: 4rem;
padding: 0 1rem;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.info-section .info {
margin: unset;
font-size: 2rem;
}
.info-section .time {
color: #888;
font-size: 1.3rem;
}
.main-section {
margin-top: 3rem;
padding: 0 1rem;
}
.main-section .synopsis-section {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: 2rem;
}
.main-section .synopsis-section .synopsis-item {
display: flex;
flex-direction: column;
flex: 1;
padding: 1rem 2rem;
border: 1px solid #e0e0e0;
border-radius: 8px;
height: 350px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
}
.main-section .synopsis-section .synopsis-item:hover {
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
transform: translateY(-2px);
}
.main-section .synopsis-section .synopsis-item .synopsis-item-content {
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: flex-start;
margin-top: 1rem;
height: 100%;
font-size: 1.5rem;
cursor: pointer;
}
.main-section .synopsis-section .synopsis-item .synopsis-item-content p {
display: inline-flex;
width: 100%;
line-height: 1;
gap: 2rem;
font-weight: 500;
}
.main-section .synopsis-section .synopsis-item .synopsis-item-content span {
align-items: center;
justify-content: center;
font-weight: normal;
}
.synopsis-item-content-charts {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 1rem;
}
.main-section .tabel-summery-section {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
align-items: flex-start;
gap: 2rem;
width: inherit;
margin-top: 2rem;
}
.main-section .tabel-summery-section .result-section {
width: 100%;
padding: 1rem;
background: #fff;
border: 1px solid #e0e0e0;
border-radius: 8px;
{% comment %} box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); {% endcomment %}
}
.main-section .tabel-execution-section {
display: flex;
flex-wrap: nowrap;
flex-direction: column;
align-items: flex-start;
width: inherit;
margin-top: 2rem;
padding: 1rem;
}
.main-section .tabel-execution-section h3 {
font-size: 1.5rem;
color: #2c3e50;
}
.section-header {
padding-bottom: 0.5rem;
margin-bottom: 1rem;
font-size: 1.5rem;
}
.section-header h3 {
display: flex;
align-items: center;
gap: 0.5rem;
margin: 0;
color: #2c3e50;
font-size: inherit;
}
.section-header span {
background: #e8f5e9;
color: #2e7d32;
padding: 0.2rem 0.8rem;
border-radius: 1rem;
font-size: inherit;
}
.custom-table {
margin-bottom: 0;
width: 100%;
border-collapse: collapse;
overflow: hidden;
}
.custom-table th {
background: #f6f6f6;
color: #495057;
padding: 0.75rem;
border-bottom: 2px solid #e0e0e0;
}
.custom-table td {
padding: 0.75rem;
border-bottom: 1px solid #e0e0e0;
}
.custom-table tr:last-child td {
border-bottom: none;
}
.table-hover tbody tr:hover {
background-color: rgba(0, 0, 0, 0.02);
}
.no-data {
text-align: center;
color: #6c757d;
padding: 2rem;
background: #f6f6f6;
border-radius: 8px;
margin: 1rem 0;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.new-accounts .section-header span {
background: #e8f5e9;
color: #2e7d32;
}
.lost-accounts .section-header span {
background: #fbe9e7;
color: #d84315;
}
</style>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.4 KiB

85952
apps/static/js/echarts.js Executable file

File diff suppressed because it is too large Load Diff