mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
view and delete orphaned files
miscelaneous bug fixes discovered during testing
This commit is contained in:
@@ -84,21 +84,47 @@
|
||||
{% endif %}
|
||||
|
||||
<h4 class="mt-3">{% trans 'Database' %} <span
|
||||
class="badge badge-{% if postgres %}warning{% else %}success{% endif %}">{% if postgres %}
|
||||
class="badge badge-{% if postgres %}success{% else %}warning{% endif %}">{% if postgres %}
|
||||
{% trans 'Info' %}{% else %}{% trans 'Ok' %}{% endif %}</span></h4>
|
||||
{% if postgres %}
|
||||
{% trans 'Everything is fine!' %}
|
||||
{% else %}
|
||||
{% blocktrans %}
|
||||
This application is not running with a Postgres database backend. This is ok but not recommended as some
|
||||
features only work with postgres databases.
|
||||
{% endblocktrans %}
|
||||
{% else %}
|
||||
{% trans 'Everything is fine!' %}
|
||||
{% endif %}
|
||||
|
||||
<h4 class="mt-3">
|
||||
{% trans 'Orphaned Files' %}
|
||||
|
||||
<span class="badge badge-{% if orphans|length == 0 %}success{% elif orphans|length <= 25 %}warning{% else %}danger{% endif %}">
|
||||
{% if orphans|length == 0 %}{% trans 'Success' %}
|
||||
{% elif orphans|length <= 25 %}{% trans 'Warning' %}
|
||||
{% else %}{% trans 'Danger' %}
|
||||
{% endif %}
|
||||
</span>
|
||||
</h4>
|
||||
|
||||
{% if orphans|length == 0 %}
|
||||
{% trans 'Everything is fine!' %}
|
||||
{% else %}
|
||||
{% blocktrans with orphan_count=orphans|length %}
|
||||
There are currently {{ orphan_count }} orphaned files.
|
||||
{% endblocktrans %}
|
||||
<br>
|
||||
<button id="toggle-button" class="btn btn-info btn-sm" onclick="toggleOrphans()">{% trans 'Show' %}</button>
|
||||
<button class="btn btn-info btn-sm" onclick="deleteOrphans()">{% trans 'Delete' %}</button>
|
||||
{% endif %}
|
||||
<textarea id="orphans-list" style="display:none;" class="form-control" rows="20">
|
||||
{% for orphan in orphans %}{{ orphan }}
|
||||
{% endfor %}
|
||||
</textarea>
|
||||
|
||||
<h4 class="mt-3">Debug</h4>
|
||||
<textarea class="form-control" rows="20">
|
||||
Gunicorn Media: {{ gunicorn_media }}
|
||||
Sqlite: {{ postgres }}
|
||||
Sqlite: {% if postgres %} {% trans 'False' %} {% else %} {% trans 'True' %} {% endif %}
|
||||
Debug: {{ debug }}
|
||||
|
||||
{% for key,value in request.META.items %}{% if key in 'SERVER_PORT,REMOTE_HOST,REMOTE_ADDR,SERVER_PROTOCOL' %}{{ key }}:{{ value }}
|
||||
@@ -110,4 +136,30 @@ Debug: {{ debug }}
|
||||
</textarea>
|
||||
<br/>
|
||||
<br/>
|
||||
{% endblock %}
|
||||
<form method="POST" id="delete-form">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="delete_orphans" value="false">
|
||||
</form>
|
||||
{% block script %}
|
||||
<script>
|
||||
function toggleOrphans() {
|
||||
var orphansList = document.getElementById('orphans-list');
|
||||
var button = document.getElementById('toggle-button');
|
||||
|
||||
if (orphansList.style.display === 'none') {
|
||||
orphansList.style.display = 'block';
|
||||
button.innerText = "{% trans 'Hide' %}";
|
||||
} else {
|
||||
orphansList.style.display = 'none';
|
||||
button.innerText = "{% trans 'Show' %}";
|
||||
}
|
||||
}
|
||||
function deleteOrphans() {
|
||||
document.getElementById('delete-form').delete_orphans.value = 'true';
|
||||
document.getElementById('delete-form').submit();
|
||||
}
|
||||
</script>
|
||||
{% endblock script %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user