1*eb8dc403SDave Cobbley#
2*eb8dc403SDave Cobbley# BitBake Toaster Implementation
3*eb8dc403SDave Cobbley#
4*eb8dc403SDave Cobbley# Copyright (C) 2013-2017    Intel Corporation
5*eb8dc403SDave Cobbley#
6*eb8dc403SDave Cobbley# This program is free software; you can redistribute it and/or modify
7*eb8dc403SDave Cobbley# it under the terms of the GNU General Public License version 2 as
8*eb8dc403SDave Cobbley# published by the Free Software Foundation.
9*eb8dc403SDave Cobbley#
10*eb8dc403SDave Cobbley# This program is distributed in the hope that it will be useful,
11*eb8dc403SDave Cobbley# but WITHOUT ANY WARRANTY; without even the implied warranty of
12*eb8dc403SDave Cobbley# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13*eb8dc403SDave Cobbley# GNU General Public License for more details.
14*eb8dc403SDave Cobbley#
15*eb8dc403SDave Cobbley# You should have received a copy of the GNU General Public License along
16*eb8dc403SDave Cobbley# with this program; if not, write to the Free Software Foundation, Inc.,
17*eb8dc403SDave Cobbley# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18*eb8dc403SDave Cobbley
19*eb8dc403SDave Cobbleyfrom django.conf.urls import include, url
20*eb8dc403SDave Cobbleyfrom django.views.generic import RedirectView, TemplateView
21*eb8dc403SDave Cobbley
22*eb8dc403SDave Cobbleyfrom django.http import HttpResponseBadRequest
23*eb8dc403SDave Cobbleyfrom toastergui import tables
24*eb8dc403SDave Cobbleyfrom toastergui import buildtables
25*eb8dc403SDave Cobbleyfrom toastergui import typeaheads
26*eb8dc403SDave Cobbleyfrom toastergui import api
27*eb8dc403SDave Cobbleyfrom toastergui import widgets
28*eb8dc403SDave Cobbleyfrom toastergui import views
29*eb8dc403SDave Cobbley
30*eb8dc403SDave Cobbleyurlpatterns = [
31*eb8dc403SDave Cobbley        # landing page
32*eb8dc403SDave Cobbley        url(r'^landing/$', views.landing, name='landing'),
33*eb8dc403SDave Cobbley
34*eb8dc403SDave Cobbley        url(r'^builds/$',
35*eb8dc403SDave Cobbley            tables.AllBuildsTable.as_view(template_name="builds-toastertable.html"),
36*eb8dc403SDave Cobbley            name='all-builds'),
37*eb8dc403SDave Cobbley
38*eb8dc403SDave Cobbley        # build info navigation
39*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)$', views.builddashboard, name="builddashboard"),
40*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/tasks/$',
41*eb8dc403SDave Cobbley            buildtables.BuildTasksTable.as_view(
42*eb8dc403SDave Cobbley                template_name="buildinfo-toastertable.html"),
43*eb8dc403SDave Cobbley            name='tasks'),
44*eb8dc403SDave Cobbley
45*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/task/(?P<task_id>\d+)$', views.task, name='task'),
46*eb8dc403SDave Cobbley
47*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/recipes/$',
48*eb8dc403SDave Cobbley            buildtables.BuiltRecipesTable.as_view(
49*eb8dc403SDave Cobbley                template_name="buildinfo-toastertable.html"),
50*eb8dc403SDave Cobbley            name='recipes'),
51*eb8dc403SDave Cobbley
52*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/recipe/(?P<recipe_id>\d+)/active_tab/(?P<active_tab>\d{1})$', views.recipe, name='recipe'),
53*eb8dc403SDave Cobbley
54*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/recipe/(?P<recipe_id>\d+)$', views.recipe, name='recipe'),
55*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/recipe_packages/(?P<recipe_id>\d+)$', views.recipe_packages, name='recipe_packages'),
56*eb8dc403SDave Cobbley
57*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/packages/$',
58*eb8dc403SDave Cobbley            buildtables.BuiltPackagesTable.as_view(
59*eb8dc403SDave Cobbley                template_name="buildinfo-toastertable.html"),
60*eb8dc403SDave Cobbley            name='packages'),
61*eb8dc403SDave Cobbley
62*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/package/(?P<package_id>\d+)$', views.package_built_detail,
63*eb8dc403SDave Cobbley                name='package_built_detail'),
64*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/package_built_dependencies/(?P<package_id>\d+)$',
65*eb8dc403SDave Cobbley            views.package_built_dependencies, name='package_built_dependencies'),
66*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/package_included_detail/(?P<target_id>\d+)/(?P<package_id>\d+)$',
67*eb8dc403SDave Cobbley            views.package_included_detail, name='package_included_detail'),
68*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/package_included_dependencies/(?P<target_id>\d+)/(?P<package_id>\d+)$',
69*eb8dc403SDave Cobbley            views.package_included_dependencies, name='package_included_dependencies'),
70*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/package_included_reverse_dependencies/(?P<target_id>\d+)/(?P<package_id>\d+)$',
71*eb8dc403SDave Cobbley            views.package_included_reverse_dependencies, name='package_included_reverse_dependencies'),
72*eb8dc403SDave Cobbley
73*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/target/(?P<target_id>\d+)$',
74*eb8dc403SDave Cobbley            buildtables.InstalledPackagesTable.as_view(
75*eb8dc403SDave Cobbley                template_name="target.html"),
76*eb8dc403SDave Cobbley            name='target'),
77*eb8dc403SDave Cobbley
78*eb8dc403SDave Cobbley
79*eb8dc403SDave Cobbley        url(r'^dentries/build/(?P<build_id>\d+)/target/(?P<target_id>\d+)$', views.xhr_dirinfo, name='dirinfo_ajax'),
80*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/target/(?P<target_id>\d+)/dirinfo$', views.dirinfo, name='dirinfo'),
81*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/target/(?P<target_id>\d+)/dirinfo_filepath/_(?P<file_path>(?:/[^/\n]+)*)$', views.dirinfo, name='dirinfo_filepath'),
82*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/configuration$', views.configuration, name='configuration'),
83*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/configvars$', views.configvars, name='configvars'),
84*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/buildtime$',
85*eb8dc403SDave Cobbley            buildtables.BuildTimeTable.as_view(
86*eb8dc403SDave Cobbley                template_name="buildinfo-toastertable.html"),
87*eb8dc403SDave Cobbley            name='buildtime'),
88*eb8dc403SDave Cobbley
89*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/cputime$',
90*eb8dc403SDave Cobbley            buildtables.BuildCPUTimeTable.as_view(
91*eb8dc403SDave Cobbley                template_name="buildinfo-toastertable.html"),
92*eb8dc403SDave Cobbley            name='cputime'),
93*eb8dc403SDave Cobbley
94*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/diskio$',
95*eb8dc403SDave Cobbley            buildtables.BuildIOTable.as_view(
96*eb8dc403SDave Cobbley                template_name="buildinfo-toastertable.html"),
97*eb8dc403SDave Cobbley            name='diskio'),
98*eb8dc403SDave Cobbley
99*eb8dc403SDave Cobbley        # image information dir
100*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/target/(?P<target_id>\d+)/packagefile/(?P<packagefile_id>\d+)$',
101*eb8dc403SDave Cobbley             views.image_information_dir, name='image_information_dir'),
102*eb8dc403SDave Cobbley
103*eb8dc403SDave Cobbley        # build download artifact
104*eb8dc403SDave Cobbley        url(r'^build/(?P<build_id>\d+)/artifact/(?P<artifact_type>\w+)/id/(?P<artifact_id>\w+)', views.build_artifact, name="build_artifact"),
105*eb8dc403SDave Cobbley
106*eb8dc403SDave Cobbley        # project URLs
107*eb8dc403SDave Cobbley        url(r'^newproject/$', views.newproject, name='newproject'),
108*eb8dc403SDave Cobbley
109*eb8dc403SDave Cobbley        url(r'^projects/$',
110*eb8dc403SDave Cobbley            tables.ProjectsTable.as_view(template_name="projects-toastertable.html"),
111*eb8dc403SDave Cobbley            name='all-projects'),
112*eb8dc403SDave Cobbley
113*eb8dc403SDave Cobbley        url(r'^project/(?P<pid>\d+)/$', views.project, name='project'),
114*eb8dc403SDave Cobbley        url(r'^project/(?P<pid>\d+)/configuration$', views.projectconf, name='projectconf'),
115*eb8dc403SDave Cobbley        url(r'^project/(?P<pid>\d+)/builds/$',
116*eb8dc403SDave Cobbley            tables.ProjectBuildsTable.as_view(template_name="projectbuilds-toastertable.html"),
117*eb8dc403SDave Cobbley            name='projectbuilds'),
118*eb8dc403SDave Cobbley
119*eb8dc403SDave Cobbley        # the import layer is a project-specific functionality;
120*eb8dc403SDave Cobbley        url(r'^project/(?P<pid>\d+)/importlayer$', views.importlayer, name='importlayer'),
121*eb8dc403SDave Cobbley
122*eb8dc403SDave Cobbley        # the table pages that have been converted to ToasterTable widget
123*eb8dc403SDave Cobbley        url(r'^project/(?P<pid>\d+)/machines/$',
124*eb8dc403SDave Cobbley            tables.MachinesTable.as_view(template_name="generic-toastertable-page.html"),
125*eb8dc403SDave Cobbley            name="projectmachines"),
126*eb8dc403SDave Cobbley
127*eb8dc403SDave Cobbley        url(r'^project/(?P<pid>\d+)/softwarerecipes/$',
128*eb8dc403SDave Cobbley            tables.SoftwareRecipesTable.as_view(template_name="generic-toastertable-page.html"),
129*eb8dc403SDave Cobbley            name="projectsoftwarerecipes"),
130*eb8dc403SDave Cobbley
131*eb8dc403SDave Cobbley        url(r'^project/(?P<pid>\d+)/images/$',
132*eb8dc403SDave Cobbley            tables.ImageRecipesTable.as_view(template_name="generic-toastertable-page.html"), name="projectimagerecipes"),
133*eb8dc403SDave Cobbley
134*eb8dc403SDave Cobbley        url(r'^project/(?P<pid>\d+)/customimages/$',
135*eb8dc403SDave Cobbley            tables.CustomImagesTable.as_view(template_name="generic-toastertable-page.html"), name="projectcustomimages"),
136*eb8dc403SDave Cobbley
137*eb8dc403SDave Cobbley        url(r'^project/(?P<pid>\d+)/newcustomimage/$',
138*eb8dc403SDave Cobbley            tables.NewCustomImagesTable.as_view(template_name="newcustomimage.html"),
139*eb8dc403SDave Cobbley            name="newcustomimage"),
140*eb8dc403SDave Cobbley
141*eb8dc403SDave Cobbley        url(r'^project/(?P<pid>\d+)/layers/$',
142*eb8dc403SDave Cobbley            tables.LayersTable.as_view(template_name="generic-toastertable-page.html"),
143*eb8dc403SDave Cobbley            name="projectlayers"),
144*eb8dc403SDave Cobbley
145*eb8dc403SDave Cobbley        url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)$',
146*eb8dc403SDave Cobbley            views.layerdetails, name='layerdetails'),
147*eb8dc403SDave Cobbley
148*eb8dc403SDave Cobbley        url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)/recipes/$',
149*eb8dc403SDave Cobbley            tables.LayerRecipesTable.as_view(template_name="generic-toastertable-page.html"),
150*eb8dc403SDave Cobbley            { 'table_name': tables.LayerRecipesTable.__name__.lower(),
151*eb8dc403SDave Cobbley              'title' : 'All recipes in layer' },
152*eb8dc403SDave Cobbley             name=tables.LayerRecipesTable.__name__.lower()),
153*eb8dc403SDave Cobbley
154*eb8dc403SDave Cobbley        url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)/machines/$',
155*eb8dc403SDave Cobbley            tables.LayerMachinesTable.as_view(template_name="generic-toastertable-page.html"),
156*eb8dc403SDave Cobbley            { 'table_name': tables.LayerMachinesTable.__name__.lower(),
157*eb8dc403SDave Cobbley              'title' : 'All machines in layer' },
158*eb8dc403SDave Cobbley            name=tables.LayerMachinesTable.__name__.lower()),
159*eb8dc403SDave Cobbley
160*eb8dc403SDave Cobbley
161*eb8dc403SDave Cobbley        url(r'^project/(?P<pid>\d+)/distros/$',
162*eb8dc403SDave Cobbley            tables.DistrosTable.as_view(template_name="generic-toastertable-page.html"),
163*eb8dc403SDave Cobbley            name="projectdistros"),
164*eb8dc403SDave Cobbley
165*eb8dc403SDave Cobbley
166*eb8dc403SDave Cobbley        url(r'^project/(?P<pid>\d+)/customrecipe/(?P<custrecipeid>\d+)/selectpackages/$',
167*eb8dc403SDave Cobbley            tables.SelectPackagesTable.as_view(), name="recipeselectpackages"),
168*eb8dc403SDave Cobbley
169*eb8dc403SDave Cobbley
170*eb8dc403SDave Cobbley        url(r'^project/(?P<pid>\d+)/customrecipe/(?P<custrecipeid>\d+)$',
171*eb8dc403SDave Cobbley            tables.SelectPackagesTable.as_view(template_name="customrecipe.html"),
172*eb8dc403SDave Cobbley            name="customrecipe"),
173*eb8dc403SDave Cobbley
174*eb8dc403SDave Cobbley        url(r'^project/(?P<pid>\d+)/customrecipe/(?P<recipe_id>\d+)/download$',
175*eb8dc403SDave Cobbley            views.customrecipe_download,
176*eb8dc403SDave Cobbley            name="customrecipedownload"),
177*eb8dc403SDave Cobbley
178*eb8dc403SDave Cobbley        url(r'^project/(?P<pid>\d+)/recipe/(?P<recipe_id>\d+)$',
179*eb8dc403SDave Cobbley            tables.PackagesTable.as_view(template_name="recipedetails.html"),
180*eb8dc403SDave Cobbley            name="recipedetails"),
181*eb8dc403SDave Cobbley
182*eb8dc403SDave Cobbley        # typeahead api end points
183*eb8dc403SDave Cobbley        url(r'^xhr_typeahead/(?P<pid>\d+)/layers$',
184*eb8dc403SDave Cobbley            typeaheads.LayersTypeAhead.as_view(), name='xhr_layerstypeahead'),
185*eb8dc403SDave Cobbley        url(r'^xhr_typeahead/(?P<pid>\d+)/machines$',
186*eb8dc403SDave Cobbley            typeaheads.MachinesTypeAhead.as_view(), name='xhr_machinestypeahead'),
187*eb8dc403SDave Cobbley        url(r'^xhr_typeahead/(?P<pid>\d+)/recipes$',
188*eb8dc403SDave Cobbley            typeaheads.RecipesTypeAhead.as_view(), name='xhr_recipestypeahead'),
189*eb8dc403SDave Cobbley        url(r'^xhr_typeahead/projects$',
190*eb8dc403SDave Cobbley            typeaheads.ProjectsTypeAhead.as_view(), name='xhr_projectstypeahead'),
191*eb8dc403SDave Cobbley        url(r'^xhr_typeahead/gitrev$',
192*eb8dc403SDave Cobbley            typeaheads.GitRevisionTypeAhead.as_view(),
193*eb8dc403SDave Cobbley            name='xhr_gitrevtypeahead'),
194*eb8dc403SDave Cobbley
195*eb8dc403SDave Cobbley        url(r'^xhr_typeahead/(?P<pid>\d+)/distros$',
196*eb8dc403SDave Cobbley            typeaheads.DistrosTypeAhead.as_view(), name='xhr_distrostypeahead'),
197*eb8dc403SDave Cobbley
198*eb8dc403SDave Cobbley        url(r'^xhr_testreleasechange/(?P<pid>\d+)$', views.xhr_testreleasechange,
199*eb8dc403SDave Cobbley            name='xhr_testreleasechange'),
200*eb8dc403SDave Cobbley        url(r'^xhr_configvaredit/(?P<pid>\d+)$', views.xhr_configvaredit,
201*eb8dc403SDave Cobbley            name='xhr_configvaredit'),
202*eb8dc403SDave Cobbley
203*eb8dc403SDave Cobbley        url(r'^xhr_layer/(?P<pid>\d+)/(?P<layerversion_id>\d+)$',
204*eb8dc403SDave Cobbley            api.XhrLayer.as_view(),
205*eb8dc403SDave Cobbley            name='xhr_layer'),
206*eb8dc403SDave Cobbley
207*eb8dc403SDave Cobbley        url(r'^xhr_layer/(?P<pid>\d+)$',
208*eb8dc403SDave Cobbley            api.XhrLayer.as_view(),
209*eb8dc403SDave Cobbley            name='xhr_layer'),
210*eb8dc403SDave Cobbley
211*eb8dc403SDave Cobbley        # JS Unit tests
212*eb8dc403SDave Cobbley        url(r'^js-unit-tests/$', views.jsunittests, name='js-unit-tests'),
213*eb8dc403SDave Cobbley
214*eb8dc403SDave Cobbley        # image customisation functionality
215*eb8dc403SDave Cobbley        url(r'^xhr_customrecipe/(?P<recipe_id>\d+)'
216*eb8dc403SDave Cobbley            '/packages/(?P<package_id>\d+|)$',
217*eb8dc403SDave Cobbley            api.XhrCustomRecipePackages.as_view(),
218*eb8dc403SDave Cobbley            name='xhr_customrecipe_packages'),
219*eb8dc403SDave Cobbley
220*eb8dc403SDave Cobbley        url(r'^xhr_customrecipe/(?P<recipe_id>\d+)/packages/$',
221*eb8dc403SDave Cobbley            api.XhrCustomRecipePackages.as_view(),
222*eb8dc403SDave Cobbley            name='xhr_customrecipe_packages'),
223*eb8dc403SDave Cobbley
224*eb8dc403SDave Cobbley        url(r'^xhr_customrecipe/(?P<recipe_id>\d+)$',
225*eb8dc403SDave Cobbley            api.XhrCustomRecipeId.as_view(),
226*eb8dc403SDave Cobbley            name='xhr_customrecipe_id'),
227*eb8dc403SDave Cobbley
228*eb8dc403SDave Cobbley        url(r'^xhr_customrecipe/',
229*eb8dc403SDave Cobbley            api.XhrCustomRecipe.as_view(),
230*eb8dc403SDave Cobbley            name='xhr_customrecipe'),
231*eb8dc403SDave Cobbley
232*eb8dc403SDave Cobbley        url(r'^xhr_buildrequest/project/(?P<pid>\d+)$',
233*eb8dc403SDave Cobbley            api.XhrBuildRequest.as_view(),
234*eb8dc403SDave Cobbley            name='xhr_buildrequest'),
235*eb8dc403SDave Cobbley
236*eb8dc403SDave Cobbley        url(r'xhr_project/(?P<project_id>\d+)$',
237*eb8dc403SDave Cobbley            api.XhrProject.as_view(),
238*eb8dc403SDave Cobbley            name='xhr_project'),
239*eb8dc403SDave Cobbley
240*eb8dc403SDave Cobbley        url(r'xhr_build/(?P<build_id>\d+)$',
241*eb8dc403SDave Cobbley            api.XhrBuild.as_view(),
242*eb8dc403SDave Cobbley            name='xhr_build'),
243*eb8dc403SDave Cobbley
244*eb8dc403SDave Cobbley        url(r'^mostrecentbuilds$', widgets.MostRecentBuildsView.as_view(),
245*eb8dc403SDave Cobbley            name='most_recent_builds'),
246*eb8dc403SDave Cobbley
247*eb8dc403SDave Cobbley        # JSON data for aggregators
248*eb8dc403SDave Cobbley        url(r'^api/builds$', views.json_builds, name='json_builds'),
249*eb8dc403SDave Cobbley        url(r'^api/building$', views.json_building, name='json_building'),
250*eb8dc403SDave Cobbley        url(r'^api/build/(?P<build_id>\d+)$', views.json_build, name='json_build'),
251*eb8dc403SDave Cobbley
252*eb8dc403SDave Cobbley        # default redirection
253*eb8dc403SDave Cobbley        url(r'^$', RedirectView.as_view(url='landing', permanent=True)),
254*eb8dc403SDave Cobbley]
255