Patchwork [bitbake-devel,84/94] bitbake: webhob: update API endpoints

login
register
mail settings
Submitter Alexandru DAMIAN
Date Sept. 24, 2013, 4:52 p.m.
Message ID <5e6dc71033aa34e071755d20778db3f200d6aba4.1380041477.git.alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/58781/
State New
Headers show

Comments

Alexandru DAMIAN - Sept. 24, 2013, 4:52 p.m.
From: Alexandru DAMIAN <alexandru.damian@intel.com>

Updating the API endpoints as described by the documentation.

The documentation updated here:
https://wiki.yoctoproject.org/wiki/REST_API_Contracts

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
---
 bitbake/lib/webhob/bldviewer/api.py   | 20 ++++++++++++++------
 bitbake/lib/webhob/bldviewer/views.py | 15 ++++++++++++---
 2 files changed, 26 insertions(+), 9 deletions(-)

Patch

diff --git a/bitbake/lib/webhob/bldviewer/api.py b/bitbake/lib/webhob/bldviewer/api.py
index 9fa701c..2e58313 100644
--- a/bitbake/lib/webhob/bldviewer/api.py
+++ b/bitbake/lib/webhob/bldviewer/api.py
@@ -2,10 +2,18 @@  from django.conf.urls import patterns, include, url
 
 
 urlpatterns = patterns('bldviewer.views',
-        url(r'^builds/$', 'model_explorer',  {'model_name':'build'}, name='builds'),
-        url(r'^tasks/$', 'model_explorer', {'model_name':'task'}, name='task'),
-        url(r'^packages/$', 'model_explorer', {'model_name':'package'}, name='package'),
-        url(r'^layers/$', 'model_explorer', {'model_name':'layer'}, name='layer'),
-        url(r'^recipes/$', 'model_explorer', {'model_name':'recipe'}, name='recipe'),
-        url(r'^layersversions/$', 'model_explorer', {'model_name':'layerversion'}, name='layerversion'),
+        url(r'^builds$', 'model_explorer',  {'model_name':'build'}, name='builds'),
+        url(r'^targets$', 'model_explorer',  {'model_name':'target'}, name='targets'),
+        url(r'^tasks$', 'model_explorer', {'model_name':'task'}, name='task'),
+        url(r'^task_dependencies$', 'model_explorer',  {'model_name':'task_dependency'}, name='task_dependencies'),
+        url(r'^packages$', 'model_explorer',  {'model_name':'build_package'}, name='build_packages'),
+        url(r'^package_dependencies$', 'model_explorer',  {'model_name':'build_package_dependency'}, name='build_package_dependencies'),
+        url(r'^target_packages$', 'model_explorer',  {'model_name':'target_package'}, name='target_packages'),
+        url(r'^package_files$', 'model_explorer',  {'model_name':'build_file'}, name='build_files'),
+        url(r'^layers$', 'model_explorer', {'model_name':'layer'}, name='layer'),
+        url(r'^layerversions$', 'model_explorer', {'model_name':'layerversion'}, name='layerversion'),
+        url(r'^recipes$', 'model_explorer', {'model_name':'recipe'}, name='recipe'),
+        url(r'^recipe_dependencies$', 'model_explorer',  {'model_name':'recipe_dependency'}, name='recipe_dependencies'),
+        url(r'^variables$', 'model_explorer',  {'model_name':'variable'}, name='variables'),
+        url(r'^logmessages$', 'model_explorer',  {'model_name':'logmessage'}, name='logmessages'),
 )
diff --git a/bitbake/lib/webhob/bldviewer/views.py b/bitbake/lib/webhob/bldviewer/views.py
index 4ff23d3..98099ee 100644
--- a/bitbake/lib/webhob/bldviewer/views.py
+++ b/bitbake/lib/webhob/bldviewer/views.py
@@ -2,8 +2,8 @@  import operator
 
 from django.db.models import Q
 from django.shortcuts import render
-from orm.models import Build, Task, Layer, Layer_Version, Recipe, Target_Package, LogMessage, Variable
-from orm.models import Task_Dependency, Target_Package_Dependency, Build_Package, Build_File
+from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, Target_Package, LogMessage, Variable
+from orm.models import Task_Dependency, Recipe_Dependency, Build_Package, Build_File, Build_Package_Dependency
 from django.views.decorators.cache import cache_control
 
 @cache_control(no_store=True)
@@ -95,11 +95,20 @@  def model_explorer(request, model_name):
     response_data = {}
     model_mapping = {
         'build': Build,
+        'target': Target,
+        'target_package': Target_Package,
         'task': Task,
-        'package': Target_Package,
+        'task_dependency': Task_Dependency,
+        'package': Build_Package,
         'layer': Layer,
         'layerversion': Layer_Version,
         'recipe': Recipe,
+        'recipe_dependency': Recipe_Dependency,
+        'build_package': Build_Package,
+        'build_package_dependency': Build_Package_Dependency,
+        'build_file': Build_File,
+        'variable': Variable,
+        'logmessage': LogMessage,
         }
 
     if model_name not in model_mapping.keys():