diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/tables.py')
| -rw-r--r-- | bitbake/lib/toaster/toastergui/tables.py | 87 |
1 files changed, 78 insertions, 9 deletions
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py index e6395834a5..78a7cb095e 100644 --- a/bitbake/lib/toaster/toastergui/tables.py +++ b/bitbake/lib/toaster/toastergui/tables.py | |||
| @@ -132,7 +132,6 @@ class LayersTable(ToasterTable): | |||
| 132 | static_data_name="add-del-layers", | 132 | static_data_name="add-del-layers", |
| 133 | static_data_template='{% include "layer_btn.html" %}') | 133 | static_data_template='{% include "layer_btn.html" %}') |
| 134 | 134 | ||
| 135 | |||
| 136 | class MachinesTable(ToasterTable): | 135 | class MachinesTable(ToasterTable): |
| 137 | """Table of Machines in Toaster""" | 136 | """Table of Machines in Toaster""" |
| 138 | 137 | ||
| @@ -178,8 +177,7 @@ class MachinesTable(ToasterTable): | |||
| 178 | self.add_column(title="Machine file", | 177 | self.add_column(title="Machine file", |
| 179 | hidden=True, | 178 | hidden=True, |
| 180 | static_data_name="machinefile", | 179 | static_data_name="machinefile", |
| 181 | static_data_template=machine_file_template, | 180 | static_data_template=machine_file_template) |
| 182 | field_name="name") | ||
| 183 | 181 | ||
| 184 | self.add_column(title="Select", | 182 | self.add_column(title="Select", |
| 185 | help_text="Sets the selected machine as the project machine. You can only have one machine per project", | 183 | help_text="Sets the selected machine as the project machine. You can only have one machine per project", |
| @@ -189,6 +187,33 @@ class MachinesTable(ToasterTable): | |||
| 189 | field_name="layer_version__id") | 187 | field_name="layer_version__id") |
| 190 | 188 | ||
| 191 | 189 | ||
| 190 | class LayerMachinesTable(MachinesTable): | ||
| 191 | """ Smaller version of the Machines table for use in layer details """ | ||
| 192 | |||
| 193 | def __init__(self, *args, **kwargs): | ||
| 194 | MachinesTable.__init__(self) | ||
| 195 | |||
| 196 | def setup_queryset(self, *args, **kwargs): | ||
| 197 | MachinesTable.setup_queryset(self, *args, **kwargs) | ||
| 198 | |||
| 199 | self.queryset = self.queryset.filter(layer_version__pk=int(kwargs['layerid'])) | ||
| 200 | self.static_context_extra['in_prj'] = ProjectLayer.objects.filter(Q(project=kwargs['pid']) and Q(layercommit=kwargs['layerid'])).count() | ||
| 201 | |||
| 202 | def setup_columns(self, *args, **kwargs): | ||
| 203 | self.add_column(title="Machine", | ||
| 204 | hideable=False, | ||
| 205 | orderable=True, | ||
| 206 | field_name="name") | ||
| 207 | |||
| 208 | self.add_column(title="Description", | ||
| 209 | field_name="description") | ||
| 210 | |||
| 211 | select_btn_template = '<a href="{% url "project" extra.pid %}#/machineselect={{data.name}}" class="btn btn-block select-machine-btn" {% if extra.in_prj == 0%}disabled="disabled"{%endif%}>Select machine</a>' | ||
| 212 | |||
| 213 | self.add_column(title="Select machine", | ||
| 214 | static_data_name="add-del-layers", | ||
| 215 | static_data_template=select_btn_template) | ||
| 216 | |||
| 192 | 217 | ||
| 193 | class RecipesTable(ToasterTable): | 218 | class RecipesTable(ToasterTable): |
| 194 | """Table of Recipes in Toaster""" | 219 | """Table of Recipes in Toaster""" |
| @@ -267,13 +292,57 @@ class RecipesTable(ToasterTable): | |||
| 267 | static_data_name="add-del-layers", | 292 | static_data_name="add-del-layers", |
| 268 | static_data_template='{% include "recipe_btn.html" %}') | 293 | static_data_template='{% include "recipe_btn.html" %}') |
| 269 | 294 | ||
| 295 | class LayerRecipesTable(RecipesTable): | ||
| 296 | """ Smaller version of the Machines table for use in layer details """ | ||
| 297 | |||
| 298 | def __init__(self, *args, **kwargs): | ||
| 299 | RecipesTable.__init__(self) | ||
| 300 | |||
| 301 | def setup_queryset(self, *args, **kwargs): | ||
| 302 | RecipesTable.setup_queryset(self, *args, **kwargs) | ||
| 303 | self.queryset = self.queryset.filter(layer_version__pk=int(kwargs['layerid'])) | ||
| 304 | |||
| 305 | self.static_context_extra['in_prj'] = ProjectLayer.objects.filter(Q(project=kwargs['pid']) and Q(layercommit=kwargs['layerid'])).count() | ||
| 306 | |||
| 307 | def setup_columns(self, *args, **kwargs): | ||
| 308 | self.add_column(title="Recipe", | ||
| 309 | help_text="Information about a single piece of software, including where to download the source, configuration options, how to compile the source files and how to package the compiled output", | ||
| 310 | hideable=False, | ||
| 311 | orderable=True, | ||
| 312 | field_name="name") | ||
| 313 | |||
| 314 | self.add_column(title="Description", | ||
| 315 | field_name="get_description_or_summary") | ||
| 316 | |||
| 317 | |||
| 318 | build_recipe_template ='<button class="btn btn-block build-target-btn" data-target-name="{{data.name}}" {%if extra.in_prj == 0 %}disabled="disabled"{%endif%}>Build recipe</button>' | ||
| 319 | |||
| 320 | self.add_column(title="Build recipe", | ||
| 321 | static_data_name="add-del-layers", | ||
| 322 | static_data_template=build_recipe_template) | ||
| 323 | |||
| 324 | |||
| 325 | |||
| 326 | |||
| 327 | |||
| 328 | |||
| 329 | |||
| 330 | |||
| 270 | # This needs to be staticaly defined here as django reads the url patterns | 331 | # This needs to be staticaly defined here as django reads the url patterns |
| 271 | # on start up | 332 | # on start up |
| 272 | urlpatterns = ( | 333 | urlpatterns = ( |
| 273 | url(r'^machines/(?P<cmd>\w+)*', MachinesTable.as_view(), | 334 | url(r'^machines/(?P<cmd>\w+)*', MachinesTable.as_view(), |
| 274 | name=MachinesTable.__name__.lower()), | 335 | name=MachinesTable.__name__.lower()), |
| 275 | url(r'^layers/(?P<cmd>\w+)*', LayersTable.as_view(), | 336 | url(r'^layers/(?P<cmd>\w+)*', LayersTable.as_view(), |
| 276 | name=LayersTable.__name__.lower()), | 337 | name=LayersTable.__name__.lower()), |
| 277 | url(r'^recipes/(?P<cmd>\w+)*', RecipesTable.as_view(), | 338 | url(r'^recipes/(?P<cmd>\w+)*', RecipesTable.as_view(), |
| 278 | name=RecipesTable.__name__.lower()), | 339 | name=RecipesTable.__name__.lower()), |
| 340 | |||
| 341 | # layer details tables | ||
| 342 | url(r'^layer/(?P<layerid>\d+)/recipes/(?P<cmd>\w+)*', | ||
| 343 | LayerRecipesTable.as_view(), | ||
| 344 | name=LayerRecipesTable.__name__.lower()), | ||
| 345 | url(r'^layer/(?P<layerid>\d+)/machines/(?P<cmd>\w+)*', | ||
| 346 | LayerMachinesTable.as_view(), | ||
| 347 | name=LayerMachinesTable.__name__.lower()), | ||
| 279 | ) | 348 | ) |
