-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
486e80a
commit dcb7e65
Showing
4 changed files
with
73 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from rest_framework import serializers | ||
from kernelCI_app.models import Checkouts | ||
|
||
|
||
class CheckoutsSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Checkouts | ||
fields = [ | ||
'field_timestamp', 'id', 'origin', 'tree_name', | ||
'git_repository_url', 'git_commit_hash', 'git_commit_name', | ||
'git_repository_branch', 'patchset_files', 'patchset_hash', | ||
'message_id', 'comment', 'start_time', 'contacts', | ||
'log_url', 'log_excerpt', 'valid', 'misc' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.urls import path | ||
from kernelCI_app import views | ||
|
||
|
||
urlpatterns = [ | ||
path('tree/', views.TreeView.as_view(), name='tree') | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,51 @@ | ||
# from django.shortcuts import render | ||
from django.http import JsonResponse | ||
from django.views import View | ||
|
||
# Create your views here. | ||
from kernelCI_app.models import Checkouts | ||
from kernelCI_app.serializers import CheckoutsSerializer | ||
|
||
|
||
class TreeView(View): | ||
|
||
def get(self, _): | ||
checkout_ids = config.keys() | ||
checkouts = Checkouts.objects.filter(id__in=checkout_ids) | ||
serializer = CheckoutsSerializer(checkouts, many=True) | ||
for d in serializer.data: | ||
d.update(config.get(d["id"])) | ||
|
||
return JsonResponse(serializer.data, safe=False) | ||
|
||
|
||
config = { | ||
"broonie:7592653346c84691a16ccd1c115df05c": { | ||
"tree_name": "mainline", | ||
"build_status": {"finished": 160, "total": 182}, | ||
"test_status": {"finished": 182, "total": 182}, | ||
}, | ||
"broonie:170e93ec1178448293bb3b1163b1a4ee": { | ||
"tree_name": "stable", | ||
"build_status": {"finished": 182, "total": 182}, | ||
"test_status": {"finished": 820, "total": 820}, | ||
}, | ||
"broonie:88964264010d43159ffa28bb524be058": { | ||
"tree_name": "stable", | ||
"build_status": {"finished": 160, "total": 182}, | ||
"test_status": {"finished": 642, "total": 820} | ||
}, | ||
"broonie:12f55b2668fb4eca9254bfadad4ee871": { | ||
"tree_name": "stable", | ||
"build_status": {"finished": 182, "total": 182}, | ||
"test_status": {"finished": 820, "total": 820} | ||
}, | ||
"broonie:c4ea3368208f4909b5af51c6a148047d": { | ||
"tree_name": "stable", | ||
"build_status": {"finished": 182, "total": 182}, | ||
"test_status": {"finished": 820, "total": 820} | ||
}, | ||
"broonie:1b17e613a3e94254af6fef1167572d35": { | ||
"tree_name": "stable", | ||
"build_status": {"finished": 182, "total": 182}, | ||
"test_status": {"finished": 820, "total": 820} | ||
}, | ||
} |