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