Sync workspace source: rank tracker module + routes, Grid DB admin page, flaskfactory AI probe + analytics zone, nav.js v16 Blog pill, template refresh
c8c30b4 Download templates/admin_cron.html from deanpowers/blind-monkeys: direct link, hf CLI and curl.
- Browser
- Download file 13.1 kB
-
https://huggingface.co/deanpowers/blind-monkeys/resolve/main/templates/admin_cron.html
- Command line
-
hf download hf://deanpowers/blind-monkeys/templates/admin_cron.html
-
curl -L -o admin_cron.html https://huggingface.co/deanpowers/blind-monkeys/resolve/main/templates/admin_cron.html
13.1 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Cron Jobs — Admin</title> | |
| <link rel="stylesheet" href="/css/nav.css?v=4"> | |
| <link rel="icon" type="image/svg+xml" href="/static/favicon.svg"> | |
| <style> | |
| * { box-sizing: border-box; } | |
| body { background: #0d1117; color: #e6edf3; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; margin: 0; } | |
| .page-content { max-width: 1200px; margin: 0 auto; padding: 32px 20px; } | |
| h1 { font-size: 24px; margin: 0 0 4px; } | |
| .sub { color: #8b949e; font-size: 14px; margin-bottom: 24px; } | |
| .card { background: #1e2329; border: 2px solid #30363d; border-radius: 12px; padding: 20px; margin-bottom: 20px; } | |
| .card h2 { font-size: 14px; color: #f0b90b; margin: 0 0 16px; letter-spacing: 1px; text-transform: uppercase; } | |
| table { width: 100%; border-collapse: collapse; } | |
| th { text-align: left; padding: 10px 8px; color: #8b949e; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid #30363d; } | |
| td { padding: 12px 8px; border-bottom: 1px solid #21262d; font-size: 13px; vertical-align: middle; } | |
| tr:last-child td { border-bottom: none; } | |
| .mono { font-family: 'SF Mono', Monaco, monospace; font-size: 12px; color: #8b949e; } | |
| .badge { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; } | |
| .badge-enabled { background: #1a3a1a; color: #4ade80; border: 1px solid #4ade80; } | |
| .badge-paused { background: #3a2a1a; color: #f0b90b; border: 1px solid #f0b90b; } | |
| .badge-disabled { background: #3a1a1a; color: #f87171; border: 1px solid #f87171; } | |
| .btn-mini { padding: 5px 10px; border-radius: 6px; font-size: 11px; font-weight: 700; cursor: pointer; border: 1px solid #30363d; background: transparent; color: #8b949e; font-family: inherit; margin-right: 4px; } | |
| .btn-mini:hover { border-color: #f0b90b; color: #f0b90b; } | |
| .btn-danger:hover { border-color: #f87171; color: #f87171; } | |
| .btn-primary { padding: 10px 20px; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; border: none; background: #f0b90b; color: #0b0e11; font-family: inherit; } | |
| .btn-primary:hover { background: #d9a70a; } | |
| .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; } | |
| .field { margin-bottom: 14px; } | |
| .field label { display: block; color: #8b949e; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; } | |
| .field input, .field select, .field textarea { width: 100%; padding: 9px 12px; border-radius: 6px; border: 1px solid #30363d; background: #0d1117; color: #e6edf3; font-size: 13px; font-family: inherit; } | |
| .field input:focus, .field select:focus { outline: none; border-color: #f0b90b; } | |
| .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } | |
| .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; } | |
| #form-wrap { display: none; } | |
| #form-wrap.visible { display: block; } | |
| .hint { color: #484f58; font-size: 11px; margin-top: 4px; } | |
| .err { color: #f87171; font-size: 12px; margin-top: 8px; display: none; } | |
| .err.show { display: block; } | |
| .empty { color: #8b949e; font-size: 14px; padding: 16px 0; text-align: center; } | |
| </style> | |
| </head> | |
| <body> | |
| <nav class="nav-bar"> | |
| <div class="nav-brand">🙈 Blind Monkeys</div> | |
| <div class="nav-links"> | |
| <a href="/" class="nav-link">\ud83c\udfe0 Home</a> | |
| <a href="/scan/" class="nav-link">\ud83d\udd0d Scan</a> | |
| <a href="/settings/" class="nav-link">⚙️ Settings</a> | |
| </div> | |
| </nav> | |
| <div class="page-content"> | |
| <h1>⏰ Cron Jobs</h1> | |
| <div class="sub">Scheduled scans and tasks \u2014 backed by Cloud Scheduler</div> | |
| <div class="card"> | |
| <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;"> | |
| <h2 style="margin:0;">Jobs</h2> | |
| <button class="btn-primary" id="toggle-form">+ Add Job</button> | |
| </div> | |
| <div id="jobs-content"><div class="empty">Loading\u2026</div></div> | |
| </div> | |
| <div class="card" id="form-wrap"> | |
| <h2>New Job</h2> | |
| <div class="row2"> | |
| <div class="field"> | |
| <label>Name</label> | |
| <input id="f-name" placeholder="scan-conservative-15min" pattern="[a-z0-9-]+"> | |
| <div class="hint">Lowercase, hyphens only. Cannot be changed later.</div> | |
| </div> | |
| <div class="field"> | |
| <label>Description</label> | |
| <input id="f-description" placeholder="Conservative scan every 15 min"> | |
| </div> | |
| </div> | |
| <div class="row3"> | |
| <div class="field"> | |
| <label>Frequency</label> | |
| <select id="f-freq"> | |
| <option value="*/5 * * * *">Every 5 minutes</option> | |
| <option value="*/15 * * * *" selected>Every 15 minutes</option> | |
| <option value="*/30 * * * *">Every 30 minutes</option> | |
| <option value="0 * * * *">Hourly</option> | |
| <option value="0 9 * * *">Daily at 9am</option> | |
| <option value="custom">Custom\u2026</option> | |
| </select> | |
| </div> | |
| <div class="field"> | |
| <label>Cron Expression</label> | |
| <input id="f-schedule" value="*/15 * * * *"> | |
| </div> | |
| <div class="field"> | |
| <label>Timezone</label> | |
| <select id="f-timezone"> | |
| <option value="America/New_York">America/New_York</option> | |
| <option value="America/Chicago">America/Chicago</option> | |
| <option value="America scan/Los_Angeles">America/Los</_Angeles</optionoption> | |
| <option value> | |
| ="UTC">UTC</option> | |
| </select > | |
| </div> | |
| </div> | |
| <div class="row2"> | |
| <div class="field"> | |
| <label>Action</label> | |
| <select id="f-action"> | |
| <option value="scan_conservative">Conservative scan</option> | |
| <option value="scan_risk">Risk-taker <option value="flush_alerts">Flush Telegram alerts</option> | |
| <option value="custom">Custom URL\u2026</option> | |
| </select> | |
| </div> | |
| <div class="field"> | |
| <label>Enabled</label> | |
| <select id="f-enabled"> | |
| <option value="1">Yes \u2014 starts running immediately</option> | |
| <option value="0">No \u2014 create paused</option> | |
| </select> | |
| </div> | |
| </div> | |
| <div class="field" id="custom-url-wrap" style="display:none;"> | |
| <label>Custom URL (must be on your Cloud Run domain)</label> | |
| <input id="f-custom-url" placeholder="https://portfolio-agent-public-...run.app/your-path"> | |
| </div> | |
| <div class="err" id="form-err"></div> | |
| <div style="margin-top:16px;"> | |
| <button class="btn-primary" id="f-submit">Create Job</button> | |
| <button class="btn-mini" id="f-cancel" style="margin-left:8px;">Cancel</button> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| (function(){ | |
| var jobsEl = document.getElementById('jobs-content'); | |
| var formWrap = document.getElementById('form-wrap'); | |
| var formErr = document.getElementById('form-err'); | |
| function esc(s){return String(s==null?'':s).replace(/[&<>"']/g,function(c){return{'&':'&','<':'<','>':'>','"':'"',"'":'''}[c];});} | |
| function badge(state){ | |
| if (state === 'ENABLED') return '<span class="badge badge-enabled">Live</span>'; | |
| if (state === 'PAUSED') return '<span class="badge badge-paused">Paused</span>'; | |
| return '<span class="badge badge-disabled">' + esc(state) + '</span>'; | |
| } | |
| function fmtTs(ts){ if(!ts) return '\u2014'; try { return new Date(ts).toLocaleString(); } catch(e){ return ts; } } | |
| function load(){ | |
| jobsEl.innerHTML = '<div class="empty">Loading\u2026</div>'; | |
| fetch('/api/admin/cron', {cache:'no-store'}) | |
| .then(function(r){return r.json();}) | |
| .then(function(d){ | |
| if (d.error){ jobsEl.innerHTML = '<div class="empty" style="color:#f87171;">'+esc(d.error)+'</div>'; return; } | |
| var jobs = d.jobs || []; | |
| if (!jobs.length){ jobsEl.innerHTML = '<div class="empty">No cron jobs yet. Click "+ Add Job".</div>'; return; } | |
| var html = '<table><thead><tr><th>Name</th><th>Schedule</th><th>Action</th><th>State</th><th>Last Run</th><th>Next Run</th><th></th></tr></thead><tbody>'; | |
| jobs.forEach(function(j){ | |
| var action = j.uri ? j.uri.split('.run.app')[1] || j.uri : '\u2014'; | |
| html += '<tr>'; | |
| html += '<td><div style="font-weight:600;">'+esc(j.name)+'</div><div class="mono">'+esc(j.description)+'</div></td>'; | |
| html += '<td class="mono">'+esc(j.schedule)+'<br><span style="color:#484f58;">'+esc(j.time_zone)+'</span></td>'; | |
| html += '<td class="mono">'+esc(action)+'</td>'; | |
| html += '<td>'+badge(j.state)+'</td>'; | |
| html += '<td class="mono">'+fmtTs(j.last_attempt_time)+'</td>'; | |
| html += '<td class="mono">'+fmtTs(j.schedule_time)+'</td>'; | |
| html += '<td style="text-align:right;white-space:nowrap;">'; | |
| html += '<button class="btn-mini" data-act="run" data-name="'+esc(j.name)+'">Run</button>'; | |
| if (j.state === 'ENABLED') html += '<button class="btn-mini" data-act="pause" data-name="'+esc(j.name)+'">Pause</button>'; | |
| else if (j.state === 'PAUSED') html += '<button class="btn-mini" data-act="resume" data-name="'+esc(j.name)+'">Resume</button>'; | |
| html += '<button class="btn-mini btn-danger" data-act="delete" data-name="'+esc(j.name)+'">Delete</button>'; | |
| html += '</td></tr>'; | |
| }); | |
| html += '</tbody></table>'; | |
| jobsEl.innerHTML = html; | |
| jobsEl.querySelectorAll('button[data-act]').forEach(function(b){ | |
| b.addEventListener('click', function(){ | |
| var act = b.dataset.act, name = b.dataset.name; | |
| if (act === 'delete' && !confirm('Delete cron job "'+name+'"? This cannot be undone.')) return; | |
| b.disabled = true; | |
| fetch('/api/admin/cron/'+act+'/'+encodeURIComponent(name), {method:'POST'}) | |
| .then(function(r){return r.json().then(function(d){return {ok:r.ok,d:d};});}) | |
| .then(function(x){ if(!x.ok){ alert(x.d.error||'Action failed'); } load(); }) | |
| .catch(function(e){ alert('Failed: '+e.message); b.disabled=false; }); | |
| }); | |
| }); | |
| }) | |
| .catch(function(e){ jobsEl.innerHTML = '<div class="empty" style="color:#f87171;">Load failed: '+esc(e.message)+'</div>'; }); | |
| } | |
| document.getElementById('toggle-form').addEventListener('click', function(){ | |
| formWrap.classList.toggle('visible'); | |
| formErr.classList.remove('show'); | |
| }); | |
| document.getElementById('f-cancel').addEventListener('click', function(){ | |
| formWrap.classList.remove('visible'); | |
| }); | |
| var freq = document.getElementById('f-freq'); | |
| var sched = document.getElementById('f-schedule'); | |
| freq.addEventListener('change', function(){ | |
| if (freq.value !== 'custom') sched.value = freq.value; | |
| }); | |
| var actionSel = document.getElementById('f-action'); | |
| var customWrap = document.getElementById('custom-url-wrap'); | |
| actionSel.addEventListener('change', function(){ | |
| customWrap.style.display = (actionSel.value === 'custom') ? 'block' : 'none'; | |
| }); | |
| document.getElementById('f-submit').addEventListener('click', function(){ | |
| formErr.classList.remove('show'); | |
| var body = { | |
| name: document.getElementById('f-name').value.trim(), | |
| description: document.getElementById('f-description').value.trim(), | |
| schedule: sched.value.trim(), | |
| time_zone: document.getElementById('f-timezone').value, | |
| action: actionSel.value, | |
| custom_url: document.getElementById('f-custom-url').value.trim(), | |
| enabled: document.getElementById('f-enabled').value === '1' | |
| }; | |
| var btn = this; btn.disabled = true; | |
| fetch('/api/admin/cron/create', {method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(body)}) | |
| .then(function(r){return r.json().then(function(d){return {ok:r.ok,d:d};});}) | |
| .then(function(x){ | |
| btn.disabled = false; | |
| if (!x.ok){ formErr.textContent = x.d.error || 'Create failed'; formErr.classList.add('show'); return; } | |
| formWrap.classList.remove('visible'); | |
| ['f-name','f-description','f-custom-url'].forEach(function(id){document.getElementById(id).value='';}); | |
| load(); | |
| }) | |
| .catch(function(e){ btn.disabled = false; formErr.textContent = e.message; formErr.classList.add('show'); }); | |
| }); | |
| load(); | |
| })(); | |
| </script> | |
| <script src="/css/nav.js?v=16"></script> | |
| <!--Start of Tawk.to Script--> | |
| <script type="text/javascript"> | |
| var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date(); | |
| (function(){ | |
| var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0]; | |
| s1.async=true; | |
| s1.src='https://embed.tawk.to/6ad326872ab00434d21793a2/1k54ic9h0'; | |
| s1.charset='UTF-8'; | |
| s1.setAttribute('crossorigin','*'); | |
| s0.parentNode.insertBefore(s1,s0); | |
| })(); | |
| </script> | |
| <!--End of Tawk.to Script--> | |
| </body> | |
| </html> | |