Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9342169
D3081.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Subscribers
None
D3081.diff
View Options
diff --git a/swh/web/templates/browse/browse.html b/swh/web/templates/browse/browse.html
--- a/swh/web/templates/browse/browse.html
+++ b/swh/web/templates/browse/browse.html
@@ -15,11 +15,11 @@
{% if snapshot_context %}
<h4>
<i class="{{ swh_object_icons|key_value:swh_object_name.lower }} fa-fw" aria-hidden="true"></i>
- Browse archived {{ swh_object_name.lower }}
+
{% if snapshot_context.origin_info %}
- for origin
+ Browse archived {{ swh_object_name.lower }} for origin
<a href="{% url 'browse-origin' %}?origin_url={{ snapshot_context.origin_info.url }}">
- {% url 'browse-origin' %}?origin_url={{ snapshot_context.origin_info.url }}
+ {{ snapshot_context.origin_info.url }}
</a>
{% if snapshot_context.origin_info.url|slice:"0:4" == "http" %}
<a href="{{ snapshot_context.origin_info.url }}" title="Go to origin">
@@ -27,7 +27,7 @@
</a>
{% endif %}
{% else %}
- for snapshot
+ Browse archived {{ swh_object_name.lower }} for snapshot
<a href="{% url 'browse-swh-id' snapshot_context.snapshot_swhid %}">
{{ snapshot_context.snapshot_swhid }}
</a>
diff --git a/swh/web/tests/browse/views/test_content.py b/swh/web/tests/browse/views/test_content.py
--- a/swh/web/tests/browse/views/test_content.py
+++ b/swh/web/tests/browse/views/test_content.py
@@ -3,6 +3,8 @@
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
+import textwrap
+
from django.utils.html import escape
from hypothesis import given
@@ -61,6 +63,18 @@
swh_cnt_id_url = reverse("browse-swh-id", url_args={"swh_id": swh_cnt_id})
assert_contains(resp, swh_cnt_id)
assert_contains(resp, swh_cnt_id_url)
+ assert_contains(
+ resp,
+ textwrap.indent(
+ (
+ f"Browse archived content\n"
+ f'<a href="{swh_cnt_id_url}">\n'
+ f" {swh_cnt_id}\n"
+ f"</a>"
+ ),
+ " " * 4,
+ ),
+ )
@given(content_text_no_highlight())
diff --git a/swh/web/tests/browse/views/test_directory.py b/swh/web/tests/browse/views/test_directory.py
--- a/swh/web/tests/browse/views/test_directory.py
+++ b/swh/web/tests/browse/views/test_directory.py
@@ -4,6 +4,7 @@
# See top-level LICENSE file for more information
import random
+import textwrap
from hypothesis import given
@@ -147,3 +148,16 @@
swh_dir_id_url = reverse("browse-swh-id", url_args={"swh_id": swh_dir_id})
assert_contains(resp, swh_dir_id)
assert_contains(resp, swh_dir_id_url)
+
+ assert_contains(
+ resp,
+ textwrap.indent(
+ (
+ f"Browse archived directory\n"
+ f'<a href="{swh_dir_id_url}">\n'
+ f" {swh_dir_id}\n"
+ f"</a>"
+ ),
+ " " * 4,
+ ),
+ )
diff --git a/swh/web/tests/browse/views/test_origin.py b/swh/web/tests/browse/views/test_origin.py
--- a/swh/web/tests/browse/views/test_origin.py
+++ b/swh/web/tests/browse/views/test_origin.py
@@ -7,6 +7,7 @@
import random
import re
import string
+import textwrap
from django.utils.html import escape
@@ -67,6 +68,8 @@
)
assert_contains(resp, browse_dir_url)
+ _check_origin_view_title(resp, origin["url"], "visits")
+
@given(origin_with_multiple_visits())
def test_origin_content_view(client, archive_data, origin):
@@ -844,6 +847,8 @@
assert_contains(resp, "swh-take-new-snapshot")
+ _check_origin_view_title(resp, origin_info["url"], "content")
+
def _origin_directory_view_test_helper(
client,
@@ -976,6 +981,8 @@
assert_contains(resp, "swh-take-new-snapshot")
+ _check_origin_view_title(resp, origin_info["url"], "directory")
+
def _origin_branches_test_helper(client, origin_info, origin_snapshot):
query_params = {"origin_url": origin_info["url"]}
@@ -1021,6 +1028,8 @@
)
assert_contains(resp, '<a href="%s">' % escape(browse_revision_url))
+ _check_origin_view_title(resp, origin_info["url"], "branches")
+
def _origin_releases_test_helper(client, origin_info, origin_snapshot):
query_params = {"origin_url": origin_info["url"]}
@@ -1066,6 +1075,8 @@
assert_contains(resp, '<a href="%s">' % escape(browse_release_url))
assert_contains(resp, '<a href="%s">' % escape(browse_revision_url))
+ _check_origin_view_title(resp, origin_info["url"], "releases")
+
@given(
new_origin(), visit_dates(), revisions(min_size=10, max_size=10), existing_release()
@@ -1108,3 +1119,22 @@
assert resp.status_code == 200
assert_template_used(resp, "browse/branches.html")
assert_contains(resp, '<ul class="pagination')
+
+
+def _check_origin_view_title(resp, origin_url, object_type):
+ browse_origin_url = reverse(
+ "browse-origin", query_params={"origin_url": origin_url}
+ )
+
+ assert_contains(
+ resp,
+ textwrap.indent(
+ (
+ f"Browse archived {object_type} for origin\n"
+ f'<a href="{browse_origin_url}">\n'
+ f" {origin_url}\n"
+ f"</a>"
+ ),
+ " " * 6,
+ ),
+ )
diff --git a/swh/web/tests/browse/views/test_release.py b/swh/web/tests/browse/views/test_release.py
--- a/swh/web/tests/browse/views/test_release.py
+++ b/swh/web/tests/browse/views/test_release.py
@@ -4,6 +4,7 @@
# See top-level LICENSE file for more information
import random
+import textwrap
from hypothesis import given
@@ -104,6 +105,30 @@
assert_contains(resp, swh_rel_id)
assert_contains(resp, swh_rel_id_url)
+ if origin_info:
+ browse_origin_url = reverse(
+ "browse-origin", query_params={"origin_url": origin_info["url"]}
+ )
+ title = (
+ f"Browse archived release for origin\n"
+ f'<a href="{browse_origin_url}">\n'
+ f' {origin_info["url"]}\n'
+ f"</a>"
+ )
+ indent = " " * 6
+ else:
+ title = (
+ f"Browse archived release\n"
+ f'<a href="{swh_rel_id_url}">\n'
+ f" {swh_rel_id}\n"
+ f"</a>"
+ )
+ indent = " " * 4
+
+ assert_contains(
+ resp, textwrap.indent(title, indent),
+ )
+
if release_data["target_type"] == "revision":
if origin_info:
directory_url = reverse(
diff --git a/swh/web/tests/browse/views/test_revision.py b/swh/web/tests/browse/views/test_revision.py
--- a/swh/web/tests/browse/views/test_revision.py
+++ b/swh/web/tests/browse/views/test_revision.py
@@ -3,6 +3,8 @@
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
+import textwrap
+
from django.utils.html import escape
from hypothesis import given
@@ -49,6 +51,22 @@
assert_contains(resp, escape(message_lines[0]))
assert_contains(resp, escape("\n".join(message_lines[1:])))
+ swh_rev_id = get_swh_persistent_id("revision", revision)
+ swh_rev_id_url = reverse("browse-swh-id", url_args={"swh_id": swh_rev_id})
+
+ assert_contains(
+ resp,
+ textwrap.indent(
+ (
+ f"Browse archived revision\n"
+ f'<a href="{swh_rev_id_url}">\n'
+ f" {swh_rev_id}\n"
+ f"</a>"
+ ),
+ " " * 4,
+ ),
+ )
+
@given(origin())
def test_revision_origin_browse(client, archive_data, origin):
@@ -209,6 +227,22 @@
resp, '<a class="page-link" href="%s">Older</a>' % escape(next_page_url),
)
+ swh_rev_id = get_swh_persistent_id("revision", revision)
+ swh_rev_id_url = reverse("browse-swh-id", url_args={"swh_id": swh_rev_id})
+
+ assert_contains(
+ resp,
+ textwrap.indent(
+ (
+ f"Browse archived revisions history\n"
+ f'<a href="{swh_rev_id_url}">\n'
+ f" {swh_rev_id}\n"
+ f"</a>"
+ ),
+ " " * 4,
+ ),
+ )
+
@given(revision(), unknown_revision(), new_origin())
def test_revision_request_errors(client, revision, unknown_revision, new_origin):
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 12:31 PM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3216745
Attached To
D3081: browse: Fix origin view titles
Event Timeline
Log In to Comment