web-interface.assets.bb8c8232-1143.d97cae61cfd6dd8c0ce8.js Maven / Gradle / Ivy
(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["bb8c8232-1143"],{SfPIQIJE:(R,h,t)=>{"use strict";t.d(h,{A:()=>O});var e=t("Z7aTuO5B"),u=t("J6y4/h8P"),o=t("rIl5IEuP"),v=t("ty2gyrHp"),T=t("IOI9nV80"),p=t("NV1/EHMi");const I=(0,u.default)(o.ButtonToolbar)`
margin-bottom: 10px;
`,g=(0,u.default)(o.Button)(({theme:E})=>(0,u.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,p.WS)(E)}
}
&.active {
color: ${E.colors.global.textDefault};
${(0,p.at)(E)}
&:hover,
&:focus {
${(0,p.at)(E)}
}
`);g.displayName="Button";const O=({items:E})=>e.createElement(I,null,E.map(({path:P,title:S,permissions:y,exactPathMatch:m})=>P?e.createElement(T.Wj,{permissions:y!=null?y:[],key:P},e.createElement(v.m,{to:P,relativeActive:!m},e.createElement(g,{bsStyle:"link"},e.createElement(p.Ay,null,S)))):null))},"42lc8BRs":(R,h,t)=>{"use strict";t.d(h,{A:()=>X});var e=t("Z7aTuO5B"),u=t("ii0bleBb"),o=t.n(u),v=t("VZ0CjfW1"),T=t.n(v),p=t("IW7priiX"),I=t.n(p),g=t("IOI9nV80"),A=t("d4kzUuQm"),O=t("J7MaobQD"),E=t("N6x7vnl1"),P=t("/yh+QgO6"),S=t.n(P),y=t("QL8i6bcz"),m=t("rIl5IEuP"),x=t("S6FuRS7B"),V=t("BqxuktKK"),L=t("MdYBRjRJ"),b=t("v4GbOr/o"),j=t("HCsT5Gmk"),Q=Object.defineProperty,G=(r,i,n)=>i in r?Q(r,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[i]=n,C=(r,i,n)=>(G(r,typeof i!="symbol"?i+"":i,n),n);const U=r=>r===void 0?{}:y.d.exports("eventNotificationTypes").find(i=>i.type===r)||{},$=()=>y.d.exports("eventNotificationTypes").map(r=>({label:r.displayName,value:r.type}));class M extends e.Component{constructor(i){super(i),C(this,"setIsSubmitEnabled",n=>{this.setState({isSubmitEnabled:n})}),C(this,"handleSubmit",n=>{const{notification:a,onSubmit:s,sendTelemetry:l,action:c,location:d}=this.props;l(c==="create"?b.g.NOTIFICATIONS.CREATE_CLICKED:b.g.NOTIFICATIONS.EDIT_CLICKED,{app_pathname:(0,L.i)(d.pathname),app_section:"event-notification",app_action_value:`${c}-button`}),n.preventDefault(),s(a)}),C(this,"handleChange",n=>{const{name:a}=n.target,{onChange:s}=this.props;s(a,(0,x.yG)(n.target))}),C(this,"handleConfigChange",n=>{const{onChange:a}=this.props;a("config",n)}),C(this,"handleTypeChange",n=>{const{sendTelemetry:a,location:s}=this.props;a(b.g.EVENTDEFINITION_NOTIFICATIONS.NOTIFICATION_TYPE_SELECTED,{app_pathname:(0,L.i)(s.pathname),app_section:"event-definition-notifications",app_action_value:"notification-type-select",notification_type:n});const c=U(n).defaultConfig||{};this.handleConfigChange({...c,type:n})}),C(this,"handleTestTrigger",()=>{const{notification:n,onTest:a,sendTelemetry:s,location:l}=this.props;s(b.g.NOTIFICATIONS.EXECUTE_TEST_CLICKED,{app_pathname:(0,L.i)(l.pathname),app_section:"event-notification",app_action_value:"execute-test-button"}),a(n)}),this.state={isSubmitEnabled:!0}}render(){const{action:i,embedded:n,formId:a,notification:s,onCancel:l,validation:c,testResult:d}=this.props,{isSubmitEnabled:N}=this.state,f=U(s.config.type),K=f.formComponent?e.createElement(f.formComponent,{config:s.config,onChange:this.handleConfigChange,validation:c,setIsSubmitEnabled:this.setIsSubmitEnabled}):null,Y=d.isLoading?e.createElement(g.y$,{text:"Testing..."}):"Execute Test Notification";return e.createElement(m.Row,null,e.createElement(m.Col,{lg:8},e.createElement("form",{onSubmit:this.handleSubmit,id:a},e.createElement(m.Input,{id:"notification-title",name:"title",label:"Title",type:"text",bsStyle:c.errors.title?"error":null,help:S()(c,"errors.title[0]","Title to identify this Notification."),value:s.title,onChange:this.handleChange,required:!0,autoFocus:!0}),e.createElement(m.Input,{id:"notification-description",name:"description",label:e.createElement("span",null,"Description ",e.createElement("small",{className:"text-muted"},"(Optional)")),type:"textarea",help:"Longer description for this Notification.",value:s.description,onChange:this.handleChange,rows:2}),e.createElement(m.FormGroup,{controlId:"notification-type",validationState:c.errors.config?"error":null},e.createElement(m.ControlLabel,null,"Notification Type"),e.createElement(g.l6,{id:"notification-type",options:$(),value:s.config.type,onChange:this.handleTypeChange,clearable:!1,required:!0}),e.createElement(m.HelpBlock,null,S()(c,"errors.config[0]","Choose the type of Notification to create."))),K,K&&e.createElement(m.FormGroup,null,e.createElement(m.ControlLabel,null,"Test Notification ",e.createElement("small",{className:"text-muted"},"(Optional)")),e.createElement(m.FormControl.Static,null,e.createElement(m.Button,{bsStyle:"info",bsSize:"small",disabled:d.isLoading,onClick:this.handleTestTrigger},Y)),d.message&&e.createElement(m.Alert,{bsStyle:d.error?"danger":"success",title:d.error?"Error: ":"Success: "},d.message),e.createElement(m.HelpBlock,null,"Execute this Notification with a test Alert.")),!n&&e.createElement(g.hP,{disabledSubmit:!N,submitButtonText:`${i==="create"?"Create":"Update"} notification`,onCancel:l}))))}}C(M,"propTypes",{action:o().oneOf(["create","edit"]),notification:o().object.isRequired,validation:o().object.isRequired,testResult:o().shape({isLoading:o().bool,error:o().bool,message:o().string}).isRequired,formId:o().string,embedded:o().bool.isRequired,onChange:o().func.isRequired,onCancel:o().func.isRequired,onSubmit:o().func.isRequired,onTest:o().func.isRequired,sendTelemetry:o().func.isRequired,location:o().object.isRequired}),C(M,"defaultProps",{action:"edit",formId:void 0});const z=(0,j.A)((0,V.A)(M));var H=Object.defineProperty,Z=(r,i,n)=>i in r?H(r,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[i]=n,D=(r,i,n)=>(Z(r,typeof i!="symbol"?i+"":i,n),n);const W={errors:{}},_={isLoading:!1},B=class F extends e.Component{constructor(i){super(i),D(this,"handleChange",(n,a)=>{const{notification:s}=this.state,l=I()(s);l[n]=a,this.setState({notification:l,isDirty:!0,testResult:_})}),D(this,"handleCancel",()=>{const{history:n}=this.props;n.push(A.Ay.ALERTS.NOTIFICATIONS.LIST)}),D(this,"handleSubmit",()=>{const{action:n,embedded:a,onSubmit:s,history:l}=this.props,{notification:c}=this.state;this.setState({isDirty:!1});let d;n==="create"?(d=O.M.create(c),d.then(()=>{a||l.push(A.Ay.ALERTS.NOTIFICATIONS.LIST)},N=>{const{body:f}=N.additional;N.status===400&&f&&f.failed&&(this.setState({validation:f}),F.scrollToFirstError())})):(d=O.M.update(c.id,c),d.then(()=>{a||l.push(A.Ay.ALERTS.NOTIFICATIONS.LIST)},N=>{const{body:f}=N.additional;N.status===400&&f&&f.failed&&(this.setState({validation:f}),F.scrollToFirstError())})),s(d)}),D(this,"handleTest",()=>{const{notification:n}=this.state;this.setState({testResult:{isLoading:!0},validation:W});const a=T()(_);this.testPromise=O.M.test(n),this.testPromise.then(s=>(a.error=!1,a.message="Notification was executed successfully.",s),s=>{a.error=!0;const{body:l}=s.additional;s.status===400&&l&&l.failed?(a.message="Validation failed, please correct any errors in the form before continuing.",this.setState({validation:l})):a.message=s.responseMessage||"Unknown error, please check your Graylog server logs."}).finally(()=>{this.setState({testResult:a}),this.testPromise=void 0})}),this.state={notification:i.notification,validation:W,testResult:_,isDirty:!1}}static scrollToFirstError(){document.getElementsByClassName("has-error")[0]!==void 0&&document.getElementsByClassName("has-error")[0].scrollIntoView(!0)}componentWillUnmount(){this.testPromise&&this.testPromise.cancel()}render(){const{action:i,embedded:n,formId:a}=this.props,{notification:s,validation:l,testResult:c,isDirty:d}=this.state;return e.createElement(e.Fragment,null,!n&&d&&e.createElement(g.Oj,{question:"Do you really want to abandon this page and lose your changes? This action cannot be undone."}),e.createElement(z,{action:i,notification:s,validation:l,testResult:c,formId:a,embedded:n,onChange:this.handleChange,onCancel:this.handleCancel,onSubmit:this.handleSubmit,onTest:this.handleTest}))}};D(B,"propTypes",{action:o().oneOf(["create","edit"]),notification:o().object,embedded:o().bool,formId:o().string,onSubmit:o().func,history:o().object.isRequired}),D(B,"defaultProps",{action:"edit",notification:{title:"",description:"",config:{}},embedded:!1,formId:void 0,onSubmit:()=>{}});let J=B;const X=(0,E.A)(J)},jvpdvVQ7:(R,h,t)=>{"use strict";t.d(h,{A:()=>I});var e=t("Z7aTuO5B"),u=t("SfPIQIJE"),o=t("d4kzUuQm"),v=t("rIl5IEuP");const T=[{title:"Alerts & Events",path:o.Ay.ALERTS.LIST,exactPathMatch:!0},{title:"Event Definitions",path:o.Ay.ALERTS.DEFINITIONS.LIST},{title:"Notifications",path:o.Ay.ALERTS.NOTIFICATIONS.LIST}],I=()=>e.createElement(v.Row,null,e.createElement(u.A,{items:T}))},ipCdamDE:(R,h,t)=>{"use strict";t.r(h),t.d(h,{default:()=>P});var e=t("Z7aTuO5B"),u=t("rIl5IEuP"),o=t("IOI9nV80"),v=t("d4kzUuQm"),T=t("E+CaPsQD"),p=t("yGRmSjYM"),I=t("42lc8BRs"),g=t("jvpdvVQ7"),A=t("q2j1bVbz"),O=t("/7OuCFNo");const P=()=>{const S=(0,A.A)(),y=(0,O.A)();return(0,p.Nn)(S.permissions,"eventnotifications:create")||y.push(v.Ay.NOTFOUND),e.createElement(o.Qc,{title:"New Notification"},e.createElement(g.A,null),e.createElement(o.zY,{title:"New Notification",documentationLink:{title:"Alerts documentation",path:T.A.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.")),e.createElement(u.Row,{className:"content"},e.createElement(u.Col,{md:12},e.createElement(I.A,{action:"create"}))))}},VZ0CjfW1:(R,h,t)=>{var e=t("8U3oBBH1"),u=4;function o(v){return e(v,u)}R.exports=o}}]);})();
//# sourceMappingURL=bb8c8232-1143.d97cae61cfd6dd8c0ce8.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy