feat(tickets): per-dataset "Last updated" freshness in the explorer
Add a "Last updated <ingested_at> EAT" readout under the ticket-explorer Time filter (right-aligned, its own line) so data freshness is visible while searching, for both INC and CRQ. Also fix renderIncMetrics to read freshness[DS] instead of the hardcoded freshness.inc, so the overview "updated" stamp reflects the active dataset. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
82a6d11d95
commit
6bddccb91a
1 changed files with 9 additions and 1 deletions
|
|
@ -140,6 +140,8 @@
|
||||||
.ff.custom { display: none; }
|
.ff.custom { display: none; }
|
||||||
.ff.custom.show { display: flex; }
|
.ff.custom.show { display: flex; }
|
||||||
.x-filters { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
|
.x-filters { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
|
||||||
|
/* Data-freshness readout: wraps to its own full-width line under the filter row, right-aligned. */
|
||||||
|
.x-fresh { flex-basis: 100%; text-align: right; font-size: 11px; color: var(--muted); margin-top: 2px; }
|
||||||
|
|
||||||
/* ── Content grid ────────────────────────────────────────────────────── */
|
/* ── Content grid ────────────────────────────────────────────────────── */
|
||||||
main { padding: 16px 18px 40px; display: grid; gap: 16px; grid-template-columns: repeat(12, 1fr); }
|
main { padding: 16px 18px 40px; display: grid; gap: 16px; grid-template-columns: repeat(12, 1fr); }
|
||||||
|
|
@ -474,6 +476,7 @@
|
||||||
<div class="ff custom" id="tk-x-ff-start"><label for="tk-x-start">Start</label><input type="date" id="tk-x-start"></div>
|
<div class="ff custom" id="tk-x-ff-start"><label for="tk-x-start">Start</label><input type="date" id="tk-x-start"></div>
|
||||||
<div class="ff custom" id="tk-x-ff-end"><label for="tk-x-end">End</label><input type="date" id="tk-x-end"></div>
|
<div class="ff custom" id="tk-x-ff-end"><label for="tk-x-end">End</label><input type="date" id="tk-x-end"></div>
|
||||||
<button class="btn" id="tk-x-search" type="button">Search</button>
|
<button class="btn" id="tk-x-search" type="button">Search</button>
|
||||||
|
<div class="x-fresh" id="tk-x-fresh"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tbl-scroll" id="tk-x-wrap"><div class="empty">Search by ticket id, engineer, cluster, state and time.</div></div>
|
<div class="tbl-scroll" id="tk-x-wrap"><div class="empty">Search by ticket id, engineer, cluster, state and time.</div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1218,8 +1221,13 @@ function renderIncMetrics(m, freshness) {
|
||||||
`<div class="metric"><b>${num(cr.per_day_avg, 1)}</b><span class="lbl">Closures / day</span></div>`,
|
`<div class="metric"><b>${num(cr.per_day_avg, 1)}</b><span class="lbl">Closures / day</span></div>`,
|
||||||
];
|
];
|
||||||
$('tk-metrics').innerHTML = tiles.join('');
|
$('tk-metrics').innerHTML = tiles.join('');
|
||||||
const fr = freshness && freshness.inc;
|
// Freshness is per-dataset — show the ACTIVE dataset's last ingest (was hardcoded to inc).
|
||||||
|
const fr = freshness && freshness[DS];
|
||||||
$('tk-fresh').textContent = fr ? `updated ${eatShort(fr.ingested_at)} · ${intg(fr.records_ingested)} records` : '';
|
$('tk-fresh').textContent = fr ? `updated ${eatShort(fr.ingested_at)} · ${intg(fr.records_ingested)} records` : '';
|
||||||
|
// Mirror it in the ticket-explorer filter bar (below the Time field) so freshness is
|
||||||
|
// visible while searching, for both INC and CRQ.
|
||||||
|
const xf = $('tk-x-fresh');
|
||||||
|
if (xf) xf.textContent = fr ? `Last updated ${eatShort(fr.ingested_at)} EAT` : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Ticket explorer (search) — GET /webhook/inc-search ──────────────────────
|
// ── Ticket explorer (search) — GET /webhook/inc-search ──────────────────────
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue