diff --git a/atdb/taskdatabase/serializers.py b/atdb/taskdatabase/serializers.py index 45bbd2823f400d25956676c681fc5fbaff4b5e61..a260c1d888ef2cffa1114cd55d1f8d71efae3a49 100644 --- a/atdb/taskdatabase/serializers.py +++ b/atdb/taskdatabase/serializers.py @@ -98,7 +98,7 @@ class TaskReadSerializer(serializers.ModelSerializer): 'workflow', 'stage_request_id', 'status','new_status','quality', - 'inputs','outputs','metrics','status_history', + 'inputs','outputs','metrics','remarks','status_history', 'size_to_process', 'size_processed', 'total_processing_time', 'log_entries','meta_scheduling','environment' ] diff --git a/atdb/taskdatabase/templates/taskdatabase/query/set_multi_status_panel.html b/atdb/taskdatabase/templates/taskdatabase/query/set_multi_status_panel.html index 2328da1a792cdc2525614ce06c3a190b5af6a88d..f2606a3c328088c3d88c978de33e47d9fb3e93e6 100644 --- a/atdb/taskdatabase/templates/taskdatabase/query/set_multi_status_panel.html +++ b/atdb/taskdatabase/templates/taskdatabase/query/set_multi_status_panel.html @@ -10,11 +10,11 @@ <tr> <a href="{% url 'task-multi-hold' 'hold' request.GET %}" class="btn btn-danger btn-sm" role="button"><i class="fas fa-pause"></i> hold</a> <a href="{% url 'task-multi-hold' 'resume' request.GET %}" class="btn btn-danger btn-sm" role="button"><i class="fas fa-play"></i> start</a> - <a href="{% url 'task-multi-setstatus' 'defined' request.GET %}" class="btn btn-danger btn-sm" role="button"><i class="fas fa-sync-alt"></i> defined</a> <a href="{% url 'task-multi-setstatus' 'staged' request.GET %}" class="btn btn-danger btn-sm" role="button"><i class="fas fa-sync-alt"></i> staged</a> <a href="{% url 'task-multi-setstatus' 'processed' request.GET %}" class="btn btn-danger btn-sm" role="button"><i class="fas fa-sync-alt"></i> processed</a> <a href="{% url 'task-multi-setstatus' 'validated' request.GET %}" class="btn btn-danger btn-sm" role="button"><i class="fas fa-sync-alt"></i> validated</a> + <a href="{% url 'task-multi-setstatus' 'stored' request.GET %}" class="btn btn-danger btn-sm" role="button"><i class="fas fa-sync-alt"></i> stored</a> <a href="{% url 'task-multi-setstatus' 'scrubbed' request.GET %}" class="btn btn-danger btn-sm" role="button"><i class="fas fa-sync-alt"></i> scrubbed</a> <a href="{% url 'task-multi-setstatus' 'archived' request.GET %}" class="btn btn-danger btn-sm" role="button"><i class="fas fa-sync-alt"></i> archived</a> <a href="{% url 'task-multi-setstatus' 'finished' request.GET %}" class="btn btn-danger btn-sm" role="button"><i class="fas fa-sync-alt"></i> finished</a> diff --git a/atdb/taskdatabase/templates/taskdatabase/validation/annotate.html b/atdb/taskdatabase/templates/taskdatabase/validation/annotate.html new file mode 100644 index 0000000000000000000000000000000000000000..beac39a483479ca150cfcc2b4a8e995583bf45d2 --- /dev/null +++ b/atdb/taskdatabase/templates/taskdatabase/validation/annotate.html @@ -0,0 +1,7 @@ + +<form class="navbar-form navbar-left" role="Annotate" onsubmit="writeToLocalStorage('annotate')" method="get" action=""> + <div class="form-group"> + <input type="text" class="form-control" id="annotate_box" name="annotate" placeholder="Annotate..." value=""> + </div> +</form> + diff --git a/atdb/taskdatabase/templates/taskdatabase/validation/annotate_quality.html b/atdb/taskdatabase/templates/taskdatabase/validation/annotate_quality.html new file mode 100644 index 0000000000000000000000000000000000000000..9a87b5d9859de70084bb51ace5f13a102efcc41d --- /dev/null +++ b/atdb/taskdatabase/templates/taskdatabase/validation/annotate_quality.html @@ -0,0 +1,18 @@ +{% load static %} + +<div class="card"> + <div class="card-body"> + <h4>Quality Annotation</h4> + <table class="table table-striped"> + {{ quality_remarks | safe }} + </table> + </div> + <form class="navbar-form navbar-left" role="Annotate" onsubmit="writeToLocalStorage('annotate')" method="get" action=""> + <div class="form-group"> + <input type="text" class="form-control" id="annotate_box" name="annotate" placeholder="Enter annotation..." value={{ quality_remarks | safe }}> + </div> + </form> +</div> + +{% include "taskdatabase/modal/modal_script.html" %} +{% include "taskdatabase/modal/modal.html" %} \ No newline at end of file diff --git a/atdb/taskdatabase/templates/taskdatabase/validation/tasks_validation.html b/atdb/taskdatabase/templates/taskdatabase/validation/tasks_validation.html index 0485f26a8fca50c9da59b1d01d0052fa5a98341f..506062059bb6295fe4095ead22d9b8ac533f525b 100644 --- a/atdb/taskdatabase/templates/taskdatabase/validation/tasks_validation.html +++ b/atdb/taskdatabase/templates/taskdatabase/validation/tasks_validation.html @@ -35,8 +35,8 @@ <td>{{value}}</td> {% endfor %} <td> - <a href="https://ganglia.grid.surfsara.nl/dcache.php?vo=Lofar&r=day" - class="btn btn-info btn-sm" role="button" target="_blank"><img src="{% static 'taskdatabase/surfsara.jpg' %}" height="20" alt=""></a> + <a href="" + class="btn btn-primary btn-sm" role="button" target="_blank"><img src="{% static 'taskdatabase/surfsara.jpg' %}" height="20" alt="this is a placeholder, links to plots will follow"></a> </td> {% else %} <td>-</td><td>-</td><td>-</td><td>-</td> @@ -47,25 +47,23 @@ <td> {% if task.has_quality_remarks %} - <a class="open-modal btn btn-primary btn-sm" - href="{% url 'task-quality' task.id my_tasks.number %}" - data-popup-url="{% url 'task-quality' task.id my_tasks.number %}"> + <a class="open-modal btn btn-warning btn-sm" + href="{% url 'annotate-quality' task.id my_tasks.number %}" + data-popup-url="{% url 'annotate-quality' task.id my_tasks.number %}"> <i class="fas fa-pen-alt"></i> </a> {% else %} <a class="open-modal btn btn-secondary btn-sm" - href="{% url 'task-quality' task.id my_tasks.number %}" - data-popup-url="{% url 'task-quality' task.id my_tasks.number %}"> + href="{% url 'annotate-quality' task.id my_tasks.number %}" + data-popup-url="{% url 'annotate-quality' task.id my_tasks.number %}"> <i class="fas fa-pen-alt"></i> </a> {% endif %} </td> <td> - <a href="{% url 'task-validate-view' task.pk 'poor' 'validated' my_tasks.number %}" class="btn btn-danger btn-sm" role="button"><i class="fas fa-check"></i> P</a> <a href="{% url 'task-validate-view' task.pk 'moderate' 'validated' my_tasks.number %}" class="btn btn-warning btn-sm" role="button"><i class="fas fa-check"></i> M</a> <a href="{% url 'task-validate-view' task.pk 'good' 'validated' my_tasks.number %}" class="btn btn-success btn-sm" role="button"><i class="fas fa-check"></i> G</a> - </td> </tr> diff --git a/atdb/taskdatabase/templates/taskdatabase/validation/tasks_validation_headers.html b/atdb/taskdatabase/templates/taskdatabase/validation/tasks_validation_headers.html index 88d6dc4743303e097b2c8b5718106d30b3bca970..fbb2435a07b3ef6f45d3bf679b965989b70ce0b4 100644 --- a/atdb/taskdatabase/templates/taskdatabase/validation/tasks_validation_headers.html +++ b/atdb/taskdatabase/templates/taskdatabase/validation/tasks_validation_headers.html @@ -26,6 +26,6 @@ <th>Conditions</th> <th>Plots</th> <th>Quality</th> - <th>Edit</th> + <th>Annotate</th> <th>Poor/Moderate/Good</th> </tr> \ No newline at end of file diff --git a/atdb/taskdatabase/urls.py b/atdb/taskdatabase/urls.py index fa5b2c7d4bb9a5e9e210c7e600b455cbde793a21..4f2cca518e2e1feedd9891118467f9c6bba2dab2 100644 --- a/atdb/taskdatabase/urls.py +++ b/atdb/taskdatabase/urls.py @@ -23,6 +23,8 @@ urlpatterns = [ path('task_details/', views.TaskDetails, name='task-details'), path('task_quality/<int:id>/<page>', views.TaskQuality, name='task-quality'), path('task_quality/', views.TaskQuality, name='task-quality'), + path('annotate_quality/<int:id>/<page>', views.AnnotateQuality, name='annotate-quality'), + path('annotate_quality/', views.AnnotateQuality, name='annotate-quality'), path('show-inputs/<int:id>/', views.ShowInputs, name='show-inputs'), path('show-outputs/<int:id>/', views.ShowOutputs, name='show-outputs'), diff --git a/atdb/taskdatabase/views.py b/atdb/taskdatabase/views.py index 8e5a20249a268e2cd3fcf32b8a5da7275764b0c3..86899d54b7d656db41e94b467ae52fc750677e12 100644 --- a/atdb/taskdatabase/views.py +++ b/atdb/taskdatabase/views.py @@ -579,6 +579,30 @@ def TaskQuality(request, id=0, page=0): return render(request, "taskdatabase/tasks/task_quality.html", {'task': task, 'quality': quality_html}) +def AnnotateQuality(request, id=0, page=0): + try: + task = Task.objects.get(id=id) + + # store the requested task_id on the session + request.session['task_id'] = task.id + + except: + # when an invalid id is given, like '/atdb/task_details/0/', + # then look if there is a task stored on the session + try: + task_on_session = request.session['task_id'] + task = Task.objects.get(id=task_on_session) + except: + messages.add_message(request, messages.WARNING, 'no task selected.') + return redirect('index') + + # store the current page on the session + request.session['page'] = page + + quality_remarks = task.remarks['quality'] + + return render(request, "taskdatabase/validation/annotate_quality.html", {'task': task, 'quality_remarks': quality_remarks}) + def ShowInputs(request, id): task = Task.objects.get(id=id) @@ -1062,7 +1086,7 @@ def TaskMultiStatus(request, new_status, query_params): current_query_params = convert_query_params_to_url(query_params) request.session['current_query_params'] = current_query_params - return render(request, "query/confirm_multi_change.html", {'new_value': new_status, 'count': count}) + return render(request, "taskdatabase/query/confirm_multi_change.html", {'new_value': new_status, 'count': count}) @login_required @@ -1086,7 +1110,7 @@ def TaskMultiHold(request, onhold, query_params): current_query_params = convert_query_params_to_url(query_params) request.session['current_query_params'] = current_query_params - return render(request, "query/confirm_multi_change.html", {'new_value': onhold, 'count': count}) + return render(request, "taskdatabase/query/confirm_multi_change.html", {'new_value': onhold, 'count': count}) # /atdb/get_size?status__in=defined,staged