jumpserver/apps/accounts/templates/accounts/push_account_report.html

164 lines
5.5 KiB
Python

{% load i18n %}
{% load static %}
<link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
<div class="report-container">
<section class="basic-info-section">
<div class="header-container">
<span
class="triangle-down-icon collapse-toggle"
data-target="basic-info"
></span>
<h2>{% trans 'Basic Information' %}</h2>
</div>
<div class="container-section collapsible-content" id="basic-info-content">
<div class="item">
<span class="item-label">{% trans 'Date start' %}</span>
<span class="item-value">{{ execution.date_start | date:"Y/m/d H:i:s" }}</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Date end' %}</span>
<span class="item-value">{{ execution.date_finished | date:"Y/m/d H:i:s" }}</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Assets amount' %}</span>
<span class="item-value">{{ summary.total_assets }}</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Asset success count' %}</span>
<span class="item-value">{{ summary.ok_assets | default:0 }}</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Asset failed count' %}</span>
<span class="item-value">{{ summary.fail_assets | default:0 }}</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Asset not support count' %}</span>
<span class="item-value">{{ summary.error_assets | default:0 }}</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Task name' %}</span>
<span class="item-value">{{ execution.automation.name }}</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Time using' %}</span>
<span class="item-value">{{ execution.duration }}s</span>
</div>
</div>
</section>
<section class="success">
<div class="header-container">
<span
class="triangle-down-icon collapse-toggle"
data-target="success"
></span>
<h2>
{% trans 'Success accounts' %}:
<span> {{ summary.ok_accounts | default:0 }} </span>
</h2>
</div>
<div class="container-section collapsible-content" id="success-content">
{% if summary.ok_accounts %}
<table class="custom-table table-striped table-hover data-table">
<thead>
<tr>
<th>{% trans 'No' %}</th>
<th>{% trans 'Asset' %}</th>
<th>{% trans 'Username' %}</th>
</tr>
</thead>
<tbody>
{% for account in result.ok_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>
</section>
<section class="failed">
<div class="header-container">
<span
class="triangle-down-icon collapse-toggle"
data-target="failed"
></span>
<h2>
{% trans 'Failed accounts' %}:
<span> {{ summary.fail_accounts | default:0 }} </span>
</h2>
</div>
<div class="container-section collapsible-content" id="failed-content">
{% if summary.fail_accounts %}
<table class="custom-table table-hover data-table">
<thead>
<tr>
<th>{% trans 'No' %}</th>
<th>{% trans 'Asset' %}</th>
<th>{% trans 'Username' %}</th>
</tr>
</thead>
<tbody>
{% for account in result.fail_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>
</section>
</div>
<style>
{% include './css/report.css' %}
</style>
<script>
const toggleButtons = document.querySelectorAll('.collapse-toggle')
toggleButtons.forEach((button) => {
button.addEventListener('click', function () {
const targetId = this.getAttribute('data-target')
const targetContent = document.getElementById(`${targetId}-content`)
if (this.classList.contains('triangle-down-icon')) {
this.classList.remove('triangle-down-icon')
this.classList.add('triangle-right-icon')
targetContent.classList.add('collapsed')
} else {
this.classList.remove('triangle-right-icon')
this.classList.add('triangle-down-icon')
targetContent.classList.remove('collapsed')
}
})
})
</script>