Skip to contentSkip to conversation

] toaster: projectconf Add feature for free form IMAGE_FSTYPES

PATCH In review Michael Wood 3 participants 7 messages Nov 23, 2015 – Dec 15, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ] toaster: projectconf Add feature for free form IMAGE_FSTYPES

Add feature to the projectconf page to allow free form input of IMAGE_FSTYPES. Sometimes a recipe can provide an IMAGE_FSTYPE that isn't in the normal image_types class. So would need to be specified manually.

[YOCTO #7828]

---
 .../toaster/toastergui/templates/projectconf.html  | 128 +++++++++++++++------
 1 file changed, 95 insertions(+), 33 deletions(-)
bitbake/lib/toaster/toastergui/templates/projectconf.html +95 -33
index 30fd03e..13f9c66 100644
@@ -36,18 +36,36 @@
                 <span class="js-config-var-name js-config-var-managed-name">IMAGE_FSTYPES</span>
                 <i class="icon-question-sign get-help" title="Formats of root file system images that you want to have created <br /><a href='http://www.yoctoproject.org/docs/1.6.1/ref-manual/ref-manual.html#var-IMAGE_FSTYPES' target='_blank'>Read more in the manual</a>"></i>
             </dt>
-            <dd class="lead">
-                <span id="image_fstypes">{{fstypes}}</span>
-                <i class="icon-pencil" id="change-image_fstypes-icon"></i>
-                <form id="change-image_fstypes-form" style="display:none;">
-                    <input id="filter-image_fstypes" type="text" placeholder="Search image types" class="span4">
-                    <div id="all-image_fstypes" class="scrolling">
+            <dd style="margin-bottom: 20px">
+              <span id="image_fstypes" class="lead">{{fstypes}}</span>
+              <i class="icon-pencil" id="change-image_fstypes-icon"></i>
+              <form id="change-image_fstypes-form" style="display:none;">
+                <label>Choose from known image types</label>
+                <input id="filter-image_fstypes" type="text" placeholder="Search known image types" class="span4">
+                  <div id="all-image_fstypes" class="scrolling">
+                  </div>
+                  <div class="input-append">
+                    <span class="control-group" id="fstypes-control-validation">
+                      <label>Enter your own image types
+                        <i data-original-title="You can enter more than one image type, separated by a space" class="icon-question-sign get-help" title=""></i>
+                      </label>
+                      <input type="text" id="new-image-fstype-input">
+
+                      </span>
                     </div>
-                    <span class="help-block" id="fstypes-error-message">You must select at least one image type</span>
-                    <button id="apply-change-image_fstypes" type="button" class="btn">Save</button>
-                    <button id="cancel-change-image_fstypes" type="button" class="btn btn-link">Cancel</button>
-                </form>
-            </dd>
+                    <p style="display:none" class="error" id="fstypes-error-message">
+                      You must select at least one image type. <br />
+                      Choose from the list of known ones or type your own.
+                    </p>
+                    <p style="display:none" class="error" id="invalid-chars-in-fstype-msg">
+                      A valid image type cannot include underscores.
+                    </p>
+                    <div>
+                      <button id="apply-change-image_fstypes" type="button" class="btn">Save</button>
+                      <button id="cancel-change-image_fstypes" type="button" class="btn btn-link">Cancel</button>
+                    </div>
+                  </form>
+                </dd>
             {% endif %}
 
             {% if image_install_append_defined %}
@@ -305,20 +323,41 @@
             return true;
         }
 
-        // Test to insure at least one FS Type is checked
+        var fsTypesInput = $("#new-image-fstype-input");
+        var invalidCharsMsg = $("#invalid-chars-in-fstype-msg");
+        var fsTypesControl = $("#fstypes-control-validation");
+        var noFsType = $('#fstypes-error-message');
+        var fsTypesApplyBtn = $("#apply-change-image_fstypes");
+
+        /* Validation of fstypes */
         function enableFsTypesSave() {
-            var any_checked = 0;
-            $(".fs-checkbox-fstypes:checked").each(function(){
-                any_checked = 1;
-            });
-            if ( 0 == any_checked ) {
-                $("#apply-change-image_fstypes").attr("disabled","disabled");
-                $('#fstypes-error-message').show();
-            }
-            else {
-                $("#apply-change-image_fstypes").removeAttr("disabled");
-                $('#fstypes-error-message').hide();
-            }
+          var valid_input = false;
+          var valid_checkboxes = false;
+          var anyChecked = $(".fs-checkbox-fstypes:checked").length;
+
+          /* No underscores allowed */
+          if (fsTypesInput.val().match(/\_/)) {
+            invalidCharsMsg.show();
+            fsTypesControl.addClass("error");
+            valid_input = false;
+          } else {
+            fsTypesControl.removeClass("error");
+            invalidCharsMsg.hide();
+            valid_input = true;
+          }
+
+          if (!anyChecked && !fsTypesInput.val()){
+            noFsType.show();
+            valid_checkboxes = false;
+          } else {
+            noFsType.hide();
+            valid_checkboxes = true;
+          }
+
+          if (valid_checkboxes == false || valid_input == false)
+            fsTypesApplyBtn.attr("disabled","disabled");
+          else
+            fsTypesApplyBtn.removeAttr("disabled");
         }
 
         // Preset or reset the Package Class checkbox labels
@@ -597,17 +636,37 @@
                 }
             });
 
-            $('#apply-change-image_fstypes').click(function(){
-                // extract the selected fstypes and sort them
-                var fstypes_array = [];
-                var checkboxes = document.getElementsByClassName('fs-checkbox-fstypes');
-                $(".fs-checkbox-fstypes:checked").each(function(){
-                       fstypes_array.push($(this).val());
-                });
-                fstypes_array.sort();
+            fsTypesInput.on('input', function(){
+              enableFsTypesSave();
+            });
+
+            fsTypesApplyBtn.click(function(e){
+              e.preventDefault();
+
+              var fstypes = '';
+              // extract the selected fstypes and sort them
+              var fstypes_array = [];
+              var checkboxes = document.getElementsByClassName('fs-checkbox-fstypes');
+              $(".fs-checkbox-fstypes:checked").each(function(){
+                fstypes_array.push($(this).val());
+              });
+              fstypes_array.sort();
+
+              /* If we have a value in our enter own image type input and it
+               * isn't already selected add it to the fstypes value
+               */
+               if (fsTypesInput.val()){
+                 var inputFsTypes = fsTypesInput.val().split(" ");
+
+                 for (var type in inputFsTypes){
+                   if (fstypes_array.indexOf(inputFsTypes[type].trim()) === -1)
+                   {
+                     fstypes += inputFsTypes[type]+' ';
+                   }
+                 }
+               }
 
                 // now make a string of them
-                var fstypes = '';
                 for (var i = 0, length = fstypes_array.length; i < length; i++) {
                     fstypes += fstypes_array[i] + ' ';
                 }
@@ -620,6 +679,9 @@
                 $("#change-image_fstypes-form").slideUp(function() {
                     $('#image_fstypes, #change-image_fstypes-icon').show();
                 });
+
+
+              fsTypesInput.val("");
             });
             {% endif %}
 
Signature · 1 line
2.5.0
#1 lore raw
Quoted 6 lines · On 23/11/2015 11:41, "[email protected] on behalf of Michael…

Add feature to the projectconf page to allow free form input of IMAGE_FSTYPES. Sometimes a recipe can provide an IMAGE_FSTYPE that isn't in the normal image_types class. So would need to be specified manually.

[YOCTO #7828]

This seems to address all the issues from v1. Getting rid the 'already selected' error message by not duplicating any values works well.

From my perspective, this is good to go.

Thanks!

Belén

Quoted 206 lines

---
.../toaster/toastergui/templates/projectconf.html | 128
+++++++++++++++------

1 file changed, 95 insertions(+), 33 deletions(-)
bitbake/lib/toaster/toastergui/templates/projectconf.html +0 -0
index 30fd03e..13f9c66 100644
@@ -36,18 +36,36 @@
                <span class="js-config-var-name

js-config-var-managed-name">IMAGE_FSTYPES</span>
<i class="icon-question-sign get-help" title="Formats of
root file system images that you want to have created <br /><a href='http://www.yoctoproject.org/docs/1.6.1/ref-manual/ref-manual.html#va r-IMAGE_FSTYPES' target='_blank'>Read more in the manual</a>"></i>

            </dt>
bitbake/lib/toaster/toastergui/templates/projectconf.html +0 -3
-            <dd class="lead">
-                <span id="image_fstypes">{{fstypes}}</span>
-                <i class="icon-pencil"

id="change-image_fstypes-icon"></i>
- <form id="change-image_fstypes-form"
style="display:none;">
- <input id="filter-image_fstypes" type="text"
placeholder="Search image types" class="span4">

bitbake/lib/toaster/toastergui/templates/projectconf.html +6 -1
-                    <div id="all-image_fstypes" class="scrolling">
+            <dd style="margin-bottom: 20px">
+              <span id="image_fstypes" class="lead">{{fstypes}}</span>
+              <i class="icon-pencil" id="change-image_fstypes-icon"></i>
+              <form id="change-image_fstypes-form" style="display:none;">
+                <label>Choose from known image types</label>
+                <input id="filter-image_fstypes" type="text"

placeholder="Search known image types" class="span4">

bitbake/lib/toaster/toastergui/templates/projectconf.html +4 -0
+                  <div id="all-image_fstypes" class="scrolling">
+                  </div>
+                  <div class="input-append">
+                    <span class="control-group"

id="fstypes-control-validation">

bitbake/lib/toaster/toastergui/templates/projectconf.html +2 -0
+                      <label>Enter your own image types
+                        <i data-original-title="You can enter more than

one image type, separated by a space" class="icon-question-sign get-help" title=""></i>

bitbake/lib/toaster/toastergui/templates/projectconf.html +4 -1
+                      </label>
+                      <input type="text" id="new-image-fstype-input">
+
+                      </span>
                    </div>
-                    <span class="help-block"

id="fstypes-error-message">You must select at least one image type</span>
- <button id="apply-change-image_fstypes"
type="button" class="btn">Save</button>
- <button id="cancel-change-image_fstypes"
type="button" class="btn btn-link">Cancel</button>

bitbake/lib/toaster/toastergui/templates/projectconf.html +1 -2
-                </form>
-            </dd>
+                    <p style="display:none" class="error"

id="fstypes-error-message">

bitbake/lib/toaster/toastergui/templates/projectconf.html +2 -0
+                      You must select at least one image type. <br />
+                      Choose from the list of known ones or type your

own.

bitbake/lib/toaster/toastergui/templates/projectconf.html +2 -0
+                    </p>
+                    <p style="display:none" class="error"

id="invalid-chars-in-fstype-msg">

bitbake/lib/toaster/toastergui/templates/projectconf.html +4 -0
+                      A valid image type cannot include underscores.
+                    </p>
+                    <div>
+                      <button id="apply-change-image_fstypes"

type="button" class="btn">Save</button>
+ <button id="cancel-change-image_fstypes"
type="button" class="btn btn-link">Cancel</button>

bitbake/lib/toaster/toastergui/templates/projectconf.html +37 -13
+                    </div>
+                  </form>
+                </dd>
            {% endif %}
 
            {% if image_install_append_defined %}
@@ -305,20 +323,41 @@
            return true;
        }
 
-        // Test to insure at least one FS Type is checked
+        var fsTypesInput = $("#new-image-fstype-input");
+        var invalidCharsMsg = $("#invalid-chars-in-fstype-msg");
+        var fsTypesControl = $("#fstypes-control-validation");
+        var noFsType = $('#fstypes-error-message');
+        var fsTypesApplyBtn = $("#apply-change-image_fstypes");
+
+        /* Validation of fstypes */
        function enableFsTypesSave() {
-            var any_checked = 0;
-            $(".fs-checkbox-fstypes:checked").each(function(){
-                any_checked = 1;
-            });
-            if ( 0 == any_checked ) {
-                
 $("#apply-change-image_fstypes").attr("disabled","disabled");
-                $('#fstypes-error-message').show();
-            }
-            else {
-                $("#apply-change-image_fstypes").removeAttr("disabled");
-                $('#fstypes-error-message').hide();
-            }
+          var valid_input = false;
+          var valid_checkboxes = false;
+          var anyChecked = $(".fs-checkbox-fstypes:checked").length;
+
+          /* No underscores allowed */
+          if (fsTypesInput.val().match(/\_/)) {
+            invalidCharsMsg.show();
+            fsTypesControl.addClass("error");
+            valid_input = false;
+          } else {
+            fsTypesControl.removeClass("error");
+            invalidCharsMsg.hide();
+            valid_input = true;
+          }
+
+          if (!anyChecked && !fsTypesInput.val()){
+            noFsType.show();
+            valid_checkboxes = false;
+          } else {
+            noFsType.hide();
+            valid_checkboxes = true;
+          }
+
+          if (valid_checkboxes == false || valid_input == false)
+            fsTypesApplyBtn.attr("disabled","disabled");
+          else
+            fsTypesApplyBtn.removeAttr("disabled");
        }
 
        // Preset or reset the Package Class checkbox labels
bitbake/lib/toaster/toastergui/templates/projectconf.html +17 -8
@@ -597,17 +636,37 @@
                }
            });
 
-            $('#apply-change-image_fstypes').click(function(){
-                // extract the selected fstypes and sort them
-                var fstypes_array = [];
-                var checkboxes =
 document.getElementsByClassName('fs-checkbox-fstypes');
-                $(".fs-checkbox-fstypes:checked").each(function(){
-                       fstypes_array.push($(this).val());
-                });
-                fstypes_array.sort();
+            fsTypesInput.on('input', function(){
+              enableFsTypesSave();
+            });
+
+            fsTypesApplyBtn.click(function(e){
+              e.preventDefault();
+
+              var fstypes = '';
+              // extract the selected fstypes and sort them
+              var fstypes_array = [];
+              var checkboxes =
 document.getElementsByClassName('fs-checkbox-fstypes');
+              $(".fs-checkbox-fstypes:checked").each(function(){
+                fstypes_array.push($(this).val());
+              });
+              fstypes_array.sort();
+
+              /* If we have a value in our enter own image type input

and it

bitbake/lib/toaster/toastergui/templates/projectconf.html +7 -0
+               * isn't already selected add it to the fstypes value
+               */
+               if (fsTypesInput.val()){
+                 var inputFsTypes = fsTypesInput.val().split(" ");
+
+                 for (var type in inputFsTypes){
+                   if (fstypes_array.indexOf(inputFsTypes[type].trim())

=== -1)

bitbake/lib/toaster/toastergui/templates/projectconf.html +5 -1
+                   {
+                     fstypes += inputFsTypes[type]+' ';
+                   }
+                 }
+               }
 
                // now make a string of them
-                var fstypes = '';
                for (var i = 0, length = fstypes_array.length; i <
length; i++) {
                    fstypes += fstypes_array[i] + ' ';
                }
bitbake/lib/toaster/toastergui/templates/projectconf.html +3 -0
@@ -620,6 +679,9 @@
                $("#change-image_fstypes-form").slideUp(function() {
                    $('#image_fstypes,
 #change-image_fstypes-icon').show();
                });
+
+
+              fsTypesInput.val("");
            });
            {% endif %}
Signature · 8 lines
-- 
2.5.0

-- 
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster
#2 lore raw
Quoted 9 lines · Belen
Quoted 5 lines · On 23/11/2015 11:41, "[email protected] on behalf of Michael…

Add feature to the projectconf page to allow free form input of IMAGE_FSTYPES. Sometimes a recipe can provide an IMAGE_FSTYPE that isn't in the normal image_types class. So would need to be specified manually.

Quoted 5 lines
Quoted 1 line

[YOCTO #7828]

This seems to address all the issues from v1. Getting rid the 'already selected' error message by not duplicating any values works well.

It works correctly, but there is one issue: if you enter an invalid string as the image type (e.g. btrfss) and want to correct it, there's no way to delete it from the list.

Perhaps a button to set the list back to the defaults, or to remove any invalid types ("cleanup")?

Alternatively, add the user's custom image type to the checkbox list; if they uncheck it, is disappears from the list.

Elliot

Quoted 221 lines

From my perspective, this is good to go.

Thanks!

Belén

Quoted 14 lines

---
.../toaster/toastergui/templates/projectconf.html | 128
+++++++++++++++------

1 file changed, 95 insertions(+), 33 deletions(-)
bitbake/lib/toaster/toastergui/templates/projectconf.html +0 -0
index 30fd03e..13f9c66 100644
@@ -36,18 +36,36 @@
                <span class="js-config-var-name
Quoted 4 lines

js-config-var-managed-name">IMAGE_FSTYPES</span>
<i class="icon-question-sign get-help" title="Formats of
root file system images that you want to have created <br /><a href='

http://www.yoctoproject.org/docs/1.6.1/ref-manual/ref-manual.html#va

Quoted 183 lines

r-IMAGE_FSTYPES' target='_blank'>Read more in the manual</a>"></i>

            </dt>
bitbake/lib/toaster/toastergui/templates/projectconf.html +0 -3
-            <dd class="lead">
-                <span id="image_fstypes">{{fstypes}}</span>
-                <i class="icon-pencil"

id="change-image_fstypes-icon"></i>
- <form id="change-image_fstypes-form"
style="display:none;">
- <input id="filter-image_fstypes" type="text"
placeholder="Search image types" class="span4">

bitbake/lib/toaster/toastergui/templates/projectconf.html +6 -1
-                    <div id="all-image_fstypes" class="scrolling">
+            <dd style="margin-bottom: 20px">
+              <span id="image_fstypes" class="lead">{{fstypes}}</span>
+              <i class="icon-pencil" id="change-image_fstypes-icon"></i>
+              <form id="change-image_fstypes-form" style="display:none;">
+                <label>Choose from known image types</label>
+                <input id="filter-image_fstypes" type="text"

placeholder="Search known image types" class="span4">

bitbake/lib/toaster/toastergui/templates/projectconf.html +4 -0
+                  <div id="all-image_fstypes" class="scrolling">
+                  </div>
+                  <div class="input-append">
+                    <span class="control-group"

id="fstypes-control-validation">

bitbake/lib/toaster/toastergui/templates/projectconf.html +2 -0
+                      <label>Enter your own image types
+                        <i data-original-title="You can enter more than

one image type, separated by a space" class="icon-question-sign get-help" title=""></i>

bitbake/lib/toaster/toastergui/templates/projectconf.html +4 -1
+                      </label>
+                      <input type="text" id="new-image-fstype-input">
+
+                      </span>
                    </div>
-                    <span class="help-block"

id="fstypes-error-message">You must select at least one image type</span>
- <button id="apply-change-image_fstypes"
type="button" class="btn">Save</button>
- <button id="cancel-change-image_fstypes"
type="button" class="btn btn-link">Cancel</button>

bitbake/lib/toaster/toastergui/templates/projectconf.html +1 -2
-                </form>
-            </dd>
+                    <p style="display:none" class="error"

id="fstypes-error-message">

bitbake/lib/toaster/toastergui/templates/projectconf.html +2 -0
+                      You must select at least one image type. <br />
+                      Choose from the list of known ones or type your

own.

bitbake/lib/toaster/toastergui/templates/projectconf.html +2 -0
+                    </p>
+                    <p style="display:none" class="error"

id="invalid-chars-in-fstype-msg">

bitbake/lib/toaster/toastergui/templates/projectconf.html +4 -0
+                      A valid image type cannot include underscores.
+                    </p>
+                    <div>
+                      <button id="apply-change-image_fstypes"

type="button" class="btn">Save</button>
+ <button id="cancel-change-image_fstypes"
type="button" class="btn btn-link">Cancel</button>

bitbake/lib/toaster/toastergui/templates/projectconf.html +37 -13
+                    </div>
+                  </form>
+                </dd>
            {% endif %}
 
            {% if image_install_append_defined %}
@@ -305,20 +323,41 @@
            return true;
        }
 
-        // Test to insure at least one FS Type is checked
+        var fsTypesInput = $("#new-image-fstype-input");
+        var invalidCharsMsg = $("#invalid-chars-in-fstype-msg");
+        var fsTypesControl = $("#fstypes-control-validation");
+        var noFsType = $('#fstypes-error-message');
+        var fsTypesApplyBtn = $("#apply-change-image_fstypes");
+
+        /* Validation of fstypes */
        function enableFsTypesSave() {
-            var any_checked = 0;
-            $(".fs-checkbox-fstypes:checked").each(function(){
-                any_checked = 1;
-            });
-            if ( 0 == any_checked ) {
-
 $("#apply-change-image_fstypes").attr("disabled","disabled");
-                $('#fstypes-error-message').show();
-            }
-            else {
-                $("#apply-change-image_fstypes").removeAttr("disabled");
-                $('#fstypes-error-message').hide();
-            }
+          var valid_input = false;
+          var valid_checkboxes = false;
+          var anyChecked = $(".fs-checkbox-fstypes:checked").length;
+
+          /* No underscores allowed */
+          if (fsTypesInput.val().match(/\_/)) {
+            invalidCharsMsg.show();
+            fsTypesControl.addClass("error");
+            valid_input = false;
+          } else {
+            fsTypesControl.removeClass("error");
+            invalidCharsMsg.hide();
+            valid_input = true;
+          }
+
+          if (!anyChecked && !fsTypesInput.val()){
+            noFsType.show();
+            valid_checkboxes = false;
+          } else {
+            noFsType.hide();
+            valid_checkboxes = true;
+          }
+
+          if (valid_checkboxes == false || valid_input == false)
+            fsTypesApplyBtn.attr("disabled","disabled");
+          else
+            fsTypesApplyBtn.removeAttr("disabled");
        }
 
        // Preset or reset the Package Class checkbox labels
bitbake/lib/toaster/toastergui/templates/projectconf.html +17 -8
@@ -597,17 +636,37 @@
                }
            });
 
-            $('#apply-change-image_fstypes').click(function(){
-                // extract the selected fstypes and sort them
-                var fstypes_array = [];
-                var checkboxes =
 document.getElementsByClassName('fs-checkbox-fstypes');
-                $(".fs-checkbox-fstypes:checked").each(function(){
-                       fstypes_array.push($(this).val());
-                });
-                fstypes_array.sort();
+            fsTypesInput.on('input', function(){
+              enableFsTypesSave();
+            });
+
+            fsTypesApplyBtn.click(function(e){
+              e.preventDefault();
+
+              var fstypes = '';
+              // extract the selected fstypes and sort them
+              var fstypes_array = [];
+              var checkboxes =
 document.getElementsByClassName('fs-checkbox-fstypes');
+              $(".fs-checkbox-fstypes:checked").each(function(){
+                fstypes_array.push($(this).val());
+              });
+              fstypes_array.sort();
+
+              /* If we have a value in our enter own image type input

and it

bitbake/lib/toaster/toastergui/templates/projectconf.html +7 -0
+               * isn't already selected add it to the fstypes value
+               */
+               if (fsTypesInput.val()){
+                 var inputFsTypes = fsTypesInput.val().split(" ");
+
+                 for (var type in inputFsTypes){
+                   if (fstypes_array.indexOf(inputFsTypes[type].trim())

=== -1)

bitbake/lib/toaster/toastergui/templates/projectconf.html +5 -1
+                   {
+                     fstypes += inputFsTypes[type]+' ';
+                   }
+                 }
+               }
 
                // now make a string of them
-                var fstypes = '';
                for (var i = 0, length = fstypes_array.length; i <
length; i++) {
                    fstypes += fstypes_array[i] + ' ';
                }
bitbake/lib/toaster/toastergui/templates/projectconf.html +3 -1
@@ -620,6 +679,9 @@
                $("#change-image_fstypes-form").slideUp(function() {
                    $('#image_fstypes,
 #change-image_fstypes-icon').show();
                });
+
+
+              fsTypesInput.val("");
            });
            {% endif %}
 
--

2.5.0

Quoted 5 lines

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Signature · 3 lines
Elliot Smith
Software Engineer
Intel Open Source Technology Centre
#3 lore raw
Quoted 20 lines · Elliot

On 24 November 2015 at 13:26, Barros Pena, Belen
<[email protected]> wrote:

Quoted 6 lines · On 23/11/2015 11:41, "[email protected] on behalf of Michael…

Add feature to the projectconf page to allow free form input of IMAGE_FSTYPES. Sometimes a recipe can provide an IMAGE_FSTYPE that isn't in the normal image_types class. So would need to be specified manually.

[YOCTO #7828]

This seems to address all the issues from v1. Getting rid the 'already selected' error message by not duplicating any values works well.

Quoted 3 lines

It works correctly, but there is one issue: if you enter an invalid string as the image type (e.g. btrfss) and want to correct it, there's no way to delete it from the list.

Heh, well spotted. Didn't think of this one :/

Quoted 4 lines

Perhaps a button to set the list back to the defaults, or to remove any invalid types ("cleanup")?

This would be a possible solution, but it seems a bit clunky when you just want to remove an extra 's' from an image type that you typed by mistake.

Quoted 4 lines

Alternatively, add the user's custom image type to the checkbox list; if they uncheck it, is disappears from the list.

This was the initial solution, but having it disappearing from the list when you unchecked it is not the behaviour you expect from checkboxes, and it does feel quite weird. A solution would be to store the value you type in the free text field somewhere, so that it appears back there when you click the 'change' button and you can edit it.

I know we cannot store the value in the database (the list of image types is currently hardcoded in views.py), but maybe it's enough to store it for the session. You are bound to realise quite soon if you typed something wrong.

Michael: is this possible?

Thanks!

Belén

Quoted 6 lines

Elliot

From my perspective, this is good to go.

Quoted 236 lines

Thanks!

Belén

Quoted 203 lines

---
.../toaster/toastergui/templates/projectconf.html | 128
+++++++++++++++------

1 file changed, 95 insertions(+), 33 deletions(-)
bitbake/lib/toaster/toastergui/templates/projectconf.html +0 -0
index 30fd03e..13f9c66 100644
@@ -36,18 +36,36 @@
                <span class="js-config-var-name

js-config-var-managed-name">IMAGE_FSTYPES</span>
<i class="icon-question-sign get-help" title="Formats of
root file system images that you want to have created <br /><a href='http://www.yoctoproject.org/docs/1.6.1/ref-manual/ref-manual.html#v a
r-IMAGE_FSTYPES' target='_blank'>Read more in the manual</a>"></i>

            </dt>
bitbake/lib/toaster/toastergui/templates/projectconf.html +0 -3
-            <dd class="lead">
-                <span id="image_fstypes">{{fstypes}}</span>
-                <i class="icon-pencil"

id="change-image_fstypes-icon"></i>
- <form id="change-image_fstypes-form"
style="display:none;">
- <input id="filter-image_fstypes" type="text"
placeholder="Search image types" class="span4">

bitbake/lib/toaster/toastergui/templates/projectconf.html +4 -1
-                    <div id="all-image_fstypes" class="scrolling">
+            <dd style="margin-bottom: 20px">
+              <span id="image_fstypes" class="lead">{{fstypes}}</span>
+              <i class="icon-pencil" id="change-image_fstypes-icon"></i>
+              <form id="change-image_fstypes-form"

style="display:none;">

bitbake/lib/toaster/toastergui/templates/projectconf.html +2 -0
+                <label>Choose from known image types</label>
+                <input id="filter-image_fstypes" type="text"

placeholder="Search known image types" class="span4">

bitbake/lib/toaster/toastergui/templates/projectconf.html +4 -0
+                  <div id="all-image_fstypes" class="scrolling">
+                  </div>
+                  <div class="input-append">
+                    <span class="control-group"

id="fstypes-control-validation">

bitbake/lib/toaster/toastergui/templates/projectconf.html +2 -0
+                      <label>Enter your own image types
+                        <i data-original-title="You can enter more than

one image type, separated by a space" class="icon-question-sign get-help" title=""></i>

bitbake/lib/toaster/toastergui/templates/projectconf.html +4 -1
+                      </label>
+                      <input type="text" id="new-image-fstype-input">
+
+                      </span>
                    </div>
-                    <span class="help-block"

id="fstypes-error-message">You must select at least one image type</span>
- <button id="apply-change-image_fstypes"
type="button" class="btn">Save</button>
- <button id="cancel-change-image_fstypes"
type="button" class="btn btn-link">Cancel</button>

bitbake/lib/toaster/toastergui/templates/projectconf.html +1 -2
-                </form>
-            </dd>
+                    <p style="display:none" class="error"

id="fstypes-error-message">

bitbake/lib/toaster/toastergui/templates/projectconf.html +2 -0
+                      You must select at least one image type. <br />
+                      Choose from the list of known ones or type your

own.

bitbake/lib/toaster/toastergui/templates/projectconf.html +2 -0
+                    </p>
+                    <p style="display:none" class="error"

id="invalid-chars-in-fstype-msg">

bitbake/lib/toaster/toastergui/templates/projectconf.html +4 -0
+                      A valid image type cannot include underscores.
+                    </p>
+                    <div>
+                      <button id="apply-change-image_fstypes"

type="button" class="btn">Save</button>
+ <button id="cancel-change-image_fstypes"
type="button" class="btn btn-link">Cancel</button>

bitbake/lib/toaster/toastergui/templates/projectconf.html +37 -13
+                    </div>
+                  </form>
+                </dd>
            {% endif %}
 
            {% if image_install_append_defined %}
@@ -305,20 +323,41 @@
            return true;
        }
 
-        // Test to insure at least one FS Type is checked
+        var fsTypesInput = $("#new-image-fstype-input");
+        var invalidCharsMsg = $("#invalid-chars-in-fstype-msg");
+        var fsTypesControl = $("#fstypes-control-validation");
+        var noFsType = $('#fstypes-error-message');
+        var fsTypesApplyBtn = $("#apply-change-image_fstypes");
+
+        /* Validation of fstypes */
        function enableFsTypesSave() {
-            var any_checked = 0;
-            $(".fs-checkbox-fstypes:checked").each(function(){
-                any_checked = 1;
-            });
-            if ( 0 == any_checked ) {
-
 $("#apply-change-image_fstypes").attr("disabled","disabled");
-                $('#fstypes-error-message').show();
-            }
-            else {
-                $("#apply-change-image_fstypes").removeAttr("disabled");
-                $('#fstypes-error-message').hide();
-            }
+          var valid_input = false;
+          var valid_checkboxes = false;
+          var anyChecked = $(".fs-checkbox-fstypes:checked").length;
+
+          /* No underscores allowed */
+          if (fsTypesInput.val().match(/\_/)) {
+            invalidCharsMsg.show();
+            fsTypesControl.addClass("error");
+            valid_input = false;
+          } else {
+            fsTypesControl.removeClass("error");
+            invalidCharsMsg.hide();
+            valid_input = true;
+          }
+
+          if (!anyChecked && !fsTypesInput.val()){
+            noFsType.show();
+            valid_checkboxes = false;
+          } else {
+            noFsType.hide();
+            valid_checkboxes = true;
+          }
+
+          if (valid_checkboxes == false || valid_input == false)
+            fsTypesApplyBtn.attr("disabled","disabled");
+          else
+            fsTypesApplyBtn.removeAttr("disabled");
        }
 
        // Preset or reset the Package Class checkbox labels
bitbake/lib/toaster/toastergui/templates/projectconf.html +17 -8
@@ -597,17 +636,37 @@
                }
            });
 
-            $('#apply-change-image_fstypes').click(function(){
-                // extract the selected fstypes and sort them
-                var fstypes_array = [];
-                var checkboxes =
 document.getElementsByClassName('fs-checkbox-fstypes');
-                $(".fs-checkbox-fstypes:checked").each(function(){
-                       fstypes_array.push($(this).val());
-                });
-                fstypes_array.sort();
+            fsTypesInput.on('input', function(){
+              enableFsTypesSave();
+            });
+
+            fsTypesApplyBtn.click(function(e){
+              e.preventDefault();
+
+              var fstypes = '';
+              // extract the selected fstypes and sort them
+              var fstypes_array = [];
+              var checkboxes =
 document.getElementsByClassName('fs-checkbox-fstypes');
+              $(".fs-checkbox-fstypes:checked").each(function(){
+                fstypes_array.push($(this).val());
+              });
+              fstypes_array.sort();
+
+              /* If we have a value in our enter own image type input

and it

bitbake/lib/toaster/toastergui/templates/projectconf.html +7 -0
+               * isn't already selected add it to the fstypes value
+               */
+               if (fsTypesInput.val()){
+                 var inputFsTypes = fsTypesInput.val().split(" ");
+
+                 for (var type in inputFsTypes){
+                   if (fstypes_array.indexOf(inputFsTypes[type].trim())

=== -1)

bitbake/lib/toaster/toastergui/templates/projectconf.html +5 -1
+                   {
+                     fstypes += inputFsTypes[type]+' ';
+                   }
+                 }
+               }
 
                // now make a string of them
-                var fstypes = '';
                for (var i = 0, length = fstypes_array.length; i <
length; i++) {
                    fstypes += fstypes_array[i] + ' ';
                }
bitbake/lib/toaster/toastergui/templates/projectconf.html +3 -1
@@ -620,6 +679,9 @@
                $("#change-image_fstypes-form").slideUp(function() {
                    $('#image_fstypes,
 #change-image_fstypes-icon').show();
                });
+
+
+              fsTypesInput.val("");
            });
            {% endif %}
 
--

2.5.0

Quoted 5 lines

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Signature · 3 lines
Elliot Smith
Software Engineer
Intel Open Source Technology Centre
#4 lore raw
In reply to Smith, Elliot
Quoted 13 lines · Elliot

On 24 November 2015 at 13:26, Barros Pena, Belen <[email protected] <mailto:[email protected]>> wrote:

On 23/11/2015 11:41, "[email protected] <mailto:[email protected]> on behalf of Michael Wood" <[email protected] <mailto:[email protected]> on behalf of [email protected] <mailto:[email protected]>> wrote:

>Add feature to the projectconf page to allow free form input of >IMAGE_FSTYPES. Sometimes a recipe can provide an IMAGE_FSTYPE that >isn't in the normal image_types class. So would need to be specified >manually.
>

Quoted 7 lines

>[YOCTO #7828]

This seems to address all the issues from v1. Getting rid the 'already selected' error message by not duplicating any values works well.

It works correctly, but there is one issue: if you enter an invalid string as the image type (e.g. btrfss) and want to correct it, there's no way to delete it from the list.

To remove custom added values, you just have to click edit and then press 'Save'.

Quoted 260 lines

Perhaps a button to set the list back to the defaults, or to remove any invalid types ("cleanup")?

Alternatively, add the user's custom image type to the checkbox list; if they uncheck it, is disappears from the list.

Elliot

    From my perspective, this is good to go.

    Thanks!

    Belén

    >
    >Signed-off-by: Michael Wood <[email protected]
    <mailto:[email protected]>>
    >---
    > .../toaster/toastergui/templates/projectconf.html  | 128
    >+++++++++++++++------
    > 1 file changed, 95 insertions(+), 33 deletions(-)
    >
    >diff --git
    a/bitbake/lib/toaster/toastergui/templates/projectconf.html
    >b/bitbake/lib/toaster/toastergui/templates/projectconf.html
    >index 30fd03e..13f9c66 100644
    >--- a/bitbake/lib/toaster/toastergui/templates/projectconf.html
    >+++ b/bitbake/lib/toaster/toastergui/templates/projectconf.html
    >@@ -36,18 +36,36 @@
    >                 <span class="js-config-var-name
    >js-config-var-managed-name">IMAGE_FSTYPES</span>
    >                 <i class="icon-question-sign get-help"
    title="Formats of
    >root file system images that you want to have created <br /><a
    >href='http://www.yoctoproject.org/docs/1.6.1/ref-manual/ref-manual.html#va
    >r-IMAGE_FSTYPES' target='_blank'>Read more in the manual</a>"></i>
    >             </dt>
    >-            <dd class="lead">
    >-                <span id="image_fstypes">{{fstypes}}</span>
    >-                <i class="icon-pencil"
    >id="change-image_fstypes-icon"></i>
    >-                <form id="change-image_fstypes-form"
    >style="display:none;">
    >-                    <input id="filter-image_fstypes" type="text"
    >placeholder="Search image types" class="span4">
    >-                    <div id="all-image_fstypes" class="scrolling">
    >+            <dd style="margin-bottom: 20px">
    >+              <span id="image_fstypes"
    class="lead">{{fstypes}}</span>
    >+              <i class="icon-pencil"
    id="change-image_fstypes-icon"></i>
    >+              <form id="change-image_fstypes-form"
    style="display:none;">
    >+                <label>Choose from known image types</label>
    >+                <input id="filter-image_fstypes" type="text"
    >placeholder="Search known image types" class="span4">
    >+                  <div id="all-image_fstypes" class="scrolling">
    >+                  </div>
    >+                  <div class="input-append">
    >+                    <span class="control-group"
    >id="fstypes-control-validation">
    >+                      <label>Enter your own image types
    >+                        <i data-original-title="You can enter
    more than
    >one image type, separated by a space" class="icon-question-sign
    get-help"
    >title=""></i>
    >+                      </label>
    >+                      <input type="text"
    id="new-image-fstype-input">
    >+
    >+                      </span>
    >                     </div>
    >-                    <span class="help-block"
    >id="fstypes-error-message">You must select at least one image
    type</span>
    >-                    <button id="apply-change-image_fstypes"
    >type="button" class="btn">Save</button>
    >-                    <button id="cancel-change-image_fstypes"
    >type="button" class="btn btn-link">Cancel</button>
    >-                </form>
    >-            </dd>
    >+                    <p style="display:none" class="error"
    >id="fstypes-error-message">
    >+                      You must select at least one image type.
    <br />
    >+                      Choose from the list of known ones or type
    your
    >own.
    >+                    </p>
    >+                    <p style="display:none" class="error"
    >id="invalid-chars-in-fstype-msg">
    >+                      A valid image type cannot include underscores.
    >+                    </p>
    >+                    <div>
    >+                      <button id="apply-change-image_fstypes"
    >type="button" class="btn">Save</button>
    >+                      <button id="cancel-change-image_fstypes"
    >type="button" class="btn btn-link">Cancel</button>
    >+                    </div>
    >+                  </form>
    >+                </dd>
    >             {% endif %}
    >
    >             {% if image_install_append_defined %}
    >@@ -305,20 +323,41 @@
    >             return true;
    >         }
    >
    >-        // Test to insure at least one FS Type is checked
    >+        var fsTypesInput = $("#new-image-fstype-input");
    >+        var invalidCharsMsg = $("#invalid-chars-in-fstype-msg");
    >+        var fsTypesControl = $("#fstypes-control-validation");
    >+        var noFsType = $('#fstypes-error-message');
    >+        var fsTypesApplyBtn = $("#apply-change-image_fstypes");
    >+
    >+        /* Validation of fstypes */
    >         function enableFsTypesSave() {
    >-            var any_checked = 0;
    >- $(".fs-checkbox-fstypes:checked").each(function(){
    >-                any_checked = 1;
    >-            });
    >-            if ( 0 == any_checked ) {
    >-
    >$("#apply-change-image_fstypes").attr("disabled","disabled");
    >- $('#fstypes-error-message').show();
    >-            }
    >-            else {
    >- $("#apply-change-image_fstypes").removeAttr("disabled");
    >- $('#fstypes-error-message').hide();
    >-            }
    >+          var valid_input = false;
    >+          var valid_checkboxes = false;
    >+          var anyChecked = $(".fs-checkbox-fstypes:checked").length;
    >+
    >+          /* No underscores allowed */
    >+          if (fsTypesInput.val().match(/\_/)) {
    >+            invalidCharsMsg.show();
    >+            fsTypesControl.addClass("error");
    >+            valid_input = false;
    >+          } else {
    >+            fsTypesControl.removeClass("error");
    >+            invalidCharsMsg.hide();
    >+            valid_input = true;
    >+          }
    >+
    >+          if (!anyChecked && !fsTypesInput.val()){
    >+            noFsType.show();
    >+            valid_checkboxes = false;
    >+          } else {
    >+            noFsType.hide();
    >+            valid_checkboxes = true;
    >+          }
    >+
    >+          if (valid_checkboxes == false || valid_input == false)
    >+ fsTypesApplyBtn.attr("disabled","disabled");
    >+          else
    >+ fsTypesApplyBtn.removeAttr("disabled");
    >         }
    >
    >         // Preset or reset the Package Class checkbox labels
    >@@ -597,17 +636,37 @@
    >                 }
    >             });
    >
    >- $('#apply-change-image_fstypes').click(function(){
    >-                // extract the selected fstypes and sort them
    >-                var fstypes_array = [];
    >-                var checkboxes =
    >document.getElementsByClassName('fs-checkbox-fstypes');
    >- $(".fs-checkbox-fstypes:checked").each(function(){
    >-  fstypes_array.push($(this).val());
    >-                });
    >-                fstypes_array.sort();
    >+            fsTypesInput.on('input', function(){
    >+              enableFsTypesSave();
    >+            });
    >+
    >+            fsTypesApplyBtn.click(function(e){
    >+              e.preventDefault();
    >+
    >+              var fstypes = '';
    >+              // extract the selected fstypes and sort them
    >+              var fstypes_array = [];
    >+              var checkboxes =
    >document.getElementsByClassName('fs-checkbox-fstypes');
    >+ $(".fs-checkbox-fstypes:checked").each(function(){
    >+ fstypes_array.push($(this).val());
    >+              });
    >+              fstypes_array.sort();
    >+
    >+              /* If we have a value in our enter own image type
    input
    >and it
    >+               * isn't already selected add it to the fstypes value
    >+               */
    >+               if (fsTypesInput.val()){
    >+                 var inputFsTypes = fsTypesInput.val().split(" ");
    >+
    >+                 for (var type in inputFsTypes){
    >+                   if
    (fstypes_array.indexOf(inputFsTypes[type].trim())
    >=== -1)
    >+                   {
    >+                     fstypes += inputFsTypes[type]+' ';
    >+                   }
    >+                 }
    >+               }
    >
    >                 // now make a string of them
    >-                var fstypes = '';
    >                 for (var i = 0, length = fstypes_array.length; i <
    >length; i++) {
    >                     fstypes += fstypes_array[i] + ' ';
    >                 }
    >@@ -620,6 +679,9 @@
    >  $("#change-image_fstypes-form").slideUp(function() {
    >                     $('#image_fstypes,
    >#change-image_fstypes-icon').show();
    >                 });
    >+
    >+
    >+              fsTypesInput.val("");
    >             });
    >             {% endif %}
    >
    >--
    >2.5.0
    >
    >--
    >_______________________________________________
    >toaster mailing list
    >[email protected] <mailto:[email protected]>
    >https://lists.yoctoproject.org/listinfo/toaster

    --
    _______________________________________________
    toaster mailing list
    [email protected] <mailto:[email protected]>
    https://lists.yoctoproject.org/listinfo/toaster
Signature · 14 lines
Elliot Smith
Software Engineer
Intel Open Source Technology Centre

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#5 lore raw
Quoted 24 lines · Michael Wood
Quoted 23 lines · Elliot

On 24 November 2015 at 13:26, Barros Pena, Belen <[email protected] <mailto:[email protected]>> wrote:

On 23/11/2015 11:41, "[email protected] <mailto:[email protected]> on behalf of Michael Wood" <[email protected] <mailto:[email protected]> on behalf of [email protected] <mailto:[email protected]>> wrote:

>Add feature to the projectconf page to allow free form input of >IMAGE_FSTYPES. Sometimes a recipe can provide an IMAGE_FSTYPE that >isn't in the normal image_types class. So would need to be
specified

Quoted 3 lines

manually.

[YOCTO #7828]

This seems to address all the issues from v1. Getting rid the
'already
selected' error message by not duplicating any values works well.

Quoted 6 lines
Quoted 3 lines

It works correctly, but there is one issue: if you enter an invalid string as the image type (e.g. btrfss) and want to correct it, there's no way to delete it from the list.

To remove custom added values, you just have to click edit and then press 'Save'.

The fact that Elliot couldn't work it out I think tells us something. We shouldn't leave it that way :/

Quoted 269 lines
Quoted 268 lines

Perhaps a button to set the list back to the defaults, or to remove any invalid types ("cleanup")?

Alternatively, add the user's custom image type to the checkbox list; if they uncheck it, is disappears from the list.

Elliot

    From my perspective, this is good to go.

    Thanks!

    Belén

    >
    >Signed-off-by: Michael Wood <[email protected]
    <mailto:[email protected]>>
    >---
    > .../toaster/toastergui/templates/projectconf.html  | 128
    >+++++++++++++++------
    > 1 file changed, 95 insertions(+), 33 deletions(-)
    >
    >diff --git
    a/bitbake/lib/toaster/toastergui/templates/projectconf.html
    >b/bitbake/lib/toaster/toastergui/templates/projectconf.html
    >index 30fd03e..13f9c66 100644
    >--- a/bitbake/lib/toaster/toastergui/templates/projectconf.html
    >+++ b/bitbake/lib/toaster/toastergui/templates/projectconf.html
    >@@ -36,18 +36,36 @@
    >                 <span class="js-config-var-name
    >js-config-var-managed-name">IMAGE_FSTYPES</span>
    >                 <i class="icon-question-sign get-help"
    title="Formats of
    >root file system images that you want to have created <br /><a
Quoted 12 lines

href='http://www.yoctoproject.org/docs/1.6.1/ref-manual/ref-manual.html# va
r-IMAGE_FSTYPES' target='_blank'>Read more in the manual</a>"></i>

            </dt>
bitbake/lib/toaster/toastergui/templates/projectconf.html +0 -3
-            <dd class="lead">
-                <span id="image_fstypes">{{fstypes}}</span>
-                <i class="icon-pencil"

id="change-image_fstypes-icon"></i>
- <form id="change-image_fstypes-form"
style="display:none;">
- <input id="filter-image_fstypes" type="text"
placeholder="Search image types" class="span4">

bitbake/lib/toaster/toastergui/templates/projectconf.html

Quoted 3 lines
bitbake/lib/toaster/toastergui/templates/projectconf.html +2 -1
-                    <div id="all-image_fstypes" class="scrolling">
+            <dd style="margin-bottom: 20px">
+              <span id="image_fstypes"

class="lead">{{fstypes}}</span>
>+ <i class="icon-pencil"
id="change-image_fstypes-icon"></i>
>+ <form id="change-image_fstypes-form"
style="display:none;">
>+ <label>Choose from known image types</label>
>+ <input id="filter-image_fstypes" type="text"
>placeholder="Search known image types" class="span4">
>+ <div id="all-image_fstypes" class="scrolling">
>+ </div>
>+ <div class="input-append">
>+ <span class="control-group"
>id="fstypes-control-validation">
>+ <label>Enter your own image types
>+ <i data-original-title="You can enter
more than
>one image type, separated by a space" class="icon-question-sign get-help"
>title=""></i>
>+ </label>
>+ <input type="text"
id="new-image-fstype-input">
>+
>+ </span>
> </div>
>- <span class="help-block"
>id="fstypes-error-message">You must select at least one image type</span>
>- <button id="apply-change-image_fstypes"
>type="button" class="btn">Save</button>
>- <button id="cancel-change-image_fstypes"
>type="button" class="btn btn-link">Cancel</button>
>- </form>
>- </dd>
>+ <p style="display:none" class="error"
>id="fstypes-error-message">
>+ You must select at least one image type.
<br />
>+ Choose from the list of known ones or type
your
>own.
>+ </p>
>+ <p style="display:none" class="error"
>id="invalid-chars-in-fstype-msg">
>+ A valid image type cannot include
underscores.

Quoted 31 lines
bitbake/lib/toaster/toastergui/templates/projectconf.html +3 -0
+                    </p>
+                    <div>
+                      <button id="apply-change-image_fstypes"

type="button" class="btn">Save</button>
+ <button id="cancel-change-image_fstypes"
type="button" class="btn btn-link">Cancel</button>

bitbake/lib/toaster/toastergui/templates/projectconf.html +10 -7
+                    </div>
+                  </form>
+                </dd>
            {% endif %}
 
            {% if image_install_append_defined %}
@@ -305,20 +323,41 @@
            return true;
        }
 
-        // Test to insure at least one FS Type is checked
+        var fsTypesInput = $("#new-image-fstype-input");
+        var invalidCharsMsg = $("#invalid-chars-in-fstype-msg");
+        var fsTypesControl = $("#fstypes-control-validation");
+        var noFsType = $('#fstypes-error-message');
+        var fsTypesApplyBtn = $("#apply-change-image_fstypes");
+
+        /* Validation of fstypes */
        function enableFsTypesSave() {
-            var any_checked = 0;
- $(".fs-checkbox-fstypes:checked").each(function(){
-                any_checked = 1;
-            });
-            if ( 0 == any_checked ) {
-

bitbake/lib/toaster/toastergui/templates/projectconf.html line 337

Quoted 10 lines
bitbake/lib/toaster/toastergui/templates/projectconf.html +3 -6
 $("#apply-change-image_fstypes").attr("disabled","disabled");
- $('#fstypes-error-message').show();
-            }
-            else {
- $("#apply-change-image_fstypes").removeAttr("disabled");
- $('#fstypes-error-message').hide();
-            }
+          var valid_input = false;
+          var valid_checkboxes = false;
+          var anyChecked =
$(".fs-checkbox-fstypes:checked").length;
    >+
    >+          /* No underscores allowed */
    >+          if (fsTypesInput.val().match(/\_/)) {
    >+            invalidCharsMsg.show();
    >+            fsTypesControl.addClass("error");
    >+            valid_input = false;
    >+          } else {
    >+            fsTypesControl.removeClass("error");
    >+            invalidCharsMsg.hide();
    >+            valid_input = true;
    >+          }
    >+
    >+          if (!anyChecked && !fsTypesInput.val()){
    >+            noFsType.show();
    >+            valid_checkboxes = false;
    >+          } else {
    >+            noFsType.hide();
    >+            valid_checkboxes = true;
    >+          }
    >+
    >+          if (valid_checkboxes == false || valid_input == false)
    >+ fsTypesApplyBtn.attr("disabled","disabled");
    >+          else
    >+ fsTypesApplyBtn.removeAttr("disabled");
    >         }
    >
    >         // Preset or reset the Package Class checkbox labels
    >@@ -597,17 +636,37 @@
    >                 }
    >             });
    >
    >- $('#apply-change-image_fstypes').click(function(){
    >-                // extract the selected fstypes and sort them
    >-                var fstypes_array = [];
    >-                var checkboxes =
    >document.getElementsByClassName('fs-checkbox-fstypes');
    >- $(".fs-checkbox-fstypes:checked").each(function(){
    >-  fstypes_array.push($(this).val());
    >-                });
    >-                fstypes_array.sort();
    >+            fsTypesInput.on('input', function(){
    >+              enableFsTypesSave();
    >+            });
    >+
    >+            fsTypesApplyBtn.click(function(e){
    >+              e.preventDefault();
    >+
    >+              var fstypes = '';
    >+              // extract the selected fstypes and sort them
    >+              var fstypes_array = [];
    >+              var checkboxes =
    >document.getElementsByClassName('fs-checkbox-fstypes');
    >+ $(".fs-checkbox-fstypes:checked").each(function(){
    >+ fstypes_array.push($(this).val());
    >+              });
    >+              fstypes_array.sort();
    >+
    >+              /* If we have a value in our enter own image type
    input
    >and it
    >+               * isn't already selected add it to the fstypes

value

bitbake/lib/toaster/toastergui/templates/projectconf.html

Quoted 6 lines
bitbake/lib/toaster/toastergui/templates/projectconf.html +6 -0
+               */
+               if (fsTypesInput.val()){
+                 var inputFsTypes = fsTypesInput.val().split(" ");
+
+                 for (var type in inputFsTypes){
+                   if
    (fstypes_array.indexOf(inputFsTypes[type].trim())
    >=== -1)
    >+                   {
    >+                     fstypes += inputFsTypes[type]+' ';
    >+                   }
    >+                 }
    >+               }
    >
    >                 // now make a string of them
    >-                var fstypes = '';
    >                 for (var i = 0, length = fstypes_array.length; i <
    >length; i++) {
    >                     fstypes += fstypes_array[i] + ' ';
    >                 }
    >@@ -620,6 +679,9 @@
    >  $("#change-image_fstypes-form").slideUp(function() {
    >                     $('#image_fstypes,
    >#change-image_fstypes-icon').show();
    >                 });
    >+
    >+
    >+              fsTypesInput.val("");
    >             });
    >             {% endif %}
    >
    >--
    >2.5.0
    >
    >--
    >_______________________________________________
    >toaster mailing list
    >[email protected] <mailto:[email protected]>
    >https://lists.yoctoproject.org/listinfo/toaster

    --
    _______________________________________________
    toaster mailing list
    [email protected] <mailto:[email protected]>
    https://lists.yoctoproject.org/listinfo/toaster
Signature · 14 lines
Elliot Smith
Software Engineer
Intel Open Source Technology Centre

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#6 lore raw

Sorry for the huge delay on this. A new design now attached to the Bugzilla entry

https://bugzilla.yoctoproject.org/show_bug.cgi?id=7828

Let me know what you think.

Belén

Quoted 317 lines · Belen
Quoted 24 lines · Michael Wood
Quoted 23 lines · Elliot

On 24 November 2015 at 13:26, Barros Pena, Belen <[email protected] <mailto:[email protected]>> wrote:

On 23/11/2015 11:41, "[email protected] <mailto:[email protected]> on behalf of Michael Wood" <[email protected] <mailto:[email protected]> on behalf of [email protected] <mailto:[email protected]>> wrote:

>Add feature to the projectconf page to allow free form input of >IMAGE_FSTYPES. Sometimes a recipe can provide an IMAGE_FSTYPE that >isn't in the normal image_types class. So would need to be
specified

Quoted 3 lines

manually.

[YOCTO #7828]

This seems to address all the issues from v1. Getting rid the
'already
selected' error message by not duplicating any values works well.

Quoted 6 lines
Quoted 3 lines

It works correctly, but there is one issue: if you enter an invalid string as the image type (e.g. btrfss) and want to correct it, there's no way to delete it from the list.

To remove custom added values, you just have to click edit and then press 'Save'.

The fact that Elliot couldn't work it out I think tells us something. We shouldn't leave it that way :/

Quoted 273 lines
Quoted 272 lines

Perhaps a button to set the list back to the defaults, or to remove any invalid types ("cleanup")?

Alternatively, add the user's custom image type to the checkbox list; if they uncheck it, is disappears from the list.

Elliot

    From my perspective, this is good to go.

    Thanks!

    Belén

    >
    >Signed-off-by: Michael Wood <[email protected]
    <mailto:[email protected]>>
    >---
    > .../toaster/toastergui/templates/projectconf.html  | 128
    >+++++++++++++++------
    > 1 file changed, 95 insertions(+), 33 deletions(-)
    >
    >diff --git
    a/bitbake/lib/toaster/toastergui/templates/projectconf.html
    >b/bitbake/lib/toaster/toastergui/templates/projectconf.html
    >index 30fd03e..13f9c66 100644
    >--- a/bitbake/lib/toaster/toastergui/templates/projectconf.html
    >+++ b/bitbake/lib/toaster/toastergui/templates/projectconf.html
    >@@ -36,18 +36,36 @@
    >                 <span class="js-config-var-name
    >js-config-var-managed-name">IMAGE_FSTYPES</span>
    >                 <i class="icon-question-sign get-help"
    title="Formats of
    >root file system images that you want to have created <br /><a
Quoted 8 lines

href='http://www.yoctoproject.org/docs/1.6.1/ref-manual/ref-manual.html #
va
r-IMAGE_FSTYPES' target='_blank'>Read more in the manual</a>"></i>

            </dt>
bitbake/lib/toaster/toastergui/templates/projectconf.html +0 -3
-            <dd class="lead">
-                <span id="image_fstypes">{{fstypes}}</span>
-                <i class="icon-pencil"
Quoted 6 lines

id="change-image_fstypes-icon"></i>
- <form id="change-image_fstypes-form"
style="display:none;">
- <input id="filter-image_fstypes" type="text"
placeholder="Search image types" class="span4">
- <div id="all-image_fstypes"

class="scrolling">

Review

Quoted 2 lines
(quoted diff) +2 -0
+            <dd style="margin-bottom: 20px">
+              <span id="image_fstypes"

class="lead">{{fstypes}}</span>
>+ <i class="icon-pencil"
id="change-image_fstypes-icon"></i>
>+ <form id="change-image_fstypes-form"
style="display:none;">
>+ <label>Choose from known image types</label>
>+ <input id="filter-image_fstypes" type="text"
>placeholder="Search known image types" class="span4">
>+ <div id="all-image_fstypes" class="scrolling">
>+ </div>
>+ <div class="input-append">
>+ <span class="control-group"
>id="fstypes-control-validation">
>+ <label>Enter your own image types
>+ <i data-original-title="You can enter
more than
>one image type, separated by a space" class="icon-question-sign get-help"
>title=""></i>
>+ </label>
>+ <input type="text"
id="new-image-fstype-input">
>+
>+ </span>
> </div>
>- <span class="help-block"
>id="fstypes-error-message">You must select at least one image type</span>
>- <button id="apply-change-image_fstypes"
>type="button" class="btn">Save</button>
>- <button id="cancel-change-image_fstypes"
>type="button" class="btn btn-link">Cancel</button>
>- </form>
>- </dd>
>+ <p style="display:none" class="error"
>id="fstypes-error-message">
>+ You must select at least one image type.
<br />
>+ Choose from the list of known ones or type
your
>own.
>+ </p>
>+ <p style="display:none" class="error"
>id="invalid-chars-in-fstype-msg">
>+ A valid image type cannot include
underscores.

Quoted 31 lines
bitbake/lib/toaster/toastergui/templates/projectconf.html +3 -0
+                    </p>
+                    <div>
+                      <button id="apply-change-image_fstypes"

type="button" class="btn">Save</button>
+ <button id="cancel-change-image_fstypes"
type="button" class="btn btn-link">Cancel</button>

bitbake/lib/toaster/toastergui/templates/projectconf.html +10 -7
+                    </div>
+                  </form>
+                </dd>
            {% endif %}
 
            {% if image_install_append_defined %}
@@ -305,20 +323,41 @@
            return true;
        }
 
-        // Test to insure at least one FS Type is checked
+        var fsTypesInput = $("#new-image-fstype-input");
+        var invalidCharsMsg = $("#invalid-chars-in-fstype-msg");
+        var fsTypesControl = $("#fstypes-control-validation");
+        var noFsType = $('#fstypes-error-message');
+        var fsTypesApplyBtn = $("#apply-change-image_fstypes");
+
+        /* Validation of fstypes */
        function enableFsTypesSave() {
-            var any_checked = 0;
- $(".fs-checkbox-fstypes:checked").each(function(){
-                any_checked = 1;
-            });
-            if ( 0 == any_checked ) {
-

bitbake/lib/toaster/toastergui/templates/projectconf.html line 337

Quoted 10 lines
bitbake/lib/toaster/toastergui/templates/projectconf.html +3 -6
 $("#apply-change-image_fstypes").attr("disabled","disabled");
- $('#fstypes-error-message').show();
-            }
-            else {
- $("#apply-change-image_fstypes").removeAttr("disabled");
- $('#fstypes-error-message').hide();
-            }
+          var valid_input = false;
+          var valid_checkboxes = false;
+          var anyChecked =
$(".fs-checkbox-fstypes:checked").length;
    >+
    >+          /* No underscores allowed */
    >+          if (fsTypesInput.val().match(/\_/)) {
    >+            invalidCharsMsg.show();
    >+            fsTypesControl.addClass("error");
    >+            valid_input = false;
    >+          } else {
    >+            fsTypesControl.removeClass("error");
    >+            invalidCharsMsg.hide();
    >+            valid_input = true;
    >+          }
    >+
    >+          if (!anyChecked && !fsTypesInput.val()){
    >+            noFsType.show();
    >+            valid_checkboxes = false;
    >+          } else {
    >+            noFsType.hide();
    >+            valid_checkboxes = true;
    >+          }
    >+
    >+          if (valid_checkboxes == false || valid_input == false)
    >+ fsTypesApplyBtn.attr("disabled","disabled");
    >+          else
    >+ fsTypesApplyBtn.removeAttr("disabled");
    >         }
    >
    >         // Preset or reset the Package Class checkbox labels
    >@@ -597,17 +636,37 @@
    >                 }
    >             });
    >
    >- $('#apply-change-image_fstypes').click(function(){
    >-                // extract the selected fstypes and sort them
    >-                var fstypes_array = [];
    >-                var checkboxes =
    >document.getElementsByClassName('fs-checkbox-fstypes');
    >- $(".fs-checkbox-fstypes:checked").each(function(){
    >-  fstypes_array.push($(this).val());
    >-                });
    >-                fstypes_array.sort();
    >+            fsTypesInput.on('input', function(){
    >+              enableFsTypesSave();
    >+            });
    >+
    >+            fsTypesApplyBtn.click(function(e){
    >+              e.preventDefault();
    >+
    >+              var fstypes = '';
    >+              // extract the selected fstypes and sort them
    >+              var fstypes_array = [];
    >+              var checkboxes =
    >document.getElementsByClassName('fs-checkbox-fstypes');
    >+ $(".fs-checkbox-fstypes:checked").each(function(){
    >+ fstypes_array.push($(this).val());
    >+              });
    >+              fstypes_array.sort();
    >+
    >+              /* If we have a value in our enter own image type
    input
    >and it
    >+               * isn't already selected add it to the fstypes

value

bitbake/lib/toaster/toastergui/templates/projectconf.html

Quoted 3 lines
bitbake/lib/toaster/toastergui/templates/projectconf.html +3 -0
+               */
+               if (fsTypesInput.val()){
+                 var inputFsTypes = fsTypesInput.val().split("
");
    >+
    >+                 for (var type in inputFsTypes){
    >+                   if
    (fstypes_array.indexOf(inputFsTypes[type].trim())
    >=== -1)
    >+                   {
    >+                     fstypes += inputFsTypes[type]+' ';
    >+                   }
    >+                 }
    >+               }
    >
    >                 // now make a string of them
    >-                var fstypes = '';
    >                 for (var i = 0, length = fstypes_array.length; i

<

Quoted 17 lines
bitbake/lib/toaster/toastergui/templates/projectconf.html +3 -1
 length; i++) {
                    fstypes += fstypes_array[i] + ' ';
                }
@@ -620,6 +679,9 @@
 $("#change-image_fstypes-form").slideUp(function() {
                    $('#image_fstypes,
 #change-image_fstypes-icon').show();
                });
+
+
+              fsTypesInput.val("");
            });
            {% endif %}
 
--

2.5.0

Quoted 5 lines

--
_______________________________________________
toaster mailing list
[email protected] <mailto:[email protected]>
https://lists.yoctoproject.org/listinfo/toaster

    --
    _______________________________________________
    toaster mailing list
    [email protected] <mailto:[email protected]>
    https://lists.yoctoproject.org/listinfo/toaster
Signature · 14 lines
Elliot Smith
Software Engineer
Intel Open Source Technology Centre

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
Signature · 4 lines
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster