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

web-interface.assets.325e2d4b-4053.86f6ebe6c5a0849f485c.js Maven / Gradle / Ivy

There is a newer version: 6.0.1
Show newest version
"use strict";(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["325e2d4b-4053"],{TADW41AU:(e,t,i)=>{i.d(t,{Z:()=>u});var n=i("Z7aTuO5B"),o=i("ii0bleBb"),s=i.n(o),a=i("EeAwn/0x"),r=i("F9olzlTR"),l=i("0zTRKSqx"),c=i("DeVaSktS");const d=e=>{let{notificationId:t}=e;return n.createElement(r.Si,null,n.createElement(l.AE,{permissions:`eventnotifications:read:${t}`},n.createElement(a.J,{to:c.ZP.ALERTS.NOTIFICATIONS.show(t)},n.createElement(r.zx,{bsStyle:"success"},"View Details"))),n.createElement(l.AE,{permissions:`eventnotifications:edit:${t}`},n.createElement(a.J,{to:c.ZP.ALERTS.NOTIFICATIONS.edit(t)},n.createElement(r.zx,{bsStyle:"success"},"Edit Notification"))))};d.propTypes={notificationId:s().string.isRequired};const u=d},x85XLEUc:(e,t,i)=>{i.d(t,{Z:()=>I});var n=i("Z7aTuO5B"),o=i("ii0bleBb"),s=i.n(o),a=i("nHcjWeCO"),r=i.n(a),l=i("0zTRKSqx"),c=i("BSHS2nUH"),d=i("DeVaSktS"),u=i("5GvVt6f3"),m=i("AztyBNMT"),h=i("F9olzlTR"),f=i("YyiN4DLW");function p(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}const b=e=>void 0===e?{}:m.PluginStore.exports("eventNotificationTypes").find((t=>t.type===e))||{};class g extends n.Component{constructor(e){super(e),p(this,"setIsSubmitEnabled",(e=>{this.setState({isSubmitEnabled:e})})),p(this,"handleSubmit",(e=>{const{notification:t,onSubmit:i}=this.props;e.preventDefault(),i(t)})),p(this,"handleChange",(e=>{const{name:t}=e.target,{onChange:i}=this.props;i(t,(0,f.n6)(e.target))})),p(this,"handleConfigChange",(e=>{const{onChange:t}=this.props;t("config",e)})),p(this,"handleTypeChange",(e=>{const t=b(e).defaultConfig||{};this.handleConfigChange({...t,type:e})})),p(this,"handleTestTrigger",(()=>{const{notification:e,onTest:t}=this.props;t(e)})),this.state={isSubmitEnabled:!0}}render(){const{action:e,embedded:t,formId:i,notification:o,onCancel:s,validation:a,testResult:c}=this.props,{isSubmitEnabled:d}=this.state,u=b(o.config.type),f=u.formComponent?n.createElement(u.formComponent,{config:o.config,onChange:this.handleConfigChange,validation:a,setIsSubmitEnabled:this.setIsSubmitEnabled}):null,p=c.isLoading?n.createElement(l.$j,{text:"Testing..."}):"Execute Test Notification";return n.createElement(h.X2,null,n.createElement(h.JX,{lg:8},n.createElement("form",{onSubmit:this.handleSubmit,id:i},n.createElement(h.II,{id:"notification-title",name:"title",label:"Title",type:"text",bsStyle:a.errors.title?"error":null,help:r().get(a,"errors.title[0]","Title to identify this Notification."),value:o.title,onChange:this.handleChange,required:!0,autoFocus:!0}),n.createElement(h.II,{id:"notification-description",name:"description",label:n.createElement("span",null,"Description ",n.createElement("small",{className:"text-muted"},"(Optional)")),type:"textarea",help:"Longer description for this Notification.",value:o.description,onChange:this.handleChange,rows:2}),n.createElement(h.cw,{controlId:"notification-type",validationState:a.errors.config?"error":null},n.createElement(h.J$,null,"Notification Type"),n.createElement(l.Ph,{id:"notification-type",options:m.PluginStore.exports("eventNotificationTypes").map((e=>({label:e.displayName,value:e.type}))),value:o.config.type,onChange:this.handleTypeChange,clearable:!1,required:!0}),n.createElement(h.Qb,null,r().get(a,"errors.config[0]","Choose the type of Notification to create."))),f,f&&n.createElement(h.cw,null,n.createElement(h.J$,null,"Test Notification ",n.createElement("small",{className:"text-muted"},"(Optional)")),n.createElement(h.NI.Static,null,n.createElement(h.zx,{bsStyle:"info",bsSize:"small",disabled:c.isLoading,onClick:this.handleTestTrigger},p)),c.message&&n.createElement(h.bZ,{bsStyle:c.error?"danger":"success"},n.createElement("b",null,c.error?"Error: ":"Success: "),c.message),n.createElement(h.Qb,null,"Execute this Notification with a test Alert.")),!t&&n.createElement(l.Ow,{disabledSubmit:!d,submitButtonText:("create"===e?"Create":"Update")+" notification",onCancel:s}))))}}p(g,"propTypes",{action:s().oneOf(["create","edit"]),notification:s().object.isRequired,validation:s().object.isRequired,testResult:s().shape({isLoading:s().bool,error:s().bool,message:s().string}).isRequired,formId:s().string,embedded:s().bool.isRequired,onChange:s().func.isRequired,onCancel:s().func.isRequired,onSubmit:s().func.isRequired,onTest:s().func.isRequired}),p(g,"defaultProps",{action:"edit",formId:void 0});const E=g;i("BXP2KjIr");function S(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}const T={errors:{}},y={isLoading:!1};class C extends n.Component{static scrollToFirstError(){void 0!==document.getElementsByClassName("has-error")[0]&&document.getElementsByClassName("has-error")[0].scrollIntoView(!0)}constructor(e){super(e),S(this,"handleChange",((e,t)=>{const{notification:i}=this.state,n=r().cloneDeep(i);n[e]=t,this.setState({notification:n,isDirty:!0,testResult:y})})),S(this,"handleCancel",(()=>{c.Z.push(d.ZP.ALERTS.NOTIFICATIONS.LIST)})),S(this,"handleSubmit",(()=>{const{action:e,embedded:t,onSubmit:i}=this.props,{notification:n}=this.state;let o;"create"===e?(o=u.e.create(n),o.then((()=>{this.setState({isDirty:!1},(()=>{t||c.Z.push(d.ZP.ALERTS.NOTIFICATIONS.LIST)}))}),(e=>{const{body:t}=e.additional;400===e.status&&t&&t.failed&&(this.setState({validation:t}),C.scrollToFirstError())}))):(o=u.e.update(n.id,n),o.then((()=>{this.setState({isDirty:!1},(()=>{t||c.Z.push(d.ZP.ALERTS.NOTIFICATIONS.LIST)}))}),(e=>{const{body:t}=e.additional;400===e.status&&t&&t.failed&&(this.setState({validation:t}),C.scrollToFirstError())}))),i(o)})),S(this,"handleTest",(()=>{const{notification:e}=this.state;this.setState({testResult:{isLoading:!0},validation:T});const t=r().clone(y);this.testPromise=u.e.test(e),this.testPromise.then((e=>(t.error=!1,t.message="Notification was executed successfully.",e)),(e=>{t.error=!0;const{body:i}=e.additional;400===e.status&&i&&i.failed?(t.message="Validation failed, please correct any errors in the form before continuing.",this.setState({validation:i})):t.message=e.responseMessage||"Unknown error, please check your Graylog server logs."})).finally((()=>{this.setState({testResult:t}),this.testPromise=void 0}))})),this.state={notification:e.notification,validation:T,testResult:y,isDirty:!1}}componentWillUnmount(){this.testPromise&&this.testPromise.cancel()}render(){const{action:e,embedded:t,formId:i}=this.props,{notification:o,validation:s,testResult:a,isDirty:r}=this.state;return n.createElement(n.Fragment,null,!t&&r&&n.createElement(l.oU,{question:"Do you really want to abandon this page and lose your changes? This action cannot be undone."}),n.createElement(E,{action:e,notification:o,validation:s,testResult:a,formId:i,embedded:t,onChange:this.handleChange,onCancel:this.handleCancel,onSubmit:this.handleSubmit,onTest:this.handleTest}))}}S(C,"propTypes",{action:s().oneOf(["create","edit"]),notification:s().object,embedded:s().bool,formId:s().string,onSubmit:s().func}),S(C,"defaultProps",{action:"edit",notification:{title:"",description:"",config:{}},embedded:!1,formId:void 0,onSubmit:()=>{}});const I=C},zsYr8K90:(e,t,i)=>{i.r(t),i.d(t,{default:()=>I});var n,o,s,a=i("Z7aTuO5B"),r=i("ii0bleBb"),l=i.n(r),c=i("F9olzlTR"),d=i("0zTRKSqx"),u=i("DeVaSktS"),m=i("4Js8dUPg"),h=i("b/6pmtOr"),f=i("EUJYvlA3"),p=i("BSHS2nUH"),b=i("x85XLEUc"),g=i("TADW41AU"),E=i("CfS4XPvw"),S=i("6WrsI6bg"),T=i("5GvVt6f3"),y=i("GdY2o7iN");class C extends a.Component{constructor(e){super(e),this.state={notification:void 0}}componentDidMount(){const{params:e,currentUser:t}=this.props;(0,f.rq)(t.permissions,`eventnotifications:edit:${e.notificationId}`)&&T.e.get(e.notificationId).then((e=>this.setState({notification:e})),(e=>{404===e.status&&p.Z.push(u.ZP.ALERTS.NOTIFICATIONS.LIST)}))}render(){const{notification:e}=this.state,{params:t,currentUser:i}=this.props;return(0,f.rq)(i.permissions,`eventnotifications:edit:${t.notificationId}`)||p.Z.push(u.ZP.NOTFOUND),e?a.createElement(d.$4,{title:`Edit "${e.title}" Notification`},a.createElement(y.Z,null),a.createElement(d.mr,{title:`Edit "${e.title}" Notification`,actions:a.createElement(g.Z,{notificationId:e.id}),documentationLink:{title:"Alerts documentation",path:m.Z.PAGES.ALERTS}},a.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.")),a.createElement(c.X2,{className:"content"},a.createElement(c.JX,{md:12},a.createElement(b.Z,{action:"edit",notification:e})))):a.createElement(d.$4,{title:"Edit Notification"},a.createElement("span",null,a.createElement(d.mr,{title:"Edit Notification"},a.createElement(d.$j,{text:"Loading Notification information..."}))))}}n=C,o="propTypes",s={params:l().object.isRequired,currentUser:l().object.isRequired},o in n?Object.defineProperty(n,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[o]=s;const I=(0,h.Z)((0,E.Z)(C),{currentUser:S.D},(e=>{let{currentUser:t}=e;return{currentUser:t.currentUser}}))}}]);
//# sourceMappingURL=325e2d4b-4053.86f6ebe6c5a0849f485c.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy