[Qa-jenkins-scm] [jenkins.debian.net] 01/01: reproducible debian: remove suite or arch nav when not relevent for page

Holger Levsen holger at layer-acht.org
Wed Aug 3 20:10:39 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit d657beb8211fdfe146019a22198694dfc194d3ad
Author: Valerie R Young <spectranaut at riseup.net>
Date:   Wed Aug 3 16:07:45 2016 -0400

    reproducible debian: remove suite or arch nav when not relevent for page
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 bin/reproducible_common.py                         | 59 +++++++++++-----------
 .../reproducible/main_navigation.mustache          |  4 ++
 2 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index a149c85..eeb4ffb 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -260,38 +260,33 @@ def gen_suite_arch_nav_context(suite, arch, suite_arch_nav_template=None,
                                no_arch=None):
     # if a template is not passed in to navigate between suite and archs the
     # current page, we use the "default" suite/arch summary view.
-    # OR if there is not suite equivalent for this page, use the default
-    # for suite links.
     default_nav_template = '/debian/{{suite}}/index_suite_{{arch}}_stats.html'
-    uri_template = suite_arch_nav_template
-    if not uri_template or no_suite:
-        uri_template = default_nav_template
+    if not suite_arch_nav_template:
+        suite_arch_nav_template = default_nav_template
+
     suite_list = []
-    for s in SUITES:
-        include_suite = True
-        if s == 'experimental' and ignore_experimental:
-            include_suite = False
-        suite_list.append({
-            's': s,
-            'class': 'current' if s == suite and not no_suite else '',
-            'uri': renderer.render(uri_template,
-                                   {'suite': s, 'arch': arch})
-                   if include_suite else '',
-        })
+    if not no_suite:
+        for s in SUITES:
+            include_suite = True
+            if s == 'experimental' and ignore_experimental:
+                include_suite = False
+            suite_list.append({
+                's': s,
+                'class': 'current' if s == suite else '',
+                'uri': renderer.render(suite_arch_nav_template,
+                                       {'suite': s, 'arch': arch})
+                if include_suite else '',
+            })
 
-    # if there is no arch equivalents for this page, use the default
-    # for arch links.
-    uri_template = suite_arch_nav_template
-    if not uri_template or no_arch:
-        uri_template = default_nav_template
     arch_list = []
-    for a in ARCHS:
-        arch_list.append({
-            'a': a,
-            'class': 'current' if a == arch and not no_arch else '',
-            'uri': renderer.render(uri_template,
-                                   {'suite': suite, 'arch': a}),
-        })
+    if not no_arch:
+        for a in ARCHS:
+            arch_list.append({
+                'a': a,
+                'class': 'current' if a == arch else '',
+                'uri': renderer.render(suite_arch_nav_template,
+                                       {'suite': suite, 'arch': a}),
+            })
     return (suite_list, arch_list)
 
 # See bash equivelent: reproducible_common.sh's "write_page_header()"
@@ -305,8 +300,12 @@ def create_main_navigation(suite=defaultsuite, arch=defaultarch,
         'suite': suite,
         'arch': arch,
         'project_links_html': renderer.render(project_links_template),
-        'suite_list': suite_list,
-        'arch_list': arch_list,
+        'suite_nav': {
+            'suite_list': suite_list
+        } if len(suite_list) else '',
+        'arch_nav': {
+            'arch_list': arch_list
+        } if len(arch_list) else '',
         'debian_uri': DEBIAN_DASHBOARD_URI,
         'cross_suite_arch_nav': True if suite_arch_nav_template else False,
     }
diff --git a/mustache-templates/reproducible/main_navigation.mustache b/mustache-templates/reproducible/main_navigation.mustache
index 594f2e9..25fe8d8 100644
--- a/mustache-templates/reproducible/main_navigation.mustache
+++ b/mustache-templates/reproducible/main_navigation.mustache
@@ -6,6 +6,7 @@
   {{#cross_suite_arch_nav}}
   <h4>Change suite/architecture</h4>
   {{/cross_suite_arch_nav}}
+  {{#arch_nav}}
   <li>
     Tested architectures:
     <ul class="children">
@@ -21,6 +22,8 @@
       </li>
     </ul>
   </li>
+  {{/arch_nav}}
+  {{#suite_nav}}
   <li>Tested suites:
     <ul class="children">
       <li>
@@ -35,6 +38,7 @@
       </li>
     </ul>
   </li>
+  {{/suite_nav}}
   <h4>Test results statistics</h4>
   <li {{#suite_arch_stats}}class='active'{{/suite_arch_stats}}>
     Results for

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list