From 9f75c3ffb77f9b827bbd1a89ad9f8a25fd6e1f31 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dylan=20A=C3=AFssi?= <dylan.aissi@collabora.com>
Date: Mon, 15 Jul 2024 15:51:18 +0200
Subject: [PATCH] Add a legend for tags with links to the policy
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Dylan Aïssi <dylan.aissi@collabora.com>
---
 .gitlab-ci.yml              |  2 ++
 bin/dashboard               |  7 ++++++-
 templates/base.html.jinja2  |  4 ++++
 templates/index.html.jinja2 | 20 ++++++++++++++++++++
 4 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d958215..d92e1ea 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,6 +9,7 @@ default:
 
 variables:
   OSNAME: apertis
+  OS_WEBSITE: www.apertis.org
   GITLAB_RULES_GIT: $CI_SERVER_URL/infrastructure/$OSNAME-infrastructure.git
   GITLAB_RULES_FILE: gitlab-scripts/rulez.yaml
   DEBUG:
@@ -562,6 +563,7 @@ packaging-updates-upstream-linux:
         --current-job-url "$CI_JOB_URL"
         --current-pipeline-url "$CI_PIPELINE_URL"
         --new-pipeline-url "$CI_PROJECT_URL/-/pipelines/new?ref=$CI_COMMIT_REF_NAME"
+        --os-website-url "${OS_WEBSITE}"
     - ./bin/tsv
         --data packaging.json
         --destdir tsv/
diff --git a/bin/dashboard b/bin/dashboard
index 84a7a88..59df49b 100755
--- a/bin/dashboard
+++ b/bin/dashboard
@@ -134,7 +134,7 @@ def render(packaging_data, storage_data, destdir):
 
         logging.debug(f"Generating {destdir}/{html}.html")
         rendered = env.get_template(f"{html}.html.jinja2").render(
-            **data, both_data=both_data
+            **data, both_data=both_data, website_url=args.os_website_url
         )
         with open(destdir / f"{html}.html", "w") as html_file:
             html_file.write(rendered)
@@ -190,6 +190,11 @@ if __name__ == "__main__":
         type=argparse.FileType("r"),
         help="storage stats input file in YAML format",
     )
+    parser.add_argument(
+        "--os-website-url",
+        default="www.apertis.org",
+        help="URL to the OS website",
+    )
     parser.add_argument("--destdir", required=True, type=str, help="output directory")
     args = parser.parse_args()
 
diff --git a/templates/base.html.jinja2 b/templates/base.html.jinja2
index dcbe92a..449bceb 100644
--- a/templates/base.html.jinja2
+++ b/templates/base.html.jinja2
@@ -58,6 +58,10 @@
       </div>
 
       {% block content %} {% endblock %}
+
+      <div class="d-flex align-items-baseline justify-content-between">
+        {% block legend %}{% endblock %}
+      </div>
     </main>
   </body>
 </html>
diff --git a/templates/index.html.jinja2 b/templates/index.html.jinja2
index adc2621..0b5dec5 100644
--- a/templates/index.html.jinja2
+++ b/templates/index.html.jinja2
@@ -456,3 +456,23 @@
   {% endfor %}
   </div>
 {% endblock %}
+
+{% block legend %}
+  <div class="list-group">
+            <p>
+            <strong>🛈 Legend: </strong>
+            <ul>
+            <li><big><span class="badge badge-danger">error</span></big>: This tag reports an error that needs to be fixed!</li>
+            <li><big><span class="badge badge-warning">warning</span></big>: This tag reports an issue that needs to be investigated!</li>
+            <li><big><span class="badge badge-info">info</span></big>: This tag reports only information.</li>
+            <li><big><span class="badge border">licensing</span></big>: This tag is about a potential issue with the package license, see <a href="https://{{ website_url }}/policies/license-expectations/">License Expectations</a>.</li>
+            <li><big><span class="badge border">delta</span></big>: This tag is about the changes in packages against upstream, see <a href="https://{{ website_url }}/policies/upstreaming/">Upstreaming</a>.</li>
+            <li><big><span class="badge border">update</span></big>: This tag is about available package updates, see <a href="https://{{ website_url }}/policies/release-flow/">Release flow</a>.</li>
+            <li><big><span class="badge border">git</span></big>: This tag is about a potential issue with source packages in Git repositories, see <a href="https://{{ website_url }}/policies/package_maintenance/">Package maintenance</a>.</li>
+            <li><big><span class="badge border">apt</span></big>: This tag is about a potential issue with binary packages in Apt repositories, see <a href="https://{{ website_url }}/policies/package_maintenance/">Package maintenance</a>.</li>
+            <li><big><span class="badge border">obs</span></big>: This tag is about a potential issue with packages in OBS repositories, see <a href="https://{{ website_url }}/policies/package_maintenance/">Package maintenance</a>.</li>
+            </ul>
+            </p>
+            <p>For more information, please refer to the Apertis policy at <a href="https://{{ website_url }}/">{{ website_url }}</a>.</p>
+    </div>
+{% endblock %}
-- 
GitLab