toaster: toastergui: implement machine name validation
cover toaster: toastergui: implement machine name validation
From: David Reyna <[email protected]>
This prevents improperly entered machine names in Toaster UI.
The following changes since commit eff56e4f0d59b1d965a68e4f009b7f07717b7edd:
bitbake: bitbake-user-manual: Fixed special character in -D output (2017-04-03 22:32:02 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib dreyna/submit/abelal/toaster/implement-machine-name-8721
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=dreyna/submit/abelal/toaster/implement-machine-name-8721
Belal, Awais (1):
toaster: toastergui: implement machine name validation
lib/toaster/toastergui/static/js/projectpage.js | 17 +++++++++++++++++ lib/toaster/toastergui/templates/project.html | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-)
Signature · 1 line
1.9.1
PATCH 1/1 toaster: toastergui: implement machine name validation
From: "Belal, Awais" <[email protected]>
Valid machine names cannot include spaces anywhere in the name and doing so will result in a build failure. This implements a mechanism to alert the user against such a misconfiguration and does not allow input of such machine names.
[YOCTO #8721]
--- lib/toaster/toastergui/static/js/projectpage.js | 17 +++++++++++++++++ lib/toaster/toastergui/templates/project.html | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-)
lib/toaster/toastergui/static/js/projectpage.js +17 -0
@@ -12,6 +12,8 @@ function projectPageInit(ctx) { var machineChangeFormToggle = $("#change-machine-toggle"); var machineNameTitle = $("#project-machine-name"); var machineChangeCancel = $("#cancel-machine-change"); + var machineInputForm = $("#machine-input-form"); + var invalidMachineNameHelp = $("#invalid-machine-name-help"); var freqBuildBtn = $("#freq-build-btn"); var freqBuildList = $("#freq-build-list");
@@ -208,8 +210,23 @@ function projectPageInit(ctx) { /* Change machine functionality */ + machineChangeInput.keyup(function(){ + if ($(this).val().indexOf(' ') >= 0) { + machineChangeBtn.attr("disabled", "disabled"); + invalidMachineNameHelp.show(); + machineInputForm.addClass('has-error'); + } else { + machineChangeBtn.removeAttr("disabled"); + invalidMachineNameHelp.hide(); + machineInputForm.removeClass('has-error'); + } + }); machineChangeFormToggle.click(function(){ + machineChangeInput.val(machineNameTitle.text()); + machineChangeBtn.removeAttr("disabled"); + invalidMachineNameHelp.hide(); + machineInputForm.removeClass('has-error'); machineForm.slideDown(); machineNameTitle.hide(); $(this).hide();
lib/toaster/toastergui/templates/project.html +2 -1
@@ -67,11 +67,12 @@ <form id="select-machine-form" style="display:none;" class="form-inline"> <span class="help-block">Machine suggestions come from the list of layers added to your project. If you don't see the machine you are looking for, <a href="{% url 'projectmachines' project.id %}">check the full list of machines</a></span> - <div class="form-group"> + <div class="form-group" id="machine-input-form"> <input class="form-control" id="machine-change-input" autocomplete="off" value="" data-provide="typeahead" data-minlength="1" data-autocomplete="off" type="text"> </div> <button id="machine-change-btn" class="btn btn-default" type="button">Save</button> <a href="#" id="cancel-machine-change" class="btn btn-link">Cancel</a> + <span class="help-block text-danger" id="invalid-machine-name-help" style="display:none">A valid machine name cannot include spaces.</span> <p class="form-link"><a href="{% url 'projectmachines' project.id %}">View compatible machines</a></p> </form> </div>
Signature · 1 line
1.9.1