fix(files): a steady list header, every user on the Storage tab, the name gets the row's room
- The Files list starts at the scroller's top: the padding above it let the sticky header ride up 12px on the first scroll, then stop. - Users -> Storage lists every user with their quota, not only those already holding a file — a quota is set before anyone downloads. - On a wide Files list only the "…" holds a place; Copy link, Share and Save come up over the date while the row is hovered or holds the keyboard (a card keeps them in its line). Keeps is narrower.
This commit is contained in:
@@ -593,9 +593,10 @@ def test_the_admin_storage_view_counts_a_waiting_upload(db, as_user, make_user,
|
||||
_probe(monkeypatch)
|
||||
u = make_user()
|
||||
_ingest(db, _root, u.id, size=10)
|
||||
r = as_user(make_user(role="admin")).get("/api/admin/downloads/storage").json()
|
||||
admin = make_user(role="admin")
|
||||
r = as_user(admin).get("/api/admin/downloads/storage").json()
|
||||
assert (r["files_on_disk"], r["total_bytes"]) == (1, 10)
|
||||
assert {p["user_id"]: p["footprint_bytes"] for p in r["per_user"]} == {u.id: 10}
|
||||
assert {p["user_id"]: p["footprint_bytes"] for p in r["per_user"]} == {u.id: 10, admin.id: 0}
|
||||
|
||||
|
||||
def test_the_admin_storage_view_names_each_users_quota_and_files(
|
||||
@@ -612,15 +613,26 @@ def test_the_admin_storage_view_names_each_users_quota_and_files(
|
||||
admin = as_user(make_user(role="admin"))
|
||||
put = admin.put(f"/api/admin/downloads/quota/{u.id}", json={"max_bytes": 1000})
|
||||
assert put.status_code == 200
|
||||
row = admin.get("/api/admin/downloads/storage").json()["per_user"]
|
||||
assert [(p["user_id"], p["files"], p["max_bytes"], p["unlimited"]) for p in row] == [
|
||||
(u.id, 1, 1000, False)
|
||||
]
|
||||
rows = admin.get("/api/admin/downloads/storage").json()["per_user"]
|
||||
mine = [(p["files"], p["max_bytes"], p["unlimited"]) for p in rows if p["user_id"] == u.id]
|
||||
assert mine == [(1, 1000, False)]
|
||||
# Every download names its owner, so its row can open THEIR quota.
|
||||
jobs = admin.get("/api/admin/downloads").json()
|
||||
assert {(j["id"], j["user_id"]) for j in jobs} == {(done.id, u.id), (waiting.id, u.id)}
|
||||
|
||||
|
||||
def test_the_admin_storage_view_lists_every_user_even_one_without_a_file(db, as_user, make_user):
|
||||
# The admin sets a quota BEFORE anyone downloads: a user holding nothing is still a row.
|
||||
empty = make_user()
|
||||
admin_user = make_user(role="admin")
|
||||
admin = as_user(admin_user)
|
||||
rows = admin.get("/api/admin/downloads/storage").json()["per_user"]
|
||||
by_id = {p["user_id"]: p for p in rows}
|
||||
assert {empty.id, admin_user.id} <= by_id.keys()
|
||||
assert (by_id[empty.id]["email"], by_id[empty.id]["files"]) == (empty.email, 0)
|
||||
assert by_id[empty.id]["footprint_bytes"] == 0
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("job_status", "asset_status", "ref_count"),
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user