D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
share
/
grafana
/
public
/
build
/
Filename :
3312.48d5fac3b02144f52e9a.js
back
Copy
"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[3312],{43491:(I,p,e)=>{e.d(p,{F:()=>u});var l=e(42844),n=e(27702),f=e(66310),d=e(45986);const u=({renderExpandedContent:r,...s})=>{const m=(0,f.wW)(t);return n.createElement(d.t,{renderExpandedContent:r?(x,D,P)=>n.createElement(n.Fragment,null,D!==P.length-1&&n.createElement("div",{className:(0,l.cx)(m.contentGuideline,m.guideline)}),r(x,D,P)):void 0,renderPrefixHeader:()=>n.createElement("div",{className:m.relative},n.createElement("div",{className:(0,l.cx)(m.headerGuideline,m.guideline)})),renderPrefixCell:(x,D,P)=>n.createElement("div",{className:m.relative},n.createElement("div",{className:(0,l.cx)(m.topGuideline,m.guideline)}),D!==P.length-1&&n.createElement("div",{className:(0,l.cx)(m.bottomGuideline,m.guideline)})),...s})},t=r=>({relative:(0,l.css)` position: relative; height: 100%; `,guideline:(0,l.css)` left: -19px; border-left: 1px solid ${r.colors.border.weak}; position: absolute; ${r.breakpoints.down("md")} { display: none; } `,topGuideline:(0,l.css)` width: 18px; border-bottom: 1px solid ${r.colors.border.medium}; top: 0; bottom: 50%; `,bottomGuideline:(0,l.css)` top: 50%; bottom: 0; `,contentGuideline:(0,l.css)` top: 0; bottom: 0; left: -49px !important; `,headerGuideline:(0,l.css)` top: -17px; bottom: 0; `})},18629:(I,p,e)=>{e.d(p,{C0:()=>t,Uv:()=>d,Xq:()=>u});var l=e(27702),n=e(63439),f=e(25357),d=(r=>(r.ContactPoint="contact point",r.Template="template",r.MuteTiming="mute timing",r.AlertRule="alert rule",r.RootNotificationPolicy="root notification policy",r))(d||{});const u=({resource:r})=>l.createElement(n.b,{title:`This ${r} cannot be edited through the UI`,severity:"info"},"This ",r," has been provisioned, that means it was created by config. Please contact your server admin to update this ",r,"."),t=()=>l.createElement(f.C,{text:"Provisioned",color:"purple"})},14158:(I,p,e)=>{e.d(p,{V:()=>f});var l=e(27702),n=e(73453);const f=({namespace:d,group:u})=>u?l.createElement(l.Fragment,null,d," ",l.createElement(n.J,{name:"angle-right"})," ",u):l.createElement(l.Fragment,null,d)},77982:(I,p,e)=>{e.d(p,{V:()=>t});var l=e(42844),n=e(27702),f=e(66310),d=e(80011),u=e(73453);const t=({rule:s})=>{const m=(0,f.wW)(r);return s.health==="err"||s.health==="error"?n.createElement(d.u,{theme:"error",content:s.lastError||"No error message provided."},n.createElement("div",{className:m.warn},n.createElement(u.J,{name:"exclamation-triangle"}),n.createElement("span",null,"error"))):n.createElement(n.Fragment,null,s.health)},r=s=>({warn:(0,l.css)` display: inline-flex; flex-direction: row; align-items: center; gap: ${s.spacing(1)}; color: ${s.colors.warning.text}; `})},60087:(I,p,e)=>{e.d(p,{p:()=>x});var l=e(42844),n=e(27702),f=e(32082),d=e(23852),u=e(66310),t=e(62108),r=e(18447),s=e(22446),m=e(68614);const x=({rule:P,isDeleting:K,isCreating:N,isPaused:A})=>{const U=(0,u.wW)(D),{promRule:g}=P,S=(0,n.useMemo)(()=>{if(g&&(0,s.x_)(g)&&g.alerts?.length&&g.state!==r.x_.Inactive){const L=g.activeAt?new Date(g.activeAt):(0,s.ub)(g);if(L)return n.createElement("span",{title:String(L),className:U.for},"for"," ",(0,f.vT)({start:L,end:new Date},!1))}return null},[g,U]);return K?n.createElement(d.K,{gap:1},n.createElement(t.$,null),"Deleting"):N?n.createElement(d.K,{gap:1},n.createElement(t.$,null),"Creating"):g&&(0,s.x_)(g)?n.createElement(d.K,{gap:1},n.createElement(m.l,{state:g.state,isPaused:A}),S):g&&(0,s.OP)(g)?n.createElement(n.Fragment,null,"Recording rule"):n.createElement(n.Fragment,null,"n/a")},D=P=>({for:(0,l.css)` font-size: ${P.typography.bodySmall.fontSize}; color: ${P.colors.text.secondary}; white-space: nowrap; padding-top: 2px; `})},3312:(I,p,e)=>{e.d(p,{i:()=>Ee});var l=e(42844),n=e(2629),f=e(55434);function d(a,v){(0,f.Z)(2,arguments);var h=(0,n.Z)(a),C=(0,n.Z)(v);return h.getTime()<C.getTime()}var u=e(81205),t=e(27702),r=e(32082),s=e(99633),m=e(60956),x=e(66310),D=e(80011),P=e(97957),K=e(93364),N=e(33555),A=e(22446),U=e(45986),g=e(43491),S=e(18629),L=e(14158),Y=e(3671),j=e(7662),J=e(23852),z=e(66670),Q=e(71585),X=e(3613),w=e(73807),k=e(18771),q=e(99322),_=e(47702),G=e(22513),H=e(39036),b=e(96437),ee=e(59597),te=e(3764);const Pe=a=>window.matchMedia(`(max-width: ${a}px)`).matches,ne=({rule:a,rulesSource:v})=>{const h=(0,k.useDispatch)(),C=(0,j.TH)(),W=(0,w.iG)(),T=(0,x.wW)(le),{namespace:E,group:o,rulerRule:c}=a,[i,R]=(0,t.useState)(),y=(0,G.EG)(v),M=(0,A.Pc)(a.rulerRule)&&!!a.rulerRule.grafana_alert.provenance,O=[],$=(0,A.Jq)(o),{isEditable:pe,isRemovable:fe}=(0,q.M)(y,c),Z=C.pathname+C.search,V=ae(C.pathname),De=()=>{if(i&&i.rulerRule){const B=b.Zk((0,G.EG)(i.namespace.rulesSource),i.namespace.name,i.group.name,i.rulerRule);h((0,_.hS)(B,{navigateTo:V?"/alerting/list":void 0})),R(void 0)}},he=()=>(0,H.t6)(v,a),Me=(0,G.EG)(v);if(V||O.push(t.createElement(D.u,{placement:"top",content:"View"},t.createElement(z.Qj,{className:T.button,title:"View",size:"sm",key:"view",variant:"secondary",icon:"eye",href:(0,H.V2)(v,a,Z)}))),pe&&c&&!$){const B=b.Zk(Me,E.name,o.name,c);if(!M){const F=(0,ee.u)(`/alerting/${encodeURIComponent(b.$V(B))}/edit`,{returnTo:Z});V&&O.push(t.createElement(Q.m,{key:"copy",icon:"copy",onClipboardError:Re=>{W.error("Error while copying URL",Re)},className:T.button,size:"sm",getText:he},"Copy link to rule")),O.push(t.createElement(D.u,{placement:"top",content:"Edit"},t.createElement(z.Qj,{title:"Edit",className:T.button,size:"sm",key:"edit",variant:"secondary",icon:"pen",href:F})))}O.push(t.createElement(D.u,{placement:"top",content:"Copy"},t.createElement(te.E,{ruleIdentifier:B,isProvisioned:M,className:T.button})))}return fe&&c&&!$&&!M&&O.push(t.createElement(D.u,{placement:"top",content:"Delete"},t.createElement(z.zx,{title:"Delete",className:T.button,size:"sm",type:"button",key:"delete",variant:"secondary",icon:"trash-alt",onClick:()=>R(a)}))),O.length?t.createElement(t.Fragment,null,t.createElement(J.K,{gap:1},O.map((B,F)=>t.createElement(t.Fragment,{key:F},B))),!!i&&t.createElement(X.s,{isOpen:!0,title:"Delete rule",body:t.createElement("div",null,t.createElement("p",null,'Deleting "',t.createElement("strong",null,i.name),'" will permanently remove it from your alert rule list.'),t.createElement("p",null,"Are you sure you want to delete this rule?")),confirmText:"Yes, delete",icon:"exclamation-triangle",onConfirm:De,onDismiss:()=>R(void 0)})):null};function ae(a){return a.endsWith("/view")}const le=a=>({button:(0,l.css)` padding: 0 ${a.spacing(2)}; `});var oe=e(34667),re=e(73453),se=e(76384);function ie({rule:a}){const v=(0,x.wW)(ce),{exceedsLimit:h}=(0,t.useMemo)(()=>(0,se.f)(a.group.interval),[a.group.interval]);return h?t.createElement(D.u,{theme:"error",content:t.createElement("div",null,"A minimum evaluation interval of"," ",t.createElement("span",{className:v.globalLimitValue},oe.config.unifiedAlerting.minInterval)," has been configured in Grafana and will be used instead of the ",a.group.interval," interval configured for the Rule Group.")},t.createElement(re.J,{name:"stopwatch-slash",className:v.icon})):null}function ce(a){return{globalLimitValue:(0,l.css)` font-weight: ${a.typography.fontWeightBold}; `,icon:(0,l.css)` fill: ${a.colors.warning.text}; `}}var me=e(93764),ue=e(77982),de=e(60087);const Ee=({rules:a,className:v,showGuidelines:h=!1,emptyMessage:C="No rules found.",showGroupColumn:W=!1,showSummaryColumn:T=!1,showNextEvaluationColumn:E=!1})=>{const o=(0,x.wW)(ge),c=(0,l.cx)(o.wrapper,v,{[o.wrapperMargin]:h}),i=(0,t.useMemo)(()=>a.map((M,O)=>({id:`${M.namespace.name}-${M.group.name}-${M.name}-${O}`,data:M})),[a]),R=ve(T,W,E);if(!a.length)return t.createElement("div",{className:(0,l.cx)(c,o.emptyMessage)},C);const y=h?g.F:U.t;return t.createElement("div",{className:c,"data-testid":"rules-table"},t.createElement(y,{cols:R,isExpandable:!0,items:i,renderExpandedContent:({data:M})=>t.createElement(me.Ii,{rule:M}),pagination:{itemsPerPage:P.gN},paginationStyles:o.pagination}))},ge=a=>({wrapperMargin:(0,l.css)` ${a.breakpoints.up("md")} { margin-left: 36px; } `,emptyMessage:(0,l.css)` padding: ${a.spacing(1)}; `,wrapper:(0,l.css)` width: auto; border-radius: ${a.shape.borderRadius()}; `,pagination:(0,l.css)` display: flex; margin: 0; padding-top: ${a.spacing(1)}; padding-bottom: ${a.spacing(.25)}; justify-content: center; border-left: 1px solid ${a.colors.border.medium}; border-right: 1px solid ${a.colors.border.medium}; border-bottom: 1px solid ${a.colors.border.medium}; `});function ve(a,v,h){const{hasRuler:C,rulerRulesLoaded:W}=(0,K.h)(),T=(0,t.useCallback)(E=>{const o=E.promRule?.lastEvaluation&&(0,r.qb)(E.promRule.lastEvaluation),c=E.group.interval&&(0,r.jO)(E.group.interval);if(!o||!c||(0,A.E)(E))return;const i=(0,r.RA)(E.group.interval),R=Date.parse(E.promRule?.lastEvaluation||""),y=(0,r.Ks)(R,i);return d(y,new Date)?{humanized:`within ${(0,u.Z)(i)}`,fullDate:`within ${(0,u.Z)(i)}`}:{humanized:`in ${(0,s.CQ)(y).locale("en").fromNow(!0)}`,fullDate:(0,m.dq)(y,{format:"YYYY-MM-DD HH:mm:ss"})}},[]);return(0,t.useMemo)(()=>{const E=[{id:"state",label:"State",renderCell:({data:o})=>{const{namespace:c}=o,{rulesSource:i}=c,{promRule:R,rulerRule:y}=o,M=!!(C(i)&&W(i)&&R&&!y),O=!!(C(i)&&W(i)&&y&&!R),$=(0,A.E)(o);return t.createElement(de.p,{rule:o,isDeleting:M,isCreating:O,isPaused:$})},size:"165px"},{id:"name",label:"Name",renderCell:({data:o})=>o.name,size:h?4:5},{id:"provisioned",label:"",renderCell:({data:o})=>{const c=o.rulerRule;return(0,A.Pc)(c)&&c.grafana_alert.provenance?t.createElement(S.C0,null):null},size:"100px"},{id:"warnings",label:"",renderCell:({data:o})=>t.createElement(ie,{rule:o}),size:"45px"},{id:"health",label:"Health",renderCell:({data:{promRule:o,group:c}})=>o?t.createElement(ue.V,{rule:o}):null,size:"75px"}];return a&&E.push({id:"summary",label:"Summary",renderCell:({data:o})=>t.createElement(Y.Z,{input:o.annotations[N.q6.summary]??""}),size:h?4:5}),h&&E.push({id:"nextEvaluation",label:"Next evaluation",renderCell:({data:o})=>{const c=T(o);return c&&t.createElement(D.u,{placement:"top",content:`${c?.fullDate}`,theme:"info"},t.createElement("span",null,c?.humanized))},size:2}),v&&E.push({id:"group",label:"Group",renderCell:({data:o})=>{const{namespace:c,group:i}=o;return i.name==="default"?t.createElement(L.V,{namespace:c.name}):t.createElement(L.V,{namespace:c.name,group:i.name})},size:5}),E.push({id:"actions",label:"Actions",renderCell:({data:o})=>t.createElement(ne,{rule:o,rulesSource:o.namespace.rulesSource}),size:"200px"}),E},[a,v,h,C,W,T])}},93364:(I,p,e)=>{e.d(p,{h:()=>d});var l=e(27702),n=e(22513),f=e(10027);function d(){const u=(0,f._)(s=>s.rulerRules),t=(0,l.useCallback)(s=>{const m=typeof s=="string"?s:s.name;return m===n.GC||!!u[m]?.result},[u]),r=(0,l.useCallback)(s=>{const m=(0,n.EG)(s);return!!u[m]?.result},[u]);return{hasRuler:t,rulerRulesLoaded:r}}}}]); //# sourceMappingURL=3312.48d5fac3b02144f52e9a.js.map