diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-06-03 12:36:30 +0100 |
---|---|---|
committer | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-06-10 15:31:12 +0100 |
commit | 1778dac9fd39dae75c55bf2cf836cdd488dbc265 (patch) | |
tree | 99765f72b1e3e131818a9f10b474201bcd1d9f7e /lib/toaster/toastergui/urls.py | |
parent | 7a6eb36b82c5f2e342777e479d9c401ded42453d (diff) | |
download | bitbake-1778dac9fd39dae75c55bf2cf836cdd488dbc265.tar.gz |
toaster: toastertables REST refactoring
This patch refactors the ToasterTables to bring them in line
with REST principles -
- all table pages now support the "format=json" GET parameter
that returns the data in JSON format
- the tables themselves
This cleans up the URL namespace by aleviating the need to
have two URLS for each table (one for the template and one for
the data loading), and fixes minor things in the ToasterTable
implementation.
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Diffstat (limited to 'lib/toaster/toastergui/urls.py')
-rw-r--r-- | lib/toaster/toastergui/urls.py | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/lib/toaster/toastergui/urls.py b/lib/toaster/toastergui/urls.py index 4e328dae1..e10e0bb15 100644 --- a/lib/toaster/toastergui/urls.py +++ b/lib/toaster/toastergui/urls.py @@ -20,8 +20,7 @@ from django.conf.urls import patterns, include, url from django.views.generic import RedirectView, TemplateView from django.http import HttpResponseBadRequest -import tables -from widgets import ToasterTemplateView +from toastergui import tables urlpatterns = patterns('toastergui.views', # landing page @@ -81,32 +80,46 @@ urlpatterns = patterns('toastergui.views', url(r'^project/(?P<pid>\d+)/configuration$', 'projectconf', name='projectconf'), url(r'^project/(?P<pid>\d+)/builds/$', 'projectbuilds', name='projectbuilds'), - url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)$', - ToasterTemplateView.as_view(template_name='layerdetails.html'), - name='layerdetails'), url(r'^project/(?P<pid>\d+)/layer/$', lambda x,pid: HttpResponseBadRequest(), name='base_layerdetails'), # the import layer is a project-specific functionality; url(r'^project/(?P<pid>\d+)/importlayer$', 'importlayer', name='importlayer'), + + # the table pages that have been converted to ToasterTable widget url(r'^project/(?P<pid>\d+)/machines/$', - ToasterTemplateView.as_view(template_name="generic-toastertable-page.html"), + tables.MachinesTable.as_view(template_name="generic-toastertable-page.html"), { 'table_name': tables.MachinesTable.__name__.lower(), 'title' : 'All compatible machines' }, name="all-machines"), url(r'^project/(?P<pid>\d+)/recipes/$', - ToasterTemplateView.as_view(template_name="generic-toastertable-page.html"), + tables.RecipesTable.as_view(template_name="generic-toastertable-page.html"), { 'table_name': tables.RecipesTable.__name__.lower(), 'title' : 'All compatible recipes' }, name="all-targets"), url(r'^project/(?P<pid>\d+)/layers/$', - ToasterTemplateView.as_view(template_name="generic-toastertable-page.html"), + tables.LayersTable.as_view(template_name="generic-toastertable-page.html"), { 'table_name': tables.LayersTable.__name__.lower(), 'title' : 'All compatible layers' }, name="all-layers"), + url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)$', + tables.LayerDetails.as_view(template_name='layerdetails.html'), + name='layerdetails'), + + url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)/recipes/$', + tables.LayerRecipesTable.as_view(template_name="generic-toastertable-page.html"), + { 'table_name': tables.LayerRecipesTable.__name__.lower(), + 'title' : 'All recipes in layer' }, + name=tables.LayerRecipesTable.__name__.lower()), + + url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)/machines/$', + tables.LayerMachinesTable.as_view(template_name="generic-toastertable-page.html"), + { 'table_name': tables.LayerMachinesTable.__name__.lower(), + 'title' : 'All machines in layer' }, + name=tables.LayerMachinesTable.__name__.lower()), url(r'^xhr_projectbuild/(?P<pid>\d+)$', 'xhr_projectbuild', name='xhr_projectbuild'), url(r'^xhr_projectinfo/$', 'xhr_projectinfo', name='xhr_projectinfo'), @@ -116,7 +129,6 @@ urlpatterns = patterns('toastergui.views', url(r'^xhr_datatypeahead/(?P<pid>\d+)$', 'xhr_datatypeahead', name='xhr_datatypeahead'), url(r'^xhr_importlayer/$', 'xhr_importlayer', name='xhr_importlayer'), url(r'^xhr_updatelayer/$', 'xhr_updatelayer', name='xhr_updatelayer'), - url(r'^xhr_tables/project/(?P<pid>\d+)/', include('toastergui.tables')), # dashboard for failed build requests url(r'^project/(?P<pid>\d+)/buildrequest/(?P<brid>\d+)$', 'buildrequestdetails', name='buildrequestdetails'), |