Merge pull request #382 from pierotofy/publicjson

Added public json endpoint, updated docs
pull/390/head
Piero Toffanin 2018-01-29 11:51:50 -05:00 zatwierdzone przez GitHub
commit 69f888ada2
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 13 dodań i 1 usunięć

Wyświetl plik

@ -131,6 +131,8 @@ class TestApp(BootTestCase):
self.assertTrue(res.status_code == expectedStatus)
res = client.get('/public/task/{}/iframe/map/'.format(task.id))
self.assertTrue(res.status_code == expectedStatus)
res = client.get('/public/task/{}/json/'.format(task.id))
self.assertTrue(res.status_code == expectedStatus)
test_public_views(c, status.HTTP_404_NOT_FOUND)

Wyświetl plik

@ -17,6 +17,7 @@ urlpatterns = [
url(r'^public/task/(?P<task_pk>[^/.]+)/iframe/map/$', public_views.map_iframe, name='public_map'),
url(r'^public/task/(?P<task_pk>[^/.]+)/3d/$', public_views.model_display, name='public_map'),
url(r'^public/task/(?P<task_pk>[^/.]+)/iframe/3d/$', public_views.model_display_iframe, name='public_map'),
url(r'^public/task/(?P<task_pk>[^/.]+)/json/$', public_views.task_json, name='public_map'),
url(r'^processingnode/([\d]+)/$', app_views.processing_node, name='processing_node'),

Wyświetl plik

@ -1,9 +1,11 @@
import json
from django.http import Http404
from django.http import JsonResponse
from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext as _
from django.shortcuts import render
from app.api.tasks import TaskSerializer
from app.models import Task
@ -49,4 +51,9 @@ def model_display(request, task_pk=None):
return handle_model_display(request, 'app/public/3d_model_display.html', task_pk)
def model_display_iframe(request, task_pk=None):
return handle_model_display(request, 'app/public/3d_model_display_iframe.html', task_pk)
return handle_model_display(request, 'app/public/3d_model_display_iframe.html', task_pk)
def task_json(request, task_pk=None):
task = get_public_task(task_pk)
serializer = TaskSerializer(task)
return JsonResponse(serializer.data)

Wyświetl plik

@ -8,6 +8,7 @@
"project": 27,
"processing_node": 10,
"images_count": 48,
"can_rerun_from": [],
"available_assets": [
"all.zip",
"orthophoto.tif",
@ -43,6 +44,7 @@ id | int | Unique identifier
project | int | [Project](#project) ID the task belongs to
processing_node | int | The ID of the [Processing Node](#processing-node) this task has been assigned to, or `null` if no [Processing Node](#processing-node) has been assigned.
images_count | int | Number of images
can_rerun_from | string[] | List of possible "rerun-from" options that this task could restart from, given its currently assigned processing node. If this is an empty list, the task can only be restarted from the start of the pipeline.
available_assets | string[] | List of [assets](#download-assets) available for download
uuid | string | Unique identifier assigned by a [Processing Node](#processing-node) once processing has started.
name | string | User defined name for the task