All Downloads are FREE. Search and download functionalities are using the official Maven repository.

web-interface.assets.1255d548-9985.82f1e6e34e3f4c54485c.js Maven / Gradle / Ivy

There is a newer version: 6.1.4
Show newest version
"use strict";(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["1255d548-9985"],{"1hA+0wID":(Ee,$,o)=>{o.r($),o.d($,{default:()=>le});var e=o("Z7aTuO5B"),A=o("ty2gyrHp"),m=o("uZqmR+ju"),c=o("/GOzvPf6"),F=o("rVdVsuGH"),j=o("Dg3D5NJi"),H=o("qO9czYNI");const b="event_notifications",S={pageSize:20,sort:{attributeId:"title",direction:"asc"},displayedColumns:["title","description","type","created_at"],columnsOrder:["title","description","type","created_at"]};var D=o("8OvTct/Z"),L=o("v4GbOr/o"),h=o("MdYBRjRJ"),I=o("0t7Ye+61"),x=o("QL8i6bcz");const G=t=>t===void 0?{}:x.G.exports("eventNotificationTypes").find(n=>n.type===t)||{displayName:null},J=({notification:t})=>{const n=G(t.config.type);return e.createElement("div",null,(n==null?void 0:n.displayName)||t.config.type)};var Z=o("d4kzUuQm");const K=({notification:t,testResults:n})=>{const i=n==null?void 0:n[t.id];return e.createElement(e.Fragment,null,e.createElement(A.r,{to:Z.ZP.ALERTS.NOTIFICATIONS.show(t.id)},t.title),(i==null?void 0:i.id)===t.id?e.createElement("div",null,i.isLoading?e.createElement(c.$j,{text:"Testing Notification..."}):e.createElement("p",{className:i.error?"text-danger":"text-success"},e.createElement("b",null,i.error?"Error":"Success",":")," ",i.message)):null)};var C=o("jAGDuYSC"),O=o("J7MaobQD"),Y=o("HqzDVmZB"),V=o("HQjpSCKK"),B=o("HhRuy6uH");const w=({isTestLoading:t,notification:n,refetchEventNotification:i,onTest:l})=>{const[s,a]=(0,e.useState)(!1),[u,d]=(0,e.useState)(void 0),T=(0,D.Z)(),{pathname:g}=(0,I.Z)(),v=()=>{T(L.A.NOTIFICATIONS.ROW_ACTION_DELETE_CLICKED,{app_pathname:(0,h.av)(g),app_section:"event-notification",app_action_value:"notification-delete"}),a(!0)},y=()=>{a(!1),i()},p=()=>{O.e.delete(n).then(()=>{C.Z.success("Event Notification deleted successfully",`Event Notification "${n.title}" was deleted successfully.`)},f=>{C.Z.error(`Deleting Event Notification "${n.title}" failed with status: ${f}`,"Could not delete Event Notification")}).finally(()=>{y()})};return e.createElement(e.Fragment,null,e.createElement(m.ButtonToolbar,null,e.createElement(c.Tz,{entityType:"notification",entityId:n.id,onClick:()=>d(n),bsSize:"xsmall"}),e.createElement(V.Z,{title:B.zN,buttonTitle:B.V,bsSize:"xsmall",dropdownZIndex:1e3},e.createElement(c.AE,{permissions:`eventnotifications:edit:${n.id}`},e.createElement(A.J,{to:Z.ZP.ALERTS.NOTIFICATIONS.edit(n.id)},e.createElement(m.MenuItem,null,"Edit"))),e.createElement(c.AE,{permissions:[`eventnotifications:edit:${n.id}`,`eventnotifications:delete:${n.id}`],anyPermissions:!0},e.createElement(c.AE,{permissions:`eventnotifications:edit:${n.id}`},e.createElement(m.MenuItem,{disabled:t,onClick:()=>l(n)},t?"Testing...":"Test Notification")),e.createElement(m.MenuItem,{divider:!0}),e.createElement(c.AE,{permissions:`eventnotifications:delete:${n.id}`},e.createElement(m.MenuItem,{onClick:v},"Delete"))))),s&&e.createElement(c.QH,{title:"Delete Notification",show:!0,onConfirm:p,onCancel:y},`Are you sure you want to delete "${n.title}"`),u&&e.createElement(Y.Z,{entityId:n.id,entityType:"notification",description:"Search for a user or team to add as collaborator on this notification.",entityTitle:n.title,onClose:()=>d(void 0)}))};var W=o("efAt+LzL"),k=o.n(W),Q=o("DUKaTDO2"),X=o("U1Iufsob"),q=o("eFxcQyPT"),U=o("TJOheZRu"),_=o("Z2BtcgLJ");const ee=({selectedNotificationsIds:t,setSelectedNotificationsIds:n,refetchEventNotifications:i})=>{const l=(0,Q.useQueryClient)(),s=(0,D.Z)(),{pathname:a}=(0,I.Z)(),u=t==null?void 0:t.length,d=U.Z.pluralize(u,"event notification","event notifications"),T=(0,e.useCallback)(()=>{if(s(L.A.NOTIFICATIONS.BULK_ACTION_DELETE_CLICKED,{app_pathname:(0,h.av)(a),app_section:"event-notification-bulk",app_action_value:"bulk-delete-button"}),window.confirm(`Do you really want to remove ${u} ${d}?`)){const g=t.map(v=>(0,q.ZP)("DELETE",(0,h.DC)(X.Z.EventNotificationsApiController.delete(v).url)).then(()=>v));Promise.allSettled(g).then(v=>{const p=v.filter(E=>E.status==="fulfilled").map(({value:E})=>E),f=t==null?void 0:t.filter(E=>!p.includes(E));if(f.length){const E=v.filter(N=>N.status==="rejected"),z=k()(E.map(N=>N.reason.responseMessage));f.length!==t.length&&l.invalidateQueries(["eventNotifications","overview"]),C.Z.error(`${f.length} out of ${t} selected ${d} could not be deleted. Status: ${z.join()}`);return}l.invalidateQueries(["eventNotifications","overview"]),n(f),i(),C.Z.success(`${u} ${d} ${U.Z.pluralize(u,"was","were")} deleted successfully.`,"Success")})}},[s,a,u,d,t,l,n,i]);return e.createElement(_.Z,{selectedEntities:t,setSelectedEntities:n},e.createElement(m.MenuItem,{onSelect:()=>T()},"Delete"))},te=(t,{enabled:n}={enabled:!0})=>{const{data:i,refetch:l,isInitialLoading:s}=(0,Q.useQuery)(["eventNotifications","overview",t],()=>O.O.searchPaginated(t.page,t.pageSize,t.query,{sort:t==null?void 0:t.sort.attributeId,order:t==null?void 0:t.sort.direction}),{onError:a=>{C.Z.error(`Loading event notifications failed with status: ${a}`,"Could not load event notifications")},keepPreviousData:!0,enabled:n});return{data:i,refetch:l,isInitialLoading:s}},ne=()=>{const[t,n]=(0,e.useState)(void 0),i=l=>{n({[l.id]:{isLoading:!0,id:l.id}});let s={isLoading:!1,id:null,error:null,message:null};O.e.testPersisted(l).then(a=>(s={...s,id:l.id,error:!1,message:"Notification was executed successfully."},n({[l.id]:s}),a),a=>(s={isLoading:!1,id:l.id,error:!0,message:null},(a.status!==400||!a.additional.body||!a.additional.body.failed)&&(s.message=a.responseMessage||"Unknown errorResponse, please check your Graylog server logs."),n({[l.id]:s}),a))};return{isLoadingTest:t==null?void 0:t.isLoading,testResults:t,getNotificationTest:i}};var Se=o("ava0cCRK");const oe=t=>({attributes:{title:{renderCell:(n,i)=>e.createElement(K,{notification:i,testResults:t})},type:{renderCell:(n,i)=>e.createElement(J,{notification:i})}}}),ie=()=>{const[t,n]=(0,e.useState)(""),{layoutConfig:i,isInitialLoading:l}=(0,j.Z)({entityTableId:b,defaultPageSize:S.pageSize,defaultDisplayedAttributes:S.displayedColumns,defaultSort:S.sort}),s=(0,F.ZP)(void 0,i.pageSize,!1),{mutate:a}=(0,H.Z)(b),{data:u,refetch:d,isInitialLoading:T}=te({query:t,page:s.page,pageSize:i.pageSize,sort:i.sort}),{isLoadingTest:g,testResults:v,getNotificationTest:y}=ne(),p=(0,D.Z)(),{pathname:f}=(0,I.Z)(),E=(0,e.useMemo)(()=>oe(v),[v]),z=(0,e.useMemo)(()=>{var r;return[...(r=u==null?void 0:u.attributes)!=null?r:[]]},[u==null?void 0:u.attributes]),N=(0,e.useCallback)(r=>{s.setPagination({page:1,pageSize:r}),a({perPage:r})},[s,a]),P=(0,e.useCallback)(r=>{s.resetPage(),n(r)},[s]),re=(0,e.useCallback)(()=>{P("")},[P]),ce=(0,e.useCallback)(r=>{a({displayedAttributes:r})},[a]),ue=(0,e.useCallback)(r=>{s.resetPage(),a({sort:r})},[s,a]),M=(0,e.useCallback)(r=>{p(L.A.NOTIFICATIONS.ROW_ACTION_TEST_CLICKED,{app_pathname:(0,h.av)(f),app_section:"event-notification",app_action_value:"notification-test"}),y(r),d()},[y,f,d,p]),de=(0,e.useCallback)(r=>e.createElement(w,{notification:r,refetchEventNotification:d,isTestLoading:g,onTest:M}),[M,g,d]),ve=(r,fe)=>e.createElement(ee,{selectedNotificationsIds:r,setSelectedNotificationsIds:fe,refetchEventNotifications:d});if(l||T)return e.createElement(c.$j,null);const{elements:R,pagination:{total:me}}=u;return e.createElement(c.l9,{pageSize:i.pageSize,showPageSizeSelect:!1,totalItems:me},e.createElement("div",{style:{marginBottom:5}},e.createElement(c.UI,{onSearch:P,onReset:re,queryHelpComponent:e.createElement(c.y8,{entityName:"notification"})})),e.createElement("div",null,(R==null?void 0:R.length)===0?e.createElement(c.pJ,null,"No notification has been found"):e.createElement(c.$E,{data:R,visibleColumns:i.displayedAttributes,columnsOrder:S.columnsOrder,onColumnsChange:ce,onSortChange:ue,bulkSelection:{actions:ve},activeSort:i.sort,onPageSizeChange:N,pageSize:i.pageSize,rowActions:de,actionsCellWidth:160,columnRenderers:E,columnDefinitions:z})))};var ae=o("E+CaPsQD"),se=o("jvpdvVQ7");const le=()=>e.createElement(c.$4,{title:"Notifications"},e.createElement(se.Z,null),e.createElement(c.mr,{title:"Notifications",actions:e.createElement(c.AE,{permissions:"eventnotifications:create"},e.createElement(A.J,{to:Z.ZP.ALERTS.NOTIFICATIONS.CREATE},e.createElement(m.Button,{bsStyle:"success"},"Create notification"))),documentationLink:{title:"Alerts documentation",path:ae.Z.PAGES.ALERTS}},e.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.")),e.createElement(m.Row,{className:"content"},e.createElement(m.Col,{md:12},e.createElement(ie,null))))}}]);})();

//# sourceMappingURL=1255d548-9985.82f1e6e34e3f4c54485c.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy