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

web-interface.assets.1255d548-2501.8ba161447f299d54ecdc.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-2501"],{FBcshu83:(x,P,t)=>{t.d(P,{Z:()=>f});var e=t("ii0bleBb"),a=t.n(e),n=t("Z7aTuO5B"),u=t("r3NKmxcf"),E=t("JOCOSU54");const s="",p=(l,c)=>{if(c.type===u.Z.MATCH_INPUT){const m=l.find(({id:S})=>S===c.value);return m?`${m.title} (${m.name}: ${m.id})`:`: ${c.value})`}return c.type!==u.Z.FIELD_PRESENCE?c.value?c.value:s:null},O=l=>l.field?l.field:l.type===u.Z.MATCH_INPUT?"gl_source_input":s,h=({streamRule:l,inputs:c=[]})=>{const{data:m}=(0,E.Z)(),S=m==null?void 0:m.find(({id:L})=>L===l.type),g=l.inverted?"not ":null,M=S?S.long_desc:null;return l.type===u.Z.ALWAYS_MATCHES?n.createElement("span",null,"Rule always matches"):n.createElement("span",null,n.createElement("em",null,O(l))," ",n.createElement("strong",null,"must ",g),M," ",n.createElement("em",null,p(c,l)))};h.propTypes={streamRule:a().object.isRequired,inputs:a().array.isRequired};const f=h},RfX2tXzp:(x,P,t)=>{t.d(P,{Z:()=>H});var e=t("ii0bleBb"),a=t.n(e),n=t("Z7aTuO5B"),u=t("oc9db6Tt"),E=t.n(u),s=t("J6y4/h8P"),p=t("FBcshu83"),O=t("8fnsnG21"),h=t("/GOzvPf6"),f=t("uZqmR+ju"),l=t("0TVxnHwi"),c=t("0CyR/E1C"),m=t("jAGDuYSC"),S=t("W/ejv//U"),g=t("apKKh8n6"),M=t("q2j1bVbz");const L=s.default.span`
  margin-right: 6px;
`,d=({matchData:_,stream:A,streamRule:T,onSubmit:v,onDelete:b})=>{const{permissions:K}=(0,M.Z)(),[N,y]=(0,n.useState)(!1),{inputs:Z}=(0,O.o)(S.R);(0,n.useEffect)(()=>{S.l.list()},[]);const j=D=>{D.preventDefault(),y(!0)},Y=D=>{D.preventDefault(),window.confirm("Do you really want to delete this stream rule?")&&g.b.remove(A.id,T.id,()=>{b&&b(T.id),m.Z.success("Stream rule has been successfully deleted.","Success")})},I=(D,$)=>g.b.update(A.id,D,$,()=>{v&&v(D,$),m.Z.success("Stream rule has been successfully updated.","Success")}),r=()=>n.createElement(L,null,n.createElement(f.Button,{bsStyle:"link",bsSize:"xsmall",onClick:Y,title:"Delete stream rule"},n.createElement(h.JO,{name:"trash-alt",type:"regular"})),n.createElement(f.Button,{bsStyle:"link",bsSize:"xsmall",onClick:j,title:"Edit stream rule"},n.createElement(h.JO,{name:"edit"}))),o=()=>_.rules[T.id]?"success":"danger",i=(0,l.rq)(K,[`streams:edit:${A.id}`])?r():null,C=T.description?n.createElement("small",null," ","(",T.description,")"):null,U=E()(_)?null:o();return n.createElement(f.ListGroupItem,{bsStyle:U},i,n.createElement(p.Z,{streamRule:T,inputs:Z}),N&&n.createElement(c.Z,{initialValues:T,onClose:()=>y(!1),title:"Edit Stream Rule",submitButtonText:"Update Rule",submitLoadingText:"Updating Rule...",onSubmit:I}),C)};d.propTypes={matchData:a().shape({matches:a().bool,rules:a().object}),onDelete:a().func,onSubmit:a().func,stream:a().object.isRequired,streamRule:a().object.isRequired},d.defaultProps={matchData:{},onSubmit:()=>{},onDelete:()=>{}};const R=d,F=({matchData:_,onDelete:A,onSubmit:T,stream:v})=>{if(!v)return n.createElement(h.$j,null);const b=!!v.rules.length;return n.createElement(f.ListGroup,{componentClass:"ul"},b&&v.rules.map(K=>n.createElement(R,{key:K.id,matchData:_,onSubmit:T,onDelete:A,stream:v,streamRule:K})),!b&&n.createElement(f.ListGroupItem,null,"No rules defined."))};F.propTypes={matchData:a().shape({matches:a().bool,rules:a().object}),onSubmit:a().func,onDelete:a().func,stream:a().object.isRequired},F.defaultProps={matchData:{},onSubmit:()=>{},onDelete:()=>{}};const H=F},"0CyR/E1C":(x,P,t)=>{t.d(P,{Z:()=>L});var e=t("Z7aTuO5B"),a=t("UiXZqrDE"),n=t("kbGtT3aS"),u=t("/GOzvPf6"),E=t("FBcshu83"),s=t("uZqmR+ju"),p=t("fVisTAey"),O=t("E+CaPsQD"),h=t("8fnsnG21"),f=t("W/ejv//U"),l=t("r3NKmxcf"),c=t("JOCOSU54");const m=d=>d!==l.Z.FIELD_PRESENCE&&d!==l.Z.ALWAYS_MATCHES,S=d=>d!==l.Z.ALWAYS_MATCHES&&d!==l.Z.MATCH_INPUT,g=d=>{let R={};return d.type||(R={...R,type:"Type is required"}),m(d.type)&&!d.value&&(R={...R,value:"Value is required"}),S(d.type)&&!d.field&&(R={...R,field:"Field is required"}),R},M=({title:d,onClose:R,submitButtonText:F,submitLoadingText:H,onSubmit:_,initialValues:A})=>{const{inputs:T}=(0,h.o)(f.R),{data:v}=(0,c.Z)();(0,e.useEffect)(()=>{f.l.list()},[]);const b=(0,e.useCallback)(y=>_(A==null?void 0:A.id,y).then(()=>R()),[_,A==null?void 0:A.id,R]),K=(0,e.useMemo)(()=>v==null?void 0:v.map(({id:y,short_desc:Z})=>({value:y,label:Z})),[v]),N=(0,e.useMemo)(()=>T==null?void 0:T.map(({id:y,title:Z,name:j})=>({label:`${Z} (${j})`,value:y})),[T]);return e.createElement(s.Modal,{title:d,onHide:R,show:!0},e.createElement(a.Formik,{initialValues:A,onSubmit:b,validate:g},({values:y,setFieldValue:Z,isSubmitting:j,isValidating:Y})=>e.createElement(a.Form,null,e.createElement(s.Modal.Header,{closeButton:!0},e.createElement(s.Modal.Title,null,d)),e.createElement(s.Modal.Body,null,v!=null&&v.length?e.createElement(s.Row,null,e.createElement(s.Col,{md:8},S(y.type)&&e.createElement(a.Field,{name:"field"},({field:{name:I,value:r,onChange:o,onBlur:i},meta:{error:C,touched:U}})=>e.createElement(u.jY,{id:I,onBlur:i,type:"text",label:"Field",name:I,error:C&&U?C:void 0,defaultValue:r,onChange:o})),e.createElement(a.Field,{name:"type"},({field:{name:I,value:r,onChange:o,onBlur:i},meta:{error:C,touched:U}})=>e.createElement(s.Input,{label:"Type",id:"type",error:C&&U?C:void 0},e.createElement(u.Ph,{onBlur:i,onChange:D=>((D===l.Z.MATCH_INPUT||D===l.Z.ALWAYS_MATCHES)&&(Z("value",""),Z("field","")),o({target:{value:D,name:I}})),options:K,inputId:I,placeholder:"Select a type",inputProps:{"aria-label":"Select a type"},value:r}))),m(y.type)&&(y.type===l.Z.MATCH_INPUT?e.createElement(a.Field,{name:"value"},({field:{name:I,value:r,onChange:o,onBlur:i},meta:{error:C,touched:U}})=>e.createElement(s.Input,{id:"value",label:"Input",error:C&&U?C:void 0},e.createElement(u.Ph,{onBlur:i,onChange:D=>{o({target:{value:D,name:I}})},options:N,inputId:I,placeholder:"Select an input",inputProps:{"aria-label":"Select an input"},value:r}))):e.createElement(u.jc,{id:"value",label:"Value",name:"value"})),e.createElement(u.jc,{id:"inverted",label:"Inverted",name:"inverted",type:"checkbox"}),e.createElement(u.jc,{id:"description",label:e.createElement(e.Fragment,null,"Description ",e.createElement(u.Sr,null)),name:"description",type:"textarea"}),e.createElement("p",null,e.createElement("strong",null,"Result:")," ",e.createElement(E.Z,{streamRule:y,inputs:T}))),e.createElement(s.Col,{md:4},e.createElement(s.Well,{bsSize:"small",className:"matcher-github"},"The server will try to convert to strings or numbers based on the matcher type as well as it can.",e.createElement("br",null),e.createElement("br",null),e.createElement(u.JO,{name:"github",type:"brand"}),"\xA0",e.createElement("a",{href:`https://github.com/Graylog2/graylog2-server/tree/${n.ZP.getMajorAndMinorVersion()}/graylog2-server/src/main/java/org/graylog2/streams/matchers`,target:"_blank",rel:"noopener noreferrer"}," Take a look at the matcher code on GitHub"),e.createElement("br",null),e.createElement("br",null),"Regular expressions use Java syntax. ",e.createElement(p.eb,{page:O.Z.PAGES.STREAMS,title:"More information",text:e.createElement(u.JO,{name:"lightbulb",type:"regular"})})))):e.createElement(u.$j,null)),e.createElement(s.Modal.Footer,null,e.createElement(u.os,{submitButtonText:F,submitLoadingText:H,onCancel:R,disabledSubmit:Y,isSubmitting:j})))))};M.defaultProps={initialValues:{field:"",type:1,value:"",inverted:!1,description:""}};const L=M},JOCOSU54:(x,P,t)=>{t.d(P,{Z:()=>E});var e=t("DUKaTDO2"),a=t("apKKh8n6"),n=t("jAGDuYSC");const E=()=>{const{data:s}=(0,e.useQuery)(["streams","rule-types"],()=>a.b.types(),{onError:p=>{n.Z.error(`Loading stream rule types failed with status: ${p}`,"Could not load stream rule types")},keepPreviousData:!0,staleTime:36e5});return{data:s}}},r3NKmxcf:(x,P,t)=>{t.d(P,{Z:()=>a});const a={FIELD_PRESENCE:5,ALWAYS_MATCHES:7,MATCH_INPUT:8}},VBBnYA0D:(x,P,t)=>{t.r(P),t.d(P,{default:()=>I});var e=t("Z7aTuO5B"),a=t("yAXMqwrl"),n=t("uZqmR+ju"),u=t("ii0bleBb"),E=t.n(u),s=t("J6y4/h8P"),p=t("ty2gyrHp"),O=t("d4kzUuQm"),h=t("/GOzvPf6"),f=t("mihjYJ2+"),l=t("jAGDuYSC"),c=t("pUKP3+Pg"),m=Object.defineProperty,S=(r,o,i)=>o in r?m(r,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[o]=i,g=(r,o,i)=>(S(r,typeof o!="symbol"?o+"":o,i),i);const M=s.default.div(({theme:r})=>(0,s.css)`
  margin-top: 10px;
  margin-bottom: 13px;

  label {
    font-size: ${r.fonts.size.small};
  }

  .form-group {
    margin-bottom: 5px;
  }

  .radio {
    margin-top: 0;
    margin-bottom: 0;
  }

  input[type='radio'] {
    margin-top: 2px;
    margin-bottom: 2px;
  }
`);class L extends e.Component{constructor(){super(...arguments),g(this,"handleTypeChangeToAnd",()=>{this.handleTypeChange("AND")}),g(this,"handleTypeChangeToOr",()=>{this.handleTypeChange("OR")}),g(this,"handleTypeChange",o=>{const{onChange:i,stream:C}=this.props;window.confirm("You are about to change how rules are applied to this stream, do you want to continue? Changes will take effect immediately.")&&c.ZP.update(C.id,{matching_type:o},U=>(i(),l.Z.success(`Messages will now be routed into the stream when ${o==="AND"?"all":"any"} rules are matched`,"Success"),U))})}render(){const{stream:o}=this.props;return e.createElement(M,null,e.createElement("div",null,e.createElement(n.Input,{id:"streamrule-and-connector",type:"radio",label:"A message must match all of the following rules",checked:o.matching_type==="AND",onChange:this.handleTypeChangeToAnd}),e.createElement(n.Input,{id:"streamrule-or-connector",type:"radio",label:"A message must match at least one of the following rules",checked:o.matching_type==="OR",onChange:this.handleTypeChangeToOr})))}}g(L,"propTypes",{stream:E().object.isRequired,onChange:E().func.isRequired});const d=L;var R=t("RfX2tXzp"),F=t("0CyR/E1C"),H=t("dsvqAVKU"),_=t("apKKh8n6"),A=t("yzCFXWYn");const T=(0,s.default)(n.Panel.Heading)`
  font-weight: bold;
`,v=(0,s.default)(h.JO)(({theme:r,$empty:o,$matches:i})=>{const C=i?r.colors.variant.success:r.colors.variant.danger;return(0,s.css)`
      color: ${o?r.colors.variant.info:C};
      margin-right: 3px;
`}),b=(0,s.default)(H.Z)`
  margin-left: 10px;
`,K=r=>r.matches?"success":"danger",N=({streamId:r,messageId:o,index:i})=>{const[C,U]=(0,e.useState)(!1),[D,$]=(0,e.useState)(),[W,X]=(0,e.useState)(),{data:G,refetch:J}=(0,A.Z)(r);(0,e.useEffect)(()=>{const B=()=>J();return c.ZP.onChange(B),_.b.onChange(B),()=>{c.ZP.unregister(B),_.b.unregister(B)}},[J]);const Q=B=>{$(B),D!==void 0?c.ZP.testMatch(r,{message:D.fields},z=>{X(z)}):X(void 0)},V=(B,z)=>_.b.create(r,z,()=>{}),w=B=>{B.preventDefault(),U(!0)},k=W?K(W):"info";return G?e.createElement(n.Row,{className:"content"},e.createElement(n.Col,{md:12,className:"streamrule-sample-message"},e.createElement("h2",null,"1. Load a message to test rules"),e.createElement("div",{className:"stream-loader"},e.createElement(f.Z,{messageId:o,index:i,onMessageLoaded:Q})),e.createElement("hr",null),e.createElement("div",{className:"buttons pull-right"},e.createElement(n.Button,{bsStyle:"success",className:"show-stream-rule",onClick:w},"Add stream rule"),C&&e.createElement(F.Z,{title:"New Stream Rule",onClose:()=>U(!1),submitButtonText:"Create Rule",submitLoadingText:"Creating Rule...",onSubmit:V})),e.createElement("h2",null,"2. Manage stream rules"),e.createElement(d,{stream:G,onChange:J}),e.createElement(n.Panel,{bsStyle:k},e.createElement(T,null,(W==null?void 0:W.matches)&&e.createElement(e.Fragment,null,e.createElement(v,{$matches:!0,name:"check"})," This message would be routed to this stream!"),W&&!W.matches&&e.createElement(e.Fragment,null,e.createElement(v,{name:"times"})," This message would not be routed to this stream."),!W&&e.createElement(e.Fragment,null,e.createElement(v,{$empty:!0,name:"exclamation-circle"})," Please load a message in Step 1 above to check if it would match against these rules.")),e.createElement(R.Z,{stream:G,matchData:W})),e.createElement("p",null,e.createElement(p.J,{to:O.ZP.STREAMS},e.createElement(n.Button,{bsStyle:"success"},"I'm done!"))))):e.createElement(n.Row,{className:"content"},e.createElement(b,null))};N.propTypes={streamId:E().string.isRequired,messageId:E().string,index:E().string},N.defaultProps={messageId:"",index:""};const y=N;var Z=t("brbjQOmY"),j=t("E+CaPsQD");const I=()=>{const r=(0,a.useParams)(),o=(0,Z.Z)(),{data:i}=(0,A.Z)(r.streamId);return i?e.createElement(h.$4,{title:`Rules of Stream ${i.title}`},e.createElement("div",null,e.createElement(h.mr,{title:e.createElement("span",null,'Rules of Stream "',i.title,'"'),documentationLink:{title:"Streams documentation",path:j.Z.PAGES.STREAMS}},e.createElement("span",null,"This screen is dedicated to an easy and comfortable creation and manipulation of stream rules. You can"," ","see the effect configured stream rules have on message matching here.")),!i.is_default&&e.createElement(y,{streamId:r.streamId,messageId:o.message_id,index:o.index}),i.is_default&&e.createElement("div",{className:"row content"},e.createElement("div",{className:"col-md-12"},e.createElement(n.Alert,{bsStyle:"danger"},"The default stream cannot be edited."))))):e.createElement(h.$j,null)}},"W/ejv//U":(x,P,t)=>{t.d(P,{R:()=>O,l:()=>p});var e=t("JnTtTRmZ"),a=t.n(e),n=t("jAGDuYSC"),u=t("MdYBRjRJ"),E=t("eFxcQyPT"),s=t("IA3Ku5lS");const p=(0,s.ei)("core.StreamRulesInputs",()=>a().createActions({list:{asyncResult:!0}})),O=(0,s.dS)("core.StreamRulesInputs",()=>a().createStore({listenables:[p],sourceUrl:"/streams/rules/inputs",inputs:void 0,init(){this.list()},_state(){return{inputs:this.inputs}},getInitialState(){return this._state()},list(){const h=(0,E.ZP)("GET",(0,u.DC)(this.sourceUrl));h.then(f=>(this.inputs=f.inputs,this.trigger(this._state()),this.inputs),f=>{n.Z.error(`Fetching Stream Rule Inputs List failed with status: ${f}`,"Could not retrieve Stream Rule Inputs")}),p.list.promise(h)}}))},apKKh8n6:(x,P,t)=>{t.d(P,{b:()=>f});var e=t("JnTtTRmZ"),a=t.n(e),n=t("XYSsaeV4"),u=t.n(n),E=t("eFxcQyPT"),s=t("U1Iufsob"),p=t("MdYBRjRJ"),O=t("jAGDuYSC"),h=t("IA3Ku5lS");const f=(0,h.dS)("core.StreamRules",()=>a().createStore({callbacks:[],types(){const l="/streams/null/rules/types";return(0,E.ZP)("GET",p.DC(l))},update(l,c,m,S){const g=d=>{O.Z.error(`Updating Stream Rule failed with status: ${d}`,"Could not update Stream Rule")},M=p.DC(s.Z.StreamRulesApiController.update(l,c).url),L={field:m.field,type:m.type,value:m.value,inverted:m.inverted,description:m.description};return(0,E.ZP)("PUT",M,L).then(S,g).then(this._emitChange.bind(this))},remove(l,c,m){const S=M=>{O.Z.error(`Deleting Stream Rule failed with status: ${M}`,"Could not delete Stream Rule")},g=p.DC(s.Z.StreamRulesApiController.delete(l,c).url);(0,E.ZP)("DELETE",g).then(m,S).then(this._emitChange.bind(this))},create(l,c,m){const S=M=>{O.Z.error(`Creating Stream Rule failed with status: ${M}`,"Could not create Stream Rule")},g=p.DC(s.Z.StreamRulesApiController.create(l).url);return(0,E.ZP)("POST",g,c).then(m,S).then(this._emitChange.bind(this))},onChange(l){this.callbacks.push(l)},_emitChange(){this.callbacks.forEach(l=>l())},unregister(l){u()(this.callbacks,l)}}))}}]);})();

//# sourceMappingURL=1255d548-2501.8ba161447f299d54ecdc.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy