diff options
author | Dave Cobbley <david.j.cobbley@linux.intel.com> | 2018-08-14 20:05:37 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-08-23 04:26:31 +0300 |
commit | eb8dc40360f0cfef56fb6947cc817a547d6d9bc6 (patch) | |
tree | de291a73dc37168da6370e2cf16c347d1eba9df8 /poky/bitbake/lib/toaster/toastergui/static/js/projecttopbar.js | |
parent | 9c3cf826d853102535ead04cebc2d6023eff3032 (diff) | |
download | openbmc-eb8dc40360f0cfef56fb6947cc817a547d6d9bc6.tar.xz |
[Subtree] Removing import-layers directory
As part of the move to subtrees, need to bring all the import layers
content to the top level.
Change-Id: I4a163d10898cbc6e11c27f776f60e1a470049d8f
Signed-off-by: Dave Cobbley <david.j.cobbley@linux.intel.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'poky/bitbake/lib/toaster/toastergui/static/js/projecttopbar.js')
-rw-r--r-- | poky/bitbake/lib/toaster/toastergui/static/js/projecttopbar.js | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/poky/bitbake/lib/toaster/toastergui/static/js/projecttopbar.js b/poky/bitbake/lib/toaster/toastergui/static/js/projecttopbar.js new file mode 100644 index 000000000..69220aaf5 --- /dev/null +++ b/poky/bitbake/lib/toaster/toastergui/static/js/projecttopbar.js @@ -0,0 +1,97 @@ +'use strict'; + +function projectTopBarInit(ctx) { + + var projectNameForm = $("#project-name-change-form"); + var projectNameContainer = $("#project-name-container"); + var projectName = $(".project-name"); + var projectNameFormToggle = $("#project-change-form-toggle"); + var projectNameChangeCancel = $("#project-name-change-cancel"); + + // this doesn't exist for command-line builds + var newBuildTargetInput = $("#build-input"); + + var newBuildTargetBuildBtn = $("#build-button"); + var selectedTarget; + + /* Project name change functionality */ + projectNameFormToggle.click(function(e){ + e.preventDefault(); + projectNameContainer.hide(); + projectNameForm.fadeIn(); + }); + + projectNameChangeCancel.click(function(e){ + e.preventDefault(); + projectNameForm.hide(); + projectNameContainer.fadeIn(); + $("#project-name-change-input").val(projectName.first().text()); + }); + + $("#project-name-change-btn").click(function(){ + var newProjectName = $("#project-name-change-input").val(); + + libtoaster.editCurrentProject({ projectName: newProjectName }, function (){ + projectName.text(newProjectName); + libtoaster.ctx.projectName = newProjectName; + projectNameChangeCancel.click(); + }); + }); + + /* Nav bar activate state switcher */ + $("#project-topbar .nav li a").each(function(){ + if (window.location.pathname === $(this).attr('href')) + $(this).parent().addClass('active'); + else + $(this).parent().removeClass('active'); + }); + + if (!newBuildTargetInput.length) { + return; + } + + /* the following only applies for non-command-line projects */ + + /* Recipe build input functionality */ + if (ctx.numProjectLayers > 0 && ctx.machine){ + newBuildTargetInput.removeAttr("disabled"); + } + + libtoaster.makeTypeahead(newBuildTargetInput, + libtoaster.ctx.recipesTypeAheadUrl, {}, function (item) { + selectedTarget = item; + newBuildTargetBuildBtn.removeAttr("disabled"); + }); + + newBuildTargetInput.on('input', function () { + if ($(this).val().length === 0) { + newBuildTargetBuildBtn.attr("disabled", "disabled"); + } else { + newBuildTargetBuildBtn.removeAttr("disabled"); + } + }); + + newBuildTargetBuildBtn.click(function (e) { + e.preventDefault(); + if (!newBuildTargetInput.val().trim()) { + return; + } + /* We use the value of the input field so as to maintain any command also + * added e.g. core-image-minimal:clean and because we can build targets + * that toaster doesn't yet know about + */ + selectedTarget = { name: newBuildTargetInput.val().trim() }; + + /* Fire off the build */ + libtoaster.startABuild(null, selectedTarget.name, + function(){ + window.location.replace(libtoaster.ctx.projectBuildsUrl); + }, null); + }); + + /* Call makeProjectNameValidation function */ + libtoaster.makeProjectNameValidation($("#project-name-change-input"), + $("#hint-error-project-name"), $("#validate-project-name"), + $("#project-name-change-btn")); + +} |