poky/bitbake/lib/toaster/toastergui/templates/layers_dep_modal.html
Michael Wood 1605cd37db bitbake: toaster: Add import layer feature.
This feature allows users to import layers from git into their current
project and associate it with the release of the current project and the
dependencies for the newly imported layer with existing layers.
It will also resolve the child dependencies of the dependencies added.

[YOCTO #6595]

(Bitbake rev: 017f5c746e894f9d87d927c848386459ea332378)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-12-18 10:24:07 +00:00

69 lines
2.7 KiB
HTML

<!-- 'Layer dependencies modal' -->
<div id="dependencies_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">
<form id="dependencies_modal_form">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3><span class="layer-name"></span> dependencies</h3>
</div>
<div class="modal-body">
<p><strong class="layer-name"></strong> depends on some layers that are not added to your project. Select the ones you want to add:</p>
<ul class="unstyled" id="dependencies_list">
</ul>
</div>
<div class="modal-footer">
<button class="btn btn-primary" type="submit">Add layers</button>
<button class="btn" type="reset" data-dismiss="modal">Cancel</button>
</div>
</form>
</div>
<script>
function show_layer_deps_modal(projectId, layer, dependencies, successAdd) {
// update layer name
$('.layer-name').text(layer.name);
var deplistHtml = "";
for (var i = 0; i < dependencies.length; i++) {
deplistHtml += "<li><label class=\"checkbox\"><input name=\"dependencies\" value=\"";
deplistHtml += dependencies[i].id;
deplistHtml +="\" type=\"checkbox\" checked=\"checked\"/>";
deplistHtml += dependencies[i].name;
deplistHtml += "</label></li>";
}
$('#dependencies_list').html(deplistHtml);
var selected = [layer.id];
var layer_link_list = "<a href='"+layer.url+"'>"+layer.name+"</a>";
$("#dependencies_modal_form").submit(function (e) {
e.preventDefault();
$("input[name='dependencies']:checked").map(function () { selected.push(parseInt($(this).val()))});
if (selected.length > 1) {
tooltipUpdateText = "" + selected.length + " layers added";
} else {
tooltipUpdateText = "1 layer added";
}
for (var i = 0; i < selected.length; i++) {
for (var j = 0; j < dependencies.length; j++) {
if (dependencies[j].id == selected[i]) {
layer_link_list+= ", <a href='"+dependencies[j].layerdetailurl+"'>"+dependencies[j].name+"</a>"
break;
}
}
}
$('#dependencies_modal').modal('hide');
var editProjectUrl = "{% url 'xhr_projectedit' project.id %}";
libtoaster.editProject(editProjectUrl, projectId, { 'layerAdd': selected.join(",") }, function () {
if (successAdd) {
successAdd(selected);
}
}, function () {
console.log ("Adding layers to project failed");
});
});
$('#dependencies_modal').modal('show');
}
</script>