US07-06: Validate Performance and Resource Bounds (#93)
This commit was merged in pull request #93.
This commit is contained in:
@@ -74,8 +74,10 @@ export const api = {
|
||||
request("/inventory/assets?" + new URLSearchParams(params).toString(), opts),
|
||||
listClusters: (params = {}, opts = {}) =>
|
||||
request("/duplicates/clusters?" + new URLSearchParams(params).toString(), opts),
|
||||
getCluster: (id, opts = {}) =>
|
||||
request(`/duplicates/clusters/${encodeURIComponent(id)}`, opts),
|
||||
getCluster: (id, params = {}, opts = {}) => {
|
||||
const query = new URLSearchParams(params).toString();
|
||||
return request(`/duplicates/clusters/${encodeURIComponent(id)}${query ? `?${query}` : ""}`, opts);
|
||||
},
|
||||
decide: (id, payload, opts = {}) =>
|
||||
request(`/duplicates/clusters/${encodeURIComponent(id)}/decision`, {
|
||||
method: "POST",
|
||||
|
||||
@@ -193,7 +193,7 @@ async function renderClusters(params) {
|
||||
" ",
|
||||
el("span", { class: `badge ${cluster.state}` }, cluster.state)
|
||||
),
|
||||
el("div", { class: "muted" }, `${cluster.members.length} members · confidence ${cluster.confidence}`)
|
||||
el("div", { class: "muted" }, `${cluster.member_total ?? cluster.members.length} members · confidence ${cluster.confidence}`)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -207,8 +207,11 @@ async function renderClusters(params) {
|
||||
async function renderClusterDetail(id, extra = {}) {
|
||||
setActiveNav("duplicates");
|
||||
let cluster;
|
||||
// A cluster can hold thousands of members, so the server pages them; the page
|
||||
// asks for as many as it is currently showing (US07-06).
|
||||
const shown = extra.shown || 0;
|
||||
try {
|
||||
cluster = await api.getCluster(id);
|
||||
cluster = await api.getCluster(id, shown ? { limit: shown } : {});
|
||||
} catch (error) {
|
||||
show(errorBanner(`Failed to load cluster: ${error.message}`));
|
||||
return;
|
||||
@@ -298,6 +301,19 @@ async function renderClusterDetail(id, extra = {}) {
|
||||
nodes.push(decisionBar);
|
||||
if (extra.pending) nodes.push(confirmPanel(cluster, extra.pending));
|
||||
nodes.push(el("div", { class: "cluster-grid" }, ...members));
|
||||
const total = cluster.member_total ?? cluster.members.length;
|
||||
if (cluster.members.length < total) {
|
||||
nodes.push(
|
||||
el(
|
||||
"button",
|
||||
{
|
||||
"data-testid": "show-more-members",
|
||||
onclick: () => renderClusterDetail(id, { ...extra, shown: cluster.members.length + 100 }),
|
||||
},
|
||||
`Show more (${cluster.members.length} of ${total})`
|
||||
)
|
||||
);
|
||||
}
|
||||
show(...nodes);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user