Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id AF012E00D92; Tue, 24 May 2016 04:56:22 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id DEE95E00D1F for ; Tue, 24 May 2016 04:53:29 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP; 24 May 2016 04:53:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,359,1459839600"; d="scan'208";a="961194575" Received: from icarus.isw.intel.com ([10.237.224.37]) by orsmga001.jf.intel.com with ESMTP; 24 May 2016 04:53:29 -0700 From: Belen Barros Pena To: toaster@yoctoproject.org Date: Tue, 24 May 2016 12:39:48 +0100 Message-Id: <1464090003-23469-92-git-send-email-belen.barros.pena@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1464090003-23469-1-git-send-email-belen.barros.pena@linux.intel.com> References: <1464090003-23469-1-git-send-email-belen.barros.pena@linux.intel.com> Subject: [PATCH 091/106] toaster: layerdetails Fix the layer details page X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 11:56:22 -0000 Make sure that all information displays correctly, and all controls interact as designed, with Bootstrap 3. Signed-off-by: Belen Barros Pena --- .../lib/toaster/toastergui/static/css/default.css | 45 ++++- .../toaster/toastergui/static/js/layerdetails.js | 65 ++++--- bitbake/lib/toaster/toastergui/tables.py | 12 +- .../toaster/toastergui/templates/layerdetails.html | 204 +++++++++++---------- .../toastergui/templates/toastertable-simple.html | 104 ++++++----- 5 files changed, 243 insertions(+), 187 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/static/css/default.css b/bitbake/lib/toaster/toastergui/static/css/default.css index ddea5ee..43c7c54 100644 --- a/bitbake/lib/toaster/toastergui/static/css/default.css +++ b/bitbake/lib/toaster/toastergui/static/css/default.css @@ -22,8 +22,13 @@ img.logo { height: 30px; vertical-align: bottom; } /* Increase popovers width to fit commit SHAs */ .popover { max-width: 350px; } -/* Increase bottom margin of definition lists inside popovers for the Toaster version information in the top navbar */ -.popover-content dd { margin-bottom: 15px; } +/* Increase bottom margin of definition lists inside popovers for the Toaster version information in the top navbar, and also inside the right hand columns of our details pages */ +.popover-content dd, +.well dd { margin-bottom: 15px; } + +/* Style the horizonal definition lists */ +.dl-horizontal dt { width: 200px; line-height: 25px; } +.dl-horizontal dd { margin-left: 220px; line-height: 25px; } /* Style our build results */ .build-result .progress { margin-bottom: 0; } @@ -52,6 +57,8 @@ span[class^="remove-search-btn-"] { position: absolute; right: 5px; top: 0; bott span[class^="remove-search-btn-"]:hover { color: #333; } [id^="pagination-"] .pagination, [id^="pagination-"] .navbar-form { margin-top: 0; } +[id^="table-chrome-"] .navbar-form { margin-left: -15px; margin-right: -15px; } +[id^="table-chrome-"] .detail-page-contols { padding-left: 0; padding-right: 0; } /* Override the default font-weight for labels: it's a bit too much */ label { font-weight: normal; } @@ -111,6 +118,7 @@ h3 > .glyphicon-question-sign { font-size: 14px; } /* Style the most built recipes list in the project page */ #freq-build-list .checkbox input[type="checkbox"] { position: relative; margin: 0 10px 0 0; vertical-align: middle; } +#freq-build-list.lead > li { line-height: 25px; } #freq-build-list { margin-top: 20px; } #freq-build-list label { padding-left: 0; } #freq-build-btn { margin-top: 10px; } @@ -119,16 +127,22 @@ h3 > .glyphicon-question-sign { font-size: 14px; } /* Style the layers section in the project page and the layer dependencies in the import layer form */ #layer-container .form-inline { margin-top: 20px; } #layer-add-input { width: 17em; } -#layers-in-project-list, -#layer-deps-list { margin-top: 20px; } -#layers-in-project-list > li, -#layer-deps-list > li { line-height: 38px; } -#layers-in-project-list .glyphicon-trash, -#layer-deps-list .glyphicon-trash { font-size: 16px; margin-left: 7px; } +ul.lead { margin-top: 20px; } +ul.lead > li { line-height: 38px; } +ul.lead .glyphicon-trash, +ul.lead .glyphicon-trash { font-size: 16px; margin-left: 7px; } #layers-in-project-list .tooltip-inner { max-width: 600px; } #no-layers-in-project { margin-top: 20px; } #no-layers-in-project ul { margin-top: 10px; } +/* Style the layer information icons in the layer details pages */ +dd .glyphicon-trash, +dd .glyphicon-edit { margin-left: 5px; } + +/* Style the forms and definition lists in the layer details pages */ +#change-repo-form .form-control { width: 17em; } +#information dd > form { margin-bottom: 5px; margin-top: 5px; } + /* Create a class for additional top margin that we can use in headings */ .top-air { margin-top: 40px; } @@ -161,8 +175,10 @@ td > .tooltip-inner { padding: 10px; } #newcustomimagestable .get_description_or_summary, #imagerecipestable .get_description_or_summary, #softwarerecipestable .get_description_or_summary, -#machinestable .description, #layerstable .layer__summary { width: 30%; } +#recipestable .get_description_or_summary { width: 40%; } +#machinestable .name { white-space: nowrap; } +#machinestable .description { width: 45%; } /* Override the rather ugly default code styles */ code { color: #333; background-color: transparent; } @@ -171,3 +187,14 @@ code { color: #333; background-color: transparent; } .breadcrumb > li + li::before { content: none; } .breadcrumb { background-color: transparent; padding-left: 0; padding-top: 15px; } .breadcrumb .divider { color: #777; margin: 0 5px; } + +/* Reduce top margin for the page-header class */ +.page-header { margin-top: 30px; } + +/* Set some space around the layer button in the layer details pages */ +.tab-content { margin-top: 20px; } +.tab-pane { margin-top: 20px; } + +/* Style the new window icons */ +.glyphicon-new-window:hover { text-decoration: none; } +.dl-horizontal > dd > .glyphicon-new-window { margin-left: 5px; } diff --git a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js index d545406..dbc6ba6 100644 --- a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js +++ b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js @@ -18,6 +18,13 @@ function layerDetailsPageInit (ctx) { layerDepBtn.removeAttr("disabled"); }); + /* disable the add layer button if its input field is empty */ + layerDepInput.on("keyup",function(){ + if ( $(this).val().length == 0 ) { + layerDepBtn.attr("disabled", "disabled"); + } + }); + $(window).on('hashchange', function(e){ switch(window.location.hash){ case '#machines': @@ -76,7 +83,7 @@ function layerDetailsPageInit (ctx) { addRemoveDep(currentLayerDepSelection.id, true, function(){ /* Make a list item for the new layer dependency */ - var newLayerDep = $("
  • "); + var newLayerDep = $("
  • "); newLayerDep.data('layer-id', currentLayerDepSelection.id); newLayerDep.children("span").tooltip(); @@ -94,11 +101,11 @@ function layerDetailsPageInit (ctx) { /* Clear the current selection */ layerDepInput.val(""); currentLayerDepSelection = undefined; - layerDepBtn.attr("disabled","disabled"); + layerDepBtn.attr("disabled", "disabled"); }); }); - $(".icon-pencil").click(function (){ + $(".glyphicon-edit").click(function (){ var mParent = $(this).parent("dd"); mParent.prev().css("margin-top", "10px"); mParent.children("form").slideDown(); @@ -106,8 +113,12 @@ function layerDetailsPageInit (ctx) { currentVal.hide(); /* Set the current value to the input field */ mParent.find("textarea,input").val(currentVal.text()); + /* If the input field is empty, disable the submit button */ + if ( mParent.find("textarea,input").val().length == 0 ) { + mParent.find(".change-btn").attr("disabled", "disabled"); + } /* Hides the "Not set" text */ - mParent.children(".muted").hide(); + mParent.children(".text-muted").hide(); /* We're editing so hide the delete icon */ mParent.children(".delete-current-value").hide(); mParent.find(".cancel").show(); @@ -128,21 +139,21 @@ function layerDetailsPageInit (ctx) { mParent.children(".current-value").show(); /* Show the "Not set" text if we ended up with no value */ if (!mParent.children(".current-value").html()){ - mParent.children(".muted").fadeIn(); + mParent.children(".text-muted").fadeIn(); mParent.children(".delete-current-value").hide(); } else { mParent.children(".delete-current-value").show(); } - mParent.children(".icon-pencil").show(); - mParent.prev().css("margin-top", "0px"); + mParent.children(".glyphicon-edit").show(); + mParent.prev().css("margin-top", "0"); }); }); function defaultAddBtnText(){ var text = " Add the "+ctx.layerVersion.name+" layer to your project"; addRmLayerBtn.text(text); - addRmLayerBtn.prepend(""); + addRmLayerBtn.prepend(""); addRmLayerBtn.removeClass("btn-danger"); } @@ -159,7 +170,7 @@ function layerDetailsPageInit (ctx) { var text = " Add the "+ctx.layerVersion.name+" layer to your project "+ "to enable these recipes"; addRmLayerBtn.text(text); - addRmLayerBtn.prepend(""); + addRmLayerBtn.prepend(""); } else { defaultAddBtnText(); } @@ -177,7 +188,7 @@ function layerDetailsPageInit (ctx) { $("#no-recipes-yet").hide(); } - targetTab.removeClass("muted"); + targetTab.removeClass("text-muted"); if (window.location.hash === "#recipes"){ /* re run the machinesTabShow to update the text */ targetsTabShow(); @@ -192,20 +203,20 @@ function layerDetailsPageInit (ctx) { else $("#no-machines-yet").hide(); - machineTab.removeClass("muted"); + machineTab.removeClass("text-muted"); if (window.location.hash === "#machines"){ /* re run the machinesTabShow to update the text */ machinesTabShow(); } $(".select-machine-btn").click(function(e){ - if ($(this).attr("disabled") === "disabled") + if ($(this).hasClass("disabled")) e.preventDefault(); }); }); - targetTab.on('show', targetsTabShow); + targetTab.on('show.bs.tab', targetsTabShow); function machinesTabShow(){ if (!ctx.layerVersion.inCurrentPrj) { @@ -213,7 +224,7 @@ function layerDetailsPageInit (ctx) { var text = " Add the "+ctx.layerVersion.name+" layer to your project " + "to enable these machines"; addRmLayerBtn.text(text); - addRmLayerBtn.prepend(""); + addRmLayerBtn.prepend(""); } else { defaultAddBtnText(); } @@ -222,7 +233,7 @@ function layerDetailsPageInit (ctx) { window.location.hash = "machines"; } - machineTab.on('show', machinesTabShow); + machineTab.on('show.bs.tab', machinesTabShow); $(".pagesize").change(function(){ var search = libtoaster.parseUrlParams(); @@ -239,17 +250,17 @@ function layerDetailsPageInit (ctx) { if (added){ /* enable and switch all the button states */ - $(".build-recipe-btn").removeAttr("disabled"); - $(".select-machine-btn").removeAttr("disabled"); + $(".build-recipe-btn").removeClass("disabled"); + $(".select-machine-btn").removeClass("disabled"); addRmLayerBtn.addClass("btn-danger"); addRmLayerBtn.data('directive', "remove"); addRmLayerBtn.text(" Remove the "+ctx.layerVersion.name+" layer from your project"); - addRmLayerBtn.prepend(""); + addRmLayerBtn.prepend(""); } else { /* disable and switch all the button states */ - $(".build-recipe-btn").attr("disabled","disabled"); - $(".select-machine-btn").attr("disabled", "disabled"); + $(".build-recipe-btn").addClass("disabled"); + $(".select-machine-btn").addClass("disabled"); addRmLayerBtn.removeClass("btn-danger"); addRmLayerBtn.data('directive', "add"); @@ -257,7 +268,7 @@ function layerDetailsPageInit (ctx) { * on which tab is currently visible. Unfortunately we can't just call * tab('show') as if it's already visible it doesn't run the event. */ - switch ($(".nav-pills .active a").prop('id')){ + switch ($(".nav-tabs .active a").prop('id')){ case 'machines-tab': machinesTabShow(); break; @@ -325,7 +336,7 @@ function layerDetailsPageInit (ctx) { text = entryElement.val(); /* Hide the "Not set" text if it's visible */ - inputArea.find(".muted").hide(); + inputArea.find(".text-muted").hide(); inputArea.find(".current-value").text(text); /* Same behaviour as cancel in that we hide the form/show current * value. @@ -343,9 +354,9 @@ function layerDetailsPageInit (ctx) { /* Disable the change button when we have no data in the input */ $("dl input, dl textarea").on("input",function() { if ($(this).val().length === 0) - $(this).parent().children(".change-btn").attr("disabled", "disabled"); + $(this).parent().next(".change-btn").attr("disabled", "disabled"); else - $(this).parent().children(".change-btn").removeAttr("disabled"); + $(this).parent().next(".change-btn").removeAttr("disabled"); }); /* This checks to see if the dt's dd has data in it or if the change data @@ -359,7 +370,7 @@ function layerDetailsPageInit (ctx) { /* There's no current value and the layer is editable * so show the "Not set" and hide the delete icon */ - dd.find(".muted").show(); + dd.find(".text-muted").show(); dd.find(".delete-current-value").hide(); } else { /* We're not viewing an editable layer so hide the empty dd/dl pair */ @@ -387,9 +398,9 @@ function layerDetailsPageInit (ctx) { }); - layerDepsList.find(".icon-trash").click(layerDepRemoveClick); + layerDepsList.find(".glyphicon-trash").click(layerDepRemoveClick); layerDepsList.find("a").tooltip(); - $(".icon-trash").tooltip(); + $(".glyphicon-trash").tooltip(); $(".commit").tooltip(); } diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py index dead0d7..efc9c7b 100644 --- a/bitbake/lib/toaster/toastergui/tables.py +++ b/bitbake/lib/toaster/toastergui/tables.py @@ -307,7 +307,11 @@ class LayerMachinesTable(MachinesTable): self.add_column(title="Description", field_name="description") - select_btn_template = 'Select machine' + select_btn_template = ''' + Select machine + ''' self.add_column(title="Select machine", static_data_name="add-del-layers", @@ -455,7 +459,11 @@ class LayerRecipesTable(RecipesTable): self.add_column(title="Description", field_name="get_description_or_summary") - build_recipe_template ='' + build_recipe_template = ''' + Build recipe + ''' self.add_column(title="Build recipe", static_data_name="add-del-layers", diff --git a/bitbake/lib/toaster/toastergui/templates/layerdetails.html b/bitbake/lib/toaster/toastergui/templates/layerdetails.html index dc6018b..781f281 100644 --- a/bitbake/lib/toaster/toastergui/templates/layerdetails.html +++ b/bitbake/lib/toaster/toastergui/templates/layerdetails.html @@ -7,30 +7,30 @@ {% block pagecontent %}
    - -
    +
    + {# If this is not an imported layer then hide the edit ui #} {% if not layerversion.layer_source_id or layerversion.layer_source.sourcetype != layerversion.layer_source.TYPE_IMPORTED %}