PageSourceSearch

https://affne.com/assets/runbooks-PP8xnpMP.js

js affne.com collected 2026-10-06 18:05:54 UTC 7,413 bytes, 1 lines download raw bytes

1import{j as e,a3 as h,r as j}from"./react-core-B0dokwlC.js";import{u as n,c as g,b as f}from"./tanstack-vd4r7a6S.js";import{C as c,a as d,b as l,c as o}from"./card-Da3kDgnT.js";import{B as m}from"./badge-D8DSoPJn.js";import{u as N,a as b,B as x}from"./index-Bk-MTYAN.js";import{S as v}from"./authenticated-app-D0O6uVHz.js";import{cx as y,at as w,c2 as k,m as C,ax as P,ap as B,av as S,i as R,a$ as A,g as T,S as D,f as q,c6 as z,au as K}from"./lucide-BAInuTRQ.js";import"./radix-D2EKS-RZ.js";import"./charts-CgPya_By.js";import"./input-Drn4J9gH.js";import"./dark-marketing-layout-T357hzqy.js";import"./affne-logo-ZGd0xEuO.js";import"./use-auth-DM6HQijx.js";import"./home-BQfO24u1.js";import"./accordion-AWFij4Fa.js";import"./framer-motion-V3lmxFoN.js";const E={"P1-001":e.jsx(K,{className:"h-5 w-5"}),"P1-002":e.jsx(z,{className:"h-5 w-5"}),"P1-003":e.jsx(q,{className:"h-5 w-5"}),"P1-004":e.jsx(D,{className:"h-5 w-5"}),"P1-005":e.jsx(T,{className:"h-5 w-5"}),"P1-006":e.jsx(A,{className:"h-5 w-5"})},L={P1:"bg-red-100 text-red-800 border-red-200",P2:"bg-orange-100 text-orange-800 border-orange-200"};function U({runbook:t}){const[i,s]=j.useState(!1);return e.jsxs(c,{className:"border",children:[e.jsxs(d,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>s(a=>!a),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"text-muted-foreground",children:E[t.id]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:t.id}),e.jsx(m,{variant:"outline",className:`text-xs px-1.5 py-0 ${L[t.severity]}`,children:t.severity})]}),e.jsx(l,{className:"text-base mt-0.5",children:t.title})]})]}),e.jsx(x,{variant:"ghost",size:"icon",className:"shrink-0",children:i?e.jsx(P,{className:"h-4 w-4"}):e.jsx(B,{className:"h-4 w-4"})})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 ml-8",children:t.description})]}),i&&e.jsxs(o,{className:"pt-0 space-y-5",children:[e.jsx(v,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:"When to activate"}),e.jsx("ul",{className:"space-y-1",children:t.triggers.map((a,r)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[e.jsx(S,{className:"h-3.5 w-3.5 text-amber-500 mt-0.5 shrink-0"}),a]},r))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:"Response steps"}),e.jsx("ol",{className:"space-y-2",children:t.steps.map(a=>e.jsxs("li",{className:"flex items-start gap-3 text-sm",children:[e.jsx("span",{className:"flex-shrink-0 w-5 h-5 rounded-full bg-primary/10 text-primary text-xs font-bold flex items-center justify-center mt-0.5",children:a.step}),e.jsx("span",{children:a.action})]},a.step))})]}),e.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-lg p-3",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-green-700 mb-2",children:"Post-incident checklist"}),e.jsx("ul",{className:"space-y-1",children:t.postIncident.map((a,r)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm text-green-800",children:[e.jsx(R,{className:"h-3.5 w-3.5 text-green-600 mt-0.5 shrink-0"}),a]},r))})]})]})]})}function $(){const{toast:t}=N(),i=g(),{data:s,isLoading:a}=n({queryKey:["/api/admin/backup/status"],refetchInterval:3e4}),r=f({mutationFn:()=>b("POST","/api/admin/backup/run"),onSuccess:()=>{t({title:"Backup started",description:"pg_dump is running — refresh in a few seconds."}),setTimeout(()=>i.invalidateQueries({queryKey:["/api/admin/backup/status"]}),5e3)},onError:p=>{t({title:"Backup failed",description:p.message??"Unknown error",variant:"destructive"})}}),u=!s||s.status==="never"?"bg-gray-100 text-gray-700 border-gray-200":s.status==="success"?"bg-green-100 text-green-800 border-green-200":"bg-red-100 text-red-800 border-red-200";return e.jsxs(c,{children:[e.jsx(d,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{className:"h-5 w-5 text-muted-foreground"}),e.jsx(l,{className:"text-base",children:"Database Backup"})]}),e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>r.mutate(),disabled:r.isPending,children:[r.isPending?e.jsx(w,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):e.jsx(k,{className:"h-3.5 w-3.5 mr-1.5"}),"Run Backup Now"]})]})}),e.jsx(o,{children:a?e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading backup status…"}):!s||s.status==="never"?e.jsx("div",{className:"text-sm text-muted-foreground",children:"No backup has been run yet. The scheduler runs one daily at 02:00 UTC, or trigger one manually above."}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{variant:"outline",className:`${u} text-xs`,children:s.status.toUpperCase()}),s.triggeredBy&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["triggered by ",s.triggeredBy]})]}),s.status==="success"&&e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-0.5",children:"Completed"}),e.jsx("p",{className:"font-medium",children:s.completedAt?h(new Date(s.completedAt),{addSuffix:!0}):"—"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-0.5",children:"Size"}),e.jsx("p",{className:"font-medium",children:s.sizeKb!=null?`${s.sizeKb} KB`:"—"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-0.5",children:"File"}),e.jsx("p",{className:"font-mono text-xs truncate text-muted-foreground",children:s.filePath})]})]}),s.status==="failed"&&e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded p-2",children:[e.jsx("p",{className:"text-xs font-medium text-red-700 mb-0.5",children:"Error"}),e.jsx("p",{className:"text-xs text-red-600 font-mono",children:s.error})]}),e.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1 border-t pt-2 mt-1",children:[e.jsx(C,{className:"h-3 w-3"}),"Restore procedure: use"," ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"gunzip -c backup.sql.gz | psql $DATABASE_URL"})," ","on a fresh database instance."]})]})})]})}function te(){const{data:t,isLoading:i}=n({queryKey:["/api/admin/runbooks"]});return e.jsxs("div",{className:"container mx-auto py-6 max-w-4xl space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"On-Call Runbooks"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Step-by-step incident response guides for every P1/P2 scenario. Open a runbook and follow the steps in order."})]}),e.jsx($,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-base font-semibold",children:"Incident Runbooks"}),t&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",t.version," · last reviewed ",t.updatedAt]})]}),i?e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading runbooks…"}):t?.runbooks.map(s=>e.jsx(U,{runbook:s},s.id))]})]})}export{te as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.