From b8bc3d3d2bd2b730871f537b8d78a6dae937249a Mon Sep 17 00:00:00 2001 From: Valerie R Young Date: Tue, 2 Aug 2016 18:36:51 -0400 Subject: reproducible debian: add cross suite/arch nav for scheduled and maintainers Signed-off-by: Holger Levsen --- bin/reproducible_common.py | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'bin/reproducible_common.py') diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py index 0a027b0b..a149c85e 100755 --- a/bin/reproducible_common.py +++ b/bin/reproducible_common.py @@ -256,11 +256,16 @@ def convert_into_hms_string(duration): def gen_suite_arch_nav_context(suite, arch, suite_arch_nav_template=None, - ignore_experimental=False): - # if a template is not passed in to navigate between suite and archs - # for the current page, we use the suite/arch summary view - if not suite_arch_nav_template: - suite_arch_nav_template = '/debian/{{suite}}/index_suite_{{arch}}_stats.html' + ignore_experimental=False, no_suite=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 suite_list = [] for s in SUITES: include_suite = True @@ -268,17 +273,23 @@ def gen_suite_arch_nav_context(suite, arch, suite_arch_nav_template=None, include_suite = False suite_list.append({ 's': s, - 'class': 'current' if s == suite else '', - 'uri': renderer.render(suite_arch_nav_template, + 'class': 'current' if s == suite and not no_suite else '', + 'uri': renderer.render(uri_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 else '', - 'uri': renderer.render(suite_arch_nav_template, + 'class': 'current' if a == arch and not no_arch else '', + 'uri': renderer.render(uri_template, {'suite': suite, 'arch': a}), }) return (suite_list, arch_list) @@ -286,9 +297,10 @@ def gen_suite_arch_nav_context(suite, arch, suite_arch_nav_template=None, # See bash equivelent: reproducible_common.sh's "write_page_header()" def create_main_navigation(suite=defaultsuite, arch=defaultarch, displayed_page=None, suite_arch_nav_template=None, - ignore_experimental=False): + ignore_experimental=False, no_suite=None, + no_arch=None): suite_list, arch_list = gen_suite_arch_nav_context(suite, arch, - suite_arch_nav_template, ignore_experimental) + suite_arch_nav_template, ignore_experimental, no_suite, no_arch) context = { 'suite': suite, 'arch': arch, -- cgit v1.2.3-54-g00ecf