fix: increase investigate time; more feedback (#8457)

This commit is contained in:
Jennifer Richards 2025-01-22 13:52:09 -04:00 committed by GitHub
parent 567d55fa12
commit 9a72cc0d6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 8 deletions

View file

@ -18,13 +18,13 @@ document.addEventListener('DOMContentLoaded', () => {
loadResultsFromTask('bogus-task-id') // bad task id will generate an error from Django loadResultsFromTask('bogus-task-id') // bad task id will generate an error from Django
} }
const taskId = (await response.json()).id const taskId = (await response.json()).id
// Poll for completion of the investigation up to 18*10 = 180 seconds // Poll for completion of the investigation up to 60*10 = 600 seconds
waitForResults(taskId, 18) waitForResults(taskId, 60)
} }
const waitForResults = async (taskId, retries) => { const waitForResults = async (taskId, retries) => {
// indicate that investigation is in progress // indicate that investigation is in progress
document.getElementById('spinner').classList.remove('d-none') document.querySelectorAll('.investigation-indicator').forEach(elt => elt.classList.remove('d-none'))
document.getElementById('investigate-button').disabled = true document.getElementById('investigate-button').disabled = true
investigateForm.elements['id_name_fragment'].disabled = true investigateForm.elements['id_name_fragment'].disabled = true

View file

@ -13,13 +13,15 @@
{% csrf_token %} {% csrf_token %}
{% bootstrap_form form %} {% bootstrap_form form %}
<button class="btn btn-primary" type="submit" id="investigate-button"> <button class="btn btn-primary" type="submit" id="investigate-button">
<span id="spinner" <span class="spinner-border spinner-border-sm investigation-indicator d-none"
class="spinner-border spinner-border-sm d-none" role="status"
role="status" aria-hidden="true">
aria-hidden="true"> </span>
</span>
Investigate Investigate
</button> </button>
<div class="alert alert-info mt-3 d-none investigation-indicator">
Please be patient, processing may take several minutes.
</div>
</form> </form>
</div> </div>
{% if results %} {% if results %}