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/9163.45804e64bfc2a3b6c2f5.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:"0725d67f2585acd82a0d73d488b6cd9060c3224d"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="37051008-43f5-407c-8975-6d01d988bbd8",e._sentryDebugIdIdentifier="sentry-dbid-37051008-43f5-407c-8975-6d01d988bbd8")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[9163],{29163(e,t,l){l.r(t),l.d(t,{default:()=>ue});var n=l(96540),a=l(78904),s=l(79748),o=l(98563),r=l(74848);const i=e=>{let{title:t,description:l}=e;return(0,r.jsxs)(a.Flex,{column:!0,gap:1,padding:[2],children:[(0,r.jsx)(a.TextBig,{children:t}),(0,r.jsx)(a.Text,{color:"textLite",children:l})]})},d=e=>{let{children:t,...l}=e;return(0,r.jsx)(a.Flex,{column:!0,gap:3,width:"100%",padding:[0,2],overflow:{vertical:"auto"},...l,children:t})};l(98992),l(81454);var c=l(63950),u=l.n(c),h=l(45087),p=l(37437),g=l(74891);const m=(0,g.A)(a.Flex),b=e=>{let{scope:t,setScope:l=u(),isDisabled:n,...s}=e;return(0,r.jsx)(m,{gap:3,...s,children:Object.entries(p.Wu).map(e=>{let[s,{text:o,tooltip:i}]=e;return(0,r.jsx)(a.RadioButton,{checked:s===t,onChange:()=>l(s),disabled:n,tooltip:"Test",children:(0,r.jsx)(h.A,{content:i,align:"bottom",children:(0,r.jsx)(a.Text,{color:"textDescription",children:o})})},s)})})};l(74423),l(54520),l(72577),l(8872);var x=l(76667),C=l(89942),v=l(46587),j=l(99728),f=l(24609),A=l(10602),R=l(49635),S=l(81391),I=l(30811),L=l(92068),O=l(52035),k=l(34843),N=l(18790),y=l(25316),E=l(1705);const D=(0,N.I)(e=>(0,O.eU)(()=>(0,E.z5)(e)));var H=l(19075),w=l(41258),M=l(76571),P=l(11409),T=l(89544),F=l(6304),_=l(63872);const B={name:"",rooms:[],nodes:[],hostLabels:null,alertNames:[],alertContexts:[],alertRoles:[],integrationIds:[],startsAt:null,lastsUntil:null,rrule:null,rruleState:{}},U=e=>{let{id:t,name:l,...n}=e;return{label:l,value:t,...n}},V=e=>({label:e,value:e}),$=(e,t)=>{let{rooms:l,nodes:n,hostLabels:a,startsAt:s,lastsUntil:o,...r}=e;return{...r,scope:t?r.accountId?"personal":p._V:"personal",canSubmit:!!r?.name?.length,rooms:l?.length?l.map(U):[R.PT],...n?.length?{nodes:n.map(U).filter(e=>{let{notAvailable:t}=e;return!t})}:{},...a?{hostLabels:a}:{},...s?{startsAt:s}:{},...o?{lastsUntil:o}:{}}},z=e=>{let{value:t}=e;return t},J=[{label:"CRITICAL",value:"CRITICAL"},{label:"WARNING",value:"WARNING"},{label:"CLEAR",value:"CLEAR"}],W=e=>{let{rule:t,onClose:l,isEdit:a}=e;const s=(0,v.NJ)(),o=(0,j.JT)("space:CreateSystemSilencingRule"),r=(0,j.JT)("space:CreatePersonalSilencingRule"),i=(0,x.Zp)(),d=(0,f.bq)(),[c,u]=(0,F.A)(),h=(0,S.A)({all:!0}),g=h.find(e=>{let{label:t}=e;return"All nodes"===t})?.value,{loaded:m,value:b,hasError:R}=(()=>{const e=(0,f.vt)(),t=(0,k.md)((0,y.A)(D(e)));return{loaded:"loading"!==t.state,value:t.data?.data||E.rx,hasError:"hasError"===t.state}})(),O=(0,L._B)(),N=(0,L.FU)(),U=a?N:O,W=(0,I.l)(),G=(0,L.Lz)(),[,,K]=(0,_.A)(),[Y,Z]=(0,n.useState)({alertNameOptions:[],alertContextOptions:[],alertRoleOptions:[]}),{alertNameOptions:q,alertContextOptions:Q,alertRoleOptions:X}=Y,ee=(0,f.vt)();(0,w.A)(ee,"modal");const[te,le]=(0,n.useState)([]),{loaded:ne,loading:ae,channels:se,error:oe}=(0,M.t5)(ee);(0,n.useEffect)(()=>{if(!ae&&ne&&!oe){const e=se.reduce((e,t)=>{let{enabled:l,name:n,integration:a}=t;return[...e,...l?[{value:a.id,label:`${n||""} (${a.title})`}]:[]]},[]);le(e)}},[ae,ne,se,oe,le]);const re=(0,n.useCallback)(()=>({...B,...$(t,o)}),[t,o]),[ie,de]=(0,n.useState)(re),[ce,ue]=(0,n.useState)([]),{loaded:he,value:pe}=(0,H.I8)({alertNames:ie.alertNames,contexts:ie.alertContexts,allowEmptyName:!0});(0,n.useEffect)(()=>{const e=(pe||[]).filter(e=>!((ie.alertNames||[]).length&&!ie.alertNames.includes(e.name))&&(!((ie.alertContexts||[]).length&&!ie.alertContexts.includes(e.context))&&!((ie.nodeIds||[]).length&&!ie.nodeIds.includes(e.nodeId)))).map(e=>{let{instance:t,instanceName:l}=e;return{value:t,label:l}});ue(e)},[he,pe,ie.alertNames,ie.alertContexts,ie.nodeIds]);const ge=(0,A.vv)(ie.roomIds||[g]),me=(0,n.useCallback)(e=>de(t=>({...t,scope:e})),[de]),be=(0,n.useCallback)(e=>de(t=>({...t,name:e,canSubmit:!!e?.length})),[de]),xe=(0,n.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const l=(e=>e.length<=1?e:e[e.length-1].value===p.jH.value?[p.jH]:e.filter(e=>{let{value:t}=e;return!!t}))(e),n=l.map(e=>{let{value:t}=e;return t||g}),a=t.length<l.length?l.filter(e=>{let{value:l}=e;return!t.includes(l)})[0]:null;de(e=>({...e,rooms:l,roomIds:n,lastRoomAdded:a||null}))},[g,de]),Ce=(0,n.useCallback)(e=>de(t=>({...t,nodeIds:e.map(e=>{let{value:t}=e;return t}),nodes:e})),[de]),ve=(0,n.useCallback)(e=>de(t=>({...t,hostLabels:{...t.hostLabels,...e}})),[de]),je=(0,n.useCallback)(e=>de(t=>{const l={...t.hostLabels};return delete l[e],{...t,hostLabels:l}}),[de]),fe=(0,n.useCallback)(e=>t=>de(l=>({...l,[e]:t.map(e=>{let{value:t}=e;return t})})),[de]),Ae=(0,n.useCallback)(e=>de(t=>({...t,integrationIds:e.map(e=>{let{value:t}=e;return t})})),[de]),Re=(0,n.useCallback)(e=>{let{start:t,end:l}=e;de(e=>({...e,startsAt:t,lastsUntil:l}))},[de]),Se=(0,n.useCallback)(e=>{de(t=>({...t,rrule:e}))},[de]),Ie=(0,n.useCallback)(()=>{u(),U(((e,t)=>{const{scope:l,rooms:n,nodes:a,hostLabels:s,startsAt:o,lastsUntil:r,rrule:i,rruleText:d,canSubmit:c,...u}=e,h=n.filter(e=>{let{value:t}=e;return t!==p.jH.value}).map(z),g=a.map(z),m=!!Object.keys(s||{}).length;return{...u,..."personal"===l?{account_id:t}:{},...h.length?{room_ids:h}:{},...g.length?{node_ids:g}:{},...m?{host_labels:s}:{},starts_at:new Date(o).toISOString(),...r?{lasts_until:new Date(r).toISOString()}:{},...i?{rrule:"string"===typeof i?i:i.toString()}:{}}})(ie,s)).then(()=>{l(),G(),W()}).catch(e=>K((0,P.H)(e))).finally(u)},[ie,s]),Le=(0,T.A)();(0,n.useEffect)(()=>{const e=ie.lastRoomAdded?.value||g;let t=null;return e&&(t=Le(e)),()=>!!t?.cancel&&t.cancel()},[ie.roomIds,Le]),(0,n.useEffect)(()=>{if(m){const{contexts:e,names:t,roles:l}=b||{};Z({alertNameOptions:t?t.map(V):[],alertContextOptions:e?e.map(V):[],alertRoleOptions:l?l.map(V):[]})}},[m]),(0,n.useEffect)(()=>{const e=(0,C.PP)(),t=(()=>{const{silencingRulePrefill:e}=(0,C.PP)();if(!e)return{};let t={};try{t=JSON.parse(e)}catch{}return t})(),{alertName:l,nodeId:n,context:a,instance:s,roomId:o}=t;if(o){const e=h.filter(e=>{let{value:t}=e;return t===o});e&&xe(e)}if((l||a||s)&&de(e=>({...e,...l?{alertNames:[l]}:{},...a?{alertContexts:[a]}:{},...s?{alertInstances:[s]}:{}})),n){const e=ge.filter(e=>{let{value:t}=e;return t===n});e&&Ce(e)}(0,C.Z8)({...e,silencingRulePrefill:""})},[de,Ce,h,ge]);const Oe=(0,n.useCallback)(()=>i(`/spaces/${d}/settings/billing`),[d,i]);return{state:ie,onScopeChange:me,onRuleNameChange:be,onRoomsSelectionChange:xe,roomOptions:h,onNodesSelectionChange:Ce,nodesOptions:ge,alertMetasLoaded:m,alertMetas:b,alertNameOptions:q,alertContextOptions:Q,alertInstancesEnabled:!0,alertInstancesOptions:ce,alertRoleOptions:X,alertStatusOptions:J,channelsOptions:te,alertMetasError:R,onAlertValueChange:fe,onIntegrationsValueChange:Ae,onAddHostLabel:ve,onRemoveHostLabel:je,onDatesChange:Re,onRRuleChange:Se,loading:c,onSave:Ie,canCreateSystemRule:o,canCreatePersonalRule:r,onUpdateButtonClick:Oe}};var G=l(77148),K=l(80320);l(33110);const Y=e=>{let{selectedKey:t,selectedValue:l,onAddHostLabel:s=u(),onRemoveHostLabel:o=u(),isDefault:i=!1,showPlaceholder:d=u(),isDisabled:c}=e;const[p,g]=(0,n.useState)(t||""),[m,b]=(0,n.useState)(l||""),x=()=>{p&&m&&(s({[p]:m}),d())};return(0,r.jsxs)(a.Flex,{gap:2,children:[(0,r.jsx)(K.A,{component:"input",onChange:g,onBlur:x,placeholder:"Host key",value:p,disabled:c||!i}),(0,r.jsx)(K.A,{component:"input",onChange:b,onBlur:x,placeholder:"Host value",value:m,disabled:c||!i||!p}),i?(0,r.jsx)(h.A,{content:"Save label pair",align:"bottom",children:(0,r.jsx)(a.Button,{flavour:"borderless",disabled:!p||!m,children:(0,r.jsx)(a.Icon,{name:"check",color:"primary",size:"small"})})}):(0,r.jsx)(h.A,{content:"Remove label pair",align:"bottom",children:(0,r.jsx)(a.Button,{flavour:"borderless",onClick:()=>o(t),children:(0,r.jsx)(a.Icon,{name:"x",color:"primary",size:"small"})})})]})},Z=e=>{let{hostLabels:t,onAddHostLabel:l,onRemoveHostLabel:n}=e;return Object.entries(t).map(e=>{let[t,a]=e;return(0,r.jsx)(Y,{onAddHostLabel:l,selectedKey:t,selectedValue:a,onRemoveHostLabel:n},t)})},q=e=>{let{hostLabels:t,onAddHostLabel:l=u(),onRemoveHostLabel:n=u(),isEdit:s,isDisabled:o}=e;const i=!!Object.entries(t||{}).length,[d,,c]=(0,F.A)(!1);return(0,r.jsxs)(a.Flex,{column:!0,children:[(0,r.jsx)(a.Text,{color:"textLite",children:"Host labels"}),i&&(0,r.jsx)(Z,{hostLabels:t,onAddHostLabel:l,onRemoveHostLabel:n}),(!i||d)&&(0,r.jsx)(Y,{onAddHostLabel:l,isDefault:!0,showPlaceholder:c,isDisabled:o},JSON.stringify(t)),s&&!d&&i&&(0,r.jsx)(a.Flex,{justifyContent:"end",children:(0,r.jsx)(a.Button,{flavour:"borderless",onClick:c,children:"Add host label"})})]})},Q=e=>{let{content:t="Loading alerts..."}=e;return(0,r.jsx)(a.Flex,{height:45,alignItems:"center",justifyContent:"center",children:(0,r.jsx)(a.Text,{children:t})})},X=e=>e?.length?e.map(V):[],ee=e=>{let{state:t,isEdit:l,alertMetasLoaded:s,canCreatePersonalRule:o,channelsOptions:i,roomOptions:d,nodesOptions:c,alertStatusOptions:u,alertNameOptions:h,alertContextOptions:p,alertInstancesOptions:g,alertRoleOptions:m,alertInstancesEnabled:b,onRuleNameChange:x,onRoomsSelectionChange:C,onNodesSelectionChange:v,onAddHostLabel:j,onRemoveHostLabel:f,onAlertValueChange:A,onIntegrationsValueChange:R}=e;const S=(0,n.useCallback)(()=>i.filter(e=>{let{value:l}=e;return t.integrationIds.includes(l)}),[t.integrationIds,i]);return(0,r.jsxs)(a.Flex,{"data-testid":"silencing-rules-modal-criteria-container",column:!0,gap:3,children:[(0,r.jsx)(K.A,{component:"input",onChange:x,placeholder:"Add rule name",title:"Rule name*",value:t.name,disabled:!o}),(0,r.jsx)(K.A,{component:"select",isMulti:!0,onChange:e=>C(e,t.roomIds),options:d,placeholder:"Select rooms",title:"Rooms*",value:t.rooms,isDisabled:!o}),(0,r.jsx)(K.A,{component:"select",isMulti:!0,onChange:v,options:c,placeholder:"Select nodes",title:"Nodes",value:t.nodes,isDisabled:!o||!c.length}),(0,r.jsx)(q,{hostLabels:t.hostLabels,onAddHostLabel:j,onRemoveHostLabel:f,isEdit:l,isDisabled:!o}),s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(G.A,{}),(0,r.jsx)(K.A,{component:"select",isMulti:!0,onChange:A("alertNames"),options:h,placeholder:"Select alert name",title:"Alert name",value:X(t.alertNames),isDisabled:!o}),(0,r.jsx)(K.A,{component:"select",isMulti:!0,onChange:A("alertContexts"),options:p,placeholder:"Select alert context",title:"Alert context",value:X(t.alertContexts),isDisabled:!o}),(0,r.jsx)(K.A,{component:"select",isMulti:!0,onChange:A("alertInstances"),options:g,placeholder:"Select alert instance",title:"Alert instance",value:X(t.alertInstances),isDisabled:!o||!b}),(0,r.jsx)(K.A,{component:"select",isMulti:!0,onChange:A("severities"),options:u,placeholder:"Select alert status",title:"Alert status",value:X(t.severities),isDisabled:!o}),(0,r.jsx)(K.A,{component:"select",isMulti:!0,onChange:A("alertRoles"),options:m,placeholder:"Select alert role",title:"Alert role",value:X(t.alertRoles),isDisabled:!o}),(0,r.jsx)(K.A,{component:"select",isMulti:!0,onChange:R,options:i,placeholder:"Select notification methods",title:"Notification Methods",value:S(),isDisabled:!o})]}):(0,r.jsx)(Q,{})]})};var te=l(82821),le=l(12678),ne=l(62927),ae=l(36710);const se=()=>{const e=(0,f.vt)();return(0,n.useCallback)(t=>(0,ae.O$)(e,t),[e])};var oe=l(94404),re=l(60908);const ie=(0,g.A)((0,oe.A)(a.Button)),de="90vh",ce=`calc(${de} - 190px)`,ue=e=>{let{rule:t={},onClose:l,isEdit:c}=e;const{state:u,onScopeChange:h,onRuleNameChange:p,onRoomsSelectionChange:g,roomOptions:m,onNodesSelectionChange:x,nodesOptions:C,alertMetasLoaded:v,alertNameOptions:j,alertContextOptions:f,alertInstancesEnabled:A,alertInstancesOptions:R,alertRoleOptions:S,alertStatusOptions:I,channelsOptions:L,onAlertValueChange:O,onIntegrationsValueChange:k,onAddHostLabel:N,onRemoveHostLabel:y,onDatesChange:E,onRRuleChange:D,loading:H,onSave:w,canCreateSystemRule:M,canCreatePersonalRule:P,onUpdateButtonClick:T}=W({rule:t,onClose:l,isEdit:c}),F=se(),_=(0,n.useMemo)(()=>`${c?"Edit":"Add"} silencing rule`,[c]);return(0,r.jsx)(a.Modal,{onEsc:l,backdropProps:{backdropBlur:!0},children:(0,r.jsx)(re.Ay,{feature:"silencingRuleModal",children:(0,r.jsxs)(o.$m,{width:{base:"90vw",max:"1600px"},height:de,children:[(0,r.jsxs)(a.ModalHeader,{column:!0,gap:1,children:[(0,r.jsxs)(a.Flex,{alignItems:"center",justifyContent:"between",children:[(0,r.jsx)(a.TextBig,{children:_}),l&&(0,r.jsx)(o.Oj,{onClose:l})]}),(0,r.jsxs)(a.Text,{lineHeight:1.5,children:["Define an alert notification silencing rule that will apply to all users or just you."," ",(0,r.jsx)(s.A,{"data-ga":"alert-silencing::click-link-docs::rule-modal","data-testid":"silencing-rules-doc",href:"https://learn.netdata.cloud/docs/alerts-&-notifications/notifications/centralized-cloud-notifications/manage-alert-notification-silencing-rules",rel:"noopener noreferrer",target:"_blank",children:"Learn how to configure silencing rules."})]}),!P&&(0,r.jsx)(ne.A,{})]}),(0,r.jsxs)(a.ModalBody,{"data-testid":"silencing-rules-modal-content",column:!1,height:"100%",padding:[0],children:[(0,r.jsx)(a.Flex,{width:"500px",column:!0,border:{side:"right",color:"border"},children:(0,r.jsxs)(a.Flex,{"data-testid":"silencing-rules-criteria-section",column:!0,gap:3,padding:[2],children:[(0,r.jsx)(i,{title:"Scope",description:"Alert targeting"}),(0,r.jsxs)(d,{height:ce,children:[(0,r.jsx)(b,{scope:u.scope,setScope:h,isDisabled:!P||!M,...M?{}:{tooltip:"You don't have permissions to create rules for other users",tooltipProps:{align:"bottom"}}}),(0,r.jsx)(ee,{state:u,isEdit:c,alertMetasLoaded:v,canCreatePersonalRule:P,channelsOptions:L,roomOptions:m,nodesOptions:C,alertStatusOptions:I,alertNameOptions:j,alertContextOptions:f,alertInstancesOptions:R,alertRoleOptions:S,alertInstancesEnabled:A,onRuleNameChange:p,onRoomsSelectionChange:g,onNodesSelectionChange:x,onAddHostLabel:N,onRemoveHostLabel:y,onAlertValueChange:O,onIntegrationsValueChange:k})]})]})}),(0,r.jsx)(a.Flex,{column:!0,flex:"grow",children:(0,r.jsxs)(a.Flex,{"data-testid":"silencing-rules-scheduling-section",column:!0,gap:2,padding:[2],flex:"grow",children:[(0,r.jsx)(i,{title:"Schedule",description:"Timing & recurrence"}),(0,r.jsx)(d,{height:ce,children:(0,r.jsx)(te.A,{withDuration:!0,isEdit:c,rrule:u.rrule,startDate:u.startsAt,endDate:u.lastsUntil,evaluationFn:F,onDatesChange:E,onRuleChange:D,containerProps:{width:"100%"},dateInputProps:{startDateLabel:"Start silence",endDateLabel:"End silence"}})})]})})]}),(0,r.jsxs)(a.ModalFooter,{alignItems:"center",justifyContent:"between",containerProps:{flex:0},children:[(0,r.jsx)(le.A,{}),(0,r.jsxs)(a.Flex,{gap:2,alignItems:"center",children:[(0,r.jsx)(a.Button,{flavour:"hollow",label:"Cancel",onClick:l,disabled:H}),P?(0,r.jsx)(ie,{label:"Save",onClick:w,"data-ga":`alert-silencing::click-save-${c?"edit":"new"}-rule::rule-modal`,"data-testid":"saveRule-button",isLoading:H,disabled:H||!u.canSubmit,tooltip:c?"Update the rule":"Create the rule",tooltipProps:{align:"bottom"},payload:{description:`Modal - ${c?"Edit":"Create"} silencing rule`}}):(0,r.jsx)(ie,{label:"Upgrade!",onClick:T,tooltip:"Update to a paid plan in order to be able to create silencing rules",tooltipProps:{align:"bottom"}})]})]})]})})})}}}]);