summaryrefslogtreecommitdiffstats
path: root/src/web/gui/v2/5304.dcb81c99fcb90f8ee8cc.chunk.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/web/gui/v2/5304.dcb81c99fcb90f8ee8cc.chunk.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/web/gui/v2/5304.dcb81c99fcb90f8ee8cc.chunk.js b/src/web/gui/v2/5304.dcb81c99fcb90f8ee8cc.chunk.js
new file mode 100644
index 000000000..f4dd5cbb0
--- /dev/null
+++ b/src/web/gui/v2/5304.dcb81c99fcb90f8ee8cc.chunk.js
@@ -0,0 +1 @@
+!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e27ff49e-a3c2-487e-95c7-13bbd43d7887",e._sentryDebugIdIdentifier="sentry-dbid-e27ff49e-a3c2-487e-95c7-13bbd43d7887")}catch(e){}}();var _global="undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{};_global.SENTRY_RELEASE={id:"08864407160b3973b9b88c5ae92687282b21e2f4"},(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[5304],{79394:(e,t,l)=>{l.d(t,{A:()=>u,p:()=>d});l(41393),l(81454);var a=l(96540),n=l(47444),r=l(3914),o=l(67990),s=l(63129),i=l(88982);const c=()=>{const e=(0,r.vt)();return(0,n.Zs)((t=>{let{set:l,snapshot:a}=t;return async t=>{const n=await a.getPromise((0,o.$6)({id:t,key:"nodes"}));let r=null;return null!==n&&void 0!==n&&n.length||(l((0,o.$6)({id:t,key:"loaded"}),!1),r=(0,s.uQ)({roomId:t,spaceId:e}),r.then((e=>{let{data:a}=e;l((0,o.$6)({id:t,key:"nodes"}),a.map((e=>{let{id:t,name:l}=e;return{label:l,value:t}}))),l((0,o.$6)({id:t,key:"loaded"}),!0)})).catch((e=>l((0,o.$6)({id:t,key:"error"}),e)))),r}}),[e])},d=()=>{const e=c(),t=(0,i.n)("id");(0,a.useEffect)((()=>{let l=null;return t&&(l=e(t)),()=>{var e;return!(null===(e=l)||void 0===e||!e.cancel)&&l.cancel()}}),[t,e])},u=c},25304:(e,t,l)=>{l.r(t),l.d(t,{default:()=>ae});var a=l(96540),n=l(83084),r=l(28738),o=(l(8159),l(98992),l(37550),l(62953),l(87659)),s=l(81638),i=l(30577),c=l(93615),d=l(58168),u=l(10058),m=(l(9920),l(14905),l(3949),l(8872),l(27467)),g=l(59846),p=l(82700),y=l(37171),b=l(10368);const h=(e,t,l)=>{let{id:a,name:n}=e;-1==l?t.push({id:a,name:n,count:1}):t[l]={...t[l],count:t[l].count+1}},f=e=>e.id,E=e=>e.name,x=e=>{let{title:t,baseKey:l,param:n,paramKey:r,extraKey:o,testIdPrefix:s}=e;const i=(e=>{let{baseKey:t,extraKey:l,param:n,paramKey:r}=e;const{rules:o}=(0,y.q)({extraKey:l,omit:n,keepAll:!0}),s=(0,m.rW)(n,{key:t,extraKey:l,flavour:"arr"});return(0,a.useMemo)((()=>o.reduce(((e,t)=>{const l=t[r];if(!l)return e;const a=e.findIndex((e=>e.id==l.id));return"id"==r?h({id:l,name:l},e,a):["rooms","nodes"].includes(r)?l.forEach((t=>{let{id:l,name:n,notAvailable:r}=t;const o=r?"Not available (".concat(l,")"):n;h({id:l,name:o},e,a)})):["alertNames","alertContexts","alertRoles"].includes(r)?l.forEach((t=>{h({id:t,name:t},e,a)})):"hostLabels"==r&&Object.entries(l).forEach((t=>{let[l,n]=t;const r=(0,b.M)({key:l,value:n});h({id:r,name:r},e,a)})),e}),[])),[o,s])})({baseKey:l,extraKey:o,param:n,paramKey:r});return i.length?a.createElement(g.A,{title:t,testIdPrefix:s,param:n,baseKey:l,extraKey:o},a.createElement(p.Ay,{param:n,baseKey:l,extraKey:o,testIdPrefix:s,collection:i,getValue:f,getLabel:E,capitalized:!1})):null};var A=l(3914),v=l(78940);const w=[{title:"Rules IDs",param:"ids",paramKey:"id"},{title:"Rooms",param:"roomIds",paramKey:"rooms"},{title:"Nodes",param:"nodeIds",paramKey:"nodes"},{title:"Host labels",param:"hostLabels",paramKey:"hostLabels"},{title:"Alert names",param:"alertNames",paramKey:"alertNames"},{title:"Alert contexts",param:"alertContexts",paramKey:"alertContexts"},{title:"Alert roles",param:"alertRoles",paramKey:"alertRoles"}],k={filters:{iconName:"filterList",color:{active:"success",notActive:"textLite"},width:"19px",Content:(0,a.memo)((e=>{const t=(0,A.vt)();return a.createElement(u.Flex,(0,d.A)({column:!0,height:"calc(100vh - 266px)",overflow:{vertical:"auto"},padding:[0,0,30]},e),w.map((e=>{let{title:l,param:n,paramKey:r}=e;return a.createElement(x,{key:l,baseKey:t,extraKey:v.qt,title:l,param:n,paramKey:r})})))})),dataTestId:"filterBar",label:"Filters"}},K=["filters"],C=e=>e.some((e=>{let{roomIds:t=[],nodeIds:l=[],hostLabels:a={},alertNames:n=[],alertContexts:r=[],alertRoles:o=[]}=e;return t.length||l.length||Object.keys(a).length||n.length||r.length||o.length})),S=e=>{let{rules:t}=e;const[l,n]=(0,o.A)((()=>C(t))),{Content:r}=k.filters;return(0,a.useEffect)((()=>{n(C(t))}),[t]),a.createElement(s.Ay,{collapsedComponent:a.createElement(i.A,{onClickTab:n,availableTabs:k,tabsToShow:K}),isOpen:l,header:a.createElement(c.A,{isOpen:l,onToggle:n,title:"Filters",icon:"filterList"})},a.createElement(r,{padding:[0,3,30]}))};var T=l(39225),L=l(4659),I=l(65570),F=(l(9391),l(41393),l(81454),l(21290)),R=l(36021),D=l(71835),N=l(29217),M=l(40267);const P=e=>{let{value:t,...l}=e;return a.createElement(N.A,{content:t},a.createElement(u.Pill,(0,d.A)({flavour:"neutral"},l),t))},_=()=>a.createElement(u.Text,null,"*"),j=e=>{let{getValue:t}=e;const l=t();return null!==l&&void 0!==l&&l.length?a.createElement(u.Flex,{flexWrap:!0,gap:1},l.map((e=>a.createElement(u.Flex,{key:e,padding:[.5,0]},a.createElement(P,{value:e}))))):a.createElement(_,null)},O=e=>{let{getValue:t}=e;const{localeDateString:l}=(0,F.$j)();if(!t())return a.createElement(u.Text,null,"-");const n=l(new Date(t()),{month:"2-digit",day:"2-digit",year:"numeric",hour:"numeric",minute:"numeric",long:!1,dateStyle:void 0});return a.createElement(u.Text,{whiteSpace:"nowrap"},n)},V=[{id:"disabled",name:"Disable rule",accessorKey:"disabled",header:"",cell:e=>{let{row:t,getValue:l}=e;const n=t.original,[r,s]=(0,a.useState)(!l()),[i,c]=(0,o.A)(),[,d]=(0,D.A)(),m=(0,R.FU)(),g=(0,R.Lz)();return a.createElement(u.Toggle,{colored:!0,checked:r,disabled:i,onChange:e=>{c();const t=e.target.checked;s(t),m({...n,disabled:!t}).then((()=>{g()})).catch((e=>{s(!t),d(e)})).finally(c)}})},size:80},{id:"name",name:"Name",accessorKey:"name",header:"Rule name",cell:e=>{let{row:t,getValue:l}=e;const{accountId:n}=t.original;return a.createElement(u.Flex,{gap:2,alignItems:"center"},a.createElement(u.Text,{wordBreak:"break-word"},l()),n&&a.createElement(N.A,{align:"bottom",content:"This rule affects only your account"},a.createElement(u.Box,null,a.createElement(u.Icon,{color:"textLite",height:"16px",name:"userPress",width:"16px"}))))}},{id:"rooms",name:"Rooms",accessorKey:"rooms",header:"Rooms",cell:e=>{let{getValue:t}=e;const l=t();return null!==l&&void 0!==l&&l.length?a.createElement(u.Text,null,l.map((e=>{let{name:t}=e;return t})).join(", ")):a.createElement(u.Text,null,"All rooms")}},{id:"nodes",name:"Nodes",accessorKey:"nodes",header:"Nodes",cell:e=>{let{getValue:t}=e;const l=t();return null!==l&&void 0!==l&&l.length?a.createElement(u.Flex,{flexWrap:!0,gap:1},l.map((e=>{let{id:t,name:l,notAvailable:n}=e;const r=n?a.createElement(u.Flex,{alignItems:"center",gap:1},a.createElement(u.Icon,{name:"warning_triangle",size:"small",color:"neutralPillColor"}),a.createElement(u.Text,null,"Node no longer available")):l;return a.createElement(P,{key:t,value:r})}))):a.createElement(_,null)}},{id:"hostLabels",name:"Host labels",accessorKey:"hostLabels",header:"Host labels",cell:e=>{let{getValue:t}=e;const l=t(),n=Object.entries(l||{});return n.length?a.createElement(u.Flex,{flexWrap:!0,gap:1},n.map((e=>{let[t,l]=e;const n=(0,b.M)({key:t,value:l});return a.createElement(P,{key:n,value:n})}))):a.createElement(_,null)}},{id:"alertNames",name:"Alert names",accessorKey:"alertNames",header:"Alert name",cell:j},{id:"alertContexts",name:"Alert contexts",accessorKey:"alertContexts",header:"Alert context",cell:j},{id:"severities",name:"Alert status",accessorKey:"severities",header:"Alert status",cell:e=>{let{getValue:t}=e;const l=t();return null!==l&&void 0!==l&&l.length?a.createElement(u.Flex,{flexWrap:!0,gap:1},l.map((e=>a.createElement(u.Flex,{key:e,padding:[.5,0]},a.createElement(M.A,{flavour:e.toLowerCase()},e))))):a.createElement(_,null)}},{id:"alertRoles",name:"Alert roles",accessorKey:"alertRoles",header:"Alert role",cell:j},{id:"startDate",name:"Start date",accessorKey:"startsAt",header:"Start date",cell:O},{id:"endDate",name:"End date",accessorKey:"lastsUntil",header:"End date",cell:O}];l(93514);var $=l(38819),U=l(29848),z=l(46741);const B={month:"2-digit",day:"2-digit",year:"numeric",hour:"numeric",minute:"numeric",long:!1,dateStyle:void 0},H=()=>{const[e,t]=(0,a.useState)(""),{silencingRulePrefill:l}=(0,$.PP)(),n=l?{type:"create"}:{},[r,o]=(0,a.useState)(n),[,s]=(0,D.A)(),{localeDateString:i}=(0,F.$j)(),c=(0,R._S)(),d=(0,R.Lz)(),m=(0,U.ly)(),g=()=>o({type:"create"}),p=e=>o({type:"edit",rule:e}),y=e=>{let{id:t}=e;c([t]).then((()=>{d(),m()})).catch(s)},b=(0,z.JT)("space:DeletePersonalSilencingRule"),h=(0,z.JT)("space:DeleteSystemSilencingRule"),f=(0,a.useMemo)((()=>({addEntry:{dataGa:"",flavour:"hollow",handleAction:g,iconColor:"success",label:"Add rule",small:!0,width:"auto"}})),[]),E=e=>{let{name:t}=e;return a.createElement(a.Fragment,null,"Delete ",t," rule")};return{search:e,setSearch:t,bulkActions:f,rowActions:(0,a.useMemo)((()=>({edit:{handleAction:p,disabledTooltipText:"Edit is disabled",isDisabled:e=>{let{readOnly:t}=e;return!!t},dataGa:"alert-silencing::click-edit-row::rules-table"},delete:{handleAction:y,confirmationTitle:E,confirmationMessage:e=>a.createElement(u.Text,{wordBreak:"break-word"},"You are about to delete ",a.createElement("strong",null,e.name)," silencing rule.",a.createElement("br",null),"Are you sure you want to continue?"),dataGa:"alert-silencing::click-delete-row::rules-table",disabledTooltipText:"Delete is disabled",confirmLabel:"Yes, delete",declineLabel:"Cancel",isDisabled:e=>{let{accountId:t}=e;return t?!b:!h}}})),[]),onFilter:(0,a.useCallback)(((e,t,l)=>{const a=e.original,n=l.toLowerCase(),r=(a.rooms||[]).map((e=>{let{name:t}=e;return t})),o=(a.nodes||[]).map((e=>{let{name:t}=e;return t})),s=a.alertNames||[],c=a.alertContexts||[],d=a.severities||[],u=a.alertRoles||[],m=a.hostLabels||{},g=a.startsAt?i(new Date(a.startsAt),B):"",p=a.lastsUntil?i(new Date(a.lastsUntil),B):"";return((e,t)=>e.some((e=>e.toLowerCase().includes(t))))([a.name.toLowerCase(),...r,...o,...s,...c,...d,...u,...Object.entries(m).flat(),g,p],n)}),[]),modalDetails:r,closeModal:()=>o({})}},W=(0,T.A)((()=>l.e(8011).then(l.bind(l,88011))),"CreateOrUpdateRuleModal"),q=(0,a.memo)(u.Table,((e,t)=>(0,I.Ay)(e,t))),J={right:["actions"]},G=()=>a.createElement(u.Flex,null,a.createElement(u.Text,null,"Create or Maintain Alert Notification Silencing Rules on this Space. These rules can be applicable to all users or just you, depending on their definition."," ",a.createElement(L.A,{"data-ga":"alert-silencing::click-link-docs::rules-table","data-testid":"silencing-rules-doc",href:"https://learn.netdata.cloud/docs/alerts-and-notifications/notifications/netdata-cloud-notifications/#silencing-alert-notifications",rel:"noopener noreferrer",target:"_blank"},"Read the Alert Notification Silencing Rules documentation to learn more."))),Y=e=>{let{data:t}=e;const{search:l,setSearch:n,bulkActions:r,rowActions:o,onFilter:s,modalDetails:i,closeModal:c}=H();return a.createElement(a.Fragment,null,a.createElement(u.Flex,{column:!0,gap:4,padding:[2,4],height:"calc(100vh - 241px)"},a.createElement(G,null),a.createElement(q,{key:JSON.stringify(t||{}),enableSorting:!0,enableColumnVisibility:!0,data:t,dataColumns:V,bulkActions:r,rowActions:o,globalFilter:l,globalFilterFn:s,onSearch:n,columnPinning:J,enableColumnPinning:!0})),"create"==i.type&&a.createElement(a.Suspense,null,a.createElement(W,{onClose:c})),"edit"==i.type&&i.rule&&a.createElement(a.Suspense,null,a.createElement(W,{rule:i.rule,onClose:c,isEdit:!0})))};var Q=l(9415),Z=l(89821),X=l(18061);const ee=e=>{let{errorMessage:t}=e;return a.createElement(u.Flex,{column:!0,gap:2,alignItems:"center",justifyContent:"center",flex:!0},a.createElement(u.TextBig,null,"Something went wrong"),t&&a.createElement(u.Text,null,"(",t,")"))};var te=l(79394),le=l(63314);const ae=()=>{(e=>{const t=(0,R.ys)({id:e,key:"initialLoad"}),l=(0,R.Qu)(),a=(0,R.UJ)(e);(0,X.A)((()=>({enabled:!!e&&!t,fetch:()=>(0,Q.cH)(e),onFail:e=>a({...Z.$,loading:!1,loaded:!0,error:e}),onSuccess:e=>a(((e,t)=>({...e,loading:!1,loaded:!0,initialLoad:!0,rules:t}))(Z.$,e))})),[e,l])})((0,A.vt)()),(0,te.p)();const{loaded:e,rules:t,error:l}=(0,y.q)({extraKey:v.qt});return e?l?a.createElement(le.DL,{tab:"Notifications::SilencingRules"},a.createElement(ee,{errorMessage:l.message})):a.createElement(le.Ay,{tab:"Notifications::SilencingRules"},a.createElement(n.A,{sidebar:a.createElement(S,{rules:t}),margin:[3,0]},a.createElement(Y,{data:t}))):a.createElement(r.A,{height:"calc(100% - 44px)",title:"Loading silencing rules..."})}},10368:(e,t,l)=>{l.d(t,{H:()=>n,M:()=>r});l(14905),l(98992),l(8872),l(62953);var a=l(78940);const n=e=>{var t;const{validationErrors:l,errorMessage:n}=(null===e||void 0===e||null===(t=e.response)||void 0===t?void 0:t.data)||{};return l&&Object.keys(l).length?Object.entries(l).reduce(((e,t)=>{let[,l]=t;const{Code:n}=l;return a.xc[n]&&e.push({errorMessage:a.xc[n]}),e}),[]):[{errorMessage:n}]},r=e=>{let{key:t,value:l}=e;return"".concat(t,": ").concat(l)}}}]); \ No newline at end of file