Page MenuHomeSoftware Heritage

browse: Add dedicated icon for snapshot branch alias
ClosedPublic

Authored by anlambert on Nov 4 2020, 3:48 PM.

Details

Summary

In order to distinguish alias branches from the others, display a dedicated icon
in branches / releases list views.

I chose a star icon for a branch alias, not sure if it is the best one.
Any other icon choice suggestion is welcolme.

Depends on D4356

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 D4409 (id=15626)

Could not rebase; Attempt merge onto 527e7b0a87...

Updating 527e7b0a..f14677db
Fast-forward
 swh/web/browse/snapshot_context.py             | 103 ++++++++++++++-----------
 swh/web/common/archive.py                      |  68 +++++++++-------
 swh/web/common/typing.py                       |   8 ++
 swh/web/common/utils.py                        |   1 +
 swh/web/templates/browse/branches.html         |   7 +-
 swh/web/templates/browse/releases.html         |   7 +-
 swh/web/templates/includes/top-navigation.html |  24 +++++-
 swh/web/tests/browse/test_snapshot_context.py  |  27 +++++--
 swh/web/tests/browse/views/test_content.py     |  22 ++++--
 swh/web/tests/browse/views/test_directory.py   |  22 ++++--
 swh/web/tests/browse/views/test_origin.py      |  69 ++++++++++++-----
 swh/web/tests/common/test_archive.py           |  25 ++++++
 swh/web/tests/conftest.py                      |   6 ++
 13 files changed, 268 insertions(+), 121 deletions(-)
Changes applied before test
commit f14677db1927a6b1d8f0e83a3a1a564006fd46f9
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Wed Nov 4 15:45:06 2020 +0100

    browse: Add dedicated icon for snapshot branch alias
    
    In order to distinguish alias branches from the others, display a dedicated icon
    in branches / releases list views.

commit 25d33a00a0171fab288a6a366b66bf134ca4eba4
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Mon Oct 26 18:34:46 2020 +0100

    browse/snapshot_context: Put processed snapshot sizes in cache
    
    Put processed snapshot sizes in cache to avoid sending the same set of
    database queries each time a page is loaded when browsing the archive
    in the context of a specific snapshot.
    
    Closes T2734

commit 907c4760d11224bfb1ddffcabc054b1eb161a197
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Mon Oct 26 18:26:20 2020 +0100

    common/archive: Avoid db timeouts in lookup_snapshot_sizes
    
    When querying all branch aliases in a snapshot, the underlying database
    query can timeout as it is not properly indexable.
    
    That commit stops to try resolving aliases when getting snapshot sizes
    and only resolve an alias when required for display.
    
    Related to T2734

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

ardumont added a subscriber: ardumont.

lgtm

a couple of remarks or (unconvinced) suggestions.

swh/web/common/utils.py
28

as another proposal which i'm not entirely convinced is relevant would be a symbolic link icon or some such?

otherwise, i don't have something better than your initial star idea ¯\_(ツ)_/¯

(some of the object icons values in this very dict, folder, document are file-system oriented after all...)

swh/web/templates/browse/branches.html
32

I don't recall if the following is possible?

<i class="{{ swh_object_icons.alias if branch.alias else swh_object_icons.branch }} mdi-fw" aria-hidden="true"></i>

I'm not too sure it's more readable though...
Well, what would be more readable if the theme was computed earlier, maybe?

¯\_(ツ)_/¯

This revision is now accepted and ready to land.Nov 5 2020, 9:12 AM

Build is green

Patch application report for D4409 (id=15690)

Could not rebase; Attempt merge onto 8daf7a8fda...

Updating 8daf7a8f..e4397e79
Fast-forward
 swh/web/browse/snapshot_context.py             | 103 ++++++++++++++-----------
 swh/web/common/archive.py                      |  61 ++++++++-------
 swh/web/common/typing.py                       |   8 ++
 swh/web/common/utils.py                        |   1 +
 swh/web/templates/browse/branches.html         |   7 +-
 swh/web/templates/browse/releases.html         |   7 +-
 swh/web/templates/includes/top-navigation.html |  24 +++++-
 swh/web/tests/browse/test_snapshot_context.py  |  27 +++++--
 swh/web/tests/browse/views/test_content.py     |  22 ++++--
 swh/web/tests/browse/views/test_directory.py   |  22 ++++--
 swh/web/tests/browse/views/test_origin.py      |  69 ++++++++++++-----
 swh/web/tests/common/test_archive.py           |  25 ++++++
 swh/web/tests/conftest.py                      |   6 ++
 13 files changed, 261 insertions(+), 121 deletions(-)
Changes applied before test
commit e4397e793e90beb62d1588bf4f9fa19495afe559
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Wed Nov 4 15:45:06 2020 +0100

    browse: Add dedicated icon for snapshot branch alias
    
    In order to distinguish alias branches from the others, display a dedicated icon
    in branches / releases list views.

commit 3c59879e2fe6379a4ebeae4cb4449ce02221d608
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Mon Oct 26 18:34:46 2020 +0100

    browse/snapshot_context: Put processed snapshot sizes in cache
    
    Put processed snapshot sizes in cache to avoid sending the same set of
    database queries each time a page is loaded when browsing the archive
    in the context of a specific snapshot.
    
    Closes T2734

commit c469412a897ac980ccab72ba5c6d71b159e6a672
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Mon Oct 26 18:26:20 2020 +0100

    common/archive: Avoid db timeouts in lookup_snapshot_sizes
    
    When querying all branch aliases in a snapshot, the underlying database
    query can timeout as it is not properly indexable.
    
    That commit stops to try resolving aliases when getting snapshot sizes
    and only resolve an alias when required for display.
    
    Related to T2734

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