fix(panel): projects table fits narrow widths, keeps loaded versions on refresh, skips settings
The projects table sits in a min-width-0 host so fitColumns can drop columns. A live refresh re-reads only the changed, expanded projects and keeps as many versions as were shown (Load more included). Version pages ask for the summary form, so the panel no longer downloads settings it never shows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
26bab759fe
commit
353024fc71
4 files changed
+54
-10
No files matched your search
@@ -43,7 +43,16 @@ public sealed partial class AdminProjectsTests(TestContext context)
|
||||
Assert.True(!Regex.IsMatch(projects, @"\son[a-z]+="""), "inline handler");
|
||||
// It lists, opens versions, renames and deletes: no push, no restore, no settings (R6: the panel manages, never edits).
|
||||
Assert.Contains("projects = await api.get(base);", projects);
|
||||
Assert.Contains("api.get(`${base}/${encodeURIComponent(id)}/versions?limit=${VERSION_PAGE}${before}`)", projects);
|
||||
// Versions are read without their settings, which the panel never shows (a large sequence's are megabytes each).
|
||||
Assert.Contains("api.get(`${base}/${encodeURIComponent(id)}/versions?limit=${limit}${before}&summary=true`)", projects);
|
||||
// A live refresh reads again only the opened projects an event named (every one after a reconnection), as many
|
||||
// versions as are shown: the pages Load more read stay.
|
||||
Assert.Contains("const again = [...expanded].filter((id) => stale === null || stale.has(id));", projects);
|
||||
Assert.Contains("return loadVersions(id, false, Math.min(MAX_PAGE, Math.max(VERSION_PAGE, shown)));", projects);
|
||||
Assert.Contains("else changed?.add(e.projectId);", projects);
|
||||
// The table's wrapper may be narrower than the table (a grid item of the panel), so its columns fit on a phone.
|
||||
Assert.Contains(@"<div id=""projects"" class=""table-host""></div>", page);
|
||||
Assert.Contains(".panel > .table-host { min-width: 0; }", await server.Client.GetStringAsync("/admin/admin.css"));
|
||||
Assert.Contains("await api.patch(`${base}/${encodeURIComponent(project.id)}`, { name });", projects);
|
||||
Assert.Contains("await api.del(`${base}/${encodeURIComponent(project.id)}`);", projects);
|
||||
Assert.False(projects.Contains("api.post(", StringComparison.Ordinal), "the panel pushes or makes nothing");
|
||||
@@ -110,6 +119,17 @@ public sealed partial class AdminProjectsTests(TestContext context)
|
||||
Assert.Equal((1, "imported"), (first.GetProperty("number").GetInt32(), first.GetProperty("kind").GetString()));
|
||||
Assert.True(first.TryGetProperty("storedAt", out _) && first.TryGetProperty("createdAt", out _) && first.TryGetProperty("clientName", out _));
|
||||
Assert.False(json.RootElement.GetProperty("more").GetBoolean());
|
||||
Assert.NotEqual(string.Empty, first.GetProperty("settingsJson").GetString());
|
||||
}
|
||||
// The page's own form: the same versions, without their settings.
|
||||
using (var versions = await browser.SendAsync(HttpMethod.Get, $"{url}/{vertical}/versions?limit=20&summary=true"))
|
||||
{
|
||||
await versions.ExpectAsync(HttpStatusCode.OK);
|
||||
using var json = JsonDocument.Parse(await versions.Content.ReadAsStringAsync());
|
||||
var first = json.RootElement.GetProperty("items").EnumerateArray().Single();
|
||||
Assert.Equal((1, "imported", string.Empty), (first.GetProperty("number").GetInt32(), first.GetProperty("kind").GetString(),
|
||||
first.GetProperty("settingsJson").GetString()));
|
||||
Assert.Equal(64, first.GetProperty("contentHash").GetString()!.Length);
|
||||
}
|
||||
|
||||
using (var renamed = await browser.SendAsync(HttpMethod.Patch, $"{url}/{vertical}", Json("""{"name":"Vertical"}""")))
|
||||
|
||||
Reference in new issue
Block a user