adds status indicators to files view

This commit is contained in:
Michael Beck
2025-02-06 22:37:39 +01:00
parent 417a47d6a7
commit a5c15f211e
3 changed files with 174 additions and 103 deletions

View File

@@ -1,4 +1,3 @@
{% extends 'base.html' %}
{% block content %}
<section class="container-fluid d-flex justify-content-center">
@@ -25,18 +24,24 @@
<th onclick="sortTable(3, 'dataFilesTable')">Created</th>
<th onclick="sortTable(4, 'dataFilesTable')">Size</th>
<th>Action</th>
<th>Status</th>
</tr>
</thead>
</thead>
<tbody>
{% for file in files.data %}
{% for file in files.data %}
<tr>
<td class="d-sm-table-cell"><input type="checkbox" name="fileCheckbox" value="{{ url_for('download_data_file', filename=file.name_display) }}"></td>
<td><input type="checkbox" name="fileCheckbox" value="{{ url_for('download_log_file', filename=file.name_display) }}"{{ ' disabled' if file.active }}></td>
<td><a href="{{ url_for('download_data_file', filename=file.name_display) }}" target="_blank">{{ file.name_display }}</a></td>
<td>{{ file.last_modified | datetimeformat }}</td>
<td>{{ file.created | datetimeformat }}</td>
<td>{{ file.size }}</td>
<td>
<button class="btn btn-warning" onclick="deleteFiles(['{{ file.name }}'])">Delete</button>
<button class="btn btn-sm btn-warning" onclick="deleteFiles(['{{ file.name }}'])"{{ ' disabled' if file.active }}>Delete</button>
</td>
<td>
<span id="status-{{ file.name_display }}" class="badge {{ 'bg-danger' if file.active else 'bg-success' }}">
{{ 'In Use' if file.active else 'Available' }}
</span>
</td>
</tr>
{% endfor %}
@@ -68,27 +73,33 @@
<th onclick="sortTable(3, 'logFilesTable')">Created</th>
<th onclick="sortTable(4, 'logFilesTable')">Size</th>
<th>Action</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for file in files.log %}
<tr>
<td><input type="checkbox" name="fileCheckbox" value="{{ url_for('download_log_file', filename=file.name_display) }}"></td>
<td><a href="{{ url_for('download_log_file', filename=file.name_display) }}" target="_blank">{{ file.name }}</a></td>
<td>{{ file.last_modified | datetimeformat }}</td>
<td>{{ file.created | datetimeformat }}</td>
<td>{{ file.size }}</td>
<td>
<button class="btn btn-warning" onclick="deleteFiles(['{{ file.name }}'])">Delete</button>
</td>
</tr>
<tr>
<td><input type="checkbox" name="fileCheckbox" value="{{ url_for('download_log_file', filename=file.name_display) }}"{{ ' disabled' if file.active }}></td>
<td><a href="{{ url_for('download_log_file', filename=file.name_display) }}" target="_blank">{{ file.name_display }}</a></td>
<td>{{ file.last_modified | datetimeformat }}</td>
<td>{{ file.created | datetimeformat }}</td>
<td>{{ file.size }}</td>
<td>
<button class="btn btn-sm btn-warning" onclick="deleteFiles(['{{ file.name }}'])"{{ ' disabled' if file.active }}>Delete</button>
</td>
<td>
<span id="status-{{ file.name_display }}" class="badge {{ 'bg-danger' if file.active else 'bg-success' }}">
{{ 'In Use' if file.active else 'Available' }}
</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</section>
{% block scripts %}
{{ bootstrap.load_js() }}
{% block scripts %}
{{ bootstrap.load_js() }}
<script src="{{url_for('.static', filename='download_results.js')}}"></script>
{% endblock %}
{% endblock content %}
{% endblock %}
{% endblock content %}