PageSourceSearch

https://app.middleware.io/static/CGiQRimC.production.bundle.min.js

js middleware.io collected 2026-09-24 18:01:45 UTC 30,543 bytes, 1 lines download raw bytes

1import{r as o,j as e,D as $,v as T,b as oe,C as Me,M as Ie,a as Pe}from"./CgBZl8m0.production.bundle.min.js";import{aA as V,hS as $e,f1 as Be,hT as He,aB as fe,u as je,bc as ve,a as Fe,aI as We}from"./CY9JcdZ7.production.bundle.min.js";import{T as ze}from"./B_v3Fv2u.production.bundle.min.js";import{u as ne}from"./CUU-sqeu.production.bundle.min.js";import{c as Ke,d as Ue,e as Ve,f as Ye,h as Ge,j as qe,k as Xe,l as Ze,m as Qe,n as Je,o as es,p as ss,q as ts,r as as,s as ls,t as os,u as ns,v as rs,w as is,x as cs}from"./D4liyLd7.production.bundle.min.js";import{G as ds}from"./DYxQq3CM.production.bundle.min.js";import{P as K,D as J}from"./CHbJgqnE.production.bundle.min.js";import{b as ms,f as Y,c as re,d as us,g as Se,e as ps,h as hs,i as _s,u as xs,j as Q,S as he,k as gs,l as bs}from"./Bvm6xsqS.production.bundle.min.js";import{B}from"./B7jgtT_H.production.bundle.min.js";import{D as fs}from"./BaeVAzEX.production.bundle.min.js";import{a7 as js,a8 as se}from"./DpOFvyFl.production.bundle.min.js";import{c as ae,M as vs,Q as Ss,S as z,b as A,L as Ne}from"./uYRgXL5M.production.bundle.min.js";import{T as H}from"./BhEpiGZx.production.bundle.min.js";import{G as Ns}from"./PSw9bd14.production.bundle.min.js";import{u as R}from"./BWr4BVpJ.production.bundle.min.js";import{S as ee,A as te}from"./D4lvmK5r.production.bundle.min.js";import{I as ye,F as _e}from"./DuMSlPdM.production.bundle.min.js";import{P as ie,E as ce,D as we}from"./9zG8c1d8.production.bundle.min.js";import{M as ys}from"./_2CfvPZG.production.bundle.min.js";import{D as ws}from"./Czbq-YEj.production.bundle.min.js";import{M as Cs}from"./D_zu75wr.production.bundle.min.js";import{A as Ce}from"./CuBqghHU.production.bundle.min.js";import{S as Ts}from"./BZwPEnwo.production.bundle.min.js";import{T as Te,C as Ds}from"./CHbz8HD7.production.bundle.min.js";import{L as de}from"./CRSxynHN.production.bundle.min.js";import{f as De,s as Ls}from"./BeeWekk-.production.bundle.min.js";import{S as xe}from"./jZHkhCas.production.bundle.min.js";import{u as Es}from"./bQk04zL4.production.bundle.min.js";import{t as Os}from"./BFsIcxdk.production.bundle.min.js";import{A as ks}from"./DlG3g9Q4.production.bundle.min.js";import"./BTOj8ijf.production.bundle.min.js";import"./IimQW1M7.production.bundle.min.js";import"./CJLuAe4t.production.bundle.min.js";import"./Dsqj8S3w.production.bundle.min.js";import"./DhCfBX8j.production.bundle.min.js";import"./DohGM9_I.production.bundle.min.js";import"./Czj00ZrM.production.bundle.min.js";import"./vhNSgALD.production.bundle.min.js";import"./BpQvVIpM.production.bundle.min.js";import"./DvJkqRNe.production.bundle.min.js";import"./M_FBjfQJ.production.bundle.min.js";import"./BS0dGend.production.bundle.min.js";import"./DV0DPFOt.production.bundle.min.js";import"./BOFlCg2s.production.bundle.min.js";import"./BKtnA6hw.production.bundle.min.js";import"./URTTg1rg.production.bundle.min.js";import"./CK-5Vo_r.production.bundle.min.js";import"./CMxhj3GZ.production.bundle.min.js";import"./CIT-tl5U.production.bundle.min.js";import"./DnFKFUTo.production.bundle.min.js";import"./CrsULzDT.production.bundle.min.js";import"./C7aKDdDU.production.bundle.min.js";import"./_LyuCvYL.production.bundle.min.js";import"./DnQqxH0F.production.bundle.min.js";import"./DVYtYn_y.production.bundle.min.js";import"./v06WTCWU.production.bundle.min.js";import"./BAUftK01.production.bundle.min.js";const Rs=["breached","warning","ok","nodata"],As={breached:{error:!0},warning:{warning:!0},ok:{success:!0},nodata:{}},Ms=({counts:s,total:t,selected:l,onToggle:c,onClear:x})=>e.jsxs("div",{className:"slo-summary-cards",children:[Rs.map(d=>{const a=l.includes(d);return e.jsx("button",{type:"button",className:`slo-summary-cards__card ${l.length>0&&!a?"is-dimmed":""}`,"aria-pressed":a,onClick:()=>c(d),children:e.jsx(V,{title:ms[d],value:String(s[d]),...s[d]>0?As[d]:{}})},d)}),e.jsx("button",{type:"button",className:"slo-summary-cards__card","aria-pressed":l.length===0,onClick:x,children:e.jsx(V,{title:"Total",value:String(t)})})]}),Is=o.memo(Ms),me=24*60*60*1e3,Le=[{timeRangeOption:$.OneDay,label:"Past day",value:()=>[T().subtract(1,"day"),T()]},{timeRangeOption:$.ThreeDays,label:"Past 3 days",value:()=>[T().subtract(3,"day"),T()]},{timeRangeOption:$.OneWeek,label:"Past 7 days",value:()=>[T().subtract(7,"day"),T()]},{timeRangeOption:$.OneMonth,label:"Past 30 days",value:()=>[T().subtract(30,"day"),T()]},{timeRangeOption:$.NinetyDays,label:"Past 90 days",value:()=>[T().subtract(90,"day"),T()]},{timeRangeOption:$.Custom,label:"Custom"}],le={"7d":7,"30d":30,"90d":90},Ps=(s,t=Date.now())=>({fromTs:t-le[s]*me,toTs:t,range:s==="7d"?$.OneWeek:s==="30d"?$.OneMonth:$.NinetyDays}),$s=s=>{const t=Math.round((s.toTs-s.fromTs)/me);return Object.keys(le).find(c=>Math.abs(le[c]-t)<=1)??null},Bs=s=>{const t=Math.round((s.toTs-s.fromTs)/me),l=Le.find(d=>d.timeRangeOption===s.range&&s.range!==$.Custom);if(l)return l.label;const c=T(s.fromTs),x=T(s.toTs);return c.isSame(x,"day")?`${c.format("MMM D, HH:mm")} – ${x.format("HH:mm")}`:t<=3?`${c.format("MMM D, HH:mm")} – ${x.format("MMM D, HH:mm")}`:`${c.format("MMM D")} – ${x.format("MMM D")}`},ge=60,Hs=s=>{var v;const t=ne(),l=R(Ke),c=R(Ue),x=R(Ve),d=R(Ye),a=R(Ge),k=R(qe),O=R(Xe),D=R(Ze),g=R(Qe),y=R(Je),[M,f]=o.useState(null),[N,_]=o.useState([]),i=o.useCallback(E=>{_(w=>w.includes(E)?w.filter(C=>C!==E):[...w,E])},[]),L=o.useCallback(()=>_([]),[]),m=(l==null?void 0:l.id)===s?l:null,u=(m==null?void 0:m.thresholds[0])??null,
1j=(v=m==null?void 0:m.status)==null?void 0:v.computed_at,r=o.useMemo(()=>M??Ps((u==null?void 0:u.window)??"7d",j),[M,u==null?void 0:u.window,j]),n=o.useMemo(()=>{const E=$s(r);return(m==null?void 0:m.thresholds.find(w=>w.window===E))??u},[m,u,r]);return o.useEffect(()=>{f(null),_([]),s>0&&(t(es(s)),t(ss(s)))},[t,s]),o.useEffect(()=>{s>0&&m&&t(ts(s,{from:r.fromTs,to:r.toTs,buckets:ge}))},[t,s,m,r]),o.useEffect(()=>{s>0&&m&&N.length>0&&t(as(s,{from:r.fromTs,to:r.toTs,buckets:ge,rule_ids:N}))},[t,s,m,r,N]),{slo:m,status:d,corrections:m?O:[],range:r,setRange:f,threshold:n,selectedRuleIds:N,toggleRule:i,clearSelection:L,focusStatus:N.length>0?g:null,isFocusLoading:y,isLoading:c,isStatusLoading:a,statusError:k,isCorrectionsLoading:D,error:x}},Fs=({slo:s,window:t,canCreate:l})=>{const c=oe(),x=s.alert_rules??[],d=()=>{const a=$e({meta:{slo_id:s.id,mode:"error_budget",window:t},name:`${s.name} budget`});c({pathname:"/alerts/new-rule/slo/step-1",search:`?${Be}=${encodeURIComponent(a)}`})};return e.jsxs("div",{className:"slo-panel__alerts",children:[e.jsxs("div",{className:"slo-panel__section-head",children:[e.jsxs("span",{className:"slo-panel__section-note",children:[e.jsxs("span",{className:"slo-panel__section-title",children:["Alerts",e.jsx(H,{content:"Monitors that notify you when your error budget or burn rate crosses a threshold.",children:e.jsx("span",{className:"slo-panel__info-icon",children:e.jsx(ye,{})})})]}),x.length?`This SLO has ${x.length} alert rule${x.length===1?"":"s"}.`:"This SLO has no alert rules yet."]}),e.jsx(B,{primary:!0,size:ee.Small,disabled:!l,prefixicon:e.jsx(ie,{color:"var(--color-white)"}),onClick:d,children:"Add SLO alert"})]}),x.map(a=>e.jsxs("div",{className:"slo-panel__card slo-panel__alert-row",children:[e.jsx("span",{className:"slo-panel__alert-name",children:a.name}),e.jsxs("div",{className:"slo-panel__alert-actions",children:[e.jsx(B,{secondary:!0,size:ee.Small,onClick:()=>c(`/alerts/rules?ruleid=${a.id}`),children:"Triggered alerts"}),e.jsx(H,{content:"Edit alert rule",children:e.jsx("div",{children:e.jsx(B,{outlined:!0,className:"slo-panel__icon-btn",prefixicon:e.jsx(ce,{}),onClick:()=>c(`/alerts/edit-rule/${a.id}/slo/step-1`)})})})]})]},a.id))]})},Ws=["One-time","Daily","Weekly","Monthly"],zs={"One-time":void 0,Daily:"daily",Weekly:"weekly",Monthly:"monthly"},Ee=s=>{var t;if(!s)return"";try{return((t=new Intl.DateTimeFormat(void 0,{timeZone:s,timeZoneName:"long"}).formatToParts(new Date).find(l=>l.type==="timeZoneName"))==null?void 0:t.value)??s}catch{return s}},Ks=s=>{const t=T(s.start_at).format("MMM D, YYYY HH:mm"),l=Math.round(s.duration_secs/60),c=Ee(s.timezone),x=s.repeat?` · every ${s.interval&&s.interval>1?`${s.interval} `:""}${s.repeat==="daily"?"day":s.repeat==="weekly"?"week":"month"}${c?` (${c})`:""}`:"";return`${t} for ${l} minute${l===1?"":"s"}${x}`},Us=({corrections:s,isLoading:t,canEdit:l,onAdd:c,onRemove:x})=>{const[d,a]=o.useState(!1),[k,O]=o.useState(T()),[D,g]=o.useState(T().format("HH:mm")),[y,M]=o.useState("60"),[f,N]=o.useState(""),[_,i]=o.useState("One-time"),[L,m]=o.useState(!1),u=Intl.DateTimeFormat().resolvedOptions().timeZone,j=Ee(u),r=async()=>{const[n,v]=D.split(":").map(Number),E=k.hour(n||0).minute(v||0).second(0).millisecond(0);m(!0);const w=await c({start_at:E.valueOf(),duration_secs:Math.max(1,Math.round(Number(y)||0)*60),description:f,repeat:zs[_],timezone:u});m(!1),w&&(a(!1),N(""))};return e.jsxs("div",{className:"slo-panel__corrections",children:[e.jsxs("div",{className:"slo-panel__section-head",children:[e.jsxs("span",{className:"slo-panel__section-note",children:[e.jsxs("span",{className:"slo-panel__section-title",children:["Corrections",e.jsx(H,{content:"Time you've chosen to exclude from the calculation, such as planned maintenance.",children:e.jsx("span",{className:"slo-panel__info-icon",children:e.jsx(ye,{})})})]}),"Corrections exclude known incidents or maintenance from the SLO calculation."]}),e.jsx(B,{primary:!0,size:ee.Small,disabled:!l,prefixicon:d?void 0:e.jsx(ie,{color:"var(--color-white)"}),onClick:()=>a(n=>!n),children:d?"Cancel":"Add correction"})]}),d&&e.jsxs("div",{className:"slo-panel__card slo-panel__correction-form",children:[e.jsxs("div",{className:"slo-panel__form-row",children:[e.jsx("span",{children:"Start"}),e.jsx(ys,{value:k,onChange:O,timeZone:u}),e.jsx("span",{children:"at"}),e.jsx(Cs,{defaultValue:D,onChange:(n,v)=>g(v)})]}),e.jsxs("div",{className:"slo-panel__form-row",children:[e.jsx("span",{children:"Duration"}),e.jsx("div",{className:"slo-panel__form-input",children:e.jsx(_e,{id:"slo-correction-minutes",type:"number",value:y,onChange:M})}),e.jsx("span",{children:"minutes, repeating"}),e.jsx("div",{className:"slo-panel__form-input slo-panel__form-input--wide",children:e.jsx(ws,{options:[...Ws],showSearch:!1,selectedValues:[_],onChange:n=>i(Array.isArray(n)?n[0]:n)})})]}),e.jsxs("div",{className:"slo-panel__form-row",children:[e.jsx("div",{className:"slo-panel__form-input slo-panel__form-input--full",children:e.jsx(_e,{id:"slo-correction-description",placeholder:"Description (optional)",value:f,onChange:N})}),e.jsx(B,{primary:!0,size:ee.Small,loading:L,disabled:L,onClick:()=>void r(),children:"Save"})]}),e.jsxs("div",{className:"slo-panel__muted",children:["Times are shown in your local time zone (",j,")."]})]}),s.length===0&&!t&&e.jsx("div",{className:"slo-panel__muted",children:"No corrections yet."}),s.map(n=>e.jsxs("div",{className:"slo-panel__card slo-panel__alert-row",children:[e.jsxs("div",{className:"slo-panel__alert-text",children:[e.jsx("div",{className:"slo-panel__alert-name",children:Ks(n)}),n.description&&e.jsx("div",{className:"slo-panel__alert-desc",children:n.description})]}),e.jsx(B,{className:"slo-panel__row-delete",disabled:!l,prefixicon:e.jsx(we,{c
1olor:"var(--color-error)"}),onClick:()=>x(n.id)})]},n.id))]})},Oe=o.memo(({series:s})=>{const t=o.useMemo(()=>Ls(s),[s]);return e.jsx("div",{className:"slo-panel__bar",children:t.map((l,c)=>e.jsx("span",{className:`slo-panel__bar-segment is-${l.state}`,style:{width:`${l.widthPercent}%`}},`${l.state}-${c}`))})});Oe.displayName="UptimeBar";const Vs={value:0,label:"out of budget"},Ys={value:1,label:"1x"},Gs=({ruleId:s})=>e.jsx(de,{className:"slo-panel__row-link",to:`/alerts/rules?ruleid=${s}`,target:"_blank",rel:"noopener noreferrer",title:"Open alert in a new tab",onClick:t=>t.stopPropagation(),children:e.jsx(Ne,{size:14})}),qs=({from:s,to:t})=>e.jsx("div",{className:"slo-panel__axis",children:us(s,t).map(l=>e.jsx("span",{className:"slo-panel__axis-tick",style:{left:`${l.pct}%`},children:l.label},l.pct))}),Xs=74,ke=109,Zs=9,Qs=({row:s})=>e.jsxs("div",{className:"slo-panel__alert-cell",children:[s.isOverall&&e.jsx(H,{content:"The combined status across all monitors in this SLO.",children:e.jsx("span",{className:"slo-panel__overall-badge",children:"OVERALL"})}),e.jsxs("div",{className:"slo-panel__alert-line",children:[e.jsxs("div",{className:"slo-panel__row-name",children:[e.jsx("span",{title:s.label,children:s.label}),s.series.deleted?e.jsx(z,{labelText:"deleted",type:A.Default}):!s.isOverall&&e.jsx(Gs,{ruleId:s.series.rule_id})]}),e.jsxs("div",{className:"slo-panel__bar-cell",children:[e.jsx(Oe,{series:s.series}),s.axis&&e.jsx(qs,{from:s.axis.from,to:s.axis.to})]})]})]}),Js=({row:s})=>{const{summary:t}=s.series;return t.uptime===null?e.jsx(z,{labelText:"NO DATA",type:A.Default}):e.jsx("span",{className:t.uptime<t.target?"slo-panel__negative":"",children:Y(t.uptime)})},Re=s=>[{columnKey:"label",title:"Alert",width:480,disableResize:!0,render:(t,l)=>e.jsx(Qs,{row:l})},{columnKey:"status",title:"Status",tooltipInfo:"The level of service you're currently providing to your users.",width:Xs,disableAutoGrow:!0,disableResize:!0,render:(t,l)=>e.jsx(Js,{row:l})},{columnKey:"budget",title:"Error Budget",tooltipInfo:"The amount of unreliability you can afford before user happiness is impacted.",width:s,disableAutoGrow:!0,disableResize:!0,render:(t,l)=>De(l.series.summary.budget_left_secs)}],et=Re(ke),st=()=>Re(Math.max(ke-Zs-vs(),48)),tt=[Ss(0)],at=({slo:s,status:t,target:l,creatorName:c,isStatusLoading:x,statusError:d,selectedRuleIds:a,onToggleRule:k,onClearSelection:O,focusStatus:D})=>{var W,b;const g=o.useCallback(h=>h===0?O():k(h),[O,k]),[y,M]=o.useState(null),[f,N]=o.useState(""),_=a.length>0,i=o.useMemo(()=>{if(!t)return;const h=t.rules.find(p=>p.rule_id===y);return h||(_?(D==null?void 0:D.overall)??void 0:t.overall)},[t,y,_,D]),L=i&&i.rule_id!==0?i.name:_&&y===null?`${a.length} pinned alert${a.length===1?"":"s"}`:"",m=o.useMemo(()=>{const h=f.trim().toLowerCase();return t?h?t.rules.filter(p=>(p.name||"").toLowerCase().includes(h)):t.rules:[]},[t,f]),u=i==null?void 0:i.summary,j=(u==null?void 0:u.uptime)??null,r=j!==null&&j<l,n=(u==null?void 0:u.budget_left_pct)??null,v=x&&!u,E=o.useMemo(()=>t?[{series:t.overall,label:`${t.rules.length} alert${t.rules.length===1?"":"s"} aggregated`,isOverall:!0,metric:"0",axis:{from:t.from,to:t.to}}]:[],[t]),w=o.useMemo(()=>m.map(h=>({series:h,label:h.name||`Deleted monitor #${h.rule_id}`,isOverall:!1,metric:String(h.rule_id)})),[m]),C=o.useMemo(st,[]),F=o.useCallback((h,p)=>M(p&&h!=="0"?Number(h):null),[]),P=o.useCallback(h=>{const p=h.series.rule_id;return[y===p&&"is-focused",a.includes(p)&&"is-selected"].filter(Boolean).join(" ")},[y,a]);return e.jsxs("div",{className:"slo-panel__overview",children:[e.jsx("div",{className:"slo-panel__info",children:e.jsxs(V,{title:"Information",info:"Details of this SLO",placeInfoIconOnLeft:!0,children:[e.jsxs("div",{className:"slo-panel__info-grid",children:[e.jsxs("div",{className:"slo-panel__field",children:[e.jsx("div",{className:"slo-panel__field-label",children:"Creator"}),e.jsxs("div",{className:"slo-panel__creator slo-panel__value",children:[e.jsx(Ce,{size:20,seed:c}),c]})]}),e.jsxs("div",{className:"slo-panel__field",children:[e.jsx("div",{className:"slo-panel__field-label",children:"Tags"}),e.jsx("div",{className:"slo-panel__tags",children:(W=s.tags)!=null&&W.length?s.tags.map(h=>e.jsx("span",{className:"slo-panel__tag",children:h},h)):e.jsx("span",{className:"slo-panel__value",children:"None"})})]}),e.jsxs("div",{className:"slo-panel__field slo-panel__field--end",children:[e.jsx("div",{className:"slo-panel__field-label",children:"Created on"}),e.jsx("div",{className:"slo-panel__value",children:T(s.created_at).format("MMM D, YYYY, h:mm a")})]}),e.jsxs("div",{className:"slo-panel__field",children:[e.jsx(H,{content:"Monitors that notify you when your error budget or burn rate crosses a threshold.",children:e.jsx("div",{className:"slo-panel__field-label",children:"Alerts"})}),e.jsx("div",{className:"slo-panel__value",children:(b=s.alert_rules)!=null&&b.length?e.jsx("div",{className:"slo-panel__rule-links",children:s.alert_rules.map(h=>e.jsx(de,{className:"slo-panel__alert-link",to:`/alerts/rules?ruleid=${h.id}`,target:"_blank",rel:"noopener noreferrer",children:h.name},h.id))}):"None"})]})]}),s.description&&e.jsx("div",{className:"slo-panel__description",children:s.description})]})}),d&&e.jsx("div",{className:"slo-panel__muted slo-panel__negative",children:d}),e.jsxs("div",{className:"slo-panel__tiles",children:[e.jsx("div",{className:"slo-panel__tile",children:e.jsx(V,{title:"Status",placeInfoIconOnLeft:!0,info:"The level of service you're currently providing to your users.",value:v?"…":j===null?"No data":Y(j),error:j!==null&&r,success:j!==null&&!r,children:e.jsx("span",{className:"slo-panel__tile-sub",children:e.jsx(He,{text:L?`${L} · Target ${l}%`:`Target ${l}%`,className:"slo-panel__tile-sub-text",mode:"multi-line"})})})}),e.jsx("div",{className:"slo-panel__tile",children:e.jsxs(V,{title:"Error budget left",placeInfoIconOnLeft:!0,info:"How much of that unreliability you still have to spend in this window.",value:v?"…":re(n),error:n!==null&&n<0,children:[u&&e.jsxs("span",{className:`slo-panel__budget-pill ${n!==null&&n<0?"is-negative":""}`,children:["(",De(u.budget_left_secs),")"]}),n!==null&&e.jsx("div",{className:"slo-panel__tile-progress",children:e.jsx(fe,{value:n<0?100:Math.min(100,n),maxValue:100,color:n<0?"error":"success"})})]})})]}),e.jsxs("div",{className:"slo-panel__charts",children:[e.jsx(xe,{title:"Error budget burndown",info:"How your error budget was spent over time, and when it ran out.",buckets:(i==null?void 0:i.buckets)??[],metric:"budget_left_pct",color:"var(--color-primary)",referenceLine:Vs,unit:"%"}),e.jsx(xe,{title:"Burn rate",info:"How fast you're spending your error budget compared to the pace your target allows.",buckets:(i==null?void 0:i.buckets)??[],metric:"burn_rate",color:"var(--color-warning)",referenceLine:Ys,unit:"number"})]}),t&&e.jsx("div",{className:"slo-panel__alerts-table",children:e.jsx(Te,{titleChild:e.jsx(e.Fragment,{}),actionElements:e.jsx(Ts,{placeholder:"Search with alert name",width:260,value:f,onChange:N}),children:e.jsx(ae,{columns:et,dataProvider:E,loading:!1,uniqId:"slo-panel-alerts-v2",rowClassName:"slo-panel__overall-row",rowOnClick:()=>g(0),onRowHover:F,expandable:{showExpandColumn:!1,expandedRowKeys:tt,rowExpandable:()=>!0,expandedRowRender:()=>e.jsx("div",{className:"slo-panel__alerts-nested",children:e.jsx(ae,{columns:C,dataProvider:w,loading:!1,uniqId:"slo-panel-alerts-nested-v1",rowClassName:P,rowOnClick:h=>g(h.series.rule_id),onRowHover:F,noDataLabel:`No alerts match “${f}”.`})})}})})})]})},lt={"7d":"7 days","30d":"30 days","90d":"90 days"},X=({label:s,tooltip:t})=>e.jsx(H,{content:t,children:e.jsx("span",{className:"slo-panel__label",children:s})}),ot=({id:s,onClose:t})=>{var n,v,E,w;const l=ne(),c=oe(),x=je(),d=R(ve),a=Hs(s),[k,O]=o.useState(0),[D,g]=o.useState(!1),y=x(K.EditRules),M=x(K.CreateAlerts),f=C=>{g(!1),a.setRange(C)},N=o.useMemo(()=>
1{if(!a.slo)return"";if(a.slo.created_by===0)return"System";const C=Object.values(d??{}).find(F=>{var P;return F.Id===((P=a.slo)==null?void 0:P.created_by)});return(C==null?void 0:C.Name)??`User ${a.slo.created_by}`},[d,a.slo]),_=(n=a.slo)==null?void 0:n.thresholds[0],i=(v=a.slo)==null?void 0:v.status,L=(_==null?void 0:_.target)??0,m=Se(i==null?void 0:i.uptime,L,_==null?void 0:_.warning),u=(_==null?void 0:_.window)??"7d",j=C=>l(os(s,C)),r=C=>{l(ls(s,C))};return e.jsx(Ns,{isOpen:!0,size:"md",title:((E=a.slo)==null?void 0:E.name)??"SLO",onClose:t,onBackBtnClick:t,datePicker:!1,bodyPadding:!1,dialogContentClassName:"slo-panel-dialog",rightAlignedHeaderElements:a.slo&&e.jsxs("div",{className:"slo-panel__header-actions",children:[e.jsx(H,{content:y?"Edit SLO":J,children:e.jsx("div",{children:e.jsx(B,{className:"slo-panel__icon-btn",disabled:!y,prefixicon:e.jsx(ce,{}),onClick:()=>c(`/alerts/slos/edit/${s}`)})})}),e.jsx(fs,{isDatePickerVisible:D,handleDatePickerVisibility:g,datePickerBtnText:Bs(a.range),onChange:f,defaultValue:a.range,presetOptions:Le,disableFutureDates:!0,maxDaysSelection:0,dataTestId:"slo-panel-datepicker"})]}),children:e.jsxs("div",{className:"slo-panel",children:[a.isLoading&&!a.slo&&e.jsx(Me,{}),a.error&&!a.slo&&e.jsx("div",{className:"slo-panel__muted slo-panel__pad",children:a.error}),a.slo&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"slo-panel__strip",children:[e.jsxs("div",{className:"slo-panel__strip-item",children:[e.jsx(X,{label:"Time",tooltip:"The rolling period your status is measured over."}),e.jsx("span",{children:lt[u]})]}),e.jsxs("div",{className:"slo-panel__strip-item",children:[e.jsx(X,{label:"Target",tooltip:"The level of service you've committed to providing over the time window."}),e.jsxs("span",{children:[L,"%"]})]}),e.jsxs("div",{className:"slo-panel__strip-item",children:[e.jsx(X,{label:"Status",tooltip:"The level of service you're currently providing to your users."}),e.jsx(z,{labelText:m==="nodata"?"NO DATA":Y(i==null?void 0:i.uptime),type:m==="breached"?A.Error:m==="warning"?A.Warning:m==="ok"?A.Success:A.Default})]}),e.jsxs("div",{className:"slo-panel__strip-item",children:[e.jsx(X,{label:"Error budget",tooltip:"The amount of unreliability you can afford before user happiness is impacted."}),e.jsx("span",{className:((i==null?void 0:i.budget_left_pct)??0)<0?"slo-panel__negative":"",children:re(i==null?void 0:i.budget_left_pct)})]})]}),e.jsxs(js,{classname:"slo-panel__tabs",targetIndex:k,onTabChange:O,showBorderBottom:!0,children:[e.jsx(se,{title:"Overview",children:e.jsx("div",{className:"slo-panel__body",children:e.jsx(at,{slo:a.slo,status:a.status,target:L,creatorName:N,isStatusLoading:a.isStatusLoading,statusError:a.statusError,selectedRuleIds:a.selectedRuleIds,onToggleRule:a.toggleRule,onClearSelection:a.clearSelection,focusStatus:a.focusStatus})})}),e.jsx(se,{title:"Alerts",children:e.jsx("div",{className:"slo-panel__body",children:e.jsx(Fs,{slo:a.slo,window:((w=a.threshold)==null?void 0:w.window)??u,canCreate:M})})}),e.jsx(se,{title:"Corrections",children:e.jsx("div",{className:"slo-panel__body",children:e.jsx(Us,{corrections:a.corrections,isLoading:a.isCorrectionsLoading,canEdit:y,onAdd:j,onRemove:r})})})]})]})]})})},nt="https://docs.middleware.io/workflow/alerting/slo/monitor-based",Ae={breached:A.Error,warning:A.Warning,ok:A.Success,nodata:A.Default},be=3,U=4,rt=106,it=52,ct=s=>{if(!s.length)return e.jsx("span",{className:"slo-table__muted",children:"—"});const t=s.slice(be);return e.jsxs("div",{className:"slo-table__tags",children:[s.slice(0,be).map(l=>e.jsx(z,{labelText:l,type:A.Secondary},l)),t.length>0&&e.jsx(H,{content:t.join(", "),position:"bottom",children:e.jsxs("span",{className:"slo-table__more",children:["+",t.length," more"]})})]})},dt=({bucket:s,row:t})=>{const l=t.thresholds[0],c=s&&l?Se(s.uptime,l.target,l.warning):"nodata";return e.jsx(z,{labelText:c==="nodata"?"NO DATA":Y(s==null?void 0:s.uptime),type:Ae[c]})},Z=({onClick:s,disabled:t,double:l,direction:c})=>{const x=c==="left"?Os:ks;return e.jsx(B,{className:"slo-table__pager-btn",background:!1,borderless:!0,shouldStopPropagation:!0,disabled:t,prefixicon:e.jsxs("span",{className:`slo-table__pager-icon ${l?"is-double":""}`,children:[e.jsx(x,{size:12}),l&&e.jsx(x,{size:12})]}),onClick:s})},mt={columnKey:"thresholds",title:"Time",width:80,render:s=>{var t;return e.jsx(z,{labelText:((t=s[0])==null?void 0:t.window)??"—",type:A.Secondary})}},ut=[{label:"Type",value:"type"},{label:"Time",value:"thresholds"},{label:"Target",value:"target"},{label:"Status",value:"statusKey"},{label:"Error budget left",value:"status"},{label:"Tags",value:"tags"},{label:"Created By",value:"created_by",defaultSelected:!1},{label:"Created At",value:"created_at",defaultSelected:!1}],pt=s=>{const{rows:t,totalRows:l,page:c,onPageChange:x,view:d,calendar:a,isLoading:k,canEdit:O,canDelete:D,onEdit:g,onDelete:y,onRowClick:M,titleChild:f}=s,N=Es("slo-table",ut),_=R(ve),i=o.useMemo(()=>Object.values(_??{}).reduce((r,n)=>(r[String(n.Id)]=n.Name,r),{}),[_]),[L,m]=o.useState(0);o.useEffect(()=>{m(0)},[d]);const u=o.useMemo(()=>
1{if(d==="primary")return[];const r=t.map(n=>a[n.id]).find(n=>{var v;return(v=n==null?void 0:n.buckets)==null?void 0:v.length});return(r==null?void 0:r.buckets)??[]},[t,a,d]),j=o.useMemo(()=>{const r=[{columnKey:"name",title:"Name",width:260},{columnKey:"type",title:"Type",width:90,render:p=>e.jsx(z,{labelText:ps[p],type:A.Info})},...d==="primary"?[mt]:[],{columnKey:"target",title:"Target",width:90,align:te.Right,render:(p,S)=>{var I;return`${((I=S.thresholds[0])==null?void 0:I.target)??"—"}%`}}],n=[{columnKey:"statusKey",title:"Status",tooltipInfo:"The level of service you're currently providing to your users",width:110,align:te.Center,render:(p,S)=>{var q;const I=S,G=p;return e.jsx(z,{labelText:G==="nodata"?"NO DATA":Y((q=I.status)==null?void 0:q.uptime),type:Ae[G]})}},{columnKey:"status",title:"Error budget left",tooltipInfo:"How much of that unreliability you still have to spend in this window",width:180,render:p=>{const S=p==null?void 0:p.budget_left_pct;return S==null?e.jsx("span",{className:"slo-table__muted",children:"—"}):e.jsxs("div",{className:`slo-table__budget ${S<0?"is-overspent":""}`,children:[e.jsx("span",{children:re(S)}),e.jsx(fe,{value:Math.max(0,Math.min(100,S)),maxValue:100,color:S<0?"error":"success"})]})}}],v=u.length,E=Math.max(0,v-L),w=Math.max(0,E-U),C=w>0,F=L>0,P=p=>m(S=>Math.max(0,Math.min(Math.max(0,v-U),S+p))),W=u.slice(w,E),b=W.length?[{columnKey:"periods",title:"Periods",titleNode:e.jsxs("div",{className:"slo-table__periods is-head",children:[e.jsxs("span",{className:"slo-table__periods-nav",children:[e.jsx(Z,{direction:"left",double:!0,disabled:!C,onClick:()=>P(U)}),e.jsx(Z,{direction:"left",disabled:!C,onClick:()=>P(1)})]}),W.map((p,S)=>{const I=w+S;return e.jsx("span",{className:"slo-table__period",children:hs(p,d,I===v-1)},p.from)}),e.jsxs("span",{className:"slo-table__periods-nav",children:[e.jsx(Z,{direction:"right",disabled:!F,onClick:()=>P(-1)}),e.jsx(Z,{direction:"right",double:!0,disabled:!F,onClick:()=>P(-U)})]})]}),width:it*2+rt*U,align:te.Center,disableResize:!0,disableAutoGrow:!0,clickActionDisabled:!0,render:(p,S)=>{const I=S;return e.jsxs("div",{className:"slo-table__periods",children:[e.jsx("span",{className:"slo-table__periods-nav"}),W.map((G,q)=>{var ue,pe;return e.jsx("span",{className:"slo-table__period",children:e.jsx(dt,{row:I,bucket:(pe=(ue=a[I.id])==null?void 0:ue.buckets)==null?void 0:pe[w+q]})},G.from)}),e.jsx("span",{className:"slo-table__periods-nav"})]})}}]:[],h=[{columnKey:"tags",title:"Tags",width:220,render:p=>ct(p??[])},{columnKey:"created_by",title:"Created By",width:180,render:p=>{const S=i[String(p)];return e.jsxs("div",{className:"slo-table__creator",children:[e.jsx(Ce,{size:20,seed:S??""}),S||(Number(p)===0?"System":`User ${String(p)}`)]})}},{columnKey:"created_at",title:"Created At",width:140,render:p=>T(String(p)).isValid()?T(String(p)).format("MMM DD YYYY"):"-"},{columnKey:"id",title:"Actions",width:90,fixed:"right",clickActionDisabled:!0,render:(p,S)=>{const I=S;return e.jsxs("div",{className:"slo-table__actions",children:[e.jsx(H,{content:!O&&J,children:e.jsx("div",{children:e.jsx(B,{className:"slo-table__action",disabled:!O,shouldStopPropagation:!0,prefixicon:e.jsx(ce,{}),onClick:()=>g(I)})})}),e.jsx(H,{content:!D&&J,children:e.jsx("div",{children:e.jsx(B,{className:"slo-table__action is-delete",disabled:!D,shouldStopPropagation:!0,prefixicon:e.jsx(we,{color:"var(--color-error)"}),onClick:()=>y(I)})})})]})}}];return[...r,...d==="primary"?n:b,...h]},[d,u,a,O,D,g,y,L,i]);return e.jsx(Te,{titleChild:f,actionElements:e.jsxs(e.Fragment,{children:[e.jsxs(de,{className:"slo-table__docs-link",to:nt,target:"_blank",rel:"noopener noreferrer",children:["Docs",e.jsx(Ne,{size:18})]}),e.jsx("div",{className:"table-customize-columns-action",children:e.jsx(Ds,{filterOptions:N.available,handleApplyFilter:N.onChange,onDefaultLabelClick:N.reset})})]}),children:e.jsx(ae,{columns:N.filterColumns(j),dataProvider:t,loading:k,uniqId:`slo-table-${d}-v2`,rowOnClick:r=>M(r),maxHeight:"calc(100vh - 330px)",pagination:{totalRecords:l,page:c,recordsPerPage:_s,onChange:x,recordsLabel:"SLOs"}})})},ht=o.memo(pt),_t=Q.map((s,t)=>({label:s.label,value:t})),fa=()=>{var W;const s=oe(),t=ne(),l=je(),c=o.useContext(Ie),x=Pe(),d=Number(x.get("slo_id"))||0,a=l(K.CreateAlerts),k=l(K.EditRules),O=l(K.DeleteRules),D=a||k||O||l(K.ViewAlertHistory),g=xs(),y=R(ns),M=R(rs),[f,N]=o.useState("primary"),[_,i]=o.useState(null),L=o.useMemo(()=>e.jsx(ze,{tabs:_t,selectedTab:Q.findIndex(b=>b.value===f),onTabChange:b=>N(Q[b.value].value)}),[f,N]),m=o.useMemo(()=>g.pageRows.map(b=>b.id),[g.pageRows]),u=(W=Q.find(b=>b.value===f))==null?void 0:W.bucket;if(o.useEffect(()=>{!u||m.length===0||t(is({ids:m,bucket:u,...bs(f)}))},[t,u,f,m]),!D)return e.jsx(Fe,{});const j=g.filters.status??[],r=c.params.query,n=o.useCallback(b=>{b.length?r.set(he.status,b.join(",")):r.delete(he.status),r.set("page","1"),r.redirect()},[r]),v=o.useCallback(b=>n(j.includes(b)?j.filter(h=>h!==b):[...j,b]),[n,j]),E=o.useCallback(()=>n([]),[n]),w=o.useCallback(b=>{r.set("slo_id",String(b.id)),r.redirect()},[r]),C=o.useCallback(()=>{r.delete("slo_id"),r.redirect()},[r]),F=o.useCallback(b=>s(`/alerts/slos/edit/${b.id}`),[s]),P=()=>{_&&(t(cs(_.id)),i(null))};return e.jsxs("div",{className:"slo-list-v2",children:[e.jsx("div",{className:"slo-list-v2__search",children:e.jsx(ds,{caller:gs,placeholder:"Search by SLO name or tag",extraBtnPrefixIcon:e.jsx(ie,{c
1olor:"var(--color-primary)"}),extraBtnDisabled:!a,extraBtnTooltip:a?void 0:J,onExtraBtnClick:()=>a&&s("/alerts/slos/create"),extraBtnLabel:"New SLO"})}),e.jsx(Is,{counts:g.stateCounts,total:g.totalRows,selected:j,onToggle:v,onClear:E}),e.jsx("div",{className:"slo-list-v2__table",children:e.jsx(ht,{titleChild:L,rows:g.pageRows,totalRows:g.totalRows,page:g.page,onPageChange:g.setPage,view:f,calendar:y.byId,isLoading:g.isLoading||f!=="primary"&&M,canEdit:k,canDelete:O,onEdit:F,onDelete:i,onRowClick:w})}),d>0&&e.jsx(ot,{id:d,onClose:C}),e.jsx(We,{isOpen:_!==null,title:"Delete SLO",description:`Delete "${(_==null?void 0:_.name)??""}"? Its history is kept, but alert rules on it must be removed first.`,confirmBtnText:"Delete",handleConfirmEvent:P,handleCancelEvent:()=>i(null),onClose:()=>i(null)})]})};export{fa 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.