-
+
diff --git a/geotrek/common/static/common/css/import.css b/geotrek/common/static/common/css/import.css
index 0a46011a5f..65ba3fc801 100644
--- a/geotrek/common/static/common/css/import.css
+++ b/geotrek/common/static/common/css/import.css
@@ -9,12 +9,10 @@
}
#progress-bars div.alert {
- margin-left: 45px;
display: none;
}
#progress-bars div.description {
- margin-left: 45px;
}
#progress-bars span.parser{
diff --git a/geotrek/common/static/common/js/import.js b/geotrek/common/static/common/js/import.js
index 3dfe34ca34..a1ebf63d65 100644
--- a/geotrek/common/static/common/js/import.js
+++ b/geotrek/common/static/common/js/import.js
@@ -2,38 +2,42 @@ function updateImportProgressBars() {
$.getJSON('/commands/import-update.json', function(json) {
parent = document.querySelector('#progress-bars');
json.forEach(function(row) {
- var local_percent = row.result.current + "%";
- var status_class = 'pogress-info';
-
- if (row.status == 'SUCCESS') {
- local_percent = "100%";
- status_class = "progress-success";
- } else if (row.status == 'FAILURE') {
- local_percent = "100%";
- status_class = "progress-danger";
+ var local_percent = row.result.current;
+ var status_class = '';
+
+ if (row.status === 'SUCCESS') {
+ local_percent = "100";
+ status_class = "bg-success";
+ } else if (row.status === 'FAILURE') {
+ local_percent = "100";
+ status_class = "bg-danger";
}
// Update element if exists
if (element = document.getElementById(row.id)) {
- element.querySelector('.bar').style.width = local_percent;
- element.querySelector('.pull-left').innerHTML = local_percent;
+ element.querySelector('.progress-bar').setAttribute('style', 'width: ' + local_percent + '% ;');
+ element.querySelector('.progress-bar').setAttribute('aria-valuenow', local_percent);
+ element.querySelector('.progress-bar').innerHTML = local_percent + "%";
if(!element.querySelector('.alert').classList.contains('alert-success')) {
// Add report if success.
if (row.result.report) {
alert = element.querySelector('.alert');
alert.classList.add('alert-success');
- alert.innerHTML = row.result.report;
+ message = element.querySelector('.message');
+ message.innerHTML = row.result.report;
alert.style.display = 'block';
}
}
} else { //Create element in dom.
element = document.createElement('div');
- element.innerHTML = document.querySelector('#import-template').innerHTML
+ element.innerHTML = document.querySelector('#import-template').innerHTML;
element.id = row.id;
- element.querySelector('.bar').style.width = local_percent + ' : ';
- element.querySelector('.pull-left').innerHTML = local_percent;
+ element.querySelector('.progress-bar').setAttribute('style', 'width: ' + local_percent + '% ;');
+ element.querySelector('.progress-bar').setAttribute('aria-valuenow', local_percent);
+ element.querySelector('.progress-bar').innerHTML = local_percent + "%";
+
element.querySelector('.parser').innerHTML = row.result.parser;
element.querySelector('.filename').innerHTML = row.result.filename;
@@ -43,13 +47,13 @@ function updateImportProgressBars() {
// Handle errors if any.
if (row.result.exc_message) {
element.querySelector('.alert').classList.add('alert-danger');
- element.querySelector('.alert span').innerHTML = row.result.exc_type + " : " + row.result.exc_message;
+ element.querySelector('.message span').innerHTML = row.result.exc_type + " : " + row.result.exc_message;
element.querySelector('.alert').style.display = 'block';
}
// Add class on status change.
- if (!element.querySelector('.progress').classList.contains(status_class)) {
- element.querySelector('.progress').classList.add(status_class);
+ if (!element.querySelector('.progress-bar').classList.contains(status_class)) {
+ element.querySelector('.progress-bar').classList.add(status_class);
}
});
});
diff --git a/geotrek/common/templates/common/import_dataset.html b/geotrek/common/templates/common/import_dataset.html
index c789e278c5..e698b76dc5 100644
--- a/geotrek/common/templates/common/import_dataset.html
+++ b/geotrek/common/templates/common/import_dataset.html
@@ -36,22 +36,19 @@
{% endblock mainpanel %}
diff --git a/geotrek/common/views.py b/geotrek/common/views.py
index 3ab4ff7f67..1c86db22e4 100644
--- a/geotrek/common/views.py
+++ b/geotrek/common/views.py
@@ -1,12 +1,12 @@
import ast
import json
+import logging
import mimetypes
import os
import re
from datetime import timedelta
from zipfile import ZipFile, is_zipfile
-import logging
import redis
from django.apps import apps
from django.conf import settings
@@ -19,29 +19,21 @@
from django.contrib.gis.db.models import Extent, GeometryField
from django.core.exceptions import PermissionDenied
from django.db.models.functions import Cast
-from django.http import (Http404, HttpResponse, HttpResponseRedirect,
- JsonResponse)
-from django.shortcuts import get_object_or_404, redirect, render
-from django.urls import reverse
-from django.utils import timezone
from django.http import JsonResponse, Http404, HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render, redirect
-from django.urls import reverse, reverse_lazy
-from django.utils import timezone, translation
+from django.urls import reverse
+from django.utils import timezone
from django.utils.decorators import method_decorator
from django.utils.encoding import force_str
from django.utils.translation import gettext as _
from django.views import static
-from django.views.defaults import page_not_found
-from django.views.decorators.http import require_http_methods, require_POST
-from django.views.generic import TemplateView, UpdateView, View
-from django.views.generic import RedirectView, TemplateView, UpdateView, View
from django.views.decorators.http import require_POST, require_http_methods
-from django.views.generic import RedirectView, View, FormView
+from django.views.defaults import page_not_found
from django.views.generic import TemplateView
+from django.views.generic import UpdateView
+from django.views.generic import View
from django_celery_results.models import TaskResult
from django_large_image.rest import LargeImageFileDetailMixin
-from geotrek.common.filters import HDViewPointFilterSet
from large_image import config
from mapentity import views as mapentity_views
from mapentity.helpers import api_bbox
@@ -54,11 +46,9 @@
from geotrek import __version__
from geotrek.celery import app as celery_app
+from geotrek.common.filters import HDViewPointFilterSet
from geotrek.common.viewsets import GeotrekMapentityViewSet
from geotrek.feedback.parsers import SuricateParser
-
-from ..altimetry.models import Dem
-from ..core.models import Path
from .forms import (AttachmentAccessibilityForm, HDViewPointAnnotationForm,
HDViewPointForm, ImportDatasetForm,
ImportDatasetFormWithFile, ImportSuricateForm)
@@ -70,6 +60,8 @@
from .utils import leaflet_bounds
from .utils.import_celery import (create_tmp_destination,
discover_available_parsers)
+from ..altimetry.models import Dem
+from ..core.models import Path
logger = logging.getLogger(__name__)