diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-11-29 16:28:27 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-04-16 16:38:32 +0200 |
commit | 4beeb842d8e4eff1f6e433a4f86d081efe554c98 (patch) | |
tree | 42ac1c1ba3aa816fe51944274077aad49277b81c | |
parent | e28a17667e5d6b63500211295ae09a0fa2c1135e (diff) | |
download | Ishtar-4beeb842d8e4eff1f6e433a4f86d081efe554c98.tar.bz2 Ishtar-4beeb842d8e4eff1f6e433a4f86d081efe554c98.zip |
🐛 reload import table page at the end of an import (refs #5665)
-rw-r--r-- | ishtar_common/static/js/ishtar.js | 8 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/import_table.html | 22 |
2 files changed, 10 insertions, 20 deletions
diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js index 10ca7bd6c..ab9e7eb6f 100644 --- a/ishtar_common/static/js/ishtar.js +++ b/ishtar_common/static/js/ishtar.js @@ -2141,6 +2141,8 @@ var import_table_refresh_import_item = function(item){ } }; +var import_table_import_is_progress = new Array(); + var import_table_refresh_import_list = function(data){ for (item_id in data["group"]){ let item = data["group"][item_id]; @@ -2150,6 +2152,9 @@ var import_table_refresh_import_list = function(data){ let item = data["import"][item_id]; import_table_refresh_import_item(item); if (item["current_line"]){ + if (!import_table_import_is_progress.includes(item["full_id"])){ + import_table_import_is_progress.push(item["full_id"]); + } $("#progress-" + item["full_id"]).attr("aria-valuenow", item["current_line"]); $("#progress-" + item["full_id"]).attr("aria-valuemax", item["status"]); $("#progress-" + item["full_id"]).attr("style", "width: " + item["progress_percent"] + "%"); @@ -2164,6 +2169,9 @@ var import_table_refresh_import_list = function(data){ item["current_line"] + "/" + item["number_of_line"] ); } + if ((item["state"][0] == "F") && import_table_import_is_progress.includes(item["full_id"])){ + location.reload(); + } if (item["has_error"]){ $("#import-" + item["full_id"]).addClass("import-row-error"); } else { diff --git a/ishtar_common/templates/ishtar/import_table.html b/ishtar_common/templates/ishtar/import_table.html index 56e73c6f0..7c65cd2f7 100644 --- a/ishtar_common/templates/ishtar/import_table.html +++ b/ishtar_common/templates/ishtar/import_table.html @@ -5,31 +5,12 @@ {% trans "Error" as error_label %} {% trans "Match" as match_label %} {% localize off %}<script type="text/javascript"> - {% comment %} - - /* TODO : à effacer ? */ - - var html = $("#message_list").html(); - {% if MESSAGES and AJAX %}{% for message, message_type in MESSAGES %} - html += '<div class="alert alert-{{message_type}} alert-dismissible fade show"'; - html += ' role="alert">'; - html += ' {{message}}'; - html += ' <button type="button" class="close" data-dismiss="alert"'; - html += ' aria-label="Close">'; - html += ' <span aria-hidden="true">×</span>'; - html += ' </button>'; - html += ' </div>'; - {% endfor %}{% endif %} - $("#message_list").html(html); - - {% endcomment %} - $("#import-list").find('select').prop('disabled', true); $("#import-list").find('input').prop('disabled', true); var import_table_update_import_ids = new Array(); var import_table_import_state = new Array(); - {% for import in object_list %}{% if import.state == 'IP' or import.state == 'PP' %} + {% for import in object_list %}{% if import.state == 'IP' or import.state == 'PP' or import.state == 'IQ' %} import_table_update_import_ids.push("{{import.import_id}}"); {% if not import.importer_type.type_label %}{# group #}{% for sub in import.import_list %} import_table_update_import_ids.push("{{sub.id}}");{% endfor %} @@ -38,6 +19,7 @@ if (import_table_update_import_ids.length) need_refresh = true; $(document).ready(function(){ + setTimeout(function(){$(".alert-info.alert-dismissible").hide("fade");}, 5000); register_qa(); if (need_refresh) setInterval(function(){ import_table_update_import_list(import_table_update_import_ids) |