summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/templates/projectconf.html
diff options
context:
space:
mode:
authorSujith H <sujith.h@gmail.com>2016-05-19 11:43:30 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-20 10:09:02 +0100
commitc81d03e8a30d9ac62e7162794b41f7e0c21e0a61 (patch)
tree1b220261e89295950c971edb11421e5c0bad561f /bitbake/lib/toaster/toastergui/templates/projectconf.html
parent5444abaaca31c9e4bafd29deb28e97c616526d23 (diff)
downloadpoky-c81d03e8a30d9ac62e7162794b41f7e0c21e0a61.tar.gz
bitbake: toaster: handle multiple imagefs types
This functionality helps users to add custom image fs types available other than the checkboxes in the UI. User can add imagefs types in the text box and use them in the build. [YOCTO #7828] (Bitbake rev: c14cbb026598be064f08f46bb513456c7a3089f5) Signed-off-by: Sujith H <sujith.h@gmail.com> Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/templates/projectconf.html')
-rw-r--r--bitbake/lib/toaster/toastergui/templates/projectconf.html111
1 files changed, 70 insertions, 41 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/projectconf.html b/bitbake/lib/toaster/toastergui/templates/projectconf.html
index 27a898b657..c007859385 100644
--- a/bitbake/lib/toaster/toastergui/templates/projectconf.html
+++ b/bitbake/lib/toaster/toastergui/templates/projectconf.html
@@ -62,12 +62,16 @@
62 <span id="image_fstypes">{{fstypes}}</span> 62 <span id="image_fstypes">{{fstypes}}</span>
63 <i class="icon-pencil" id="change-image_fstypes-icon"></i> 63 <i class="icon-pencil" id="change-image_fstypes-icon"></i>
64 <form id="change-image_fstypes-form" style="display:none;"> 64 <form id="change-image_fstypes-form" style="display:none;">
65 <div class="input-append" id="validate-image_fstypes">
66 <input type="text" class="input-xlarge" id="new-imagefs_types">
67 <button id="apply-change-image_fstypes" type="button" class="btn">Save</button>
68 <button id="cancel-change-image_fstypes" type="button" class="btn btn-link">Cancel</button>
69 </div>
70 </br><span class="help-block error" style="display:none;" id="hintError-image-fs_type">A valid image type cannot include underscores.</span>
71 <p>Choose from known image types</p>
65 <input id="filter-image_fstypes" type="text" placeholder="Search image types" class="span4"> 72 <input id="filter-image_fstypes" type="text" placeholder="Search image types" class="span4">
66 <div id="all-image_fstypes" class="scrolling"> 73 <div id="all-image_fstypes" class="scrolling">
67 </div> 74 </div>
68 <span class="help-block" id="fstypes-error-message">You must select at least one image type</span>
69 <button id="apply-change-image_fstypes" type="button" class="btn">Save</button>
70 <button id="cancel-change-image_fstypes" type="button" class="btn btn-link">Cancel</button>
71 </form> 75 </form>
72 </dd> 76 </dd>
73 {% endif %} 77 {% endif %}
@@ -322,22 +326,6 @@
322 return true; 326 return true;
323 } 327 }
324 328
325 // Test to insure at least one FS Type is checked
326 function enableFsTypesSave() {
327 var any_checked = 0;
328 $(".fs-checkbox-fstypes:checked").each(function(){
329 any_checked = 1;
330 });
331 if ( 0 == any_checked ) {
332 $("#apply-change-image_fstypes").attr("disabled","disabled");
333 $('#fstypes-error-message').show();
334 }
335 else {
336 $("#apply-change-image_fstypes").removeAttr("disabled");
337 $('#fstypes-error-message').hide();
338 }
339 }
340
341 // Preset or reset the Package Class checkbox labels 329 // Preset or reset the Package Class checkbox labels
342 function updatePackageClassCheckboxes() { 330 function updatePackageClassCheckboxes() {
343 $('#package_class_1, #package_class_2').hide(); 331 $('#package_class_1, #package_class_2').hide();
@@ -603,6 +591,46 @@
603 {% if fstypes_defined %} 591 {% if fstypes_defined %}
604 // change IMAGE_FSTYPES variable 592 // change IMAGE_FSTYPES variable
605 593
594 // get value of fstypes and add to the textbox
595 $("#new-imagefs_types").val("{{fstypes}}");
596
597 // If value of new-imagefs_types is empty disable save button
598 $("#new-imagefs_types").on("input", function() {
599 $(this).val($(this).val().replace(/\s+/g,' '));
600 if ($(this).val().length === 0) {
601 //$('#apply-change-image_fstypes').prop('disabled', true);
602 $('#apply-change-image_fstypes').attr("disabled", "disabled");
603 } else {
604 //$('#apply-change-image_fstypes').prop('disabled', false);
605 $('#apply-change-image_fstypes').removeAttr("disabled");
606 }
607
608 /*If user types imagefs do the action on checkboxes.
609 Lets say if an imagefstype typed by user and the same
610 imagefs is unchecked in the checkbox, then checkbox needs
611 to get checked. Similarly when user deletes imagefs from
612 textbox the checkbox which is checked gets unchecked.
613 */
614 $('#all-image_fstypes input').each(function(){
615 var imagefs_userval = $('#new-imagefs_types').val();
616 if( imagefs_userval.indexOf($(this).val()) > -1) {
617 $(this).prop('checked', true);
618 } else {
619 $(this).prop('checked', false);
620 }
621 });
622
623 // Validate underscore in image fs types
624 if ($(this).val().indexOf('_') > -1) {
625 $('#validate-image_fstypes').addClass('control-group error');
626 $('#hintError-image-fs_type').show();
627 $("#apply-change-image_fstypes").prop("disabled", true);
628 } else {
629 $('#validate-image_fstypes').removeClass('control-group error');
630 $('#hintError-image-fs_type').hide();
631 }
632 });
633
606 $('#change-image_fstypes-icon').click(function() { 634 $('#change-image_fstypes-icon').click(function() {
607 $('#change-image_fstypes-icon, #image_fstypes').hide(); 635 $('#change-image_fstypes-icon, #image_fstypes').hide();
608 $("#change-image_fstypes-form").slideDown(); 636 $("#change-image_fstypes-form").slideDown();
@@ -630,19 +658,33 @@
630 document.getElementById("all-image_fstypes").innerHTML = html; 658 document.getElementById("all-image_fstypes").innerHTML = html;
631 $('#no-match-fstypes').hide(); 659 $('#no-match-fstypes').hide();
632 660
633 // Watch elements to disable Save when none are checked
634 $(".fs-checkbox-fstypes").each(function(){
635 $(this).click(function() {
636 enableFsTypesSave();
637 });
638 });
639
640 // clear the previous filter values and warning messages 661 // clear the previous filter values and warning messages
641 $("input#filter-image_fstypes").val(""); 662 $("input#filter-image_fstypes").val("");
642 $('#fstypes-error-message').hide(); 663 });
664
665 // When checkbox is checked/unchecked kindly update the text
666 $(document).on("change", "#all-image_fstypes :checkbox", function() {
667 var imagefs = $(this);
668 var imagefs_obj = $('#new-imagefs_types');
669 var imagefs_userval = imagefs_obj.val();
670 if ($(this).is(':checked')) {
671 if (imagefs_userval.indexOf($(imagefs).val()) === -1) {
672 imagefs_obj.val(imagefs_userval + " " + $(imagefs).val());
673 }
674 } else {
675 if (imagefs_userval.indexOf($(imagefs).val()) > -1) {
676 imagefs_obj.val(imagefs_userval.replace($(imagefs).val(), '').trim());
677 }
678 }
679 if ($('#new-imagefs_types').val().length === 0) {
680 $("#apply-change-image_fstypes").prop("disabled", true);
681 } else {
682 $("#apply-change-image_fstypes").prop("disabled", false);
683 }
643 }); 684 });
644 685
645 $('#cancel-change-image_fstypes').click(function(){ 686 $('#cancel-change-image_fstypes').click(function(){
687 $("#new-imagefs_types").val("{{fstypes}}");
646 $("#change-image_fstypes-form").slideUp(function() { 688 $("#change-image_fstypes-form").slideUp(function() {
647 $('#image_fstypes, #change-image_fstypes-icon').show(); 689 $('#image_fstypes, #change-image_fstypes-icon').show();
648 }); 690 });
@@ -670,20 +712,7 @@
670 }); 712 });
671 713
672 $('#apply-change-image_fstypes').click(function(){ 714 $('#apply-change-image_fstypes').click(function(){
673 // extract the selected fstypes and sort them 715 var fstypes = $('#new-imagefs_types').val();
674 var fstypes_array = [];
675 var checkboxes = document.getElementsByClassName('fs-checkbox-fstypes');
676 $(".fs-checkbox-fstypes:checked").each(function(){
677 fstypes_array.push($(this).val());
678 });
679 fstypes_array.sort();
680
681 // now make a string of them
682 var fstypes = '';
683 for (var i = 0, length = fstypes_array.length; i < length; i++) {
684 fstypes += fstypes_array[i] + ' ';
685 }
686 fstypes = fstypes.trim();
687 716
688 postEditAjaxRequest({"configvarChange" : 'IMAGE_FSTYPES:'+fstypes}); 717 postEditAjaxRequest({"configvarChange" : 'IMAGE_FSTYPES:'+fstypes});
689 $('#image_fstypes').text(fstypes); 718 $('#image_fstypes').text(fstypes);