summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/static
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/projectpage.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/projectpage.js b/bitbake/lib/toaster/toastergui/static/js/projectpage.js
index b0fe4510a9..e742ef291a 100644
--- a/bitbake/lib/toaster/toastergui/static/js/projectpage.js
+++ b/bitbake/lib/toaster/toastergui/static/js/projectpage.js
@@ -23,7 +23,7 @@ function projectPageInit(ctx) {
23 var cancelReleaseChange = $("#cancel-release-change"); 23 var cancelReleaseChange = $("#cancel-release-change");
24 24
25 var currentLayerAddSelection; 25 var currentLayerAddSelection;
26 var currentMachineAddSelection = {}; 26 var currentMachineAddSelection = "";
27 27
28 var urlParams = libtoaster.parseUrlParams(); 28 var urlParams = libtoaster.parseUrlParams();
29 29
@@ -38,7 +38,7 @@ function projectPageInit(ctx) {
38 */ 38 */
39 if (urlParams.hasOwnProperty('setMachine') && 39 if (urlParams.hasOwnProperty('setMachine') &&
40 urlParams.setMachine !== prjInfo.machine.name){ 40 urlParams.setMachine !== prjInfo.machine.name){
41 currentMachineAddSelection.name = urlParams.setMachine; 41 machineChangeInput.val(urlParams.setMachine);
42 machineChangeBtn.click(); 42 machineChangeBtn.click();
43 } else { 43 } else {
44 updateMachineName(prjInfo.machine.name); 44 updateMachineName(prjInfo.machine.name);
@@ -254,29 +254,33 @@ function projectPageInit(ctx) {
254 } 254 }
255 255
256 libtoaster.makeTypeahead(machineChangeInput, libtoaster.ctx.machinesTypeAheadUrl, { }, function(item){ 256 libtoaster.makeTypeahead(machineChangeInput, libtoaster.ctx.machinesTypeAheadUrl, { }, function(item){
257 currentMachineAddSelection = item; 257 currentMachineAddSelection = item.name;
258 machineChangeBtn.removeAttr("disabled"); 258 machineChangeBtn.removeAttr("disabled");
259 }); 259 });
260 260
261 machineChangeBtn.click(function(e){ 261 machineChangeBtn.click(function(e){
262 e.preventDefault(); 262 e.preventDefault();
263 if (currentMachineAddSelection.name === undefined) 263 /* We accept any value regardless of typeahead selection or not */
264 if (machineChangeInput.val().length === 0)
264 return; 265 return;
265 266
266 libtoaster.editCurrentProject({ machineName : currentMachineAddSelection.name }, 267 currentMachineAddSelection = machineChangeInput.val();
268
269 libtoaster.editCurrentProject(
270 { machineName : currentMachineAddSelection },
267 function(){ 271 function(){
268 /* Success machine changed */ 272 /* Success machine changed */
269 updateMachineName(currentMachineAddSelection.name); 273 updateMachineName(currentMachineAddSelection);
270 machineChangeCancel.click(); 274 machineChangeCancel.click();
271 275
272 /* Show the alert message */ 276 /* Show the alert message */
273 var message = $('<span class="lead">You have changed the machine to: <strong><span id="notify-machine-name"></span></strong></span>'); 277 var message = $('<span class="lead">You have changed the machine to: <strong><span id="notify-machine-name"></span></strong></span>');
274 message.find("#notify-machine-name").text(currentMachineAddSelection.name); 278 message.find("#notify-machine-name").text(currentMachineAddSelection);
275 libtoaster.showChangeNotification(message); 279 libtoaster.showChangeNotification(message);
276 }, 280 },
277 function(){ 281 function(){
278 /* Failed machine changed */ 282 /* Failed machine changed */
279 console.log("failed to change machine"); 283 console.warn("Failed to change machine");
280 }); 284 });
281 }); 285 });
282 286