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.3ab2d7773ea332edf006.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:"b06348a4787b660201b18f5fa878e4faccd4b679"};var a=(new e.Error).stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="ddd3e480-c1fd-4a54-ae5f-b2563d760efe",e._sentryDebugIdIdentifier="sentry-dbid-ddd3e480-c1fd-4a54-ae5f-b2563d760efe")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[2948],{22948(e,a,t){t.r(a),t.d(a,{default:()=>K});var s=t(38429),r=t(77148),i=t(96540),o=t(52035),l=t(34843),n=t(18790),c=t(25316),d=t(24609),u=t(91130),h=t(15505);const f=(e,a)=>e&&a?u.A.post(`/api/v2/spaces/${e}/notifications`,a,{transform:h.bn}):Promise.resolve({data:{}});var y=t(57377);const g=(0,o.eU)(0),b=(0,n.I)(e=>{let{spaceId:a}=e;return(0,o.eU)(e=>(e(g),(e=>e?u.A.get(`/api/v2/spaces/${e}/notifications`,{transform:h.bn}):Promise.resolve({data:{}}))(a)))},y.Ay),p=()=>{const e=(0,d.vt)(),a=(0,l.md)((0,c.A)(b({spaceId:e}))),t=(0,l.Xr)(g),s=(0,i.useCallback)(()=>t(e=>e+1),[t]);return{loaded:"loading"!==a.state,value:a.data?.data,hasError:"hasError"===a.state,error:"hasError"===a.state?a.error?.response?.data:null,refresh:s}},m=()=>{const e=(0,d.vt)();return(0,i.useCallback)(a=>function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e&&a.length?u.A.delete(`/api/v2/spaces/${e}/notifications`,{data:a}):Promise.resolve({data:{}})}(e,a),[e])};var x=t(55093),v=t(29022),A=t(74848);const j={missingCanReadNotifications:"You don't have permissions to view this page",default:"Something went wrong"},D=e=>{let{error:a}=e;const{errorMessage:t,errorMsgKey:r}=a||{},i=j[r]||t||j.default;return(0,A.jsx)(v.A,{title:"Error",children:(0,A.jsx)(s.TextBig,{children:i})})};t(98992),t(72577);var I=t(64903),T=t(99728),C=t(63872),w=t(94404);const k=(0,w.A)(s.Button),S=e=>{let{notifications:a,refresh:t,startLoading:r,stopLoading:o}=e;const{defaultReachabilityDelay:l,settings:n}=a||{},c=n.find(e=>{let{roomID:a}=e;return null===a}),{id:u,reachabilityDelay:h}=c||{},y=h&&h!==l,g=(()=>{const e=(0,d.vt)();return(0,i.useCallback)(a=>f(e,[{reachabilityDelay:a}]),[e])})(),b=m(),p=(0,T.JT)("space:NotificationsManage"),[x,v]=(0,C.A)(),j=(0,i.useCallback)(e=>{r(),g(e).then(()=>{x({header:"Success",text:"Successfully updated space delay"}),t()}).catch(v).finally(o)},[g,t,r,o,x,v]),D=(0,i.useCallback)(()=>{u&&(r(),b([u]).then(()=>{x({header:"Success",text:"Successfully reset space delay"}),t()}).catch(v).finally(o))},[u,b,t,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=t(63950),R=t.n(L),M=(t(81454),t(49916));const E=[{id:"name",accessor:"name",header:"Room",cell:e=>{let{getValue:a}=e;return(0,A.jsx)(s.Flex,{alignItems:"center",children:(0,A.jsx)(s.Text,{children:a()})})}},{id:"reachabilityDelay",accessor:"reachabilityDelay",header:"Delay",cell:e=>{let{row:a,getValue:t}=e;const r=t(),o=a.original.id,{refresh:l}=p(),n=(()=>{const e=(0,d.vt)();return(0,i.useCallback)((a,t)=>f(e,[{roomID:a,reachabilityDelay:t}]),[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:a}=p(),{defaultReachabilityDelay:t,settings:s}=e||{},r=s.find(e=>{let{roomID:a}=e;return null==a}),{reachabilityDelay:o}=r||{},l=(0,M.DL)(),n=(0,i.useMemo)(()=>l.map(e=>{const a=s.find(a=>{let{roomID:t}=a;return t==e.id}),r=a?.reachabilityDelay||o||t,i=a?.id;return{...e,settingId:i,reachabilityDelay:r}}),[l,t,s]),c=m(),d=(0,T.JT)("space:NotificationsManage"),[u,h]=(0,C.A)(),f=(0,i.useMemo)(()=>({addRule:{handleAction:e=>{const{settingId:t}=e;t&&c([t]).then(()=>{u({header:"Success",text:"Successfully reset delay"}),a()}).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,a]);return{data:n,columns:E,rowActions:f}};t(54520);const _=(0,w.A)(s.Button),Y=e=>{let{notifications:a,refresh:t,startLoading:s,stopLoading:r}=e;const{settings:o}=a||{},l=(0,i.useMemo)(()=>o.filter(e=>{let{roomID:a}=e;return null!=a}),[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:a}=e;return a});s(),c(e).then(()=>{h({header:"Success",text:"Successfully reset space delay"}),t()}).catch(f).finally(r)},[l,s,c,h,t,f,r]);return(0,A.jsx)(_,{flavour:"borderless",label:"Reset all to space default",icon:"refresh",disabled:u,onClick:y})},F=e=>{let{notifications:a,refresh:t,startLoading:r,stopLoading:i}=e;const{data:o,columns:l,rowActions:n}=N({notifications:a});return(0,A.jsx)(s.Table,{data:o,dataColumns:l,rowActions:n,onSearch:R(),headerChildren:(0,A.jsx)(Y,{notifications:a,refresh:t,startLoading:r,stopLoading:i})})};var J=t(6304),P=t(76375),B=t(62927),$=t(60908);const K=()=>{const[e,,a,t]=(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:a,stopLoading:t}),(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:a,stopLoading:t})})]})}):(0,A.jsx)(D,{error:{errorMsgKey:"missingCanReadNotifications"}})}}}]);