File: //opt/netdata/usr/share/netdata/web/v3/9856.82d776cf34c83bd5b315.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]="1260b058-922b-4c24-aa19-a326949100b1",e._sentryDebugIdIdentifier="sentry-dbid-1260b058-922b-4c24-aa19-a326949100b1")}()}catch(e){}!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"5ded98bed5f4589e490b1beae30dccf288de26e3"}}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[9856],{30005:(e,t,o)=>{o.d(t,{Ay:()=>u,R0:()=>c});var n=o(33185),l=o(92415),r=o(88307),a=o(74848);const i=(0,n.default)(l.Box).attrs((e=>({color:"textDescription",background:"modalTabsBackground",border:{side:"all",color:"borderSecondary"},padding:[4,10,4,4],position:"relative",width:"100%",...e}))).withConfig({displayName:"command__StyledTerminalCommand",componentId:"sc-wnwmk3-0"})(["color:",";border-radius:2px;overflow-wrap:anywhere;white-space:pre-wrap;font-family:monospace;letter-spacing:0.09px;line-height:18px;font-size:14px;word-break:break-word;"],(0,l.getColor)("textDescription")),d=(0,n.default)(l.Icon).withConfig({displayName:"command__StyledIcon",componentId:"sc-wnwmk3-1"})(["display:flex;align-self:flex-end;cursor:pointer;"]),s=(0,n.default)(l.Box).attrs({color:"textDescription",border:{side:"all",color:"borderSecondary"},background:"modalTabsBackground",padding:[0,1]}).withConfig({displayName:"command__CodeText",componentId:"sc-wnwmk3-2"})(["display:inline-block;color:",";border-radius:2px;font-family:monospace;letter-spacing:0.09px;line-height:16px;font-size:12px;font-weight:bold;word-break:break-word;"],(0,l.getColor)("textDescription")),c=e=>{let{children:t,...o}=e;return(0,a.jsx)(s,{...o,children:t})},u=e=>{let{children:t,confirmationText:o="Copied to your clipboard.",commandText:n=t,iconContainerProps:s={},...c}=e;return(0,a.jsxs)(i,{...c,children:[t,(0,a.jsx)(l.Box,{position:"absolute",bottom:"8px",right:"8px",onClick:(0,r.C)(n||t,{text:o}),...s,children:(0,a.jsx)(d,{name:"copy",size:"small",color:"primary"})})]})}},39856:(e,t,o)=>{o.r(t),o.d(t,{default:()=>_});var n=o(92415),l=o(19075),r=o(91721),a=o(96540),i=o(30005),d=o(33185);const s=d.default.div.withConfig({displayName:"styled__StyledAlertTypeIndicator",componentId:"sc-19nk935-0"})(["width:",";height:",";border-radius:",";background-color:",";"],(0,n.getSizeBy)(1),(0,n.getSizeBy)(1),(0,n.getSizeBy)(1),(e=>{let{critical:t,theme:o}=e;return(0,n.getColor)(t?"error":["yellow","sunglow"])({theme:o})}));d.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,n.getColor)("success"),(0,n.getColor)("success"));var c=o(45087),u=o(74848);const p=e=>{let{title:t,value:o,testId:l,status:r}=e;return o?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(n.Flex,{justifyContent:"between",children:[(0,u.jsxs)(n.Flex,{gap:1,alignItems:"center",children:[(0,u.jsx)(s,{critical:"critical"===r}),(0,u.jsx)(n.H6,{color:"menuItem",children:t})]}),(0,u.jsxs)(n.Flex,{gap:1,alignItems:"center",children:[(0,u.jsxs)(n.TextSmall,{color:"menuItem",children:["More details about"," ",(0,u.jsx)(n.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)(n.Flex,{margin:[-.5,0,0],children:(0,u.jsx)(n.Icon,{name:"informationPress",color:"textLite",width:"16px",height:"16px"})})})]})]}),(0,u.jsx)(i.Ay,{"data-testid":l,children:o})]}):null};var h=o(84287),x=o(49914),m=o(57549);const f=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,m.W)(t,e),t,{addSuffix:!0})},g=e=>{const{instance:t,lookupAfter:o,lookupBefore:n,lookupDimensions:r,lookupMethod:i,lookupOptions:d}=(0,l.JL)(e);return(0,a.useMemo)((()=>i?(e=>{let{lookupOptions:t,lookupDimensions:o,lookupMethod:n,lookupAfter:l,lookupBefore:r,instance:a}=e,i="of all values";if(o){const e=o.split(",");i=`${e.length>1?"of the sum of dimensions":"of all values of dimension"} ${e.join(", ")}`}const d=t?`, with options ${t}`:"";return`${n} ${i} of chart ${a}, starting ${f(l+r)} and up to ${f(r)}${d}`})({lookupOptions:d,lookupDimensions:r,lookupMethod:i,lookupAfter:o,lookupBefore:n,instance:t}):""),[d,r,i,o,n,t])},w=e=>{let{heading:t,value:o,testId:l}=e;return o&&o.length?(0,u.jsxs)(n.Flex,{column:!0,gap:2,children:[t&&(0,u.jsx)(n.H6,{textTransform:"uppercase",color:"menuItem",children:t}),(0,u.jsx)(i.Ay,{"data-testid":l,children:o})]}):null},b=(0,a.memo)(w);var y=o(61013),k=o(67119),j=o(10900);const I=e=>{let{children:t}=e;return(0,u.jsx)(n.Flex,{column:!0,gap:2,children:t})},v=e=>{let{id:t,testid:o}=e;const{calculation:r,warning:i,critical:d,updateEvery:c}=(0,l.JL)(t),h=g(t),x=(0,a.useMemo)((()=>(0,j.Ay)(r)),[r]),[m,f,,,w]=(0,y.A)();k.w.expanded;return(0,u.jsxs)(n.Flex,{column:!0,gap:4,children:[(0,u.jsx)(b,{heading:"DB lookup",value:h,testId:`${o}-lookup`}),(0,u.jsx)(b,{heading:"Calculation",value:x,testId:`${o}-calculation`}),(0,u.jsxs)(I,{children:[(0,u.jsx)(n.H6,{textTransform:"uppercase",color:"menuItem",children:"Severity Conditions"}),(0,u.jsxs)(n.Flex,{column:!0,gap:3,children:[(0,u.jsx)(p,{title:"Warning when",value:i,testId:`${o}-warningWhen`,status:"warning",children:(0,u.jsx)(s,{critical:!1})}),(0,u.jsx)(p,{title:"Critical when",value:d,testId:`${o}-criticalWhen`,status:"critical",children:(0,u.jsx)(s,{critical:!0})})]})]}),(0,u.jsxs)(I,{children:[(0,u.jsx)(n.H6,{textTransform:"uppercase",color:"menuItem",children:"Check"}),(0,u.jsxs)(n.Text,{strong:!0,color:"menuItem",children:["Every ",c," seconds"]})]})]})},C=(0,a.memo)(v);var T=o(52007),A=o(79748),S=o(3464);const _=e=>{let{alertId:t,...o}=e;const{fullyLoaded:a,nodeId:i}=(0,l.JL)(t);return a?(0,u.jsxs)(n.Flex,{column:!0,gap:8,padding:[4,0],...o,children:[(0,u.jsx)(C,{id:t}),(0,u.jsxs)(n.Flex,{column:!0,gap:3,children:[(0,u.jsx)(T.A,{alertId:t,nodeId:i,label:"Edit alert configuration",noWrapper:!0}),(0,u.jsx)(A.A,{href:S.UW,target:"_blank",rel:"noopener noreferrer",children:(0,u.jsxs)(n.Flex,{alignItems:"center",justifyContent:"center",children:[(0,u.jsx)(n.TextBig,{color:"primary",children:"View the documentation"}),(0,u.jsx)(n.Icon,{name:"arrow_left",rotate:2,size:"small",margin:[0,0,-.75,1],color:"success"})]})})]})]}):(0,u.jsx)(r.A,{})}},52007:(e,t,o)=>{o.d(t,{A:()=>s});var n=o(92415),l=o(96026),r=o(74891),a=o(94404),i=o(74848);const d=(0,a.A)((0,r.A)(n.Button)),s=e=>{let{alertId:t,nodeId:o,small:n=!1,isLoading:r,disabled:a,...s}=e;const{canEdit:c,goToEdit:u}=(0,l.q)({nodeIds:[o],alertId:t});return(0,i.jsx)(d,{small:n,label:"Edit alert",onClick:()=>u(o),flavour:"hollow",isLoading:r,disabled:r||!c||a,width:n?"112px":"150px","data-ga":"alert-modal::click-edit-congiguration::alerts-view",payload:{action:"Edit alert",alertId:t,nodeId:o},tooltip:c?null:"You cannot edit this alert.",...s})}},61013:(e,t,o)=>{o.d(t,{A:()=>r});var n=o(96540),l=o(67119);const r=function(){let{initialExpandedState:e=l.w.collapsed}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[t,o]=(0,n.useState)(e),r=(0,n.useCallback)((()=>{o(l.w.expanded)}),[o]),a=(0,n.useCallback)((()=>{o(l.w.collapsed)}),[o]),i=(0,n.useCallback)((()=>{o(l.w.hidden)}),[o]),d=(0,n.useCallback)((()=>{t!==l.w.expanded?r():a()}),[t,r,a]);return[t,d,r,a,i]}},67119:(e,t,o)=>{o.d(t,{w:()=>n});const n={expanded:"expanded",collapsed:"collapsed",hidden:"hidden"}},96026:(e,t,o)=>{o.d(t,{l:()=>p,q:()=>u});o(25509),o(65223),o(60321),o(41927),o(11632),o(64377),o(66771),o(12516),o(68931),o(52514),o(35694),o(52774),o(49536),o(21926),o(94483),o(16215);var n=o(96540),l=o(88934),r=o(42790),a=o(61841),i=o(24609),d=o(24013),s=o(19075),c=o(91421);const u=e=>{let{alertId:t,alertName:o,nodeIds:r=[]}=e;const i=(0,l.Zp)(),{setState:u}=(0,c.$h)(),[p]=(0,a.Ay)(),{name:h}=(0,s.JL)(t),x=o||h,{isParent:m}=(0,d.xY)(r[0]),{loaded:f,value:g,hasError:w,error:b}=(0,c.wd)({node:{value:r[0],isParent:m},path:"/health"}),y=!!g?.tree?.["/health/alerts/prototypes"]?.[`health:alert:prototype:${x}`],[,k]=(0,c.PJ)();return{canEdit:f&&!w&&y,goToEdit:(0,n.useCallback)((e=>{r=e?Array.from(new Set([e,...r])):r,u({alertName:x,isAlert:!0}),k(!0,{nodeId:r[0]})}),[x,r,p,u,i]),error:b?.errorMessage||b}},p=()=>{const e=(0,l.Zp)(),{slug:t}=(0,i.ap)(),o=(0,r.rI)();return(0,n.useCallback)((n=>{n&&(o((e=>({...e,dyncfgSearchTerm:n}))),e(`/spaces/${t}/settings/configurations`,{replace:!0}))}),[e,o,t])}}}]);