diff options
author | Belal, Awais <Awais_Belal@mentor.com> | 2017-04-05 00:12:48 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-04-10 23:00:32 +0100 |
commit | f45a5a5de8ee8e7b014a780aa45b37774a4b06a1 (patch) | |
tree | 10f8e1950194953d1663547cba539ecdc05ff0b5 /bitbake | |
parent | eb7430e5b9cb51ad593379ddf9aa1dca38d6d34f (diff) | |
download | poky-f45a5a5de8ee8e7b014a780aa45b37774a4b06a1.tar.gz |
bitbake: toaster: toastergui: implement machine name validation
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]
(Bitbake rev: 6fb642935a3787659aa316ca906025d2d87964cf)
Signed-off-by: Awais Belal <awais_belal@mentor.com>
Signed-off-by: David Reyna <David.Reyna@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/projectpage.js | 17 | ||||
-rw-r--r-- | bitbake/lib/toaster/toastergui/templates/project.html | 3 |
2 files changed, 19 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/projectpage.js b/bitbake/lib/toaster/toastergui/static/js/projectpage.js index 4536703649..21adf816c6 100644 --- a/bitbake/lib/toaster/toastergui/static/js/projectpage.js +++ b/bitbake/lib/toaster/toastergui/static/js/projectpage.js | |||
@@ -12,6 +12,8 @@ function projectPageInit(ctx) { | |||
12 | var machineChangeFormToggle = $("#change-machine-toggle"); | 12 | var machineChangeFormToggle = $("#change-machine-toggle"); |
13 | var machineNameTitle = $("#project-machine-name"); | 13 | var machineNameTitle = $("#project-machine-name"); |
14 | var machineChangeCancel = $("#cancel-machine-change"); | 14 | var machineChangeCancel = $("#cancel-machine-change"); |
15 | var machineInputForm = $("#machine-input-form"); | ||
16 | var invalidMachineNameHelp = $("#invalid-machine-name-help"); | ||
15 | 17 | ||
16 | var freqBuildBtn = $("#freq-build-btn"); | 18 | var freqBuildBtn = $("#freq-build-btn"); |
17 | var freqBuildList = $("#freq-build-list"); | 19 | var freqBuildList = $("#freq-build-list"); |
@@ -208,8 +210,23 @@ function projectPageInit(ctx) { | |||
208 | 210 | ||
209 | 211 | ||
210 | /* Change machine functionality */ | 212 | /* Change machine functionality */ |
213 | machineChangeInput.keyup(function(){ | ||
214 | if ($(this).val().indexOf(' ') >= 0) { | ||
215 | machineChangeBtn.attr("disabled", "disabled"); | ||
216 | invalidMachineNameHelp.show(); | ||
217 | machineInputForm.addClass('has-error'); | ||
218 | } else { | ||
219 | machineChangeBtn.removeAttr("disabled"); | ||
220 | invalidMachineNameHelp.hide(); | ||
221 | machineInputForm.removeClass('has-error'); | ||
222 | } | ||
223 | }); | ||
211 | 224 | ||
212 | machineChangeFormToggle.click(function(){ | 225 | machineChangeFormToggle.click(function(){ |
226 | machineChangeInput.val(machineNameTitle.text()); | ||
227 | machineChangeBtn.removeAttr("disabled"); | ||
228 | invalidMachineNameHelp.hide(); | ||
229 | machineInputForm.removeClass('has-error'); | ||
213 | machineForm.slideDown(); | 230 | machineForm.slideDown(); |
214 | machineNameTitle.hide(); | 231 | machineNameTitle.hide(); |
215 | $(this).hide(); | 232 | $(this).hide(); |
diff --git a/bitbake/lib/toaster/toastergui/templates/project.html b/bitbake/lib/toaster/toastergui/templates/project.html index 5abe241305..ab7e665b64 100644 --- a/bitbake/lib/toaster/toastergui/templates/project.html +++ b/bitbake/lib/toaster/toastergui/templates/project.html | |||
@@ -67,11 +67,12 @@ | |||
67 | 67 | ||
68 | <form id="select-machine-form" style="display:none;" class="form-inline"> | 68 | <form id="select-machine-form" style="display:none;" class="form-inline"> |
69 | <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> | 69 | <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> |
70 | <div class="form-group"> | 70 | <div class="form-group" id="machine-input-form"> |
71 | <input class="form-control" id="machine-change-input" autocomplete="off" value="" data-provide="typeahead" data-minlength="1" data-autocomplete="off" type="text"> | 71 | <input class="form-control" id="machine-change-input" autocomplete="off" value="" data-provide="typeahead" data-minlength="1" data-autocomplete="off" type="text"> |
72 | </div> | 72 | </div> |
73 | <button id="machine-change-btn" class="btn btn-default" type="button">Save</button> | 73 | <button id="machine-change-btn" class="btn btn-default" type="button">Save</button> |
74 | <a href="#" id="cancel-machine-change" class="btn btn-link">Cancel</a> | 74 | <a href="#" id="cancel-machine-change" class="btn btn-link">Cancel</a> |
75 | <span class="help-block text-danger" id="invalid-machine-name-help" style="display:none">A valid machine name cannot include spaces.</span> | ||
75 | <p class="form-link"><a href="{% url 'projectmachines' project.id %}">View compatible machines</a></p> | 76 | <p class="form-link"><a href="{% url 'projectmachines' project.id %}">View compatible machines</a></p> |
76 | </form> | 77 | </form> |
77 | </div> | 78 | </div> |