MOON
Server: Apache
System: Linux server1.studioinfinity.com.br 2.6.32-954.3.5.lve1.4.90.el6.x86_64 #1 SMP Tue Feb 21 12:26:30 UTC 2023 x86_64
User: artinside (517)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/netdata/usr/share/netdata/web/v3/2948.23047cd2275a924fc437.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]="4f1cb44c-23c1-4751-9a10-0787b6b82bc1",e._sentryDebugIdIdentifier="sentry-dbid-4f1cb44c-23c1-4751-9a10-0787b6b82bc1")}()}catch(e){}!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"90b87a93a48a089118916e8342e7b31e0e561cb5"}}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[2948],{22948:(e,t,a)=>{a.r(t),a.d(t,{default:()=>$});var s=a(63766),o=a(77148),i=a(96540),l=a(52035),r=a(34843),n=a(84929),c=a(24609),d=a(91130),u=a(15505);const h=(e,t)=>e&&t?d.A.post(`/api/v2/spaces/${e}/notifications`,t,{transform:u.bn}):Promise.resolve({data:{}});var f=a(57377);const y=(0,l.eU)(0),b=(0,n.Iz)((e=>{let{spaceId:t}=e;return(0,l.eU)((e=>(e(y),(e=>e?d.A.get(`/api/v2/spaces/${e}/notifications`,{transform:u.bn}):Promise.resolve({data:{}}))(t))))}),f.Ay),g=()=>{const e=(0,c.vt)(),t=(0,r.md)((0,n.Rq)(b({spaceId:e}))),a=(0,r.Xr)(y),s=(0,i.useCallback)((()=>a((e=>e+1))),[a]);return{loaded:"loading"!==t.state,value:t.data?.data,hasError:"hasError"===t.state,error:"hasError"===t.state?t.error?.response?.data:null,refresh:s}},p=()=>{const e=(0,c.vt)();return(0,i.useCallback)((t=>function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e&&t.length?d.A.delete(`/api/v2/spaces/${e}/notifications`,{data:t}):Promise.resolve({data:{}})}(e,t)),[e])};var m=a(55093),x=a(29022),v=a(74848);const A={missingCanReadNotifications:"You don't have permissions to view this page",default:"Something went wrong"},j=e=>{let{error:t}=e;const{errorMessage:a,errorMsgKey:o}=t||{},i=A[o]||a||A.default;return(0,v.jsx)(x.A,{title:"Error",children:(0,v.jsx)(s.TextBig,{children:i})})};a(98992),a(72577);var D=a(64903),I=a(99728),T=a(63872),w=a(94404);const C=(0,w.A)(s.Button),k=e=>{let{notifications:t,refresh:a,startLoading:o,stopLoading:l}=e;const{defaultReachabilityDelay:r,settings:n}=t||{},d=n.find((e=>{let{roomID:t}=e;return null===t})),{id:u,reachabilityDelay:f}=d||{},y=f&&f!==r,b=(()=>{const e=(0,c.vt)();return(0,i.useCallback)((t=>h(e,[{reachabilityDelay:t}])),[e])})(),g=p(),m=(0,I.JT)("space:NotificationsManage"),[x,A]=(0,T.A)(),j=(0,i.useCallback)((e=>{o(),b(e).then((()=>{x({header:"Success",text:"Successfully updated space delay"}),a()})).catch(A).finally(l)}),[b,a,o,l,x,A]),w=(0,i.useCallback)((()=>{u&&(o(),g([u]).then((()=>{x({header:"Success",text:"Successfully reset space delay"}),a()})).catch(A).finally(l))}),[u,g,a,o,l,x,A]);return(0,v.jsxs)(s.Flex,{gap:2,alignItems:"end",children:[(0,v.jsx)(D.A,{value:null!==f&&void 0!==f?f:r,onChange:j,disabled:!m,disabledTooltip:"You don't have permissions to edit this value",testId:"space-reachability-delay-selector"}),y?(0,v.jsx)(C,{label:"Reset to Netdata's default delay",icon:"refresh",flavour:"borderless",textTransform:"",style:{height:"28px"},onClick:w,disabled:!m,payload:{testId:"space-reachability-delay-selector"}}):null]})};var S=a(63950),L=a.n(S),R=(a(81454),a(49916));const M=[{id:"name",accessor:"name",header:"Room",cell:e=>{let{getValue:t}=e;return(0,v.jsx)(s.Flex,{alignItems:"center",children:(0,v.jsx)(s.Text,{children:t()})})}},{id:"reachabilityDelay",accessor:"reachabilityDelay",header:"Delay",cell:e=>{let{row:t,getValue:a}=e;const o=a(),l=t.original.id,{refresh:r}=g(),n=(()=>{const e=(0,c.vt)();return(0,i.useCallback)(((t,a)=>h(e,[{roomID:t,reachabilityDelay:a}])),[e])})(),d=(0,I.JT)("space:NotificationsManage"),[u,f]=(0,T.A)(),y=(0,i.useCallback)((e=>{n(l,e).then((()=>{u({header:"Success",text:"Successfully updated delay"}),r()})).catch(f)}),[l,n,r,u,f]);return(0,v.jsx)(s.Flex,{alignItems:"center",children:(0,v.jsx)(D.A,{value:o,onChange:y,disabled:!d,disabledTooltip:"You don't have permissions to edit this value",testId:"room-reachability-delay-selector"})})}}],E=()=>{const{value:e,refresh:t}=g(),{defaultReachabilityDelay:a,settings:s}=e||{},o=s.find((e=>{let{roomID:t}=e;return null==t})),{reachabilityDelay:l}=o||{},r=(0,R.DL)(),n=(0,i.useMemo)((()=>r.map((e=>{const t=s.find((t=>{let{roomID:a}=t;return a==e.id})),o=t?.reachabilityDelay||l||a,i=t?.id;return{...e,settingId:i,reachabilityDelay:o}}))),[r,a,s]),c=p(),d=(0,I.JT)("space:NotificationsManage"),[u,h]=(0,T.A)(),f=(0,i.useMemo)((()=>({addRule:{handleAction:e=>{const{settingId:a}=e;a&&c([a]).then((()=>{u({header:"Success",text:"Successfully reset delay"}),t()})).catch(h)},icon:"refresh",flavour:"borderless",neutral:!1,isDisabled:e=>!d||!e.settingId,tooltipText:"Reset value",disabledTooltipText:d?"You cannot reset the default value":"You don't have permissions to reset this value",confirmation:!1}})),[d,t]);return{data:n,columns:M,rowActions:f}};a(54520);const N=(0,w.A)(s.Button),_=e=>{let{notifications:t,refresh:a,startLoading:s,stopLoading:o}=e;const{settings:l}=t||{},r=(0,i.useMemo)((()=>l.filter((e=>{let{roomID:t}=e;return null!=t}))),[l]),n=!!r.length,c=p(),d=(0,I.JT)("space:NotificationsManage"),u=(0,i.useMemo)((()=>!d||!n),[d,n]),[h,f]=(0,T.A)(),y=(0,i.useCallback)((()=>{const e=r.map((e=>{let{id:t}=e;return t}));s(),c(e).then((()=>{h({header:"Success",text:"Successfully reset space delay"}),a()})).catch(f).finally(o)}),[r,s,c,h,a,f,o]);return(0,v.jsx)(N,{flavour:"borderless",label:"Reset all to space default",icon:"refresh",disabled:u,onClick:y})},Y=e=>{let{notifications:t,refresh:a,startLoading:o,stopLoading:i}=e;const{data:l,columns:r,rowActions:n}=E({notifications:t});return(0,v.jsx)(s.Table,{data:l,dataColumns:r,rowActions:n,onSearch:L(),headerChildren:(0,v.jsx)(_,{notifications:t,refresh:a,startLoading:o,stopLoading:i})})};var F=a(6304),J=a(76375),P=a(60670),B=a(60908);const $=()=>{const[e,,t,a]=(0,F.A)(),{loaded:i,value:l,hasError:r,error:n,refresh:c}=g(),{loaded:d,isPaid:u}=(0,J.A)(),h=(0,I.JT)("space:NotificationsRead");return!i||e?(0,v.jsx)(m.A,{height:"calc(100% - 97px)"}):r?(0,v.jsx)(j,{error:n}):h?(0,v.jsx)(B.Ay,{tab:"Notifications::Reachability",children:(0,v.jsxs)(s.Flex,{column:!0,"data-testid":"reachability-notifications-container",gap:4,height:"100%",width:"100%",margin:[3,0],padding:[2,4],children:[(0,v.jsx)(s.Text,{children:"Set delay for all reachability notifications for this space. The delay is automatically applied to all rooms, but you can also manually set specific delays for each room separately."}),d&&!u?(0,v.jsx)(P.A,{}):null,(0,v.jsx)(k,{notifications:l,refresh:c,startLoading:t,stopLoading:a}),(0,v.jsx)(o.A,{}),(0,v.jsx)(s.Flex,{height:"calc(100vh - 320px)",overflow:{vertical:"auto"},children:(0,v.jsx)(Y,{notifications:l,refresh:c,startLoading:t,stopLoading:a})})]})}):(0,v.jsx)(j,{error:{errorMsgKey:"missingCanReadNotifications"}})}}}]);