From 71ff9b9e0ef5582bddf501f7b737bd17ba2e19d5 Mon Sep 17 00:00:00 2001 From: Sujith H Date: Wed, 6 Apr 2016 17:46:44 +0100 Subject: bitbake: toaster: update projectconf.html for DL_DIR and SSTATE_DIR Modified the projectconf.html to include DL_DIR and SSTATE_DIR. Updated the script section in the html to handle the changes made by the user on DL_DIR and SSTATE_DIR. Included validation check for the folder names. [YOCTO #8422] (Bitbake rev: bd9f8973d4c9c0722874a058466b1b911112500e) Signed-off-by: Sujith H Signed-off-by: Michael Wood Signed-off-by: Richard Purdie --- .../toaster/toastergui/templates/projectconf.html | 160 ++++++++++++++++++++- 1 file changed, 157 insertions(+), 3 deletions(-) (limited to 'bitbake') diff --git a/bitbake/lib/toaster/toastergui/templates/projectconf.html b/bitbake/lib/toaster/toastergui/templates/projectconf.html index 08223daa5b..27a898b657 100644 --- a/bitbake/lib/toaster/toastergui/templates/projectconf.html +++ b/bitbake/lib/toaster/toastergui/templates/projectconf.html @@ -31,6 +31,28 @@ {% endif %} + {% if dl_dir_defined %} +
+ DL_DIR + +
+
+ {% if dl_dir %}{{dl_dir}}{%else%}Not set{%endif%} + + +
+ {% endif %} + {% if fstypes_defined %}
IMAGE_FSTYPES @@ -107,6 +129,29 @@ {% endif %} + + {% if sstate_dir_defined %} +
+ SSTATE_DIR + +
+
+ {% if sstate_dir %}{{sstate_dir}}{%else%}Not set{%endif%} + + +
+ {% endif %} @@ -156,9 +201,7 @@ BB_NUMBER_THREADS CVS_PROXY_HOST CVS_PROXY_PORT - DL_DIR PARALLEL_MAKE - SSTATE_DIR SSTATE_MIRRORS TMPDIR

Plus the following standard shell environment variables:

@@ -501,6 +544,61 @@ }); {% endif %} + {% if dl_dir_defined %} + + // change DL_DIR variable + $('#change-dl_dir-icon').click(function() { + $('#hintError-dl_dir').hide(); + // preset the edit value + var current_val = $("span#dl_dir").text().trim(); + if (current_val == "Not set") { + current_val=""; + $("#apply-change-dl_dir").attr("disabled","disabled"); + } + $("input#new-dl_dir").val(current_val); + + $('#change-dl_dir-icon, #dl_dir').hide(); + $("#change-dl_dir-form").slideDown(); + }); + + $('#cancel-change-dl_dir').click(function(){ + $("#change-dl_dir-form").slideUp(function() { + $('#dl_dir, #change-dl_dir-icon').show(); + }); + }); + + $("#new-dl_dir").on('input', function(){ + if ($(this).val().trim().length == 0) { + $("#apply-change-dl_dir").attr("disabled","disabled"); + } + else { + var input = $(this); + var re = /^\/([^ <>\\|":\.%\?\*]+)$/; + var invalidDir = re.test(input.val()); + console.log(invalidDir); + if ( invalidDir ) { + $('#validate-dl_dir').removeClass('control-group error'); + $("#apply-change-dl_dir").removeAttr("disabled"); + $('#hintError-dl_dir').hide(); + } else { + $('#validate-dl_dir').addClass('control-group error'); + $("#apply-change-dl_dir").attr("disabled","disabled"); + $('#hintError-dl_dir').show(); + } + } + }); + + $('#apply-change-dl_dir').click(function(){ + var value = $('#new-dl_dir').val().trim(); + postEditAjaxRequest({"configvarChange" : 'DL_DIR:'+value}); + $('#dl_dir').text(value); + $('#dl_dir').removeClass('muted'); + $("#change-dl_dir-form").slideUp(function () { + $('#dl_dir, #change-dl_dir-icon').show(); + }); + }); + + {% endif %} {% if fstypes_defined %} // change IMAGE_FSTYPES variable @@ -748,6 +846,62 @@ }); {% endif %} + {% if sstate_dir_defined %} + + // change SSTATE_DIR variable + $('#change-sstate_dir-icon').click(function() { + $('#hintError-sstate_dir').hide(); + // preset the edit value + var current_val = $("span#sstate_dir").text().trim(); + if (current_val == "Not set") { + current_val=""; + $("#apply-change-sstate_dir").attr("disabled","disabled"); + } + $("input#new-sstate_dir").val(current_val); + + $('#change-sstate_dir-icon, #sstate_dir').hide(); + $("#change-sstate_dir-form").slideDown(); + }); + + $('#cancel-change-sstate_dir').click(function(){ + $("#change-sstate_dir-form").slideUp(function() { + $('#sstate_dir, #change-sstate_dir-icon').show(); + }); + }); + + $("#new-sstate_dir").on('input', function(){ + if ($(this).val().trim().length == 0) { + $("#apply-change-sstate_dir").attr("disabled","disabled"); + } + else { + var input = $(this); + var re = /^\/([^ <>\\|":\.%\?\*]+)$/; + var invalidDir = re.test(input.val()); + console.log(invalidDir); + if ( invalidDir ) { + $('#validate-sstate_dir').removeClass('control-group error'); + $("#apply-change-sstate_dir").removeAttr("disabled"); + $('#hintError-sstate_dir').hide(); + } else { + $('#validate-sstate_dir').addClass('control-group error'); + $("#apply-change-sstate_dir").attr("disabled","disabled"); + $('#hintError-sstate_dir').show(); + } + } + }); + + $('#apply-change-sstate_dir').click(function(){ + var value = $('#new-sstate_dir').val().trim(); + postEditAjaxRequest({"configvarChange" : 'SSTATE_DIR:'+value}); + $('#sstate_dir').text(value); + $('#sstate_dir').removeClass('muted'); + $("#change-sstate_dir-form").slideUp(function () { + $('#sstate_dir, #change-sstate_dir-icon').show(); + }); + }); + + {% endif %} + // add new variable $("button#add-configvar-button").click( function (evt) { var variable = $("input#variable").val(); @@ -762,7 +916,7 @@ $(".save").attr("disabled","disabled"); // Reload page if admin-removed core managed value is manually added back in - if (0 <= " DISTRO IMAGE_FSTYPES IMAGE_INSTALL_append PACKAGE_CLASSES ".indexOf( " "+variable+" " )) { + if (0 <= " DISTRO DL_DIR IMAGE_FSTYPES IMAGE_INSTALL_append PACKAGE_CLASSES SSTATE_DIR ".indexOf( " "+variable+" " )) { // delayed reload to avoid race condition with postEditAjaxRequest do_reload=true; } -- cgit v1.2.3-54-g00ecf