* [PATCH 0/1] toaster: toastergui: implement machine name validation
@ 2017-04-05 7:12 David Reyna
2017-04-05 7:12 ` [PATCH 1/1] " David Reyna
0 siblings, 1 reply; 2+ messages in thread
From: David Reyna @ 2017-04-05 7:12 UTC (permalink / raw)
To: bitbake-devel
From: David Reyna <David.Reyna@windriver.com>
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(-)
--
1.9.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 1/1] toaster: toastergui: implement machine name validation
2017-04-05 7:12 [PATCH 0/1] toaster: toastergui: implement machine name validation David Reyna
@ 2017-04-05 7:12 ` David Reyna
0 siblings, 0 replies; 2+ messages in thread
From: David Reyna @ 2017-04-05 7:12 UTC (permalink / raw)
To: bitbake-devel
From: "Belal, Awais" <Awais_Belal@mentor.com>
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]
Signed-off-by: Awais Belal <awais_belal@mentor.com>
Signed-off-by: David Reyna <David.Reyna@windriver.com>
---
lib/toaster/toastergui/static/js/projectpage.js | 17 +++++++++++++++++
lib/toaster/toastergui/templates/project.html | 3 ++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/lib/toaster/toastergui/static/js/projectpage.js b/lib/toaster/toastergui/static/js/projectpage.js
index 4536703..21adf81 100644
--- a/lib/toaster/toastergui/static/js/projectpage.js
+++ b/lib/toaster/toastergui/static/js/projectpage.js
@@ -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();
diff --git a/lib/toaster/toastergui/templates/project.html b/lib/toaster/toastergui/templates/project.html
index 5abe241..ab7e665 100644
--- a/lib/toaster/toastergui/templates/project.html
+++ b/lib/toaster/toastergui/templates/project.html
@@ -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>
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-05 7:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-05 7:12 [PATCH 0/1] toaster: toastergui: implement machine name validation David Reyna
2017-04-05 7:12 ` [PATCH 1/1] " David Reyna
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox