File: //opt/netdata/usr/share/netdata/web/v3/9856.9d2bddde2f076e582cd7.chunk.js
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"9f9973293dea885c0484e86d9a5d6e44ba9e045b"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e89e310c-26ac-4e22-acf3-14c7f6e94c75",e._sentryDebugIdIdentifier="sentry-dbid-e89e310c-26ac-4e22-acf3-14c7f6e94c75")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[6026,9856],{67119(e,t,n){n.d(t,{w:()=>o});const o={expanded:"expanded",collapsed:"collapsed",hidden:"hidden"}},37347(e,t,n){n.d(t,{A:()=>k});var o=n(96540),r=n(38429),a=n(34843),l=n(25316),s=n(24609),i=n(19186),d=n(52035),c=n(18790),u=n(24719),p=n(1705),h=n(57377);const x=(0,c.I)(e=>{let{id:t,spaceId:n,roomId:o}=e;return(0,d.eU)(async()=>{const{data:e}=await(0,p.PY)(n,o,t);return e.configString?(0,u._3)({spaceId:n,payload:{config:e.configString}}).catch(e=>({error:e.response?.data?.errorMessage})):Promise.reject("No alert configuration found")})},h.Ay);x.setShouldRemove(e=>Date.now()-new Date(e)>9e5);var g=n(24155),m=n(94615),f=n(67119),I=n(74848);const j=()=>(0,I.jsxs)(r.Flex,{column:!0,gap:2,children:[(0,I.jsx)(g.A,{width:"100%"}),(0,I.jsx)(g.A,{width:"80%"})]}),w=e=>{let{message:t="There was an error while fetching alert explanation"}=e;return(0,I.jsxs)(r.Flex,{alignItems:"center",gap:1,children:[(0,I.jsx)(r.Icon,{name:"warning_triangle",color:"warning"}),(0,I.jsx)(r.Text,{color:"textLite",children:t})]})},k=e=>{let{id:t,spaceId:n,roomId:r,expandedState:d}=e;const{loaded:c,value:u,hasError:p,error:h}=(e=>{let{id:t,spaceId:n,roomId:o}=e;const r=(0,s.vt)(),d=(0,i.ID)(),c=(0,a.md)((0,l.A)(x({id:t,spaceId:n||r,roomId:o||d})));return{loaded:"loading"!==c.state,value:c.data?.data,hasError:"hasError"===c.state||!!c.data?.error,error:c.error||c.data?.error}})({id:t,spaceId:n,roomId:r}),g=(0,o.useMemo)(()=>d===f.w.collapsed?{height:{max:30},overflow:{vertical:"auto"}}:{},[d]);return c?p?(0,I.jsx)(w,{message:h?.message}):d===f.w.hidden?null:u?.explanation?(0,I.jsx)(m.A,{value:u?.explanation,...g}):(0,I.jsx)(w,{message:"No explanation returned for this alert definition"}):(0,I.jsx)(j,{})}},61013(e,t,n){n.d(t,{A:()=>a});var o=n(96540),r=n(67119);const a=function(){let{initialExpandedState:e=r.w.collapsed}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[t,n]=(0,o.useState)(e),a=(0,o.useCallback)(()=>{n(r.w.expanded)},[n]),l=(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?a():l()},[t,a,l]);return[t,i,a,l,s]}},52678(e,t,n){n.d(t,{A:()=>s});var o=n(38429),r=n(74891),a=n(74848);const l=(0,r.A)(o.Icon),s=e=>{let{isOpen:t,toggle:n,hide:r}=e;return(0,a.jsxs)(o.Flex,{alignItems:"center",gap:2,children:[(0,a.jsx)(l,{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,a.jsx)(l,{name:"hide",width:"10px",color:"menuItem",cursor:"pointer",onClick:r,tooltip:"Hide",tooltipProps:{align:"bottom"},noWrapper:!0})]})}},39856(e,t,n){n.r(t),n.d(t,{default:()=>F});var o=n(38429),r=n(19075),a=n(91721),l=n(96540),s=n(30005),i=n(882);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:a}=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"===a}),(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:a,lookupMethod:s,lookupOptions:i}=(0,r.JL)(e);return(0,l.useMemo)(()=>s?(e=>{let{lookupOptions:t,lookupDimensions:n,lookupMethod:o,lookupAfter:r,lookupBefore:a,instance:l}=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 ${l}, starting ${m(r+a)} and up to ${m(a)}${i}`})({lookupOptions:i,lookupDimensions:a,lookupMethod:s,lookupAfter:n,lookupBefore:o,instance:t}):"",[i,a,s,n,o,t])},I=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},j=(0,l.memo)(I);var w=n(37347),k=n(52678),v=n(61013),y=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:a,warning:s,critical:i,updateEvery:c}=(0,r.JL)(t),h=f(t),x=(0,l.useMemo)(()=>(0,b.Ay)(a),[a]),[g,m,,,I]=(0,v.A)(),C=g===y.w.expanded;return(0,u.jsxs)(o.Flex,{column:!0,gap:4,children:[(0,u.jsx)(j,{heading:"DB lookup",value:h,testId:`${n}-lookup`}),(0,u.jsx)(j,{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)(k.A,{isOpen:C,toggle:m,hide:I})]}),(0,u.jsx)(w.A,{id:t,expandedState:g})]})]})},S=(0,l.memo)(C);var E=n(52007),T=n(79748),$=n(3464);const F=e=>{let{alertId:t,...n}=e;const{fullyLoaded:l,nodeId:s}=(0,r.JL)(t);return l?(0,u.jsxs)(o.Flex,{"data-testid":"alert-details-modal-tab-configuration",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)(a.A,{})}},52007(e,t,n){n.d(t,{A:()=>d});var o=n(38429),r=n(96026),a=n(74891),l=n(94404),s=n(74848);const i=(0,l.A)((0,a.A)(o.Button)),d=e=>{let{alertId:t,nodeId:n,small:o=!1,isLoading:a,disabled:l,...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:a,disabled:a||!c||l,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})}},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(76667),a=n(42790),l=n(61841),s=n(24609),i=n(24013),d=n(19075),c=n(91421);const u=e=>{let{alertId:t,alertName:n,nodeIds:a=[]}=e;const s=(0,r.Zp)(),{setState:u}=(0,c.$h)(),[p]=(0,l.Ay)(),{name:h}=(0,d.JL)(t),x=n||h,{isParent:g}=(0,i.xY)(a[0]),{loaded:m,value:f,hasError:I,error:j}=(0,c.wd)({node:{value:a[0],isParent:g},path:"/health"}),w=!!f?.tree?.["/health/alerts/prototypes"]?.[`health:alert:prototype:${x}`],[,k]=(0,c.PJ)();return{canEdit:m&&!I&&w,goToEdit:(0,o.useCallback)(e=>{a=e?Array.from(new Set([e,...a])):a,u({alertName:x,isAlert:!0}),k(!0,{nodeId:a[0]})},[x,a,p,u,s]),error:j?.errorMessage||j}},p=()=>{const e=(0,r.Zp)(),{slug:t}=(0,s.ap)(),n=(0,a.rI)();return(0,o.useCallback)(o=>{o&&(n(e=>({...e,dyncfgSearchTerm:o})),e(`/spaces/${t}/settings/configurations`,{replace:!0}))},[e,n,t])}}}]);