diff options
author | Valerie R Young <spectranaut@riseup.net> | 2016-06-30 14:42:11 -0400 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2016-07-17 12:12:05 +0200 |
commit | b3999887aa7387e7db24ebab04d3d15c4ac7d9df (patch) | |
tree | 442b4759576bd5e9c9f2753c181c539a36f34b54 /bin | |
parent | f16c248f5153732d36e808df1da2e12c8fd8a6bf (diff) | |
download | jenkins.debian.net-b3999887aa7387e7db24ebab04d3d15c4ac7d9df.tar.xz |
reproducible debian: add main navigation highlighting to python pages
Added the correct navigation highlighting to the following pages: notes,
no notes, tested in the last 24 hours, tested in the last 48 hours, all
packages, notifications enabled, breakages, issue pages, scheduled, and
maintainers page.
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/reproducible_common.py | 18 | ||||
-rwxr-xr-x | bin/reproducible_html_breakages.py | 2 | ||||
-rwxr-xr-x | bin/reproducible_html_dd_list.py | 3 | ||||
-rwxr-xr-x | bin/reproducible_html_indexes.py | 3 | ||||
-rwxr-xr-x | bin/reproducible_html_live_status.py | 2 | ||||
-rwxr-xr-x | bin/reproducible_html_notes.py | 5 | ||||
-rw-r--r-- | bin/templates/main_navigation.mustache | 57 |
7 files changed, 63 insertions, 27 deletions
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py index ed095e07..28b4add4 100755 --- a/bin/reproducible_common.py +++ b/bin/reproducible_common.py @@ -254,7 +254,7 @@ def convert_into_hms_string(duration): # See bash equivelent: reproducible_common.sh's "write_page_header()" -def create_main_navigation(page_title, suite, arch): +def create_main_navigation(page_title, suite, arch, displayed_page=None): context = { 'page_title': page_title, 'suite': suite, @@ -265,10 +265,16 @@ def create_main_navigation(page_title, suite, arch): 'arch_list': [{'a': a} for a in ARCHS], 'debian_url': DEBIAN_URL, } + # this argument controls which of the main page navigation items will be + # highlighted. + if displayed_page: + context[displayed_page] = True return renderer.render(main_navigation_template, context) -def write_html_page(title, body, destfile, suite=defaultsuite, arch=defaultarch, noheader=False, style_note=False, noendpage=False, packages=False, refresh_every=None): +def write_html_page(title, body, destfile, suite=defaultsuite, arch=defaultarch, + noheader=False, style_note=False, noendpage=False, + packages=False, refresh_every=None, displayed_page=None): now = datetime.utcnow().strftime('%Y-%m-%d %H:%M UTC') html = '' meta_refresh = '<meta http-equiv="refresh" content="%d">' % \ @@ -277,7 +283,12 @@ def write_html_page(title, body, destfile, suite=defaultsuite, arch=defaultarch, page_title=title, meta_refresh=meta_refresh) if not noheader: - html += create_main_navigation(title, suite, arch) + html += create_main_navigation( + page_title=title, + suite=suite, + arch=arch, + displayed_page=displayed_page, + ) html += body if style_note: @@ -292,6 +303,7 @@ def write_html_page(title, body, destfile, suite=defaultsuite, arch=defaultarch, except OSError as e: if e.errno != errno.EEXIST: # that's 'File exists' error (errno 17) raise + log.debug("Writing " + destfile) with open(destfile, 'w', encoding='UTF-8') as fd: fd.write(html) diff --git a/bin/reproducible_html_breakages.py b/bin/reproducible_html_breakages.py index 861375b7..1fec3c1f 100755 --- a/bin/reproducible_html_breakages.py +++ b/bin/reproducible_html_breakages.py @@ -312,5 +312,5 @@ if __name__ == '__main__': title = 'Breakage on the Debian pages of tests.reproducible-builds.org' destfile = DEBIAN_BASE + '/index_breakages.html' desturl = DEBIAN_URL + '/index_breakages.html' - write_html_page(title, html, destfile, style_note=True) + write_html_page(title, html, destfile, style_note=True, displayed_page='breakages') log.info('Breackages page created at ' + desturl) diff --git a/bin/reproducible_html_dd_list.py b/bin/reproducible_html_dd_list.py index 174c8124..702d7fb6 100755 --- a/bin/reproducible_html_dd_list.py +++ b/bin/reproducible_html_dd_list.py @@ -73,5 +73,6 @@ for suite in SUITES: html += '</pre></p>' title = 'Maintainers of unreproducible packages in ' + suite destfile = DEBIAN_BASE + '/' + suite + '/index_dd-list.html' - write_html_page(title, html, destfile, suite, arch, style_note=True) + write_html_page(title, html, destfile, suite, arch, style_note=True, + displayed_page='dd_list') log.info('%s/%s/index_dd-list.html published', DEBIAN_URL, suite) diff --git a/bin/reproducible_html_indexes.py b/bin/reproducible_html_indexes.py index f0eda28b..46a0b23f 100755 --- a/bin/reproducible_html_indexes.py +++ b/bin/reproducible_html_indexes.py @@ -529,7 +529,8 @@ def build_page(page, suite=None, arch=None): destfile = DEBIAN_BASE + '/' + suite + '/' + arch + '/index_' + page + '.html' desturl = DEBIAN_URL + '/' + suite + '/' + arch + '/index_' + \ page + '.html' - write_html_page(title=title, body=html, destfile=destfile, suite=suite, arch=arch, style_note=True) + write_html_page(title=title, body=html, destfile=destfile, suite=suite, + arch=arch, style_note=True, displayed_page=page) log.info('"' + title + '" now available at ' + desturl) diff --git a/bin/reproducible_html_live_status.py b/bin/reproducible_html_live_status.py index fa401def..59f4b1e2 100755 --- a/bin/reproducible_html_live_status.py +++ b/bin/reproducible_html_live_status.py @@ -52,7 +52,7 @@ def generate_schedule(arch): html += '</table></p>\n' destfile = DEBIAN_BASE + '/index_' + arch + '_scheduled.html' desturl = DEBIAN_URL + '/index_' + arch + '_scheduled.html' - write_html_page(title=title, body=html, destfile=destfile, arch=arch, style_note=True, refresh_every=60) + write_html_page(title=title, body=html, destfile=destfile, arch=arch, style_note=True, refresh_every=60, displayed_page='scheduled') log.info("Page generated at " + desturl) diff --git a/bin/reproducible_html_notes.py b/bin/reproducible_html_notes.py index be0eb196..535ea9cc 100755 --- a/bin/reproducible_html_notes.py +++ b/bin/reproducible_html_notes.py @@ -387,7 +387,7 @@ def iterate_over_issues(issues): title = 'Notes about issue ' + issue + ' in ' + suite destfile = ISSUES_PATH + '/' + suite + '/' + issue + '_issue.html' write_html_page(title=title, body=html, destfile=destfile, - style_note=True) + style_note=True, displayed_page='issues') desturl = REPRODUCIBLE_URL + ISSUES_URI + '/' + suite + '/' + issue + '_issue.html' log.debug("Issue created: " + desturl) @@ -450,7 +450,8 @@ def index_issues(issues, scorefuncs): title = 'Known issues related to reproducible builds' destfile = DEBIAN_BASE + '/index_issues.html' desturl = DEBIAN_URL + '/index_issues.html' - write_html_page(title=title, body=html, destfile=destfile) + write_html_page(title=title, body=html, destfile=destfile, + displayed_page='issues') log.info('Issues index now available at ' + desturl) diff --git a/bin/templates/main_navigation.mustache b/bin/templates/main_navigation.mustache index 1a8a60ac..776a1207 100644 --- a/bin/templates/main_navigation.mustache +++ b/bin/templates/main_navigation.mustache @@ -3,12 +3,16 @@ <ul class="menu"> <li>{{suite}}/{{arch}}:<ul class="children"> <li>Notes:<ul class="children"> - <li><a href="/debian/{{suite}}/{{arch}}/index_notes.html"> + <li {{#notes}}class='active'{{/notes}}> + <a href="/debian/{{suite}}/{{arch}}/index_notes.html"> packages with notes - </a></li> - <li><a href="/debian/{{suite}}/{{arch}}/index_no_notes.html"> + </a> + </li> + <li {{#no_notes}}class='active'{{/no_notes}}> + <a href="/debian/{{suite}}/{{arch}}/index_no_notes.html"> packages without notes - </a></li> + </a> + </li> </ul></li> <li>Package states:<ul class="children"> <li> @@ -36,23 +40,29 @@ </li> </ul></li> {{^experimental}} - <li> + <li {{#pkg_set}}class='active'{{/pkg_set}}> <a href="/debian/{{suite}}/{{arch}}/index_pkg_sets.html"> package sets </a> </li> {{/experimental}} <li>Recently tested:<ul class="children"> - <li><a href="/debian/{{suite}}/{{arch}}/index_last_24h.html"> + <li {{#last_24h}}class='active'{{/last_24h}}> + <a href="/debian/{{suite}}/{{arch}}/index_last_24h.html"> packages tested in the last 24h - </a></li> - <li><a href="/debian/{{suite}}/{{arch}}/index_last_48h.html"> + </a> + </li> + <li {{#last_48h}}class='active'{{/last_48h}}> + <a href="/debian/{{suite}}/{{arch}}/index_last_48h.html"> packages tested in the last 48h - </a></li> + </a> + </li> </ul></li> - <li><a href="/debian/{{suite}}/{{arch}}/index_all_abc.html"> + <li {{#all_abc}}class='active'{{/all_abc}}> + <a href="/debian/{{suite}}/{{arch}}/index_all_abc.html"> all tested packages (sorted alphabetically) - </a></li> + </a> + </li> </ul></li> <li>Architectures:<ul class="children"> <li> @@ -60,7 +70,9 @@ <a href="/debian/{{suite}}/index_suite_{{a}}_stats.html">{{a}}</a> {{/arch_list}} </li> - <li><a href="/debian/index_{{arch}}_scheduled.html">currently scheduled</a></li> + <li {{#scheduled}}class='active'{{/scheduled}}> + <a href="/debian/index_{{arch}}_scheduled.html">currently scheduled</a> + </li> </ul></li> <li>Suites:<ul class="children"> <li> @@ -68,20 +80,29 @@ <a href="/debian/{{s}}/index_suite_{{arch}}_stats.html">{{s}}</a> {{/suite_list}} </li> - <li><a href="/debian/{{suite}}/index_dd-list.html"> + <li {{#dd_list}}class='active'{{/dd_list}}> + <a href="/debian/{{suite}}/index_dd-list.html"> maintainers of unreproducible packages - </a></li> + </a> + </li> </ul></li> <li><a href="{{debian_url}}">Debian dashboard</a> <ul class="children"> - <li><a href="/debian/index_issues.html">issues</a></li> + <li {{#issues}}class='active'{{/issues}}> + <a href="/debian/index_issues.html">issues</a> + </li> <li><a href="/debian/index_repositories.html"> repositories overview</a></li> - <li><a href="/debian/index_notify.html" title="notify icon"> - ⚑ packages with enabled notifications</a></li> + <li {{#notify}}class='active'{{/notify}}> + <a href="/debian/index_notify.html" title="notify icon"> + ⚑ packages with enabled notifications + </a> + </li> <li><a href="/debian/index_performance.html">performance stats</a></li> <li><a href="/debian/index_variations.html">variations tested</a></li> - <li><a href="/debian/index_breakages.html">broken pieces</a></li> + <li {{#breakages}}class='active'{{/breakages}}> + <a href="/debian/index_breakages.html">broken pieces</a> + </li> </ul></li> </ul> {{{project_links_html}}} |