Sfoglia il codice sorgente

toastergui: Change build button popover to a build-button

To share the build-button mechanism from the pop over and project
topbar build button we now use a build-button class to reference them
and share the event handlers.

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Michael Wood 8 anni fa
parent
commit
e3c6a00b84

+ 9 - 6
lib/toaster/toastergui/static/js/base.js

@@ -42,7 +42,7 @@ function basePageInit(ctx) {
       $(".build-target-input").length === 1) {
 
     newBuildTargetInput = $("#new-build-button .build-target-input");
-    newBuildTargetBuildBtn = $("#new-build-button .build-button");
+    newBuildTargetBuildBtn = $("#new-build-button").find(".build-button");
 
     _setupNewBuildButton();
     newBuildButton.show();
@@ -59,8 +59,9 @@ function basePageInit(ctx) {
     $('#project .icon-pencil').hide();
   }
 
-  libtoaster.makeTypeahead(newBuildTargetInput, selectedProject.projectTargetsUrl, { format: "json" }, function (item) {
-        /* successfully selected a target */
+  /* If we have a project setup the typeahead */
+  if (selectedProject.projectTargetsUrl){
+    libtoaster.makeTypeahead(newBuildTargetInput, selectedProject.projectTargetsUrl, { format: "json" }, function (item) {
       selectedTarget = item;
       newBuildTargetBuildBtn.removeAttr("disabled");
     });
@@ -81,9 +82,11 @@ function basePageInit(ctx) {
       return;
     }
 
-    if (!selectedTarget) {
-      selectedTarget = { name: newBuildTargetInput.val() };
-    }
+    /* We use the value of the input field so as to maintain any command also
+     * added e.g. core-image-minimal:clean
+     */
+    selectedTarget = { name: newBuildTargetInput.val() };
+
     /* Fire off the build */
     libtoaster.startABuild(selectedProject.projectBuildsUrl,
       selectedProject.projectId, selectedTarget.name, function(){

+ 2 - 2
lib/toaster/toastergui/templates/base.html

@@ -143,8 +143,8 @@
                 <h6>Recipe(s):</h6>
                 <form>
                   <input type="text" class="input-xlarge build-target-input" placeholder="Type a recipe name" autocomplete="off" data-minLength="1" data-autocomplete="off" data-provide="typeahead" disabled/>
-                  <div>
-                    <button class="btn btn-primary" id="build-button" disabled>Build</button>
+                  <div class="row-fluid">
+                    <button class="btn btn-primary build-button" disabled>Build</button>
                   </div>
                 </form>
               </li>