Page MenuHomeSoftware Heritage

misc: Move SWHID iframe view in browse django application
ClosedPublic

Authored by anlambert on Aug 23 2022, 4:00 PM.

Details

Summary

It heavily depends on browse templates so better moving it here.

Also changes view URL from /embed/<swhid>/ to /browse/embed/<swhid>/
but keeps backward compatibility by adding a redirection from the
old URL to the new one.

Depends on D8294

Diff Detail

Repository
rDWAPPS Web applications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D8295 (id=29953)

Could not rebase; Attempt merge onto eb2cda51ca...

Updating eb2cda51..007c9c78
Fast-forward
 .../{webapp/iframes.js => browse/iframe.js}        |  6 +--
 assets/src/bundles/browse/index.js                 |  9 ++--
 assets/src/bundles/webapp/index.js                 | 20 ++++----
 swh/web/browse/snapshot_context.py                 |  8 ++--
 .../templates/browse-branches.html}                |  4 +-
 .../templates/browse-content.html}                 |  6 +--
 .../templates/browse-directory.html}               |  8 ++--
 .../templates/browse-help.html}                    |  0
 .../templates/browse-iframe.html}                  |  6 +--
 .../templates/browse-origin-visits.html}           |  0
 .../templates/browse-release.html}                 |  4 +-
 .../templates/browse-releases.html}                |  4 +-
 .../templates/browse-revision-log.html}            |  6 +--
 .../templates/browse-revision.html}                | 10 ++--
 .../templates/browse-search.html}                  |  6 +--
 .../templates/browse-vault-ui.html}                |  6 +--
 .../browse => browse/templates}/browse.html        | 15 ++++--
 .../templates/includes/branch-search.html          |  0
 .../templates/includes/breadcrumbs.html            |  0
 .../templates/includes/content-display.html        |  4 +-
 .../templates/includes/directory-display.html      |  6 +--
 .../templates/includes/empty-snapshot.html         |  0
 .../templates/includes/origin-search-form.html     |  0
 .../templates/includes/readme-display.html         |  0
 .../templates/includes/revision-info.html          |  0
 .../templates/includes/show-metadata.html          |  0
 .../templates/includes/show-swhids.html            |  4 +-
 .../templates/includes/snapshot-context.html       |  0
 .../templates/includes/take-new-snapshot.html      |  0
 .../templates/includes/top-navigation.html         | 12 ++---
 .../templates/includes/vault-common.html           |  0
 .../templates/includes/vault-create-tasks.html     |  2 +-
 swh/web/browse/urls.py                             | 16 +++++--
 swh/web/browse/views/content.py                    |  2 +-
 swh/web/browse/views/directory.py                  |  2 +-
 swh/web/{misc => browse/views}/iframe.py           | 17 ++++---
 swh/web/browse/views/origin.py                     |  2 +-
 swh/web/browse/views/release.py                    |  2 +-
 swh/web/browse/views/revision.py                   |  4 +-
 swh/web/misc/urls.py                               |  1 -
 swh/web/templates/browse/layout.html               | 23 ---------
 swh/web/tests/browse/views/test_content.py         | 34 ++++++-------
 swh/web/tests/browse/views/test_directory.py       | 16 +++----
 swh/web/tests/browse/views/test_identifiers.py     |  6 +--
 .../tests/{misc => browse/views}/test_iframe.py    | 56 +++++++++++++++-------
 swh/web/tests/browse/views/test_origin.py          | 24 +++++-----
 swh/web/tests/browse/views/test_release.py         |  4 +-
 swh/web/tests/browse/views/test_revision.py        | 14 +++---
 swh/web/tests/browse/views/test_snapshot.py        | 18 +++----
 49 files changed, 203 insertions(+), 184 deletions(-)
 rename assets/src/bundles/{webapp/iframes.js => browse/iframe.js} (75%)
 rename swh/web/{templates/browse/branches.html => browse/templates/browse-branches.html} (96%)
 rename swh/web/{templates/browse/content.html => browse/templates/browse-content.html} (66%)
 rename swh/web/{templates/browse/directory.html => browse/templates/browse-directory.html} (63%)
 rename swh/web/{templates/browse/help.html => browse/templates/browse-help.html} (100%)
 rename swh/web/{templates/misc/iframe.html => browse/templates/browse-iframe.html} (97%)
 rename swh/web/{templates/browse/origin-visits.html => browse/templates/browse-origin-visits.html} (100%)
 rename swh/web/{templates/browse/release.html => browse/templates/browse-release.html} (90%)
 rename swh/web/{templates/browse/releases.html => browse/templates/browse-releases.html} (96%)
 rename swh/web/{templates/browse/revision-log.html => browse/templates/browse-revision-log.html} (96%)
 rename swh/web/{templates/browse/revision.html => browse/templates/browse-revision.html} (94%)
 rename swh/web/{templates/browse/search.html => browse/templates/browse-search.html} (90%)
 rename swh/web/{templates/browse/vault-ui.html => browse/templates/browse-vault-ui.html} (92%)
 rename swh/web/{templates/browse => browse/templates}/browse.html (67%)
 rename swh/web/{ => browse}/templates/includes/branch-search.html (100%)
 rename swh/web/{ => browse}/templates/includes/breadcrumbs.html (100%)
 rename swh/web/{ => browse}/templates/includes/content-display.html (97%)
 rename swh/web/{ => browse}/templates/includes/directory-display.html (93%)
 rename swh/web/{ => browse}/templates/includes/empty-snapshot.html (100%)
 rename swh/web/{ => browse}/templates/includes/origin-search-form.html (100%)
 rename swh/web/{ => browse}/templates/includes/readme-display.html (100%)
 rename swh/web/{ => browse}/templates/includes/revision-info.html (100%)
 rename swh/web/{ => browse}/templates/includes/show-metadata.html (100%)
 rename swh/web/{ => browse}/templates/includes/show-swhids.html (98%)
 rename swh/web/{ => browse}/templates/includes/snapshot-context.html (100%)
 rename swh/web/{ => browse}/templates/includes/take-new-snapshot.html (100%)
 rename swh/web/{ => browse}/templates/includes/top-navigation.html (95%)
 rename swh/web/{ => browse}/templates/includes/vault-common.html (100%)
 rename swh/web/{ => browse}/templates/includes/vault-create-tasks.html (99%)
 rename swh/web/{misc => browse/views}/iframe.py (96%)
 delete mode 100644 swh/web/templates/browse/layout.html
 rename swh/web/tests/{misc => browse/views}/test_iframe.py (57%)
Changes applied before test
commit 007c9c782df9539968362c4e481045d86575bdba
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Aug 23 15:38:28 2022 +0200

    misc: Move SWHID iframe view in browse django application
    
    It heavily depends on browse templates so better moving it here.
    
    Also changes view URL from /embed/<swhid>/ to /browse/embed/<swhid>/
    but keeps backward compatibility by adding a redirection from the
    old URL to the new one.

commit 4b1ee050986129a7b3ee7d0732fa91afe107401d
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Aug 11 17:06:15 2022 +0200

    browse: Move related templates into dedicated django application
    
    Related to T4398

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1997/ for more details.

This revision is now accepted and ready to land.Aug 23 2022, 4:50 PM