diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-06-03 12:36:30 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-12 00:01:47 +0100 |
commit | d9341d1a774ccea25e64583f9adc61b163fb1f95 (patch) | |
tree | a2989f7885d4b1a3acce138cfdd93b864fd81832 /bitbake/lib/toaster/toastergui/urls.py | |
parent | 751e9182ac7f37506c3d85cade00ef6f3986eb7a (diff) | |
download | poky-d9341d1a774ccea25e64583f9adc61b163fb1f95.tar.gz |
bitbake: 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.
(Bitbake rev: 1778dac9fd39dae75c55bf2cf836cdd488dbc265)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/urls.py')
-rw-r--r-- | bitbake/lib/toaster/toastergui/urls.py | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py index 4e328dae17..e10e0bb159 100644 --- a/bitbake/lib/toaster/toastergui/urls.py +++ b/bitbake/lib/toaster/toastergui/urls.py | |||
@@ -20,8 +20,7 @@ from django.conf.urls import patterns, include, url | |||
20 | from django.views.generic import RedirectView, TemplateView | 20 | from django.views.generic import RedirectView, TemplateView |
21 | 21 | ||
22 | from django.http import HttpResponseBadRequest | 22 | from django.http import HttpResponseBadRequest |
23 | import tables | 23 | from toastergui import tables |
24 | from widgets import ToasterTemplateView | ||
25 | 24 | ||
26 | urlpatterns = patterns('toastergui.views', | 25 | urlpatterns = patterns('toastergui.views', |
27 | # landing page | 26 | # landing page |
@@ -81,32 +80,46 @@ urlpatterns = patterns('toastergui.views', | |||
81 | url(r'^project/(?P<pid>\d+)/configuration$', 'projectconf', name='projectconf'), | 80 | url(r'^project/(?P<pid>\d+)/configuration$', 'projectconf', name='projectconf'), |
82 | url(r'^project/(?P<pid>\d+)/builds/$', 'projectbuilds', name='projectbuilds'), | 81 | url(r'^project/(?P<pid>\d+)/builds/$', 'projectbuilds', name='projectbuilds'), |
83 | 82 | ||
84 | url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)$', | ||
85 | ToasterTemplateView.as_view(template_name='layerdetails.html'), | ||
86 | name='layerdetails'), | ||
87 | url(r'^project/(?P<pid>\d+)/layer/$', lambda x,pid: HttpResponseBadRequest(), name='base_layerdetails'), | 83 | url(r'^project/(?P<pid>\d+)/layer/$', lambda x,pid: HttpResponseBadRequest(), name='base_layerdetails'), |
88 | 84 | ||
89 | # the import layer is a project-specific functionality; | 85 | # the import layer is a project-specific functionality; |
90 | url(r'^project/(?P<pid>\d+)/importlayer$', 'importlayer', name='importlayer'), | 86 | url(r'^project/(?P<pid>\d+)/importlayer$', 'importlayer', name='importlayer'), |
91 | 87 | ||
88 | |||
89 | # the table pages that have been converted to ToasterTable widget | ||
92 | url(r'^project/(?P<pid>\d+)/machines/$', | 90 | url(r'^project/(?P<pid>\d+)/machines/$', |
93 | ToasterTemplateView.as_view(template_name="generic-toastertable-page.html"), | 91 | tables.MachinesTable.as_view(template_name="generic-toastertable-page.html"), |
94 | { 'table_name': tables.MachinesTable.__name__.lower(), | 92 | { 'table_name': tables.MachinesTable.__name__.lower(), |
95 | 'title' : 'All compatible machines' }, | 93 | 'title' : 'All compatible machines' }, |
96 | name="all-machines"), | 94 | name="all-machines"), |
97 | 95 | ||
98 | url(r'^project/(?P<pid>\d+)/recipes/$', | 96 | url(r'^project/(?P<pid>\d+)/recipes/$', |
99 | ToasterTemplateView.as_view(template_name="generic-toastertable-page.html"), | 97 | tables.RecipesTable.as_view(template_name="generic-toastertable-page.html"), |
100 | { 'table_name': tables.RecipesTable.__name__.lower(), | 98 | { 'table_name': tables.RecipesTable.__name__.lower(), |
101 | 'title' : 'All compatible recipes' }, | 99 | 'title' : 'All compatible recipes' }, |
102 | name="all-targets"), | 100 | name="all-targets"), |
103 | 101 | ||
104 | url(r'^project/(?P<pid>\d+)/layers/$', | 102 | url(r'^project/(?P<pid>\d+)/layers/$', |
105 | ToasterTemplateView.as_view(template_name="generic-toastertable-page.html"), | 103 | tables.LayersTable.as_view(template_name="generic-toastertable-page.html"), |
106 | { 'table_name': tables.LayersTable.__name__.lower(), | 104 | { 'table_name': tables.LayersTable.__name__.lower(), |
107 | 'title' : 'All compatible layers' }, | 105 | 'title' : 'All compatible layers' }, |
108 | name="all-layers"), | 106 | name="all-layers"), |
109 | 107 | ||
108 | url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)$', | ||
109 | tables.LayerDetails.as_view(template_name='layerdetails.html'), | ||
110 | name='layerdetails'), | ||
111 | |||
112 | url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)/recipes/$', | ||
113 | tables.LayerRecipesTable.as_view(template_name="generic-toastertable-page.html"), | ||
114 | { 'table_name': tables.LayerRecipesTable.__name__.lower(), | ||
115 | 'title' : 'All recipes in layer' }, | ||
116 | name=tables.LayerRecipesTable.__name__.lower()), | ||
117 | |||
118 | url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)/machines/$', | ||
119 | tables.LayerMachinesTable.as_view(template_name="generic-toastertable-page.html"), | ||
120 | { 'table_name': tables.LayerMachinesTable.__name__.lower(), | ||
121 | 'title' : 'All machines in layer' }, | ||
122 | name=tables.LayerMachinesTable.__name__.lower()), | ||
110 | 123 | ||
111 | url(r'^xhr_projectbuild/(?P<pid>\d+)$', 'xhr_projectbuild', name='xhr_projectbuild'), | 124 | url(r'^xhr_projectbuild/(?P<pid>\d+)$', 'xhr_projectbuild', name='xhr_projectbuild'), |
112 | url(r'^xhr_projectinfo/$', 'xhr_projectinfo', name='xhr_projectinfo'), | 125 | url(r'^xhr_projectinfo/$', 'xhr_projectinfo', name='xhr_projectinfo'), |
@@ -116,7 +129,6 @@ urlpatterns = patterns('toastergui.views', | |||
116 | url(r'^xhr_datatypeahead/(?P<pid>\d+)$', 'xhr_datatypeahead', name='xhr_datatypeahead'), | 129 | url(r'^xhr_datatypeahead/(?P<pid>\d+)$', 'xhr_datatypeahead', name='xhr_datatypeahead'), |
117 | url(r'^xhr_importlayer/$', 'xhr_importlayer', name='xhr_importlayer'), | 130 | url(r'^xhr_importlayer/$', 'xhr_importlayer', name='xhr_importlayer'), |
118 | url(r'^xhr_updatelayer/$', 'xhr_updatelayer', name='xhr_updatelayer'), | 131 | url(r'^xhr_updatelayer/$', 'xhr_updatelayer', name='xhr_updatelayer'), |
119 | url(r'^xhr_tables/project/(?P<pid>\d+)/', include('toastergui.tables')), | ||
120 | 132 | ||
121 | # dashboard for failed build requests | 133 | # dashboard for failed build requests |
122 | url(r'^project/(?P<pid>\d+)/buildrequest/(?P<brid>\d+)$', 'buildrequestdetails', name='buildrequestdetails'), | 134 | url(r'^project/(?P<pid>\d+)/buildrequest/(?P<brid>\d+)$', 'buildrequestdetails', name='buildrequestdetails'), |