feat(dashboard): reprocess or remove every model on a property

The property page gets a Reprocess all models button (ugc_manage): every
model placed on the property goes back to the UGC server's queue, made
again with the current settings (/api/ugc/reprocess with {property}).
Import models gets Remove all models (properties_import): deletes every
model placed on the property after the property id is typed in, refused
while the property is loaded in a world, as import is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-28 10:18:07 -05:00
parent 25e223ce19
commit 6c45d4abdb
10 changed files with 74 additions and 1 deletions

View File

@@ -20,6 +20,9 @@
<button class="btn btn-outline-danger btn-sm" onclick="rejectProperty()">Reject</button>
{% endif %}
<a class="btn btn-sm btn-primary" href="/properties/{{ property_id }}/3d">Open 3D view</a>
{% if can.ugc_manage %}
<button class="btn btn-sm btn-outline-secondary" id="reprocessModelsBtn" title="Have the UGC server make every model on this property again (mesh and icon), with the current settings">Reprocess all models</button>
{% endif %}
{% if can.reports_view %}
<a class="btn btn-sm btn-outline-secondary d-none" id="propEconomy" href="#">Economy &amp; map</a>
{% endif %}
@@ -88,6 +91,11 @@
</div>
<div class="col-md-2"><button class="btn btn-sm btn-primary w-100" id="importBtn">Import</button></div>
</div>
<hr>
<div class="d-flex align-items-center gap-2 flex-wrap">
<button class="btn btn-sm btn-outline-danger" id="removeModelsBtn">Remove all models</button>
<span class="small text-body-secondary">Deletes every model placed on this property; they don't go back to the owner. Not possible while the property is loaded in a world.</span>
</div>
</div>
</div>
{% endif %}
@@ -264,6 +272,21 @@ $('#modelsTable').DataTable({
language: { emptyTable: 'Nothing placed on this property' }
});
const reprocessModelsBtn = document.getElementById('reprocessModelsBtn');
if (reprocessModelsBtn) reprocessModelsBtn.addEventListener('click', () => {
reprocessModelsBtn.disabled = true;
api.action('/api/ugc/reprocess', { kind: 'model', property: propertyId }).then((d) => { toast(d.message, 'success'); load(); })
.catch(() => {}).finally(() => { reprocessModelsBtn.disabled = false; });
});
const removeModelsBtn = document.getElementById('removeModelsBtn');
if (removeModelsBtn) removeModelsBtn.addEventListener('click', () => {
if (window.prompt('This deletes every model on the property. Type the property ID (' + propertyId + ') to confirm:') !== propertyId) return;
removeModelsBtn.disabled = true;
api.action('/api/properties/' + propertyId + '/remove_models', { confirm: propertyId }).then((d) => { toast(d.message, 'success'); load(); })
.catch(() => {}).finally(() => { removeModelsBtn.disabled = false; });
});
const importBtn = document.getElementById('importBtn');
if (importBtn) importBtn.addEventListener('click', async () => {
const file = document.getElementById('importFile').files[0];