Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Douard
swh-web
Commits
46a3271c
Commit
46a3271c
authored
5 months ago
by
David Douard
Browse files
Options
Downloads
Patches
Plain Diff
web: always activate cache for coverage, webapp (visit_types) and browse (visit_types) views
parent
2569d641
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
swh/web/archive_coverage/views.py
+8
-17
8 additions, 17 deletions
swh/web/archive_coverage/views.py
swh/web/browse/urls.py
+2
-2
2 additions, 2 deletions
swh/web/browse/urls.py
swh/web/webapp/urls.py
+2
-2
2 additions, 2 deletions
swh/web/webapp/urls.py
with
12 additions
and
21 deletions
swh/web/archive_coverage/views.py
+
8
−
17
View file @
46a3271c
...
...
@@ -17,14 +17,7 @@ from django.views.decorators.clickjacking import xframe_options_exempt
from
swh.scheduler.model
import
SchedulerMetrics
from
swh.web.config
import
scheduler
from
swh.web.utils
import
(
archive
,
django_cache
,
get_deposits_list
,
is_swh_web_development
,
is_swh_web_production
,
reverse
,
)
from
swh.web.utils
import
archive
,
django_cache
,
get_deposits_list
,
reverse
_swh_arch_overview_doc
=
(
"
https://docs.softwareheritage.org/devel/architecture/overview.html
"
...
...
@@ -551,8 +544,7 @@ def _search_url(query: str, visit_type: str) -> str:
@xframe_options_exempt
@never_cache
def
swh_coverage
(
request
:
HttpRequest
)
->
HttpResponse
:
use_cache
=
is_swh_web_production
(
request
)
listers_metrics
=
_get_listers_metrics
(
use_cache
)
listers_metrics
=
_get_listers_metrics
(
cache_metrics
=
True
)
for
origins
in
listed_origins
[
"
origins
"
]:
origins
[
"
count
"
]
=
"
0
"
...
...
@@ -574,7 +566,7 @@ def swh_coverage(request: HttpRequest) -> HttpResponse:
)
# visit type from legacy nixguix lister
visit_type_counts
[
"
nixguix
"
]
=
_get_nixguix_origins_count
(
manifest_url
,
cache_count
=
use_cach
e
manifest_url
,
cache_count
=
Tru
e
)
count
=
sum
(
visit_type_counts
.
values
())
...
...
@@ -634,11 +626,10 @@ def swh_coverage(request: HttpRequest) -> HttpResponse:
search_url
=
_search_url
(
search_pattern
,
visit_type
)
visit_types
[
visit_type
][
"
search_url
"
]
=
search_url
# filter out origin types without archived origins on production and staging
if
not
is_swh_web_development
(
request
):
listed_origins
[
"
origins
"
]
=
list
(
filter
(
lambda
o
:
o
[
"
count
"
]
!=
"
0
"
,
listed_origins
[
"
origins
"
])
)
# filter out origin types without archived origins
listed_origins
[
"
origins
"
]
=
list
(
filter
(
lambda
o
:
o
[
"
count
"
]
!=
"
0
"
,
listed_origins
[
"
origins
"
])
)
for
origins
in
legacy_origins
[
"
origins
"
]:
origins
[
"
search_urls
"
]
=
{}
...
...
@@ -647,7 +638,7 @@ def swh_coverage(request: HttpRequest) -> HttpResponse:
origins
[
"
search_pattern
"
],
visit_type
)
deposits_counts
=
_get_deposits_netloc_counts
(
use_
cache
)
deposits_counts
=
_get_deposits_netloc_counts
(
cach
e_counts
=
Tru
e
)
for
origins
in
deposited_origins
[
"
origins
"
]:
origins
[
"
count
"
]
=
"
0
"
...
...
This diff is collapsed.
Click to expand it.
swh/web/browse/urls.py
+
2
−
2
View file @
46a3271c
...
...
@@ -16,7 +16,7 @@ import swh.web.browse.views.origin # noqa
import
swh.web.browse.views.release
# noqa
import
swh.web.browse.views.revision
# noqa
import
swh.web.browse.views.snapshot
# noqa
from
swh.web.utils
import
is_swh_web_production
,
origin_visit_types
,
reverse
from
swh.web.utils
import
origin_visit_types
,
reverse
from
swh.web.utils.url_path_converters
import
register_url_path_converters
...
...
@@ -32,7 +32,7 @@ def _browse_search_view(request: HttpRequest) -> HttpResponse:
"
browse-search.html
"
,
{
"
heading
"
:
"
Search software origins to browse
"
,
"
visit_types
"
:
origin_visit_types
(
use_cache
=
is_swh_web_production
(
request
)
),
"
visit_types
"
:
origin_visit_types
(
use_cache
=
True
),
},
)
...
...
This diff is collapsed.
Click to expand it.
swh/web/webapp/urls.py
+
2
−
2
View file @
46a3271c
...
...
@@ -16,7 +16,7 @@ from django.urls import re_path as url
from
django.views.generic.base
import
RedirectView
from
swh.web.config
import
get_config
from
swh.web.utils
import
archive
,
is_swh_web_production
,
origin_visit_types
from
swh.web.utils
import
archive
,
origin_visit_types
from
swh.web.utils.exc
import
sentry_capture_exception
swh_web_config
=
get_config
()
...
...
@@ -32,7 +32,7 @@ def default_view(request):
return
render
(
request
,
"
homepage.html
"
,
{
"
visit_types
"
:
origin_visit_types
(
use_cache
=
is_swh_web_production
(
request
)
)},
{
"
visit_types
"
:
origin_visit_types
(
use_cache
=
True
)},
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment