From b06a633f25aec303e867c6109fb97d63d9ee1f73 Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Fri, 31 Jul 2015 15:09:03 +0300 Subject: bitbake: toastergui: Implement new project navigation Change the structure of the project page to include a navigation menu and top tab navigation. Remove old breadcrumb method. [YOCTO #7329] (Bitbake rev: 66fa0dd988e01ec79e74be7a5697eaa3b4f017d8) Signed-off-by: Michael Wood Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- .../lib/toaster/toastergui/static/css/default.css | 1 - bitbake/lib/toaster/toastergui/static/js/base.js | 54 ++++++++++++------ .../toaster/toastergui/static/js/layerdetails.js | 13 +++++ bitbake/lib/toaster/toastergui/templates/base.html | 5 +- .../templates/baseprojectbuildspage.html | 15 +++++ .../toastergui/templates/baseprojectpage.html | 64 ++++++++++------------ .../toastergui/templates/basetable_top.html | 1 - .../templates/basetable_top_buildprojects.html | 14 ----- .../toastergui/templates/buildrequestdetails.html | 3 - .../lib/toaster/toastergui/templates/builds.html | 2 +- .../templates/generic-toastertable-page.html | 19 +++---- .../toaster/toastergui/templates/importlayer.html | 11 +--- .../toaster/toastergui/templates/layerdetails.html | 27 ++++++--- .../lib/toaster/toastergui/templates/project.html | 38 +++---------- .../toastergui/templates/projectbuilds.html | 5 +- .../toaster/toastergui/templates/projectconf.html | 8 +-- .../toastergui/templates/projecttopbar.html | 38 +++++++++++++ bitbake/lib/toaster/toastergui/urls.py | 6 +- bitbake/lib/toaster/toastergui/views.py | 1 + 19 files changed, 180 insertions(+), 145 deletions(-) create mode 100644 bitbake/lib/toaster/toastergui/templates/baseprojectbuildspage.html delete mode 100644 bitbake/lib/toaster/toastergui/templates/basetable_top_buildprojects.html create mode 100644 bitbake/lib/toaster/toastergui/templates/projecttopbar.html (limited to 'bitbake/lib/toaster/toastergui') diff --git a/bitbake/lib/toaster/toastergui/static/css/default.css b/bitbake/lib/toaster/toastergui/static/css/default.css index da78f47f85..072a71d834 100644 --- a/bitbake/lib/toaster/toastergui/static/css/default.css +++ b/bitbake/lib/toaster/toastergui/static/css/default.css @@ -179,7 +179,6 @@ table { table-layout: fixed; word-wrap: break-word; } .well-alert > .lead { color: #C09853; padding-bottom: .75em; } .configuration-alert { margin-bottom: 0px; padding: 8px 14px; } .configuration-alert p { margin-bottom: 0px; } -fieldset { padding-left: 19px; } .project-form { margin-top: 10px; } .add-layers .btn-block + .btn-block, .build .btn-block + .btn-block { margin-top: 0px; } input.huge { font-size: 17.5px; padding: 11px 19px; } diff --git a/bitbake/lib/toaster/toastergui/static/js/base.js b/bitbake/lib/toaster/toastergui/static/js/base.js index f1711c134f..6fd77ea457 100644 --- a/bitbake/lib/toaster/toastergui/static/js/base.js +++ b/bitbake/lib/toaster/toastergui/static/js/base.js @@ -3,33 +3,57 @@ function basePageInit(ctx) { var newBuildButton = $("#new-build-button"); - /* Hide the button if we're on the project,newproject or importlyaer page + var newBuildTargetInput; + var newBuildTargetBuildBtn; + + var selectedProject = libtoaster.ctx; + var selectedTarget; + + var newBuildProjectInput = $("#new-build-button #project-name-input"); + var newBuildProjectSaveBtn = $("#new-build-button #save-project-button"); + + $("#config-nav .nav li a").each(function(){ + if (window.location.pathname === $(this).attr('href')) + $(this).parent().addClass('active'); + else + $(this).parent().removeClass('active'); + }); + + if ($(".total-builds").length !== 0){ + libtoaster.getProjectInfo(libtoaster.ctx.projectPageUrl, function(prjInfo){ + if (prjInfo.builds) + $(".total-builds").text(prjInfo.builds.length); + }); + } + + /* Hide the button if we're on the project,newproject or importlyaer page * or if there are no projects yet defined + * only show if there isn't already a build-target-input already */ - if (ctx.numProjects === 0 || ctx.currentUrl.search('newproject|project/\\d$|importlayer$') > 0) { - newBuildButton.hide(); + if (ctx.numProjects > 0 && + ctx.currentUrl.search('newproject') < 0 && + $(".build-target-input").length === 1) { + + newBuildTargetInput = $("#new-build-button .build-target-input"); + newBuildTargetBuildBtn = $("#new-build-button .build-button"); + + newBuildButton.show(); + _setupNewBuildButton(); + } else if ($(".build-target-input").length > 0) { + newBuildTargetInput = $("#project-topbar .build-target-input"); + newBuildTargetBuildBtn = $("#project-topbar .build-button"); + } else { return; } - var selectedProject = libtoaster.ctx; - var selectedTarget; /* Hide the change project icon when there is only one project */ if (ctx.numProjects === 1) { $('#project .icon-pencil').hide(); } - newBuildButton.show().removeAttr("disabled"); - - - var newBuildProjectInput = $("#new-build-button #project-name-input"); - var newBuildTargetBuildBtn = $("#new-build-button #build-button"); - var newBuildTargetInput = $("#new-build-button #build-target-input"); - var newBuildProjectSaveBtn = $("#new-build-button #save-project-button"); - _checkProjectBuildable(); - _setupNewBuildButton(); function _checkProjectBuildable() { @@ -57,8 +81,6 @@ function basePageInit(ctx) { selectedProject.projectName = item.name; selectedProject.projectId = item.id; selectedProject.projectBuildsUrl = item.projectBuildsUrl; - - }); } diff --git a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js index 0accd971d4..e522373b3f 100644 --- a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js +++ b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js @@ -15,6 +15,19 @@ function layerDetailsPageInit (ctx) { layerDepBtn.removeAttr("disabled"); }); + $(".breadcrumb li:first a").click(function(e){ + /* By default this link goes to the project configuration page. However + * if we have some builds we go there instead of the default href + */ + libtoaster.getProjectInfo(libtoaster.ctx.projectPageUrl, function(prjInfo){ + if (prjInfo.builds && prjInfo.builds.length > 0) { + window.location.replace(libtoaster.ctx.projectBuildsUrl); + e.preventDefault(); + return; + } + }); + }); + function addRemoveDep(depLayerId, add, doneCb) { var data = { layer_version_id : ctx.layerVersion.id }; if (add) diff --git a/bitbake/lib/toaster/toastergui/templates/base.html b/bitbake/lib/toaster/toastergui/templates/base.html index b34e6c37d3..6c3e1a3823 100644 --- a/bitbake/lib/toaster/toastergui/templates/base.html +++ b/bitbake/lib/toaster/toastergui/templates/base.html @@ -80,7 +80,6 @@ {% endif %}