diff --git a/bin/dashboard b/bin/dashboard index 8784eba8411b4ca39a6fe91c286d9ed61cdd55bc..4251769b6835ddd3ef58729a7aca94ec93995514 100755 --- a/bin/dashboard +++ b/bin/dashboard @@ -116,12 +116,20 @@ def render(packaging_data, storage_data, destdir): env = jinja2.Environment( loader=jinja2.FileSystemLoader("templates/"), autoescape=True ) + + if packaging_data is not None and storage_data is not None: + both_data = True + else: + both_data = False + for html, data in ("index", packaging_data), ("storage", storage_data): if data is None: continue logging.debug(f"Generating {destdir}/{html}.html") - rendered = env.get_template(f"{html}.html.jinja2").render(**data) + rendered = env.get_template(f"{html}.html.jinja2").render( + **data, both_data=both_data + ) with open(destdir / f"{html}.html", "w") as html_file: html_file.write(rendered) diff --git a/templates/base.html.jinja2 b/templates/base.html.jinja2 index 1f7b992b3b219f99ed5800a230d13821408ad5f9..05b4f4e9fc28a74301b2e12fe8b786df0ae51cc3 100644 --- a/templates/base.html.jinja2 +++ b/templates/base.html.jinja2 @@ -37,7 +37,7 @@ <div> <a href="index.html" class="text-muted">Packages</a> <span>â—</span> - <a href="storage.html" class="text-muted">Storage Usage</a> + <a href="storage.html" class="text-muted {{'btn-link disabled' if not both_data }}">Storage Usage</a> </div> </div>