mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat: add "Last Updated" column to search results
Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
parent
becce1aac4
commit
ec239ceeb3
3 changed files with 23 additions and 1 deletions
|
@ -102,6 +102,7 @@ async def packages_get(
|
||||||
models.PackageBase.Popularity,
|
models.PackageBase.Popularity,
|
||||||
models.PackageBase.NumVotes,
|
models.PackageBase.NumVotes,
|
||||||
models.PackageBase.OutOfDateTS,
|
models.PackageBase.OutOfDateTS,
|
||||||
|
models.PackageBase.ModifiedTS,
|
||||||
models.User.Username.label("Maintainer"),
|
models.User.Username.label("Maintainer"),
|
||||||
models.PackageVote.PackageBaseID.label("Voted"),
|
models.PackageVote.PackageBaseID.label("Voted"),
|
||||||
models.PackageNotification.PackageBaseID.label("Notify"),
|
models.PackageNotification.PackageBaseID.label("Notify"),
|
||||||
|
|
|
@ -68,6 +68,16 @@
|
||||||
{{ "Maintainer" | tr }}
|
{{ "Maintainer" | tr }}
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
|
<th>
|
||||||
|
{% if SB == "l" %}
|
||||||
|
{% set order = reverse_order %}
|
||||||
|
{% else %}
|
||||||
|
{% set order = SO %}
|
||||||
|
{% endif %}
|
||||||
|
<a href="/packages?{{ q | extend_query(('O', 0), ('SB', 'l'), ('SO', order)) | urlencode }}">
|
||||||
|
{{ "Last Updated" | tr }}
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -115,6 +125,11 @@
|
||||||
<span class="error">{{ "orphan" | tr }}</span>
|
<span class="error">{{ "orphan" | tr }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
{% if flagged %}
|
||||||
|
<td class="flagged">{{ datetime_display(pkg.ModifiedTS) }}</td>
|
||||||
|
{% else %}
|
||||||
|
<td>{{ datetime_display(pkg.ModifiedTS) }}</td>
|
||||||
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -5,7 +5,8 @@ from unittest import mock
|
||||||
import pytest
|
import pytest
|
||||||
from fastapi.testclient import TestClient
|
from fastapi.testclient import TestClient
|
||||||
|
|
||||||
from aurweb import asgi, db, time
|
from aurweb import asgi, config, db, time
|
||||||
|
from aurweb.filters import datetime_display
|
||||||
from aurweb.models import License, PackageLicense
|
from aurweb.models import License, PackageLicense
|
||||||
from aurweb.models.account_type import USER_ID, AccountType
|
from aurweb.models.account_type import USER_ID, AccountType
|
||||||
from aurweb.models.dependency_type import DependencyType
|
from aurweb.models.dependency_type import DependencyType
|
||||||
|
@ -1085,6 +1086,11 @@ def test_packages_sort_by_last_modified(client: TestClient, packages: list[Packa
|
||||||
col = row.xpath("./td")[0].xpath("./a")[0]
|
col = row.xpath("./td")[0].xpath("./a")[0]
|
||||||
assert col.text.strip() == package.Name
|
assert col.text.strip() == package.Name
|
||||||
|
|
||||||
|
# Make sure our row contains the modified date we've set
|
||||||
|
tz = config.get("options", "default_timezone")
|
||||||
|
dt = datetime_display({"timezone": tz}, package.PackageBase.ModifiedTS)
|
||||||
|
assert dt in "".join(row.itertext())
|
||||||
|
|
||||||
|
|
||||||
def test_packages_flagged(
|
def test_packages_flagged(
|
||||||
client: TestClient, maintainer: User, packages: list[Package]
|
client: TestClient, maintainer: User, packages: list[Package]
|
||||||
|
|
Loading…
Add table
Reference in a new issue