"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[6503],{18629:(x,p,e)=>{e.d(p,{C0:()=>C,Uv:()=>g,Xq:()=>v});var t=e(27702),s=e(63439),M=e(25357),g=(o=>(o.ContactPoint="contact point",o.Template="template",o.MuteTiming="mute timing",o.AlertRule="alert rule",o.RootNotificationPolicy="root notification policy",o))(g||{});const v=({resource:o})=>t.createElement(s.b,{title:`This ${o} cannot be edited through the UI`,severity:"info"},"This ",o," has been provisioned, that means it was created by config. Please contact your server admin to update this ",o,"."),C=()=>t.createElement(M.C,{text:"Provisioned",color:"purple"})},26503:(x,p,e)=>{e.r(p),e.d(p,{default:()=>Z});var t=e(27702),s=e(23852),M=e(52419),g=e(66670),v=e(73453),C=e(63439),o=e(15372),h=e(54281),D=e(4432),f=e(21323),O=e(18447),T=e(76404),A=e(26473);function a(n){const{chrome:l}=(0,A.p)();(0,t.useLayoutEffect)(()=>{n?.name&&l.update({pageNav:{text:n.name}})},[l,n]),n&&(document.title=`${n.name} - Alerting - ${T.c.AppTitle}`)}var r=e(19552),i=e(96437),c=e(22446),u=e(42844),R=e(66310),E=e(80011);const y=n=>{const l=(0,R.wW)(P=>m(P,n));return t.createElement(E.u,{content:String(n.state),placement:"top"},t.createElement("div",{className:l.dot}))},m=(n,l)=>{const P=n.spacing(1.25);return{dot:(0,u.css)`
      width: ${P};
      height: ${P};

      border-radius: 100%;

      background-color: ${n.colors.secondary.main};
      outline: solid calc(${P} / 2.5) ${n.colors.secondary.transparent};

      ${l.state===O.bj.Normal&&(0,u.css)`
        background-color: ${n.colors.success.main};
        outline-color: ${n.colors.success.transparent};
      `}

      ${l.state===O.bj.Pending&&(0,u.css)`
        background-color: ${n.colors.warning.main};
        outline-color: ${n.colors.warning.transparent};
      `}

      ${l.state===O.bj.Alerting&&(0,u.css)`
        background-color: ${n.colors.error.main};
        outline-color: ${n.colors.error.transparent};
      `}
    `}};var B=e(18629),W=e(67045);const F=()=>t.createElement(t.Fragment,null,"History"),H=()=>t.createElement(t.Fragment,null,"Instances"),b=()=>t.createElement(t.Fragment,null,"Query results"),z=()=>t.createElement(t.Fragment,null,"Routing");var J=(n=>(n[n.Instances=0]="Instances",n[n.Query=1]="Query",n[n.Routing=2]="Routing",n[n.History=3]="History",n))(J||{});const Q=({match:n})=>{const{id:l}=n.params,P=i.OA(l,!0),[I,K]=(0,t.useState)(0),{loading:G,error:L,result:d}=(0,r.H)(P,P?.ruleSourceName);if(a(d),G)return t.createElement(M.u,{text:"Loading..."});if(L)return String(L);if(d){const $=d.annotations.summary,U=d.promRule,S=(0,c.x_)(U)?U.alerts?.length:void 0,Y=(0,c.Jq)(d.group),N=(0,c.Pc)(d.rulerRule)&&!!d.rulerRule.grafana_alert.provenance;return t.createElement(t.Fragment,null,t.createElement(s.K,{direction:"column",gap:3},t.createElement(s.K,null,t.createElement(j,{folder:d.namespace.name,evaluationGroup:d.group.name}),t.createElement(W.L,null),t.createElement(s.K,{gap:1},t.createElement(g.zx,{variant:"secondary",icon:"pen"},"Edit"),t.createElement(g.zx,{variant:"secondary"},t.createElement(s.K,{alignItems:"center",gap:1},"More ",t.createElement(v.J,{name:"angle-down"}))))),t.createElement(s.K,{direction:"column",gap:1},t.createElement(s.K,{alignItems:"center"},t.createElement(V,{name:d.name,state:O.bj.Alerting})),$&&t.createElement(X,{text:$})),Y&&t.createElement(C.b,{severity:"info",title:"This rule is part of a federated rule group."},t.createElement(s.K,{direction:"column"},"Federated rule groups are currently an experimental feature.",t.createElement(g.zx,{fill:"text",icon:"book"},t.createElement("a",{href:"https://grafana.com/docs/metrics-enterprise/latest/tenant-management/tenant-federation/#cross-tenant-alerting-and-recording-rule-federation"},"Read documentation")))),N&&t.createElement(B.Xq,{resource:B.Uv.AlertRule}),t.createElement(o.J,null,t.createElement(h.O,{label:"Instances",active:!0,counter:S,onChangeTab:()=>K(0)}),t.createElement(h.O,{label:"Query",onChangeTab:()=>K(1)}),t.createElement(h.O,{label:"Routing",onChangeTab:()=>K(2)}),t.createElement(h.O,{label:"History",onChangeTab:()=>K(3)})),t.createElement(D.I,null,I===0&&t.createElement(H,null),I===1&&t.createElement(b,null),I===2&&t.createElement(z,null),I===3&&t.createElement(F,null))))}return null},j=({folder:n,evaluationGroup:l})=>t.createElement(s.K,{alignItems:"center",gap:.5},t.createElement(f.x,{color:"secondary"},t.createElement(v.J,{name:"folder"})),t.createElement(f.x,{variant:"body",color:"primary"},n),t.createElement(f.x,{variant:"body",color:"secondary"},t.createElement(v.J,{name:"angle-right"})),t.createElement(f.x,{variant:"body",color:"primary"},l)),V=({name:n,state:l})=>t.createElement("header",null,t.createElement(s.K,{alignItems:"center",gap:1},t.createElement(y,{size:"md",state:l}),t.createElement(f.x,{element:"h1",variant:"h2",weight:"bold"},n))),X=({text:n})=>t.createElement(f.x,{variant:"body",color:"secondary"},n),Z=Q},19552:(x,p,e)=>{e.d(p,{H:()=>f,X:()=>O});var t=e(27702),s=e(25111),M=e(18771),g=e(47702),v=e(84369),C=e(96437),o=e(22446),h=e(52467),D=e(10027);function f(a,r){const i=T(r,a),c=(0,h.Zo)(r),u=(0,t.useMemo)(()=>{if(!(!a||!r||c.length===0))for(const R of c)for(const E of R.groups)for(const y of E.rules){const m=C.Yd(r,y);if(C.Dg(m,a))return y}},[a,r,c]);return{...i,result:u}}function O(a,r){const i=T(r),c=(0,h.Zo)(r),u=(0,t.useMemo)(()=>{if(!a||!r||c.length===0)return[];const R=[];for(const E of c)for(const y of E.groups)for(const m of y.rules)m.name===a&&R.push(m);return R},[a,r,c]);return{...i,result:u}}function T(a,r){const i=(0,M.useDispatch)(),c=(0,D._)(m=>m.promRules),u=A(a,c),R=(0,D._)(m=>m.rulerRules),E=A(a,R),{loading:y}=(0,s.Z)(async()=>{a&&await i((0,g.dn)({rulesSourceName:a,identifier:r}))},[i,a]);return{loading:y,error:u.error??(0,o.m$)(E)?void 0:E.error,dispatched:u.dispatched&&E.dispatched}}function A(a,r){if(!a)return v.oq;const i=r[a];return i||v.oq}}}]);

//# sourceMappingURL=6503.7b4ac61cbb1bd0574688.js.map