AdithyaSK HF Staff commited on
Commit
3ceafe2
·
verified ·
1 Parent(s): 6abb7be

Fix narrow admin version labels and complete catalog counts

Browse files
Files changed (3) hide show
  1. app/admin.py +1 -1
  2. web-admin/admin.css +2 -0
  3. web-admin/admin.js +3 -3
app/admin.py CHANGED
@@ -74,7 +74,7 @@ def overview(request: Request):
74
  "recent": [_admin_view(r) for r in runs[:8]],
75
  "live": [_admin_view(r) for r in runs if _live(r)][:24],
76
  "operations": _operations(envs),
77
- "new": new[:12],
78
  "settings": _settings(),
79
  }
80
 
 
74
  "recent": [_admin_view(r) for r in runs[:8]],
75
  "live": [_admin_view(r) for r in runs if _live(r)][:24],
76
  "operations": _operations(envs),
77
+ "new": new[:12], "new_count": len(new),
78
  "settings": _settings(),
79
  }
80
 
web-admin/admin.css CHANGED
@@ -171,3 +171,5 @@
171
  }
172
 
173
  @media (min-width: 1101px) and (max-width: 1450px) { .ad-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
 
 
 
171
  }
172
 
173
  @media (min-width: 1101px) and (max-width: 1450px) { .ad-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
174
+
175
+ .ad-name > .faint { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
web-admin/admin.js CHANGED
@@ -65,7 +65,7 @@ export async function mount(el, { qs, explorer }) {
65
  }, {signal:events.signal});
66
  show();
67
  // live counts beside the sections: running rollouts, new environments
68
- api("/api/admin/overview").then((o) => { counts = { rollouts: o.rollouts.live || "", environments: o.new.length || "" }; if (alive) nav(); }).catch(() => {});
69
  }
70
 
71
  const head = (title, sub, actions = "") => `<div class="ad-head"><div><h1>${title}</h1>${sub ? `<p>${sub}</p>` : ""}</div><div class="ad-actions">${actions}</div></div>`;
@@ -208,7 +208,7 @@ async function environments(body) {
208
  body.innerHTML = `${head("Environments", "Pin to feature separately above the trending row on Explore; hide to take off every listing (the page still opens by link); put in a collection to feature it.")}
209
  <div class="ad-tools"><div class="search">${icon("search", 16)}<input id="ad-q" type="search" aria-label="Search environments" placeholder="Search environments…"></div>
210
  <div class="seg" id="ad-flag">${[["", "All", d.environments.length], ["new", "New", n(isNew)], ["pinned", "Pinned", n((x) => x.pinned)], ["hidden", "Hidden", n((x) => x.hidden)],
211
- ["loose", "In no collection", n((x) => !x.collection)], ["unindexed", "Not indexed", n((x) => x.kind === "dataset" && !x.indexed)]]
212
  .map(([k, l, c]) => `<button type="button" data-flag="${k}" aria-pressed="${k === ""}">${l}<span>${fmt.format(c)}</span></button>`).join("")}</div>
213
  <select class="hf-select-mimo" id="ad-kind" aria-label="Environment type"><option value="">Datasets and Spaces</option><option value="dataset">Datasets</option><option value="space">Spaces</option></select><select class="input" id="ad-health" aria-label="API evidence"><option value="">All API evidence</option><option value="ready">Checked Spaces</option><option value="candidate">Unverified / unavailable Spaces</option><option value="Check expired">Expired checks</option><option value="Checks failed">OpenEnv checks failed</option><option value="Not running">Not running</option></select></div><p class="fine">Discovery candidates are kept here for review. Only Spaces with fresh supported API evidence appear in the default explorer. Versions are declared dependencies, not runtime attestations.</p>
214
  <div class="panel"><div class="ad-envs" id="ad-envs"></div></div>
@@ -224,7 +224,7 @@ async function environments(body) {
224
  <span class="num">Tasks</span><span class="num">Rollouts</span><span></span></div>` + rows.slice(0, st.shown).map((x) => `<div class="ad-env${x.hidden ? " gone" : ""}">
225
  <span class="ad-name">${x.kind === "space" ? `<img class="ad-th" src="${thumb(x.id)}" alt="" loading="lazy">` : `<span class="ad-th ic-only">${icon("database", 14)}</span>`}
226
  <a href="${envHref(x)}" title="${esc(x.id)}" target="_blank" rel="noopener"><code>${esc(x.id)}</code></a>
227
- ${x.kind === "space" ? `<span class="chip ${x.ready ? "new" : ""}" title="${esc(x.api_status || "Not checked")}">${esc(x.ready ? (x.openenv ? "OpenEnv API checked" : x.framework + " API checked") : x.api_status || "Not checked")}</span><span class="faint xs" title="${esc(x.version_source)}">${esc(x.declared_version || "Unknown version")}</span>` : `<span class="chip">${esc(x.framework)}</span>`}
228
  ${x.pinned ? `<span class="chip">${icon("flag", 11)}Pinned</span>` : ""}${x.hidden ? `<span class="chip">Hidden</span>` : ""}${isNew(x) ? `<span class="chip new">New</span>` : ""}</span>
229
  <span><select class="hf-select-mimo sm" data-feature="${esc(x.key)}" aria-label="Collection"><option value="">No collection</option>${cols.map((c) => `<option value="${c.id}" ${x.collection === c.id ? "selected" : ""}>${esc(c.group)}</option>`).join("")}</select></span>
230
  <span class="num">${fmt.format(x.trending || 0)}</span><span class="num">${x.kind === "dataset" ? compact.format(x.downloads) : `${compact.format(x.likes)} ♥`}</span>
 
65
  }, {signal:events.signal});
66
  show();
67
  // live counts beside the sections: running rollouts, new environments
68
+ api("/api/admin/overview").then((o) => { counts = { rollouts: o.rollouts.live || "", environments: o.new_count || "" }; if (alive) nav(); }).catch(() => {});
69
  }
70
 
71
  const head = (title, sub, actions = "") => `<div class="ad-head"><div><h1>${title}</h1>${sub ? `<p>${sub}</p>` : ""}</div><div class="ad-actions">${actions}</div></div>`;
 
208
  body.innerHTML = `${head("Environments", "Pin to feature separately above the trending row on Explore; hide to take off every listing (the page still opens by link); put in a collection to feature it.")}
209
  <div class="ad-tools"><div class="search">${icon("search", 16)}<input id="ad-q" type="search" aria-label="Search environments" placeholder="Search environments…"></div>
210
  <div class="seg" id="ad-flag">${[["", "All", d.environments.length], ["new", "New", n(isNew)], ["pinned", "Pinned", n((x) => x.pinned)], ["hidden", "Hidden", n((x) => x.hidden)],
211
+ ["loose", "In no collection", n((x) => !x.collection)], ["unindexed", "No file index", n((x) => x.kind === "dataset" && !x.indexed)]]
212
  .map(([k, l, c]) => `<button type="button" data-flag="${k}" aria-pressed="${k === ""}">${l}<span>${fmt.format(c)}</span></button>`).join("")}</div>
213
  <select class="hf-select-mimo" id="ad-kind" aria-label="Environment type"><option value="">Datasets and Spaces</option><option value="dataset">Datasets</option><option value="space">Spaces</option></select><select class="input" id="ad-health" aria-label="API evidence"><option value="">All API evidence</option><option value="ready">Checked Spaces</option><option value="candidate">Unverified / unavailable Spaces</option><option value="Check expired">Expired checks</option><option value="Checks failed">OpenEnv checks failed</option><option value="Not running">Not running</option></select></div><p class="fine">Discovery candidates are kept here for review. Only Spaces with fresh supported API evidence appear in the default explorer. Versions are declared dependencies, not runtime attestations.</p>
214
  <div class="panel"><div class="ad-envs" id="ad-envs"></div></div>
 
224
  <span class="num">Tasks</span><span class="num">Rollouts</span><span></span></div>` + rows.slice(0, st.shown).map((x) => `<div class="ad-env${x.hidden ? " gone" : ""}">
225
  <span class="ad-name">${x.kind === "space" ? `<img class="ad-th" src="${thumb(x.id)}" alt="" loading="lazy">` : `<span class="ad-th ic-only">${icon("database", 14)}</span>`}
226
  <a href="${envHref(x)}" title="${esc(x.id)}" target="_blank" rel="noopener"><code>${esc(x.id)}</code></a>
227
+ ${x.kind === "space" ? `<span class="chip ${x.ready ? "new" : ""}" title="${esc(x.api_status || "Not checked")}">${esc(x.ready ? (x.openenv ? "OpenEnv API checked" : x.framework + " API checked") : x.api_status || "Not checked")}</span><span class="faint xs" title="${esc((x.declared_version || "Unknown version") + " · " + (x.version_source || "Unknown source"))}">${esc(x.declared_version || "Unknown version")}</span>` : `<span class="chip">${esc(x.id === "XiaomiMiMo/MiMo-V2.6-RL-oss" ? "MiMo" : x.framework === "rows" ? "RL dataset" : runnerName(x.framework))}</span>`}
228
  ${x.pinned ? `<span class="chip">${icon("flag", 11)}Pinned</span>` : ""}${x.hidden ? `<span class="chip">Hidden</span>` : ""}${isNew(x) ? `<span class="chip new">New</span>` : ""}</span>
229
  <span><select class="hf-select-mimo sm" data-feature="${esc(x.key)}" aria-label="Collection"><option value="">No collection</option>${cols.map((c) => `<option value="${c.id}" ${x.collection === c.id ? "selected" : ""}>${esc(c.group)}</option>`).join("")}</select></span>
230
  <span class="num">${fmt.format(x.trending || 0)}</span><span class="num">${x.kind === "dataset" ? compact.format(x.downloads) : `${compact.format(x.likes)} ♥`}</span>