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

web-interface.assets.325e2d4b-4811.8efb53064130901ed6c0.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-4811"],{lZIqb5ni:(e,t,n)=>{n.d(t,{Z:()=>Tt});var i=n("Z7aTuO5B"),o=n("ii0bleBb"),a=n.n(o),l=n("nHcjWeCO"),r=n.n(l),s=n("BSHS2nUH"),c=n("DeVaSktS"),d=n("b/6pmtOr"),m=n("WlYEmUoB"),u=n("0zTRKSqx"),p=n("JnTtTRmZ"),h=n.n(p),f=n("0wQfx7YJ"),g=n("OqsMdpSm"),y=n("xc00RsLr");const v=(0,y.ei)("core.AvailableEventDefinitionTypes",(()=>h().createActions({get:{asyncResult:!0}}))),E=(0,y.dS)("core.AvailableEventDefinitionTypes",(()=>h().createStore({listenables:[v],sourceUrl:"/events/entity_types",entityTypes:void 0,init(){this.get()},getInitialState(){return this.entityTypes},get(){(0,g.ZP)("GET",f.DC(this.sourceUrl)).then((e=>{this.entityTypes=e,this.trigger(this.entityTypes)}))}})));var b=n("5LMarVJQ"),C=n("6WrsI6bg"),S=n("vxGQ9flp"),N=n("5GvVt6f3"),k=n("AztyBNMT"),T=n("J6y4/h8P"),A=n("F9olzlTR"),F=n("YyiN4DLW"),P=n("4kW3fUUU");function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const R=r().map(m.Z.properties,((e,t)=>({value:t,label:r().upperFirst(e.name)})));class w extends i.Component{constructor(){super(...arguments),x(this,"handleChange",(e=>{const{name:t}=e.target,{onChange:n}=this.props;n(t,F.n6(e.target))})),x(this,"handlePriorityChange",(e=>{const{onChange:t}=this.props;t("priority",r().toNumber(e))}))}render(){const{eventDefinition:e,validation:t}=this.props;return i.createElement(A.X2,null,i.createElement(A.JX,{md:7,lg:6},i.createElement("h2",{className:P.Z.title},"Event Details"),i.createElement("fieldset",null,i.createElement(A.II,{id:"event-definition-title",name:"title",label:"Title",type:"text",bsStyle:t.errors.title?"error":null,help:r().get(t,"errors.title[0]","Title for this Event Definition, Events and Alerts created from it."),value:e.title,onChange:this.handleChange,required:!0}),i.createElement(A.II,{id:"event-definition-description",name:"description",label:i.createElement("span",null,"Description ",i.createElement("small",{className:"text-muted"},"(Optional)")),type:"textarea",help:"Longer description for this Event Definition.",value:e.description,onChange:this.handleChange,rows:2}),i.createElement(A.cw,{controlId:"event-definition-priority"},i.createElement(A.J$,null,"Priority"),i.createElement(u.Ph,{options:R,value:r().toString(e.priority),onChange:this.handlePriorityChange,clearable:!1,required:!0}),i.createElement(A.Qb,null,"Choose the priority for Events created from this Definition.")))))}}x(w,"propTypes",{eventDefinition:a().object.isRequired,validation:a().object.isRequired,onChange:a().func.isRequired});const D=w;var q=n("6n4dw8v3"),I=n("0+pgPwY9"),j=n("dFpwyWHg"),O=n.n(j),_=n("C2ikvoS0"),Z=n.n(_),B=n("1IntWRSu"),X=n.n(B),z=n("8nGWeFnd"),U=n.n(z),J=n("TeAcaicX"),L=n.n(J),K=n("eE3+5goe"),M=n.n(K),V=n("xDyzG6yO"),Q={};Q.styleTagTransform=M(),Q.setAttributes=U(),Q.insert=X().bind(null,"head"),Q.domAPI=Z(),Q.insertStyleElement=L();O()(V.Z,Q);const G=V.Z&&V.Z.locals?V.Z.locals:void 0,W=e=>{let{action:t,entityTypes:n,eventDefinition:o,validation:a,currentUser:l,onChange:s}=e;const c=e=>void 0===e?{}:k.PluginStore.exports("eventDefinitionTypes").find((t=>t.type===e))||{},d=()=>k.PluginStore.exports("eventDefinitionTypes").sort(((e,t)=>{const n=e.sortOrder,i=t.sortOrder;if(void 0!==n||void 0!==i){const e=r().defaultTo(n,Number.MAX_SAFE_INTEGER)-r().defaultTo(i,Number.MAX_SAFE_INTEGER);if(0!==e)return e}return(0,q.S)(e.displayName,t.displayName)})),m=()=>d().map((e=>({label:e.displayName,value:e.type}))),p=()=>!m().some((e=>o.config.type===e.value))&&"edit"===t,h=c(o.config.type),f=null!=h&&h.formComponent?i.createElement(h.formComponent,{action:t,entityTypes:n,currentUser:l,validation:a,eventDefinition:o,onChange:s,key:o.id}):null;return i.createElement(A.X2,null,i.createElement(A.JX,{md:7,lg:6},i.createElement("h2",{className:P.Z.title},"Event Condition"),i.createElement("p",null,"Configure how Graylog should create Events of this kind. You can later use those Events as input on other Conditions, making it possible to build powerful Conditions based on others."),i.createElement(A.cw,{controlId:"event-definition-priority",validationState:a.errors.config?"error":null},i.createElement(A.J$,null,"Condition Type"),i.createElement(u.Ph,{placeholder:"Select a Condition Type",options:m(),value:o.config.type,onChange:e=>{const t=c(e),n=(null==t?void 0:t.defaultConfig)||{};s("config",{...n,type:e})},clearable:!1,disabled:p(),required:!0}),i.createElement(A.Qb,null,r().get(a,"errors.config[0]","Choose the type of Condition for this Event.")))),!p()&&i.createElement(A.JX,{md:5,lg:5,lgOffset:1},i.createElement(I.e,{className:G.conditionTypesInfo,title:"Available Conditions"},(()=>{const e=d().map((e=>i.createElement(i.Fragment,{key:e.type},i.createElement("dt",null,e.displayName),i.createElement("dd",null,e.description||"No description available."))));return i.createElement("dl",null,e)})())),i.createElement(A.O7,null),f&&i.createElement(i.Fragment,null,i.createElement("hr",{className:G.hr}),i.createElement(A.JX,{md:12},f)))};W.defaultProps={action:"create",entityTypes:void 0},W.propTypes={action:a().oneOf(["create","edit"]),entityTypes:a().object,eventDefinition:a().object.isRequired,currentUser:a().object.isRequired,validation:a().object.isRequired,onChange:a().func.isRequired};const Y=W;function H(){return H=Object.assign?Object.assign.bind():function(e){for(var t=1;tvoid 0===e?{}:k.PluginStore.exports("fieldValueProviders").find((t=>t.type===e))||{})),ae(this,"getConfigProviderType",((e,t)=>r().get(e,"providers[0].type",t))),ae(this,"validate",(()=>{const{isKey:e,keyPosition:t,config:n}=this.state,i={},o=this.getConfigProviderType(n);let a=[];if(o){a=this.getProviderPlugin(o).requiredFields}le.forEach((e=>{r().get(this.state,e)||(i[e]="Field cannot be empty.")})),e&&(!r().isNumber(t)||Number(t)<1)&&(i.key_position="Field must be a positive number."),a.forEach((e=>{r().get(n,`providers[0].${e}`)||(i[e]="Field cannot be empty.")}));const l=Object.keys(i).length;return l>0&&this.setState({validation:{errors:i}}),0===l})),ae(this,"handleSubmit",(()=>{if(this.validate()){const{fieldName:e,onChange:t}=this.props,{fieldName:n,config:i,isKey:o,keyPosition:a}=this.state;t(e,n,i,o,a-1)}})),ae(this,"handleFieldNameChange",(e=>{const t=F.n6(e.target);this.setState({fieldName:t})})),ae(this,"handleConfigChange",(e=>{this.setState({config:e})})),ae(this,"handleProviderTypeChange",(e=>{const{config:t}=this.state,n={...t,providers:[{...this.getProviderPlugin(e).defaultConfig||{},type:e}]};this.handleConfigChange(n)})),ae(this,"handleKeySortChange",(e=>{const t=""===e.target.value?"":F.n6(e.target);this.setState({keyPosition:t})})),ae(this,"toggleKey",(e=>{const t=F.n6(e.target);this.setState({isKey:t})})),ae(this,"renderFieldValueProviderForm",(()=>{const{fieldName:e,config:t,validation:n}=this.state,{currentUser:o}=this.props,a=this.getConfigProviderType(t);if(!a)return null;const l=this.getProviderPlugin(a);return l.formComponent?i.createElement(l.formComponent,{fieldName:e,config:t,onChange:this.handleConfigChange,validation:n,currentUser:o}):i.createElement("div",null,"Selected provider is not available.")})),ae(this,"formatFieldValueProviders",(()=>k.PluginStore.exports("fieldValueProviders").map((e=>({label:e.displayName,value:e.type})))));const t=e.keys.indexOf(e.fieldName);this.state={fieldName:e.fieldName,config:{data_type:"string",providers:[],...e.config},isKey:t>=0,keyPosition:t>=0?t+1:e.keys.length+1,validation:{errors:{}}}}render(){const{fieldName:e,onCancel:t}=this.props,{fieldName:n,isKey:o,keyPosition:a,config:l,validation:r}=this.state;return i.createElement(A.X2,null,i.createElement(A.JX,{md:7,lg:6},i.createElement("h2",{className:P.Z.title},e?`Custom Field "${n}"`:"New Custom Field"),i.createElement(A.II,{id:"field-name",name:"name",label:"Name",type:"text",value:n,onChange:this.handleFieldNameChange,bsStyle:r.errors.fieldName?"error":null,help:r.errors.fieldName||"Name for this Field.",required:!0}),i.createElement(A.cw,{validationState:r.errors.key_position?"error":null},i.createElement(A.J$,null,"Use Field as Event Key ",i.createElement(u.Ox,{placement:"right",trigger:["click","focus"],overlay:i.createElement(oe,{id:"key-popover"})},i.createElement(A.zx,{bsStyle:"link",bsSize:"xsmall"},i.createElement(u.JO,{name:"question-circle"})))),i.createElement(A.BZ,null,i.createElement(A.BZ.Addon,null,i.createElement("input",{id:"is-key",name:"is-key",type:"checkbox",onChange:this.toggleKey,checked:o})),i.createElement(A.NI,{id:"field-key",name:"key",type:"number",value:a,onChange:this.handleKeySortChange,disabled:!o})),i.createElement(A.Qb,null,r.errors.key_position||"Indicates if this Field should be a Key and its order.")),i.createElement(A.cw,null,i.createElement(A.J$,null,"Field Data Type"),i.createElement(A.NI.Static,null,"String")),i.createElement(A.cw,{controlId:"event-field-provider",validationState:r.errors["config.providers[0].type"]?"error":null},i.createElement(A.J$,null,"Set Value From"),i.createElement(u.Ph,{name:"event-field-provider",ignoreAccents:!1,placeholder:"Select Value Source",onChange:this.handleProviderTypeChange,options:this.formatFieldValueProviders(),value:this.getConfigProviderType(l,""),matchProp:"label",required:!0}),i.createElement(A.Qb,null,r.errors["config.providers[0].type"]||"Select a source for the value of this Field."))),i.createElement(A.JX,{md:12},this.renderFieldValueProviderForm()),i.createElement(A.JX,{md:12},i.createElement(A.Si,null,i.createElement(A.zx,{bsStyle:"primary",onClick:this.handleSubmit},"Done"),i.createElement(A.zx,{onClick:t},"Cancel"))))}}ae(re,"propTypes",{fieldName:a().string,config:a().object,currentUser:a().object.isRequired,keys:a().array.isRequired,onChange:a().func.isRequired,onCancel:a().func.isRequired}),ae(re,"defaultProps",{fieldName:"",config:{}});const se=re;var ce=n("x1BxQQLs"),de={};de.styleTagTransform=M(),de.setAttributes=U(),de.insert=X().bind(null,"head"),de.domAPI=Z(),de.insertStyleElement=L();O()(ce.Z,de);const me=ce.Z&&ce.Z.locals?ce.Z.locals:void 0;function ue(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const pe=["Field Name","Is Key?","Value Source","Data Type","Configuration","Actions"];class he extends i.Component{constructor(){super(...arguments),ue(this,"getFieldValueProviderPlugin",(e=>void 0===e?{}:k.PluginStore.exports("fieldValueProviders").find((t=>t.type===e))||{})),ue(this,"handleAddFieldClick",(()=>{const{onAddFieldClick:e}=this.props;e()})),ue(this,"handleEditClick",(e=>()=>{const{onEditFieldClick:t}=this.props;t(e)})),ue(this,"handleRemoveClick",(e=>()=>{const{onRemoveFieldClick:t}=this.props;t(e)})),ue(this,"providerFormatter",(e=>{const t=Object.keys(e).filter((e=>"type"!==e));return i.createElement("p",null,t.map((t=>i.createElement("span",{key:t,className:me.providerOptions},t,": ",i.createElement("em",null,JSON.stringify(e[t]))))))})),ue(this,"fieldFormatter",(e=>{const{fields:t,keys:n}=this.props,o=t[e],a=n.indexOf(e),l=this.getFieldValueProviderPlugin(o.providers[0].type);return i.createElement("tr",{key:e},i.createElement("td",null,e),i.createElement("td",null,a<0?"No":"Yes"),i.createElement("td",null,l.displayName||o.providers[0].type),i.createElement("td",null,o.data_type),i.createElement("td",null,this.providerFormatter(o.providers[0])),i.createElement("td",{className:me.actions},i.createElement(A.Si,null,i.createElement(A.zx,{bsStyle:"primary",bsSize:"xsmall",onClick:this.handleRemoveClick(e)},"Remove Field"),i.createElement(A.zx,{bsStyle:"info",bsSize:"xsmall",onClick:this.handleEditClick(e)},"Edit"))))}))}render(){const{fields:e}=this.props,t=Object.keys(e).sort(q.S),n=i.createElement(A.zx,{bsStyle:"success",onClick:this.handleAddFieldClick},"Add Custom Field");return 0===t.length?i.createElement(i.Fragment,null,i.createElement("p",null,"This Event does not have any custom Fields yet."),n):i.createElement(i.Fragment,null,i.createElement(u.wQ,{id:"event-definition-fields",className:"table-striped table-hover",headers:pe,rows:t,dataRowFormatter:this.fieldFormatter,filterKeys:[]}),n)}}ue(he,"propTypes",{fields:a().object.isRequired,keys:a().array.isRequired,onAddFieldClick:a().func.isRequired,onEditFieldClick:a().func.isRequired,onRemoveFieldClick:a().func.isRequired});const fe=he;var ge=n("dntKaB+S"),ye={};ye.styleTagTransform=M(),ye.setAttributes=U(),ye.insert=X().bind(null,"head"),ye.domAPI=Z(),ye.insertStyleElement=L();O()(ge.Z,ye);const ve=ge.Z&&ge.Z.locals?ge.Z.locals:void 0;class Ee extends i.Component{render(){return i.createElement(A.s_,{className:ve.templatePreview,header:i.createElement("h3",null,"Available Fields in Template")},i.createElement("p",null,"Graylog lets you enrich generated Events with dynamic values. You can access Fields from the Event context"," ","with ",i.createElement("code",null,"${source.}"),".",i.createElement("br",null),"Available Fields in the Template depend on the condition that created the Event:"),i.createElement("ul",null,i.createElement("li",null,i.createElement("b",null,"Filter:")," All Fields in the original log message"),i.createElement("li",null,i.createElement("b",null,"Aggregation:")," Fields set in Group By with their original names"),i.createElement("li",null,i.createElement("b",null,"Correlation:")," All Fields in the last matched and non-negated Event")))}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(Ee,"propTypes",{});const be=Ee;function Ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Se extends i.Component{constructor(){super(...arguments),Ce(this,"handleChange",(e=>{const{config:t,onChange:n}=this.props,{name:i}=e.target,o=F.n6(e.target),a=r().cloneDeep(t.providers);a.find((e=>e.type===Se.type))[i]=o,n({...t,providers:a})}))}render(){const{config:e,validation:t}=this.props,n=e.providers.find((e=>e.type===Se.type)),o=i.createElement("span",null,"Type a literal text to set to this Field or use"," ",i.createElement(u.dL,{href:"https://cdn.rawgit.com/DJCordhose/jmte/master/doc/index.html"},"JMTE syntax")," ","to add a dynamic Value.");return i.createElement(A.X2,{className:"row-sm"},i.createElement(A.JX,{md:7,lg:6},i.createElement(A.II,{id:"template-provider-template",name:"template",type:"text",label:"Template",onChange:this.handleChange,value:n.template||"",bsStyle:t.errors.template?"error":null,help:t.errors.template||o}),i.createElement(A.cw,null,i.createElement(A.XZ,{id:"lookup-message-require-values",name:"require_values",checked:n.require_values,onChange:this.handleChange},"Require all template values to be set"),i.createElement(A.Qb,null,"Check this option to validate that all variables used in the Template have values."))),i.createElement(A.JX,{md:5,lgOffset:1},i.createElement(be,null)))}}Ce(Se,"propTypes",{config:a().object.isRequired,validation:a().object.isRequired,onChange:a().func.isRequired}),Ce(Se,"type","template-v1"),Ce(Se,"defaultConfig",{template:""}),Ce(Se,"requiredFields",["template"]);const Ne=Se;var ke=n("3QxG6MMi"),Te={};Te.styleTagTransform=M(),Te.setAttributes=U(),Te.insert=X().bind(null,"head"),Te.domAPI=Z(),Te.insertStyleElement=L();O()(ke.Z,Te);const Ae=ke.Z&&ke.Z.locals?ke.Z.locals:void 0;function Fe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Pe extends i.Component{constructor(){super(...arguments),Fe(this,"state",{displayDetails:!1}),Fe(this,"toggleDisplayDetails",(()=>{const{displayDetails:e}=this.state;this.setState({displayDetails:!e})}))}render(){const{fieldName:e,config:t,keys:n,children:o}=this.props,{displayDetails:a}=this.state;return i.createElement("dl",{className:Ae.field},i.createElement("dt",null,e),i.createElement("dd",null,i.createElement(A.zx,{bsStyle:"link",className:"btn-text",bsSize:"xsmall",onClick:this.toggleDisplayDetails},i.createElement(u.JO,{name:"caret-"+(a?"down":"right")})," ",a?"Less details":"More details"),a&&i.createElement(A.iA,{condensed:!0,hover:!0,className:Ae.fixedTable},i.createElement("tbody",null,i.createElement("tr",null,i.createElement("td",null,"Is Key?"),i.createElement("td",null,n.includes(e)?"Yes":"No")),i.createElement("tr",null,i.createElement("td",null,"Data Type"),i.createElement("td",null,t.data_type)),o))))}}Fe(Pe,"propTypes",{fieldName:a().string.isRequired,config:a().object.isRequired,keys:a().array.isRequired,children:a().element.isRequired});const xe=Pe;class Re extends i.Component{render(){const{config:e}=this.props;return i.createElement(xe,this.props,i.createElement(i.Fragment,null,i.createElement("tr",null,i.createElement("td",null,"Value source"),i.createElement("td",null,"Template")),i.createElement("tr",null,i.createElement("td",null,"Template"),i.createElement("td",null,e.providers[0].template)),i.createElement("tr",null,i.createElement("td",null,"Validate that all Template values are set"),i.createElement("td",null,e.providers[0].require_values?"Yes":"No"))))}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(Re,"propTypes",{fieldName:a().string.isRequired,config:a().object.isRequired,keys:a().array.isRequired});const we=Re;var De=n("HEvxCVG3");function qe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Ie extends i.Component{constructor(){super(...arguments),qe(this,"formatMessageFields",r().memoize((e=>e.sort(((e,t)=>(0,De.Q)(e.name,t.name))).map((e=>({label:`${e.name} – ${e.value.type.type}`,value:e.name})))),(e=>e.map((e=>e.name)).join("-")))),qe(this,"propagateChanges",((e,t)=>{const{config:n,onChange:i}=this.props,o=r().cloneDeep(n.providers);o.find((e=>e.type===Ie.type))[e]=t,i({...n,providers:o})})),qe(this,"handleChange",(e=>{const{name:t}=e.target,n=F.n6(e.target);this.propagateChanges(t,n)})),qe(this,"handleSelectChange",(e=>t=>{this.propagateChanges(e,t)})),qe(this,"formatLookupTables",(e=>e.sort(((e,t)=>(0,De.Q)(e.title,t.title))).map((e=>({label:e.title,value:e.name})))))}render(){const{allFieldTypes:e,config:t,lookupTables:n,validation:o}=this.props,a=t.providers.find((e=>e.type===Ie.type));return i.createElement(A.X2,{className:"row-sm"},i.createElement(A.JX,{md:7,lg:6},i.createElement(A.cw,{controlId:"lookup-provider-table",validationState:o.errors.table_name?"error":null},i.createElement(A.J$,null,"Select Lookup Table"),i.createElement(u.Ph,{name:"event-field-table-name",placeholder:"Select Lookup Table",onChange:this.handleSelectChange("table_name"),options:this.formatLookupTables(n),value:a.table_name,matchProp:"label",required:!0}),i.createElement(A.Qb,null,o.errors.table_name||"Select the Lookup Table Graylog should use to get the value.")),i.createElement(A.cw,{controlId:"lookup-provider-table",validationState:o.errors.key_field?"error":null},i.createElement(A.J$,null,"Lookup Table Key Field"),i.createElement(u.Ph,{name:"lookup-provider-key",placeholder:"Select Field",onChange:this.handleSelectChange("key_field"),options:this.formatMessageFields(e),value:a.key_field,matchProp:"label",allowCreate:!0,required:!0}),i.createElement(A.Qb,null,o.errors.key_field||"Message Field name whose value will be used as Lookup Table Key."))))}}qe(Ie,"propTypes",{allFieldTypes:a().array.isRequired,config:a().object.isRequired,validation:a().object.isRequired,lookupTables:a().array.isRequired,onChange:a().func.isRequired}),qe(Ie,"type","lookup-v1"),qe(Ie,"defaultConfig",{table_name:"",key_field:""}),qe(Ie,"requiredFields",["table_name","key_field"]);const je=Ie;var Oe=n("EUJYvlA3"),_e=n("Lzn6DvfV"),Ze=n("iZEbgYb9"),Be=n("v07IjUZn");function Xe(){return Xe=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{currentUser:t,...n}=e;const{data:o}=(0,Ze.Z)([],Be.w_),a=(0,d.o)(_e.m);if((0,i.useEffect)((()=>{(0,Oe.rq)(t.permissions,ze)&&_e.H.searchPaginated(1,0,void 0,!1)}),[t.permissions]),!(0,Oe.rq)(t.permissions,ze))return i.createElement(A.X2,null,i.createElement(A.JX,{md:6,lg:5},i.createElement("p",null,"No Lookup Tables found.")));return!o||!a.tables?i.createElement(u.$j,{text:"Loading Field Provider information..."}):i.createElement(je,Xe({allFieldTypes:o,lookupTables:a.tables},n))};Ue.propTypes={config:a().object.isRequired,validation:a().object.isRequired,currentUser:a().object.isRequired,onChange:a().func.isRequired};const Je=Ue;class Le extends i.Component{render(){const{config:e}=this.props,t=e.providers[0];return i.createElement(xe,this.props,i.createElement(u.AE,{permissions:"lookuptables:read"},i.createElement(i.Fragment,null,i.createElement("tr",null,i.createElement("td",null,"Value source"),i.createElement("td",null,"Lookup Table")),i.createElement("tr",null,i.createElement("td",null,"Lookup Table"),i.createElement("td",null,t.table_name)),i.createElement("tr",null,i.createElement("td",null,"Lookup Table Key Field"),i.createElement("td",null,t.key_field)))))}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(Le,"propTypes",{fieldName:a().string.isRequired,config:a().object.isRequired,keys:a().array.isRequired});const Ke=Le;function Me(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}k.PluginStore.register(new k.PluginManifest({},{fieldValueProviders:[{type:Ne.type,displayName:"Template",formComponent:Ne,summaryComponent:we,defaultConfig:Ne.defaultConfig,requiredFields:Ne.requiredFields},{type:je.type,displayName:"Lookup Table",formComponent:Je,summaryComponent:Ke,defaultConfig:je.defaultConfig,requiredFields:je.requiredFields}]}));class Ve extends i.Component{constructor(){super(...arguments),Me(this,"state",{editField:void 0,showFieldForm:!1}),Me(this,"removeCustomField",(e=>{const{eventDefinition:t,onChange:n}=this.props,i=r().omit(t.field_spec,e);n("field_spec",i);const o=Object.keys(i),a=t.key_spec.filter((e=>o.includes(e)));n("key_spec",a)})),Me(this,"addCustomField",((e,t,n,i,o)=>{const{eventDefinition:a,onChange:l}=this.props,s=e===t?r().cloneDeep(a.field_spec):r().omit(a.field_spec,e);s[t]=n,l("field_spec",s);const c=Object.keys(s);let d=a.key_spec.filter((e=>c.includes(e)&&e!==t));i&&(d=[...d.slice(0,o),t,...d.slice(o)]),l("key_spec",d),this.toggleFieldForm()})),Me(this,"toggleFieldForm",(e=>{const{showFieldForm:t}=this.state;this.setState({showFieldForm:!t,editField:t?void 0:e})}))}render(){const{eventDefinition:e,validation:t,currentUser:n}=this.props,{editField:o,showFieldForm:a}=this.state;if(a)return i.createElement(se,{keys:e.key_spec,fieldName:o,config:o?e.field_spec[o]:void 0,currentUser:n,onChange:this.addCustomField,onCancel:this.toggleFieldForm});const l=[...r().get(t,"errors.field_spec",[]),...r().get(t,"errors.key_spec",[])];return i.createElement(A.X2,null,i.createElement(A.JX,{md:12},i.createElement("h2",{className:P.Z.title},"Event Fields ",i.createElement("small",null,"(optional)")),i.createElement("p",null,"Include additional information in Events generated from this Event Definition by adding custom Fields. That can help you search Events or having more context when receiving Notifications."),l.length>0&&i.createElement(A.bZ,{bsStyle:"danger",className:P.Z.validationSummary},i.createElement("h4",null,"Fields with errors"),i.createElement("p",null,"Please correct the following errors before saving this Event Definition:"),i.createElement("ul",null,l.map((e=>i.createElement("li",{key:e},e))))),Object.keys(e.field_spec).length>0&&i.createElement("dl",null,i.createElement("dt",null,"Keys",i.createElement(u.Ox,{placement:"right",trigger:["click","hover"],overlay:i.createElement(oe,{id:"key-header-popover"})},i.createElement(A.zx,{bsStyle:"link",bsSize:"xsmall"},i.createElement(u.JO,{name:"question-circle"})))),i.createElement("dd",null,e.key_spec.length>0?e.key_spec.join(", "):"No Keys configured yet.")),i.createElement(fe,{fields:e.field_spec,validation:t,keys:e.key_spec,onAddFieldClick:this.toggleFieldForm,onEditFieldClick:this.toggleFieldForm,onRemoveFieldClick:this.removeCustomField})))}}Me(Ve,"propTypes",{eventDefinition:a().object.isRequired,currentUser:a().object.isRequired,validation:a().object.isRequired,onChange:a().func.isRequired});const Qe=Ve;var Ge=n("EeAwn/0x"),We=n("x85XLEUc");function Ye(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class $e extends i.Component{constructor(){super(...arguments),Ye(this,"state",{selectedNotification:void 0,displayNewNotificationForm:!1}),Ye(this,"handleNewNotificationSubmit",(e=>{const{onChange:t}=this.props;e.then((e=>t(e.id)))})),Ye(this,"handleSubmit",(()=>{const{onChange:e}=this.props,{selectedNotification:t}=this.state;e(t)})),Ye(this,"handleSelectNotificationChange",(e=>{"create"!==e?this.setState({selectedNotification:e,displayNewNotificationForm:!1}):this.setState({displayNewNotificationForm:!0})})),Ye(this,"formatNotifications",(e=>{const{hasCreationPermissions:t}=this.props,n=e.map((e=>({label:e.title,value:e.id})));return t&&n.unshift({label:"Create New Notification...",value:"create"}),n}))}render(){const{notifications:e,onCancel:t}=this.props,{displayNewNotificationForm:n,selectedNotification:o}=this.state,a=n?i.createElement(A.zx,{bsStyle:"primary",type:"submit",form:"new-notification-form"},"Done"):i.createElement(A.zx,{bsStyle:"primary",onClick:this.handleSubmit},"Done");return i.createElement(A.X2,null,i.createElement(A.JX,{md:7,lg:6},i.createElement("h2",{className:P.Z.title},"Add Notification"),i.createElement("fieldset",null,i.createElement(A.cw,{controlId:"notification-select"},i.createElement(A.J$,null,"Choose Notification"),i.createElement(u.Ph,{id:"notification-select",matchProp:"label",placeholder:"Select Notification",onChange:this.handleSelectNotificationChange,options:this.formatNotifications(e),value:o}),i.createElement(A.Qb,null,"Select a Notification to use on Alerts of this kind or create a new Notification that you can later use in other Alerts.")),n&&i.createElement(We.Z,{action:"create",formId:"new-notification-form",onSubmit:this.handleNewNotificationSubmit,embedded:!0})),i.createElement(A.Si,null,a,i.createElement(A.zx,{onClick:t},"Cancel"))))}}Ye($e,"propTypes",{notifications:a().array.isRequired,onChange:a().func.isRequired,onCancel:a().func.isRequired,hasCreationPermissions:a().bool}),Ye($e,"defaultProps",{hasCreationPermissions:!1});const He=$e;var et=n("9oVghaOd"),tt=n.n(et),nt=n("V/MyycIc");function it(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ot=["HOURS","MINUTES","SECONDS"];class at extends i.Component{constructor(e){super(e),it(this,"propagateChanges",((e,t)=>{const{eventDefinition:n,onSettingsChange:i}=this.props,o=r().cloneDeep(n.notification_settings);o[e]=t,i("notification_settings",o)})),it(this,"handleGracePeriodChange",((e,t,n)=>{const i=n?tt().duration(r().max([e,0]),t).asMilliseconds():0;this.propagateChanges("grace_period_ms",i),this.setState({gracePeriodDuration:e,gracePeriodUnit:t})})),it(this,"handleBacklogSizeChange",(e=>{const{name:t}=e.target,n=""===e.target.value?"":F.n6(e.target);this.setState({[r().camelCase(t)]:n}),this.propagateChanges(t,r().max([Number(n),0]))})),it(this,"toggleBacklogSize",(()=>{const{isBacklogSizeEnabled:e,backlogSize:t}=this.state;this.setState({isBacklogSizeEnabled:!e}),this.propagateChanges("backlog_size",e?0:t)}));const{backlog_size:t,grace_period_ms:n}=e.eventDefinition.notification_settings,i=(0,nt.l)(n,ot),o=e.defaults.default_backlog_size,a=r().defaultTo(t,o);this.state={gracePeriodDuration:i.duration,gracePeriodUnit:i.unit,isBacklogSizeEnabled:null!==t&&a>0,backlogSize:a}}render(){const{eventDefinition:e}=this.props,{gracePeriodDuration:t,gracePeriodUnit:n,isBacklogSizeEnabled:o,backlogSize:a}=this.state;return 0===e.notifications.length?null:i.createElement(i.Fragment,null,i.createElement("h3",{className:P.Z.title},"Notification Settings"),i.createElement("fieldset",null,i.createElement(A.cw,{controlId:"grace-period"},i.createElement(u.AX,{label:"Grace Period",update:this.handleGracePeriodChange,defaultEnabled:0!==t,value:t,unit:n,units:ot,clearable:!0}),i.createElement(A.Qb,null,"Graylog sends Notifications for Alerts every time they occur. Set a Grace Period to control how long Graylog should wait before sending Notifications again. Note that Events with keys will have a Grace Period for each different key value.")),i.createElement(A.cw,null,i.createElement(A.J$,null,"Message Backlog"),i.createElement(A.BZ,null,i.createElement(A.BZ.Addon,null,i.createElement("input",{id:"toggle_backlog_size",type:"checkbox",checked:o,onChange:this.toggleBacklogSize})),i.createElement(A.NI,{type:"number",id:"backlog_size",name:"backlog_size",onChange:this.handleBacklogSizeChange,value:a,disabled:!o})),i.createElement(A.Qb,null,"Number of messages to be included in Notifications."))))}}it(at,"propTypes",{eventDefinition:a().object.isRequired,defaults:a().object.isRequired,onSettingsChange:a().func.isRequired});const lt=at;function rt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class st extends i.Component{constructor(){super(...arguments),rt(this,"getNotificationPlugin",(e=>void 0===e?{}:k.PluginStore.exports("eventNotificationTypes").find((t=>t.type===e))||{})),rt(this,"handleRemoveClick",(e=>()=>{const{onRemoveNotificationClick:t}=this.props;t(e)})),rt(this,"notificationFormatter",(e=>{if(e.missing)return i.createElement("tr",null,i.createElement("td",{colSpan:2},"Could not find information for Notification ",i.createElement("em",null,e.title)),i.createElement("td",{className:"actions"},i.createElement(A.zx,{bsStyle:"info",bsSize:"xsmall",onClick:this.handleRemoveClick(e.title)},"Remove from Event")));const t=this.getNotificationPlugin(e.config.type);return i.createElement("tr",{key:e.id},i.createElement("td",null,e.title),i.createElement("td",null,t.displayName||e.config.type),i.createElement("td",{className:"actions"},i.createElement(A.zx,{bsStyle:"info",bsSize:"xsmall",onClick:this.handleRemoveClick(e.id)},"Remove from Event")))}))}render(){const{eventDefinition:e,notifications:t,onAddNotificationClick:n}=this.props,o=e.notifications.map((e=>t.find((t=>t.id===e.notification_id))||{title:e.notification_id,missing:!0})),a=i.createElement(A.zx,{bsStyle:"success",onClick:n},"Add Notification");return 0===o.length?i.createElement(i.Fragment,null,i.createElement("p",null,"This Event is not configured to trigger any Notifications yet."),a):i.createElement(i.Fragment,null,i.createElement(u.wQ,{id:"event-definition-notifications",className:"table-striped table-hover",headers:["Notification","Type","Actions"],sortByKey:"title",rows:o,dataRowFormatter:this.notificationFormatter,filterKeys:[]}),a)}}rt(st,"propTypes",{eventDefinition:a().object.isRequired,notifications:a().array.isRequired,onAddNotificationClick:a().func.isRequired,onRemoveNotificationClick:a().func.isRequired});const ct=st;var dt=n("bRhJtaaM"),mt={};mt.styleTagTransform=M(),mt.setAttributes=U(),mt.insert=X().bind(null,"head"),mt.domAPI=Z(),mt.insertStyleElement=L();O()(dt.Z,mt);const ut=dt.Z&&dt.Z.locals?dt.Z.locals:void 0;function pt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class ht extends i.Component{constructor(){super(...arguments),pt(this,"state",{showAddNotificationForm:!1}),pt(this,"toggleAddNotificationForm",(()=>{const{showAddNotificationForm:e}=this.state;this.setState({showAddNotificationForm:!e})})),pt(this,"handleAssignNotification",(e=>{const{onChange:t,eventDefinition:n}=this.props,i=r().cloneDeep(n.notifications);i.push({notification_id:e}),t("notifications",i),this.toggleAddNotificationForm()})),pt(this,"handleRemoveNotification",(e=>{const{onChange:t,eventDefinition:n}=this.props,i=n.notifications.find((t=>t.notification_id===e));t("notifications",r().without(n.notifications,i))}))}render(){const{eventDefinition:e,notifications:t,defaults:n,currentUser:o,onChange:a}=this.props,{showAddNotificationForm:l}=this.state,r=e.notifications.map((e=>e.notification_id)).filter((e=>!(0,Oe.rq)(o.permissions,`eventnotifications:read:${e}`)));return r.length>0?i.createElement(A.X2,null,i.createElement(A.JX,{md:6,lg:5},i.createElement(A.bZ,{bsStyle:"warning"},"Missing Notifications Permissions for: ",i.createElement("br",null)," ",r.join(", ")))):t.length<1?i.createElement(A.X2,null,i.createElement(A.JX,{md:6,lg:5},i.createElement("p",null,"No Notifications found."))):l?i.createElement(He,{notifications:t,onChange:this.handleAssignNotification,onCancel:this.toggleAddNotificationForm,hasCreationPermissions:(0,Oe.rq)(o.permissions,"eventnotifications:create")}):i.createElement(A.X2,null,i.createElement(A.JX,{md:6,lg:5},i.createElement("span",{className:ut.manageNotifications},i.createElement(Ge.J,{to:c.ZP.ALERTS.NOTIFICATIONS.LIST,target:"_blank"},i.createElement(A.zx,{bsStyle:"link",bsSize:"small"},"Manage Notifications ",i.createElement(u.JO,{name:"external-link-alt"})))),i.createElement("h2",{className:P.Z.title},"Notifications ",i.createElement("small",null,"(optional)")),i.createElement("p",null,"Is this Event important enough that requires your attention? Make it an Alert by adding Notifications to it."),i.createElement(ct,{eventDefinition:e,notifications:t,onAddNotificationClick:this.toggleAddNotificationForm,onRemoveNotificationClick:this.handleRemoveNotification})),i.createElement(A.JX,{md:4,lg:3,mdOffset:1,className:ut.notificationSettings},i.createElement(lt,{eventDefinition:e,defaults:n,onSettingsChange:a})))}}pt(ht,"propTypes",{eventDefinition:a().object.isRequired,notifications:a().array.isRequired,defaults:a().object.isRequired,currentUser:a().object.isRequired,onChange:a().func.isRequired});const ft=ht;var gt=n("XmWOcQPs");function yt(){return yt=Object.assign?Object.assign.bind():function(e){for(var t=1;t{this.setState({activeStep:e})})),vt(this,"handleSubmit",(e=>{const{activeStep:t}=this.state;if(e&&e.preventDefault(),t===r().last(Et)){const{onSubmit:e}=this.props;e()}})),vt(this,"renderButtons",((e,t)=>{if(e===r().last(Et)){const{onCancel:e}=this.props;return i.createElement(u.os,{onCancel:e,onSubmit:this.handleSubmit,submitButtonText:(t?"Update":"Create")+" event definition"})}const n=Et.indexOf(e),o=n>0?Et[n-1]:void 0,a=Et[n+1];return i.createElement("div",null,i.createElement(A.zx,{bsStyle:"info",onClick:()=>this.handleStepChange(o),disabled:0===n},"Previous"),i.createElement("div",{className:"pull-right"},i.createElement(A.zx,{bsStyle:"info",onClick:()=>this.handleStepChange(a)},"Next")))})),this.state={activeStep:Et[0]}}render(){const{action:e,entityTypes:t,eventDefinition:n,notifications:o,onChange:a,validation:l,defaults:s,currentUser:c}=this.props,{activeStep:d}=this.state,m={key:n.id,action:e,entityTypes:t,eventDefinition:n,onChange:a,validation:l,currentUser:c},p=void 0===(h=n.config.type)?{}:k.PluginStore.exports("eventDefinitionTypes").find((e=>e.type===h))||{};var h;const f=[{key:Et[0],title:"Event Details",component:i.createElement(D,m)},{key:Et[1],title:r().defaultTo(p.displayName,"Condition"),component:i.createElement(Y,m)},{key:Et[2],title:"Fields",component:i.createElement(Qe,m)},{key:Et[3],title:"Notifications",component:i.createElement(ft,yt({},m,{notifications:o,defaults:s}))},{key:Et[4],title:"Summary",component:i.createElement(gt.Z,{action:e,eventDefinition:n,currentUser:c,notifications:o,validation:l})}];return i.createElement(A.X2,null,i.createElement(A.JX,{md:12},i.createElement(bt,null,i.createElement(u.en,{steps:f,activeStep:d,onStepChange:this.handleStepChange,horizontal:!0,justified:!0,containerClassName:"",hidePreviousNextButtons:!0})),this.renderButtons(d,null==n?void 0:n.id)))}}vt(Ct,"propTypes",{action:a().oneOf(["create","edit"]),eventDefinition:a().object.isRequired,currentUser:a().object.isRequired,validation:a().object.isRequired,entityTypes:a().object.isRequired,notifications:a().array.isRequired,defaults:a().object.isRequired,onChange:a().func.isRequired,onCancel:a().func.isRequired,onSubmit:a().func.isRequired}),vt(Ct,"defaultProps",{action:"edit"});const St=Ct;n("nRMrOfDS"),n("BXP2KjIr");function Nt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class kt extends i.Component{constructor(e){super(e),Nt(this,"fetchNotifications",(()=>{N.e.listAll()})),Nt(this,"fetchClusterConfig",(()=>{b.h.listEventsClusterConfig().then((e=>this.setState({eventsClusterConfig:e})))})),Nt(this,"handleChange",((e,t)=>{this.setState((n=>{const i=r().cloneDeep(n.eventDefinition);i[e]=t;const{onEventDefinitionChange:o}=this.props;return o(i),{eventDefinition:i,isDirty:!0}}))})),Nt(this,"handleCancel",(()=>{s.Z.push(c.ZP.ALERTS.DEFINITIONS.LIST)})),Nt(this,"handleSubmitSuccessResponse",(()=>{this.setState({isDirty:!1},(()=>s.Z.push(c.ZP.ALERTS.DEFINITIONS.LIST)))})),Nt(this,"handleSubmitFailureResponse",(e=>{const{body:t}=e.additional;if(400===e.status){if(t&&t.failed)return void this.setState({validation:t});if(t.type&&"ApiError"===t.type){if(t.message.includes("org.graylog.events.conditions.Expression")||t.message.includes("org.graylog.events.conditions.Expr")||t.message.includes("org.graylog.events.processor.aggregation.AggregationSeries"))return void this.setState({validation:{errors:{conditions:["Aggregation condition is not valid"]}}});t.message.includes("embryonic")&&this.setState({validation:{errors:{query_parameters:["Query parameters must be declared"]}}})}}})),Nt(this,"handleSubmit",(()=>{const{action:e}=this.props,{eventDefinition:t}=this.state;"create"===e?S.y.create(t).then(this.handleSubmitSuccessResponse,this.handleSubmitFailureResponse):S.y.update(t.id,t).then(this.handleSubmitSuccessResponse,this.handleSubmitFailureResponse)})),this.state={eventDefinition:e.eventDefinition,validation:{errors:{}},eventsClusterConfig:void 0,isDirty:!1}}componentDidMount(){this.fetchClusterConfig(),this.fetchNotifications()}render(){const{action:e,entityTypes:t,notifications:n,currentUser:o}=this.props,{isDirty:a,eventDefinition:l,eventsClusterConfig:r,validation:s}=this.state;if(!t||!n.all||!r)return i.createElement(u.$j,{text:"Loading Event information..."});const c={default_backlog_size:r.events_notification_default_backlog};return i.createElement(i.Fragment,null,a&&i.createElement(u.oU,{question:"Do you really want to abandon this page and lose your changes? This action cannot be undone."}),i.createElement(St,{action:e,eventDefinition:l,currentUser:o,validation:s,entityTypes:t,notifications:n.all,defaults:c,onChange:this.handleChange,onCancel:this.handleCancel,onSubmit:this.handleSubmit}))}}Nt(kt,"propTypes",{action:a().oneOf(["create","edit"]),eventDefinition:a().object,currentUser:a().object.isRequired,entityTypes:a().object,notifications:a().object.isRequired,onEventDefinitionChange:a().func}),Nt(kt,"defaultProps",{action:"edit",eventDefinition:{title:"",description:"",priority:m.Z.NORMAL,config:{},field_spec:{},key_spec:[],notification_settings:{grace_period_ms:0,backlog_size:null},notifications:[],alert:!1},entityTypes:void 0,onEventDefinitionChange:()=>{}});const Tt=(0,d.Z)(kt,{entityTypes:E,notifications:N.O,currentUser:C.D},(e=>{let{currentUser:t,...n}=e;return{...n,currentUser:t.currentUser}}))},XmWOcQPs:(e,t,n)=>{n.d(t,{Z:()=>Z});var i,o,a,l=n("Z7aTuO5B"),r=n("ii0bleBb"),s=n.n(r),c=n("nHcjWeCO"),d=n.n(c),m=n("AztyBNMT"),u=n("9oVghaOd"),p=n.n(u),h=(n("gtXNkEXl"),n("6n4dw8v3")),f=n("F9olzlTR"),g=n("EUJYvlA3"),y=n("WlYEmUoB"),v=(n("nRMrOfDS"),n("BXP2KjIr"),n("4kW3fUUU"));class E extends l.Component{render(){const{validation:e={}}=this.props,t=Object.keys(e.errors);return 0===t.length?null:l.createElement(f.X2,null,l.createElement(f.JX,{md:12},l.createElement(f.bZ,{bsStyle:"danger",className:v.Z.validationSummary},l.createElement("h4",null,"We found some errors!"),l.createElement("p",null,"Please correct the following errors before saving this Event Definition:"),l.createElement("ul",null,t.map((t=>e.errors[t].map((e=>{const n="config"===t?e.replace("config","condition"):e;return l.createElement("li",{key:`${t}-${n}`},n)}))))))))}}i=E,o="propTypes",a={validation:s().object.isRequired},o in i?Object.defineProperty(i,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[o]=a;const b=E;var C=n("dFpwyWHg"),S=n.n(C),N=n("C2ikvoS0"),k=n.n(N),T=n("1IntWRSu"),A=n.n(T),F=n("8nGWeFnd"),P=n.n(F),x=n("TeAcaicX"),R=n.n(x),w=n("eE3+5goe"),D=n.n(w),q=n("R6vKwq+5"),I={};I.styleTagTransform=D(),I.setAttributes=P(),I.insert=A().bind(null,"head"),I.domAPI=k(),I.insertStyleElement=R();S()(q.Z,I);const j=q.Z&&q.Z.locals?q.Z.locals:void 0;function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class _ extends l.Component{constructor(e){super(e),O(this,"showValidation",(()=>{const{showValidation:e}=this.state;e||this.setState({showValidation:!0})})),O(this,"renderDetails",(e=>l.createElement(l.Fragment,null,l.createElement("h3",{className:v.Z.title},"Details"),l.createElement("dl",null,l.createElement("dt",null,"Title"),l.createElement("dd",null,e.title||"No title given"),l.createElement("dt",null,"Description"),l.createElement("dd",null,e.description||"No description given"),l.createElement("dt",null,"Priority"),l.createElement("dd",null,d().upperFirst(y.Z.properties[e.priority].name)))))),O(this,"getPlugin",((e,t)=>void 0===t?{}:m.PluginStore.exports(e).find((e=>e.type===t))||{})),O(this,"renderCondition",(e=>{const{currentUser:t}=this.props,n=this.getPlugin("eventDefinitionTypes",e.type),i=n.summaryComponent?l.createElement(n.summaryComponent,{config:e,currentUser:t}):l.createElement("p",null,"Condition plugin ",l.createElement("em",null,e.type)," does not provide a summary.");return l.createElement(l.Fragment,null,l.createElement("h3",{className:v.Z.title},n.displayName||e.type),i)})),O(this,"renderField",((e,t,n)=>{const{currentUser:i}=this.props;if(!t.providers||0===t.providers.length)return l.createElement("span",{key:e},"No field value provider configured.");const o=t.providers[0]||{},a=this.getPlugin("fieldValueProviders",o.type);return a.summaryComponent?l.createElement(a.summaryComponent,{fieldName:e,config:t,keys:n,key:e,currentUser:i}):l.createElement("p",{key:e},"Provider plugin ",l.createElement("em",null,o.type)," does not provide a summary.")})),O(this,"renderFieldList",((e,t,n)=>l.createElement(l.Fragment,null,l.createElement("dl",null,l.createElement("dt",null,"Keys"),l.createElement("dd",null,n.length>0?n.join(", "):"No Keys configured for Events based on this Definition.")),e.sort(h.S).map((e=>this.renderField(e,t[e],n)))))),O(this,"renderFields",((e,t)=>{const n=Object.keys(e);return l.createElement(l.Fragment,null,l.createElement("h3",{className:v.Z.title},"Fields"),0===n.length?l.createElement("p",null,"No Fields configured for Events based on this Definition."):this.renderFieldList(n,e,t))})),O(this,"renderNotification",(e=>{const{notifications:t}=this.props,n=t.find((t=>t.id===e.notification_id));let i;if(n){const t=this.getPlugin("eventNotificationTypes",n.config.type);i=t.summaryComponent?l.createElement(t.summaryComponent,{type:t.displayName,notification:n,definitionNotification:e}):l.createElement("p",null,"Notification plugin ",l.createElement("em",null,n.config.type)," does not provide a summary.")}else i=l.createElement("p",null,"Could not find information for Notification ",l.createElement("em",null,e.notification_id),".");return l.createElement(l.Fragment,{key:e.notification_id},i)})),O(this,"renderNotificationSettings",(e=>{const t=p().duration(e.grace_period_ms).format("d [days] h [hours] m [minutes] s [seconds]",{trim:"all"}),n=e.grace_period_ms?`Grace Period is set to ${t}`:"Grace Period is disabled",i=e.backlog_size?`Notifications will include ${e.backlog_size} messages`:"Notifications will not include any messages.";return l.createElement(l.Fragment,null,l.createElement("h4",null,"Settings"),l.createElement("dl",null,l.createElement("dd",null,n),l.createElement("dd",null,i)))})),O(this,"renderNotifications",((e,t)=>{const{currentUser:n}=this.props,i=e.filter((e=>(0,g.rq)(n.permissions,`eventnotifications:read:${e.notification_id}`))),o=e.filter((e=>!i.map((e=>e.notification_id)).includes(e.notification_id))),a=o.length>0?l.createElement(f.bZ,{bsStyle:"warning"},"Missing Notifications Permissions for:",l.createElement("br",null),o.map((e=>e.notification_id)).join(", ")):null;return l.createElement(l.Fragment,null,l.createElement("h3",{className:v.Z.title},"Notifications"),l.createElement("p",null,a),0===i.length&&o.length<=0?l.createElement("p",null,"This Event is not configured to trigger any Notifications."):l.createElement(l.Fragment,null,this.renderNotificationSettings(t),e.map(this.renderNotification)))})),this.state={showValidation:!1}}componentDidUpdate(){this.showValidation()}render(){const{eventDefinition:e,validation:t}=this.props,{showValidation:n}=this.state;return l.createElement(f.X2,{className:j.eventSummary},l.createElement(f.JX,{md:12},l.createElement("h2",{className:v.Z.title},"Event Summary"),n&&l.createElement(b,{validation:t}),l.createElement(f.X2,null,l.createElement(f.JX,{md:5},this.renderDetails(e)),l.createElement(f.JX,{md:5,mdOffset:1},this.renderCondition(e.config))),l.createElement(f.X2,null,l.createElement(f.JX,{md:5},this.renderFields(e.field_spec,e.key_spec)),l.createElement(f.JX,{md:5,mdOffset:1},this.renderNotifications(e.notifications,e.notification_settings)))))}}O(_,"propTypes",{eventDefinition:s().object.isRequired,notifications:s().array.isRequired,validation:s().object,currentUser:s().object.isRequired}),O(_,"defaultProps",{validation:void 0});const Z=_},x85XLEUc:(e,t,n)=>{n.d(t,{Z:()=>N});var i=n("Z7aTuO5B"),o=n("ii0bleBb"),a=n.n(o),l=n("nHcjWeCO"),r=n.n(l),s=n("0zTRKSqx"),c=n("BSHS2nUH"),d=n("DeVaSktS"),m=n("5GvVt6f3"),u=n("AztyBNMT"),p=n("F9olzlTR"),h=n("YyiN4DLW");function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const g=e=>void 0===e?{}:u.PluginStore.exports("eventNotificationTypes").find((t=>t.type===e))||{};class y extends i.Component{constructor(e){super(e),f(this,"setIsSubmitEnabled",(e=>{this.setState({isSubmitEnabled:e})})),f(this,"handleSubmit",(e=>{const{notification:t,onSubmit:n}=this.props;e.preventDefault(),n(t)})),f(this,"handleChange",(e=>{const{name:t}=e.target,{onChange:n}=this.props;n(t,(0,h.n6)(e.target))})),f(this,"handleConfigChange",(e=>{const{onChange:t}=this.props;t("config",e)})),f(this,"handleTypeChange",(e=>{const t=g(e).defaultConfig||{};this.handleConfigChange({...t,type:e})})),f(this,"handleTestTrigger",(()=>{const{notification:e,onTest:t}=this.props;t(e)})),this.state={isSubmitEnabled:!0}}render(){const{action:e,embedded:t,formId:n,notification:o,onCancel:a,validation:l,testResult:c}=this.props,{isSubmitEnabled:d}=this.state,m=g(o.config.type),h=m.formComponent?i.createElement(m.formComponent,{config:o.config,onChange:this.handleConfigChange,validation:l,setIsSubmitEnabled:this.setIsSubmitEnabled}):null,f=c.isLoading?i.createElement(s.$j,{text:"Testing..."}):"Execute Test Notification";return i.createElement(p.X2,null,i.createElement(p.JX,{lg:8},i.createElement("form",{onSubmit:this.handleSubmit,id:n},i.createElement(p.II,{id:"notification-title",name:"title",label:"Title",type:"text",bsStyle:l.errors.title?"error":null,help:r().get(l,"errors.title[0]","Title to identify this Notification."),value:o.title,onChange:this.handleChange,required:!0,autoFocus:!0}),i.createElement(p.II,{id:"notification-description",name:"description",label:i.createElement("span",null,"Description ",i.createElement("small",{className:"text-muted"},"(Optional)")),type:"textarea",help:"Longer description for this Notification.",value:o.description,onChange:this.handleChange,rows:2}),i.createElement(p.cw,{controlId:"notification-type",validationState:l.errors.config?"error":null},i.createElement(p.J$,null,"Notification Type"),i.createElement(s.Ph,{id:"notification-type",options:u.PluginStore.exports("eventNotificationTypes").map((e=>({label:e.displayName,value:e.type}))),value:o.config.type,onChange:this.handleTypeChange,clearable:!1,required:!0}),i.createElement(p.Qb,null,r().get(l,"errors.config[0]","Choose the type of Notification to create."))),h,h&&i.createElement(p.cw,null,i.createElement(p.J$,null,"Test Notification ",i.createElement("small",{className:"text-muted"},"(Optional)")),i.createElement(p.NI.Static,null,i.createElement(p.zx,{bsStyle:"info",bsSize:"small",disabled:c.isLoading,onClick:this.handleTestTrigger},f)),c.message&&i.createElement(p.bZ,{bsStyle:c.error?"danger":"success"},i.createElement("b",null,c.error?"Error: ":"Success: "),c.message),i.createElement(p.Qb,null,"Execute this Notification with a test Alert.")),!t&&i.createElement(s.Ow,{disabledSubmit:!d,submitButtonText:("create"===e?"Create":"Update")+" notification",onCancel:a}))))}}f(y,"propTypes",{action:a().oneOf(["create","edit"]),notification:a().object.isRequired,validation:a().object.isRequired,testResult:a().shape({isLoading:a().bool,error:a().bool,message:a().string}).isRequired,formId:a().string,embedded:a().bool.isRequired,onChange:a().func.isRequired,onCancel:a().func.isRequired,onSubmit:a().func.isRequired,onTest:a().func.isRequired}),f(y,"defaultProps",{action:"edit",formId:void 0});const v=y;n("BXP2KjIr");function E(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const b={errors:{}},C={isLoading:!1};class S extends i.Component{static scrollToFirstError(){void 0!==document.getElementsByClassName("has-error")[0]&&document.getElementsByClassName("has-error")[0].scrollIntoView(!0)}constructor(e){super(e),E(this,"handleChange",((e,t)=>{const{notification:n}=this.state,i=r().cloneDeep(n);i[e]=t,this.setState({notification:i,isDirty:!0,testResult:C})})),E(this,"handleCancel",(()=>{c.Z.push(d.ZP.ALERTS.NOTIFICATIONS.LIST)})),E(this,"handleSubmit",(()=>{const{action:e,embedded:t,onSubmit:n}=this.props,{notification:i}=this.state;let o;"create"===e?(o=m.e.create(i),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}),S.scrollToFirstError())}))):(o=m.e.update(i.id,i),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}),S.scrollToFirstError())}))),n(o)})),E(this,"handleTest",(()=>{const{notification:e}=this.state;this.setState({testResult:{isLoading:!0},validation:b});const t=r().clone(C);this.testPromise=m.e.test(e),this.testPromise.then((e=>(t.error=!1,t.message="Notification was executed successfully.",e)),(e=>{t.error=!0;const{body:n}=e.additional;400===e.status&&n&&n.failed?(t.message="Validation failed, please correct any errors in the form before continuing.",this.setState({validation:n})):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:b,testResult:C,isDirty:!1}}componentWillUnmount(){this.testPromise&&this.testPromise.cancel()}render(){const{action:e,embedded:t,formId:n}=this.props,{notification:o,validation:a,testResult:l,isDirty:r}=this.state;return i.createElement(i.Fragment,null,!t&&r&&i.createElement(s.oU,{question:"Do you really want to abandon this page and lose your changes? This action cannot be undone."}),i.createElement(v,{action:e,notification:o,validation:a,testResult:l,formId:n,embedded:t,onChange:this.handleChange,onCancel:this.handleCancel,onSubmit:this.handleSubmit,onTest:this.handleTest}))}}E(S,"propTypes",{action:a().oneOf(["create","edit"]),notification:a().object,embedded:a().bool,formId:a().string,onSubmit:a().func}),E(S,"defaultProps",{action:"edit",notification:{title:"",description:"",config:{}},embedded:!1,formId:void 0,onSubmit:()=>{}});const N=S},WlYEmUoB:(e,t,n)=>{n.d(t,{Z:()=>i});const i={LOW:1,NORMAL:2,HIGH:3,properties:{1:{name:"low"},2:{name:"normal"},3:{name:"high"}}}},xDyzG6yO:(e,t,n)=>{n.d(t,{Z:()=>r});var i=n("pmX897Fv"),o=n.n(i),a=n("DjJvgDaP"),l=n.n(a)()(o());l.push([e.id,".bK_1OgMCpxX5cNvo_KNH {\n    margin-top: 35px;\n}\n\n.r3CTNJIqazOh7HmXypag {\n    margin-left: 15px;\n    margin-right: 15px;\n}\n","",{version:3,sources:["webpack://./src/components/event-definitions/event-definition-form/EventConditionForm.css"],names:[],mappings:"AAAA;IACI,gBAAgB;AACpB;;AAEA;IACI,iBAAiB;IACjB,kBAAkB;AACtB",sourcesContent:[":local(.conditionTypesInfo) {\n    margin-top: 35px;\n}\n\n:local(.hr) {\n    margin-left: 15px;\n    margin-right: 15px;\n}\n"],sourceRoot:""}]),l.locals={conditionTypesInfo:"bK_1OgMCpxX5cNvo_KNH",hr:"r3CTNJIqazOh7HmXypag"};const r=l},"R6vKwq+5":(e,t,n)=>{n.d(t,{Z:()=>r});var i=n("pmX897Fv"),o=n.n(i),a=n("DjJvgDaP"),l=n.n(a)()(o());l.push([e.id,".xZzz7avfOImN5wyTQXue dl dl {\n    padding-left: 10px;\n    margin-bottom: 5px;\n}\n","",{version:3,sources:["webpack://./src/components/event-definitions/event-definition-form/EventDefinitionSummary.css"],names:[],mappings:"AAAA;IACI,kBAAkB;IAClB,kBAAkB;AACtB",sourcesContent:[":local(.eventSummary) dl dl {\n    padding-left: 10px;\n    margin-bottom: 5px;\n}\n"],sourceRoot:""}]),l.locals={eventSummary:"xZzz7avfOImN5wyTQXue"};const r=l},x1BxQQLs:(e,t,n)=>{n.d(t,{Z:()=>r});var i=n("pmX897Fv"),o=n.n(i),a=n("DjJvgDaP"),l=n.n(a)()(o());l.push([e.id,".ZziANjUKFVuuqMSwLmtB {\n    width: 150px;\n}\n\n.Xylx_0ZpoJHGYL_KE6gZ:not(:last-child):after {\n    content: ', ';\n}\n","",{version:3,sources:["webpack://./src/components/event-definitions/event-definition-form/FieldsList.css"],names:[],mappings:"AAAA;IACI,YAAY;AAChB;;AAEA;IACI,aAAa;AACjB",sourcesContent:[":local(.actions) {\n    width: 150px;\n}\n\n:local(.providerOptions):not(:last-child):after {\n    content: ', ';\n}\n"],sourceRoot:""}]),l.locals={actions:"ZziANjUKFVuuqMSwLmtB",providerOptions:"Xylx_0ZpoJHGYL_KE6gZ"};const r=l},bRhJtaaM:(e,t,n)=>{n.d(t,{Z:()=>r});var i=n("pmX897Fv"),o=n.n(i),a=n("DjJvgDaP"),l=n.n(a)()(o());l.push([e.id,".NLt8T3UO0KICJTv1bzhC {\n    float: right;\n    margin-top: 10px;\n}\n\n.cWTw12YX10UuN5KAKoIX {\n    margin-top: 35px;\n}\n","",{version:3,sources:["webpack://./src/components/event-definitions/event-definition-form/NotificationsForm.css"],names:[],mappings:"AAAA;IACI,YAAY;IACZ,gBAAgB;AACpB;;AAEA;IACI,gBAAgB;AACpB",sourcesContent:[":local(.manageNotifications) {\n    float: right;\n    margin-top: 10px;\n}\n\n:local(.notificationSettings) {\n    margin-top: 35px;\n}\n"],sourceRoot:""}]),l.locals={manageNotifications:"NLt8T3UO0KICJTv1bzhC",notificationSettings:"cWTw12YX10UuN5KAKoIX"};const r=l},"3QxG6MMi":(e,t,n)=>{n.d(t,{Z:()=>r});var i=n("pmX897Fv"),o=n.n(i),a=n("DjJvgDaP"),l=n.n(a)()(o());l.push([e.id,".m1bai3Kt45u9j3MtW7hT {\n    margin-bottom: 20px;\n}\n\n.EJT6DlEKjyYuxyouwsaR {\n    table-layout: fixed;\n}\n","",{version:3,sources:["webpack://./src/components/event-definitions/event-definition-form/field-value-providers/CommonFieldValueProviderSummary.css"],names:[],mappings:"AAAA;IACI,mBAAmB;AACvB;;AAEA;IACI,mBAAmB;AACvB",sourcesContent:[":local(.field) {\n    margin-bottom: 20px;\n}\n\n:local(.fixedTable) {\n    table-layout: fixed;\n}\n"],sourceRoot:""}]),l.locals={field:"m1bai3Kt45u9j3MtW7hT",fixedTable:"EJT6DlEKjyYuxyouwsaR"};const r=l},"dntKaB+S":(e,t,n)=>{n.d(t,{Z:()=>r});var i=n("pmX897Fv"),o=n.n(i),a=n("DjJvgDaP"),l=n.n(a)()(o());l.push([e.id,".DqBObyDjYFhBwILgUW_Q .panel-body {\n    padding: 20px 10px;\n}\n\n.DqBObyDjYFhBwILgUW_Q ul {\n    padding-left: 1em;\n}\n","",{version:3,sources:["webpack://./src/components/event-definitions/event-definition-form/field-value-providers/TemplateFieldValueProviderPreview.css"],names:[],mappings:"AAAA;IACI,kBAAkB;AACtB;;AAEA;IACI,iBAAiB;AACrB",sourcesContent:[":local(.templatePreview) .panel-body {\n    padding: 20px 10px;\n}\n\n:local(.templatePreview) ul {\n    padding-left: 1em;\n}\n"],sourceRoot:""}]),l.locals={templatePreview:"DqBObyDjYFhBwILgUW_Q"};const r=l}}]);
//# sourceMappingURL=325e2d4b-4811.8efb53064130901ed6c0.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy