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