diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js/projectpage.js')
-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); |