From 2d5525ccce0e47666659c7af4fc7d869e4fe2f88 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Tue, 20 Aug 2024 16:47:00 -0600 Subject: [PATCH] begin work on frontend processing --- src/geo-backend/data/views/import_item.py | 4 ++-- .../src/components/import/Process.vue | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/geo-backend/data/views/import_item.py b/src/geo-backend/data/views/import_item.py index 53ea143..1ea3b9a 100644 --- a/src/geo-backend/data/views/import_item.py +++ b/src/geo-backend/data/views/import_item.py @@ -72,7 +72,7 @@ def fetch_import_queue(request, id): if queue.user_id != request.user.id: return JsonResponse({'success': False, 'msg': 'not authorized to view this item', 'code': 403}, status=400) if not lock_manager.is_locked('data_importqueue', queue.id) and (len(queue.geofeatures) or len(queue.log)): - return JsonResponse({'success': True, 'geofeatures': queue.geofeatures, 'log': queue.log}, status=200) + return JsonResponse({'success': True, 'geofeatures': queue.geofeatures, 'log': queue.log, 'msg': None}, status=200) return JsonResponse({'success': True, 'geofeatures': [], 'log': [], 'msg': 'uploaded data still processing'}, status=200) except ImportQueue.DoesNotExist: return JsonResponse({'success': False, 'msg': 'ID does not exist', 'code': 404}, status=400) @@ -88,7 +88,7 @@ def fetch_queued(request): item['processing'] = not (len(item['geofeatures']) and len(item['log'])) and lock_manager.is_locked('data_importqueue', item['id']) item['feature_count'] = count del item['geofeatures'] - return JsonResponse({'data': data}) + return JsonResponse({'data': data, 'msg': None}) @login_required_401 diff --git a/src/geo-frontend/src/components/import/Process.vue b/src/geo-frontend/src/components/import/Process.vue index 6655142..a937d95 100644 --- a/src/geo-frontend/src/components/import/Process.vue +++ b/src/geo-frontend/src/components/import/Process.vue @@ -7,14 +7,15 @@

Messages

-
  • +
  • {{ item }}

  • -
  • +
  • +

    {{ item.name }}

    -        {{ parseGeoJson(item) }}
    +        {{ item }}
           
  • @@ -45,8 +46,9 @@ export default { data() { return { msg: "", - importResponse: {}, currentId: null, + itemsForUser: [], + workerLog: [] } }, mixins: [authMixin], @@ -73,7 +75,8 @@ export default { next(async vm => { if (vm.currentId !== vm.id) { vm.msg = "" - vm.importResponse = [] + vm.messages = [] + vm.itemsForUser = [] vm.currentId = null axios.get('/api/data/item/import/get/' + vm.id).then(response => { if (!response.data.success) { @@ -81,9 +84,12 @@ export default { } else { vm.currentId = vm.id if (Object.keys(response.data).length > 0) { - vm.importResponse = response.data + response.data.geofeatures.forEach((item) => { + vm.itemsForUser.push(vm.parseGeoJson(item)) + }) } vm.msg = response.data.msg + vm.workerLog = response.data.log } }).catch(error => { vm.handleError(error.message)