layerindex-web/templates/layerindex/reviewdetail.html
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

190 lines
8.9 KiB
HTML

{% extends "base.html" %}
{% load i18n %}
{% load static %}
{% comment %}
layerindex-web - review layer detail page template
Copyright (C) 2013 Intel Corporation
Licensed under the MIT license, see COPYING.MIT for details
{% endcomment %}
<!--
{% autoescape on %}
{% block title_append %} - {{ layeritem.name }}{% endblock %}
{% endautoescape %}
-->
{% block content %}
{% autoescape on %}
<div class="container-fluid">
<div class="row">
<div class="page-header">
<h1>{{ layeritem.name }}
{% if layerbranch.yp_compatible_version %}
<a href="{{layerbranch.yp_compatible_version.link_url }}"><img src="{{layerbranch.yp_compatible_version.image_url}}" alt="{{layerbranch.yp_compatible_version.description}}" class="yp-icon" title="{{layerbranch.yp_compatible_version.description}}"></a>
{% endif %}
{% if layeritem.status == "N" %}
<span class="label label-warning">Unpublished</span>
{% else %}
<span class="label label-info">Published</span>
{% endif %}
{% if user.is_authenticated %}
<span class="pull-right">
{% if perms.layerindex.publish_layer or useredit %}
<a href="{% url 'edit_layer' 'master' layeritem.name %}?returnto=layer_review" class="btn btn-default">Edit layer</a>
{% if layeritem.layernote_set.count == 0 %}
<a href="{% url 'add_layernote' layeritem.name %}" class="btn btn-default">Add note</a>
{% endif %}
{% endif %}
{% if layeritem.status == "N" and perms.layerindex.publish_layer %}
<a href="{% url 'delete_layer' layeritem.name %}" class="btn btn-warning">Delete layer</a>
<a href="{% url 'publish' layeritem.name %}" class="btn btn-primary">Publish layer</a>
{% endif %}
{% if user.is_staff %}
<a href="{% url 'update_layer' 'master' layeritem.name %}" class="btn btn-info">Update layer</a>
{% endif %}
</span>
{% endif %}
</h1>
</div>
</div> <!-- end of row -->
</div> <!-- end of container-fluid -->
<div class="container-fluid">
<div class="row">
{% for note in layeritem.layernote_set.all %}
<div class="alert alert-warning">
<p>{{ note.text }}</p>
{% if perms.layerindex.publish_layer or useredit %}
<p>
<a href="{% url 'edit_layernote' layeritem.name note.pk %}" class="btn btn-default">Edit note</a>
<a href="{% url 'delete_layernote' layeritem.name note.pk %}" class="btn btn-default">Delete note</a>
</p>
{% endif %}
</div>
{% endfor %}
</div>
<div class="row">
<div>
<table class="table table-striped table-bordered">
<tbody>
<tr>
<th>Name</th>
<td>{{ layeritem.name }}</td>
</tr>
<tr>
<th>Type</th>
<td>{{ layeritem.get_layer_type_display }}</td>
</tr>
<tr>
<th>Summary</th>
<td>{{ layeritem.summary }}</td>
</tr>
<tr>
<th>Description</th>
<td style="white-space: pre-wrap">{{ layeritem.description }}</td>
</tr>
<tr>
<th>Repository</th>
<td>{{ layeritem.vcs_url }}</td>
</tr>
<tr>
<th>Repository subdirectory</th>
<td>{{ layerbranch.vcs_subdir }}</td>
</tr>
<tr>
<th>Repo web interface</th>
<td>
{% if layeritem.vcs_web_url %}
<a href="{{ layeritem.vcs_web_url }}">{{ layeritem.vcs_web_url }}</a>
{% endif %}
</td>
</tr>
<tr>
<th>Repo web interface test links</th>
<td>
{% if layeritem.vcs_web_file_base_url %}
<span class="label label-danger">
<a href="{{ layerbranch.test_file_url }}">test file link</a>
</span>
{% else %}
<span class="label label-default">
No base file URL provided
</span>
{% endif %}
{% if layeritem.vcs_web_tree_base_url %}
<span class="label label-danger">
<a href="{{ layerbranch.test_tree_url }}">test tree link</a>
</span>
{% else %}
<span class="label label-default">
No base tree URL provided
</span>
{% endif %}
</td>
</tr>
<tr>
<th>Setup info URL</th>
<td>
{% if layeritem.usage_url %}
<a href="{{ layerbranch.get_usage_url }}">{{ layeritem.usage_url }}</a>
{% endif %}
</td>
</tr>
<tr>
<th>Mailing list URL</th>
<td>
{% if layeritem.mailing_list_url %}
<a href="{{ layerbranch.mailing_list_url }}">{{ layeritem.mailing_list_url }}</a>
{% endif %}
</td>
</tr>
<tr>
<th>Maintainers</th>
<td>
<ul class="list-unstyled">
{% for maintainer in layerbranch.active_maintainers %}
<li>
{{ maintainer.name }}
{% if maintainer.responsibility %}
<span>({{ maintainer.responsibility }})</span>
{% endif %}
- <a href="mailto:{{ maintainer.email }}">{{ maintainer.email }}</a>
</li>
{% endfor %}
</ul>
</td>
</tr>
<tr>
<th>Dependencies</th>
<td>
<ul class="list-unstyled">
{% for dep in layerbranch.dependencies_set.all %}
<li><a href="{% url 'layer_item' 'master' dep.dependency.name %}">{{ dep.dependency.name }}</a></li>
{% endfor %}
</ul>
</td>
</tr>
</tbody>
</table>
</div>
</div> <!-- end of row -->
</div> <!-- end of container-fluid -->
{% endautoescape %}
{% endblock %}