mirror of
https://git.yoctoproject.org/poky
synced 2026-03-13 10:49:40 +01:00
Add functionality to the placeholder button on the build dashboard to open a modal dialog displaying editable custom images, in cases where multiple custom images were built by the build. Where there is only one editable custom image, go direct to its edit page. The images shown in the modal are custom recipes for the project which were built during the build shown in the dashboard. This also affects the new custom image dialog, as that also has to show custom image recipes as well as image recipes built during the build. Modify the API on the Build object to support both. Also modify and rename the queryset_to_list template filter so that it can deal with lists as well as querysets, as the new custom image modal has to show a list of image recipes which is an amalgam of two querysets. [YOCTO #9123] (Bitbake rev: 8c2aea3fa8e1071de60390e86e2536904fa9b7c0) Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
72 lines
2.0 KiB
HTML
72 lines
2.0 KiB
HTML
<!--
|
||
modal dialog shown on the build dashboard, for editing an existing custom image;
|
||
only shown if more than one custom image was built, so the user needs to
|
||
choose which one to edit
|
||
|
||
required context:
|
||
build - a Build object
|
||
-->
|
||
<div class="modal hide fade in" aria-hidden="false" id="edit-custom-image-modal">
|
||
<div class="modal-header">
|
||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||
<h3>Which image do you want to edit?</h3>
|
||
</div>
|
||
|
||
<div class="modal-body">
|
||
<div class="row-fluid">
|
||
{% for recipe in build.get_custom_image_recipes %}
|
||
<label class="radio">
|
||
{{recipe.name}}
|
||
<input type="radio" class="form-control" name="select-custom-image"
|
||
data-url="{% url 'customrecipe' build.project.id recipe.id %}">
|
||
</label>
|
||
{% endfor %}
|
||
</div>
|
||
<span class="help-block error" id="invalid-custom-image-help" style="display:none">
|
||
Please select a custom image to edit.
|
||
</span>
|
||
</div>
|
||
|
||
<div class="modal-footer">
|
||
<button class="btn btn-primary btn-large" data-url="#"
|
||
data-action="edit-custom-image" disabled>
|
||
Edit custom image
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<script>
|
||
$(document).ready(function () {
|
||
var editCustomImageButton = $('[data-action="edit-custom-image"]');
|
||
var error = $('#invalid-custom-image-help');
|
||
var radios = $('[name="select-custom-image"]');
|
||
|
||
// return custom image radio buttons which are selected
|
||
var getSelectedRadios = function () {
|
||
return $('[name="select-custom-image"]:checked');
|
||
};
|
||
|
||
radios.change(function () {
|
||
if (getSelectedRadios().length === 1) {
|
||
editCustomImageButton.removeAttr('disabled');
|
||
error.hide();
|
||
}
|
||
else {
|
||
editCustomImageButton.attr('disabled', 'disabled');
|
||
error.show();
|
||
}
|
||
});
|
||
|
||
editCustomImageButton.click(function () {
|
||
var selectedRadios = getSelectedRadios();
|
||
|
||
if (selectedRadios.length === 1) {
|
||
document.location.href = selectedRadios.first().attr('data-url');
|
||
}
|
||
else {
|
||
error.show();
|
||
}
|
||
});
|
||
});
|
||
</script>
|