diff --git a/archivebox/crawls/admin.py b/archivebox/crawls/admin.py index 736cab63..0546c469 100644 --- a/archivebox/crawls/admin.py +++ b/archivebox/crawls/admin.py @@ -8,7 +8,8 @@ from django.utils.html import escape, format_html, format_html_join from django.utils import timezone from django.utils.safestring import mark_safe from django.contrib import admin, messages -from django.db.models import Count, Prefetch, Q +from django.db.models import Count, IntegerField, OuterRef, Prefetch, Q, Subquery, Value +from django.db.models.functions import Coalesce from django_object_actions import action @@ -589,7 +590,10 @@ class CrawlAdmin(ConfigEditorMixin, BaseModelAdmin): change_actions = ["recrawl"] def get_queryset(self, request): - """Keep the changelist query page-local; counts are resolved per displayed row.""" + """Keep joins page-local while computing per-row snapshot counts in the page query.""" + snapshot_count = ( + Snapshot.objects.filter(crawl_id=OuterRef("pk")).order_by().values("crawl_id").annotate(count=Count("pk")).values("count") + ) return ( super() .get_queryset(request) @@ -597,6 +601,12 @@ class CrawlAdmin(ConfigEditorMixin, BaseModelAdmin): "created_by", Prefetch("schedule", queryset=CrawlSchedule.objects.select_related("template")), ) + .annotate( + num_snapshots_cached=Coalesce( + Subquery(snapshot_count, output_field=IntegerField()), + Value(0), + ), + ) ) def get_fieldsets(self, request, obj=None): diff --git a/archivebox/personas/admin.py b/archivebox/personas/admin.py index 60740ded..7caee68a 100644 --- a/archivebox/personas/admin.py +++ b/archivebox/personas/admin.py @@ -27,7 +27,7 @@ class PersonaAdmin(ConfigEditorMixin, BaseModelAdmin): "Persona", { "fields": ("name", "created_by"), - "classes": ("card",), + "classes": ("card", "persona-card-primary"), }, ), ( @@ -54,7 +54,17 @@ class PersonaAdmin(ConfigEditorMixin, BaseModelAdmin): ), ) - change_fieldsets = add_fieldsets + ( + change_fieldsets = ( + add_fieldsets[0], + ( + "Timestamps", + { + "fields": ("id", "created_at"), + "classes": ("card", "persona-card-timestamps"), + }, + ), + add_fieldsets[1], + add_fieldsets[2], ( "Artifacts", { @@ -62,13 +72,6 @@ class PersonaAdmin(ConfigEditorMixin, BaseModelAdmin): "classes": ("card", "wide"), }, ), - ( - "Timestamps", - { - "fields": ("id", "created_at"), - "classes": ("card",), - }, - ), ) @admin.display(description="Chrome Profile") diff --git a/archivebox/templates/admin/personas/persona/change_form.html b/archivebox/templates/admin/personas/persona/change_form.html index 4511f8a1..5969ffc2 100644 --- a/archivebox/templates/admin/personas/persona/change_form.html +++ b/archivebox/templates/admin/personas/persona/change_form.html @@ -200,22 +200,55 @@ } } - .persona-plugin-config { - margin: 0 0 24px; + body.model-persona.change-form #content-main form fieldset.persona-card-primary { + flex: 1 1 520px !important; + max-width: calc(66.66% - 10px) !important; + } + + body.model-persona.change-form #content-main form fieldset.persona-card-timestamps { + flex: 0 1 300px !important; + min-width: 240px !important; + max-width: 320px !important; + align-self: flex-start; + } + + body.model-persona.change-form #content-main form fieldset.persona-card-timestamps > div { + padding: 12px 14px; + } + + body.model-persona.change-form #content-main form fieldset.persona-card-timestamps .form-row { + padding: 5px 0; + } + + body.model-persona.change-form #content-main form fieldset.persona-card-timestamps .readonly { + font-size: 12px; + line-height: 1.4; + overflow-wrap: anywhere; + } + + body.model-persona.change-form #content-main form .persona-plugin-config { + flex: 1 1 100% !important; + min-width: 100% !important; + max-width: 100% !important; + width: 100% !important; + box-sizing: border-box; + margin: 0 0 24px !important; } .persona-plugin-config h2 { - margin: 0 0 6px; - color: #004882; - font-size: 18px; + color: #334155 !important; } .persona-plugin-config > p { - margin: 0 0 14px; + margin: 12px 16px 0; color: #64748b; font-size: 13px; } + .persona-plugin-config .plugin-config-grid { + padding: 16px; + } + {% endblock %} diff --git a/etc/package.json b/etc/package.json index 6af435e4..42728787 100644 --- a/etc/package.json +++ b/etc/package.json @@ -1,6 +1,6 @@ { "name": "archivebox", - "version": "0.9.31rc34", + "version": "0.9.31rc35", "repository": "github:ArchiveBox/ArchiveBox", "license": "MIT", "dependencies": { diff --git a/pyproject.toml b/pyproject.toml index f530b519..f5f36c89 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "archivebox" -version = "0.9.31rc34" +version = "0.9.31rc35" requires-python = ">=3.13" description = "Self-hosted internet archiving solution." authors = [{name = "Nick Sweeting", email = "pyproject.toml@archivebox.io"}] @@ -80,8 +80,8 @@ dependencies = [ ### Binary/Package Management "abxbus>=2.5.4", # EventBus API "abxpkg>=1.10.24", # for: detecting, versioning, and installing binaries via apt/brew/pip/npm - "abx-plugins>=1.10.90", # shared ArchiveBox plugin package with Chrome/Puppeteer dependency wiring - "abx-dl>=1.10.90", # shared ArchiveBox downloader package with blocking install preflight + "abx-plugins>=1.10.91", # shared ArchiveBox plugin package with Chrome/Puppeteer dependency wiring + "abx-dl>=1.10.91", # shared ArchiveBox downloader package with blocking install preflight ### UUID7 backport for Python <3.14 "uuid7>=0.1.0; python_version < '3.14'", # provides the uuid_extensions module on Python 3.13 ]