web-interface.assets.bb8c8232-8316.db921fb12953c5acf651.js Maven / Gradle / Ivy
"use strict";(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["bb8c8232-8316"],{rDZEPRYo:($,y,e)=>{e.d(y,{A:()=>C});var t=e("Z7aTuO5B"),m=e("P98ee3gW"),c=e("HhRuy6uH");const s=({children:A,disabled:I})=>t.createElement(m.A,{title:c.$N,bsSize:"xsmall",pullRight:!0,buttonTitle:c.qE,disabled:I},A);s.defaultProps={disabled:!1};const C=s},SfPIQIJE:($,y,e)=>{e.d(y,{A:()=>L});var t=e("Z7aTuO5B"),m=e("J6y4/h8P"),c=e("rIl5IEuP"),s=e("ty2gyrHp"),C=e("IOI9nV80"),A=e("NV1/EHMi");const I=(0,m.default)(c.ButtonToolbar)`
margin-bottom: 10px;
`,P=(0,m.default)(c.Button)(({theme:E})=>(0,m.css)`
font-family: ${E.fonts.family.navigation};
font-size: ${E.fonts.size.navigation};
color: ${E.colors.variant.darker.default};
&:hover,
&:focus {
background: inherit;
text-decoration: none;
}
&:hover {
color: inherit;
${(0,A.WS)(E)}
}
&.active {
color: ${E.colors.global.textDefault};
${(0,A.at)(E)}
&:hover,
&:focus {
${(0,A.at)(E)}
}
`);P.displayName="Button";const L=({items:E})=>t.createElement(I,null,E.map(({path:N,title:h,permissions:U,exactPathMatch:W})=>N?t.createElement(C.Wj,{permissions:U!=null?U:[],key:N},t.createElement(s.m,{to:N,relativeActive:!W},t.createElement(P,{bsStyle:"link"},t.createElement(A.Ay,null,h)))):null))},jvpdvVQ7:($,y,e)=>{e.d(y,{A:()=>I});var t=e("Z7aTuO5B"),m=e("SfPIQIJE"),c=e("d4kzUuQm"),s=e("rIl5IEuP");const C=[{title:"Alerts & Events",path:c.Ay.ALERTS.LIST,exactPathMatch:!0},{title:"Event Definitions",path:c.Ay.ALERTS.DEFINITIONS.LIST},{title:"Notifications",path:c.Ay.ALERTS.NOTIFICATIONS.LIST}],I=()=>t.createElement(s.Row,null,t.createElement(m.A,{items:C}))},"1hA+0wID":($,y,e)=>{e.r(y),e.d(y,{default:()=>ct});var t=e("Z7aTuO5B"),m=e("ty2gyrHp"),c=e("rIl5IEuP"),s=e("IOI9nV80"),C=e("rVdVsuGH"),A=e("Dg3D5NJi"),I=e("qO9czYNI");const P="event_notifications",O={pageSize:20,sort:{attributeId:"title",direction:"asc"},displayedColumns:["title","description","type","created_at"],columnsOrder:["title","description","type","created_at"]};var L=e("8OvTct/Z"),E=e("v4GbOr/o"),N=e("MdYBRjRJ"),h=e("0t7Ye+61"),U=e("QL8i6bcz");const W=o=>o===void 0?{}:U.d.exports("eventNotificationTypes").find(n=>n.type===o)||{displayName:null},J=({notification:o})=>{const n=W(o.config.type);return t.createElement("div",null,(n==null?void 0:n.displayName)||o.config.type)};var z=e("d4kzUuQm");const V=({notification:o,testResults:n})=>{const i=n==null?void 0:n[o.id];return t.createElement(t.Fragment,null,t.createElement(m.N,{to:z.Ay.ALERTS.NOTIFICATIONS.show(o.id)},o.title),(i==null?void 0:i.id)===o.id?t.createElement("div",null,i.isLoading?t.createElement(s.y$,{text:"Testing Notification..."}):t.createElement("p",{className:i.error?"text-danger":"text-success"},t.createElement("b",null,i.error?"Error":"Success",":")," ",i.message)):null)};var M=e("jAGDuYSC"),K=e("J7MaobQD"),Y=e("HqzDVmZB"),j=e("JNPySgKz"),G=e("rDZEPRYo");const X=({isTestLoading:o,notification:n,refetchEventNotification:i,onTest:r})=>{const{deselectEntity:a}=(0,j.A)(),[l,d]=(0,t.useState)(!1),[v,S]=(0,t.useState)(void 0),D=(0,L.A)(),{pathname:g}=(0,h.A)(),R=()=>{D(E.g.NOTIFICATIONS.ROW_ACTION_DELETE_CLICKED,{app_pathname:(0,N.i)(g),app_section:"event-notification",app_action_value:"notification-delete"}),d(!0)},p=()=>{d(!1),i()},T=()=>{K.M.delete(n).then(()=>{a(n.id),M.A.success("Event Notification deleted successfully",`Event Notification "${n.title}" was deleted successfully.`)},f=>{M.A.error(`Deleting Event Notification "${n.title}" failed with status: ${f}`,"Could not delete Event Notification")}).finally(()=>{p()})};return t.createElement(t.Fragment,null,t.createElement(c.ButtonToolbar,null,t.createElement(s.wD,{entityType:"notification",entityId:n.id,onClick:()=>S(n),bsSize:"xsmall"}),t.createElement(G.A,null,t.createElement(s.Wj,{permissions:`eventnotifications:edit:${n.id}`},t.createElement(m.m,{to:z.Ay.ALERTS.NOTIFICATIONS.edit(n.id)},t.createElement(c.MenuItem,null,"Edit"))),t.createElement(s.Wj,{permissions:[`eventnotifications:edit:${n.id}`,`eventnotifications:delete:${n.id}`],anyPermissions:!0},t.createElement(s.Wj,{permissions:`eventnotifications:edit:${n.id}`},t.createElement(c.MenuItem,{disabled:o,onClick:()=>r(n)},o?"Testing...":"Test Notification")),t.createElement(c.MenuItem,{divider:!0}),t.createElement(s.Wj,{permissions:`eventnotifications:delete:${n.id}`},t.createElement(c.MenuItem,{onClick:R,variant:"danger"},"Delete"))))),l&&t.createElement(s.TM,{title:"Delete Notification",show:!0,onConfirm:T,onCancel:p},`Are you sure you want to delete "${n.title}"`),v&&t.createElement(Y.A,{entityId:n.id,entityType:"notification",description:"Search for a user or team to add as collaborator on this notification.",entityTitle:n.title,onClose:()=>S(void 0)}))};var k=e("efAt+LzL"),w=e.n(k),x=e("DUKaTDO2"),_=e("U1Iufsob"),q=e("eFxcQyPT"),H=e("TJOheZRu"),tt=e("Z2BtcgLJ");const et=({refetchEventNotifications:o})=>{const n=(0,x.useQueryClient)(),i=(0,L.A)(),{pathname:r}=(0,h.A)(),{selectedEntities:a,setSelectedEntities:l}=(0,j.A)(),d=a==null?void 0:a.length,v=H.A.pluralize(d,"event notification","event notifications"),S=(0,t.useCallback)(()=>{if(i(E.g.NOTIFICATIONS.BULK_ACTION_DELETE_CLICKED,{app_pathname:(0,N.i)(r),app_section:"event-notification-bulk",app_action_value:"bulk-delete-button"}),window.confirm(`Do you really want to remove ${d} ${v}?`)){const D=a.map(g=>(0,q.Ay)("DELETE",(0,N.H3)(_.A.EventNotificationsApiController.delete(g).url)).then(()=>g));Promise.allSettled(D).then(g=>{const p=g.filter(f=>f.status==="fulfilled").map(({value:f})=>f),T=a==null?void 0:a.filter(f=>!p.includes(f));if(T.length){const f=g.filter(B=>B.status==="rejected"),b=w()(f.map(B=>B.reason.responseMessage));T.length!==a.length&&n.invalidateQueries(["eventNotifications","overview"]),M.A.error(`${T.length} out of ${a} selected ${v} could not be deleted. Status: ${b.join()}`);return}n.invalidateQueries(["eventNotifications","overview"]),l(T),o(),M.A.success(`${d} ${v} ${H.A.pluralize(d,"was","were")} deleted successfully.`,"Success")})}},[i,r,d,v,a,n,l,o]);return t.createElement(tt.A,null,t.createElement(c.MenuItem,{onSelect:()=>S(),variant:"danger"},"Delete"))},nt=(o,{enabled:n}={enabled:!0})=>{const{data:i,refetch:r,isInitialLoading:a}=(0,x.useQuery)(["eventNotifications","overview",o],()=>K.c.searchPaginated(o.page,o.pageSize,o.query,{sort:o==null?void 0:o.sort.attributeId,order:o==null?void 0:o.sort.direction}),{onError:l=>{M.A.error(`Loading event notifications failed with status: ${l}`,"Could not load event notifications")},keepPreviousData:!0,enabled:n});return{data:i,refetch:r,isInitialLoading:a}},ot=()=>{const[o,n]=(0,t.useState)(void 0),i=r=>{n({[r.id]:{isLoading:!0,id:r.id}});let a={isLoading:!1,id:null,error:null,message:null};K.M.testPersisted(r).then(l=>(a={...a,id:r.id,error:!1,message:"Notification was executed successfully."},n({[r.id]:a}),l),l=>(a={isLoading:!1,id:r.id,error:!0,message:null},(l.status!==400||!l.additional.body||!l.additional.body.failed)&&(a.message=l.responseMessage||"Unknown errorResponse, please check your Graylog server logs."),n({[r.id]:a}),l))};return{isLoadingTest:o==null?void 0:o.isLoading,testResults:o,getNotificationTest:i}},it=o=>({attributes:{title:{renderCell:(n,i)=>t.createElement(V,{notification:i,testResults:o})},type:{renderCell:(n,i)=>t.createElement(J,{notification:i})}}}),at=()=>{const[o,n]=(0,t.useState)(""),{layoutConfig:i,isInitialLoading:r}=(0,A.A)({entityTableId:P,defaultPageSize:O.pageSize,defaultDisplayedAttributes:O.displayedColumns,defaultSort:O.sort}),a=(0,C.Ay)(void 0,i.pageSize,!1),{mutate:l}=(0,I.A)(P),{data:d,refetch:v,isInitialLoading:S}=nt({query:o,page:a.page,pageSize:i.pageSize,sort:i.sort}),{isLoadingTest:D,testResults:g,getNotificationTest:R}=ot(),p=(0,L.A)(),{pathname:T}=(0,h.A)(),f=(0,t.useMemo)(()=>it(g),[g]),b=(0,t.useMemo)(()=>{var u;return[...(u=d==null?void 0:d.attributes)!=null?u:[]]},[d==null?void 0:d.attributes]),B=(0,t.useCallback)(u=>{a.setPagination({page:1,pageSize:u}),l({perPage:u})},[a,l]),Q=(0,t.useCallback)(u=>{a.resetPage(),n(u)},[a]),rt=(0,t.useCallback)(()=>{Q("")},[Q]),ut=(0,t.useCallback)(u=>{l({displayedAttributes:u})},[l]),dt=(0,t.useCallback)(u=>{a.resetPage(),l({sort:u})},[a,l]),Z=(0,t.useCallback)(u=>{p(E.g.NOTIFICATIONS.ROW_ACTION_TEST_CLICKED,{app_pathname:(0,N.i)(T),app_section:"event-notification",app_action_value:"notification-test"}),R(u),v()},[R,T,v,p]),Et=(0,t.useCallback)(u=>t.createElement(X,{notification:u,refetchEventNotification:v,isTestLoading:D,onTest:Z}),[Z,D,v]);if(r||S)return t.createElement(s.y$,null);const{elements:F,pagination:{total:vt}}=d;return t.createElement(s.OW,{pageSize:i.pageSize,showPageSizeSelect:!1,totalItems:vt},t.createElement("div",{style:{marginBottom:5}},t.createElement(s.B9,{onSearch:Q,onReset:rt,queryHelpComponent:t.createElement(s.xf,{entityName:"notification"})})),t.createElement("div",null,(F==null?void 0:F.length)===0?t.createElement(s.EO,null,"No notification has been found"):t.createElement(s.UA,{data:F,visibleColumns:i.displayedAttributes,columnsOrder:O.columnsOrder,onColumnsChange:ut,onSortChange:dt,bulkSelection:{actions:t.createElement(et,{refetchEventNotifications:v})},activeSort:i.sort,onPageSizeChange:B,pageSize:i.pageSize,rowActions:Et,actionsCellWidth:160,columnRenderers:f,columnDefinitions:b})))};var st=e("E+CaPsQD"),lt=e("jvpdvVQ7");const ct=()=>t.createElement(s.Qc,{title:"Notifications"},t.createElement(lt.A,null),t.createElement(s.zY,{title:"Notifications",actions:t.createElement(s.Wj,{permissions:"eventnotifications:create"},t.createElement(m.m,{to:z.Ay.ALERTS.NOTIFICATIONS.CREATE},t.createElement(c.Button,{bsStyle:"success"},"Create notification"))),documentationLink:{title:"Alerts documentation",path:st.A.PAGES.ALERTS}},t.createElement("span",null,"Notifications alert you of any configured Event when they occur. Graylog can send Notifications directly to you or to other systems you use for that purpose. Remember to assign Notifications while creating or editing an Event Definition.")),t.createElement(c.Row,{className:"content"},t.createElement(c.Col,{md:12},t.createElement(at,null))))}}]);})();
//# sourceMappingURL=bb8c8232-8316.db921fb12953c5acf651.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy