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