diff options
-rw-r--r-- | bitbake/lib/toaster/toastergui/templates/projectconf.html | 71 |
1 files changed, 49 insertions, 22 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/projectconf.html b/bitbake/lib/toaster/toastergui/templates/projectconf.html index 9a8b841037..c3ed216194 100644 --- a/bitbake/lib/toaster/toastergui/templates/projectconf.html +++ b/bitbake/lib/toaster/toastergui/templates/projectconf.html | |||
@@ -41,7 +41,8 @@ | |||
41 | </div> | 41 | </div> |
42 | <button id="apply-change-dl_dir" class="btn btn-default" type="button">Save</button> | 42 | <button id="apply-change-dl_dir" class="btn btn-default" type="button">Save</button> |
43 | <button id="cancel-change-dl_dir" type="button" class="btn btn-link">Cancel</button> | 43 | <button id="cancel-change-dl_dir" type="button" class="btn btn-link">Cancel</button> |
44 | <p class="help-block" id="hintError-dl_dir">A valid directory cannot include spaces or any of these characters: . \ ? % * : | " " < ></p> | 44 | <p class="help-block" id="hintError-dl_dir" style="display:none;">The directory path cannot include spaces or any of these characters: . \ ? % * : | " " < ></p> |
45 | <p class="help-block" id="hintError-initialChar-dl_dir" style="display:none;">The directory path should either start with a /, e.g. /home/toaster/downloads; or with a variable, e.g. ${TOPDIR}/downloads.</p> | ||
45 | </form> | 46 | </form> |
46 | </dd> | 47 | </dd> |
47 | {% endif %} | 48 | {% endif %} |
@@ -88,7 +89,7 @@ | |||
88 | <input type="text" class="form-control" id="new-image_install" placeholder="Type one or more package names"> | 89 | <input type="text" class="form-control" id="new-image_install" placeholder="Type one or more package names"> |
89 | </div> | 90 | </div> |
90 | <button id="apply-change-image_install" class="btn btn-default" type="button">Save</button> | 91 | <button id="apply-change-image_install" class="btn btn-default" type="button">Save</button> |
91 | <button id="cancel-change-image_install" type="button" class="btn btn-link">Cancel</button> | 92 | <button id="cancel-change-image_install" type="button" class="btn btn-link">Cancel</button> |
92 | </form> | 93 | </form> |
93 | </dd> | 94 | </dd> |
94 | {% endif %} | 95 | {% endif %} |
@@ -149,7 +150,8 @@ | |||
149 | </div> | 150 | </div> |
150 | <button id="apply-change-sstate_dir" class="btn btn-default" type="button">Save</button> | 151 | <button id="apply-change-sstate_dir" class="btn btn-default" type="button">Save</button> |
151 | <button id="cancel-change-sstate_dir" type="button" class="btn btn-link">Cancel</button> | 152 | <button id="cancel-change-sstate_dir" type="button" class="btn btn-link">Cancel</button> |
152 | <p class="help-block" id="hintError-sstate_dir">A valid directory cannot include spaces or any of these characters: . \ ? % * : | " " < ></p> | 153 | <p class="help-block" id="hintError-sstate_dir" style="display:none;">The directory path cannot include spaces or any of these characters: . \ ? % * : | " " < ></p> |
154 | <p class="help-block" id="hintError-initialChar-sstate_dir" style="display:none;">The directory path should either start with a /, e.g. /home/toaster/sstate-cache; or with a variable, e.g. ${TOPDIR}/sstate-cache.</p> | ||
153 | </form> | 155 | </form> |
154 | </dd> | 156 | </dd> |
155 | {% endif %} | 157 | {% endif %} |
@@ -368,8 +370,8 @@ function setEventHandlersForDynamicElements() { | |||
368 | $("#new-config_var_"+pk).val(current_val); | 370 | $("#new-config_var_"+pk).val(current_val); |
369 | if ( $("#new-config_var_"+pk).val().length ) { | 371 | if ( $("#new-config_var_"+pk).val().length ) { |
370 | $("#apply-change-config_var_"+pk).removeAttr("disabled"); | 372 | $("#apply-change-config_var_"+pk).removeAttr("disabled"); |
371 | } | 373 | } |
372 | else { | 374 | else { |
373 | $("#apply-change-config_var_"+pk).attr("disabled"); | 375 | $("#apply-change-config_var_"+pk).attr("disabled"); |
374 | } | 376 | } |
375 | }); | 377 | }); |
@@ -409,7 +411,7 @@ function setEventHandlersForDynamicElements() { | |||
409 | var pk = $(this).attr("x-data"); | 411 | var pk = $(this).attr("x-data"); |
410 | 412 | ||
411 | // fade out the variable+value div, then refresh the variable list | 413 | // fade out the variable+value div, then refresh the variable list |
412 | $(this).fadeOut(); | 414 | $(this).fadeOut(); |
413 | $(this).tooltip("hide"); | 415 | $(this).tooltip("hide"); |
414 | $("config_var_entry_"+pk).fadeOut(); | 416 | $("config_var_entry_"+pk).fadeOut(); |
415 | $('#config_var_value_'+pk).parent("dd").fadeOut(); | 417 | $('#config_var_value_'+pk).parent("dd").fadeOut(); |
@@ -552,7 +554,6 @@ $(document).ready(function() { | |||
552 | 554 | ||
553 | // change DL_DIR variable | 555 | // change DL_DIR variable |
554 | $('#change-dl_dir-icon').click(function() { | 556 | $('#change-dl_dir-icon').click(function() { |
555 | $('#hintError-dl_dir').hide(); | ||
556 | $('#change-dl_dir-form').removeClass('has-error'); | 557 | $('#change-dl_dir-form').removeClass('has-error'); |
557 | // preset the edit value | 558 | // preset the edit value |
558 | var current_val = $("#dl_dir").text().trim(); | 559 | var current_val = $("#dl_dir").text().trim(); |
@@ -574,6 +575,8 @@ $(document).ready(function() { | |||
574 | }); | 575 | }); |
575 | 576 | ||
576 | $('#cancel-change-dl_dir').click(function(){ | 577 | $('#cancel-change-dl_dir').click(function(){ |
578 | $("#hintError-dl_dir").hide(); | ||
579 | $("#hintError-initialChar-dl_dir").hide(); | ||
577 | $("#change-dl_dir-form").slideUp(function() { | 580 | $("#change-dl_dir-form").slideUp(function() { |
578 | $('#dl_dir, #change-dl_dir-icon').show(); | 581 | $('#dl_dir, #change-dl_dir-icon').show(); |
579 | }); | 582 | }); |
@@ -582,20 +585,31 @@ $(document).ready(function() { | |||
582 | $("#new-dl_dir").on('input', function(){ | 585 | $("#new-dl_dir").on('input', function(){ |
583 | if ($(this).val().trim().length == 0) { | 586 | if ($(this).val().trim().length == 0) { |
584 | $("#apply-change-dl_dir").attr("disabled","disabled"); | 587 | $("#apply-change-dl_dir").attr("disabled","disabled"); |
588 | $('#change-dl_dir-form').addClass('has-error'); | ||
589 | $('#hintError-dl_dir').hide(); | ||
590 | $('#hintError-initialChar-dl_dir').hide(); | ||
585 | } | 591 | } |
586 | else { | 592 | else { |
587 | var input = $(this); | 593 | var input = $(this); |
588 | var re = /^\/([^ <>\\|":\.%\?\*]+)$/; | 594 | var reBeginWithSlash = /^\//; |
595 | var reCheckVariable = /^\$/; | ||
596 | var re = /([ <>\\|":\.%\?\*]+)/; | ||
589 | var invalidDir = re.test(input.val()); | 597 | var invalidDir = re.test(input.val()); |
590 | console.log(invalidDir); | 598 | var invalidSlash = reBeginWithSlash.test(input.val()); |
591 | if ( invalidDir ) { | 599 | var invalidVar = reCheckVariable.test(input.val()); |
592 | $('#change-dl_dir-form').removeClass('has-error'); | 600 | if (!invalidSlash && !invalidVar) { |
593 | $("#apply-change-dl_dir").removeAttr("disabled"); | 601 | $('#change-dl_dir-form').addClass('has-error'); |
594 | $('#hintError-dl_dir').hide(); | 602 | $("#apply-change-dl_dir").attr("disabled","disabled"); |
595 | } else { | 603 | $('#hintError-initialChar-dl_dir').show(); |
604 | } else if (invalidDir) { | ||
596 | $('#change-dl_dir-form').addClass('has-error'); | 605 | $('#change-dl_dir-form').addClass('has-error'); |
597 | $("#apply-change-dl_dir").attr("disabled","disabled"); | 606 | $("#apply-change-dl_dir").attr("disabled","disabled"); |
598 | $('#hintError-dl_dir').show(); | 607 | $('#hintError-dl_dir').show(); |
608 | } else { | ||
609 | $('#change-dl_dir-form').removeClass('has-error'); | ||
610 | $("#apply-change-dl_dir").removeAttr("disabled"); | ||
611 | $('#hintError-dl_dir').hide(); | ||
612 | $('#hintError-initialChar-dl_dir').hide(); | ||
599 | } | 613 | } |
600 | } | 614 | } |
601 | }); | 615 | }); |
@@ -904,7 +918,7 @@ $(document).ready(function() { | |||
904 | 918 | ||
905 | // change SSTATE_DIR variable | 919 | // change SSTATE_DIR variable |
906 | $('#change-sstate_dir-icon').click(function() { | 920 | $('#change-sstate_dir-icon').click(function() { |
907 | $('#hintError-sstate_dir').hide(); | 921 | $('#change-sstate_dir-form').removeClass('has-error'); |
908 | // preset the edit value | 922 | // preset the edit value |
909 | var current_val = $("span#sstate_dir").text().trim(); | 923 | var current_val = $("span#sstate_dir").text().trim(); |
910 | if (current_val == "Not set") { | 924 | if (current_val == "Not set") { |
@@ -926,6 +940,8 @@ $(document).ready(function() { | |||
926 | }); | 940 | }); |
927 | 941 | ||
928 | $('#cancel-change-sstate_dir').click(function(){ | 942 | $('#cancel-change-sstate_dir').click(function(){ |
943 | $("#hintError-sstate_dir").hide(); | ||
944 | $("#hintError-initialChar-sstate_dir").hide(); | ||
929 | $("#change-sstate_dir-form").slideUp(function() { | 945 | $("#change-sstate_dir-form").slideUp(function() { |
930 | $('#sstate_dir, #change-sstate_dir-icon').show(); | 946 | $('#sstate_dir, #change-sstate_dir-icon').show(); |
931 | }); | 947 | }); |
@@ -934,20 +950,31 @@ $(document).ready(function() { | |||
934 | $("#new-sstate_dir").on('input', function(){ | 950 | $("#new-sstate_dir").on('input', function(){ |
935 | if ($(this).val().trim().length == 0) { | 951 | if ($(this).val().trim().length == 0) { |
936 | $("#apply-change-sstate_dir").attr("disabled","disabled"); | 952 | $("#apply-change-sstate_dir").attr("disabled","disabled"); |
953 | $('#change-sstate_dir-form').addClass('has-error'); | ||
954 | $('#hintError-sstate_dir').hide(); | ||
955 | $('#hintError-initialChar-sstate_dir').hide(); | ||
937 | } | 956 | } |
938 | else { | 957 | else { |
939 | var input = $(this); | 958 | var input = $(this); |
940 | var re = /^\/([^ <>\\|":\.%\?\*]+)$/; | 959 | var reBeginWithSlash = /^\//; |
960 | var reCheckVariable = /^\$/; | ||
961 | var re = /([ <>\\|":\.%\?\*]+)/; | ||
941 | var invalidDir = re.test(input.val()); | 962 | var invalidDir = re.test(input.val()); |
942 | console.log(invalidDir); | 963 | var invalidSlash = reBeginWithSlash.test(input.val()); |
943 | if ( invalidDir ) { | 964 | var invalidVar = reCheckVariable.test(input.val()); |
965 | if (!invalidSlash && !invalidVar) { | ||
966 | $('#change-sstate_dir-form').addClass('has-error'); | ||
967 | $("#apply-change-sstate_dir").attr("disabled","disabled"); | ||
968 | $('#hintError-initialChar-sstate_dir').show(); | ||
969 | } else if (invalidDir) { | ||
970 | $('#change-sstate_dir-form').addClass('has-error'); | ||
971 | $("#apply-change-sstate_dir").attr("disabled","disabled"); | ||
972 | $('#hintError-sstate_dir').show(); | ||
973 | } else { | ||
944 | $('#change-sstate_dir-form').removeClass('has-error'); | 974 | $('#change-sstate_dir-form').removeClass('has-error'); |
945 | $("#apply-change-sstate_dir").removeAttr("disabled"); | 975 | $("#apply-change-sstate_dir").removeAttr("disabled"); |
946 | $('#hintError-sstate_dir').hide(); | 976 | $('#hintError-sstate_dir').hide(); |
947 | } else { | 977 | $('#hintError-initialChar-sstate_dir').hide(); |
948 | $('#change-sstate_dir-form').addClass('has-error'); | ||
949 | $("#apply-change-sstate_dir").attr("disabled","disabled"); | ||
950 | $('#hintError-sstate_dir').show(); | ||
951 | } | 978 | } |
952 | } | 979 | } |
953 | }); | 980 | }); |