ADD export function to tables

This commit is contained in:
CaffeineFueled 2025-04-09 19:59:19 +02:00
parent 7db919bcb7
commit a7cc072777
3 changed files with 184 additions and 6 deletions

View file

@ -184,6 +184,35 @@
width: 100%;
}
}
.table-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 15px;
}
.table-actions {
display: flex;
gap: 10px;
margin-top: 10px;
}
.btn-export {
display: inline-flex;
align-items: center;
gap: 5px;
padding: 8px 15px;
background-color: #4CAF50;
color: white;
border-radius: 4px;
text-decoration: none;
font-weight: bold;
font-size: 0.9em;
}
.btn-export:hover {
background-color: #45a049;
}
.icon {
font-size: 1.2em;
}
</style>
</head>
<body>
@ -242,11 +271,20 @@
</div>
</form>
<h2>DNS Records <span class="count-badge">{{ entries|length }}</span>
{% if deduplicate %}
<small class="dedup-note">(Showing most recent entries for each Domain+Class+Type+TTL+Data combination)</small>
<div class="table-header">
<h2>DNS Records <span class="count-badge">{{ entries|length }}</span>
{% if deduplicate %}
<small class="dedup-note">(Showing most recent entries for each Domain+Class+Type+TTL+Data combination)</small>
{% endif %}
</h2>
{% if entries %}
<div class="table-actions">
<a href="/export-dns-csv?{% if request.query_params.get('upload_id') %}upload_id={{ request.query_params.get('upload_id') }}{% endif %}{% if request.query_params.get('record_type') %}&record_type={{ request.query_params.get('record_type') }}{% endif %}{% if request.query_params.get('record_class') %}&record_class={{ request.query_params.get('record_class') }}{% endif %}{% if request.query_params.get('domain') %}&domain={{ request.query_params.get('domain') }}{% endif %}{% if request.query_params.get('deduplicate') == 'false' %}&deduplicate=false{% endif %}" class="btn-export" title="Export to CSV">
<span class="icon">📥</span> Export CSV
</a>
</div>
{% endif %}
</h2>
</div>
{% if entries %}
<table id="dns-table">

View file

@ -187,6 +187,34 @@
background-color: #e53935;
color: white;
}
.table-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
}
.table-actions {
display: flex;
gap: 10px;
}
.btn-export {
display: inline-flex;
align-items: center;
gap: 5px;
padding: 8px 15px;
background-color: #4CAF50;
color: white;
border-radius: 4px;
text-decoration: none;
font-weight: bold;
font-size: 0.9em;
}
.btn-export:hover {
background-color: #45a049;
}
.icon {
font-size: 1.2em;
}
</style>
</head>
<body>
@ -292,7 +320,14 @@
</div>
{% if domains %}
<p>Found {{ domains|length }} domains{% if request.query_params.get('upload_id') %} in this upload{% endif %}.</p>
<div class="table-header">
<p>Found {{ domains|length }} domains{% if request.query_params.get('upload_id') %} in this upload{% endif %}.</p>
<div class="table-actions">
<a href="/export-domains-csv?{% if request.query_params.get('upload_id') %}upload_id={{ request.query_params.get('upload_id') }}{% endif %}{% if request.query_params.get('base_domains_only') == 'true' %}&base_domains_only=true{% endif %}" class="btn-export" title="Export to CSV">
<span class="icon">📥</span> Export CSV
</a>
</div>
</div>
<table>
<thead>
<tr>