mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 03:32:06 +00:00
Add a public health probe and monitoring runbook (#166)
* move theme picker position in add endgames form * Add branded favicons and web manifest - Replace the placeholder favicon with the knight mark: .ico (16/32/48), SVG, and 16/32 PNGs. - Add opaque apple-touch and Android launcher icons plus a site webmanifest naming the app and using the brand palette. - Link the icon set, manifest, and theme-color from the root layout and the 404/500 pages. - Whitelist the new static files in static_paths/0 and the prelaunch allowlist so they are served in production and behind the gate. - Sync the coming-soon site's favicon.ico and drop the unused Phoenix logo. * Add a public health probe and monitoring runbook Probe https://<PHX_HOST>/health through Cloudflare every two minutes and report to a healthchecks.io check. A healthy run posts the raw health JSON; a tablebase mismatch is a green check-in with the mismatch recorded; a non-200, non-JSON, down database or network failure posts one fail ping with the response body and a loopback cross-check as evidence. --dry-run evaluates the success, degraded, fail, non-JSON and unreachable fixtures without reading config or touching the network. The runbook covers the healthchecks.io check, install, what /health proves, Beszel's blind spot and the drills. * Fix theme picker search after moving it into the endgame form The picker moved inside the endgame form, which nested the component's own <form>. Browsers, and the LiveView test DOM, drop a nested form along with its phx-change and phx-submit bindings, so the search box did nothing and three form tests lost their #theme-form selector. The component now renders no form: phx-change sits on the search input, which works both inside the endgame form and standalone on the bulk importer. The unreachable create_theme_from_search handlers go away; theme creation uses the existing button. Tests search through the input and click that button.
This commit is contained in:
@@ -41,6 +41,14 @@
|
||||
name="twitter:description"
|
||||
content={assigns[:meta_description]}
|
||||
/>
|
||||
<link rel="icon" href="/favicon.ico" sizes="48x48" />
|
||||
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
||||
<link rel="icon" href="/favicon-32x32.png" type="image/png" sizes="32x32" />
|
||||
<link rel="icon" href="/favicon-16x16.png" type="image/png" sizes="16x16" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||
<link rel="manifest" href="/site.webmanifest" />
|
||||
<meta name="theme-color" content="#17352d" />
|
||||
|
||||
<link phx-track-static rel="stylesheet" href={~p"/assets/css/app.css"} />
|
||||
<link
|
||||
rel="preload"
|
||||
|
||||
@@ -3,8 +3,12 @@ defmodule ChesstrainerWeb.ThemePicker do
|
||||
Search-and-select control shared by the endgame form and bulk importer.
|
||||
|
||||
The parent LiveView owns the assignments and handles the events:
|
||||
`search_themes`, `add_theme`, `create_theme`, `create_theme_from_search` and
|
||||
`remove_theme`.
|
||||
`search_themes`, `add_theme`, `create_theme` and `remove_theme`.
|
||||
|
||||
The control renders no `<form>` of its own. It is embedded in the endgame
|
||||
form, where a nested form would be dropped by the HTML parser and take its
|
||||
bindings with it, and it is used standalone on the bulk importer. Binding
|
||||
`phx-change` on the search input keeps both call sites working.
|
||||
"""
|
||||
|
||||
use ChesstrainerWeb, :html
|
||||
@@ -35,10 +39,11 @@ defmodule ChesstrainerWeb.ThemePicker do
|
||||
</.badge>
|
||||
</div>
|
||||
|
||||
<form id="theme-form" phx-change="search_themes" phx-submit="create_theme_from_search">
|
||||
<div id="theme-picker">
|
||||
<.input
|
||||
name="theme_search"
|
||||
value={@theme_query}
|
||||
phx-change="search_themes"
|
||||
phx-debounce="200"
|
||||
autocomplete="off"
|
||||
placeholder="Search or create a theme…"
|
||||
@@ -67,7 +72,7 @@ defmodule ChesstrainerWeb.ThemePicker do
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
"""
|
||||
end
|
||||
|
||||
@@ -6,6 +6,14 @@
|
||||
<meta name="robots" content="noindex" />
|
||||
<title>{Branding.title("Page not found")}</title>
|
||||
|
||||
<link rel="icon" href="/favicon.ico" sizes="48x48" />
|
||||
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
||||
<link rel="icon" href="/favicon-32x32.png" type="image/png" sizes="32x32" />
|
||||
<link rel="icon" href="/favicon-16x16.png" type="image/png" sizes="16x16" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||
<link rel="manifest" href="/site.webmanifest" />
|
||||
<meta name="theme-color" content="#17352d" />
|
||||
|
||||
<link phx-track-static rel="stylesheet" href={~p"/assets/css/app.css"} />
|
||||
<link
|
||||
rel="preload"
|
||||
|
||||
@@ -6,6 +6,14 @@
|
||||
<meta name="robots" content="noindex" />
|
||||
<title>{Branding.title("Something went wrong")}</title>
|
||||
|
||||
<link rel="icon" href="/favicon.ico" sizes="48x48" />
|
||||
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
||||
<link rel="icon" href="/favicon-32x32.png" type="image/png" sizes="32x32" />
|
||||
<link rel="icon" href="/favicon-16x16.png" type="image/png" sizes="16x16" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||
<link rel="manifest" href="/site.webmanifest" />
|
||||
<meta name="theme-color" content="#17352d" />
|
||||
|
||||
<link phx-track-static rel="stylesheet" href={~p"/assets/css/app.css"} />
|
||||
<link
|
||||
rel="preload"
|
||||
|
||||
@@ -21,13 +21,6 @@ defmodule ChesstrainerWeb.EndgameLive.Form do
|
||||
<:subtitle>Use this form to manage endgame records in your database.</:subtitle>
|
||||
</.header>
|
||||
|
||||
<.theme_picker
|
||||
selected_themes={@selected_themes}
|
||||
theme_query={@theme_query}
|
||||
theme_results={@theme_results}
|
||||
can_create={@can_create}
|
||||
/>
|
||||
|
||||
<.form for={@form} id="endgame-form" phx-change="validate" phx-submit="save">
|
||||
<div class="flex flex-col gap-6 sm:flex-row sm:items-start">
|
||||
<div class="min-w-0 flex-1">
|
||||
@@ -40,6 +33,13 @@ defmodule ChesstrainerWeb.EndgameLive.Form do
|
||||
label="Rating"
|
||||
/>
|
||||
|
||||
<.theme_picker
|
||||
selected_themes={@selected_themes}
|
||||
theme_query={@theme_query}
|
||||
theme_results={@theme_results}
|
||||
can_create={@can_create}
|
||||
/>
|
||||
|
||||
<.input field={@form[:message]} type="textarea" label="Message" />
|
||||
<.input field={@form[:notes]} type="textarea" label="Notes" />
|
||||
<.input
|
||||
@@ -122,10 +122,6 @@ defmodule ChesstrainerWeb.EndgameLive.Form do
|
||||
{:noreply, create_theme(socket, name)}
|
||||
end
|
||||
|
||||
def handle_event("create_theme_from_search", %{"theme_search" => name}, socket) do
|
||||
{:noreply, create_theme(socket, name)}
|
||||
end
|
||||
|
||||
def handle_event("remove_theme", %{"id" => id}, socket) do
|
||||
selected = Enum.reject(socket.assigns.selected_themes, &(Integer.to_string(&1.id) == id))
|
||||
{:noreply, assign(socket, :selected_themes, selected)}
|
||||
|
||||
@@ -194,10 +194,6 @@ defmodule ChesstrainerWeb.EndgameLive.Import do
|
||||
{:noreply, create_theme(socket, name)}
|
||||
end
|
||||
|
||||
def handle_event("create_theme_from_search", %{"theme_search" => name}, socket) do
|
||||
{:noreply, create_theme(socket, name)}
|
||||
end
|
||||
|
||||
def handle_event("remove_theme", %{"id" => id}, socket) do
|
||||
selected = Enum.reject(socket.assigns.selected_themes, &(Integer.to_string(&1.id) == id))
|
||||
{:noreply, assign(socket, :selected_themes, selected)}
|
||||
|
||||
@@ -20,6 +20,13 @@ defmodule ChesstrainerWeb.Plugs.Prelaunch do
|
||||
/robots.txt
|
||||
/sitemap.xml
|
||||
/favicon.ico
|
||||
/favicon.svg
|
||||
/favicon-16x16.png
|
||||
/favicon-32x32.png
|
||||
/apple-touch-icon.png
|
||||
/android-chrome-192x192.png
|
||||
/android-chrome-512x512.png
|
||||
/site.webmanifest
|
||||
)
|
||||
|
||||
@allowed_prefixes ~w(
|
||||
|
||||
Reference in New Issue
Block a user