diff options
| author | David Reyna <David.Reyna@windriver.com> | 2017-06-27 13:44:30 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-28 16:02:15 +0100 |
| commit | 4f2baebf362d71351db044c0646f9bc6e8a39c49 (patch) | |
| tree | bcbb07afbe24816f35d0c9d616ac5ea1fcca7f17 /bitbake/lib/toaster/toastergui/static | |
| parent | 43aaa802c35ecc9d972f3b9adcd060033de1d9de (diff) | |
| download | poky-4f2baebf362d71351db044c0646f9bc6e8a39c49.tar.gz | |
bitbake: toaster: Add distro selection support
Add the ability to select a distro in the project page,
based on values from the Layer Index. Add a distro selection
page with the add layer feature, based on the add machine
page.
[YOCTO #10632]
(Bitbake rev: a156a4eff67cdc3943494f5be72b96e3db656250)
Signed-off-by: David Reyna <David.Reyna@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static')
| -rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/projectpage.js | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/projectpage.js b/bitbake/lib/toaster/toastergui/static/js/projectpage.js index 21adf816c6..506471e091 100644 --- a/bitbake/lib/toaster/toastergui/static/js/projectpage.js +++ b/bitbake/lib/toaster/toastergui/static/js/projectpage.js | |||
| @@ -15,6 +15,13 @@ function projectPageInit(ctx) { | |||
| 15 | var machineInputForm = $("#machine-input-form"); | 15 | var machineInputForm = $("#machine-input-form"); |
| 16 | var invalidMachineNameHelp = $("#invalid-machine-name-help"); | 16 | var invalidMachineNameHelp = $("#invalid-machine-name-help"); |
| 17 | 17 | ||
| 18 | var distroChangeInput = $("#distro-change-input"); | ||
| 19 | var distroChangeBtn = $("#distro-change-btn"); | ||
| 20 | var distroForm = $("#select-distro-form"); | ||
| 21 | var distroChangeFormToggle = $("#change-distro-toggle"); | ||
| 22 | var distroNameTitle = $("#project-distro-name"); | ||
| 23 | var distroChangeCancel = $("#cancel-distro-change"); | ||
| 24 | |||
| 18 | var freqBuildBtn = $("#freq-build-btn"); | 25 | var freqBuildBtn = $("#freq-build-btn"); |
| 19 | var freqBuildList = $("#freq-build-list"); | 26 | var freqBuildList = $("#freq-build-list"); |
| 20 | 27 | ||
| @@ -26,6 +33,7 @@ function projectPageInit(ctx) { | |||
| 26 | 33 | ||
| 27 | var currentLayerAddSelection; | 34 | var currentLayerAddSelection; |
| 28 | var currentMachineAddSelection = ""; | 35 | var currentMachineAddSelection = ""; |
| 36 | var currentDistroAddSelection = ""; | ||
| 29 | 37 | ||
| 30 | var urlParams = libtoaster.parseUrlParams(); | 38 | var urlParams = libtoaster.parseUrlParams(); |
| 31 | 39 | ||
| @@ -45,6 +53,17 @@ function projectPageInit(ctx) { | |||
| 45 | updateMachineName(prjInfo.machine.name); | 53 | updateMachineName(prjInfo.machine.name); |
| 46 | } | 54 | } |
| 47 | 55 | ||
| 56 | /* If we're receiving a distro set from the url and it's different from | ||
| 57 | * our current distro then activate set machine sequence. | ||
| 58 | */ | ||
| 59 | if (urlParams.hasOwnProperty('setDistro') && | ||
| 60 | urlParams.setDistro !== prjInfo.distro.name){ | ||
| 61 | distroChangeInput.val(urlParams.setDistro); | ||
| 62 | distroChangeBtn.click(); | ||
| 63 | } else { | ||
| 64 | updateDistroName(prjInfo.distro.name); | ||
| 65 | } | ||
| 66 | |||
| 48 | /* Now we're really ready show the page */ | 67 | /* Now we're really ready show the page */ |
| 49 | $("#project-page").show(); | 68 | $("#project-page").show(); |
| 50 | 69 | ||
| @@ -278,6 +297,60 @@ function projectPageInit(ctx) { | |||
| 278 | }); | 297 | }); |
| 279 | 298 | ||
| 280 | 299 | ||
| 300 | /* Change distro functionality */ | ||
| 301 | |||
| 302 | distroChangeFormToggle.click(function(){ | ||
| 303 | distroForm.slideDown(); | ||
| 304 | distroNameTitle.hide(); | ||
| 305 | $(this).hide(); | ||
| 306 | }); | ||
| 307 | |||
| 308 | distroChangeCancel.click(function(){ | ||
| 309 | distroForm.slideUp(function(){ | ||
| 310 | distroNameTitle.show(); | ||
| 311 | distroChangeFormToggle.show(); | ||
| 312 | }); | ||
| 313 | }); | ||
| 314 | |||
| 315 | function updateDistroName(distroName){ | ||
| 316 | distroChangeInput.val(distroName); | ||
| 317 | distroNameTitle.text(distroName); | ||
| 318 | } | ||
| 319 | |||
| 320 | libtoaster.makeTypeahead(distroChangeInput, | ||
| 321 | libtoaster.ctx.distrosTypeAheadUrl, | ||
| 322 | { }, function(item){ | ||
| 323 | currentDistroAddSelection = item.name; | ||
| 324 | distroChangeBtn.removeAttr("disabled"); | ||
| 325 | }); | ||
| 326 | |||
| 327 | distroChangeBtn.click(function(e){ | ||
| 328 | e.preventDefault(); | ||
| 329 | /* We accept any value regardless of typeahead selection or not */ | ||
| 330 | if (distroChangeInput.val().length === 0) | ||
| 331 | return; | ||
| 332 | |||
| 333 | currentDistroAddSelection = distroChangeInput.val(); | ||
| 334 | |||
| 335 | libtoaster.editCurrentProject( | ||
| 336 | { distroName : currentDistroAddSelection }, | ||
| 337 | function(){ | ||
| 338 | /* Success machine changed */ | ||
| 339 | updateDistroName(currentDistroAddSelection); | ||
| 340 | distroChangeCancel.click(); | ||
| 341 | |||
| 342 | /* Show the alert message */ | ||
| 343 | var message = $('<span>You have changed the distro to: <strong><span id="notify-machine-name"></span></strong></span>'); | ||
| 344 | message.find("#notify-machine-name").text(currentDistroAddSelection); | ||
| 345 | libtoaster.showChangeNotification(message); | ||
| 346 | }, | ||
| 347 | function(){ | ||
| 348 | /* Failed machine changed */ | ||
| 349 | console.warn("Failed to change distro"); | ||
| 350 | }); | ||
| 351 | }); | ||
| 352 | |||
| 353 | |||
| 281 | /* Change release functionality */ | 354 | /* Change release functionality */ |
| 282 | function updateProjectRelease(release){ | 355 | function updateProjectRelease(release){ |
| 283 | releaseTitle.text(release.description); | 356 | releaseTitle.text(release.description); |
