added
This commit is contained in:
commit
2bcc107c13
39 files changed
+2643
No files matched your search
@@ -0,0 +1,6 @@
|
||||
# HTML templates
|
||||
|
||||
- [automations-calendar.template.html](automations-calendar.template.html): calendar interface with an empty automation array and synthetic source stamp.
|
||||
- [automations-results.template.html](automations-results.template.html): results interface with the __AUTOMATION_RESULTS_DATA__ placeholder.
|
||||
|
||||
Builders insert escaped JSON and write separate output files. Do not edit generated operational HTML into these templates.
|
||||
@@ -0,0 +1,276 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Automations Calendar</title>
|
||||
<style>
|
||||
:root {
|
||||
--ink: #172033; --muted: #64748b; --line: #dfe7f1; --panel: #ffffff;
|
||||
--brand: #175cd3; --brand-soft: #e8f0ff; --paused: #8b5cf6; --warn: #c2410c;
|
||||
--success: #15803d; --success-soft: #dcfce7; --failure: #dc2626; --failure-soft: #fee2e2; --unknown: #64748b;
|
||||
--hour-height: 76px; --radius: 16px; --shadow: 0 14px 38px rgba(30, 51, 88, .09);
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
body { margin: 0; color: var(--ink); background: #f4d35e; font: 14px/1.45 system-ui, sans-serif; }
|
||||
button, input, select { font: inherit; }
|
||||
.shell { width: 90%; max-width: 1720px; margin: 0 auto; padding: 28px 0; }
|
||||
.hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
|
||||
h1 { margin: 0 0 6px; font-size: clamp(28px, 4vw, 46px); letter-spacing: -.045em; line-height: 1.05; }
|
||||
.sub { color: #000; max-width: 780px; font-size: 15px; }
|
||||
.source { margin-top: 8px; color: #000; font-size: 12px; overflow-wrap: anywhere; }
|
||||
.page-links { display: flex; gap: 8px; margin-top: 11px; }
|
||||
.page-links a { color: #1649a5; background: var(--brand-soft); border-radius: 9px; padding: 7px 10px; text-decoration: none; font-weight: 700; }
|
||||
.stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
|
||||
.stat { min-width: 108px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 5px 18px rgba(30, 51, 88, .04); }
|
||||
.stat strong { display: block; font-size: 22px; line-height: 1; margin-bottom: 5px; }
|
||||
.stat span { color: var(--muted); font-size: 12px; }
|
||||
.toolbar { position: sticky; top: 0; z-index: 50; display: grid; grid-template-columns: minmax(220px, 1.5fr) repeat(5, minmax(130px, .65fr)) auto; gap: 10px; padding: 12px; margin-bottom: 16px; background: rgba(243, 246, 251, .94); backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: var(--radius); }
|
||||
input, select { width: 100%; border: 1px solid #cdd8e7; border-radius: 10px; padding: 10px 12px; color: var(--ink); background: white; outline: none; }
|
||||
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23, 92, 211, .12); }
|
||||
.view-toggle { display: flex; border: 1px solid #cdd8e7; border-radius: 10px; overflow: hidden; background: white; }
|
||||
.view-toggle button { border: 0; background: transparent; padding: 9px 13px; color: var(--muted); cursor: pointer; }
|
||||
.view-toggle button.active { background: var(--ink); color: white; }
|
||||
.cadence-panel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
|
||||
.cadence { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
|
||||
.cadence h2 { margin: 0 0 4px; font-size: 16px; }
|
||||
.cadence .hint { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
|
||||
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
|
||||
.chip { border: 1px solid #d7e1ef; background: #f8fafc; color: #334155; padding: 6px 9px; border-radius: 999px; cursor: pointer; font-size: 12px; }
|
||||
.chip:hover { border-color: var(--brand); background: var(--brand-soft); }
|
||||
.week-wrap { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; max-height: calc(100vh - 155px); }
|
||||
.week { min-width: 1330px; display: grid; grid-template-columns: 72px repeat(7, minmax(170px, 1fr)); position: relative; }
|
||||
.corner, .day-head { position: sticky; top: 0; z-index: 25; background: #172033; color: white; min-height: 58px; border-right: 1px solid rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center; }
|
||||
.corner { left: 0; z-index: 35; color: #aebbd0; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
|
||||
.day-head { flex-direction: column; gap: 2px; font-weight: 700; }
|
||||
.day-head small { color: #aebbd0; font-weight: 500; }
|
||||
.day-head.today { background: #114cba; }
|
||||
.time-slot { position: sticky; left: 0; z-index: 20; min-height: var(--hour-height); background: #f8fafc; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 9px; color: var(--muted); font-size: 11px; text-align: right; }
|
||||
.hour-block { min-width: 0; min-height: var(--hour-height); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 6px; }
|
||||
.hour-block.today { background-color: #f7faff; }
|
||||
.event { position: relative; width: 100%; flex: 0 0 auto; min-height: 48px; border: 1px solid color-mix(in srgb, var(--event-color) 55%, white); border-left: 4px solid var(--event-color); border-radius: 9px; padding: 7px 8px; background: color-mix(in srgb, var(--event-color) 10%, white); box-shadow: 0 4px 10px rgba(30, 51, 88, .08); overflow: hidden; cursor: pointer; transition: transform .12s, box-shadow .12s; }
|
||||
.event:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(30, 51, 88, .16); z-index: 10; }
|
||||
.event.paused { opacity: .58; filter: grayscale(.25); border-style: dashed; }
|
||||
.event-time { color: #475569; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
|
||||
.event-name { overflow-wrap: anywhere; margin-top: 2px; font-weight: 750; font-size: 12px; line-height: 1.2; }
|
||||
.event-meta { color: #64748b; font-size: 10px; margin-top: 3px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
|
||||
.event-name-row { display: flex; align-items: flex-start; gap: 5px; }
|
||||
.run-mark { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; font-size: 11px; font-weight: 900; line-height: 1; vertical-align: middle; }
|
||||
.run-mark.success { color: #fff; background: var(--success); }
|
||||
.run-mark.failure { color: #fff; background: var(--failure); }
|
||||
.run-mark.unknown { color: #fff; background: var(--unknown); }
|
||||
.empty { padding: 28px; color: var(--muted); text-align: center; }
|
||||
.list { display: none; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); overflow: hidden; }
|
||||
.list-row { display: grid; grid-template-columns: 1.4fr .7fr .65fr .65fr .65fr .65fr 1fr; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: start; cursor: pointer; }
|
||||
.list-row:hover { background: #f8fafc; }
|
||||
.list-row.header { position: static; background: #172033; color: white; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; cursor: default; }
|
||||
.list-name { font-weight: 750; }
|
||||
.muted { color: var(--muted); }
|
||||
.badge { display: inline-flex; align-items: center; width: fit-content; padding: 4px 7px; border-radius: 999px; background: #eef2f7; color: #475569; font-size: 11px; }
|
||||
.badge.paused { background: #f3e8ff; color: #6b21a8; }
|
||||
dialog { width: min(650px, calc(100vw - 32px)); border: 0; border-radius: 18px; padding: 0; box-shadow: 0 30px 90px rgba(15, 23, 42, .35); }
|
||||
dialog::backdrop { background: rgba(15, 23, 42, .54); backdrop-filter: blur(4px); }
|
||||
.modal-head { padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
|
||||
.modal-head h2 { margin: 0 36px 4px 0; line-height: 1.2; }
|
||||
.close { position: absolute; right: 16px; top: 14px; border: 0; border-radius: 10px; background: #eef2f7; color: #334155; width: 34px; height: 34px; cursor: pointer; }
|
||||
.modal-body { padding: 20px 24px 24px; }
|
||||
.detail-grid { display: grid; grid-template-columns: 120px 1fr; gap: 10px 16px; }
|
||||
.detail-grid dt { color: var(--muted); }
|
||||
.detail-grid dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
|
||||
.schedule-line { display: inline-block; margin: 0 5px 5px 0; padding: 4px 7px; background: var(--brand-soft); color: #1649a5; border-radius: 7px; font-size: 12px; }
|
||||
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin: 11px 2px 0; }
|
||||
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
|
||||
@media (max-width: 920px) {
|
||||
.shell { padding: 18px; } .hero { flex-direction: column; } .stats { justify-content: flex-start; }
|
||||
.toolbar { grid-template-columns: 1fr 1fr; } .toolbar input { grid-column: 1 / -1; }
|
||||
.cadence-panel { grid-template-columns: 1fr; } .list-row { grid-template-columns: 1fr; gap: 5px; }
|
||||
.list-row.header { display: none; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main class="shell">
|
||||
<section class="hero">
|
||||
<div>
|
||||
<h1>Automations Calendar</h1>
|
||||
<div class="sub">A weekly view of every automation listed on the workbook’s <strong>workflows</strong> tab. Times are shown exactly as entered in the workbook; no timezone conversion is applied.</div>
|
||||
<div class="source">Source: synthetic-workflows.xlsx · workflows!A1:M1 · Synthetic template</div>
|
||||
<nav class="page-links"><a href="automations-results.html">Open run results</a></nav>
|
||||
</div>
|
||||
<div class="stats" id="stats"></div>
|
||||
</section>
|
||||
|
||||
<section class="toolbar" aria-label="Calendar filters">
|
||||
<input id="search" type="search" placeholder="Search name, notes, location…" aria-label="Search automations">
|
||||
<select id="project"><option value="">All projects</option></select>
|
||||
<select id="machine"><option value="">All machines</option></select>
|
||||
<select id="opsSegment"><option value="">All ops segments</option></select>
|
||||
<select id="status"><option value="">All statuses</option></select>
|
||||
<select id="runOutcome"><option value="">All run results</option><option value="success">Successful</option><option value="failure">Failed</option><option value="unknown">Unknown</option></select>
|
||||
<div class="view-toggle" aria-label="View selector">
|
||||
<button class="active" data-view="week">Week</button><button data-view="list">List</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="cadence-panel" id="cadencePanel"></section>
|
||||
<section class="week-wrap" id="weekWrap"><div class="week" id="week"></div></section>
|
||||
<section class="list" id="list"></section>
|
||||
<div class="legend" id="legend"></div>
|
||||
</main>
|
||||
|
||||
<dialog id="details"><button class="close" aria-label="Close">×</button><div id="dialogContent"></div></dialog>
|
||||
|
||||
<script>
|
||||
const automations = [];
|
||||
const days = ["Mon","Tues","Wed","Thu","Fri","Sat","Sun"];
|
||||
const colors = ["#175cd3", "#0f8a70", "#b54708", "#7c3aed", "#c0266d", "#0875b8", "#4d7c0f", "#be123c"];
|
||||
const state = { search: "", project: "", machine: "", opsSegment: "", status: "", runOutcome: "", view: "week" };
|
||||
const esc = value => String(value ?? "").replace(/[&<>"']/g, ch => ({"&":"&","<":"<",">":">",'"':""","'":"'"}[ch]));
|
||||
const fmt = mins => {
|
||||
const hour = Math.floor(mins / 60), minute = mins % 60, suffix = hour >= 12 ? "PM" : "AM";
|
||||
return `${hour % 12 || 12}:${String(minute).padStart(2, "0")} ${suffix}`;
|
||||
};
|
||||
const projectColor = project => colors[[...new Set(automations.map(a => a.project))].sort().indexOf(project) % colors.length];
|
||||
const runOutcome = a => a.run?.outcome || "unknown";
|
||||
const runLabel = a => runOutcome(a) === "success" ? "Last run successful" : runOutcome(a) === "failure" ? "Last run failed" : "Run result unavailable";
|
||||
const runMark = a => `<span class="run-mark ${runOutcome(a)}" title="${esc(runLabel(a))}${a.run?.lastRun ? ` · ${esc(a.run.lastRun)}` : ""}">${runOutcome(a) === "success" ? "✓" : runOutcome(a) === "failure" ? "×" : "?"}</span>`;
|
||||
const sortAutomations = (a, b) => (a.opsSegment || "Unsorted").localeCompare(b.opsSegment || "Unsorted") || a.project.localeCompare(b.project) || a.name.localeCompare(b.name);
|
||||
const isPaused = a => /paused|deleted/i.test(a.status);
|
||||
const exactEvents = a => days.flatMap(day => a.schedule[day].minutes === null ? [] : [{ day, minutes: a.schedule[day].minutes }]);
|
||||
const isHourly = a => days.some(day => /hourly/i.test(a.schedule[day].cadence)) || /every hour|hourly/i.test(a.other);
|
||||
const hourlyMinute = a => {
|
||||
const match = a.other.match(/:(\d{1,2}).*every hour/i);
|
||||
return match ? Math.min(59, Number(match[1])) : 0;
|
||||
};
|
||||
const hourlyDays = a => {
|
||||
const explicitDays = days.filter(day => /hourly/i.test(a.schedule[day].cadence));
|
||||
return explicitDays.length ? explicitDays : (isHourly(a) ? days : []);
|
||||
};
|
||||
const scheduleText = a => days.map(day => {
|
||||
const entry = a.schedule[day];
|
||||
if (entry.minutes !== null) return `${day} ${fmt(entry.minutes)}`;
|
||||
if (entry.cadence) return `${day} ${entry.cadence}`;
|
||||
return null;
|
||||
}).filter(Boolean).concat(a.other ? [a.other] : []);
|
||||
|
||||
function filtered() {
|
||||
const query = state.search.toLowerCase();
|
||||
return automations.filter(a =>
|
||||
(!state.project || a.project === state.project) &&
|
||||
(!state.machine || a.machine === state.machine) &&
|
||||
(!state.opsSegment || a.opsSegment === state.opsSegment) &&
|
||||
(!state.status || a.status === state.status) &&
|
||||
(!state.runOutcome || runOutcome(a) === state.runOutcome) &&
|
||||
(!query || [a.name, a.machine, a.project, a.opsSegment, a.location, a.status, a.other, a.notes].join(" ").toLowerCase().includes(query))
|
||||
).sort(sortAutomations);
|
||||
}
|
||||
|
||||
function fillSelect(id, values) {
|
||||
const select = document.getElementById(id);
|
||||
[...new Set(values)].sort((a,b) => a.localeCompare(b)).forEach(value => select.insertAdjacentHTML("beforeend", `<option>${esc(value)}</option>`));
|
||||
}
|
||||
fillSelect("project", automations.map(a => a.project));
|
||||
fillSelect("machine", automations.map(a => a.machine));
|
||||
fillSelect("opsSegment", automations.map(a => a.opsSegment || "Unsorted"));
|
||||
fillSelect("status", automations.map(a => a.status));
|
||||
|
||||
function renderStats(data) {
|
||||
const eventCount = data.reduce((sum, a) => sum + exactEvents(a).length + (isHourly(a) ? hourlyDays(a).length * 24 : 0), 0);
|
||||
const cadenceCount = data.filter(a => days.some(day => a.schedule[day].cadence) || a.other).length;
|
||||
const successCount = data.filter(a => runOutcome(a) === "success").length;
|
||||
const failureCount = data.filter(a => runOutcome(a) === "failure").length;
|
||||
document.getElementById("stats").innerHTML = `
|
||||
<div class="stat"><strong>${data.length}</strong><span>automations shown</span></div>
|
||||
<div class="stat"><strong>${eventCount}</strong><span>weekly occurrences</span></div>
|
||||
<div class="stat"><strong>${cadenceCount}</strong><span>cadence entries</span></div>
|
||||
<div class="stat"><strong>${successCount}</strong><span>last run successful</span></div>
|
||||
<div class="stat"><strong>${failureCount}</strong><span>last run failed</span></div>`;
|
||||
}
|
||||
|
||||
function renderCadences(data) {
|
||||
const groups = [
|
||||
{ title: "Real-time", hint: "Continuous synchronization", test: a => days.some(d => /real time/i.test(a.schedule[d].cadence)) },
|
||||
{ title: "Hourly", hint: "Repeating within each day", test: a => days.some(d => /hourly/i.test(a.schedule[d].cadence)) || /hour/i.test(a.other) },
|
||||
{ title: "Manual / other", hint: "Monthly or non-weekly cadence", test: a => a.other && !/hour/i.test(a.other) },
|
||||
];
|
||||
document.getElementById("cadencePanel").innerHTML = groups.map(group => {
|
||||
const items = data.filter(group.test);
|
||||
return `<article class="cadence"><h2>${group.title} <span class="muted">· ${items.length}</span></h2><div class="hint">${group.hint}</div><div class="chips">${items.length ? items.map(a => `<button class="chip" data-id="${a.id}">${esc(a.name)}</button>`).join("") : '<span class="muted">None in current filter</span>'}</div></article>`;
|
||||
}).join("");
|
||||
}
|
||||
|
||||
function renderWeek(data) {
|
||||
const jsDay = new Date().getDay();
|
||||
const today = days[jsDay === 0 ? 6 : jsDay - 1];
|
||||
let out = '<div class="corner">Time</div>' + days.map(day => `<div class="day-head ${day === today ? "today" : ""}"><span>${day === "Tues" ? "Tuesday" : day}</span><small>weekly schedule</small></div>`).join("");
|
||||
const eventsByDay = Object.fromEntries(days.map(day => {
|
||||
const exact = data.flatMap(a => a.schedule[day].minutes === null ? [] : [{a, minutes: a.schedule[day].minutes, recurring: false}]);
|
||||
const hourly = data.filter(a => isHourly(a) && hourlyDays(a).includes(day));
|
||||
const recurring = hourly.flatMap(a => Array.from({length: 24}, (_, hour) => ({a, minutes: hour * 60 + hourlyMinute(a), recurring: true})));
|
||||
return [day, exact.concat(recurring).sort((x, y) => x.minutes - y.minutes || sortAutomations(x.a, y.a))];
|
||||
}));
|
||||
for (let hour = 0; hour < 24; hour++) {
|
||||
out += `<div class="time-slot">${fmt(hour * 60).replace(":00", "")}</div>`;
|
||||
days.forEach(day => {
|
||||
const events = eventsByDay[day].filter(event => Math.floor(event.minutes / 60) === hour);
|
||||
const cards = events.map(({a, minutes, recurring}) => `<article class="event ${isPaused(a) ? "paused" : ""}" data-id="${a.id}" style="--event-color:${projectColor(a.project)}"><div class="event-time">${fmt(minutes)}${recurring ? " · Hourly" : ""}</div><div class="event-name-row">${runMark(a)}<div class="event-name">${esc(a.name)}</div></div><div class="event-meta">${esc(a.opsSegment || "Unsorted")} · ${esc(a.machine)} · ${esc(a.project)}</div></article>`).join("");
|
||||
out += `<div class="hour-block ${day === today ? "today" : ""}" data-day="${day}" data-hour="${hour}">${cards}</div>`;
|
||||
});
|
||||
}
|
||||
document.getElementById("week").innerHTML = out;
|
||||
}
|
||||
|
||||
function renderList(data) {
|
||||
const rows = data.map(a => `<div class="list-row" data-id="${a.id}">
|
||||
<div><div class="list-name">${esc(a.name)}</div><div class="muted">${esc(a.location)}</div></div>
|
||||
<div>${esc(a.opsSegment || "Unsorted")}</div><div>${esc(a.project)}</div><div>${esc(a.machine)}</div>
|
||||
<div><span class="badge ${isPaused(a) ? "paused" : ""}">${esc(a.status)}</span></div>
|
||||
<div>${runMark(a)} <span class="muted">${esc(runLabel(a))}</span></div>
|
||||
<div>${scheduleText(a).map(item => `<span class="schedule-line">${esc(item)}</span>`).join("") || '<span class="muted">No schedule entered</span>'}</div>
|
||||
</div>`).join("");
|
||||
document.getElementById("list").innerHTML = '<div class="list-row header"><div>Automation</div><div>Ops segment</div><div>Project</div><div>Machine</div><div>Status</div><div>Last run</div><div>Schedule</div></div>' + (rows || '<div class="empty">No automations match these filters.</div>');
|
||||
}
|
||||
|
||||
function renderLegend(data) {
|
||||
const projects = [...new Set(data.map(a => a.project))].sort();
|
||||
document.getElementById("legend").innerHTML = projects.map(p => `<span><i class="dot" style="background:${projectColor(p)}"></i>${esc(p)}</span>`).join("") + '<span><i class="run-mark success">✓</i> last run successful</span><span><i class="run-mark failure">×</i> last run failed</span><span><i class="run-mark unknown">?</i> no verifiable result</span><span>Items stack by time within each hour; Hourly = repeating job</span><span>Dashed/faded = paused or deleted</span>';
|
||||
}
|
||||
|
||||
function showDetails(id) {
|
||||
const a = automations.find(item => item.id === Number(id));
|
||||
if (!a) return;
|
||||
const schedules = scheduleText(a);
|
||||
document.getElementById("dialogContent").innerHTML = `
|
||||
<div class="modal-head"><h2>${runMark(a)} ${esc(a.name)}</h2><span class="badge ${isPaused(a) ? "paused" : ""}">${esc(a.status)}</span></div>
|
||||
<div class="modal-body"><dl class="detail-grid">
|
||||
<dt>Schedule</dt><dd>${schedules.map(item => `<span class="schedule-line">${esc(item)}</span>`).join("") || "No schedule entered"}</dd>
|
||||
<dt>Last run</dt><dd>${esc(runLabel(a))}${a.run?.lastRun ? ` · ${esc(a.run.lastRun)}` : ""}${a.run?.detail ? `<br>${esc(a.run.detail)}` : ""}</dd>
|
||||
<dt>Ops segment</dt><dd>${esc(a.opsSegment || "Unsorted")}</dd><dt>Project</dt><dd>${esc(a.project)}</dd><dt>Machine</dt><dd>${esc(a.machine)}</dd>
|
||||
<dt>Location</dt><dd>${esc(a.location)}</dd><dt>Notes</dt><dd>${esc(a.notes || "—")}</dd>
|
||||
</dl></div>`;
|
||||
document.getElementById("details").showModal();
|
||||
}
|
||||
|
||||
function render() {
|
||||
const data = filtered();
|
||||
renderStats(data); renderCadences(data); renderWeek(data); renderList(data); renderLegend(data);
|
||||
document.getElementById("weekWrap").style.display = state.view === "week" ? "block" : "none";
|
||||
document.getElementById("list").style.display = state.view === "list" ? "block" : "none";
|
||||
}
|
||||
|
||||
document.getElementById("search").addEventListener("input", e => { state.search = e.target.value; render(); });
|
||||
["project","machine","opsSegment","status","runOutcome"].forEach(id => document.getElementById(id).addEventListener("change", e => { state[id] = e.target.value; render(); }));
|
||||
document.querySelector(".view-toggle").addEventListener("click", e => {
|
||||
if (!e.target.dataset.view) return;
|
||||
state.view = e.target.dataset.view;
|
||||
document.querySelectorAll(".view-toggle button").forEach(button => button.classList.toggle("active", button.dataset.view === state.view));
|
||||
render();
|
||||
});
|
||||
document.addEventListener("click", e => { const target = e.target.closest("[data-id]"); if (target) showDetails(target.dataset.id); });
|
||||
document.querySelector("dialog .close").addEventListener("click", () => document.getElementById("details").close());
|
||||
document.getElementById("details").addEventListener("click", e => { if (e.target === e.currentTarget) e.currentTarget.close(); });
|
||||
render();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Automation Run Results</title>
|
||||
<style>
|
||||
:root { --ink:#172033; --muted:#64748b; --line:#dfe7f1; --panel:#fff; --bg:#f3f6fb; --success:#15803d; --success-soft:#dcfce7; --failure:#dc2626; --failure-soft:#fee2e2; --unknown:#64748b; --unknown-soft:#eef2f7; --brand:#175cd3; --shadow:0 14px 38px rgba(30,51,88,.09); }
|
||||
* { box-sizing:border-box; }
|
||||
body { margin:0; color:var(--ink); background:var(--bg); font:14px/1.45 Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
|
||||
button,input,select { font:inherit; }
|
||||
.shell { max-width:1560px; margin:0 auto; padding:28px; }
|
||||
.hero { display:flex; justify-content:space-between; align-items:flex-start; gap:24px; margin-bottom:20px; }
|
||||
h1 { margin:0 0 6px; font-size:clamp(28px,4vw,44px); letter-spacing:-.04em; line-height:1.05; }
|
||||
.sub { max-width:760px; color:var(--muted); }
|
||||
.source { margin-top:8px; color:#7c8aa0; font-size:12px; overflow-wrap:anywhere; }
|
||||
.nav { display:flex; gap:8px; margin-top:12px; }
|
||||
.nav a { color:#1649a5; background:#e8f0ff; border-radius:9px; padding:7px 10px; text-decoration:none; font-weight:700; }
|
||||
.stats { display:grid; grid-template-columns:repeat(4,minmax(110px,1fr)); gap:10px; }
|
||||
.stat { padding:13px 15px; border:1px solid var(--line); border-radius:14px; background:var(--panel); box-shadow:0 5px 18px rgba(30,51,88,.04); }
|
||||
.stat strong { display:block; font-size:23px; line-height:1; margin-bottom:5px; }
|
||||
.stat span { color:var(--muted); font-size:12px; }
|
||||
.toolbar { position:sticky; top:0; z-index:20; display:grid; grid-template-columns:minmax(220px,1.5fr) repeat(5,minmax(135px,.7fr)); gap:10px; padding:12px; margin-bottom:14px; background:rgba(243,246,251,.95); border:1px solid var(--line); border-radius:16px; backdrop-filter:blur(12px); }
|
||||
input,select { width:100%; padding:10px 12px; border:1px solid #cdd8e7; border-radius:10px; background:#fff; color:var(--ink); }
|
||||
.panel { overflow:auto; border:1px solid var(--line); border-radius:16px; background:#fff; box-shadow:var(--shadow); }
|
||||
.table-head,.row { min-width:1380px; display:grid; grid-template-columns:minmax(240px,1.3fr) 110px 175px 190px 150px 150px minmax(260px,1.4fr); gap:12px; align-items:start; }
|
||||
.table-head { position:relative; z-index:2; padding:12px 16px; color:#fff; background:#172033; font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; }
|
||||
.row { padding:14px 16px; border-bottom:1px solid var(--line); }
|
||||
.row:last-child { border-bottom:0; }
|
||||
.row:hover { background:#f8fafc; }
|
||||
.day-heading { min-width:1380px; grid-column:1/-1; padding:11px 16px; color:#fff; background:#587b91; border-bottom:1px solid #84a2b2; font-size:13px; font-weight:800; letter-spacing:.04em; }
|
||||
.name { font-weight:800; }
|
||||
.meta { margin-top:3px; color:var(--muted); font-size:12px; overflow-wrap:anywhere; }
|
||||
.result { display:inline-flex; align-items:center; gap:7px; width:fit-content; border-radius:999px; padding:5px 9px; font-weight:800; font-size:12px; }
|
||||
.result.success { color:#166534; background:var(--success-soft); }
|
||||
.result.failure { color:#991b1b; background:var(--failure-soft); }
|
||||
.result.unknown { color:#475569; background:var(--unknown-soft); }
|
||||
.mark { display:inline-flex; align-items:center; justify-content:center; width:18px; height:18px; color:#fff; border-radius:50%; line-height:1; }
|
||||
.success .mark { background:var(--success); } .failure .mark { background:var(--failure); } .unknown .mark { background:var(--unknown); }
|
||||
.empty { padding:36px; text-align:center; color:var(--muted); }
|
||||
.foot { margin:12px 2px 0; color:var(--muted); font-size:12px; }
|
||||
.embed-mode .shell { max-width:none; padding:0; }
|
||||
.embed-mode .hero, .embed-mode .toolbar, .embed-mode .foot { display:none; }
|
||||
.embed-mode .panel { border:0; border-radius:0; box-shadow:none; }
|
||||
@media (max-width:1050px) { .hero{flex-direction:column}.stats{width:100%}.toolbar{grid-template-columns:1fr 1fr}.toolbar input{grid-column:1/-1}.panel{overflow:auto}.table-head,.row{min-width:1380px} }
|
||||
@media (max-width:600px) { .stats{grid-template-columns:repeat(2,minmax(0,1fr))} }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main class="shell">
|
||||
<section class="hero">
|
||||
<div>
|
||||
<h1>Automation Run Results</h1>
|
||||
<div class="sub">A reusable operational view of the canonical automation status registry. The list retains a rolling three-day history, newest first. Managed automations are linked to the workbook; collected evidence exposes every available scheduler result.</div>
|
||||
<div class="source" id="source"></div>
|
||||
<nav class="nav"><a href="automations-calendar.html">Open calendar</a></nav>
|
||||
</div>
|
||||
<div class="stats" id="stats"></div>
|
||||
</section>
|
||||
<section class="toolbar" aria-label="Result filters">
|
||||
<input id="search" type="search" placeholder="Search automation, source, detail…" aria-label="Search run results">
|
||||
<select id="scope"><option value="managed">Managed automations</option><option value="unlinked">Unlinked evidence</option><option value="all">All records</option></select>
|
||||
<select id="outcome"><option value="">All outcomes</option><option value="success">Successful</option><option value="failure">Failed</option><option value="unknown">Unknown</option></select>
|
||||
<select id="sourceFilter"><option value="">All sources</option></select>
|
||||
<select id="project"><option value="">All projects</option></select>
|
||||
<select id="opsSegment"><option value="">All ops segments</option></select>
|
||||
</section>
|
||||
<section class="panel">
|
||||
<div class="table-head"><div>Automation</div><div>Result</div><div>Last run</div><div>Source</div><div>Project</div><div>Ops segment</div><div>Detail</div></div>
|
||||
<div id="rows"></div>
|
||||
</section>
|
||||
<div class="foot" id="foot"></div>
|
||||
</main>
|
||||
<script>
|
||||
if (new URLSearchParams(location.search).get("embed") === "table") document.body.classList.add("embed-mode");
|
||||
const data = __AUTOMATION_RESULTS_DATA__;
|
||||
const state = {search:"",scope:"managed",outcome:"",sourceFilter:"",project:"",opsSegment:""};
|
||||
const esc = value => String(value ?? "").replace(/[&<>"']/g,ch=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[ch]));
|
||||
const mark = outcome => outcome === "success" ? "✓" : outcome === "failure" ? "×" : "?";
|
||||
const dateText = value => { if(!value)return "Never / unavailable"; const date=new Date(value); return Number.isNaN(date.valueOf())?String(value):date.toLocaleString([], {dateStyle:"medium",timeStyle:"short"}); };
|
||||
const normalize = day => { const managed = day.managed.map(item=>({...item,outcome:item.run.outcome,lastRun:item.run.lastRun,detail:item.run.detail,source:item.run.source,linked:true})); const unlinked = day.evidence.filter(item=>!item.linked).map(item=>({...item,project:"",opsSegment:"",machine:"",location:"",automationStatus:""})); return {managed,unlinked,all:[...managed,...unlinked]}; };
|
||||
const days = (data.days||[]).map(day=>({...day,...normalize(day)}));
|
||||
const allDays = days.length ? days : [{date:"",generatedAt:data.generatedAt,managed:[],unlinked:[],all:[]}];
|
||||
const allRecords = allDays.flatMap(day=>day.all);
|
||||
const fill = (id,values) => { const select=document.getElementById(id); [...new Set(values.filter(Boolean))].sort((a,b)=>a.localeCompare(b)).forEach(value=>select.insertAdjacentHTML("beforeend",`<option>${esc(value)}</option>`)); };
|
||||
fill("sourceFilter",allRecords.map(item=>item.source)); fill("project",allDays.flatMap(day=>day.managed.map(item=>item.project))); fill("opsSegment",allDays.flatMap(day=>day.managed.map(item=>item.opsSegment)));
|
||||
function scoped(day){ return state.scope === "managed" ? day.managed : state.scope === "unlinked" ? day.unlinked : day.all; }
|
||||
function filtered(day){ const q=state.search.toLowerCase(); return scoped(day).filter(item=>(!state.outcome||item.outcome===state.outcome)&&(!state.sourceFilter||item.source===state.sourceFilter)&&(!state.project||item.project===state.project)&&(!state.opsSegment||item.opsSegment===state.opsSegment)&&(!q||[item.name,item.source,item.detail,item.project,item.opsSegment,item.machine,...(item.aliases||[])].join(" ").toLowerCase().includes(q))).sort((a,b)=>(b.lastRun?Date.parse(b.lastRun)||0:0)-(a.lastRun?Date.parse(a.lastRun)||0:0)||a.name.localeCompare(b.name)); }
|
||||
function renderStats(items){ const count=o=>items.filter(item=>item.outcome===o).length; document.getElementById("stats").innerHTML=`<div class="stat"><strong>${items.length}</strong><span>records across ${allDays.length} days</span></div><div class="stat"><strong>${count("success")}</strong><span>successful</span></div><div class="stat"><strong>${count("failure")}</strong><span>failed</span></div><div class="stat"><strong>${count("unknown")}</strong><span>unknown</span></div>`; }
|
||||
const rowHtml = item => `<article class="row"><div><div class="name">${esc(item.name)}</div><div class="meta">${esc(item.machine||item.location||((item.aliases||[]).join(", ")))}</div></div><div><span class="result ${item.outcome}"><i class="mark">${mark(item.outcome)}</i>${esc(item.outcome)}</span></div><div>${esc(dateText(item.lastRun))}</div><div>${esc(item.source)}</div><div>${esc(item.project||"—")}</div><div>${esc(item.opsSegment||"—")}</div><div>${esc(item.detail||"—")}</div></article>`;
|
||||
function render(){ const sections=allDays.map(day=>{ const items=filtered(day); return items.length?`<div class="day-heading">${esc(day.date)} · ${esc(dateText(day.generatedAt))}</div>${items.map(rowHtml).join("")}`:""; }).join(""); const visible=allDays.flatMap(day=>filtered(day)); renderStats(allRecords); document.getElementById("rows").innerHTML=sections||'<div class="empty">No results match these filters.</div>'; document.getElementById("foot").textContent=`Showing ${visible.length} of ${allRecords.length} records across ${allDays.length} days. Newest day appears first; history is retained for three days.`; }
|
||||
document.getElementById("source").textContent=`Registry: ${data.statusRegistry} · ${data.workbookRange} · Generated ${dateText(data.generatedAt)}`;
|
||||
document.getElementById("search").addEventListener("input",e=>{state.search=e.target.value;render()}); ["scope","outcome","sourceFilter","project","opsSegment"].forEach(id=>document.getElementById(id).addEventListener("change",e=>{state[id]=e.target.value;render()})); render();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in new issue
Block a user