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