Skip to content

Commit

Permalink
Bugfix: project list was continuously refreshing if a project was in …
Browse files Browse the repository at this point in the history
…state Pending
  • Loading branch information
fxbru committed Feb 18, 2023
1 parent d43ec9d commit d0c0374
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/base/static/assets/js/grepmarx-common.js
Expand Up @@ -69,8 +69,8 @@ async function ajaxRefreshStatus(projectId) {
reqProjectStatus = new XMLHttpRequest();
reqProjectStatus.onreadystatechange = function () {
if (reqProjectStatus.readyState === XMLHttpRequest.DONE) {
status = reqProjectStatus.responseText;
if (status != 2) {
state = reqProjectStatus.responseText;
if (state != 2 && state != 4) {
document.location = '/projects';
}
}
Expand Down
10 changes: 5 additions & 5 deletions app/projects/templates/projects_list.html
Expand Up @@ -83,7 +83,7 @@ <h3 class="card-title">Projects list</h3>
</thead>
<tbody>
{% for c_project in projects %}
{# Trigger auto-refresh if state is STATE_ANALYSING % #}
{# Trigger auto-refresh if state is Analyzing or Pending % #}
{% if c_project.status == 2 or c_project.status == 4 %}
<div id="{{ c_project.id}}" class="check-status"></div>
{% endif %}
Expand Down Expand Up @@ -348,10 +348,10 @@ <h5 class="modal-title">Confirm deletion</h5>
});
});

/* Activate auto-refresh if a project is being analyzed */
analyzing = document.getElementsByClassName("check-status");
if (analyzing.length > 0) {
ajaxRefreshStatus(analyzing[0].id);
/* Activate auto-refresh if a project is Anlyzing or Pending */
needRefresh = document.getElementsByClassName("check-status");
if (needRefresh.length > 0) {
ajaxRefreshStatus(needRefresh[0].id);
}

</script>
Expand Down

0 comments on commit d0c0374

Please sign in to comment.