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: //proc/self/root/opt/netdata/netdata-web-files/v3/2948.8bc96baf9b519f8fdced.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:"8922de3783e88f1cd90ca2031b9812542c125fed"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7065a26e-989b-4b64-9792-66b0b5fe7d20",e._sentryDebugIdIdentifier="sentry-dbid-7065a26e-989b-4b64-9792-66b0b5fe7d20")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[2948],{22948(e,t,a){a.r(t),a.d(t,{default:()=>K});var s=a(78904),r=a(77148),i=a(96540),o=a(52035),l=a(34843),n=a(18790),c=a(25316),d=a(24609),u=a(91130),h=a(15505);const f=(e,t)=>e&&t?u.A.post(`/api/v2/spaces/${e}/notifications`,t,{transform:h.bn}):Promise.resolve({data:{}});var y=a(57377);const b=(0,o.eU)(0),g=(0,n.I)(e=>{let{spaceId:t}=e;return(0,o.eU)(e=>(e(b),(e=>e?u.A.get(`/api/v2/spaces/${e}/notifications`,{transform:h.bn}):Promise.resolve({data:{}}))(t)))},y.Ay),p=()=>{const e=(0,d.vt)(),t=(0,l.md)((0,c.A)(g({spaceId:e}))),a=(0,l.Xr)(b),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}},m=()=>{const e=(0,d.vt)();return(0,i.useCallback)(t=>function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e&&t.length?u.A.delete(`/api/v2/spaces/${e}/notifications`,{data:t}):Promise.resolve({data:{}})}(e,t),[e])};var x=a(55093),v=a(29022),A=a(74848);const j={missingCanReadNotifications:"You don't have permissions to view this page",default:"Something went wrong"},D=e=>{let{error:t}=e;const{errorMessage:a,errorMsgKey:r}=t||{},i=j[r]||a||j.default;return(0,A.jsx)(v.A,{title:"Error",children:(0,A.jsx)(s.TextBig,{children:i})})};a(98992),a(72577);var I=a(64903),T=a(99728),C=a(63872),w=a(94404);const k=(0,w.A)(s.Button),S=e=>{let{notifications:t,refresh:a,startLoading:r,stopLoading:o}=e;const{defaultReachabilityDelay:l,settings:n}=t||{},c=n.find(e=>{let{roomID:t}=e;return null===t}),{id:u,reachabilityDelay:h}=c||{},y=h&&h!==l,b=(()=>{const e=(0,d.vt)();return(0,i.useCallback)(t=>f(e,[{reachabilityDelay:t}]),[e])})(),g=m(),p=(0,T.JT)("space:NotificationsManage"),[x,v]=(0,C.A)(),j=(0,i.useCallback)(e=>{r(),b(e).then(()=>{x({header:"Success",text:"Successfully updated space delay"}),a()}).catch(v).finally(o)},[b,a,r,o,x,v]),D=(0,i.useCallback)(()=>{u&&(r(),g([u]).then(()=>{x({header:"Success",text:"Successfully reset space delay"}),a()}).catch(v).finally(o))},[u,g,a,r,o,x,v]);return(0,A.jsxs)(s.Flex,{gap:2,alignItems:"end",children:[(0,A.jsx)(I.A,{value:null!==h&&void 0!==h?h:l,onChange:j,disabled:!p,disabledTooltip:"You don't have permissions to edit this value",testId:"space-reachability-delay-selector"}),y?(0,A.jsx)(k,{label:"Reset to Netdata's default delay",icon:"refresh",flavour:"borderless",textTransform:"",style:{height:"28px"},onClick:D,disabled:!p,payload:{testId:"space-reachability-delay-selector"}}):null]})};var L=a(63950),R=a.n(L),M=(a(81454),a(49916));const E=[{id:"name",accessor:"name",header:"Room",cell:e=>{let{getValue:t}=e;return(0,A.jsx)(s.Flex,{alignItems:"center",children:(0,A.jsx)(s.Text,{children:t()})})}},{id:"reachabilityDelay",accessor:"reachabilityDelay",header:"Delay",cell:e=>{let{row:t,getValue:a}=e;const r=a(),o=t.original.id,{refresh:l}=p(),n=(()=>{const e=(0,d.vt)();return(0,i.useCallback)((t,a)=>f(e,[{roomID:t,reachabilityDelay:a}]),[e])})(),c=(0,T.JT)("space:NotificationsManage"),[u,h]=(0,C.A)(),y=(0,i.useCallback)(e=>{n(o,e).then(()=>{u({header:"Success",text:"Successfully updated delay"}),l()}).catch(h)},[o,n,l,u,h]);return(0,A.jsx)(s.Flex,{alignItems:"center",children:(0,A.jsx)(I.A,{value:r,onChange:y,disabled:!c,disabledTooltip:"You don't have permissions to edit this value",testId:"room-reachability-delay-selector"})})}}],N=()=>{const{value:e,refresh:t}=p(),{defaultReachabilityDelay:a,settings:s}=e||{},r=s.find(e=>{let{roomID:t}=e;return null==t}),{reachabilityDelay:o}=r||{},l=(0,M.DL)(),n=(0,i.useMemo)(()=>l.map(e=>{const t=s.find(t=>{let{roomID:a}=t;return a==e.id}),r=t?.reachabilityDelay||o||a,i=t?.id;return{...e,settingId:i,reachabilityDelay:r}}),[l,a,s]),c=m(),d=(0,T.JT)("space:NotificationsManage"),[u,h]=(0,C.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:E,rowActions:f}};a(54520);const _=(0,w.A)(s.Button),Y=e=>{let{notifications:t,refresh:a,startLoading:s,stopLoading:r}=e;const{settings:o}=t||{},l=(0,i.useMemo)(()=>o.filter(e=>{let{roomID:t}=e;return null!=t}),[o]),n=!!l.length,c=m(),d=(0,T.JT)("space:NotificationsManage"),u=(0,i.useMemo)(()=>!d||!n,[d,n]),[h,f]=(0,C.A)(),y=(0,i.useCallback)(()=>{const e=l.map(e=>{let{id:t}=e;return t});s(),c(e).then(()=>{h({header:"Success",text:"Successfully reset space delay"}),a()}).catch(f).finally(r)},[l,s,c,h,a,f,r]);return(0,A.jsx)(_,{flavour:"borderless",label:"Reset all to space default",icon:"refresh",disabled:u,onClick:y})},F=e=>{let{notifications:t,refresh:a,startLoading:r,stopLoading:i}=e;const{data:o,columns:l,rowActions:n}=N({notifications:t});return(0,A.jsx)(s.Table,{data:o,dataColumns:l,rowActions:n,onSearch:R(),headerChildren:(0,A.jsx)(Y,{notifications:t,refresh:a,startLoading:r,stopLoading:i})})};var J=a(6304),P=a(76375),B=a(62927),$=a(60908);const K=()=>{const[e,,t,a]=(0,J.A)(),{loaded:i,value:o,hasError:l,error:n,refresh:c}=p(),{loaded:d,isPaid:u}=(0,P.A)(),h=(0,T.JT)("space:NotificationsRead");return!i||e?(0,A.jsx)(x.A,{height:"calc(100% - 97px)"}):l?(0,A.jsx)(D,{error:n}):h?(0,A.jsx)($.Ay,{tab:"Notifications::Reachability",children:(0,A.jsxs)(s.Flex,{column:!0,"data-testid":"reachability-notifications-container",gap:4,height:"100%",width:"100%",margin:[3,0],padding:[2,4],children:[(0,A.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,A.jsx)(B.A,{}):null,(0,A.jsx)(S,{notifications:o,refresh:c,startLoading:t,stopLoading:a}),(0,A.jsx)(r.A,{}),(0,A.jsx)(s.Flex,{height:"calc(100vh - 320px)",overflow:{vertical:"auto"},children:(0,A.jsx)(F,{notifications:o,refresh:c,startLoading:t,stopLoading:a})})]})}):(0,A.jsx)(D,{error:{errorMsgKey:"missingCanReadNotifications"}})}}}]);