This commit is contained in:
eddiesoehnel committed 2026-09-22 07:50:20 -06:00
commit 2bcc107c13
39 files changed
+2643

No files matched your search

@@ -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 => ({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[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>