File: //proc/self/root/opt/netdata/usr/share/netdata/web/v3/6394.b415bd6bd1f40d7e587d.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]="a044152a-c71e-4b07-94e1-d38ba5c42626",e._sentryDebugIdIdentifier="sentry-dbid-a044152a-c71e-4b07-94e1-d38ba5c42626")}()}catch(e){}!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"65453070b30ecf3d4a1205a75b366baaa35aad52"}}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[6394],{86394:(e,t,n)=>{n.r(t),n.d(t,{default:()=>It});var r=n(96540),o=n(63766),s=n(73937),l=(n(98992),n(81454),n(63950)),i=n.n(l),a=n(74891),c=n(74848);const d=(0,a.A)(o.Icon),u=()=>(0,c.jsxs)(o.Flex,{column:!0,gap:2,width:{max:80},children:[(0,c.jsx)(o.Text,{lineHeight:1.5,children:"Select the node you want to configure."}),(0,c.jsxs)(o.Text,{lineHeight:1.5,children:["You can"," ",(0,c.jsx)(o.Text,{strong:!0,color:"primary",children:"apply your changes to multiple nodes"})," ","by selecting ",(0,c.jsx)(o.Text,{strong:!0,children:"Submit to multiple nodes"})," option of the"," ",(0,c.jsx)(o.Text,{strong:!0,children:"Submit"})," button in the configuration form."]})]}),h=(0,r.memo)((function(){let{node:e,setNode:t=i(),options:n=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,c.jsxs)(o.Flex,{"data-testid":"dyncfg-nodes-selector-container",width:"250px",column:!0,gap:1,children:[(0,c.jsxs)(o.Flex,{gap:1,alignItems:"center",children:[(0,c.jsx)(o.TextBig,{children:"Node"}),(0,c.jsx)(d,{name:"information",color:"text",tooltip:u,tooltipProps:{plain:!0,isBasic:!0,align:"right"},WrapperComponent:o.Flex})]}),(0,c.jsx)(o.Select,{placeholder:"Select a node",options:n,value:e,onChange:t})]})}));n(23215),n(54520),n(37550);var g=n(42790),x=n(91421);const m=()=>{const[e,t]=(0,x.zc)(),[n,o]=(0,g.N9)("dyncfgSearchTerm"),s={...e,term:n||e.term},{term:l,props:i}=s||{},a=!!Object.keys(s.props||{}).length,c=(0,r.useCallback)((e=>{o(void 0),t((t=>({...t,term:e})))}),[t,o]),d=(0,r.useCallback)(((e,n)=>{t((t=>({...t,props:{...t.props||{},[e]:n}})))}),[t]),u=(0,r.useCallback)((e=>{t((t=>{const n={...t};return n.props?.[e]&&delete n.props[e],n}))}),[t]),h=(0,r.useCallback)((()=>{t((e=>({...e,props:void 0})))}),[t]);return{searchItem:s,hasProps:a,searchForTerm:c,searchByProp:d,testString:(0,r.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"id";if(!l)return!0;try{const n=new RegExp(l);return Object.keys(e.templateChildren||[]).length?Object.keys(e.templateChildren).some((e=>n.test(e))):n.test(e[t])}catch{return!0}}),[l]),testProps:(0,r.useCallback)((e=>{if(!i||!Object.entries(i).filter((e=>{let[,t]=e;return void 0!==t})).length)return!0;const t=Object.entries(i).every((t=>{let[n,r]=t;return e[n]===r}));return Object.keys(e.templateChildren||[]).length?Object.values(e.templateChildren).some((e=>Object.entries(i).every((t=>{let[n,r]=t;return e[n]===r})))):t}),[i]),removeSearchProp:u,resetFilters:h}},p=()=>{const{searchItem:e,searchForTerm:t}=m(),{term:n}=e||{};return(0,c.jsxs)(o.Flex,{"data-testid":"dyncfg-search-container",width:"250px",column:!0,gap:1,children:[(0,c.jsx)(o.TextBig,{children:"Search"}),(0,c.jsx)(o.SearchInput,{value:n,placeholder:"Search",onChange:t})]})};var b=n(45087),f=n(77148),j=n(33185);const y=(0,j.default)(o.Flex).attrs((e=>({width:"100%",alignItems:"center",justifyContent:"between",gap:2,padding:[1],round:!0,cursor:"pointer",...e}))).withConfig({displayName:"styled__StyledSection",componentId:"sc-dutbst-0"})(["&:hover{background-color:",";}"],(0,o.getColor)("modalBackground")),C=(0,j.default)(o.Button).withConfig({displayName:"styled__StyledButton",componentId:"sc-dutbst-1"})(["&:before{content:",";width:18px;height:18px;display:",";align-items:center;justify-content:center;font-size:11px;font-weight:bold;position:absolute;top:-6px;left:-10px;border-radius:50%;background-color:",";color:",";z-index:10;}"],(e=>{let{warningItems:t}=e;return`"${t}"`}),(e=>{let{warningItems:t}=e;return t?"flex":"none"}),(0,o.getColor)("error"),(0,o.getColor)("bright"));var A=n(21885);const v=e=>{let{title:t="",props:n={},config:s={}}=e;const{searchItem:l,searchByProp:i,removeSearchProp:a}=m(),{props:d}=l||{},u=(0,r.useCallback)(((e,t)=>{const{searchCondition:n}=s[e]||{},r=Object.entries(n||{});if(r.length){const[e,n]=r[0];t?a(e):i(e,n)}}),[i,a]);return(0,c.jsxs)(o.Flex,{column:!0,gap:1,children:[(0,c.jsx)(o.TextBig,{strong:!0,children:t}),(0,c.jsx)(o.Flex,{column:!0,children:Object.entries(s).map((e=>{let[t,{label:r,searchCondition:l}]=e;const i=n?.[t]||0,[a,h]=Object.entries(l)[0],g=!!d&&d[a]===h,x=A.zy.includes(t)&&i>0?{color:"error"}:{};return(0,c.jsx)(b.A,{content:s[t]?.tooltip,align:"bottom",isBasic:!0,base:{background:"main",padding:[2]},children:(0,c.jsxs)(y,{onClick:()=>u(t,g),children:[(0,c.jsxs)(o.Flex,{alignItems:"center",gap:2,children:[(0,c.jsx)(o.Checkbox,{checked:g}),(0,c.jsx)(o.TextBig,{...x,children:r})]}),(0,c.jsx)(o.TextBig,{...x,children:i})]})},t)}))})]})};var I=n(79748);const k=e=>{let{sourceType:t,status:n}=e;const{hasProps:r,resetFilters:s}=m();return(0,c.jsxs)(o.Flex,{column:!0,padding:[3],gap:2,children:[(0,c.jsxs)(o.Flex,{alignItems:"center",justifyContent:"between",children:[(0,c.jsx)(o.TextBig,{strong:!0,children:"Filters"}),r?(0,c.jsx)(I.A,{onClick:s,children:"Clear"}):null]}),(0,c.jsx)(f.A,{color:"border"}),(0,c.jsx)(v,{title:"Source type",props:t,config:A.V8}),(0,c.jsx)(f.A,{color:"border"}),(0,c.jsx)(v,{title:"Status",props:n,config:A.T_})]})},w=(0,r.memo)(k);n(8872);const F=Object.keys(A.T_),S=Object.keys(A.V8),T=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n=t.reduce(((e,t)=>({...e,[t]:0})),{});return function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;for(let n=0;n<t.length;n++)if(t[n]===r[e]){const t=r[e];o[e]||(o[e]={}),o[e][t]=(o[e]?.[t]||0)+1}}},D=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.attention||(t.attention={}),e.restart_required&&(t.attention.restart_required=(t.attention?.restart_required||0)+1),e.plugin_rejected&&(t.attention.plugin_rejected=(t.attention?.plugin_rejected||0)+1)},N=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=Object.entries(e);if(n.length)for(let r=0;r<n.length;r++){const[e,o]=n[r];if(e.match(/\/[^/]+/g))return N(o,t);o.type&&"template"!==o.type&&(T("status",F)(o,t),T("source_type",S)(o,t),D(o,t))}return t},B=e=>{const{attention:t,source_type:n,status:o}=(0,r.useMemo)((()=>Object.keys(e)?N(e):{}),[e]);return{warningItems:(t?.restart_required||0)+(t?.plugin_rejected||0)+(o?.failed||0)+(o?.incomplete||0),menuItems:{attention:t,sourceType:n,status:o}}};var P=n(6304);const M=e=>{let{tree:t={}}=e;const n=(0,r.useRef)(),[s,l,,i]=(0,P.A)(!1),{hasProps:a}=m(),{warningItems:d,menuItems:u}=B(t);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.A,{align:"bottom",content:s?"Hide filters":"Show filters",children:(0,c.jsx)(o.Flex,{ref:n,children:(0,c.jsx)(C,{flavour:a?"default":"hollow",icon:"filterList",onClick:l,warningItems:d})})}),s&&n.current?(0,c.jsx)(o.Drop,{width:60,target:n.current,align:{top:"bottom",right:"right"},background:"modalTabsBackground",margin:[2,0,0],round:.5,close:i,onClickOutside:i,onEsc:i,children:(0,c.jsx)(w,{...u})}):null]})},E=(0,r.memo)(M);var _=n(10094);const O=(0,a.A)(o.Icon),L=e=>{let{isDisabled:t,onClick:n}=e;const o=(0,r.useCallback)((()=>{t||n()}),[t,n]);return(0,c.jsx)(O,{name:"x",onClick:o,color:"text",tooltip:t?null:"Clear selected items",disabled:t,noWrapper:!0,cursor:t?"default":"pointer"})};var V=n(93598),z=n(19148),Y=n(55093);const $=(0,a.A)(o.Flex),H=e=>{let{items:t,renderItem:n,titleOnExpanded:r="Hide items",titleOnCollapsed:s="Show items",tooltipOnExpanded:l=null,tooltipOnCollapsed:i=null,itemsContainerProps:a={}}=e;const[d,u]=(0,P.A)();return(0,c.jsxs)(o.Flex,{column:!0,gap:2,children:[(0,c.jsxs)($,{alignItems:"center",gap:1,cursor:"pointer",onClick:u,tooltip:d?l:i,children:[(0,c.jsx)(o.Icon,{name:"chevron_right",color:"textLite",rotate:d?3:1,size:"small"}),(0,c.jsx)(o.Text,{color:"textLite",children:d?r:s})]}),(0,c.jsx)(o.Collapsible,{open:d,duration:0,children:(0,c.jsx)(o.Flex,{column:!0,gap:1,width:"100%",background:"modalBackground",height:{max:40},overflow:"auto",...a,children:t.map(n)})})]})},R=e=>{let{id:t,reason:n}=e;return(0,c.jsxs)(o.Flex,{column:!0,gap:2,children:[(0,c.jsx)(z.QP,{children:t}),(0,c.jsx)(o.Flex,{padding:[2,4],background:"panelBg",border:{side:"left",color:"error"},children:(0,c.jsx)(o.Text,{children:n})})]},t)},q="processed",W=function(){let{actionVerb:e=q}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,c.jsxs)(o.Flex,{alignItems:"center",gap:2,children:[(0,c.jsx)(o.Icon,{name:"check",color:"primary"}),(0,c.jsxs)(o.TextBigger,{children:["All items were ",e," successfully."]})]})},K=function(){let{actionVerb:e=q}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,c.jsxs)(o.Flex,{alignItems:"center",gap:2,children:[(0,c.jsx)(o.Icon,{name:"x",color:"error"}),(0,c.jsxs)(o.TextBigger,{color:"error",children:["No item could be ",e,"."]})]})},U=function(){let{success:e=0,fail:t=0,actionVerb:n=q}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,c.jsxs)(o.Flex,{column:!0,gap:2,children:[(0,c.jsxs)(o.Flex,{alignItems:"center",gap:2,children:[(0,c.jsx)(o.Icon,{name:"checkmark_s",color:"primary"}),(0,c.jsxs)(o.TextBigger,{children:[e," item",e>1?"s":""," successfully ",n,"."]})]}),(0,c.jsxs)(o.Flex,{alignItems:"center",gap:2,children:[(0,c.jsx)(o.Icon,{name:"x",color:"error"}),(0,c.jsxs)(o.TextBigger,{color:"error",children:[t," item",t>1?"s":""," could not be ",n,"."]})]})]})},Q=e=>{let{results:t,idsForAction:n,renderAllSuccess:s=W,renderAllFail:l=K,renderPartialFail:i=U}=e;const a=(0,r.useMemo)((()=>(t||[]).reduce(((e,t,r)=>[...e,...t?.value?.data?.status<200||t?.value?.data?.status>299?[{id:(n||[])[r],reason:t?.reason?.response?.data?.error_message||t?.reason?.response?.data?.errorMessage||t?.reason?.response?.data?.message||"Something went wrong"}]:[]]),[])),[t,n]),d=n.length-a.length;return t&&t.length?(0,c.jsx)(o.Flex,{column:!0,gap:2,padding:[2,4],children:a.length?(0,c.jsxs)(c.Fragment,{children:[a.length===n.length?l():i({success:d,fail:a.length}),(0,c.jsx)(H,{items:a,renderItem:R,tooltipOnCollapsed:"Show failed items.",itemsContainerProps:{gap:3}})]}):s()}):null},G=e=>{let{title:t="Progress",loading:n,results:s,idsForAction:l,onClose:i,resetSelectedItems:a,renderAllSuccess:d,renderAllFail:u,renderPartialFail:h}=e;const g=(0,x.Hj)(),m=(0,r.useCallback)((()=>{i(),a(),g()}),[g,i,a]);return(0,c.jsx)(o.Modal,{backdropContainerProps:{zIndex:"120"},backdropProps:{backdropBlur:!0},children:(0,c.jsxs)(o.ModalContent,{width:{min:100,base:140},background:"modalBackground",round:2,overflow:"hidden",children:[(0,c.jsx)(o.ModalHeader,{background:"modalBackground",children:(0,c.jsx)(o.H4,{children:t})}),(0,c.jsxs)(o.ModalBody,{padding:[4,0],children:[n?(0,c.jsx)(Y.A,{title:"Processing items...",height:"160px",background:"modalBackground"}):null,(0,c.jsx)(Q,{results:s,idsForAction:l,renderAllSuccess:d,renderAllFail:u,renderPartialFail:h})]}),(0,c.jsx)(o.ModalFooter,{gap:2,children:(0,c.jsx)(o.Button,{flavour:"hollow",small:!0,label:"Close",onClick:m})})]})})};const J=(0,n(94404).A)(V.A),X={canDoAction:[],noAction:[]},Z=e=>{let{selectedItems:t,onDecline:n,onConfirm:s,title:l="Proceed?",noActionTitle:i="No items available for this action",renderConfirmationMessage:a,...d}=e;const u=(0,r.useMemo)((()=>!t.canDoAction.length),[t.canDoAction]),h=(0,r.useCallback)((()=>{s(t)}),[t]);return(0,c.jsx)(o.ConfirmationDialog,{title:u?i:l,handleConfirm:h,handleDecline:n,confirmLabel:"Yes",declineLabel:u?"Close":"No",isConfirmDisabled:!t.canDoAction.length,backdropContainerProps:{zIndex:"120"},message:a(t),...d})},ee=e=>{let{cmd:t,action:n,items:o,list:s,resetSelectedItems:l,isDisabled:i,actionIconProps:a={},confirmationDialogProps:d={},progressModalProps:u={}}=e;const[h,,g,x]=(0,P.A)(),[m,p]=(0,r.useState)(),[b,,f,j]=(0,P.A)(),[y,,C,A]=(0,P.A)(),v=(0,r.useMemo)((()=>s.reduce(((e,n)=>{const{id:r,cmds:s}=n;if(o.includes(r)){const r=s.includes(t)?"canDoAction":"noAction";return{...e,[r]:[...e[r],{...n,[r]:!0}]}}return e}),X)),[s,o]),I=(0,r.useMemo)((()=>(v?.canDoAction||[]).map((e=>{let{id:t}=e;return t}))),[v.canDoAction]),{payload:k={},...w}=a||{},F=(0,r.useCallback)((()=>{i||f()}),[i,f]),S=(0,r.useCallback)((()=>{g(),j(),C(),n({ids:I}).then((e=>{p(e),x()}))}),[g,x,n,I,j,C]);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(J,{edit:!0,feature:"DyncfgBulkAction",onClick:F,color:"text",iconColor:"text",flavour:"borderless",payload:{ids:I,...k},disabled:i,...w,...i?{tooltip:null}:{}}),b?(0,c.jsx)(Z,{selectedItems:v,onDecline:j,onConfirm:S,...d}):null,y?(0,c.jsx)(G,{loading:h,results:m,idsForAction:I,onClose:A,resetSelectedItems:l,...u}):null]})},te=(0,a.A)(o.Icon),ne=(0,r.memo)((e=>{let{id:t,canDoAction:n,noAction:s,noActionMessage:l}=e;const i=(0,r.useMemo)((()=>({name:n?"arrow_down":"x",color:n?"success":"error",rotate:n?3:0,tooltip:s?l:null})),[n,s]);return(0,c.jsxs)(o.Flex,{alignItems:"center",gap:2,children:[(0,c.jsx)(o.Flex,{children:(0,c.jsx)(te,{...i})}),(0,c.jsx)(z.QP,{children:t})]},t)})),re=(0,a.A)(o.Icon),oe="deleted",se=(0,r.memo)((()=>(0,c.jsx)(re,{name:"question",color:"text",size:"small",noWrapper:!0,tooltip:"You cannot delete predefined items. Only items added by user can be deleted."}))),le=(0,r.memo)((()=>(0,c.jsxs)(o.Flex,{gap:2,children:[(0,c.jsx)(o.TextBig,{children:"None of the selected items can be deleted."}),(0,c.jsx)(se,{})]}))),ie=(0,r.memo)((e=>{let{canDoAction:t,noAction:n}=e;return(0,c.jsxs)(c.Fragment,{children:[n.length?(0,c.jsxs)(o.Flex,{gap:2,children:[(0,c.jsxs)(o.TextBig,{color:"warning",children:[n.length," of the selected items cannot be deleted."]}),(0,c.jsx)(se,{})]}):null,(0,c.jsx)(H,{items:[...n,...t],renderItem:e=>(0,c.jsx)(ne,{...e,noActionMessage:"Cannot be deleted."}),tooltipOnCollapsed:"Show items.",itemsContainerProps:{padding:[2]}})]})})),ae=e=>{let{canDoAction:t,noAction:n}=e;return t.length?(0,c.jsxs)(o.Flex,{column:!0,gap:2,children:[(0,c.jsxs)(o.TextBig,{children:["You are going to completely remove ",(0,c.jsxs)(o.TextBig,{strong:!0,children:[t.length," items"]})," and this action cannot be reverted."]}),(0,c.jsx)(ie,{canDoAction:t,noAction:n}),(0,c.jsx)(o.TextBig,{children:"Are you sure that you want to continue?"})]}):(0,c.jsx)(le,{})},ce=e=>{let{node:t,items:n,list:r,resetSelectedItems:o,isDisabled:s}=e;const l=(0,x.yW)({node:t});return(0,c.jsx)(ee,{cmd:"remove",action:l,items:n,list:r,resetSelectedItems:o,isDisabled:s,actionIconProps:{icon:"trashcan",tooltip:"Delete selected items",payload:{label:"Delete"}},confirmationDialogProps:{title:"Delete selected items?",noActionTitle:"No items to delete",confirmLabel:"Yes, delete",renderConfirmationMessage:ae},progressModalProps:{renderAllSuccess:e=>(0,c.jsx)(W,{...e,actionVerb:oe}),renderAllFail:e=>(0,c.jsx)(K,{...e,actionVerb:oe}),renderPartialFail:e=>(0,c.jsx)(U,{...e,actionVerb:oe})}})},de=(0,a.A)(o.Icon),ue="restarted",he=(0,r.memo)((()=>(0,c.jsx)(de,{name:"question",color:"text",size:"small",noWrapper:!0,tooltip:"You can only restart specific items."}))),ge=(0,r.memo)((()=>(0,c.jsxs)(o.Flex,{gap:2,children:[(0,c.jsx)(o.TextBig,{children:"None of the selected items can be restarted."}),(0,c.jsx)(he,{})]}))),xe=(0,r.memo)((e=>{let{canDoAction:t,noAction:n}=e;return(0,c.jsxs)(c.Fragment,{children:[n.length?(0,c.jsxs)(o.Flex,{gap:2,children:[(0,c.jsxs)(o.TextBig,{color:"warning",children:[n.length," of the selected items cannot be restarted."]}),(0,c.jsx)(he,{})]}):null,(0,c.jsx)(H,{items:[...n,...t],renderItem:e=>(0,c.jsx)(ne,{...e,noActionMessage:"Cannot be restarted."}),tooltipOnCollapsed:"Show items.",itemsContainerProps:{padding:[2]}})]})})),me=e=>{let{canDoAction:t,noAction:n}=e;return t.length?(0,c.jsxs)(o.Flex,{column:!0,gap:2,children:[(0,c.jsxs)(o.TextBig,{children:["You are going to restart ",(0,c.jsxs)(o.TextBig,{strong:!0,children:[t.length," items"]}),"."]}),(0,c.jsx)(xe,{canDoAction:t,noAction:n}),(0,c.jsx)(o.TextBig,{children:"Are you sure that you want to continue?"})]}):(0,c.jsx)(ge,{})},pe=e=>{let{node:t,items:n,list:r,resetSelectedItems:o,isDisabled:s}=e;const l=(0,x.nM)({node:t});return(0,c.jsx)(ee,{cmd:"restart",action:l,items:n,list:r,resetSelectedItems:o,isDisabled:s,actionIconProps:{icon:"refresh",tooltip:"Restart selected items",payload:{label:"Restart"}},confirmationDialogProps:{title:"Restart selected items?",noActionTitle:"No items to restart",confirmLabel:"Yes, restart",isConfirmPositive:!0,renderConfirmationMessage:me},progressModalProps:{renderAllSuccess:e=>(0,c.jsx)(W,{...e,actionVerb:ue}),renderAllFail:e=>(0,c.jsx)(K,{...e,actionVerb:ue}),renderPartialFail:e=>(0,c.jsx)(U,{...e,actionVerb:ue})}})},be=e=>{let{actionVerb:t}=e;return(0,c.jsxs)(o.TextBig,{children:["None of the selected items can be ",t,"."]})},fe=e=>{let{canDoAction:t,noAction:n,isDisable:r}=e;const s=r?"disabled":"enabled";return(0,c.jsxs)(c.Fragment,{children:[n.length?(0,c.jsxs)(o.TextBig,{color:"warning",children:[n.length," of the selected items cannot be ",s,"."]}):null,(0,c.jsx)(H,{items:[...n,...t],renderItem:e=>(0,c.jsx)(ne,{...e,noActionMessage:`Cannot be ${s}.`}),tooltipOnCollapsed:"Show items.",itemsContainerProps:{padding:[2]}})]})},je=e=>t=>{let{canDoAction:n,noAction:r}=t;const s=e?"disable":"enable",l=e?"disabled":"enabled";return n.length?(0,c.jsxs)(o.Flex,{column:!0,gap:2,children:[(0,c.jsxs)(o.TextBig,{children:["You are going to ",s," ",(0,c.jsxs)(o.TextBig,{strong:!0,children:[n.length," items"]}),"."]}),(0,c.jsx)(fe,{canDoAction:n,noAction:r,isDisable:e}),(0,c.jsx)(o.TextBig,{children:"Are you sure that you want to continue?"})]}):(0,c.jsx)(be,{actionVerb:l})},ye=e=>{let{isDisable:t,node:n,items:o,list:s,resetSelectedItems:l,isDisabled:i}=e;const a=(0,x.Ht)({disable:t,node:n}),d=t?"disabled":"enabled",u=(0,r.useMemo)((()=>({icon:"switch_off",danger:t,...t?{iconColor:"errorText",tooltip:"Disable selected items",payload:{label:"Disable"}}:{iconColor:"successText",tooltip:"Enable selected items",payload:{label:"Enable"}}})),[t]),h=(0,r.useMemo)((()=>({isConfirmPositive:!t,renderConfirmationMessage:je(t),...t?{title:"Disable selected items?",noActionTitle:"No items to disable",confirmLabel:"Yes, disable"}:{title:"Enable selected items?",noActionTitle:"No items to enable",confirmLabel:"Yes, enable"}})),[t,je]);return(0,c.jsx)(ee,{cmd:t?"disable":"enable",action:a,items:o,list:s,resetSelectedItems:l,isDisabled:i,actionIconProps:u,confirmationDialogProps:h,progressModalProps:{renderAllSuccess:e=>(0,c.jsx)(W,{...e,actionVerb:d}),renderAllFail:e=>(0,c.jsx)(K,{...e,actionVerb:d}),renderPartialFail:e=>(0,c.jsx)(U,{...e,actionVerb:d})}})},Ce=e=>{let{node:t,path:n,list:r}=e;const{items:s,reset:l}=(0,x.H2)({node:t,path:n}),i=!s.length;return(0,c.jsxs)(_.r,{"data-testid":"dyncfg-selected-items-container",gap:2,alignItems:"center",padding:[0,0,0,3],children:[(0,c.jsx)(L,{isDisabled:i,onClick:l}),(0,c.jsxs)(o.TextBig,{color:i?"textLite":"text",children:[s.length," selected"]}),(0,c.jsxs)(o.Flex,{alignItems:"center",children:[(0,c.jsx)(pe,{node:t,items:s,list:r,resetSelectedItems:l,isDisabled:i}),(0,c.jsx)(ce,{node:t,items:s,list:r,resetSelectedItems:l,isDisabled:i}),(0,c.jsx)(ye,{node:t,items:s,list:r,resetSelectedItems:l,isDisabled:i}),(0,c.jsx)(ye,{isDisable:!0,node:t,items:s,list:r,resetSelectedItems:l,isDisabled:i})]})]})},Ae=()=>{const e=(0,x.Hj)();return(0,c.jsx)(b.A,{align:"bottom",content:"Reload",children:(0,c.jsx)(o.Flex,{children:(0,c.jsx)(o.Button,{flavour:"hollow",icon:"refresh",onClick:e})})})},ve=(0,r.memo)(Ae);var Ie=n(29022),ke=(n(72577),n(81391)),we=n(75669),Fe=n(7761);const Se=(0,j.default)(o.Flex).attrs((e=>({column:!0,height:{max:"300px"},overflow:{vertical:"auto"},border:{side:"all",color:"border"},...e}))).withConfig({displayName:"parentNodes__ParentsList",componentId:"sc-hcj754-0"})([""]),Te=(0,j.default)(o.Flex).attrs((e=>({padding:[2,3],cursor:"pointer",flex:1,...e}))).withConfig({displayName:"parentNodes__ParentItem",componentId:"sc-hcj754-1"})(["&:not(:last-of-type){border-bottom:1px solid ",";}&:hover{background-color:",";}"],(0,o.getColor)("border"),(0,o.getColor)("successSemi")),De=(0,a.A)(Te),Ne="reachable",Be=(0,r.memo)((e=>{let{nodes:t,nodesOptions:n,setNode:s}=e;const l=t?.[0],i=(0,ke.n)("id");(0,we.A)({roomId:i,polling:!1});const{loaded:a,nodes:d}=(0,Fe.c8)(),u=(0,r.useMemo)((()=>a&&l?Object.entries(d||{}).find((e=>{let[t]=e;return t===l.id}))?.[1]?.parents:[]),[l,a,d]),h=(0,r.useCallback)((e=>{if(e.status===Ne){const t=n.find((t=>{let{value:n}=t;return n===e.id}));t&&s(t)}}),[s]);return a&&u?.length?(0,c.jsxs)(o.Flex,{"data-testid":"dyncfg-parent-nodes-selector-container",column:!0,gap:6,children:[(0,c.jsx)(o.TextBig,{children:"Please select one of the parent nodes to configure."}),(0,c.jsx)(Se,{children:u.filter((e=>{let{status:t}=e;return t===Ne})).map((e=>{let{id:t,hostname:n,status:r}=e;return(0,c.jsx)(De,{tooltip:`Select ${n}`,onClick:()=>h({id:t,hostname:n,status:r}),noWrapper:!0,children:(0,c.jsx)(o.TextBig,{color:"link",children:n})},t)}))})]}):null}));var Pe=n(60908);const Me=o.TextBig,Ee={[A.rd.ErrForbidden]:{title:"No permissions",Content:()=>(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Me,{children:"You don't have permissions to view the configurations."}),(0,c.jsx)(Me,{children:"Please contact the Space administrators if this is unexpected."})]})},[A.rd.ErrNoConfigurableNodes]:{title:"No configurable nodes found",Content:()=>(0,c.jsx)(Me,{children:"We couldn't find any node that can be configured from the UI."})},[A.rd.ErrNoDyncfgComponent]:{title:"No Dynamic Configuration available",Content:()=>(0,c.jsx)(Me,{children:"It appears no components that support this feature are currently running."})},[A.rd.ErrHealthDisabled]:{title:"Disabled Alerts",Content:()=>(0,c.jsx)(Me,{children:"Alerts are disabled in this node."})},[A.rd.ErrDyncfgNotAvailable]:{title:"Dynamic Configuration not avaialble",Content:()=>(0,c.jsx)(Me,{children:"This node cannot be configured from the UI."})},[A.rd.ErrAlertNotAvailable]:{title:"Alert not found",Content:()=>(0,c.jsx)(Me,{children:"It seems that the requested alert is not available on this node."})},default:{title:"Error",Content:()=>(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Me,{children:"Something went wrong, please check again later."}),(0,c.jsxs)(Me,{children:["If the problem persists feel free to contact us with a"," ",(0,c.jsx)(I.A,{href:"https://github.com/netdata/netdata-cloud/issues/new/choose",target:"_blank",rel:"noopener noreferrer",children:"ticket"})]})]})}},_e=e=>{let{testId:t="",nodes:n,nodesOptions:r,setNode:s,error:l}=e;const{errorMsgKey:i}=l||{},{title:a,Content:d}=Ee[i]||Ee.default;return(0,c.jsx)(Pe.DL,{feature:"DyncfgMainTabs",errorMsgKey:i,children:(0,c.jsx)(Ie.A,{title:a,testId:t,children:(0,c.jsxs)(o.Flex,{"data-testid":t,column:!0,gap:2,children:[(0,c.jsx)(o.Flex,{column:!0,gap:1,children:(0,c.jsx)(d,{})}),(0,c.jsx)(Be,{nodes:n,nodesOptions:r,setNode:s})]})})})};var Oe=n(7960),Le=(n(25509),n(65223),n(60321),n(41927),n(11632),n(64377),n(66771),n(12516),n(68931),n(52514),n(35694),n(52774),n(49536),n(21926),n(94483),n(16215),n(73700)),Ve=n(57530),ze=n(51220),Ye=n(73980),$e=n(15505);const He=e=>{let{id:t,entry:n,filteredEntriesIds:o,rowVirtualizer:s,virtualRow:l,isActiveSticky:i,level:a,renderChildren:d}=e;const{templateChildren:u,stickyIndex:h,...g}=n||{},x=(0,r.useMemo)((()=>u?Object.entries(u).reduce(((e,t)=>{let[n,r]=t;return{...e,...o.includes(n)?{[n]:r}:{}}}),{}):u),[u,o]),m={...(0,$e.bn)(g),templateChildren:u,filteredTemplateChildren:x},p=(0,r.useMemo)((()=>({width:"100%",overflow:"hidden",...i&&null!==h&&!isNaN(h)?{position:"sticky",top:h*l.size,zIndex:10}:{position:"absolute",top:0,left:0,transform:`translateY(${l.start}px)`}})),[i,h]);return s&&l?(0,c.jsx)("div",{className:"dyncfg-virtual-row",style:p,ref:s.measureElement,"data-index":l.index,"data-key":t,"data-id":n.id,children:(0,c.jsx)(Ye.A,{flavour:"path"!==n.type?"entity":"root"===n.type?"path":n.type,title:t,entityProps:m,level:a,entry:n,renderChildren:d})},l.key):null},Re=(0,j.default)(o.Flex).attrs((e=>({width:"100%",height:`${A.FL}px`,position:"absolute",top:0,left:0,alignItems:"center",padding:[0,6,0,12],border:{side:"all",color:"border"},style:{transform:`translateY(${e.offset*A.FL}px)`},...e}))).withConfig({displayName:"placeholder__StyledPlaceholderContainer",componentId:"sc-1lr4vg8-0"})([""]),qe=(0,j.default)(o.Flex).attrs((e=>({width:"100px",height:"10px",round:"5px",...e}))).withConfig({displayName:"placeholder__Shimmer",componentId:"sc-1lr4vg8-1"})(["@keyframes shimmer{to{background-position-x:0%;}}background:linear-gradient( -45deg,"," 40%,"," 50%,"," 60% );background-size:300%;background-position-x:100%;animation:shimmer 1s infinite linear;"],(0,o.getColor)("border"),(0,o.getColor)("generic"),(0,o.getColor)("border")),We=e=>{let{index:t,overscan:n=0,isBefore:r}=e;const s=r?t:t+n+1;return(0,c.jsxs)(Re,{justifyContent:"between",offset:s,"data-testid":"dyncfg-config-iyem-placeholder",children:[(0,c.jsxs)(o.Flex,{gap:2,children:[(0,c.jsx)(qe,{width:"30px"}),(0,c.jsx)(qe,{width:"240px"})]}),(0,c.jsxs)(o.Flex,{gap:2,children:[(0,c.jsx)(qe,{width:"30px"}),(0,c.jsx)(qe,{width:"30px"})]})]})},Ke=(0,r.memo)(We);var Ue=n(65637),Qe=n(55177);const Ge=e=>{let{entries:t=[],rowHeight:n=A.FL}=e;const o=(0,r.useRef)(),l=(0,r.useRef)(),{node:i}=(0,s.Z)(),{path:a}=(0,Ue.A)(i),[d,u]=(0,x._F)({node:i,path:a}),h=(0,r.useMemo)((()=>t.reduce(((e,t)=>{let{isSticky:n,index:r}=t;return[...e,...n?[r]:[]]}),[])),[t]),g=(0,r.useCallback)((e=>(l.current||[]).includes(e)),[l.current]),m=(0,r.useCallback)((e=>{l.current=[...h].filter((t=>e.startIndex+h.indexOf(t)>=t));return[...new Set([...l.current||[],...(0,Ve.vp)(e)])].sort(((e,t)=>e-t))}),[l.current,h]),p=(0,r.useCallback)((()=>n),[n]),b=(0,ze.Te)({count:t.length,getScrollElement:()=>o.current,rangeExtractor:m,enableSmoothScroll:!0,estimateSize:p,overscan:5}),{startIndex:f,endIndex:j}=b.calculateRange()||{},{before:y,after:C}=(0,r.useMemo)((()=>{if(void 0===f||void 0===j)return{before:[],after:[]};const e=t.length;return{before:Array(f).fill().map(((e,t)=>t)),after:Array(e-j-1).fill().map(((e,t)=>t+j))}}),[f,j,t.length,5]),v=(0,r.useCallback)((0,Le.n)(100,(e=>{u(e.target.scrollTop)})),[u]);return(0,r.useEffect)((()=>{o.current&&(o.current.scrollTop=d)}),[]),(0,c.jsx)("div",{ref:o,style:{height:"100%",width:"100%",overflow:"auto"},onScroll:v,children:(0,c.jsxs)("div",{style:{minHeight:`${b.getTotalSize()}px`,width:"100%",position:"relative"},children:[y.map((e=>(0,c.jsx)(Ke,{index:e,isBefore:!0},e))),b.getVirtualItems().map((e=>{const n=t[e.index],{level:r=1}=n||{};return(0,c.jsx)(He,{id:n.id,entry:n,filteredEntriesIds:t.map((e=>{let{id:t}=e;return t})),rowVirtualizer:b,virtualRow:e,isActiveSticky:g(n.index),level:r,renderChildren:e=>(0,c.jsx)(Qe.A,{...n,...e})},e.key)})),C.map((e=>(0,c.jsx)(Ke,{index:e,overscan:5},e)))]})})},Je=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const{searchItem:t,testString:n,testProps:o}=m(),{ids:s}=(0,x.$K)();return(0,r.useMemo)((()=>{let t=0;return e.reduce(((e,r)=>{if(!n(r)||!o(r)||(r.parents||[]).some((e=>s.includes(e))))return e;const l="path"===r.type;return[...e,{...r,...l?{isSticky:l,stickyIndex:t++}:{}}]}),[]).map(((e,t)=>({...e,index:t})))}),[e,n,o,s,t])};var Xe=n(98289);const Ze=(0,Oe.A)((()=>n.e(1658).then(n.bind(n,11658))),"DyncfgStyles"),et=e=>{let{entries:t,onListChange:n=i()}=e;const o=(0,Xe.Xt)({tree:t}),s=Je(o);return(0,r.useEffect)((()=>{n(s)}),[s,n]),(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(r.Suspense,{fallback:"",children:(0,c.jsx)(Ze,{})}),(0,c.jsx)(r.Suspense,{fallback:"",children:(0,c.jsx)(Ge,{entries:s})})]})};var tt=n(62718);const nt=e=>{let{loaded:t,hasError:n,error:s,selectedNode:l,tabs:i=[],level:a=0,onListChange:d}=e;const[u,h]=(0,x.te)({level:a}),{reset:g}=(0,x.$K)(),m=(0,r.useCallback)((e=>{g(),h(e)}),[h,g]);return(0,c.jsx)(o.Tabs,{"data-testid":`dyncfg-tabs-${a}`,height:"100%",overflow:"hidden",selected:u,onChange:m,tabsProps:{border:{side:"bottom",color:"border"}},padding:[a?2:0,0,0,0],children:i.map((e=>{let{value:r,label:i,tabs:u,entries:h}=e;return Array.isArray(u)&&u.length?(0,c.jsx)(o.Tab,{label:i,children:(0,c.jsx)(nt,{loaded:!0,tabs:u,level:a+1},i)},i):(0,c.jsx)(o.Tab,{label:i,children:(0,c.jsx)(o.Flex,{height:"100%",padding:[4,0,0],overflow:{vertical:"auto"},children:t?n?(0,c.jsx)(_e,{testId:"dyncfg-recursive-tabs",error:s}):(0,c.jsx)(et,{entries:h,onListChange:d},`${r} ${l}`):(0,c.jsx)(tt.Um,{})})},i)}))})},rt=nt;var ot=n(45026);const st=e=>{const{capabilities:t}=e||{},n=t?.dyncfg?.enabled,o=t?.health?.enabled,{title:s}=(0,ot.A)(),{state:l}=(0,x.$h)(),{isAlert:i,newAlert:a}=l||{},{loaded:c,value:d}=(0,x.wd)({node:e}),u=c&&!Object.keys(d?.tree||{}).length,h=(0,r.useMemo)((()=>d?.tree?.[A.$7]?.[s]||{}),[d?.tree,s]),g=(0,r.useMemo)((()=>!!Object.keys(h||{}).length),[h]);return(0,r.useMemo)((()=>e?i&&!o?A.rd.ErrHealthDisabled:!i||a||g?n?u?A.rd.ErrNoDyncfgComponent:null:A.rd.ErrDyncfgNotAvailable:A.rd.ErrAlertNotAvailable:null),[e,i,n,o,u])},lt=e=>{let{selectedNode:t,setNode:n,options:s}=e;const{loaded:l,tabs:i,selectedTab:a}=(0,Ue.A)(t),[d,u]=(0,r.useState)([]),g=st(t),{loaded:m,value:b,hasError:f,error:j}=(0,x.wd)({node:t,path:i?.[a]?.value}),y=(0,r.useMemo)((()=>(0,Xe.m8)(b?.tree)),[b?.tree]),C=(0,Xe.yl)(y),A=(0,r.useMemo)((()=>i.map(((e,t)=>t===a?{...e,tabs:C}:e))),[i,C,a]);return(0,c.jsxs)(o.Flex,{column:!0,height:"100%",overflow:"hidden",gap:4,children:[(0,c.jsxs)(o.Flex,{alignItems:"end",justifyContent:"between",children:[(0,c.jsxs)(o.Flex,{alignItems:"end",gap:4,children:[(0,c.jsx)(h,{node:t,setNode:n,options:s}),(0,c.jsx)(p,{}),(0,c.jsx)(Ce,{node:t,path:i[a]?.value,list:d})]}),(0,c.jsxs)(o.Flex,{alignItems:"center",gap:3,children:[(0,c.jsx)(E,{tree:b?.tree}),(0,c.jsx)(ve,{})]})]}),l?g?(0,c.jsx)(_e,{testId:"dyncfg-main-tabs-conf-error",nodes:[t],nodesOptions:s,setNode:n,error:{errorMsgKey:g}}):(0,c.jsx)(rt,{loaded:m,hasError:f,error:j,selectedNode:t,tabs:A,onListChange:u},b):(0,c.jsx)(tt.Um,{})]})},it=(0,r.memo)(lt);var at=n(24609),ct=n(64973),dt=n(58042),ut=n(28688),ht=n(21785),gt=n(41936),xt=n(38648),mt=n(3692);const pt=e=>{let{message:t,title:n,footer:r,...s}=e;const l=s?.["data-testid"]||"dyncfgError";return(0,c.jsxs)(o.Flex,{alignItems:"center",column:!0,"data-testid":l,flex:!0,gap:3,justifyContent:"center",padding:[0,20],...s,children:[(0,c.jsx)(o.H3,{"data-testid":`${l}-title`,children:n}),(0,c.jsx)(o.TextBig,{color:"textDescription","data-testid":`${l}-message`,children:t}),r]})};var bt=n(9381),ft=n(24013),jt=n(87083);const yt=(0,r.memo)((e=>{let{node:t}=e;const[n,r]=(0,x.Gt)(),o=(0,jt.a7)({extraKey:A.q4}),l=o?.[0],i=(0,ft.xY)(l);t=l?i:t;const{options:a,node:d,setNode:u}=(0,s.A)({selectedNode:t,nodes:n});return r?a.length?(0,c.jsx)(bt.A,{children:(0,c.jsx)(it,{selectedNode:d,setNode:u,options:a})}):(0,c.jsx)(_e,{testId:"dyncfg-main-tabs-adapter",error:{errorMsgKey:A.rd.ErrNoConfigurableNodes}}):(0,c.jsx)(tt.l_,{})})),Ct=e=>{const t=(0,dt.OS)();return(0,c.jsx)(o.Button,{label:"Get a fresh agent token",onClick:t,...e})},At="Configurations expose sensitive information about your systems and applications. To protect your privacy, Netdata exposes this information only to logged-in users and claimed agents. When viewing Configurations directly on a Netdata Agent UI, this information is sent directly from the Netdata Agent to your web browser, without exposing it to any third parties.",vt={notLoggedIn:{title:"Sign in to Netdata to use Configurations",description:At,footer:(0,c.jsx)(xt.default,{})},notClaimed:{title:"Connect this agent to Netdata to use Configurations",description:At,footer:(0,c.jsx)(mt.A,{})},noAccess:{title:"This agent belongs to a Netdata Space you are not member of",description:At,footer:(0,c.jsx)(o.TextBig,{color:"textDescription",children:"Ask for an invitation from the administrators of the Netdata Space of the agent to use configurations."})},bearerError:{title:"You are not authorized to use Configurations",description:At,footer:(0,c.jsx)(Ct,{})}},It=e=>{let{node:t}=e;const n=(0,at.dg)();(0,ut.A)({polling:!1});const{refresh:o}=(0,x.$h)(),[,,s]=(0,x.zc)(),[,,l]=(0,x.te)(),[i]=(0,ct.Q8)(),[{bearerProtection:a,error:d}]=(0,dt.f7)(),[{canBeClaimed:u,cloudStatus:h}]=(0,gt.RJ)();if((()=>{const e=(0,ke.n)("id");(0,ht.A)({roomId:e})})(),(0,r.useEffect)((()=>()=>{o(),s(),l()}),[o,s,l]),n&&d&&a){const{title:e,description:t,footer:n}=(e=>{let{userStatus:t,userNodeStatus:n,accessError:r,canBeClaimed:o}=e;return vt[t]?vt[t]:r?vt.notLoggedIn:o?vt.notClaimed:vt[n]?vt[n]:vt.bearerError})({...i,bearerError:d,canBeClaimed:u,cloudStatus:h});return(0,c.jsx)(pt,{title:e,message:t,footer:n})}return(0,c.jsx)(yt,{node:t})}}}]);