From 6b4b3a75b462fd432a5e99f8c60ea09b2f1cb779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thierry=20Yg=C3=A9?= Date: Fri, 4 Feb 2022 16:45:17 +0100 Subject: [PATCH] #1994 Fixing to fallback in case of local execution --- locust/static/tasks.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/locust/static/tasks.js b/locust/static/tasks.js index 11b9e68e82..4765620ba2 100644 --- a/locust/static/tasks.js +++ b/locust/static/tasks.js @@ -28,13 +28,19 @@ function _getTasks_div(root, title) { return taskDiv } +function renderTasks(data) { + var tasks = $('#tasks .tasks'); + tasks.empty(); + tasks.append(_getTasks_div(data.per_class, 'Ratio per User class')); + tasks.append(_getTasks_div(data.total, 'Total ratio')); +} function updateTasks() { $.get('/tasks', function (data) { - var tasks = $('#tasks .tasks'); - tasks.empty(); - tasks.append(_getTasks_div(data.per_class, 'Ratio per User class')); - tasks.append(_getTasks_div(data.total, 'Total ratio')); + renderTasks(data); + }).fail(function() { + // fallback issue #1994 + renderTasks($('#tasks .tasks').data('tasks')); }); } updateTasks();