]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toaster: customrecipe Only show download icon or button if it's possible
authorMichael Wood <michael.g.wood@intel.com>
Tue, 26 Apr 2016 16:18:07 +0000 (17:18 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 29 Apr 2016 09:25:25 +0000 (10:25 +0100)
If the based on recipe has not yet been checked out/cloned we cannot
generate the custom image recipe file that uses it. So disable/remove
the option to download it.

[YOCTO #9425]

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/toaster/toastergui/tables.py
lib/toaster/toastergui/templates/customrecipe.html

index 2cc2f4eb7bc0f3d212c11cc880493eb5118e1ef1..d375da434f569166d3abf1eaed28efe75f985494 100644 (file)
@@ -508,10 +508,12 @@ class CustomImagesTable(ToasterTable):
 
         recipe_file_template = '''
         <code>{{data.name}}_{{data.version}}.bb</code>
+        {% if data.get_base_recipe_file %}
         <a href="{% url 'customrecipedownload' extra.pid data.pk %}">
         <i class="icon-download-alt" data-original-title="Download recipe
         file"></i>
-        </a>'''
+        </a>
+        {% endif %}'''
 
         self.add_column(title="Recipe file",
                         static_data_name='recipe_file_download',
index ea3c9c732412525ab3fd1d8900ce2636cdabf5e0..aeb4466a209cb7a31c4c2c7d5d838da97f59dbff 100644 (file)
@@ -4,6 +4,7 @@
 {% load static %}
 {% block pagecontent %}
 
+{% with recipe.get_base_recipe_file as base_recipe_file %}
 <div class="section">
   <ul class="breadcrumb">
     <li>
       <a class="btn btn-large span6 build-custom-image" href="#" style="width: 50%">
         Build {{recipe.name}}
       </a>
-      <a href="{% url 'customrecipedownload' project.id recipe.id %}" class="btn btn-large span6" style="width: 50%">
+      <a href="{% url 'customrecipedownload' project.id recipe.id %}" class="btn btn-large span6" style="width: 50%"
+        {% if not base_recipe_file %}
+        disabled="disabled"
+        {% endif %}>
         Download recipe file
+        {% if not base_recipe_file %}
+        <i class="icon-question-sign get-help"
+          data-original-title="The {{recipe.name}} recipe cannot yet be downloaded as the Based on recipe '{{recipe.base_recipe.name}}' has not yet been fetched"></i>
+        {% endif %}
       </a>
     </div>
     <div id="no-results-special-{{table_name}}" class="air" style="display:none;">
         <dt>Recipe file</dt>
         <dd>
           <code>{{recipe.name}}_{{recipe.version}}.bb</code>
+          {% if base_recipe_path %}
           <a href="{% url 'customrecipedownload' project.pk recipe.pk %}"><i class="icon-share" title="" data-original-title="View recipe file"></i></a>
+          {% endif %}
         </dd>
         <dt>Layer</dt>
         <dd><a href="{% url 'layerdetails' project.id recipe.layer_version.pk %}">{{recipe.layer_version.layer.name}}</a></dd>
     </div>
   </div>
 
+{% endwith %}{# end base_recipe_file #}
   {% endblock %}