<% const monitor = it._form?.monitor || {}; const isEdit = !!it._form?.isEdit; const prefix = it._form?.prefix || ''; const bg = it._form?.bg || 'bg-gray-900'; const border = it._form?.border || 'border-gray-800'; const plan = it.plan || 'free'; const minInterval = { free: 30, pro: 5, pro2x: 5, pro4x: 5, lifetime: 5 }[plan] || 30; const btnText = isEdit ? 'Save Changes' : 'Create Monitor'; const formId = prefix + 'form'; const methods = ['GET','POST','PUT','PATCH','DELETE','HEAD','OPTIONS']; const allIntervals = [['2','2 seconds'],['5','5 seconds'],['10','10 seconds'],['20','20 seconds'],['30','30 seconds'],['60','1 minute'],['300','5 minutes'],['600','10 minutes'],['1800','30 minutes'],['3600','1 hour']]; const intervals = allIntervals.filter(([val]) => Number(val) >= minInterval); const timeouts = [['5000','5 seconds'],['10000','10 seconds'],['20000','20 seconds'],['30000','30 seconds'],['40000','40 seconds'],['50000','50 seconds'],['60000','60 seconds']]; const regions = it.regions; const curMethod = monitor.method || 'GET'; const bodyHidden = ['GET','HEAD','OPTIONS'].includes(curMethod); %>
<% if (monitor.request_headers && typeof monitor.request_headers === 'object') { Object.entries(monitor.request_headers).forEach(function([k, v]) { %>
<% }) } %>
<% const allRetryGaps = [['5','5 seconds'],['15','15 seconds'],['30','30 seconds'],['60','1 minute'],['120','2 minutes'],['300','5 minutes']]; const retryGaps = allRetryGaps.filter(([val]) => Number(val) >= minInterval); const defaultRetryGap = String(Math.max(30, minInterval)); const curRetryRaw = Number(monitor.retry_interval_s); const curRetry = (curRetryRaw >= minInterval) ? String(curRetryRaw) : defaultRetryGap; %>
<% const certDaysRaw = Number(monitor.cert_alert_days); const certDaysSel = (certDaysRaw >= 1 && certDaysRaw <= 9) ? String(certDaysRaw) : '0'; %>
<% const channels = it.channels || []; const attached = (monitor.channel_ids && monitor.channel_ids.length) ? monitor.channel_ids : []; %>
<% if (channels.length === 0) { %>

No channels yet. Create one to get alerted on transitions.

<% } else { %>
<% channels.forEach(function(c) { %> <% }) %>
<% } %>
<% // Default to all regions if none selected const selectedRegions = (monitor.regions && monitor.regions.length) ? monitor.regions : regions.map(r => r[0]); %>
<% regions.forEach(function([val, label]) { %> <% }) %>

Define <% if (isEdit) { %>up/down conditions<% } else { %>when this monitor should be considered "up"<% } %>. Defaults to status < 400.