diff options
author | David Reyna <David.Reyna@windriver.com> | 2015-02-12 03:40:53 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-02-17 14:38:31 +0000 |
commit | 9819728e1210fcf661b557e86f775d1766037856 (patch) | |
tree | 98c17739325776ad929102feb3f7c11f871ecb78 /bitbake | |
parent | eba4e0f74a13f13b2107959fc93b79d0b1e1cd1f (diff) | |
download | poky-9819728e1210fcf661b557e86f775d1766037856.tar.gz |
bitbake: toaster: Additional fixes for the project variable page
Fix IMAGE_FSTYPES, IMAGE_INSTALL_append, and DISTRO editing management, plus other usability details.
[YOCTO #7231]
(Bitbake rev: 58f19f1c3128c303fb8e5338c01f575418dc0b15)
Signed-off-by: David Reyna <David.Reyna@windriver.com>
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/toaster/toastergui/templates/projectconf.html | 250 | ||||
-rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 42 |
2 files changed, 210 insertions, 82 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/projectconf.html b/bitbake/lib/toaster/toastergui/templates/projectconf.html index 0d38a9228b..ec1fb9bd20 100644 --- a/bitbake/lib/toaster/toastergui/templates/projectconf.html +++ b/bitbake/lib/toaster/toastergui/templates/projectconf.html | |||
@@ -23,9 +23,12 @@ | |||
23 | <i class="icon-pencil" id="change-distro-icon"></i> | 23 | <i class="icon-pencil" id="change-distro-icon"></i> |
24 | <form id="change-distro-form" style="display:none;"> | 24 | <form id="change-distro-form" style="display:none;"> |
25 | <div class="input-append"> | 25 | <div class="input-append"> |
26 | <span id="edit-distro-name-div" class="control-group"> | ||
26 | <input type="text" id="new-distro" value="{{distro}}"> | 27 | <input type="text" id="new-distro" value="{{distro}}"> |
27 | <button id="apply-change-distro" class="btn" type="button">Save</button> | 28 | <button id="apply-change-distro" class="btn" type="button">Save</button> |
28 | <button id="cancel-change-distro" type="button" class="btn btn-link">Cancel</button> | 29 | <button id="cancel-change-distro" type="button" class="btn btn-link">Cancel</button> |
30 | <span class="help-block error" id="distro-error-message"></span> | ||
31 | </span> | ||
29 | </div> | 32 | </div> |
30 | </form> | 33 | </form> |
31 | </dd> | 34 | </dd> |
@@ -48,10 +51,10 @@ | |||
48 | <span class="js-config-var-name js-config-var-managed-name">IMAGE_INSTALL_append</span> | 51 | <span class="js-config-var-name js-config-var-managed-name">IMAGE_INSTALL_append</span> |
49 | <i class="icon-question-sign get-help" title="Specifies additional packages to install into an image. If your build creates more than one image, the packages will be installed in <strong>all of them</strong> <br /><a href='http://www.yoctoproject.org/docs/1.6.1/ref-manual/ref-manual.html#var-IMAGE_INSTALL' target='_blank'>Read more in the manual</a>"></i> | 52 | <i class="icon-question-sign get-help" title="Specifies additional packages to install into an image. If your build creates more than one image, the packages will be installed in <strong>all of them</strong> <br /><a href='http://www.yoctoproject.org/docs/1.6.1/ref-manual/ref-manual.html#var-IMAGE_INSTALL' target='_blank'>Read more in the manual</a>"></i> |
50 | </dt> | 53 | </dt> |
51 | <dd class="lead muted"> | 54 | <dd class="lead"> |
52 | <span id="image_install">{% if image_install_append %}{{image_install_append}}{%else%}Not set{%endif%}</span> | 55 | <span id="image_install">{% if image_install_append %}{{image_install_append}}{%else%}Not set{%endif%}</span> |
53 | <i class="icon-pencil" id="change-image_install-icon"></i> | 56 | <i class="icon-pencil" id="change-image_install-icon"></i> |
54 | <i class="icon-trash" id="delete-image_install-icon" style="display:none;"></i> | 57 | <i class="icon-trash" id="delete-image_install-icon" {% if image_install_append %}{%else%}style="display:none;"{%endif%}></i> |
55 | <form id="change-image_install-form" style="display:none;"> | 58 | <form id="change-image_install-form" style="display:none;"> |
56 | <div class="row-fluid"> | 59 | <div class="row-fluid"> |
57 | <span class="help-block span4">To set IMAGE_INSTALL_append to more than one package, type the package names separated by a space.</span> | 60 | <span class="help-block span4">To set IMAGE_INSTALL_append to more than one package, type the package names separated by a space.</span> |
@@ -185,13 +188,13 @@ | |||
185 | <script> | 188 | <script> |
186 | 189 | ||
187 | // validate new variable name | 190 | // validate new variable name |
188 | function validate_new_variable_name() { | 191 | function validate_new_variable() { |
189 | var variable = $("input#variable")[0].value; | 192 | var variable = $("input#variable").val(); |
190 | var value = $("input#value")[0].value; | 193 | var value = $("input#value").val(); |
191 | 194 | ||
192 | // presumed innocence | 195 | // presumed innocence |
193 | $('#new-variable-error-message').html(""); | 196 | $('#new-variable-error-message').text(""); |
194 | var error_msg = "" | 197 | var error_msg = ""; |
195 | 198 | ||
196 | var existing_configvars = document.getElementsByClassName('js-config-var-name'); | 199 | var existing_configvars = document.getElementsByClassName('js-config-var-name'); |
197 | for (var i = 0, length = existing_configvars.length; i < length; i++) { | 200 | for (var i = 0, length = existing_configvars.length; i < length; i++) { |
@@ -202,7 +205,7 @@ | |||
202 | 205 | ||
203 | var blacklist_configvars = document.getElementsByClassName('js-config-blacklist-name'); | 206 | var blacklist_configvars = document.getElementsByClassName('js-config-blacklist-name'); |
204 | for (var i = 0, length = blacklist_configvars.length; i < length; i++) { | 207 | for (var i = 0, length = blacklist_configvars.length; i < length; i++) { |
205 | if (blacklist_configvars[i].value == variable) { | 208 | if (blacklist_configvars[i].value == variable.toUpperCase()) { |
206 | error_msg = "You cannot edit this variable in Toaster because it is set by the build servers"; | 209 | error_msg = "You cannot edit this variable in Toaster because it is set by the build servers"; |
207 | } | 210 | } |
208 | } | 211 | } |
@@ -220,7 +223,7 @@ | |||
220 | } | 223 | } |
221 | 224 | ||
222 | if ("" != error_msg) { | 225 | if ("" != error_msg) { |
223 | $('#new-variable-error-message').html(error_msg); | 226 | $('#new-variable-error-message').text(error_msg); |
224 | $(".save").attr("disabled","disabled"); | 227 | $(".save").attr("disabled","disabled"); |
225 | 228 | ||
226 | var d = document.getElementById("add-configvar-name-div"); | 229 | var d = document.getElementById("add-configvar-name-div"); |
@@ -228,14 +231,68 @@ | |||
228 | 231 | ||
229 | return false; | 232 | return false; |
230 | } | 233 | } |
231 | |||
232 | var d = document.getElementById("add-configvar-name-div"); | 234 | var d = document.getElementById("add-configvar-name-div"); |
233 | d.className = d.className.replace(" control-group error",""); | 235 | d.className = d.className.replace(" control-group error",""); |
236 | |||
237 | // now set the "Save" enablement if 'value' also passes | ||
238 | if (value.trim().length > 0) { | ||
239 | $(".save").removeAttr("disabled"); | ||
240 | } else { | ||
241 | $(".save").attr("disabled","disabled"); | ||
242 | } | ||
243 | |||
234 | return true; | 244 | return true; |
235 | } | 245 | } |
236 | 246 | ||
247 | // validate distro name | ||
248 | function validate_distro_name() { | ||
249 | var value = $("input#new-distro").val(); | ||
250 | |||
251 | // presumed innocence | ||
252 | $('#distro-error-message').text(""); | ||
253 | var error_msg = ""; | ||
254 | |||
255 | var has_spaces = (0 <= value.indexOf(" ")); | ||
256 | |||
257 | if (has_spaces) { | ||
258 | error_msg = "A valid distro name cannot include spaces"; | ||
259 | } else if (0 == value.length) { | ||
260 | error_msg = "A valid distro name cannot be empty"; | ||
261 | } | ||
262 | |||
263 | if ("" != error_msg) { | ||
264 | $('#distro-error-message').text(error_msg); | ||
265 | $("#apply-change-distro").attr("disabled","disabled"); | ||
266 | |||
267 | var d = document.getElementById("edit-distro-name-div"); | ||
268 | d.className = d.className + " control-group error"; | ||
269 | |||
270 | return false; | ||
271 | } | ||
272 | |||
273 | var d = document.getElementById("edit-distro-name-div"); | ||
274 | d.className = d.className.replace(" control-group error",""); | ||
275 | $("#apply-change-distro").removeAttr("disabled"); | ||
276 | return true; | ||
277 | } | ||
278 | |||
279 | // Test to insure at least one FS Type is checked | ||
280 | function enableFsTypesSave() { | ||
281 | var any_checked = 0; | ||
282 | $(".fs-checkbox-fstypes:checked").each(function(){ | ||
283 | any_checked = 1; | ||
284 | }); | ||
285 | if ( 0 == any_checked ) { | ||
286 | $("#apply-change-image_fstypes").attr("disabled","disabled"); | ||
287 | } | ||
288 | else { | ||
289 | $("#apply-change-image_fstypes").removeAttr("disabled"); | ||
290 | } | ||
291 | } | ||
292 | |||
237 | // Preset or reset the Package Class checkbox labels | 293 | // Preset or reset the Package Class checkbox labels |
238 | function updatePackageClassCheckboxes() { | 294 | function updatePackageClassCheckboxes() { |
295 | $('#package_class_1, #package_class_2').hide(); | ||
239 | if ($('select').val() == 'package_dev') { | 296 | if ($('select').val() == 'package_dev') { |
240 | $('#package_class_1').html('<input type="checkbox" id="package_class_1_input"> package_ipk'); | 297 | $('#package_class_1').html('<input type="checkbox" id="package_class_1_input"> package_ipk'); |
241 | $('#package_class_2').html('<input type="checkbox" id="package_class_2_input"> package_rpm'); | 298 | $('#package_class_2').html('<input type="checkbox" id="package_class_2_input"> package_rpm'); |
@@ -248,6 +305,7 @@ | |||
248 | $('#package_class_1').html('<input type="checkbox" id="package_class_1_input"> package_dev'); | 305 | $('#package_class_1').html('<input type="checkbox" id="package_class_1_input"> package_dev'); |
249 | $('#package_class_2').html('<input type="checkbox" id="package_class_2_input"> package_ipk'); | 306 | $('#package_class_2').html('<input type="checkbox" id="package_class_2_input"> package_ipk'); |
250 | } | 307 | } |
308 | $('#package_class_1, #package_class_2').fadeIn(1500); | ||
251 | } | 309 | } |
252 | 310 | ||
253 | // Re-assert handlers when the page is served and/or refreshed via Ajax | 311 | // Re-assert handlers when the page is served and/or refreshed via Ajax |
@@ -256,16 +314,16 @@ | |||
256 | // change variable value | 314 | // change variable value |
257 | $('.js-icon-pencil-config_var').click(function (evt) { | 315 | $('.js-icon-pencil-config_var').click(function (evt) { |
258 | var pk = evt.target.attributes["x-data"].value; | 316 | var pk = evt.target.attributes["x-data"].value; |
259 | var current_val = $("span#config_var_"+pk).html(); | 317 | var current_val = $("span#config_var_value_"+pk).text(); |
260 | $('.js-icon-pencil-config_var, .js-icon-trash-config_var, #config_var_'+pk).hide(); | 318 | $('.js-icon-pencil-config_var, .js-icon-trash-config_var, #config_var_value_'+pk).hide(); |
261 | $("#change-config_var-form_"+pk).slideDown(); | 319 | $("#change-config_var-form_"+pk).slideDown(); |
262 | $("input#new-config_var_"+pk)[0].value = current_val; | 320 | $("input#new-config_var_"+pk).val(current_val); |
263 | }); | 321 | }); |
264 | 322 | ||
265 | $('.js-cancel-change-config_var').click(function (evt) { | 323 | $('.js-cancel-change-config_var').click(function (evt) { |
266 | var pk = evt.target.attributes["x-data"].value; | 324 | var pk = evt.target.attributes["x-data"].value; |
267 | $("#change-config_var-form_"+pk).slideUp(function() { | 325 | $("#change-config_var-form_"+pk).slideUp(function() { |
268 | $('.js-icon-pencil-config_var, .js-icon-trash-config_var, #config_var_'+pk).show(); | 326 | $('.js-icon-pencil-config_var, .js-icon-trash-config_var, #config_var_value_'+pk).show(); |
269 | }); | 327 | }); |
270 | }); | 328 | }); |
271 | 329 | ||
@@ -284,20 +342,25 @@ | |||
284 | var variable = xdata[1]; | 342 | var variable = xdata[1]; |
285 | var val = $('#new-config_var_'+pk).val(); | 343 | var val = $('#new-config_var_'+pk).val(); |
286 | postEditAjaxRequest({"configvarChange" : variable+':'+val}); | 344 | postEditAjaxRequest({"configvarChange" : variable+':'+val}); |
287 | $('#config_var_'+pk).parent().removeClass('muted'); | 345 | $('#config_var_value_'+pk).parent().removeClass('muted'); |
288 | $("#change-config_var-form_"+pk).slideUp(function() { | 346 | $("#change-config_var-form_"+pk).slideUp(function() { |
289 | $('.js-icon-pencil-config_var, .js-icon-trash-config_var, #config_var_'+pk).show(); | 347 | $('.js-icon-pencil-config_var, .js-icon-trash-config_var, #config_var_value_'+pk).show(); |
290 | }); | 348 | }); |
291 | }); | 349 | }); |
292 | 350 | ||
293 | // delete variable | 351 | // delete variable |
294 | $(".js-icon-trash-config_var").click(function (evt) { | 352 | $(".js-icon-trash-config_var").click(function (evt) { |
295 | var xdata = evt.target.attributes["x-data"].value.split(":"); | 353 | var xdata = evt.target.attributes["x-data"].value.split(":"); |
296 | var pk = xdata[0]; | 354 | var pk = xdata[0]; |
297 | $('#config_var_entry_'+pk).slideUp(function() { | 355 | |
298 | //$('#config_var_entry_'+pk).show(); | 356 | // hide the dangling trash tooltip |
299 | }); | 357 | $('#config_var_trash_'+pk).hide(); |
300 | postEditAjaxRequest({"configvarDel": evt.target.attributes["x-data"].value}); | 358 | |
359 | // fade out the variable+value div, then refresh the variable list | ||
360 | $('#config_var_entry_'+pk).parent().parent().fadeOut(1000, function(){ | ||
361 | postEditAjaxRequest({"configvarDel": evt.target.attributes["x-data"].value}); | ||
362 | }); | ||
363 | |||
301 | }); | 364 | }); |
302 | 365 | ||
303 | } | 366 | } |
@@ -320,9 +383,9 @@ | |||
320 | } | 383 | } |
321 | } | 384 | } |
322 | if (var_context == undefined) { | 385 | if (var_context == undefined) { |
323 | orightml += '<dt id="config_var_entry_'+configvars_sorted[i][2]+'"><span class="js-config-var-name">'+configvars_sorted[i][0]+'</span><i class="icon-trash js-icon-trash-config_var" x-data="'+configvars_sorted[i][2]+'"></i> </dt>' | 386 | orightml += '<div> <dt><span id="config_var_entry_'+configvars_sorted[i][2]+'" class="js-config-var-name"></span><i class="icon-trash js-icon-trash-config_var" id="config_var_trash_'+configvars_sorted[i][2]+'" x-data="'+configvars_sorted[i][2]+'"></i> </dt>' |
324 | orightml += '<dd class="lead">' | 387 | orightml += '<dd class="lead">' |
325 | orightml += ' <span id="config_var_'+configvars_sorted[i][2]+'">'+configvars_sorted[i][1]+'</span>' | 388 | orightml += ' <span id="config_var_value_'+configvars_sorted[i][2]+'"></span>' |
326 | orightml += ' <i class="icon-pencil js-icon-pencil-config_var" x-data="'+configvars_sorted[i][2]+'"></i>' | 389 | orightml += ' <i class="icon-pencil js-icon-pencil-config_var" x-data="'+configvars_sorted[i][2]+'"></i>' |
327 | orightml += ' <form id="change-config_var-form_'+configvars_sorted[i][2]+'" style="display:none;">' | 390 | orightml += ' <form id="change-config_var-form_'+configvars_sorted[i][2]+'" style="display:none;">' |
328 | orightml += ' <div class="input-append">' | 391 | orightml += ' <div class="input-append">' |
@@ -331,13 +394,23 @@ | |||
331 | orightml += ' <button type="button" class="btn btn-link js-cancel-change-config_var" x-data="'+configvars_sorted[i][2]+'">Cancel</button>' | 394 | orightml += ' <button type="button" class="btn btn-link js-cancel-change-config_var" x-data="'+configvars_sorted[i][2]+'">Cancel</button>' |
332 | orightml += ' </div>' | 395 | orightml += ' </div>' |
333 | orightml += ' </form>' | 396 | orightml += ' </form>' |
334 | orightml += '</dd>' | 397 | orightml += '</dd> </div>' |
335 | } | 398 | } |
336 | } | 399 | } |
337 | 400 | ||
338 | // update configvars list | 401 | // update configvars list HTML framework |
339 | $("dl#configvar-list").html(orightml); | 402 | $("dl#configvar-list").html(orightml); |
340 | 403 | ||
404 | // insert the name/value pairs safely as non-HTML | ||
405 | for (i = 0; i < configvars_sorted.length; i++) { | ||
406 | $('#config_var_entry_'+configvars_sorted[i][2]).text(configvars_sorted[i][0]); | ||
407 | $('#config_var_value_'+configvars_sorted[i][2]).text(configvars_sorted[i][1]); | ||
408 | } | ||
409 | |||
410 | // Add the tooltips | ||
411 | $(".js-icon-trash-config_var").each( function(){ setDeleteTooltip($(this)); }); | ||
412 | $(".js-icon-pencil-config_var").each(function(){ setChangeTooltip($(this)); }); | ||
413 | |||
341 | // re-assert these event handlers | 414 | // re-assert these event handlers |
342 | setEventHandlersForDynamicElements(); | 415 | setEventHandlersForDynamicElements(); |
343 | } | 416 | } |
@@ -364,13 +437,19 @@ | |||
364 | headers: { 'X-CSRFToken': $.cookie("csrftoken")}, | 437 | headers: { 'X-CSRFToken': $.cookie("csrftoken")}, |
365 | success: onEditAjaxSuccess, | 438 | success: onEditAjaxSuccess, |
366 | error: onEditAjaxError, | 439 | error: onEditAjaxError, |
367 | }) | 440 | }) |
368 | } | 441 | } |
369 | 442 | ||
443 | function setDeleteTooltip(object) { | ||
444 | object.tooltip({ container: 'body', html: true, delay: {show: 400}, title: "Delete" }); | ||
445 | } | ||
446 | function setChangeTooltip(object) { | ||
447 | object.tooltip({ container: 'body', html: true, delay: {show: 400}, title: "Change" }); | ||
448 | } | ||
370 | 449 | ||
371 | $(document).ready(function() { | 450 | $(document).ready(function() { |
372 | 451 | ||
373 | // | 452 | // |
374 | // Register handlers for static elements | 453 | // Register handlers for static elements |
375 | // | 454 | // |
376 | 455 | ||
@@ -378,33 +457,37 @@ | |||
378 | $('#change-distro-icon').click(function() { | 457 | $('#change-distro-icon').click(function() { |
379 | $('#change-distro-icon, #distro').hide(); | 458 | $('#change-distro-icon, #distro').hide(); |
380 | $("#change-distro-form").slideDown(); | 459 | $("#change-distro-form").slideDown(); |
460 | $("#new-distro").val( $('#distro').text() ); | ||
381 | }); | 461 | }); |
382 | 462 | ||
383 | $('#cancel-change-distro').click(function(){ | 463 | $('#cancel-change-distro').click(function(){ |
384 | $("#change-distro-form").slideUp(function() { | 464 | $("#change-distro-form").slideUp(function() { |
385 | $('#distro, #change-distro-icon').show(); | 465 | $('#distro, #change-distro-icon').show(); |
466 | |||
467 | // reset any dangling error state | ||
468 | $('#distro-error-message').text(""); | ||
469 | var d = document.getElementById("edit-distro-name-div"); | ||
470 | d.className = d.className.replace(" control-group error",""); | ||
386 | }); | 471 | }); |
387 | }); | 472 | }); |
388 | 473 | ||
389 | $("#new-distro").on('input', function(){ | 474 | // validate new distro name |
390 | if ($(this).val().length == 0) { | 475 | $("input#new-distro").on('input', function (evt) { |
391 | $("#apply-change-distro").attr("disabled","disabled"); | 476 | validate_distro_name(); |
392 | } | ||
393 | else { | ||
394 | $("#apply-change-distro").removeAttr("disabled"); | ||
395 | } | ||
396 | }); | 477 | }); |
397 | 478 | ||
398 | $('#apply-change-distro').click(function(){ | 479 | $('#apply-change-distro').click(function(){ |
399 | //$('#repo').parent().removeClass('highlight-go'); | 480 | //$('#repo').parent().removeClass('highlight-go'); |
400 | var name = $('#new-distro').val(); | 481 | var name = $('#new-distro').val(); |
401 | postEditAjaxRequest({"configvarChange" : 'DISTRO:'+name}); | 482 | postEditAjaxRequest({"configvarChange" : 'DISTRO:'+name}); |
402 | $('#distro').html(name); | 483 | $('#distro').text(name); |
403 | $("#change-distro-form").slideUp(function () { | 484 | $("#change-distro-form").slideUp(function () { |
404 | $('#distro, #change-distro-icon').show(); | 485 | $('#distro, #change-distro-icon').show(); |
405 | }); | 486 | }); |
406 | }); | 487 | }); |
407 | 488 | ||
489 | // init IMAGE_FSTYPES trash icon | ||
490 | setDeleteTooltip($('#delete-image_install-icon')); | ||
408 | 491 | ||
409 | // change IMAGE_FSTYPES variable | 492 | // change IMAGE_FSTYPES variable |
410 | $('#change-image_fstypes-icon').click(function() { | 493 | $('#change-image_fstypes-icon').click(function() { |
@@ -429,26 +512,57 @@ | |||
429 | } | 512 | } |
430 | } | 513 | } |
431 | document.getElementById("all-image_fstypes").innerHTML = html; | 514 | document.getElementById("all-image_fstypes").innerHTML = html; |
515 | |||
516 | // Watch elements to disable Save when none are checked | ||
517 | $(".fs-checkbox-fstypes").each(function(){ | ||
518 | $(this).click(function() { | ||
519 | enableFsTypesSave(); | ||
520 | }); | ||
521 | }); | ||
522 | |||
523 | // clear the previous filter values | ||
524 | $("input#filter-image_fstypes").val(""); | ||
432 | }); | 525 | }); |
433 | 526 | ||
527 | |||
434 | $('#cancel-change-image_fstypes').click(function(){ | 528 | $('#cancel-change-image_fstypes').click(function(){ |
435 | $("#change-image_fstypes-form").slideUp(function() { | 529 | $("#change-image_fstypes-form").slideUp(function() { |
436 | $('#image_fstypes, #change-image_fstypes-icon').show(); | 530 | $('#image_fstypes, #change-image_fstypes-icon').show(); |
437 | }); | 531 | }); |
438 | }); | 532 | }); |
439 | 533 | ||
534 | $('#filter-image_fstypes').on('input', function(){ | ||
535 | var valThis = $(this).val().toLowerCase(); | ||
536 | $('#all-image_fstypes label').each(function(){ | ||
537 | var text = $(this).text().toLowerCase(); | ||
538 | var match = text.indexOf(valThis); | ||
539 | if (match >= 0) { | ||
540 | $(this).show(); | ||
541 | } | ||
542 | else { | ||
543 | $(this).hide(); | ||
544 | } | ||
545 | }); | ||
546 | }); | ||
547 | |||
440 | $('#apply-change-image_fstypes').click(function(){ | 548 | $('#apply-change-image_fstypes').click(function(){ |
441 | var fstypes = ''; | 549 | // extract the selected fstypes and sort them |
550 | var fstypes_array = []; | ||
442 | var checkboxes = document.getElementsByClassName('fs-checkbox-fstypes'); | 551 | var checkboxes = document.getElementsByClassName('fs-checkbox-fstypes'); |
443 | for (var i = 0, length = checkboxes.length; i < length; i++) { | 552 | $(".fs-checkbox-fstypes:checked").each(function(){ |
444 | if (checkboxes[i].checked) { | 553 | fstypes_array.push($(this).val()); |
445 | fstypes += checkboxes[i].value + ' '; | 554 | }); |
446 | } | 555 | fstypes_array.sort(); |
556 | |||
557 | // now make a string of them | ||
558 | var fstypes = ''; | ||
559 | for (var i = 0, length = fstypes_array.length; i < length; i++) { | ||
560 | fstypes += fstypes_array[i] + ' '; | ||
447 | } | 561 | } |
448 | fstypes = fstypes.trim(); | 562 | fstypes = fstypes.trim(); |
449 | 563 | ||
450 | postEditAjaxRequest({"configvarChange" : 'IMAGE_FSTYPES:'+fstypes}); | 564 | postEditAjaxRequest({"configvarChange" : 'IMAGE_FSTYPES:'+fstypes}); |
451 | $('#image_fstypes').html(fstypes); | 565 | $('#image_fstypes').text(fstypes); |
452 | $('#image_fstypes').parent().removeClass('muted'); | 566 | $('#image_fstypes').parent().removeClass('muted'); |
453 | 567 | ||
454 | $("#change-image_fstypes-form").slideUp(function() { | 568 | $("#change-image_fstypes-form").slideUp(function() { |
@@ -459,6 +573,14 @@ | |||
459 | 573 | ||
460 | // change IMAGE_INSTALL_append variable | 574 | // change IMAGE_INSTALL_append variable |
461 | $('#change-image_install-icon').click(function() { | 575 | $('#change-image_install-icon').click(function() { |
576 | // preset the edit value | ||
577 | var current_val = $("span#image_install").text(); | ||
578 | if (current_val == "Not set") { | ||
579 | current_val=""; | ||
580 | $("#apply-change-image_install").attr("disabled","disabled"); | ||
581 | } | ||
582 | $("input#new-image_install").val(current_val); | ||
583 | |||
462 | $('#change-image_install-icon, #delete-image_install-icon, #image_install').hide(); | 584 | $('#change-image_install-icon, #delete-image_install-icon, #image_install').hide(); |
463 | $("#change-image_install-form").slideDown(); | 585 | $("#change-image_install-form").slideDown(); |
464 | }); | 586 | }); |
@@ -466,6 +588,10 @@ | |||
466 | $('#cancel-change-image_install').click(function(){ | 588 | $('#cancel-change-image_install').click(function(){ |
467 | $("#change-image_install-form").slideUp(function() { | 589 | $("#change-image_install-form").slideUp(function() { |
468 | $('#image_install, #change-image_install-icon').show(); | 590 | $('#image_install, #change-image_install-icon').show(); |
591 | if ($("span#image_install").text() != "Not set") { | ||
592 | $('#delete-image_install-icon').show(); | ||
593 | setDeleteTooltip($('#delete-image_install-icon')); | ||
594 | } | ||
469 | }); | 595 | }); |
470 | }); | 596 | }); |
471 | 597 | ||
@@ -481,12 +607,13 @@ | |||
481 | $('#apply-change-image_install').click(function(){ | 607 | $('#apply-change-image_install').click(function(){ |
482 | var name = $('#new-image_install').val(); | 608 | var name = $('#new-image_install').val(); |
483 | postEditAjaxRequest({"configvarChange" : 'IMAGE_INSTALL_append:'+name}); | 609 | postEditAjaxRequest({"configvarChange" : 'IMAGE_INSTALL_append:'+name}); |
484 | $('#image_install').html(name); | 610 | $('#image_install').text(name); |
485 | $('#image_install').parent().removeClass('muted'); | 611 | $('#image_install').parent().removeClass('muted'); |
486 | $("#change-image_install-form").slideUp(function () { | 612 | $("#change-image_install-form").slideUp(function () { |
487 | $('#image_install, #change-image_install-icon').show(); | 613 | $('#image_install, #change-image_install-icon').show(); |
488 | if (name.length > -1) { | 614 | if (name.length > -1) { |
489 | $('#delete-image_install-icon').show(); | 615 | $('#delete-image_install-icon').show(); |
616 | setDeleteTooltip($('#delete-image_install-icon')); | ||
490 | } | 617 | } |
491 | }); | 618 | }); |
492 | }); | 619 | }); |
@@ -497,7 +624,7 @@ | |||
497 | postEditAjaxRequest({"configvarChange" : 'IMAGE_INSTALL_append:'+''}); | 624 | postEditAjaxRequest({"configvarChange" : 'IMAGE_INSTALL_append:'+''}); |
498 | $('#image_install').parent().fadeOut(1000, function(){ | 625 | $('#image_install').parent().fadeOut(1000, function(){ |
499 | $('#image_install').parent().addClass('muted'); | 626 | $('#image_install').parent().addClass('muted'); |
500 | $('#image_install').html('Not set'); | 627 | $('#image_install').text('Not set'); |
501 | $('#delete-image_install-icon').hide(); | 628 | $('#delete-image_install-icon').hide(); |
502 | $('#image_install').parent().fadeIn(1000); | 629 | $('#image_install').parent().fadeIn(1000); |
503 | }); | 630 | }); |
@@ -560,7 +687,7 @@ | |||
560 | if (pc2_checked) val = val + " package_ipk"; | 687 | if (pc2_checked) val = val + " package_ipk"; |
561 | } | 688 | } |
562 | 689 | ||
563 | $('#package_classes').html(val); | 690 | $('#package_classes').text(val); |
564 | //$('#package_classes').parent().removeClass('muted'); | 691 | //$('#package_classes').parent().removeClass('muted'); |
565 | postEditAjaxRequest({"configvarChange" : 'PACKAGE_CLASSES:'+val}); | 692 | postEditAjaxRequest({"configvarChange" : 'PACKAGE_CLASSES:'+val}); |
566 | $("#change-package_classes-form").slideUp(function() { | 693 | $("#change-package_classes-form").slideUp(function() { |
@@ -600,7 +727,7 @@ | |||
600 | } | 727 | } |
601 | } | 728 | } |
602 | postEditAjaxRequest({"configvarChange" : 'SDKMACHINE:'+value}); | 729 | postEditAjaxRequest({"configvarChange" : 'SDKMACHINE:'+value}); |
603 | $('#sdkmachine').html(value); | 730 | $('#sdkmachine').text(value); |
604 | $("#change-sdkmachine-form").slideUp(function() { | 731 | $("#change-sdkmachine-form").slideUp(function() { |
605 | $('#sdkmachine, #change-sdkmachine-icon').show(); | 732 | $('#sdkmachine, #change-sdkmachine-icon').show(); |
606 | }); | 733 | }); |
@@ -610,32 +737,19 @@ | |||
610 | 737 | ||
611 | // add new variable | 738 | // add new variable |
612 | $("button#add-configvar-button").click( function (evt) { | 739 | $("button#add-configvar-button").click( function (evt) { |
613 | var variable = $("input#variable")[0].value; | 740 | var variable = $("input#variable").val(); |
614 | var value = $("input#value")[0].value; | 741 | var value = $("input#value").val(); |
615 | |||
616 | if (validate_new_variable_name()) { | ||
617 | postEditAjaxRequest({"configvarAdd" : variable+':'+value}); | ||
618 | 742 | ||
619 | // clear the previous values | 743 | postEditAjaxRequest({"configvarAdd" : variable+':'+value}); |
620 | $("input#variable")[0].value = ""; | ||
621 | $("input#value")[0].value = ""; | ||
622 | 744 | ||
623 | } | 745 | // clear the previous values |
746 | $("input#variable").val(""); | ||
747 | $("input#value").val(""); | ||
624 | }); | 748 | }); |
625 | 749 | ||
626 | // validate new variable name | 750 | // validate new variable name and value |
627 | $("input#variable").focusout( function (evt) { | ||
628 | validate_new_variable_name(); | ||
629 | }); | ||
630 | |||
631 | //activate / deactivate save added variable button | ||
632 | $("#variable, #value").on('input', function() { | 751 | $("#variable, #value").on('input', function() { |
633 | if ( $("#variable").val().length > 0 && $("#value").val().trim().length > 0 ) { | 752 | validate_new_variable(); |
634 | $(".save").removeAttr("disabled"); | ||
635 | } | ||
636 | else { | ||
637 | $(".save").attr("disabled","disabled"); | ||
638 | } | ||
639 | }); | 753 | }); |
640 | 754 | ||
641 | // | 755 | // |
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index a7f58ad5e1..4a1cdec5a8 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -2325,12 +2325,9 @@ if toastermain.settings.MANAGED: | |||
2325 | variable = t | 2325 | variable = t |
2326 | value = "" | 2326 | value = "" |
2327 | 2327 | ||
2328 | try: | 2328 | pt, created = ProjectVariable.objects.get_or_create(project = prj, name = variable) |
2329 | pt = ProjectVariable.objects.get(project = prj, name = variable) | 2329 | pt.value=value |
2330 | pt.value=value | 2330 | pt.save() |
2331 | pt.save() | ||
2332 | except ObjectDoesNotExist: | ||
2333 | print("the entry doesn't exist.") | ||
2334 | # remove conf variables | 2331 | # remove conf variables |
2335 | if 'configvarDel' in request.POST: | 2332 | if 'configvarDel' in request.POST: |
2336 | t=request.POST['configvarDel'].strip() | 2333 | t=request.POST['configvarDel'].strip() |
@@ -2338,15 +2335,32 @@ if toastermain.settings.MANAGED: | |||
2338 | 2335 | ||
2339 | # return all project settings | 2336 | # return all project settings |
2340 | vars_managed,vars_fstypes,vars_blacklist = get_project_configvars_context() | 2337 | vars_managed,vars_fstypes,vars_blacklist = get_project_configvars_context() |
2341 | return HttpResponse(json.dumps( { | 2338 | return_data = { |
2342 | "error": "ok", | 2339 | "error": "ok", |
2343 | 'configvars' : map(lambda x: (x.name, x.value, x.pk), ProjectVariable.objects.filter(project_id = pid).all()), | 2340 | 'configvars' : map(lambda x: (x.name, x.value, x.pk), ProjectVariable.objects.filter(project_id = pid).all()), |
2344 | 'distro' : ProjectVariable.objects.get(project = prj, name = "DISTRO").value, | 2341 | } |
2345 | 'fstypes' : ProjectVariable.objects.get(project = prj, name = "IMAGE_FSTYPES").value, | 2342 | try: |
2346 | 'image_install_append': ProjectVariable.objects.get(project = prj, name = "IMAGE_INSTALL_append").value, | 2343 | return_data['distro'] = ProjectVariable.objects.get(project = prj, name = "DISTRO").value, |
2347 | 'package_classes': ProjectVariable.objects.get(project = prj, name = "PACKAGE_CLASSES").value, | 2344 | except ProjectVariable.DoesNotExist: |
2348 | 'sdk_machine' : ProjectVariable.objects.get(project = prj, name = "SDKMACHINE").value, | 2345 | pass |
2349 | }), content_type = "application/json") | 2346 | try: |
2347 | return_data['fstypes'] = ProjectVariable.objects.get(project = prj, name = "IMAGE_FSTYPES").value, | ||
2348 | except ProjectVariable.DoesNotExist: | ||
2349 | pass | ||
2350 | try: | ||
2351 | return_data['image_install_append'] = ProjectVariable.objects.get(project = prj, name = "IMAGE_INSTALL_append").value, | ||
2352 | except ProjectVariable.DoesNotExist: | ||
2353 | pass | ||
2354 | try: | ||
2355 | return_data['package_classes'] = ProjectVariable.objects.get(project = prj, name = "PACKAGE_CLASSES").value, | ||
2356 | except ProjectVariable.DoesNotExist: | ||
2357 | pass | ||
2358 | try: | ||
2359 | return_data['sdk_machine'] = ProjectVariable.objects.get(project = prj, name = "SDKMACHINE").value, | ||
2360 | except ProjectVariable.DoesNotExist: | ||
2361 | pass | ||
2362 | |||
2363 | return HttpResponse(json.dumps( return_data ), content_type = "application/json") | ||
2350 | 2364 | ||
2351 | except Exception as e: | 2365 | except Exception as e: |
2352 | return HttpResponse(json.dumps({"error":str(e) + "\n" + traceback.format_exc()}), content_type = "application/json") | 2366 | return HttpResponse(json.dumps({"error":str(e) + "\n" + traceback.format_exc()}), content_type = "application/json") |
@@ -2916,7 +2930,7 @@ if toastermain.settings.MANAGED: | |||
2916 | 2930 | ||
2917 | vars_fstypes = { | 2931 | vars_fstypes = { |
2918 | 'btrfs','cpio','cpio.gz','cpio.lz4','cpio.lzma','cpio.xz','cramfs', | 2932 | 'btrfs','cpio','cpio.gz','cpio.lz4','cpio.lzma','cpio.xz','cramfs', |
2919 | 'elf','ext2','ext2.bz2','ext2.gz','ext2.lzma' 'ext3','ext3.gz','hddimg', | 2933 | 'elf','ext2','ext2.bz2','ext2.gz','ext2.lzma', 'ext3','ext3.gz','hddimg', |
2920 | 'iso','jffs2','jffs2.sum','squashfs','squashfs-lzo','squashfs-xz','tar.bz2', | 2934 | 'iso','jffs2','jffs2.sum','squashfs','squashfs-lzo','squashfs-xz','tar.bz2', |
2921 | 'tar.lz4','tar.xz','tartar.gz','ubi','ubifs','vmdk' | 2935 | 'tar.lz4','tar.xz','tartar.gz','ubi','ubifs','vmdk' |
2922 | } | 2936 | } |