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.97100a2f75bd19b7e409.chunk.js
try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},a=(new e.Error).stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="67a64a85-2f4c-4b1d-9442-881a5eae0b8b",e._sentryDebugIdIdentifier="sentry-dbid-67a64a85-2f4c-4b1d-9442-881a5eae0b8b")}()}catch(e){}!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"d29fe0107f7247ab49a8017c886bc1ba13e7faa8"}}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[2948],{22948:(e,a,t)=>{t.r(a),t.d(a,{default:()=>$});var s=t(86177),o=t(77148),i=t(96540),l=t(52035),r=t(34843),n=t(84929),c=t(24609),d=t(91130),u=t(15505);const h=(e,a)=>e&&a?d.A.post(`/api/v2/spaces/${e}/notifications`,a,{transform:u.bn}):Promise.resolve({data:{}});var f=t(57377);const y=(0,l.eU)(0),b=(0,n.Iz)((e=>{let{spaceId:a}=e;return(0,l.eU)((e=>(e(y),(e=>e?d.A.get(`/api/v2/spaces/${e}/notifications`,{transform:u.bn}):Promise.resolve({data:{}}))(a))))}),f.Ay),g=()=>{const e=(0,c.vt)(),a=(0,r.md)((0,n.Rq)(b({spaceId:e}))),t=(0,r.Xr)(y),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}},p=()=>{const e=(0,c.vt)();return(0,i.useCallback)((a=>function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e&&a.length?d.A.delete(`/api/v2/spaces/${e}/notifications`,{data:a}):Promise.resolve({data:{}})}(e,a)),[e])};var m=t(55093),x=t(29022),v=t(74848);const A={missingCanReadNotifications:"You don't have permissions to view this page",default:"Something went wrong"},j=e=>{let{error:a}=e;const{errorMessage:t,errorMsgKey:o}=a||{},i=A[o]||t||A.default;return(0,v.jsx)(x.A,{title:"Error",children:(0,v.jsx)(s.TextBig,{children:i})})};t(98992),t(72577);var D=t(64903),I=t(99728),T=t(63872),w=t(94404);const C=(0,w.A)(s.Button),k=e=>{let{notifications:a,refresh:t,startLoading:o,stopLoading:l}=e;const{defaultReachabilityDelay:r,settings:n}=a||{},d=n.find((e=>{let{roomID:a}=e;return null===a})),{id:u,reachabilityDelay:f}=d||{},y=f&&f!==r,b=(()=>{const e=(0,c.vt)();return(0,i.useCallback)((a=>h(e,[{reachabilityDelay:a}])),[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"}),t()})).catch(A).finally(l)}),[b,t,o,l,x,A]),w=(0,i.useCallback)((()=>{u&&(o(),g([u]).then((()=>{x({header:"Success",text:"Successfully reset space delay"}),t()})).catch(A).finally(l))}),[u,g,t,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=t(63950),L=t.n(S),R=(t(81454),t(49916));const M=[{id:"name",accessor:"name",header:"Room",cell:e=>{let{getValue:a}=e;return(0,v.jsx)(s.Flex,{alignItems:"center",children:(0,v.jsx)(s.Text,{children:a()})})}},{id:"reachabilityDelay",accessor:"reachabilityDelay",header:"Delay",cell:e=>{let{row:a,getValue:t}=e;const o=t(),l=a.original.id,{refresh:r}=g(),n=(()=>{const e=(0,c.vt)();return(0,i.useCallback)(((a,t)=>h(e,[{roomID:a,reachabilityDelay:t}])),[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:a}=g(),{defaultReachabilityDelay:t,settings:s}=e||{},o=s.find((e=>{let{roomID:a}=e;return null==a})),{reachabilityDelay:l}=o||{},r=(0,R.DL)(),n=(0,i.useMemo)((()=>r.map((e=>{const a=s.find((a=>{let{roomID:t}=a;return t==e.id})),o=a?.reachabilityDelay||l||t,i=a?.id;return{...e,settingId:i,reachabilityDelay:o}}))),[r,t,s]),c=p(),d=(0,I.JT)("space:NotificationsManage"),[u,h]=(0,T.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:M,rowActions:f}};t(54520);const N=(0,w.A)(s.Button),_=e=>{let{notifications:a,refresh:t,startLoading:s,stopLoading:o}=e;const{settings:l}=a||{},r=(0,i.useMemo)((()=>l.filter((e=>{let{roomID:a}=e;return null!=a}))),[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:a}=e;return a}));s(),c(e).then((()=>{h({header:"Success",text:"Successfully reset space delay"}),t()})).catch(f).finally(o)}),[r,s,c,h,t,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:a,refresh:t,startLoading:o,stopLoading:i}=e;const{data:l,columns:r,rowActions:n}=E({notifications:a});return(0,v.jsx)(s.Table,{data:l,dataColumns:r,rowActions:n,onSearch:L(),headerChildren:(0,v.jsx)(_,{notifications:a,refresh:t,startLoading:o,stopLoading:i})})};var F=t(6304),J=t(76375),P=t(60670),B=t(60908);const $=()=>{const[e,,a,t]=(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:a,stopLoading:t}),(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:a,stopLoading:t})})]})}):(0,v.jsx)(j,{error:{errorMsgKey:"missingCanReadNotifications"}})}}}]);