Skip to content

Commit f7b4d50

Browse files
authored
feat: link live system status from site footers (#60223)
1 parent 1eea2d4 commit f7b4d50

68 files changed

Lines changed: 497 additions & 23 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[data-component="legal"] [data-slot="status"] {
2+
--status-dot: var(--color-text-weak);
3+
white-space: nowrap;
4+
}
5+
6+
/* An inline dot keeps the label on the same baseline as the rest of the row. */
7+
[data-component="legal"] [data-slot="status"]::before {
8+
content: "";
9+
display: inline-block;
10+
width: 6px;
11+
height: 6px;
12+
margin-right: 10px;
13+
vertical-align: 0.1em;
14+
background: var(--status-dot);
15+
}
16+
17+
[data-component="legal"] [data-slot="status"][data-status="operational"] {
18+
--status-dot: #198b43;
19+
}
20+
21+
[data-component="legal"] [data-slot="status"][data-status="degraded"] {
22+
--status-dot: #c48a00;
23+
}
24+
25+
[data-component="legal"] [data-slot="status"][data-status="outage"] {
26+
--status-dot: #d93636;
27+
}

‎packages/console/app/src/component/legal.tsx‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { A } from "@solidjs/router"
2+
import { createSignal, onMount } from "solid-js"
23
import { LanguagePicker } from "~/component/language-picker"
34
import { useI18n } from "~/context/i18n"
45
import { useLanguage } from "~/context/language"
6+
import "./legal.css"
57

68
export function Legal() {
79
const i18n = useI18n()
@@ -11,6 +13,9 @@ export function Legal() {
1113
<span>
1214
©{new Date().getFullYear()} <a href="https://anoma.ly">Anomaly</a>
1315
</span>
16+
<span>
17+
<SystemStatusLink />
18+
</span>
1419
<span>
1520
<A href={language.route("/brand")}>{i18n.t("legal.brand")}</A>
1621
</span>
@@ -26,3 +31,30 @@ export function Legal() {
2631
</div>
2732
)
2833
}
34+
35+
const systemStatuses = ["operational", "degraded", "outage", "unknown"] as const
36+
type SystemStatus = (typeof systemStatuses)[number]
37+
38+
function SystemStatusLink() {
39+
const i18n = useI18n()
40+
const [status, setStatus] = createSignal<SystemStatus>("unknown")
41+
42+
onMount(() => {
43+
fetch("/status/api/summary", { signal: AbortSignal.timeout(10_000) })
44+
.then((response) => (response.ok ? response.json() : undefined))
45+
.then((body: unknown) => setStatus(readSystemStatus(body)))
46+
.catch(() => setStatus("unknown"))
47+
})
48+
49+
// The status page lives outside this app and is not localized, so bypass the locale route and client router.
50+
return (
51+
<a data-slot="status" data-status={status()} href="/status" rel="external">
52+
{i18n.t(`legal.status.${status()}`)}
53+
</a>
54+
)
55+
}
56+
57+
function readSystemStatus(body: unknown) {
58+
if (!body || typeof body !== "object" || !("status" in body)) return "unknown"
59+
return systemStatuses.find((status) => status === body.status) ?? "unknown"
60+
}

‎packages/console/app/src/i18n/ar.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export const dict = {
2929
"legal.brand": "العلامة التجارية",
3030
"legal.privacy": "الخصوصية",
3131
"legal.terms": "الشروط",
32+
"legal.status.operational": "كل الأنظمة تعمل",
33+
"legal.status.degraded": "أداء متراجع",
34+
"legal.status.outage": "انقطاع في الخدمة",
35+
"legal.status.unknown": "حالة النظام",
3236

3337
"email.title": "كن الأول في المعرفة عند إطلاق منتجات جديدة",
3438
"email.subtitle": "انضم إلى قائمة الانتظار للحصول على وصول مبكر.",

‎packages/console/app/src/i18n/br.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export const dict = {
3030
"legal.brand": "Marca",
3131
"legal.privacy": "Privacidade",
3232
"legal.terms": "Termos",
33+
"legal.status.operational": "Todos os sistemas operacionais",
34+
"legal.status.degraded": "Desempenho degradado",
35+
"legal.status.outage": "Interrupção do serviço",
36+
"legal.status.unknown": "Status do sistema",
3337

3438
"email.title": "Seja o primeiro a saber quando lançarmos novos produtos",
3539
"email.subtitle": "Entre na lista de espera para acesso antecipado.",

‎packages/console/app/src/i18n/da.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export const dict = {
3030
"legal.brand": "Brand",
3131
"legal.privacy": "Privatliv",
3232
"legal.terms": "Vilkår",
33+
"legal.status.operational": "Alle systemer er i drift",
34+
"legal.status.degraded": "Nedsat ydeevne",
35+
"legal.status.outage": "Driftsforstyrrelse",
36+
"legal.status.unknown": "Systemstatus",
3337

3438
"email.title": "Få besked først, når vi lancerer nye produkter",
3539
"email.subtitle": "Tilmeld dig ventelisten for tidlig adgang.",

‎packages/console/app/src/i18n/de.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export const dict = {
3030
"legal.brand": "Marke",
3131
"legal.privacy": "Datenschutz",
3232
"legal.terms": "AGB",
33+
"legal.status.operational": "Alle Systeme betriebsbereit",
34+
"legal.status.degraded": "Eingeschränkte Leistung",
35+
"legal.status.outage": "Dienststörung",
36+
"legal.status.unknown": "Systemstatus",
3337

3438
"email.title": "Erfahre als Erste:r, wenn wir neue Produkte veröffentlichen",
3539
"email.subtitle": "Trage dich in die Warteliste für frühen Zugang ein.",

‎packages/console/app/src/i18n/en.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ export const dict = {
3131
"legal.brand": "Brand",
3232
"legal.privacy": "Privacy",
3333
"legal.terms": "Terms",
34+
"legal.status.operational": "All systems operational",
35+
"legal.status.degraded": "Degraded performance",
36+
"legal.status.outage": "Service disruption",
37+
"legal.status.unknown": "System status",
3438

3539
"email.title": "Be the first to know when we release new products",
3640
"email.subtitle": "Join the waitlist for early access.",

‎packages/console/app/src/i18n/es.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export const dict = {
3030
"legal.brand": "Marca",
3131
"legal.privacy": "Privacidad",
3232
"legal.terms": "Términos",
33+
"legal.status.operational": "Todos los sistemas están operativos",
34+
"legal.status.degraded": "Rendimiento degradado",
35+
"legal.status.outage": "Interrupción del servicio",
36+
"legal.status.unknown": "Estado del sistema",
3337

3438
"email.title": "Sé el primero en enterarte cuando lancemos nuevos productos",
3539
"email.subtitle": "Únete a la lista de espera para acceso anticipado.",

‎packages/console/app/src/i18n/fr.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ export const dict = {
3131
"legal.brand": "Marque",
3232
"legal.privacy": "Confidentialité",
3333
"legal.terms": "Conditions",
34+
"legal.status.operational": "Tous les systèmes sont opérationnels",
35+
"legal.status.degraded": "Performances dégradées",
36+
"legal.status.outage": "Interruption de service",
37+
"legal.status.unknown": "État du système",
3438

3539
"email.title": "Soyez le premier à être informé de nos nouveaux produits",
3640
"email.subtitle": "Inscrivez-vous à la liste d'attente pour un accès anticipé.",

‎packages/console/app/src/i18n/it.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export const dict = {
3030
"legal.brand": "Brand",
3131
"legal.privacy": "Privacy",
3232
"legal.terms": "Termini",
33+
"legal.status.operational": "Tutti i sistemi sono operativi",
34+
"legal.status.degraded": "Prestazioni ridotte",
35+
"legal.status.outage": "Interruzione del servizio",
36+
"legal.status.unknown": "Stato del sistema",
3337

3438
"email.title": "Sii il primo a sapere quando rilasciamo nuovi prodotti",
3539
"email.subtitle": "Iscriviti alla waitlist per l'accesso anticipato.",

0 commit comments

Comments
 (0)