]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toaster: commit id format on layers page
authorDave Lerner <dave.lerner@windriver.com>
Wed, 25 Feb 2015 20:53:22 +0000 (14:53 -0600)
committerAlexandru DAMIAN <alexandru.damian@intel.com>
Mon, 9 Mar 2015 13:15:21 +0000 (13:15 +0000)
On the layers page, when a layer revision is a commit id instead of a
an upstream branch name, then follow the same format for displaying the
commit id as on the recipes page.  That format is a button with the
truncated commit SHAID which when pressed expands to the full SHAID.

[YOCTO #7191]

Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
lib/toaster/toastergui/templates/layers.html
lib/toaster/toastergui/templatetags/projecttags.py

index 864e15683be858ebeeaef13ae84ff39bb38afdf6..c35a29933379863b164d77986bcc2671366bb953 100644 (file)
                 {% endif %}
         </td>
             <td class="branch">
-                {% if o.branch %}
-                    {{o.branch}}
-                {% else %}
-                    {{o.up_branch.name}}
-                    <i class="icon-question-sign get-help hover-help" title="Your builds will use the tip of the branch you have cloned or downloaded to your computer, so nothing will be fetched"></i>
-                {% endif %}
+                {% with vcs_ref=o.get_vcs_reference %}
+                  {% if vcs_ref|is_shaid %}
+                    <a class="btn" data-content="<ul class='unstyled'> <li>{{vcs_ref}}</li> </ul>">
+                      {{vcs_ref|truncatechars:10}}
+                    </a>
+                  {% else %}
+                    {{vcs_ref}}
+                  {% endif %}
+                {% endwith %}
             </td>
             <td class="dependencies">
         {% with ods=o.dependencies.all%}
index 276c6eb098e705fee51934435f862dfcee5221c6..e66910cd9dcf52ccc34acdfae0f2b5100577e285 100644 (file)
@@ -295,3 +295,15 @@ def format_build_date(completed_on):
 
     if delta.days >= 1:
         return True
+
+@register.filter
+def is_shaid(text):
+    """ return True if text length is 40 characters and all hex-digits
+    """
+    try:
+        int(text, 16)
+        if len(text) == 40:
+            return True
+        return False
+    except ValueError:
+        return False