Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id E0601E00DFB; Thu, 18 Aug 2016 11:49:29 -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=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.220.50 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 9C440E00DF3 for ; Thu, 18 Aug 2016 11:49:28 -0700 (PDT) Received: by mail-pa0-f50.google.com with SMTP id pp5so8508016pac.3 for ; Thu, 18 Aug 2016 11:49:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MrXefey4DVKcTErbY2Xxkuv+wyMzpjB2riSDknkStaE=; b=wTKLZjPTi4ZwkfQYlYPXnY8q3mKA2g5N69vOVgjK6NIRbXJ/tuU+Z7VeTEM2COfkIh PwRtH9P7qLdKYz2iOG6sSGc2KNw0QBIQdQZORjuxprYgf99vOQeEcojwbGRlWKy5fdVt yipFHVIvsnLtgsCcZaRWc/OrTWZpa4Znyr+W9DyPnfaGLrZA5Rnq/Ktq+F2wK3lQLNPt /mjsm500DB8zZL3nA9wUXep3cmUfC873g+oLbd7fW2e+ueVkIryTWifrORXQdS1H9kI+ sHpwB8yxYPSLKjZK3a3MWn4FxBZOM93szYiow4WW25/EFkbKGOI4vmnlycLdgDjxS2Vr ruSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MrXefey4DVKcTErbY2Xxkuv+wyMzpjB2riSDknkStaE=; b=ja57rsrAoPe+jfNcYd20P7cejCpmZoyf5dUhOPt95LbZqEdD7KIrXw1pM8Mm7UmF0O QINtYPeW7jqJtHQl5KvG/oG4CpvOzb/FiKEfe96C4EIC0FlqXWT83K7xB9cBwsarb9O8 2SN7B3DaY5ODZfYKDcph6GDAmJRR6sFHH1RtpyC3qha1lOY5dJ4FD+XcCFgItSV1AniV U84IbQYtJlAUhFHM9u5EdYdFg+5B/cq/02KQhLIVfJcF2IE8WCnOrLT+Vu6OSydBANdP cON4Cj/zt3neX5AWw9sUyIMXIn8j/6FUwxLbhuUdU9mKV4ciSR3lgGZUlpBXbXlAFZqF K65Q== X-Gm-Message-State: AEkooutC2aJV/Y01hlHwCV3w6V0VOnsjkgTjNXqRkvIaHfkYbAfFSramS5NOTL6wunzTSPZL X-Received: by 10.66.72.106 with SMTP id c10mr6648496pav.18.1471546167968; Thu, 18 Aug 2016 11:49:27 -0700 (PDT) Received: from orion.ger.corp.intel.com (fmdmzpr02-ext.fm.intel.com. [192.55.55.37]) by smtp.gmail.com with ESMTPSA id w64sm496095pfb.93.2016.08.18.11.49.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Aug 2016 11:49:27 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Thu, 18 Aug 2016 19:49:09 +0100 Message-Id: <1471546154-20891-5-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471546154-20891-1-git-send-email-michael.g.wood@intel.com> References: <1471546154-20891-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH v2 4/9] toaster: layerdetails clean ups after integrating local layer changes 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: Thu, 18 Aug 2016 18:49:29 -0000 A few clean ups for the work done to integrate editing imported local layers into the layer detail page. Signed-off-by: Michael Wood --- bitbake/lib/toaster/toastergui/api.py | 6 +- .../lib/toaster/toastergui/static/css/default.css | 2 + .../toaster/toastergui/static/js/layerdetails.js | 86 ++++++++++------------ .../toaster/toastergui/templates/layerdetails.html | 59 +++++++-------- 4 files changed, 72 insertions(+), 81 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/api.py b/bitbake/lib/toaster/toastergui/api.py index 8dde128..09fb02b 100644 --- a/bitbake/lib/toaster/toastergui/api.py +++ b/bitbake/lib/toaster/toastergui/api.py @@ -135,7 +135,8 @@ class XhrLayer(View): Method: POST Args: - vcs_url, dirpath, commit, up_branch, summary, description, local_source_dir + vcs_url, dirpath, commit, up_branch, summary, description, + local_source_dir add_dep = append a layerversion_id as a dependency rm_dep = remove a layerversion_id as a depedency @@ -167,7 +168,8 @@ class XhrLayer(View): if "description" in request.POST: layer_version.layer.description = request.POST["description"] if "local_source_dir" in request.POST: - layer_version.layer.local_source_dir = request.POST["local_source_dir"] + layer_version.layer.local_source_dir = \ + request.POST["local_source_dir"] if "add_dep" in request.POST: lvd = LayerVersionDependency( diff --git a/bitbake/lib/toaster/toastergui/static/css/default.css b/bitbake/lib/toaster/toastergui/static/css/default.css index f71b37e..a56bb8c 100644 --- a/bitbake/lib/toaster/toastergui/static/css/default.css +++ b/bitbake/lib/toaster/toastergui/static/css/default.css @@ -316,6 +316,8 @@ h2.panel-title { font-size: 30px; } /* Make the help in tables insivisble until you hover over the right cell */ .hover-help { visibility: hidden; } +#add-remove-layer-btn { margin-bottom: 20px; } + /* Blue hightlight animation for tasks and directory structure tables */ .highlight { -webkit-animation: target-fade 15s 1; -moz-animation: target-fade 15s 1; animation: target-fade 15s 1; } @-webkit-keyframes target-fade { 0% { background-color: #D9EDF7; } 25% { background-color: #D9EDF7; } 100% { background-color: white; } } diff --git a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js index 2ff8e59..5fd7274 100644 --- a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js +++ b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js @@ -11,11 +11,19 @@ function layerDetailsPageInit (ctx) { var machineTab = $("#machines-tab"); var detailsTab = $("#details-tab"); var editLayerSource = $("#edit-layer-source"); + var saveSourceChangesBtn = $("#save-changes-for-switch"); + var layerGitRefInput = $("#layer-git-ref"); + var layerSubDirInput = $('#layer-subdir'); + + targetTab.on('show.bs.tab', targetsTabShow); + detailsTab.on('show.bs.tab', detailsTabShow); + machineTab.on('show.bs.tab', machinesTabShow); /* setup the dependencies typeahead */ - libtoaster.makeTypeahead(layerDepInput, libtoaster.ctx.layersTypeAheadUrl, { include_added: "true" }, function(item){ + libtoaster.makeTypeahead(layerDepInput, + libtoaster.ctx.layersTypeAheadUrl, + { include_added: "true" }, function(item){ currentLayerDepSelection = item; - layerDepBtn.removeAttr("disabled"); }); @@ -26,20 +34,6 @@ function layerDetailsPageInit (ctx) { } }); - $(window).on('hashchange', function(e){ - switch(window.location.hash){ - case '#machines': - machineTab.tab('show'); - break; - case '#recipes': - targetTab.tab('show'); - break; - default: - detailsTab.tab('show'); - break; - } - }); - function addRemoveDep(depLayerId, add, doneCb) { var data = { layer_version_id : ctx.layerVersion.id }; if (add) @@ -151,6 +145,7 @@ function layerDetailsPageInit (ctx) { }); }); + function defaultAddBtnText(){ var text = " Add the "+ctx.layerVersion.name+" layer to your project"; addRmLayerBtn.text(text); @@ -158,12 +153,12 @@ function layerDetailsPageInit (ctx) { addRmLayerBtn.removeClass("btn-danger"); } - detailsTab.on('show', function(){ + function detailsTabShow(){ if (!ctx.layerVersion.inCurrentPrj) defaultAddBtnText(); - window.location.hash = "details"; - }); + window.location.hash = "information"; + } function targetsTabShow(){ if (!ctx.layerVersion.inCurrentPrj){ @@ -217,7 +212,6 @@ function layerDetailsPageInit (ctx) { }); - targetTab.on('show.bs.tab', targetsTabShow); function machinesTabShow(){ if (!ctx.layerVersion.inCurrentPrj) { @@ -234,8 +228,6 @@ function layerDetailsPageInit (ctx) { window.location.hash = "machines"; } - machineTab.on('show.bs.tab', machinesTabShow); - $(".pagesize").change(function(){ var search = libtoaster.parseUrlParams(); search.limit = this.value; @@ -425,9 +417,11 @@ function layerDetailsPageInit (ctx) { $(".commit").tooltip(); editLayerSource.click(function() { - // Kindly bring the git layers imported from layerindex to normal page and not this new page :( + /* Kindly bring the git layers imported from layerindex to normal page + * and not this new page :( + */ $(this).hide(); - $("#save-changes-for-switch").attr("disabled", "disabled"); + saveSourceChangesBtn.attr("disabled", "disabled"); $("#git-repo-info", "#directory-info").hide(); $("#edit-layer-source-form").fadeIn(); @@ -446,9 +440,9 @@ function layerDetailsPageInit (ctx) { if ($('input[name=source-location]:checked').val() == "repo") { $("#layer-git").fadeIn(); $("#layer-dir").hide(); - if ($("#layer-git-repo-url").val().length === 0 && $("#layer-git-ref").val().length === 0) { - $("#save-changes-for-switch").attr("disabled", "disabled"); - } + if ($("#layer-git-repo-url").val().length === 0 && layerGitRefInput.val().length === 0) { + saveSourceChangesBtn.attr("disabled", "disabled"); + } } else { $("#layer-dir").fadeIn(); $("#layer-git").hide(); @@ -456,42 +450,40 @@ function layerDetailsPageInit (ctx) { }); $("#layer-dir-path-in-details").keyup(function() { - $("#save-changes-for-switch").removeAttr("disabled"); + saveSourceChangesBtn.removeAttr("disabled"); }); $("#layer-git-repo-url").keyup(function() { - if ($("#layer-git-repo-url").val().length > 0 && $("#layer-git-ref").val().length > 0) { - $("#save-changes-for-switch").removeAttr("disabled"); + if ($("#layer-git-repo-url").val().length > 0 && layerGitRefInput.val().length > 0) { + saveSourceChangesBtn.removeAttr("disabled"); } }); - $("#layer-git-ref").keyup(function() { - if ($("#layer-git-repo-url").val().length > 0 && $("#layer-git-ref").val().length > 0) { - $("#save-changes-for-switch").removeAttr("disabled"); + layerGitRefInput.keyup(function() { + if ($("#layer-git-repo-url").val().length > 0 && layerGitRefInput.val().length > 0) { + saveSourceChangesBtn.removeAttr("disabled"); } }); - $('#cancel-changes-for-switch').click(function() { - editLayerSource.show(); - $("#git-repo-info", "#directory-info").fadeIn(); - $("#edit-layer-source-form").fadeOut(); - if ($("#layer-dir-path-in-details").val().length) { - $("#dir").prop("checked", true); - $("#layer-git").fadeOut(); - $("#layer-dir").fadeIn(); - } else { - $("#layer-git").fadeIn(); - $("#layer-dir").fadeOut(); + layerSubDirInput.keyup(function(){ + if ($(this).val().length > 0){ + saveSourceChangesBtn.removeAttr("disabled"); } }); - $('#save-changes-for-switch').click(function() { + $('#cancel-changes-for-switch').click(function() { + $("#edit-layer-source-form").add("#layer-git").add("#layer-dir").fadeOut().promise().done(function(){ + editLayerSource.show(); + }); + }); + + saveSourceChangesBtn.click(function() { var layerData = { vcs_url: $('#layer-git-repo-url').val(), - commit: $('#layer-git-ref').val(), - dirpath: $('#layer-subdir').val(), + commit: layerGitRefInput.val(), + dirpath: layerSubDirInput.val(), local_source_dir: $('#layer-dir-path-in-details').val(), }; diff --git a/bitbake/lib/toaster/toastergui/templates/layerdetails.html b/bitbake/lib/toaster/toastergui/templates/layerdetails.html index 3e13756..08e41ce 100644 --- a/bitbake/lib/toaster/toastergui/templates/layerdetails.html +++ b/bitbake/lib/toaster/toastergui/templates/layerdetails.html @@ -103,7 +103,6 @@ - {% if layerversion.id not in projectlayers %} {% endif %} -