diff --git a/assets/src/bundles/webapp/webapp.css b/assets/src/bundles/webapp/webapp.css --- a/assets/src/bundles/webapp/webapp.css +++ b/assets/src/bundles/webapp/webapp.css @@ -38,8 +38,8 @@ position: absolute; bottom: 0; width: 100%; - padding-top: 20px; - padding-bottom: 20px; + padding-top: 10px; + padding-bottom: 10px; } footer a, @@ -682,7 +682,6 @@ color: #e20026; position: absolute; text-align: center; - line-height: 50px; letter-spacing: 1px; box-shadow: 0 0 3px rgba(0, 0, 0, 0.3); top: 55px; @@ -694,7 +693,6 @@ @media screen and (max-width: 600px) { .swh-corner-ribbon { - line-height: 30px; top: 53px; right: -65px; } diff --git a/cypress/integration/origin-search.spec.js b/cypress/integration/origin-search.spec.js --- a/cypress/integration/origin-search.spec.js +++ b/cypress/integration/origin-search.spec.js @@ -21,7 +21,7 @@ .invoke('val', searchText.slice(0, -1)) .type(searchText.slice(-1)) .get('.swh-search-icon') - .click(); + .click({force: true}); if (searchText.startsWith('swh:')) { cy.wait('@swhidResolve'); } diff --git a/swh/web/common/utils.py b/swh/web/common/utils.py --- a/swh/web/common/utils.py +++ b/swh/web/common/utils.py @@ -14,6 +14,7 @@ import docutils.utils from docutils.writers.html5_polyglot import HTMLTranslator, Writer from iso8601 import ParseError, parse_date +from pkg_resources import get_distribution from prometheus_client.registry import CollectorRegistry from django.http import HttpRequest, QueryDict @@ -266,12 +267,14 @@ "site_base_url": site_base_url, "DJANGO_SETTINGS_MODULE": os.environ["DJANGO_SETTINGS_MODULE"], "status": config["status"], + "swh_web_dev": "localhost" in site_base_url, "swh_web_staging": any( [ server_name in site_base_url for server_name in config["staging_server_names"] ] ), + "swh_web_version": get_distribution("swh.web").version, "visit_types": ORIGIN_VISIT_TYPES, } diff --git a/swh/web/templates/layout.html b/swh/web/templates/layout.html --- a/swh/web/templates/layout.html +++ b/swh/web/templates/layout.html @@ -237,7 +237,9 @@
{% if swh_web_staging %} -
Staging
+
Staging
v{{ swh_web_version }}
+ {% elif swh_web_dev %} +
Development
v{{ swh_web_version|split:"+"|first }}
{% endif %} {% block content %}{% endblock %}
@@ -251,17 +253,18 @@ Software Heritage — Copyright (C) 2015–{% now "Y" %}, The Software Heritage developers. License: GNU - AGPLv3+.
The source code of Software Heritage itself + AGPLv3+.
The source code of Software Heritage itself is available on our development - forge.
The source code files archived by Software - Heritage are available under their own copyright and licenses.
+ forge.
The source code files archived by Software + Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API- Contact- JavaScript license information- - Web API + Web API
+ swh-web v{{ swh_web_version }}
diff --git a/swh/web/tests/test_templates.py b/swh/web/tests/test_templates.py --- a/swh/web/tests/test_templates.py +++ b/swh/web/tests/test_templates.py @@ -6,13 +6,17 @@ from copy import deepcopy import random +from pkg_resources import get_distribution + from swh.web.common.utils import reverse from swh.web.config import STAGING_SERVER_NAMES, get_config from swh.web.tests.django_asserts import assert_contains, assert_not_contains from swh.web.tests.utils import check_http_get_response +swh_web_version = get_distribution("swh.web").version + -def test_layout_without_staging_ribbon(client): +def test_layout_without_ribbon(client): url = reverse("swh-web-homepage") resp = check_http_get_response(client, url, status_code=200) assert_not_contains(resp, "swh-corner-ribbon") @@ -24,6 +28,16 @@ client, url, status_code=200, server_name=random.choice(STAGING_SERVER_NAMES), ) assert_contains(resp, "swh-corner-ribbon") + assert_contains(resp, f"Staging
v{swh_web_version}") + + +def test_layout_with_development_ribbon(client): + url = reverse("swh-web-homepage") + resp = check_http_get_response( + client, url, status_code=200, server_name="localhost", + ) + assert_contains(resp, "swh-corner-ribbon") + assert_contains(resp, f"Development
v{swh_web_version.split('+')[0]}") def test_layout_with_oidc_auth_enabled(client): @@ -41,3 +55,9 @@ url = reverse("swh-web-homepage") resp = check_http_get_response(client, url, status_code=200) assert_contains(resp, reverse("login")) + + +def test_layout_swh_web_version_number_display(client): + url = reverse("swh-web-homepage") + resp = check_http_get_response(client, url, status_code=200) + assert_contains(resp, f"swh-web v{swh_web_version}")