Toaster patchset pull request
cover Toaster patchset pull request
From: Alexandru DAMIAN <[email protected]>
Hello,
This is a patchset for Toaster bringing in fixes and new features.
The patches have been reviewed and tested on the Toaster mailing list.
Can you please pull whenever you can ?
Cheers,
Alex
The following changes since commit 2e4a03db967ac1459b2764108fc54c4566a7e371:
tests/fetch.py: latest_versionstring add set of PN (2015-02-16 09:12:41 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib adamian/20150216-submission-bb
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=adamian/20150216-submission-bb
Alexandru DAMIAN (3):
toaster: properly detect failed server start
toaster: fix git checkout command
toasterui: empty state for pages
David Reyna (1):
toaster: Additional fixes for the project variable page
Michael Wood (6):
toaster: Use on input event for validation rather than keyup
toaster: layerdetails use new vcs reference api
toaster: New build button allow arbitrary build targets
toaster: Remove Layer source from machines, layers and targets
toaster: Remove filtering from layers,machines and targets
toaster: Set the machines page default pagesize to 100
lib/toaster/bldcontrol/localhostbecontroller.py | 7 +- .../bldcontrol/management/commands/runbuilds.py | 12 +- lib/toaster/orm/models.py | 8 +- lib/toaster/toastergui/static/img/toaster_1.7.png | Bin 0 -> 125151 bytes lib/toaster/toastergui/static/js/base.js | 6 +- lib/toaster/toastergui/static/js/importlayer.js | 6 +- lib/toaster/toastergui/static/js/layerdetails.js | 2 +- lib/toaster/toastergui/templates/landing.html | 55 ++++- lib/toaster/toastergui/templates/layerdetails.html | 13 +- lib/toaster/toastergui/templates/layers.html | 1 - lib/toaster/toastergui/templates/machines.html | 30 ++- .../toastergui/templates/managed_builds.html | 6 + .../toastergui/templates/managed_mrb_section.html | 5 +- lib/toaster/toastergui/templates/newproject.html | 2 +- lib/toaster/toastergui/templates/project.html | 14 ++ .../toastergui/templates/projectbuilds.html | 13 +- lib/toaster/toastergui/templates/projectconf.html | 258 +++++++++++++++------ lib/toaster/toastergui/templates/targets.html | 13 +- lib/toaster/toastergui/views.py | 163 ++++--------- 19 files changed, 381 insertions(+), 233 deletions(-) create mode 100644 lib/toaster/toastergui/static/img/toaster_1.7.png
Signature · 1 line
1.9.1
PATCH 1/10 toaster: Use on input event for validation rather than keyup
From: Michael Wood <[email protected]>
Avoid using keyup event to trigger form validation as this won't fire for events such as pasting or autofill from the browser.
[YOCTO #7292]
--- lib/toaster/toastergui/static/js/base.js | 4 ++-- lib/toaster/toastergui/static/js/importlayer.js | 6 +++--- lib/toaster/toastergui/static/js/layerdetails.js | 2 +- lib/toaster/toastergui/templates/newproject.html | 2 +- lib/toaster/toastergui/templates/projectconf.html | 8 ++++---- 5 files changed, 11 insertions(+), 11 deletions(-)
lib/toaster/toastergui/static/js/base.js +2 -2
@@ -71,13 +71,13 @@ function basePageInit (ctx) { /* Any typing in the input apart from enter key is going to invalidate * the value that has been set by selecting a suggestion from the typeahead */ - newBuildProjectInput.keyup(function(event) { + newBuildProjectInput.on('input', function(event) { if (event.keyCode == 13) return; newBuildProjectSaveBtn.attr("disabled", "disabled"); }); - newBuildTargetInput.keyup(function() { + newBuildTargetInput.on('input', function() { if ($(this).val().length == 0) newBuildTargetBuildBtn.attr("disabled", "disabled"); else
lib/toaster/toastergui/static/js/importlayer.js +3 -3
@@ -245,15 +245,15 @@ function importLayerPageInit (ctx) { enable_import_btn(true); } - vcsURLInput.keyup(function() { + vcsURLInput.on('input', function() { check_form(); }); - gitRefInput.keyup(function() { + gitRefInput.on('input', function() { check_form(); }); - layerNameInput.keyup(function() { + layerNameInput.on('input', function() { if ($(this).val() && !validLayerName.test($(this).val())){ layerNameCtrl.addClass("error") $("#invalid-layer-name-hint").show();
lib/toaster/toastergui/static/js/layerdetails.js +1 -1
@@ -353,7 +353,7 @@ function layerDetailsPageInit (ctx) { }); /* Disable the change button when we have no data in the input */ - $("dl input, dl textarea").keyup(function() { + $("dl input, dl textarea").on("input",function() { if ($(this).val().length == 0) $(this).parent().children(".change-btn").attr("disabled", "disabled"); else
lib/toaster/toastergui/templates/newproject.html +1 -1
@@ -72,7 +72,7 @@ $('.btn-primary').attr('disabled', 'disabled'); // enable submit button when all required fields are populated - $("input#new-project-name").keyup(function() { + $("input#new-project-name").on('input', function() { if ($("input#new-project-name").val().length > 0 ){ $('.btn-primary').removeAttr('disabled'); $(".help-inline").css('visibility','hidden');
lib/toaster/toastergui/templates/projectconf.html +4 -4
@@ -269,7 +269,7 @@ }); }); - $(".js-new-config_var").keyup(function(){ + $(".js-new-config_var").on('input', function(){ if ($(this).val().length == 0) { $(".js-apply-change-config_var").attr("disabled","disabled"); }
@@ -386,7 +386,7 @@ }); }); - $("#new-distro").keyup(function(){ + $("#new-distro").on('input', function(){ if ($(this).val().length == 0) { $("#apply-change-distro").attr("disabled","disabled"); }
@@ -469,7 +469,7 @@ }); }); - $("#new-image_install").keyup(function(){ + $("#new-image_install").on('input', function(){ if ($(this).val().length == 0) { $("#apply-change-image_install").attr("disabled","disabled"); }
@@ -629,7 +629,7 @@ }); //activate / deactivate save added variable button - $("#variable, #value").keyup(function() { + $("#variable, #value").on('input', function() { if ( $("#variable").val().length > 0 && $("#value").val().trim().length > 0 ) { $(".save").removeAttr("disabled"); }
Signature · 1 line
1.9.1
PATCH 3/10 toaster: fix git checkout command
From: Alexandru DAMIAN <[email protected]>
This patch fixes the git checkout command that would fail to properly rebase the working tree in some cases.
[YOCTO #7309]
--- lib/toaster/bldcontrol/localhostbecontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/toaster/bldcontrol/localhostbecontroller.py +1 -1
@@ -252,7 +252,7 @@ class LocalhostBEController(BuildEnvironmentController): # branch magic name "HEAD" will inhibit checkout if commit != "HEAD": logger.debug("localhostbecontroller: checking out commit %s to %s " % (commit, localdirname)) - self._shellcmd("git fetch --all && git checkout \"%s\" && git pull --rebase" % (commit) , localdirname) + self._shellcmd("git fetch --all && git checkout \"%s\" && git rebase \"origin/%s\"" % (commit, commit) , localdirname) # take the localdirname as poky dir if we can find the oe-init-build-env if self.pokydirname is None and os.path.exists(os.path.join(localdirname, "oe-init-build-env")):
Signature · 1 line
1.9.1
PATCH 5/10 toaster: Additional fixes for the project variable page
In reply to Alex DAMIANFrom: David Reyna <[email protected]>
Fix IMAGE_FSTYPES, IMAGE_INSTALL_append, and DISTRO editing management, plus other usability details.
[YOCTO #7231]
--- lib/toaster/toastergui/templates/projectconf.html | 250 ++++++++++++++++------ lib/toaster/toastergui/views.py | 42 ++-- 2 files changed, 210 insertions(+), 82 deletions(-)
lib/toaster/toastergui/templates/projectconf.html +182 -68
@@ -23,9 +23,12 @@ <i class="icon-pencil" id="change-distro-icon"></i> <form id="change-distro-form" style="display:none;"> <div class="input-append"> + <span id="edit-distro-name-div" class="control-group"> <input type="text" id="new-distro" value="{{distro}}"> <button id="apply-change-distro" class="btn" type="button">Save</button> <button id="cancel-change-distro" type="button" class="btn btn-link">Cancel</button> + <span class="help-block error" id="distro-error-message"></span> + </span> </div> </form> </dd>
@@ -48,10 +51,10 @@ <span class="js-config-var-name js-config-var-managed-name">IMAGE_INSTALL_append</span> <i class="icon-question-sign get-help" title="Specifies additional packages to install into an image. If your build creates more than one image, the packages will be installed in <strong>all of them</strong> <br /><a href='http://www.yoctoproject.org/docs/1.6.1/ref-manual/ref-manual.html#var-IMAGE_INSTALL' target='_blank'>Read more in the manual</a>"></i> </dt> - <dd class="lead muted"> + <dd class="lead"> <span id="image_install">{% if image_install_append %}{{image_install_append}}{%else%}Not set{%endif%}</span> <i class="icon-pencil" id="change-image_install-icon"></i> - <i class="icon-trash" id="delete-image_install-icon" style="display:none;"></i> + <i class="icon-trash" id="delete-image_install-icon" {% if image_install_append %}{%else%}style="display:none;"{%endif%}></i> <form id="change-image_install-form" style="display:none;"> <div class="row-fluid"> <span class="help-block span4">To set IMAGE_INSTALL_append to more than one package, type the package names separated by a space.</span>
@@ -185,13 +188,13 @@ <script> // validate new variable name - function validate_new_variable_name() { - var variable = $("input#variable")[0].value; - var value = $("input#value")[0].value; + function validate_new_variable() { + var variable = $("input#variable").val(); + var value = $("input#value").val(); // presumed innocence - $('#new-variable-error-message').html(""); - var error_msg = "" + $('#new-variable-error-message').text(""); + var error_msg = ""; var existing_configvars = document.getElementsByClassName('js-config-var-name'); for (var i = 0, length = existing_configvars.length; i < length; i++) {
@@ -202,7 +205,7 @@ var blacklist_configvars = document.getElementsByClassName('js-config-blacklist-name'); for (var i = 0, length = blacklist_configvars.length; i < length; i++) { - if (blacklist_configvars[i].value == variable) { + if (blacklist_configvars[i].value == variable.toUpperCase()) { error_msg = "You cannot edit this variable in Toaster because it is set by the build servers"; } }
@@ -220,7 +223,7 @@ } if ("" != error_msg) { - $('#new-variable-error-message').html(error_msg); + $('#new-variable-error-message').text(error_msg); $(".save").attr("disabled","disabled"); var d = document.getElementById("add-configvar-name-div");
@@ -228,14 +231,68 @@ return false; } - var d = document.getElementById("add-configvar-name-div"); d.className = d.className.replace(" control-group error",""); + + // now set the "Save" enablement if 'value' also passes + if (value.trim().length > 0) { + $(".save").removeAttr("disabled"); + } else { + $(".save").attr("disabled","disabled"); + } + return true; } + // validate distro name + function validate_distro_name() { + var value = $("input#new-distro").val(); + + // presumed innocence + $('#distro-error-message').text(""); + var error_msg = ""; + + var has_spaces = (0 <= value.indexOf(" ")); + + if (has_spaces) { + error_msg = "A valid distro name cannot include spaces"; + } else if (0 == value.length) { + error_msg = "A valid distro name cannot be empty"; + } + + if ("" != error_msg) { + $('#distro-error-message').text(error_msg); + $("#apply-change-distro").attr("disabled","disabled"); + + var d = document.getElementById("edit-distro-name-div"); + d.className = d.className + " control-group error"; + + return false; + } + + var d = document.getElementById("edit-distro-name-div"); + d.className = d.className.replace(" control-group error",""); + $("#apply-change-distro").removeAttr("disabled"); + return true; + } + + // Test to insure at least one FS Type is checked + function enableFsTypesSave() { + var any_checked = 0; + $(".fs-checkbox-fstypes:checked").each(function(){ + any_checked = 1; + }); + if ( 0 == any_checked ) { + $("#apply-change-image_fstypes").attr("disabled","disabled"); + } + else { + $("#apply-change-image_fstypes").removeAttr("disabled"); + } + } + // Preset or reset the Package Class checkbox labels function updatePackageClassCheckboxes() { + $('#package_class_1, #package_class_2').hide(); if ($('select').val() == 'package_dev') { $('#package_class_1').html('<input type="checkbox" id="package_class_1_input"> package_ipk'); $('#package_class_2').html('<input type="checkbox" id="package_class_2_input"> package_rpm');
@@ -248,6 +305,7 @@ $('#package_class_1').html('<input type="checkbox" id="package_class_1_input"> package_dev'); $('#package_class_2').html('<input type="checkbox" id="package_class_2_input"> package_ipk'); } + $('#package_class_1, #package_class_2').fadeIn(1500); } // Re-assert handlers when the page is served and/or refreshed via Ajax
@@ -256,16 +314,16 @@ // change variable value $('.js-icon-pencil-config_var').click(function (evt) { var pk = evt.target.attributes["x-data"].value; - var current_val = $("span#config_var_"+pk).html(); - $('.js-icon-pencil-config_var, .js-icon-trash-config_var, #config_var_'+pk).hide(); + var current_val = $("span#config_var_value_"+pk).text(); + $('.js-icon-pencil-config_var, .js-icon-trash-config_var, #config_var_value_'+pk).hide(); $("#change-config_var-form_"+pk).slideDown(); - $("input#new-config_var_"+pk)[0].value = current_val; + $("input#new-config_var_"+pk).val(current_val); }); $('.js-cancel-change-config_var').click(function (evt) { var pk = evt.target.attributes["x-data"].value; $("#change-config_var-form_"+pk).slideUp(function() { - $('.js-icon-pencil-config_var, .js-icon-trash-config_var, #config_var_'+pk).show(); + $('.js-icon-pencil-config_var, .js-icon-trash-config_var, #config_var_value_'+pk).show(); }); });
@@ -284,20 +342,25 @@ var variable = xdata[1]; var val = $('#new-config_var_'+pk).val(); postEditAjaxRequest({"configvarChange" : variable+':'+val}); - $('#config_var_'+pk).parent().removeClass('muted'); + $('#config_var_value_'+pk).parent().removeClass('muted'); $("#change-config_var-form_"+pk).slideUp(function() { - $('.js-icon-pencil-config_var, .js-icon-trash-config_var, #config_var_'+pk).show(); + $('.js-icon-pencil-config_var, .js-icon-trash-config_var, #config_var_value_'+pk).show(); }); }); // delete variable - $(".js-icon-trash-config_var").click(function (evt) { - var xdata = evt.target.attributes["x-data"].value.split(":"); - var pk = xdata[0]; - $('#config_var_entry_'+pk).slideUp(function() { - //$('#config_var_entry_'+pk).show(); - }); - postEditAjaxRequest({"configvarDel": evt.target.attributes["x-data"].value}); + $(".js-icon-trash-config_var").click(function (evt) { + var xdata = evt.target.attributes["x-data"].value.split(":"); + var pk = xdata[0]; + + // hide the dangling trash tooltip + $('#config_var_trash_'+pk).hide(); + + // fade out the variable+value div, then refresh the variable list + $('#config_var_entry_'+pk).parent().parent().fadeOut(1000, function(){ + postEditAjaxRequest({"configvarDel": evt.target.attributes["x-data"].value}); + }); + }); }
@@ -320,9 +383,9 @@ } } if (var_context == undefined) { - orightml += '<dt id="config_var_entry_'+configvars_sorted[i][2]+'"><span class="js-config-var-name">'+configvars_sorted[i][0]+'</span><i class="icon-trash js-icon-trash-config_var" x-data="'+configvars_sorted[i][2]+'"></i> </dt>' + orightml += '<div> <dt><span id="config_var_entry_'+configvars_sorted[i][2]+'" class="js-config-var-name"></span><i class="icon-trash js-icon-trash-config_var" id="config_var_trash_'+configvars_sorted[i][2]+'" x-data="'+configvars_sorted[i][2]+'"></i> </dt>' orightml += '<dd class="lead">' - orightml += ' <span id="config_var_'+configvars_sorted[i][2]+'">'+configvars_sorted[i][1]+'</span>' + orightml += ' <span id="config_var_value_'+configvars_sorted[i][2]+'"></span>' orightml += ' <i class="icon-pencil js-icon-pencil-config_var" x-data="'+configvars_sorted[i][2]+'"></i>' orightml += ' <form id="change-config_var-form_'+configvars_sorted[i][2]+'" style="display:none;">' orightml += ' <div class="input-append">'
@@ -331,13 +394,23 @@ orightml += ' <button type="button" class="btn btn-link js-cancel-change-config_var" x-data="'+configvars_sorted[i][2]+'">Cancel</button>' orightml += ' </div>' orightml += ' </form>' - orightml += '</dd>' + orightml += '</dd> </div>' } } - // update configvars list + // update configvars list HTML framework $("dl#configvar-list").html(orightml); + // insert the name/value pairs safely as non-HTML + for (i = 0; i < configvars_sorted.length; i++) { + $('#config_var_entry_'+configvars_sorted[i][2]).text(configvars_sorted[i][0]); + $('#config_var_value_'+configvars_sorted[i][2]).text(configvars_sorted[i][1]); + } + + // Add the tooltips + $(".js-icon-trash-config_var").each( function(){ setDeleteTooltip($(this)); }); + $(".js-icon-pencil-config_var").each(function(){ setChangeTooltip($(this)); }); + // re-assert these event handlers setEventHandlersForDynamicElements(); }
@@ -364,13 +437,19 @@ headers: { 'X-CSRFToken': $.cookie("csrftoken")}, success: onEditAjaxSuccess, error: onEditAjaxError, - }) + }) } + function setDeleteTooltip(object) { + object.tooltip({ container: 'body', html: true, delay: {show: 400}, title: "Delete" }); + } + function setChangeTooltip(object) { + object.tooltip({ container: 'body', html: true, delay: {show: 400}, title: "Change" }); + } $(document).ready(function() { - // + // // Register handlers for static elements //
@@ -378,33 +457,37 @@ $('#change-distro-icon').click(function() { $('#change-distro-icon, #distro').hide(); $("#change-distro-form").slideDown(); + $("#new-distro").val( $('#distro').text() ); }); $('#cancel-change-distro').click(function(){ $("#change-distro-form").slideUp(function() { $('#distro, #change-distro-icon').show(); + + // reset any dangling error state + $('#distro-error-message').text(""); + var d = document.getElementById("edit-distro-name-div"); + d.className = d.className.replace(" control-group error",""); }); }); - $("#new-distro").on('input', function(){ - if ($(this).val().length == 0) { - $("#apply-change-distro").attr("disabled","disabled"); - } - else { - $("#apply-change-distro").removeAttr("disabled"); - } + // validate new distro name + $("input#new-distro").on('input', function (evt) { + validate_distro_name(); }); $('#apply-change-distro').click(function(){ //$('#repo').parent().removeClass('highlight-go'); var name = $('#new-distro').val(); postEditAjaxRequest({"configvarChange" : 'DISTRO:'+name}); - $('#distro').html(name); + $('#distro').text(name); $("#change-distro-form").slideUp(function () { $('#distro, #change-distro-icon').show(); }); }); + // init IMAGE_FSTYPES trash icon + setDeleteTooltip($('#delete-image_install-icon')); // change IMAGE_FSTYPES variable $('#change-image_fstypes-icon').click(function() {
@@ -429,26 +512,57 @@ } } document.getElementById("all-image_fstypes").innerHTML = html; + + // Watch elements to disable Save when none are checked + $(".fs-checkbox-fstypes").each(function(){ + $(this).click(function() { + enableFsTypesSave(); + }); + }); + + // clear the previous filter values + $("input#filter-image_fstypes").val(""); }); + $('#cancel-change-image_fstypes').click(function(){ $("#change-image_fstypes-form").slideUp(function() { $('#image_fstypes, #change-image_fstypes-icon').show(); }); }); + $('#filter-image_fstypes').on('input', function(){ + var valThis = $(this).val().toLowerCase(); + $('#all-image_fstypes label').each(function(){ + var text = $(this).text().toLowerCase(); + var match = text.indexOf(valThis); + if (match >= 0) { + $(this).show(); + } + else { + $(this).hide(); + } + }); + }); + $('#apply-change-image_fstypes').click(function(){ - var fstypes = ''; + // extract the selected fstypes and sort them + var fstypes_array = []; var checkboxes = document.getElementsByClassName('fs-checkbox-fstypes'); - for (var i = 0, length = checkboxes.length; i < length; i++) { - if (checkboxes[i].checked) { - fstypes += checkboxes[i].value + ' '; - } + $(".fs-checkbox-fstypes:checked").each(function(){ + fstypes_array.push($(this).val()); + }); + fstypes_array.sort(); + + // now make a string of them + var fstypes = ''; + for (var i = 0, length = fstypes_array.length; i < length; i++) { + fstypes += fstypes_array[i] + ' '; } fstypes = fstypes.trim(); postEditAjaxRequest({"configvarChange" : 'IMAGE_FSTYPES:'+fstypes}); - $('#image_fstypes').html(fstypes); + $('#image_fstypes').text(fstypes); $('#image_fstypes').parent().removeClass('muted'); $("#change-image_fstypes-form").slideUp(function() {
@@ -459,6 +573,14 @@ // change IMAGE_INSTALL_append variable $('#change-image_install-icon').click(function() { + // preset the edit value + var current_val = $("span#image_install").text(); + if (current_val == "Not set") { + current_val=""; + $("#apply-change-image_install").attr("disabled","disabled"); + } + $("input#new-image_install").val(current_val); + $('#change-image_install-icon, #delete-image_install-icon, #image_install').hide(); $("#change-image_install-form").slideDown(); });
@@ -466,6 +588,10 @@ $('#cancel-change-image_install').click(function(){ $("#change-image_install-form").slideUp(function() { $('#image_install, #change-image_install-icon').show(); + if ($("span#image_install").text() != "Not set") { + $('#delete-image_install-icon').show(); + setDeleteTooltip($('#delete-image_install-icon')); + } }); });
@@ -481,12 +607,13 @@ $('#apply-change-image_install').click(function(){ var name = $('#new-image_install').val(); postEditAjaxRequest({"configvarChange" : 'IMAGE_INSTALL_append:'+name}); - $('#image_install').html(name); + $('#image_install').text(name); $('#image_install').parent().removeClass('muted'); $("#change-image_install-form").slideUp(function () { $('#image_install, #change-image_install-icon').show(); if (name.length > -1) { $('#delete-image_install-icon').show(); + setDeleteTooltip($('#delete-image_install-icon')); } }); });
@@ -497,7 +624,7 @@ postEditAjaxRequest({"configvarChange" : 'IMAGE_INSTALL_append:'+''}); $('#image_install').parent().fadeOut(1000, function(){ $('#image_install').parent().addClass('muted'); - $('#image_install').html('Not set'); + $('#image_install').text('Not set'); $('#delete-image_install-icon').hide(); $('#image_install').parent().fadeIn(1000); });
@@ -560,7 +687,7 @@ if (pc2_checked) val = val + " package_ipk"; } - $('#package_classes').html(val); + $('#package_classes').text(val); //$('#package_classes').parent().removeClass('muted'); postEditAjaxRequest({"configvarChange" : 'PACKAGE_CLASSES:'+val}); $("#change-package_classes-form").slideUp(function() {
@@ -600,7 +727,7 @@ } } postEditAjaxRequest({"configvarChange" : 'SDKMACHINE:'+value}); - $('#sdkmachine').html(value); + $('#sdkmachine').text(value); $("#change-sdkmachine-form").slideUp(function() { $('#sdkmachine, #change-sdkmachine-icon').show(); });
@@ -610,32 +737,19 @@ // add new variable $("button#add-configvar-button").click( function (evt) { - var variable = $("input#variable")[0].value; - var value = $("input#value")[0].value; - - if (validate_new_variable_name()) { - postEditAjaxRequest({"configvarAdd" : variable+':'+value}); + var variable = $("input#variable").val(); + var value = $("input#value").val(); - // clear the previous values - $("input#variable")[0].value = ""; - $("input#value")[0].value = ""; + postEditAjaxRequest({"configvarAdd" : variable+':'+value}); - } + // clear the previous values + $("input#variable").val(""); + $("input#value").val(""); }); - // validate new variable name - $("input#variable").focusout( function (evt) { - validate_new_variable_name(); - }); - - //activate / deactivate save added variable button + // validate new variable name and value $("#variable, #value").on('input', function() { - if ( $("#variable").val().length > 0 && $("#value").val().trim().length > 0 ) { - $(".save").removeAttr("disabled"); - } - else { - $(".save").attr("disabled","disabled"); - } + validate_new_variable(); }); //
lib/toaster/toastergui/views.py +28 -14
62 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 6/10 toaster: New build button allow arbitrary build targets
In reply to Alex DAMIANFrom: Michael Wood <[email protected]>
Target input field needed to support both selecting suggestions and typing targets, since Toaster doesn't always know about all the targets provided by the layers in the project.
[YOCTO #7187]
--- lib/toaster/toastergui/static/js/base.js | 2 ++ 1 file changed, 2 insertions(+)
lib/toaster/toastergui/static/js/base.js +2 -0
@@ -88,6 +88,8 @@ function basePageInit (ctx) { if (!newBuildTargetInput.val()) return; + if (!selectedTarget) + selectedTarget = { name: newBuildTargetInput.val() }; /* fire and forget */ libtoaster.startABuild(ctx.projectBuildUrl, ctx.projectId, selectedTarget.name, null, null); window.location.replace(ctx.projectPageUrl+ctx.projectId);
Signature · 1 line
1.9.1
PATCH 7/10 toaster: Remove Layer source from machines, layers and targets
In reply to Alex DAMIANFrom: Michael Wood <[email protected]>
From the bug: The layer source reveals too much of the implementation model, without explaining what is going on behind the scenes. It will confuse more than inform, so let's get rid of it.
[YOCTO #7302]
--- lib/toaster/toastergui/templates/layers.html | 1 - lib/toaster/toastergui/templates/machines.html | 1 - lib/toaster/toastergui/templates/targets.html | 1 - lib/toaster/toastergui/views.py | 37 -------------------------- 4 files changed, 40 deletions(-)
lib/toaster/toastergui/templates/layers.html +0 -1
@@ -41,7 +41,6 @@ <tr class="data"> <td class="layer"><a href="{% url 'layerdetails' o.id %}">{{o.layer.name}}</a></td> <td class="description">{% if o.layer.summary %}{{o.layer.summary}}{%endif%}</td> - <td class="source"><a href="{% url 'layerdetails' o.pk %}">{{o.layer_source.name}}</a></td> <td class="git-repo"><a href="{% url 'layerdetails' o.pk %}"><code>{{o.layer.vcs_url}}</code></a> {% if o.get_vcs_link_url %} <a target="_blank" href="{{ o.get_vcs_link_url }}"><i class="icon-share get-info"></i></a>
lib/toaster/toastergui/templates/machines.html +0 -1
@@ -64,7 +64,6 @@ <td class="machine">{{o.name}}</td> <td class="description">{{o.description}}</td> <td class="layer"><a href="{%url "layerdetails" o.layer_version.id %}">{{o.layer_version.layer.name}}</a></td> - <td class="source">{{o.layer_source.name}}</td> <td class="branch">{{o.layer_version.get_vcs_reference}}</td> <td class="machinefile"><code>/machine/conf/{{o.name}}.conf</code><a href="{{o.get_vcs_machine_file_link_url}}" target="_blank"><i class="icon-share get-info"></i></a></td> <td class="select-or-add">
lib/toaster/toastergui/templates/targets.html +0 -1
@@ -53,7 +53,6 @@ <td class="target-section">{{o.section}}</td> <td class="license">{{o.license}}</td> <td class="layer"><a href="{% url 'layerdetails' o.preffered_layerversion.id%}">{{o.preffered_layerversion.layer.name}}</a></td> - <td class="source">{{o.preffered_layerversion.layer_source.name}}</td> <td class="branch"> {% if o.preffered_layerversion.up_branch %} {{o.preffered_layerversion.up_branch.name}}
lib/toaster/toastergui/views.py +0 -37
@@ -2565,18 +2565,6 @@ if toastermain.settings.MANAGED: 'dclass': 'span4', 'clclass': 'description', }, - { 'name': 'Layer source', - 'clclass': 'source', - 'qhelp': "Where the layer is coming from, for example, if it's part of the OpenEmbedded collection of layers or if it's a layer you have imported", - 'orderfield': _get_toggle_order(request, "layer_source__name"), - 'ordericon': _get_toggle_order_icon(request, "layer_source__name"), - 'orderkey' : "layer_source__name", - 'filter': { - 'class': 'layer', - 'label': 'Show:', - 'options': map(lambda x: (x.name + " layers", 'layer_source__pk:' + str(x.id), queryset_all.filter(layer_source__pk = x.id).count() ), LayerSource.objects.all()), - } - }, { 'name': 'Git repository URL', 'dclass': 'span6', 'clclass': 'git-repo', 'hidden': 1,
@@ -2741,18 +2729,6 @@ if toastermain.settings.MANAGED: 'ordericon': _get_toggle_order_icon(request, "layer_version__layer__name"), 'orderkey': "layer_version__layer__name", }, - { 'name': 'Layer source', - 'clclass': 'source', - 'qhelp': "Where the target is coming from, for example, if it's part of the OpenEmbedded collection of targets or if it's a target you have imported", - 'orderfield': _get_toggle_order(request, "layer_source__name"), - 'ordericon': _get_toggle_order_icon(request, "layer_source__name"), - 'orderkey': "layer_source__name", - 'filter': { - 'class': 'target', - 'label': 'Show:', - 'options': map(lambda x: ("Targets provided by " + x.name + " layers", 'layer_source__pk:' + str(x.id), queryset_with_search.filter(layer_source__pk = x.id).count() ), LayerSource.objects.all()), - } - }, { 'name': 'Revision', 'clclass': 'branch', 'qhelp': "The Git branch, tag or commit. For the layers from the OpenEmbedded layer source, the revision is always the branch compatible with the Yocto Project version you selected for this project.",
@@ -2802,7 +2778,6 @@ if toastermain.settings.MANAGED: queryset_all = Machine.objects.all() queryset_all = queryset_all.prefetch_related('layer_version') - queryset_all = queryset_all.prefetch_related('layer_source') prj = Project.objects.get(pk = request.session['project_id']) compatible_layers = prj.compatible_layerversions()
@@ -2870,18 +2845,6 @@ if toastermain.settings.MANAGED: 'ordericon' : _get_toggle_order_icon(request, "layer_version__layer__name"), 'orderkey' : "layer_version__layer__name", }, - { 'name': 'Layer source', - 'clclass': 'source', - 'qhelp': "Where the machine is coming from, for example, if it's part of the OpenEmbedded collection of machines or if it's a machine you have imported", - 'orderfield': _get_toggle_order(request, "layer_source__name"), - 'ordericon': _get_toggle_order_icon(request, "layer_source__name"), - 'orderkey': "layer_source__name", - 'filter': { - 'class': 'machine', - 'label': 'Show:', - 'options': map(lambda x: (x.name, 'layer_source__pk:' + str(x.id), queryset.filter(layer_source__pk = x.id).count() ), LayerSource.objects.all()), - } - }, { 'name': 'Revision', 'clclass': 'branch', 'qhelp' : "The Git branch, tag or commit. For the layers from the OpenEmbedded layer source, the revision is always the branch compatible with the Yocto Project version you selected for this project",
Signature · 1 line
1.9.1
PATCH 9/10 toaster: Set the machines page default pagesize to 100
In reply to Alex DAMIANFrom: Michael Wood <[email protected]>
This brings it into line with the all layers and targets pages
--- lib/toaster/toastergui/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/toaster/toastergui/views.py +2 -1
@@ -2746,7 +2746,7 @@ if toastermain.settings.MANAGED: # define here what parameters the view needs in the GET portion in order to # be able to display something. 'count' and 'page' are mandatory for all views # that use paginators. - (pagesize, orderby) = _get_parameters_values(request, 10, 'name:+') + (pagesize, orderby) = _get_parameters_values(request, 100, 'name:+') mandatory_parameters = { 'count': pagesize, 'page' : 1, 'orderby' : orderby }; retval = _verify_parameters( request.GET, mandatory_parameters ) if retval:
@@ -2775,6 +2775,7 @@ if toastermain.settings.MANAGED: if len(to_rm) > 0: queryset_all = queryset_all.exclude(layer_version__in=to_rm) + machine_info = _build_page_range(Paginator(queryset_all, request.GET.get('count', 100)),request.GET.get('page', 1)) context = { 'objects' : machine_info,
Signature · 1 line
1.9.1
PATCH 8/10 toaster: Remove filtering from layers, machines and targets
In reply to Alex DAMIANFrom: Michael Wood <[email protected]>
The filter counts are unreliable so for consistency the filter feature here is removed.
[YOCTO #7060]
[YOCTO #7052]
--- lib/toaster/toastergui/views.py | 61 ++--------------------------------------- 1 file changed, 2 insertions(+), 59 deletions(-)
lib/toaster/toastergui/views.py +2 -59
@@ -2554,7 +2554,6 @@ if toastermain.settings.MANAGED: 'objects' : layer_info, 'objectname' : "layers", 'default_orderby' : 'layer__name:+', - 'total_count': len(object_list), 'tablecols' : [ { 'name': 'Layer',
@@ -2586,15 +2585,6 @@ if toastermain.settings.MANAGED: { 'name': 'Add | Delete', 'dclass': 'span2', 'qhelp': "Add or delete layers to / from your project ", - 'filter': { - 'class': 'add-del-layers', - 'label': 'Show:', - 'options': [ - ('Layers added to this project', "projectlayer__project:" + str(prj.id), queryset_all.filter(projectlayer__project = prj.id).count()), - ('Layers not added to this project', "projectlayer__project:NOT" + str(prj.id), queryset_all.exclude(projectlayer__project = prj.id).count()), - ] - - } }, ] }
@@ -2690,7 +2680,6 @@ if toastermain.settings.MANAGED: 'objects' : target_info, 'objectname' : "targets", 'default_orderby' : 'name:+', - 'total_count': queryset_with_search.count(), 'tablecols' : [ { 'name': 'Target',
@@ -2742,15 +2731,6 @@ if toastermain.settings.MANAGED: { 'name': 'Build', 'dclass': 'span2', 'qhelp': "Add or delete targets to / from your project ", - 'filter': { - 'class': 'add-layer', - 'label': 'Show:', - 'options': [ - ('Targets provided by layers added to this project', "layer_version__projectlayer__project:" + str(prj.id), queryset_with_search.filter(layer_version__projectlayer__project = prj.id).count()), - ('Targets provided by layers not added to this project', "layer_version__projectlayer__project:NOT" + str(prj.id), queryset_with_search.exclude(layer_version__projectlayer__project = prj.id).count()), - ] - - } }, ] response = render(request, template, context)
@@ -2782,52 +2762,25 @@ if toastermain.settings.MANAGED: prj = Project.objects.get(pk = request.session['project_id']) compatible_layers = prj.compatible_layerversions() - # FILTERS SECTION - # Make sure we only show machines / layers which are compatible # with the current project queryset_all = queryset_all.filter(layer_version__in=compatible_layers) project_layers = ProjectLayer.objects.filter(project_id=request.session['project_id']).values_list('layercommit',flat=True) - by_pass_filter_string = False - # "special" filters identified by these valid filter strings we - # by pass the usual filter applying method because we're filtering using - # a subquery done by project_layers - - if "name:inprj" in filter_string: - queryset_all = queryset_all.filter(layer_version__in=project_layers) - by_pass_filter_string = True - - if "name:notinprj" in filter_string: - queryset_all = queryset_all.exclude(layer_version__in=project_layers) - by_pass_filter_string = True - - # END FILTERS - - if by_pass_filter_string: - queryset = _get_queryset(Machine, queryset_all, None, search_term, ordering_string, '-name') - else: - queryset = _get_queryset(Machine, queryset_all, filter_string, search_term, ordering_string, '-name') - # Now we need to weed out the layers which will appear as duplicated # because they're from a layer source which doesn't need to be used - for machine in queryset: + for machine in queryset_all: to_rm = machine.layer_version.get_equivalents_wpriority(prj)[1:] if len(to_rm) > 0: - queryset = queryset.exclude(layer_version__in=to_rm) + queryset_all = queryset_all.exclude(layer_version__in=to_rm) - machine_info = _build_page_range(Paginator(queryset, request.GET.get('count', 10)),request.GET.get('page', 1)) - selected_filter_count = {} - selected_filter_count['inprj'] = queryset.filter(layer_version__in=project_layers).count() - selected_filter_count['notinprj'] = queryset.count() - selected_filter_count['inprj'] context = { 'objects' : machine_info, 'project_layers' : project_layers, 'objectname' : "machines", 'default_orderby' : 'name:+', - 'total_count': queryset.count(), 'tablecols' : [ { 'name': 'Machine',
@@ -2857,16 +2810,6 @@ if toastermain.settings.MANAGED: { 'name': 'Select', 'dclass': 'select span2', 'qhelp': "Sets the selected machine as the project machine. You can only have one machine per project", - 'filter': { - 'class': 'select', - 'label': 'Show:', - 'options': [ - (u'Machines provided by layers added to this project', 'name:inprj', selected_filter_count['inprj']), - (u'Machines provided by layers not added to this project', 'name:notinprj', selected_filter_count['notinprj']), - - ], - } - }, ]
Signature · 1 line
1.9.1
PATCH 2/10 toaster: properly detect failed server start
In reply to Alex DAMIANFrom: Alexandru DAMIAN <[email protected]>
This patch brings in reading the server log if the server fails to start. This is the first step in displaying the errors in a manner that is actionable by the user.
[YOCTO #7285]
--- lib/toaster/bldcontrol/localhostbecontroller.py | 5 ++++- lib/toaster/bldcontrol/management/commands/runbuilds.py | 12 +++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-)
lib/toaster/bldcontrol/localhostbecontroller.py +4 -1
@@ -108,7 +108,7 @@ class LocalhostBEController(BuildEnvironmentController): logger.debug("localhostbecontroller: running the listener at %s" % own_bitbake) - cmd = "bash -c \"source %s/oe-init-build-env %s && bitbake --read conf/toaster-pre.conf --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0 && DATABASE_URL=%s BBSERVER=0.0.0.0:-1 daemon -d -i -D %s -o toaster_ui.log -- %s --observe-only -u toasterui &\"" % (self.pokydirname, self.be.builddir, + cmd = "bash -c \"source %s/oe-init-build-env %s && bitbake --read conf/toaster-pre.conf --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0 >toaster_server.log && DATABASE_URL=%s BBSERVER=0.0.0.0:-1 daemon -d -i -D %s -o toaster_ui.log -- %s --observe-only -u toasterui &\"" % (self.pokydirname, self.be.builddir, self.dburl, self.be.builddir, own_bitbake) port = "-1" cmdoutput = self._shellcmd(cmd)
@@ -290,6 +290,9 @@ class LocalhostBEController(BuildEnvironmentController): self.islayerset = True return True + def readServerLogFile(self): + return open(os.path.join(self.be.builddir, "toaster_server.log"), "r").read() + def release(self): assert self.be.sourcedir and os.path.exists(self.be.builddir) import shutil
lib/toaster/bldcontrol/management/commands/runbuilds.py +9 -3
@@ -78,10 +78,16 @@ class Command(NoArgsCommand): except Exception as e: logger.error("runbuilds: Error executing shell command %s" % e) traceback.print_exc(e) + if "[Errno 111] Connection refused" in str(e): + # Connection refused, read toaster_server.out + errmsg = bec.readServerLogFile() + else: + errmsg = str(e) + BRError.objects.create(req = br, - errtype = str(type(e)), - errmsg = str(e), - traceback = traceback.format_exc(e)) + errtype = str(type(e)), + errmsg = errmsg, + traceback = traceback.format_exc(e)) br.state = BuildRequest.REQ_FAILED br.save() bec.be.lock = BuildEnvironment.LOCK_FREE
Signature · 1 line
1.9.1
PATCH 4/10 toaster: layerdetails use new vcs reference api
In reply to Alex DAMIANFrom: Michael Wood <[email protected]>
Use the new layer_version api so that we return the vcs reference whether that be the commit hash, branch name or the upstream branch to which the layer is associated with.
[YOCTO #7192]
--- lib/toaster/toastergui/templates/layerdetails.html | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
lib/toaster/toastergui/templates/layerdetails.html +6 -7
@@ -5,7 +5,7 @@ {% block localbreadcrumb %} <li><a href="{% url 'layers' %}">All compatible layers</a></li> <li> - {{layerversion.layer.name}} ({{layerversion.commit|truncatechars:13}}) + {{layerversion.layer.name}} ({{layerversion.get_vcs_reference|truncatechars:13}}) </li> {% endblock %} {% block projectinfomain %}
@@ -29,7 +29,7 @@ layerVersion : { name : "{{layerversion.layer.name}}", id : {{layerversion.id}}, - commit: "{{layerversion.commit}}", + commit: "{{layerversion.get_vcs_reference}}", inCurrentPrj : {{layer_in_project}}, url : "{% url 'layerdetails' layerversion.id %}", sourceId: {{layerversion.layer_source_id}},
@@ -66,7 +66,7 @@ {% include "layers_dep_modal.html" %} <div class="row-fluid span11"> <div class="page-header"> - <h1>{{layerversion.layer.name}} <small class="commit" data-toggle="tooltip" title="{{layerversion.commit}}">({{layerversion.commit|truncatechars:13}})</small></h1> + <h1>{{layerversion.layer.name}} <small class="commit" data-toggle="tooltip" title="{{layerversion.get_vcs_reference}}">({{layerversion.get_vcs_reference|truncatechars:13}})</small></h1> </div> </div>
@@ -147,10 +147,10 @@ Revision </dt> <dd> - <span class="current-value">{{layerversion.commit}}</span> + <span class="current-value">{{layerversion.get_vcs_reference}}</span> <form style="display:none;"> <div class="input-append"> - <input type="text" value="{{layerversion.commit}}"> + <input type="text" value="{{layerversion.get_vcs_reference}}"> <button data-layer-prop="commit" class="btn change-btn" type="button">Save</button> <a href="#" style="display:none" class="btn btn-link cancel">Cancel</a> </div>
@@ -166,8 +166,7 @@ {% for ld in layerversion.dependencies.all %} <span class="current-value"> <li data-layer-id="{{ld.depends_on.id}}"> - <!-- TODO use ld.depends_on.get_vcs_reference instead of commit --> - <a data-toggle="tooltip" title="{{ld.depends_on.layer.vcs_url}} | {{ld.depends_on.commit}}" href="{% url 'layerdetails' ld.depends_on.id %}">{{ld.depends_on.layer.name}}</a> + <a data-toggle="tooltip" title="{{ld.depends_on.layer.vcs_url}} | {{ld.depends_on.get_vcs_reference}}" href="{% url 'layerdetails' ld.depends_on.id %}">{{ld.depends_on.layer.name}}</a> <span class="icon-trash " data-toggle="tooltip" title="Delete"></span> </li> </span>
Signature · 1 line
1.9.1