File: //proc/self/root/opt/netdata/netdata-web-files/v3/9856.cc3671200865498ffc5c.chunk.js
try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9ef5653a-8b55-4e7e-9d63-63ed52a1a0dc",e._sentryDebugIdIdentifier="sentry-dbid-9ef5653a-8b55-4e7e-9d63-63ed52a1a0dc")}()}catch(e){}!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"3a47ecd239cde341153600f7e31b0b1d0daf94f1"}}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[6026,9856],{37347:(e,t,n)=>{n.d(t,{A:()=>w});var o=n(96540),r=n(63766),l=n(34843),a=n(84929),s=n(24609),i=n(19186),d=n(52035),c=n(24719),u=n(1705),p=n(57377);const h=(0,a.Iz)((e=>{let{id:t,spaceId:n,roomId:o}=e;return(0,d.eU)((async()=>{const{data:e}=await(0,u.PY)(n,o,t);return e.configString?(0,c._3)({spaceId:n,payload:{config:e.configString}}).catch((e=>({error:e.response?.data?.errorMessage}))):Promise.reject("No alert configuration found")}))}),p.Ay);h.setShouldRemove((e=>Date.now()-new Date(e)>9e5));var x=n(24155),g=n(94615),m=n(67119),f=n(74848);const j=()=>(0,f.jsxs)(r.Flex,{column:!0,gap:2,children:[(0,f.jsx)(x.A,{width:"100%"}),(0,f.jsx)(x.A,{width:"80%"})]}),I=e=>{let{message:t="There was an error while fetching alert explanation"}=e;return(0,f.jsxs)(r.Flex,{alignItems:"center",gap:1,children:[(0,f.jsx)(r.Icon,{name:"warning_triangle",color:"warning"}),(0,f.jsx)(r.Text,{color:"textLite",children:t})]})},w=e=>{let{id:t,expandedState:n}=e;const{loaded:r,value:d,hasError:c,error:u}=(e=>{let{id:t}=e;const n=(0,s.vt)(),o=(0,i.ID)(),r=(0,l.md)((0,a.Rq)(h({id:t,spaceId:n,roomId:o})));return{loaded:"loading"!==r.state,value:r.data?.data,hasError:"hasError"===r.state||!!r.data?.error,error:r.error||r.data?.error}})({id:t}),p=(0,o.useMemo)((()=>n===m.w.collapsed?{height:{max:30},overflow:{vertical:"auto"}}:{}),[n]);return r?c?(0,f.jsx)(I,{message:u}):n===m.w.hidden?null:d?.explanation?(0,f.jsx)(g.A,{value:d?.explanation,...p}):(0,f.jsx)(I,{message:"No explanation returned for this alert definition"}):(0,f.jsx)(j,{})}},39856:(e,t,n)=>{n.r(t),n.d(t,{default:()=>F});var o=n(63766),r=n(19075),l=n(91721),a=n(96540),s=n(30005),i=n(33185);const d=i.default.div.withConfig({displayName:"styled__StyledAlertTypeIndicator",componentId:"sc-19nk935-0"})(["width:",";height:",";border-radius:",";background-color:",";"],(0,o.getSizeBy)(1),(0,o.getSizeBy)(1),(0,o.getSizeBy)(1),(e=>{let{critical:t,theme:n}=e;return(0,o.getColor)(t?"error":["yellow","sunglow"])({theme:n})}));i.default.a.withConfig({displayName:"styled__StyledLink",componentId:"sc-19nk935-1"})(["padding:",";text-decoration:none;color:",";&:visited{color:",";}&:hover{text-decoration:none;}"],(e=>{let{padding:t}=e;return t??"0"}),(0,o.getColor)("success"),(0,o.getColor)("success"));var c=n(45087),u=n(74848);const p=e=>{let{title:t,value:n,testId:r,status:l}=e;return n?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(o.Flex,{justifyContent:"between",children:[(0,u.jsxs)(o.Flex,{gap:1,alignItems:"center",children:[(0,u.jsx)(d,{critical:"critical"===l}),(0,u.jsx)(o.H6,{color:"menuItem",children:t})]}),(0,u.jsxs)(o.Flex,{gap:1,alignItems:"center",children:[(0,u.jsxs)(o.TextSmall,{color:"menuItem",children:["More details about"," ",(0,u.jsx)(o.TextSmall,{strong:!0,color:"menuItem",children:"$this"})," ","command"]}),(0,u.jsx)(c.A,{content:"The $this value comes from the DB Lookup or the Calculation above",isBasic:!0,plain:!0,children:(0,u.jsx)(o.Flex,{margin:[-.5,0,0],children:(0,u.jsx)(o.Icon,{name:"informationPress",color:"textLite",width:"16px",height:"16px"})})})]})]}),(0,u.jsx)(s.Ay,{"data-testid":r,children:n})]}):null};var h=n(84287),x=n(49914),g=n(57549);const m=e=>{if("string"===typeof e&&(e=parseInt(e,10)),0===e)return"now";const t=new Date;return e<0?(0,h.k)((0,x.p)(t,e),t,{addSuffix:!0}):(0,h.k)((0,g.W)(t,e),t,{addSuffix:!0})},f=e=>{const{instance:t,lookupAfter:n,lookupBefore:o,lookupDimensions:l,lookupMethod:s,lookupOptions:i}=(0,r.JL)(e);return(0,a.useMemo)((()=>s?(e=>{let{lookupOptions:t,lookupDimensions:n,lookupMethod:o,lookupAfter:r,lookupBefore:l,instance:a}=e,s="of all values";if(n){const e=n.split(",");s=`${e.length>1?"of the sum of dimensions":"of all values of dimension"} ${e.join(", ")}`}const i=t?`, with options ${t}`:"";return`${o} ${s} of chart ${a}, starting ${m(r+l)} and up to ${m(l)}${i}`})({lookupOptions:i,lookupDimensions:l,lookupMethod:s,lookupAfter:n,lookupBefore:o,instance:t}):""),[i,l,s,n,o,t])},j=e=>{let{heading:t,value:n,testId:r}=e;return n&&n.length?(0,u.jsxs)(o.Flex,{column:!0,gap:2,children:[t&&(0,u.jsx)(o.H6,{textTransform:"uppercase",color:"menuItem",children:t}),(0,u.jsx)(s.Ay,{"data-testid":r,children:n})]}):null},I=(0,a.memo)(j);var w=n(37347),y=n(52678),k=n(61013),v=n(67119),b=n(10900);const A=e=>{let{children:t}=e;return(0,u.jsx)(o.Flex,{column:!0,gap:2,children:t})},C=e=>{let{id:t,testid:n}=e;const{calculation:l,warning:s,critical:i,updateEvery:c}=(0,r.JL)(t),h=f(t),x=(0,a.useMemo)((()=>(0,b.Ay)(l)),[l]),[g,m,,,j]=(0,k.A)(),C=g===v.w.expanded;return(0,u.jsxs)(o.Flex,{column:!0,gap:4,children:[(0,u.jsx)(I,{heading:"DB lookup",value:h,testId:`${n}-lookup`}),(0,u.jsx)(I,{heading:"Calculation",value:x,testId:`${n}-calculation`}),(0,u.jsxs)(A,{children:[(0,u.jsx)(o.H6,{textTransform:"uppercase",color:"menuItem",children:"Severity Conditions"}),(0,u.jsxs)(o.Flex,{column:!0,gap:3,children:[(0,u.jsx)(p,{title:"Warning when",value:s,testId:`${n}-warningWhen`,status:"warning",children:(0,u.jsx)(d,{critical:!1})}),(0,u.jsx)(p,{title:"Critical when",value:i,testId:`${n}-criticalWhen`,status:"critical",children:(0,u.jsx)(d,{critical:!0})})]})]}),(0,u.jsxs)(A,{children:[(0,u.jsx)(o.H6,{textTransform:"uppercase",color:"menuItem",children:"Check"}),(0,u.jsxs)(o.Text,{strong:!0,color:"menuItem",children:["Every ",c," seconds"]})]}),(0,u.jsxs)(A,{children:[(0,u.jsxs)(o.Flex,{alignItems:"center",gap:2,children:[(0,u.jsx)(o.H6,{textTransform:"uppercase",color:"menuItem",children:"Explanation"}),(0,u.jsx)(y.A,{isOpen:C,toggle:m,hide:j})]}),(0,u.jsx)(w.A,{id:t,expandedState:g})]})]})},S=(0,a.memo)(C);var E=n(52007),T=n(79748),$=n(3464);const F=e=>{let{alertId:t,...n}=e;const{fullyLoaded:a,nodeId:s}=(0,r.JL)(t);return a?(0,u.jsxs)(o.Flex,{column:!0,gap:8,padding:[4,0],...n,children:[(0,u.jsx)(S,{id:t}),(0,u.jsxs)(o.Flex,{column:!0,gap:3,children:[(0,u.jsx)(E.A,{alertId:t,nodeId:s,label:"Edit alert configuration",noWrapper:!0}),(0,u.jsx)(T.A,{href:$.UW,target:"_blank",rel:"noopener noreferrer",children:(0,u.jsxs)(o.Flex,{alignItems:"center",justifyContent:"center",children:[(0,u.jsx)(o.TextBig,{color:"primary",children:"View the documentation"}),(0,u.jsx)(o.Icon,{name:"arrow_left",rotate:2,size:"small",margin:[0,0,-.75,1],color:"success"})]})})]})]}):(0,u.jsx)(l.A,{})}},52007:(e,t,n)=>{n.d(t,{A:()=>d});var o=n(63766),r=n(96026),l=n(74891),a=n(94404),s=n(74848);const i=(0,a.A)((0,l.A)(o.Button)),d=e=>{let{alertId:t,nodeId:n,small:o=!1,isLoading:l,disabled:a,...d}=e;const{canEdit:c,goToEdit:u}=(0,r.q)({nodeIds:[n],alertId:t});return(0,s.jsx)(i,{small:o,label:"Edit alert",onClick:()=>u(n),flavour:"hollow",isLoading:l,disabled:l||!c||a,width:o?"112px":"150px","data-ga":"alert-modal::click-edit-congiguration::alerts-view",payload:{action:"Edit alert",alertId:t,nodeId:n},tooltip:c?null:"You cannot edit this alert.",...d})}},52678:(e,t,n)=>{n.d(t,{A:()=>s});var o=n(63766),r=n(74891),l=n(74848);const a=(0,r.A)(o.Icon),s=e=>{let{isOpen:t,toggle:n,hide:r}=e;return(0,l.jsxs)(o.Flex,{alignItems:"center",gap:2,children:[(0,l.jsx)(a,{name:"triangle_down",width:"10px",color:"menuItem",rotate:t?2:null,cursor:"pointer",onClick:n,tooltip:t?"Collapse":"Expand",tooltipProps:{align:"bottom"},noWrapper:!0}),(0,l.jsx)(a,{name:"hide",width:"10px",color:"menuItem",cursor:"pointer",onClick:r,tooltip:"Hide",tooltipProps:{align:"bottom"},noWrapper:!0})]})}},61013:(e,t,n)=>{n.d(t,{A:()=>l});var o=n(96540),r=n(67119);const l=function(){let{initialExpandedState:e=r.w.collapsed}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[t,n]=(0,o.useState)(e),l=(0,o.useCallback)((()=>{n(r.w.expanded)}),[n]),a=(0,o.useCallback)((()=>{n(r.w.collapsed)}),[n]),s=(0,o.useCallback)((()=>{n(r.w.hidden)}),[n]),i=(0,o.useCallback)((()=>{t!==r.w.expanded?l():a()}),[t,l,a]);return[t,i,l,a,s]}},67119:(e,t,n)=>{n.d(t,{w:()=>o});const o={expanded:"expanded",collapsed:"collapsed",hidden:"hidden"}},96026:(e,t,n)=>{n.d(t,{l:()=>p,q:()=>u});n(25509),n(65223),n(60321),n(41927),n(11632),n(64377),n(66771),n(12516),n(68931),n(52514),n(35694),n(52774),n(49536),n(21926),n(94483),n(16215);var o=n(96540),r=n(88934),l=n(42790),a=n(61841),s=n(24609),i=n(24013),d=n(19075),c=n(91421);const u=e=>{let{alertId:t,alertName:n,nodeIds:l=[]}=e;const s=(0,r.Zp)(),{setState:u}=(0,c.$h)(),[p]=(0,a.Ay)(),{name:h}=(0,d.JL)(t),x=n||h,{isParent:g}=(0,i.xY)(l[0]),{loaded:m,value:f,hasError:j,error:I}=(0,c.wd)({node:{value:l[0],isParent:g},path:"/health"}),w=!!f?.tree?.["/health/alerts/prototypes"]?.[`health:alert:prototype:${x}`],[,y]=(0,c.PJ)();return{canEdit:m&&!j&&w,goToEdit:(0,o.useCallback)((e=>{l=e?Array.from(new Set([e,...l])):l,u({alertName:x,isAlert:!0}),y(!0,{nodeId:l[0]})}),[x,l,p,u,s]),error:I?.errorMessage||I}},p=()=>{const e=(0,r.Zp)(),{slug:t}=(0,s.ap)(),n=(0,l.rI)();return(0,o.useCallback)((o=>{o&&(n((e=>({...e,dyncfgSearchTerm:o}))),e(`/spaces/${t}/settings/configurations`,{replace:!0}))}),[e,n,t])}}}]);