diff options
Diffstat (limited to '')
-rw-r--r-- | web/gui/v2/597.f721ec431cd86411331e.chunk.js (renamed from web/gui/v2/597.cb6f23362a28e63af220.chunk.js) | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/web/gui/v2/597.cb6f23362a28e63af220.chunk.js b/web/gui/v2/597.f721ec431cd86411331e.chunk.js index ff388548b..014189a0c 100644 --- a/web/gui/v2/597.cb6f23362a28e63af220.chunk.js +++ b/web/gui/v2/597.f721ec431cd86411331e.chunk.js @@ -1 +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]="591187c7-811e-4fc6-8fd8-53cbbd5af6d2",e._sentryDebugIdIdentifier="sentry-dbid-591187c7-811e-4fc6-8fd8-53cbbd5af6d2")}catch(e){}}();var _global="undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{};_global.SENTRY_RELEASE={id:"1f9bd6d85714735ca8bbf884fbe65fc5566ec047"},(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[597],{35539:function(e,t,n){n.d(t,{JG:function(){return c},Qj:function(){return f},Ym:function(){return r},Zg:function(){return i},k0:function(){return a},lI:function(){return u},mD:function(){return d},sr:function(){return l},xQ:function(){return o},yu:function(){return s}});var r="silencingRules",a={system:{text:"All users",tooltip:"Rule affects all users"},personal:{text:"Myself",tooltip:"Limit the silencing effect to your account only"}},o="system",l={label:"All rooms",value:""},i={now:{text:"Silence for a specific duration",tooltip:"Rule starts immediately and lasts until the specified duration"},schedule:{text:"Schedule silence",tooltip:"Schedule the rule to start taking effect at some point at the future"}},c="now",u={untilTurnedOff:"Until turned off",oneHour:"1 hour",sixHours:"6 hours",twelveHours:"12 hours",oneDay:"1 day",custom:"Custom"},s={label:"Until turned off",value:"untilTurnedOff"},d={border:{side:"all",color:"inputBorder"},padding:[1,2],margin:[0,0,.5,0],round:!0,justifyContent:"start"},f={ErrInvalidName:"No rule name provided",ErrCodeInvalidStartsAt:"Invalid or no start date provided",ErrCodeInvalidSLastUntil:"Invalid or no end date provided",ErrCodeInvalidScheduleDuration:"Invalid duration selected",ErrCodeInvalidSeverity:"Invalid severity",ErrCodeInvalidIntegration:"Invalid integration",ErrCodeNotOwnRule:"Not permitted to create system rules"}},45396:function(e,t,n){n.d(t,{B:function(){return m}});var r=n(15861),a=n(64687),o=n.n(a),l=(n(21249),n(57640),n(9924),n(67294)),i=n(4480),c=n(74059),u=n(96929),s=n(25819),d=n(93742),f=function(){var e=(0,c.th)();return(0,i._8)((function(t){var n=t.set,a=t.snapshot;return function(){var t=(0,r.Z)(o().mark((function t(r){var l,i;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,a.getPromise((0,u.Nj)({id:r,key:"nodes"}));case 2:return l=t.sent,i=null,null!==l&&void 0!==l&&l.length||(n((0,u.Nj)({id:r,key:"loaded"}),!1),(i=(0,s.Fz)({roomId:r,spaceId:e})).then((function(e){var t=e.data;n((0,u.Nj)({id:r,key:"nodes"}),t.map((function(e){var t=e.id;return{label:e.name,value:t}}))),n((0,u.Nj)({id:r,key:"loaded"}),!0)})).catch((function(e){return n((0,u.Nj)({id:r,key:"error"}),e)}))),t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()}),[e])},m=function(){var e=f(),t=(0,d.p)("id");(0,l.useEffect)((function(){var n=null;return t&&(n=e(t)),function(){var e;return!(null===(e=n)||void 0===e||!e.cancel)&&n.cancel()}}),[t,e])};t.Z=f},95384:function(e,t,n){n.r(t),n.d(t,{default:function(){return Oe}});var r=n(67294),a=n(91268),o=n(78266),l=n(29439),i=(n(41539),n(64211),n(2490),n(41874),n(47941),n(46667)),c=n(29814),u=n(72843),s=n(54316),d=n(87462),f=(n(21249),n(57509)),m=(n(82526),n(57327),n(88449),n(59849),n(38880),n(49337),n(33321),n(69070),n(4942)),p=(n(85827),n(25387),n(72608),n(34553),n(26699),n(15581),n(34514),n(54747),n(69720),n(95248)),b=n(8144),y=n(46742),v=n(45987),g=(n(32023),n(57640),n(9924),n(92222),n(4480)),h=n(74059),O=n(25403),E=n(93742),j=["rules"];function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){(0,m.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var k,P=function(e){return function(t,n){var r=t[e];return!Array.isArray(n)||!n.length||(Array.isArray(r)?n.some((function(e){return r.includes(e)})):n.includes(r))}},Z={roomIds:P("roomIds"),nodeIds:P("nodeIds"),hostLabels:(k="hostLabels",function(e,t){var n=e[k];if(!n)return!t.length;var r=Object.entries(n).map((function(e){var t=(0,l.Z)(e,2),n=t[0],r=t[1];return"".concat(n,": ").concat(r)}));return P(k)(x(x({},e),{},(0,m.Z)({},k,r)),t)}),alertNames:P("alertNames"),alertRoles:P("alertRoles"),alertContexts:P("alertContexts")},I=(0,g.CG)({key:"silencingRulesFiltered",get:function(e){var t=e.extraKey,n=e.spaceId,r=e.omit,a=void 0===r?[]:r,o=e.keepAll,i=e.allNodesRoomId;return function(e){var r=e.get,c=r((0,p.dz)({key:n,extraKey:t})),u=Object.keys(c).reduce((function(e,t){return a.includes(t)||e.push([t,c[t]]),e}),[]),s=r((0,O.z5)({id:n,allNodesRoomId:i}));if(!u.length)return s;var d=function(e){return function(t){return!e.some((function(e){var n=(0,l.Z)(e,2),r=n[0],a=n[1];return!!Z[r]&&!Z[r](t,a)}))}}(u),f=s.rules,m=(0,v.Z)(s,j);return o?s:x(x({},m),{},{rules:f.filter(d)})}}}),S=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.extraKey,n=e.omit,r=void 0===n?[]:n,a=e.keepAll,o=void 0!==a&&a,l=(0,h.th)(),i=(0,E.p)("id");return(0,g.sJ)(I({extraKey:t,spaceId:l,omit:r,keepAll:o,allNodesRoomId:i}))},A=n(62447);function D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function C(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D(Object(n),!0).forEach((function(t){(0,m.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var K=function(e,t,n){var r=e.id,a=e.name;-1==n?t.push({id:r,name:a,count:1}):t[n]=C(C({},t[n]),{},{count:t[n].count+1})},R=function(e){return e.id},N=function(e){return e.name},T=function(e){var t=e.title,n=e.baseKey,a=e.param,o=e.paramKey,i=e.extraKey,c=e.testIdPrefix,u=function(e){var t=e.baseKey,n=e.extraKey,a=e.param,o=e.paramKey,i=S({extraKey:n,omit:[a],keepAll:!0}).rules,c=(0,p.by)(a,{key:t,extraKey:n});return(0,r.useMemo)((function(){return i.reduce((function(e,t){var n=t[o];if(!n)return e;var r=e.findIndex((function(e){return e.id==n.id}));return["rooms","nodes"].includes(o)?n.forEach((function(t){var n=t.id,a=t.name,o=t.notAvailable?"Not available (".concat(n,")"):a;K({id:n,name:o},e,r)})):["alertNames","alertContexts","alertRoles"].includes(o)?n.forEach((function(t){K({id:t,name:t},e,r)})):"hostLabels"==o&&Object.entries(n).forEach((function(t){var n=(0,l.Z)(t,2),a=n[0],o=n[1],i=(0,A.q)({key:a,value:o});K({id:i,name:i},e,r)})),e}),[])}),[i,c])}({baseKey:n,extraKey:i,param:a,paramKey:o});return u.length?r.createElement(b.Z,{title:t,testIdPrefix:c,param:a,baseKey:n,extraKey:i},r.createElement(y.ZP,{param:a,baseKey:n,extraKey:i,testIdPrefix:c,collection:u,getValue:R,getLabel:N,capitalized:!1})):null},L=n(35539),F=[{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"}],_=(0,r.memo)((function(e){var t=(0,h.th)();return r.createElement(f.Flex,(0,d.Z)({column:!0,height:"calc(100vh - 266px)",overflow:{vertical:"auto"},padding:[0,0,30]},e),F.map((function(e){var n=e.title,a=e.param,o=e.paramKey;return r.createElement(T,{key:n,baseKey:t,extraKey:L.Ym,title:n,param:a,paramKey:o})})))})),M={filters:{iconName:"filterList",color:{active:"success",notActive:"textLite"},width:"19px",Content:_,dataTestId:"filterBar",label:"Filters"}},z=["filters"],B=function(e){return e.some((function(e){var t=e.roomIds,n=void 0===t?[]:t,r=e.nodeIds,a=void 0===r?[]:r,o=e.hostLabels,l=void 0===o?{}:o,i=e.alertNames,c=void 0===i?[]:i,u=e.alertContexts,s=void 0===u?[]:u,d=e.alertRoles,f=void 0===d?[]:d;return n.length||a.length||Object.keys(l).length||c.length||s.length||f.length}))},G=function(e){var t=e.rules,n=(0,i.Z)((function(){return B(t)})),a=(0,l.Z)(n,2),o=a[0],d=a[1],f=M.filters.Content;return(0,r.useEffect)((function(){d(B(t))}),[t]),r.createElement(s.ZP,{collapsedComponent:r.createElement(c.Z,{onClickTab:d,availableTabs:M,tabsToShow:z}),isOpen:o,header:r.createElement(u.Z,{isOpen:o,onToggle:d,title:"Filters",icon:"filterList"})},r.createElement(f,{padding:[0,3,30]}))},H=(n(66992),n(88674),n(78783),n(33948),n(74916),n(64765),n(38862),n(2145)),V=n(91008),U=n(41331),J=(n(17727),n(89405)),Y=n(93017),Q=n(82351),W=["value"];function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function X(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q(Object(n),!0).forEach((function(t){(0,m.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var $=function(e){var t=e.value,n=(0,v.Z)(e,W);return r.createElement(Q.Z,{content:t},r.createElement(f.Pill,(0,d.Z)({maxWidth:"100%",overflow:"hidden",flavour:"neutral",color:"neutralPillColor",size:"small",justifyContent:"start",margin:[1]},n),t))},ee=function(){return r.createElement(f.Text,null,"*")},te=function(e){var t=(0,e.getValue)();return null!==t&&void 0!==t&&t.length?r.createElement(f.Flex,{flexWrap:!0},t.map((function(e){return r.createElement($,{key:e,value:e})}))):r.createElement(ee,null)},ne=function(e){var t=e.getValue,n=(0,J.rA)().localeDateString;if(!t())return r.createElement(f.Text,null,"-");var a=n(new Date(t()),{month:"2-digit",day:"2-digit",year:"numeric",hour:"numeric",minute:"numeric",long:!1,dateStyle:void 0});return r.createElement(f.Text,{whiteSpace:"nowrap"},a)},re=[{id:"disabled",name:"Disable rule",accessorKey:"disabled",header:"",cell:function(e){var t=e.row,n=e.getValue,a=t.original,o=(0,r.useState)(!n()),c=(0,l.Z)(o,2),u=c[0],s=c[1],d=(0,i.Z)(),m=(0,l.Z)(d,2),p=m[0],b=m[1],y=(0,Y.Z)(),v=(0,l.Z)(y,2)[1],g=(0,O.j6)(),h=(0,O._A)();return r.createElement(f.Toggle,{colored:!0,checked:u,disabled:p,onChange:function(e){b();var t=e.target.checked;s(t),g(X(X({},a),{},{disabled:!t})).then((function(){h()})).catch((function(e){s(!t),v(e)})).finally(b)}})},size:50,maxSize:50,minSize:50},{id:"name",name:"Name",accessorKey:"name",header:"Rule name",cell:function(e){var t=e.row,n=e.getValue,a=t.original.accountId;return r.createElement(f.Flex,{gap:2,alignItems:"center"},r.createElement(f.Text,{wordBreak:"break-word"},n()),a&&r.createElement(Q.Z,{align:"bottom",content:"This rule affects only your account"},r.createElement(f.Icon,{color:"textLite",height:"16px",name:"userPress",width:"16px"})))}},{id:"rooms",name:"Rooms",accessorKey:"rooms",header:"Rooms",cell:function(e){var t=(0,e.getValue)();return null!==t&&void 0!==t&&t.length?r.createElement(f.Text,null,t.map((function(e){return e.name})).join(", ")):r.createElement(f.Text,null,"All rooms")}},{id:"nodes",name:"Nodes",accessorKey:"nodes",header:"Nodes",cell:function(e){var t=(0,e.getValue)();return null!==t&&void 0!==t&&t.length?r.createElement(f.Flex,{flexWrap:!0},t.map((function(e){var t=e.id,n=e.name,a=e.notAvailable?r.createElement(f.Flex,{alignItems:"center",gap:1},r.createElement(f.Icon,{name:"warning_triangle",size:"small",color:"neutralPillColor"}),r.createElement(f.Text,null,"Node no longer available")):n;return r.createElement($,{key:t,value:a})}))):r.createElement(ee,null)}},{id:"hostLabels",name:"Host labels",accessorKey:"hostLabels",header:"Host labels",cell:function(e){var t=(0,e.getValue)(),n=Object.entries(t||{});return n.length?r.createElement(f.Flex,{flexWrap:!0},n.map((function(e){var t=(0,l.Z)(e,2),n=t[0],a=t[1],o=(0,A.q)({key:n,value:a});return r.createElement($,{key:o,value:o})}))):r.createElement(ee,null)}},{id:"alertNames",name:"Alert names",accessorKey:"alertNames",header:"Alert name",cell:te},{id:"alertContexts",name:"Alert contexts",accessorKey:"alertContexts",header:"Alert context",cell:te},{id:"alertRoles",name:"Alert roles",accessorKey:"alertRoles",header:"Alert role",cell:te},{id:"startDate",name:"Start date",accessorKey:"startsAt",header:"Start date",cell:ne,size:120},{id:"endDate",name:"End date",accessorKey:"lastsUntil",header:"End date",cell:ne,size:120}],ae=n(93433),oe=(n(84944),n(92686),n(33335)),le={month:"2-digit",day:"2-digit",year:"numeric",hour:"numeric",minute:"numeric",long:!1,dateStyle:void 0},ie=(0,H.Z)((function(){return n.e(20).then(n.bind(n,9020))}),"CreateOrUpdateRuleModal"),ce=(0,r.memo)(f.NetdataTable,(function(e,t){return(0,U.ZP)(e,t)})),ue={right:["actions"]},se=function(){return r.createElement(f.Flex,null,r.createElement(f.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."," ",r.createElement(V.Z,{"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.")))},de=function(e){var t=e.data,n=function(){var e=(0,r.useState)(""),t=(0,l.Z)(e,2),n=t[0],a=t[1],o=(0,r.useState)({}),i=(0,l.Z)(o,2),c=i[0],u=i[1],s=(0,Y.Z)(),d=(0,l.Z)(s,2)[1],m=(0,J.rA)().localeDateString,p=(0,O.hr)(),b=(0,O._A)(),y=function(){return u({type:"create"})},v=function(e){return u({type:"edit",rule:e})},g=function(e){var t=e.id;p([t]).then((function(){b()})).catch(d)},h=(0,oe.gI)("space:DeletePersonalSilencingRule"),E=(0,oe.gI)("space:DeleteSystemSilencingRule"),j=(0,r.useMemo)((function(){return{addEntry:{dataGa:"",flavour:"hollow",handleAction:y,iconColor:"success",label:"Add rule",small:!0,width:"auto"}}}),[]),w=function(e){var t=e.name;return r.createElement(r.Fragment,null,"Delete ",r.createElement(f.H3,{wordBreak:"break-word"},t)," rule")};return{search:n,setSearch:a,bulkActions:j,rowActions:(0,r.useMemo)((function(){return{edit:{handleAction:v,disabledTooltipText:"Edit is disabled",isDisabled:function(e){return!!e.readOnly},dataGa:"alert-silencing::click-edit-row::rules-table"},delete:{handleAction:g,confirmationTitle:w,confirmationMessage:function(e){return r.createElement(f.Text,{wordBreak:"break-word"},"You are about to delete ",r.createElement("strong",null,e.name)," silencing rule.",r.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:function(e){return e.accountId?!h:!E}}}}),[]),onFilter:(0,r.useCallback)((function(e,t,n){var r=e.original,a=n.toLowerCase(),o=(r.rooms||[]).map((function(e){return e.name})),l=(r.nodes||[]).map((function(e){return e.name})),i=r.alertNames||[],c=r.alertContexts||[],u=r.alertRoles||[],s=r.hostLabels||{},d=r.startsAt?m(new Date(r.startsAt),le):"",f=r.lastsUntil?m(new Date(r.lastsUntil),le):"";return function(e,t){return e.some((function(e){return e.toLowerCase().includes(t)}))}([r.name.toLowerCase()].concat((0,ae.Z)(o),(0,ae.Z)(l),(0,ae.Z)(i),(0,ae.Z)(c),(0,ae.Z)(u),(0,ae.Z)(Object.entries(s).flat()),[d,f]),a)}),[]),modalDetails:c,closeModal:function(){return u({})}}}(),a=n.search,o=n.setSearch,i=n.bulkActions,c=n.rowActions,u=n.onFilter,s=n.modalDetails,d=n.closeModal;return r.createElement(r.Fragment,null,r.createElement(f.Flex,{column:!0,gap:4,padding:[2,4],height:"calc(100vh - 241px)"},r.createElement(se,null),r.createElement(ce,{key:JSON.stringify(t||{}),enableSorting:!0,enableColumnVisibility:!0,data:t,dataColumns:re,bulkActions:i,rowActions:c,globalFilter:a,globalFilterFn:u,onGlobalSearchChange:o,columnPinning:ue,enableColumnPinning:!0,enablePinning:!0})),"create"==s.type&&r.createElement(r.Suspense,null,r.createElement(ie,{onClose:d})),"edit"==s.type&&s.rule&&r.createElement(r.Suspense,null,r.createElement(ie,{rule:s.rule,onClose:d,isEdit:!0})))},fe=n(94050),me=n(73787),pe=n(5429);function be(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ye(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?be(Object(n),!0).forEach((function(t){(0,m.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):be(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ve=function(e){var t=(0,O.oO)({id:e,key:"initialLoad"}),n=(0,O.tZ)(),r=(0,O.XJ)(e);(0,pe.Z)((function(){return{enabled:!!e&&!t,fetch:function(){return(0,fe.KH)(e)},onFail:function(e){return r(ye(ye({},me.R),{},{loading:!1,loaded:!0,error:e}))},onSuccess:function(e){return r(function(e,t){return ye(ye({},e),{},{loading:!1,loaded:!0,initialLoad:!0,rules:t})}(me.R,e))}}}),[e,n])},ge=function(e){var t=e.errorMessage;return r.createElement(f.Flex,{column:!0,gap:2,alignItems:"center",justifyContent:"center",flex:!0},r.createElement(f.TextBig,null,"Something went wrong"),t&&r.createElement(f.Text,null,"(",t,")"))},he=n(45396),Oe=function(){var e=(0,h.th)();ve(e),(0,he.B)();var t=S({extraKey:L.Ym}),n=t.loaded,l=t.rules,i=t.error;return n?i?r.createElement(ge,{errorMessage:i.message}):r.createElement(a.Z,{rightBar:r.createElement(G,{rules:l}),margin:[3,0]},r.createElement(de,{data:l})):r.createElement(o.Z,{height:"calc(100% - 44px)",title:"Loading silencing rules..."})}},62447:function(e,t,n){n.d(t,{_:function(){return o},q:function(){return l}});var r=n(29439),a=(n(47941),n(85827),n(41539),n(25387),n(2490),n(72608),n(69720),n(92222),n(35539)),o=function(e){var t,n=(null===e||void 0===e||null===(t=e.response)||void 0===t?void 0:t.data)||{},o=n.validationErrors,l=n.errorMessage;return o&&Object.keys(o).length?Object.entries(o).reduce((function(e,t){var n=(0,r.Z)(t,2)[1].Code;return a.Qj[n]&&e.push({errorMessage:a.Qj[n]}),e}),[]):[{errorMessage:l}]},l=function(e){var t=e.key,n=e.value;return"".concat(t,": ").concat(n)}},94050:function(e,t,n){n.d(t,{KF:function(){return u},KH:function(){return l},nt:function(){return i},oG:function(){return c}});n(21249),n(57640),n(9924),n(92222);var r=n(26398),a=n(66152),o=function(e){return e.map((function(e){return(0,a.k5)(e)}))},l=function(e){return r.Z.get("/api/v2/spaces/".concat(e,"/notifications/silencing/rules"),{transform:o})},i=function(e,t){return r.Z.post("/api/v2/spaces/".concat(e,"/notifications/silencing/rules/delete"),t)},c=function(e,t){return r.Z.post("/api/v2/spaces/".concat(e,"/notifications/silencing/rule"),(0,a.v)(t))},u=function(e,t){return r.Z.put("/api/v2/spaces/".concat(e,"/notifications/silencing/rule/").concat(t.id),(0,a.v)(t))}},25403:function(e,t,n){n.d(t,{XJ:function(){return g},_A:function(){return E},hr:function(){return x},j6:function(){return w},oO:function(){return v},tZ:function(){return O},wK:function(){return j},z5:function(){return y}});var r=n(4942),a=n(45987),o=(n(21249),n(57640),n(9924),n(69826),n(41539),n(31672),n(2490),n(59461),n(47941),n(82526),n(57327),n(88449),n(59849),n(38880),n(15581),n(34514),n(54747),n(49337),n(33321),n(69070),n(4480)),l=n(74059),i=n(37518),c=n(94050),u=n(73787),s=n(96929),d=n(93742),f=["rules"],m=["roomIds","nodeIds"];function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach((function(t){(0,r.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var y=(0,o.CG)({key:"silencingRulesState",get:function(e){var t=e.id,n=e.key,r=e.allNodesRoomId;return function(e){var o=e.get,l=o((0,u.Z)(t)),i=l.rules,c=(0,a.Z)(l,f),d=o((0,s.Nj)({id:r,key:"nodes"})),m=b(b({},c),{},{rules:i.map((function(e){return b(b({},e),e.nodeIds?{nodes:e.nodeIds.map((function(e){var t=d.find((function(t){return t.value==e}));return{id:e,name:(null===t||void 0===t?void 0:t.label)||"-",notAvailable:!t}}))}:{})}))});return n?m[n]:m}},set:function(e){var t=e.id,n=e.key;return function(e,o){var l=e.get,c=e.set,s=o.rules;c((0,u.Z)(t),(function(e){if(s){var t=s.map((function(e){var t=e.roomIds,n=e.nodeIds,r=(0,a.Z)(e,m),o=t?t.map((function(e){var t=l((0,i.n2)({id:e}));return{id:t.id,name:t.name}})):void 0;return b(b(b(b({},r),t?{roomIds:t}:{}),o?{rooms:o}:{}),n?{nodeIds:n}:{})}));o.rules=t}return n?b(b({},e),{},(0,r.Z)({},n,o)):b(b({},e),o)}))}}}),v=function(e){var t=e.id,n=e.key,r=(0,d.p)("id");return(0,o.sJ)(y({id:t,key:n,allNodesRoomId:r}))},g=function(e,t){return(0,o.Zl)(y({id:e,key:t}))},h=(0,o.cn)({key:"forceUpdateRulesSelector",default:0}),O=function(){return(0,o.sJ)(h)},E=function(){var e=(0,l.th)(),t=g(e),n=(0,o.Zl)(h);return function(){t((function(e){return b(b({},e),{},{initialLoad:!1})})),n((function(e){return e+1}))}},j=function(){var e=(0,l.th)();return function(t){return(0,c.oG)(e,t)}},w=function(){var e=(0,l.th)();return function(t){return(0,c.KF)(e,t)}},x=function(){var e=(0,l.th)();return function(t){return(0,c.nt)(e,t)}}},73787:function(e,t,n){n.d(t,{R:function(){return i}});n(47941),n(82526),n(57327),n(41539),n(88449),n(2490),n(59849),n(38880),n(15581),n(34514),n(54747),n(49337),n(33321),n(69070);var r=n(4942),a=n(4480);function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){(0,r.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var i={rules:[],error:"",id:null,loading:!0,loaded:!1,initialLoad:!1};t.Z=(0,a.xu)({key:"silencingRulesState",default:function(e){return function(e){return l(l({},i),{},{id:e})}(e)}})},84944:function(e,t,n){var r=n(82109),a=n(6790),o=n(47908),l=n(26244),i=n(19303),c=n(65417);r({target:"Array",proto:!0},{flat:function(){var e=arguments.length?arguments[0]:void 0,t=o(this),n=l(t),r=c(t,0);return r.length=a(r,t,t,n,0,void 0===e?1:i(e)),r}})},92686:function(e,t,n){n(51223)("flat")}}]);
\ No newline at end of file +!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]="fc141b60-47b5-4b3e-b515-e52a0c7f8b47",e._sentryDebugIdIdentifier="sentry-dbid-fc141b60-47b5-4b3e-b515-e52a0c7f8b47")}catch(e){}}();var _global="undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{};_global.SENTRY_RELEASE={id:"6845f9ce010d5a446e5d4a40f17204cb8341a07a"},(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[597],{35539:function(e,t,n){n.d(t,{JG:function(){return c},Qj:function(){return f},Ym:function(){return r},Zg:function(){return i},k0:function(){return a},lI:function(){return u},mD:function(){return d},sr:function(){return l},xQ:function(){return o},yu:function(){return s}});var r="silencingRules",a={system:{text:"All users",tooltip:"Rule affects all users"},personal:{text:"Myself",tooltip:"Limit the silencing effect to your account only"}},o="system",l={label:"All rooms",value:""},i={now:{text:"Silence for a specific duration",tooltip:"Rule starts immediately and lasts until the specified duration"},schedule:{text:"Schedule silence",tooltip:"Schedule the rule to start taking effect at some point at the future"}},c="now",u={untilTurnedOff:"Until turned off",oneHour:"1 hour",sixHours:"6 hours",twelveHours:"12 hours",oneDay:"1 day",custom:"Custom"},s={label:"Until turned off",value:"untilTurnedOff"},d={border:{side:"all",color:"inputBorder"},padding:[1,2],margin:[0,0,.5,0],round:!0,justifyContent:"start"},f={ErrInvalidName:"No rule name provided",ErrCodeInvalidStartsAt:"Invalid or no start date provided",ErrCodeInvalidSLastUntil:"Invalid or no end date provided",ErrCodeInvalidScheduleDuration:"Invalid duration selected",ErrCodeInvalidSeverity:"Invalid severity",ErrCodeInvalidIntegration:"Invalid integration",ErrCodeNotOwnRule:"Not permitted to create system rules"}},45396:function(e,t,n){n.d(t,{B:function(){return m}});var r=n(15861),a=n(64687),o=n.n(a),l=(n(21249),n(57640),n(9924),n(67294)),i=n(4480),c=n(74059),u=n(96929),s=n(25819),d=n(93742),f=function(){var e=(0,c.th)();return(0,i._8)((function(t){var n=t.set,a=t.snapshot;return function(){var t=(0,r.Z)(o().mark((function t(r){var l,i;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,a.getPromise((0,u.Nj)({id:r,key:"nodes"}));case 2:return l=t.sent,i=null,null!==l&&void 0!==l&&l.length||(n((0,u.Nj)({id:r,key:"loaded"}),!1),(i=(0,s.Fz)({roomId:r,spaceId:e})).then((function(e){var t=e.data;n((0,u.Nj)({id:r,key:"nodes"}),t.map((function(e){var t=e.id;return{label:e.name,value:t}}))),n((0,u.Nj)({id:r,key:"loaded"}),!0)})).catch((function(e){return n((0,u.Nj)({id:r,key:"error"}),e)}))),t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()}),[e])},m=function(){var e=f(),t=(0,d.p)("id");(0,l.useEffect)((function(){var n=null;return t&&(n=e(t)),function(){var e;return!(null===(e=n)||void 0===e||!e.cancel)&&n.cancel()}}),[t,e])};t.Z=f},95384:function(e,t,n){n.r(t),n.d(t,{default:function(){return Oe}});var r=n(67294),a=n(91268),o=n(78266),l=n(29439),i=(n(41539),n(64211),n(2490),n(41874),n(47941),n(46667)),c=n(29814),u=n(72843),s=n(54316),d=n(87462),f=(n(21249),n(64969)),m=(n(82526),n(57327),n(88449),n(59849),n(38880),n(49337),n(33321),n(69070),n(4942)),p=(n(85827),n(25387),n(72608),n(34553),n(26699),n(15581),n(34514),n(54747),n(69720),n(95248)),b=n(8144),y=n(46742),v=n(45987),g=(n(32023),n(57640),n(9924),n(92222),n(4480)),h=n(74059),O=n(25403),E=n(93742),j=["rules"];function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){(0,m.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var k,P=function(e){return function(t,n){var r=t[e];return!Array.isArray(n)||!n.length||(Array.isArray(r)?n.some((function(e){return r.includes(e)})):n.includes(r))}},Z={roomIds:P("roomIds"),nodeIds:P("nodeIds"),hostLabels:(k="hostLabels",function(e,t){var n=e[k];if(!n)return!t.length;var r=Object.entries(n).map((function(e){var t=(0,l.Z)(e,2),n=t[0],r=t[1];return"".concat(n,": ").concat(r)}));return P(k)(x(x({},e),{},(0,m.Z)({},k,r)),t)}),alertNames:P("alertNames"),alertRoles:P("alertRoles"),alertContexts:P("alertContexts")},I=(0,g.CG)({key:"silencingRulesFiltered",get:function(e){var t=e.extraKey,n=e.spaceId,r=e.omit,a=void 0===r?[]:r,o=e.keepAll,i=e.allNodesRoomId;return function(e){var r=e.get,c=r((0,p.dz)({key:n,extraKey:t})),u=Object.keys(c).reduce((function(e,t){return a.includes(t)||e.push([t,c[t]]),e}),[]),s=r((0,O.z5)({id:n,allNodesRoomId:i}));if(!u.length)return s;var d=function(e){return function(t){return!e.some((function(e){var n=(0,l.Z)(e,2),r=n[0],a=n[1];return!!Z[r]&&!Z[r](t,a)}))}}(u),f=s.rules,m=(0,v.Z)(s,j);return o?s:x(x({},m),{},{rules:f.filter(d)})}}}),S=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.extraKey,n=e.omit,r=void 0===n?[]:n,a=e.keepAll,o=void 0!==a&&a,l=(0,h.th)(),i=(0,E.p)("id");return(0,g.sJ)(I({extraKey:t,spaceId:l,omit:r,keepAll:o,allNodesRoomId:i}))},A=n(62447);function D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function C(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D(Object(n),!0).forEach((function(t){(0,m.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var K=function(e,t,n){var r=e.id,a=e.name;-1==n?t.push({id:r,name:a,count:1}):t[n]=C(C({},t[n]),{},{count:t[n].count+1})},R=function(e){return e.id},N=function(e){return e.name},T=function(e){var t=e.title,n=e.baseKey,a=e.param,o=e.paramKey,i=e.extraKey,c=e.testIdPrefix,u=function(e){var t=e.baseKey,n=e.extraKey,a=e.param,o=e.paramKey,i=S({extraKey:n,omit:[a],keepAll:!0}).rules,c=(0,p.by)(a,{key:t,extraKey:n});return(0,r.useMemo)((function(){return i.reduce((function(e,t){var n=t[o];if(!n)return e;var r=e.findIndex((function(e){return e.id==n.id}));return["rooms","nodes"].includes(o)?n.forEach((function(t){var n=t.id,a=t.name,o=t.notAvailable?"Not available (".concat(n,")"):a;K({id:n,name:o},e,r)})):["alertNames","alertContexts","alertRoles"].includes(o)?n.forEach((function(t){K({id:t,name:t},e,r)})):"hostLabels"==o&&Object.entries(n).forEach((function(t){var n=(0,l.Z)(t,2),a=n[0],o=n[1],i=(0,A.q)({key:a,value:o});K({id:i,name:i},e,r)})),e}),[])}),[i,c])}({baseKey:n,extraKey:i,param:a,paramKey:o});return u.length?r.createElement(b.Z,{title:t,testIdPrefix:c,param:a,baseKey:n,extraKey:i},r.createElement(y.ZP,{param:a,baseKey:n,extraKey:i,testIdPrefix:c,collection:u,getValue:R,getLabel:N,capitalized:!1})):null},L=n(35539),F=[{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"}],_=(0,r.memo)((function(e){var t=(0,h.th)();return r.createElement(f.Flex,(0,d.Z)({column:!0,height:"calc(100vh - 266px)",overflow:{vertical:"auto"},padding:[0,0,30]},e),F.map((function(e){var n=e.title,a=e.param,o=e.paramKey;return r.createElement(T,{key:n,baseKey:t,extraKey:L.Ym,title:n,param:a,paramKey:o})})))})),M={filters:{iconName:"filterList",color:{active:"success",notActive:"textLite"},width:"19px",Content:_,dataTestId:"filterBar",label:"Filters"}},z=["filters"],B=function(e){return e.some((function(e){var t=e.roomIds,n=void 0===t?[]:t,r=e.nodeIds,a=void 0===r?[]:r,o=e.hostLabels,l=void 0===o?{}:o,i=e.alertNames,c=void 0===i?[]:i,u=e.alertContexts,s=void 0===u?[]:u,d=e.alertRoles,f=void 0===d?[]:d;return n.length||a.length||Object.keys(l).length||c.length||s.length||f.length}))},G=function(e){var t=e.rules,n=(0,i.Z)((function(){return B(t)})),a=(0,l.Z)(n,2),o=a[0],d=a[1],f=M.filters.Content;return(0,r.useEffect)((function(){d(B(t))}),[t]),r.createElement(s.ZP,{collapsedComponent:r.createElement(c.Z,{onClickTab:d,availableTabs:M,tabsToShow:z}),isOpen:o,header:r.createElement(u.Z,{isOpen:o,onToggle:d,title:"Filters",icon:"filterList"})},r.createElement(f,{padding:[0,3,30]}))},H=(n(66992),n(88674),n(78783),n(33948),n(74916),n(64765),n(38862),n(2145)),V=n(91008),U=n(41331),J=(n(17727),n(89405)),Y=n(93017),Q=n(82351),W=["value"];function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function X(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q(Object(n),!0).forEach((function(t){(0,m.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var $=function(e){var t=e.value,n=(0,v.Z)(e,W);return r.createElement(Q.Z,{content:t},r.createElement(f.Pill,(0,d.Z)({maxWidth:"100%",overflow:"hidden",flavour:"neutral",color:"neutralPillColor",size:"small",justifyContent:"start",margin:[1]},n),t))},ee=function(){return r.createElement(f.Text,null,"*")},te=function(e){var t=(0,e.getValue)();return null!==t&&void 0!==t&&t.length?r.createElement(f.Flex,{flexWrap:!0},t.map((function(e){return r.createElement($,{key:e,value:e})}))):r.createElement(ee,null)},ne=function(e){var t=e.getValue,n=(0,J.rA)().localeDateString;if(!t())return r.createElement(f.Text,null,"-");var a=n(new Date(t()),{month:"2-digit",day:"2-digit",year:"numeric",hour:"numeric",minute:"numeric",long:!1,dateStyle:void 0});return r.createElement(f.Text,{whiteSpace:"nowrap"},a)},re=[{id:"disabled",name:"Disable rule",accessorKey:"disabled",header:"",cell:function(e){var t=e.row,n=e.getValue,a=t.original,o=(0,r.useState)(!n()),c=(0,l.Z)(o,2),u=c[0],s=c[1],d=(0,i.Z)(),m=(0,l.Z)(d,2),p=m[0],b=m[1],y=(0,Y.Z)(),v=(0,l.Z)(y,2)[1],g=(0,O.j6)(),h=(0,O._A)();return r.createElement(f.Toggle,{colored:!0,checked:u,disabled:p,onChange:function(e){b();var t=e.target.checked;s(t),g(X(X({},a),{},{disabled:!t})).then((function(){h()})).catch((function(e){s(!t),v(e)})).finally(b)}})},size:50,maxSize:50,minSize:50},{id:"name",name:"Name",accessorKey:"name",header:"Rule name",cell:function(e){var t=e.row,n=e.getValue,a=t.original.accountId;return r.createElement(f.Flex,{gap:2,alignItems:"center"},r.createElement(f.Text,{wordBreak:"break-word"},n()),a&&r.createElement(Q.Z,{align:"bottom",content:"This rule affects only your account"},r.createElement(f.Icon,{color:"textLite",height:"16px",name:"userPress",width:"16px"})))}},{id:"rooms",name:"Rooms",accessorKey:"rooms",header:"Rooms",cell:function(e){var t=(0,e.getValue)();return null!==t&&void 0!==t&&t.length?r.createElement(f.Text,null,t.map((function(e){return e.name})).join(", ")):r.createElement(f.Text,null,"All rooms")}},{id:"nodes",name:"Nodes",accessorKey:"nodes",header:"Nodes",cell:function(e){var t=(0,e.getValue)();return null!==t&&void 0!==t&&t.length?r.createElement(f.Flex,{flexWrap:!0},t.map((function(e){var t=e.id,n=e.name,a=e.notAvailable?r.createElement(f.Flex,{alignItems:"center",gap:1},r.createElement(f.Icon,{name:"warning_triangle",size:"small",color:"neutralPillColor"}),r.createElement(f.Text,null,"Node no longer available")):n;return r.createElement($,{key:t,value:a})}))):r.createElement(ee,null)}},{id:"hostLabels",name:"Host labels",accessorKey:"hostLabels",header:"Host labels",cell:function(e){var t=(0,e.getValue)(),n=Object.entries(t||{});return n.length?r.createElement(f.Flex,{flexWrap:!0},n.map((function(e){var t=(0,l.Z)(e,2),n=t[0],a=t[1],o=(0,A.q)({key:n,value:a});return r.createElement($,{key:o,value:o})}))):r.createElement(ee,null)}},{id:"alertNames",name:"Alert names",accessorKey:"alertNames",header:"Alert name",cell:te},{id:"alertContexts",name:"Alert contexts",accessorKey:"alertContexts",header:"Alert context",cell:te},{id:"alertRoles",name:"Alert roles",accessorKey:"alertRoles",header:"Alert role",cell:te},{id:"startDate",name:"Start date",accessorKey:"startsAt",header:"Start date",cell:ne,size:120},{id:"endDate",name:"End date",accessorKey:"lastsUntil",header:"End date",cell:ne,size:120}],ae=n(93433),oe=(n(84944),n(92686),n(33335)),le={month:"2-digit",day:"2-digit",year:"numeric",hour:"numeric",minute:"numeric",long:!1,dateStyle:void 0},ie=(0,H.Z)((function(){return n.e(9020).then(n.bind(n,9020))}),"CreateOrUpdateRuleModal"),ce=(0,r.memo)(f.NetdataTable,(function(e,t){return(0,U.ZP)(e,t)})),ue={right:["actions"]},se=function(){return r.createElement(f.Flex,null,r.createElement(f.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."," ",r.createElement(V.Z,{"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.")))},de=function(e){var t=e.data,n=function(){var e=(0,r.useState)(""),t=(0,l.Z)(e,2),n=t[0],a=t[1],o=(0,r.useState)({}),i=(0,l.Z)(o,2),c=i[0],u=i[1],s=(0,Y.Z)(),d=(0,l.Z)(s,2)[1],m=(0,J.rA)().localeDateString,p=(0,O.hr)(),b=(0,O._A)(),y=function(){return u({type:"create"})},v=function(e){return u({type:"edit",rule:e})},g=function(e){var t=e.id;p([t]).then((function(){b()})).catch(d)},h=(0,oe.gI)("space:DeletePersonalSilencingRule"),E=(0,oe.gI)("space:DeleteSystemSilencingRule"),j=(0,r.useMemo)((function(){return{addEntry:{dataGa:"",flavour:"hollow",handleAction:y,iconColor:"success",label:"Add rule",small:!0,width:"auto"}}}),[]),w=function(e){var t=e.name;return r.createElement(r.Fragment,null,"Delete ",r.createElement(f.H3,{wordBreak:"break-word"},t)," rule")};return{search:n,setSearch:a,bulkActions:j,rowActions:(0,r.useMemo)((function(){return{edit:{handleAction:v,disabledTooltipText:"Edit is disabled",isDisabled:function(e){return!!e.readOnly},dataGa:"alert-silencing::click-edit-row::rules-table"},delete:{handleAction:g,confirmationTitle:w,confirmationMessage:function(e){return r.createElement(f.Text,{wordBreak:"break-word"},"You are about to delete ",r.createElement("strong",null,e.name)," silencing rule.",r.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:function(e){return e.accountId?!h:!E}}}}),[]),onFilter:(0,r.useCallback)((function(e,t,n){var r=e.original,a=n.toLowerCase(),o=(r.rooms||[]).map((function(e){return e.name})),l=(r.nodes||[]).map((function(e){return e.name})),i=r.alertNames||[],c=r.alertContexts||[],u=r.alertRoles||[],s=r.hostLabels||{},d=r.startsAt?m(new Date(r.startsAt),le):"",f=r.lastsUntil?m(new Date(r.lastsUntil),le):"";return function(e,t){return e.some((function(e){return e.toLowerCase().includes(t)}))}([r.name.toLowerCase()].concat((0,ae.Z)(o),(0,ae.Z)(l),(0,ae.Z)(i),(0,ae.Z)(c),(0,ae.Z)(u),(0,ae.Z)(Object.entries(s).flat()),[d,f]),a)}),[]),modalDetails:c,closeModal:function(){return u({})}}}(),a=n.search,o=n.setSearch,i=n.bulkActions,c=n.rowActions,u=n.onFilter,s=n.modalDetails,d=n.closeModal;return r.createElement(r.Fragment,null,r.createElement(f.Flex,{column:!0,gap:4,padding:[2,4],height:"calc(100vh - 241px)"},r.createElement(se,null),r.createElement(ce,{key:JSON.stringify(t||{}),enableSorting:!0,enableColumnVisibility:!0,data:t,dataColumns:re,bulkActions:i,rowActions:c,globalFilter:a,globalFilterFn:u,onGlobalSearchChange:o,columnPinning:ue,enableColumnPinning:!0,enablePinning:!0})),"create"==s.type&&r.createElement(r.Suspense,null,r.createElement(ie,{onClose:d})),"edit"==s.type&&s.rule&&r.createElement(r.Suspense,null,r.createElement(ie,{rule:s.rule,onClose:d,isEdit:!0})))},fe=n(94050),me=n(73787),pe=n(5429);function be(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ye(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?be(Object(n),!0).forEach((function(t){(0,m.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):be(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ve=function(e){var t=(0,O.oO)({id:e,key:"initialLoad"}),n=(0,O.tZ)(),r=(0,O.XJ)(e);(0,pe.Z)((function(){return{enabled:!!e&&!t,fetch:function(){return(0,fe.KH)(e)},onFail:function(e){return r(ye(ye({},me.R),{},{loading:!1,loaded:!0,error:e}))},onSuccess:function(e){return r(function(e,t){return ye(ye({},e),{},{loading:!1,loaded:!0,initialLoad:!0,rules:t})}(me.R,e))}}}),[e,n])},ge=function(e){var t=e.errorMessage;return r.createElement(f.Flex,{column:!0,gap:2,alignItems:"center",justifyContent:"center",flex:!0},r.createElement(f.TextBig,null,"Something went wrong"),t&&r.createElement(f.Text,null,"(",t,")"))},he=n(45396),Oe=function(){var e=(0,h.th)();ve(e),(0,he.B)();var t=S({extraKey:L.Ym}),n=t.loaded,l=t.rules,i=t.error;return n?i?r.createElement(ge,{errorMessage:i.message}):r.createElement(a.Z,{rightBar:r.createElement(G,{rules:l}),margin:[3,0]},r.createElement(de,{data:l})):r.createElement(o.Z,{height:"calc(100% - 44px)",title:"Loading silencing rules..."})}},62447:function(e,t,n){n.d(t,{_:function(){return o},q:function(){return l}});var r=n(29439),a=(n(47941),n(85827),n(41539),n(25387),n(2490),n(72608),n(69720),n(92222),n(35539)),o=function(e){var t,n=(null===e||void 0===e||null===(t=e.response)||void 0===t?void 0:t.data)||{},o=n.validationErrors,l=n.errorMessage;return o&&Object.keys(o).length?Object.entries(o).reduce((function(e,t){var n=(0,r.Z)(t,2)[1].Code;return a.Qj[n]&&e.push({errorMessage:a.Qj[n]}),e}),[]):[{errorMessage:l}]},l=function(e){var t=e.key,n=e.value;return"".concat(t,": ").concat(n)}},94050:function(e,t,n){n.d(t,{KF:function(){return u},KH:function(){return l},nt:function(){return i},oG:function(){return c}});n(21249),n(57640),n(9924),n(92222);var r=n(26398),a=n(66152),o=function(e){return e.map((function(e){return(0,a.k5)(e)}))},l=function(e){return r.Z.get("/api/v2/spaces/".concat(e,"/notifications/silencing/rules"),{transform:o})},i=function(e,t){return r.Z.post("/api/v2/spaces/".concat(e,"/notifications/silencing/rules/delete"),t)},c=function(e,t){return r.Z.post("/api/v2/spaces/".concat(e,"/notifications/silencing/rule"),(0,a.v)(t))},u=function(e,t){return r.Z.put("/api/v2/spaces/".concat(e,"/notifications/silencing/rule/").concat(t.id),(0,a.v)(t))}},25403:function(e,t,n){n.d(t,{XJ:function(){return g},_A:function(){return E},hr:function(){return x},j6:function(){return w},oO:function(){return v},tZ:function(){return O},wK:function(){return j},z5:function(){return y}});var r=n(4942),a=n(45987),o=(n(21249),n(57640),n(9924),n(69826),n(41539),n(31672),n(2490),n(59461),n(47941),n(82526),n(57327),n(88449),n(59849),n(38880),n(15581),n(34514),n(54747),n(49337),n(33321),n(69070),n(4480)),l=n(74059),i=n(37518),c=n(94050),u=n(73787),s=n(96929),d=n(93742),f=["rules"],m=["roomIds","nodeIds"];function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach((function(t){(0,r.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var y=(0,o.CG)({key:"silencingRulesState",get:function(e){var t=e.id,n=e.key,r=e.allNodesRoomId;return function(e){var o=e.get,l=o((0,u.Z)(t)),i=l.rules,c=(0,a.Z)(l,f),d=o((0,s.Nj)({id:r,key:"nodes"})),m=b(b({},c),{},{rules:i.map((function(e){return b(b({},e),e.nodeIds?{nodes:e.nodeIds.map((function(e){var t=d.find((function(t){return t.value==e}));return{id:e,name:(null===t||void 0===t?void 0:t.label)||"-",notAvailable:!t}}))}:{})}))});return n?m[n]:m}},set:function(e){var t=e.id,n=e.key;return function(e,o){var l=e.get,c=e.set,s=o.rules;c((0,u.Z)(t),(function(e){if(s){var t=s.map((function(e){var t=e.roomIds,n=e.nodeIds,r=(0,a.Z)(e,m),o=t?t.map((function(e){var t=l((0,i.n2)({id:e}));return{id:t.id,name:t.name}})):void 0;return b(b(b(b({},r),t?{roomIds:t}:{}),o?{rooms:o}:{}),n?{nodeIds:n}:{})}));o.rules=t}return n?b(b({},e),{},(0,r.Z)({},n,o)):b(b({},e),o)}))}}}),v=function(e){var t=e.id,n=e.key,r=(0,d.p)("id");return(0,o.sJ)(y({id:t,key:n,allNodesRoomId:r}))},g=function(e,t){return(0,o.Zl)(y({id:e,key:t}))},h=(0,o.cn)({key:"forceUpdateRulesSelector",default:0}),O=function(){return(0,o.sJ)(h)},E=function(){var e=(0,l.th)(),t=g(e),n=(0,o.Zl)(h);return function(){t((function(e){return b(b({},e),{},{initialLoad:!1})})),n((function(e){return e+1}))}},j=function(){var e=(0,l.th)();return function(t){return(0,c.oG)(e,t)}},w=function(){var e=(0,l.th)();return function(t){return(0,c.KF)(e,t)}},x=function(){var e=(0,l.th)();return function(t){return(0,c.nt)(e,t)}}},73787:function(e,t,n){n.d(t,{R:function(){return i}});n(47941),n(82526),n(57327),n(41539),n(88449),n(2490),n(59849),n(38880),n(15581),n(34514),n(54747),n(49337),n(33321),n(69070);var r=n(4942),a=n(4480);function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){(0,r.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var i={rules:[],error:"",id:null,loading:!0,loaded:!1,initialLoad:!1};t.Z=(0,a.xu)({key:"silencingRulesState",default:function(e){return function(e){return l(l({},i),{},{id:e})}(e)}})},84944:function(e,t,n){var r=n(82109),a=n(6790),o=n(47908),l=n(26244),i=n(19303),c=n(65417);r({target:"Array",proto:!0},{flat:function(){var e=arguments.length?arguments[0]:void 0,t=o(this),n=l(t),r=c(t,0);return r.length=a(r,t,t,n,0,void 0===e?1:i(e)),r}})},92686:function(e,t,n){n(51223)("flat")}}]);
\ No newline at end of file |