INNER CODE UNIT · JavaScript
runnable
rootSunc/CNEquity · frontend/src/main.js:379
const runnable = (dataset.commands || []).filter((command) => command.op).slice(0, 2);
const buttons = [`<a class="button button-ghost" href="#/datasets">${tr("← 返回数据集", "← Datasets")}</a>`];
for (const [index, command] of runnable.entries()) {
const tone = index === 0 ? "button button-primary" : "button button-ghost";
buttons.push(`<a class="${tone}" href="${opsHref(command.op, command.params)}">${esc(datasetOpLabel(command.op, command.why))}</a>`);
}
return buttons.join("");
}
async function renderDatasets() {
const datasets = await api("/api/datasets");
const stale = datasets.filter((d) => d.freshness === "stale").length;
const rows = (items) =>
items
.map(
(d) => `<tr class="dataset-row"><td><span class="dot ${d.freshness === "fresh" ? "fresh" : d.freshness === "stale" ? "stale" : "empty"}"></span>${dsLink(d.dataset)}</td><td>${esc(tierText(d.tier, d.tier_label))}</td><td>${esc(historyText(d.history_mode))}</td><td>${esc(partitionText(d.granularity))}</td><td>${esc(d.watermark || "-")}</td><td class="n">${fmt(d.row_count)}</td><td class="n">${mb(d.bytes)}</td></tr>`,
)
.join("");