Commit ff793726 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

Merge branch 'dev-nico' into 'master'

add PostProcessingRule object to database

See merge request !149
parents 934ad522 883b7b31
Pipeline #23701 passed with stages
in 3 minutes and 21 seconds
......@@ -96,4 +96,12 @@ p.title {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.modal-body {
padding: 0 !important;
}
.modal-dialog .modal-lg {
max-width: 75% !important;
}
\ No newline at end of file
# Generated by Django 3.1.4 on 2022-01-17 13:50
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('taskdatabase', '0007_auto_20211214_0941'),
]
operations = [
migrations.CreateModel(
name='PostProcessingRule',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('aggregation_key', models.CharField(blank=True, db_index=True, default=None, max_length=20, null=True)),
('trigger_status', models.CharField(blank=True, db_index=True, default='unknown', max_length=50, null=True)),
('workflow_to_apply', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='to_apply', to='taskdatabase.workflow')),
('workflow_to_process', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='to_process', to='taskdatabase.workflow')),
],
),
]
......@@ -115,4 +115,13 @@ class Job(models.Model):
# the representation of the value in the REST API
def __str__(self):
return 'task_id:'+str(self.task_id)+', job_id:'+str(self.job_id)
\ No newline at end of file
return 'task_id:'+str(self.task_id)+', job_id:'+str(self.job_id)
class PostProcessingRule(models.Model):
aggregation_key = models.CharField(db_index=True, max_length=20, default=None,null=True, blank=True)
trigger_status = models.CharField(db_index=True, default="unknown", max_length=50, blank=True, null=True)
# relationships
workflow_to_process = models.ForeignKey(Workflow, related_name='to_process', on_delete=models.SET_NULL, null=True, blank=True)
workflow_to_apply = models.ForeignKey(Workflow, related_name='to_apply',on_delete=models.SET_NULL, null=True, blank=True)
from rest_framework import serializers
from .models import Status, Task, Workflow, LogEntry, Configuration, Job
from .models import Status, Task, Workflow, LogEntry, Configuration, Job, PostProcessingRule
......@@ -163,3 +163,9 @@ class JobSerializer(serializers.ModelSerializer):
class Meta:
model = Job
fields = "__all__"
class PostProcessingRuleSerializer(serializers.ModelSerializer):
class Meta:
model = PostProcessingRule
fields = "__all__"
\ No newline at end of file
......@@ -6322,7 +6322,7 @@ a.close.disabled {
@media (min-width: 992px) {
.modal-lg,
.modal-xl {
max-width: 800px;
max-width: 75%;
}
}
......
......@@ -96,4 +96,12 @@ p.title {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.modal-body {
padding: 0 !important;
}
.modal-dialog .modal-lg {
max-width: 75% !important;
}
\ No newline at end of file
......@@ -80,7 +80,7 @@
{% include 'taskdatabase/pagination.html' %}
</div>
</div>
<p class="footer"> Version 1.0.0 (3 jan 2021 - 17:00)
<p class="footer"> Version 1.0.0 (17 jan 2021 - 15:00)
</div>
......
......@@ -46,6 +46,9 @@ urlpatterns = [
path('jobs/', views.JobListViewAPI.as_view()),
path('jobs/<int:pk>/', views.JobDetailsViewAPI.as_view(), name='job-detail-view-api'),
path('postprocessing/', views.PostProcessingRuleListViewAPI.as_view()),
path('postprocessing/<int:pk>/', views.PostProcessingRuleDetailsViewAPI.as_view(), name='postprocessing-detail-view-api'),
# --- custom requests ---
# /atdb/get_size?status__in=defined,staged
path('tasks/get_size/', views.GetSizeView.as_view(), name='get-size-view'),
......
......@@ -22,7 +22,7 @@ from django.shortcuts import render, redirect
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.conf import settings
from .models import Task, Status, Workflow, LogEntry, Configuration, Job
from .models import Task, Status, Workflow, LogEntry, Configuration, Job, PostProcessingRule
from .tables import TaskTable
from django.db.models import Q
......@@ -33,7 +33,7 @@ from .serializers import \
WorkflowSerializer,\
LogEntrySerializer,\
ConfigurationSerializer,\
JobSerializer
JobSerializer, PostProcessingRuleSerializer
from .services import algorithms
......@@ -123,6 +123,18 @@ class JobFilter(filters.FilterSet):
'job_id': ['exact'],
}
class PostProcessingFilter(filters.FilterSet):
class Meta:
model = PostProcessingRule
fields = {
'aggregation_key': ['exact', 'icontains', 'in'],
'trigger_status': ['exact', 'icontains', 'in'],
'workflow_to_process__id': ['exact'],
'workflow_to_apply__id': ['exact'],
}
# ---------- Tables2 Views (experimental) -----------
# implementation with tables2: http://localhost:8000/atdb/tables2
class QueryView(SingleTableMixin, FilterView):
......@@ -444,6 +456,7 @@ class ConfigurationDetailsViewAPI(generics.RetrieveUpdateDestroyAPIView):
queryset = Configuration.objects.all()
serializer_class = ConfigurationSerializer
# example: /atdb/job/
class JobListViewAPI(generics.ListCreateAPIView):
model = Job
......@@ -460,6 +473,23 @@ class JobDetailsViewAPI(generics.RetrieveUpdateDestroyAPIView):
queryset = Job.objects.all()
serializer_class = JobSerializer
# example: /atdb/job/
class PostProcessingRuleListViewAPI(generics.ListCreateAPIView):
model = PostProcessingRule
queryset = PostProcessingRule.objects.all()
serializer_class = PostProcessingRuleSerializer
filter_backends = (filters.DjangoFilterBackend,)
filter_class = PostProcessingFilter
# example: /atdb/job/5/
class PostProcessingRuleDetailsViewAPI(generics.RetrieveUpdateDestroyAPIView):
model = PostProcessingRule
queryset = PostProcessingRule.objects.all()
serializer_class = PostProcessingRuleSerializer
# --- controller resources, triggered by a button in the GUI or directoy with a URL ---
# set task status to 'new_status' - called from the GUI
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment