layerindex-web/layerindex/urls_branch.py
Tim Orling 921308416c layerindex: add Update Layer UI feature
* Add an "Update Layer" button to the layer detail view.
  - This allows a user that is a member of is_staff to trigger
    an update of the current layer (for the current branch)
* Add an "Update Layer" button to the reviewdetail view
  - This allows a user that is a member of is_staff and has
    publish_layer permissions to trigger an update attempt
    of the layer under review (even in the un-published state)
* The update is run as a task with Celery

NOTE:
  You must have the RABBITMQ_ and DATABASE_ credentials set
  correctly in the docker/settings.py file or set via
  environment variables or you will get authentication errors
  talking to layersdb or layersrabbit containers.

[YOCTO #12484]

layerindex/views.py: add update_layer_view
layerindex/urls.py: add update_layer_view
layerindex/urls_branch.py: add update_layer_view
templates/layerindex/reviewdetail.html: add Update Layer button
templates/layerindex/detail.html: add Update Layer button
templates/layerindex: add updatelayer.html

TODO:
  While the update is happening, the AJAX rendering of the
  update.log is showing the b'' characters and not adding
  any new lines. If you go back to the same task view
  afterwards, the log is rendered as expected.

TODO:
  After the update is completed, it would be nice to have a
  button to return you to the page from where you called the
  "Update Layer".

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
2024-01-03 13:33:37 -08:00

53 lines
2.3 KiB
Python

# layerindex-web - Branch-based URL definitions
#
# Copyright (C) 2013-2016 Intel Corporation
#
# Licensed under the MIT license, see COPYING.MIT for details
#
# SPDX-License-Identifier: MIT
from django.views.defaults import page_not_found
from django.urls import include, re_path, reverse_lazy
from layerindex.views import LayerListView, RecipeSearchView, MachineSearchView, DistroSearchView, ClassSearchView, LayerDetailView, edit_layer_view, delete_layer_view, edit_layernote_view, delete_layernote_view, RedirectParamsView, DuplicatesView, LayerUpdateDetailView, layer_export_recipes_csv_view, comparison_update_view, update_layer_view
urlpatterns = [
re_path(r'^$',
RedirectParamsView.as_view(permanent=False), {'redirect_name': 'layer_list'}),
re_path(r'^layers/$',
LayerListView.as_view(
template_name='layerindex/layers.html'),
name='layer_list'),
re_path(r'^layer/(?P<slug>[-\w]+)/$',
LayerDetailView.as_view(
template_name='layerindex/detail.html'),
name='layer_item'),
re_path(r'^layer/(?P<slug>[-\w]+)/recipes/csv/$',
layer_export_recipes_csv_view,
name='layer_export_recipes_csv'),
re_path(r'^recipes/$',
RecipeSearchView.as_view(
template_name='layerindex/recipes.html'),
name='recipe_search'),
re_path(r'^machines/$',
MachineSearchView.as_view(
template_name='layerindex/machines.html'),
name='machine_search'),
re_path(r'^distros/$',
DistroSearchView.as_view(
template_name='layerindex/distros.html'),
name='distro_search'),
re_path(r'^classes/$',
ClassSearchView.as_view(
template_name='layerindex/classes.html'),
name='class_search'),
re_path(r'^edit/(?P<slug>[-\w]+)/$', edit_layer_view, {'template_name': 'layerindex/editlayer.html'}, name="edit_layer"),
re_path(r'^update/(?P<slug>[-\w]+)/$', update_layer_view, {'template_name': 'layerindex/updatelayer.html'}, name="update_layer"),
re_path(r'^duplicates/$',
DuplicatesView.as_view(
template_name='layerindex/duplicates.html'),
name='duplicates'),
re_path(r'^comparison_update/$',
comparison_update_view,
name='comparison_update'),
]