towerops/lib/towerops_web/live/schedule_live/form.html.heex
Graham McIntire 0cd2ed3567
feat: add on-call schedules and escalation policies
Built-in PagerDuty-equivalent system for on-call scheduling and alert
escalation. Users can now manage schedules, rotation layers, overrides,
and escalation policies directly in the app alongside PagerDuty.

- On-call schedules with rotation layers (daily/weekly/custom), member
  management, and temporary overrides
- Escalation policies with ordered rules, timeout-based escalation,
  and user/schedule targets
- Automatic escalation via Oban worker with configurable repeat count
- Email notifications via Swoosh for on-call alerts
- Resolver computes who's on-call from layer stacking and overrides
- AlertNotificationWorker integration: starts escalation alongside
  PagerDuty, acknowledges/resolves incidents on alert state changes
- Device and organization schemas support escalation_policy_id
- Escalation policy picker on device form
- Schedules nav item with tabbed index (schedules + escalation policies)
- Full CRUD UI for schedules, layers, members, overrides, rules, targets
- 62 LiveView tests, 56 context/schema/resolver/escalation tests
- 26 E2E Playwright tests for smoke and critical path coverage
2026-03-11 12:32:54 -05:00

46 lines
1.3 KiB
Text

<Layouts.authenticated
flash={@flash}
current_scope={@current_scope}
active_page="schedules"
>
<div class="flex items-center gap-3 mb-6">
<.link
navigate={~p"/schedules"}
class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"
>
<.icon name="hero-arrow-left" class="h-5 w-5" />
</.link>
<h1 class="text-xl font-bold text-gray-900 dark:text-white">{@page_title}</h1>
</div>
<div class="max-w-2xl">
<.form for={@form} phx-change="validate" phx-submit="save" class="space-y-6">
<div>
<.input field={@form[:name]} type="text" label={t("Name")} required />
</div>
<div>
<.input
field={@form[:timezone]}
type="text"
label={t("Timezone")}
placeholder="America/Chicago"
required
/>
</div>
<div>
<.input field={@form[:description]} type="textarea" label={t("Description")} />
</div>
<div class="flex items-center gap-3">
<.button type="submit" phx-disable-with={t("Saving...")}>
{t("Save Schedule")}
</.button>
<.link
navigate={~p"/schedules"}
class="text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"
>
{t("Cancel")}
</.link>
</div>
</.form>
</div>
</Layouts.authenticated>