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

web-interface.assets.1255d548-5208.fa6065c6e394611402c8.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-5208"],{OnngdBD8:(S,g,s)=>{s.d(g,{Z:()=>c});var e=s("pmX897Fv"),o=s.n(e),m=s("DjJvgDaP"),f=s.n(m),i=f()(o());i.push([S.id,`.message-preview-wrapper {
    margin-left: 15px;
    margin-right: 15px;
}

.message-preview-wrapper dl {
    margin-top: 5px;
    margin-bottom: 0;
}`,"",{version:3,sources:["webpack://./src/components/simulator/SimulationResults.lazy.css"],names:[],mappings:"AAAA;IACI,iBAAiB;IACjB,kBAAkB;AACtB;;AAEA;IACI,eAAe;IACf,gBAAgB;AACpB",sourcesContent:[`.message-preview-wrapper {
    margin-left: 15px;
    margin-right: 15px;
}

.message-preview-wrapper dl {
    margin-top: 5px;
    margin-bottom: 0;
}`],sourceRoot:""}]),i.locals={};const c=i},OCCnKtt5:(S,g,s)=>{s.d(g,{Z:()=>c});var e=s("pmX897Fv"),o=s.n(e),m=s("DjJvgDaP"),f=s.n(m),i=f()(o());i.push([S.id,`.dl-simulation-trace {
    padding-top: 15px;
}

.dl-simulation-trace dt {
    width: 80px;
}

.dl-simulation-trace dd {
    margin-left: 100px;
    margin-bottom: 5px;
}
`,"",{version:3,sources:["webpack://./src/components/simulator/SimulationTrace.lazy.css"],names:[],mappings:"AAAA;IACI,iBAAiB;AACrB;;AAEA;IACI,WAAW;AACf;;AAEA;IACI,kBAAkB;IAClB,kBAAkB;AACtB",sourcesContent:[`.dl-simulation-trace {
    padding-top: 15px;
}

.dl-simulation-trace dt {
    width: 80px;
}

.dl-simulation-trace dd {
    margin-left: 100px;
    margin-bottom: 5px;
}
`],sourceRoot:""}]),i.locals={};const c=i},SfPIQIJE:(S,g,s)=>{s.d(g,{Z:()=>L});var e=s("Z7aTuO5B"),o=s("J6y4/h8P"),m=s("uZqmR+ju"),f=s("ty2gyrHp"),i=s("/GOzvPf6"),c=s("NV1/EHMi");const M=(0,o.default)(m.ButtonToolbar)`
  margin-bottom: 10px;
`,y=(0,o.default)(m.Button)(({theme:d})=>(0,o.css)`
  font-family: ${d.fonts.family.navigation};
  font-size: ${d.fonts.size.navigation};

  &&&& {
    color: ${d.colors.variant.darker.default};
    
    &:hover,
    &:focus {
      text-decoration: none;
    }

    > div {
      &:hover,
      &:focus {
        color: ${d.colors.variant.darker.default};
      }
    }

    &:hover {
      ${(0,c.RF)(d)}
    }

    &.active {
      color: ${d.colors.global.textDefault};

      ${(0,c.A7)(d)}

      &:hover,
      &:focus {
        ${(0,c.A7)(d)}
      }
    }
  }
`);y.displayName="Button";const L=({items:d})=>e.createElement(M,null,d.map(({path:R,title:U,permissions:I,exactPathMatch:x})=>R?e.createElement(i.AE,{permissions:I!=null?I:[],key:R},e.createElement(f.J,{to:R,relativeActive:!x},e.createElement(y,{bsStyle:"link"},e.createElement(c.ZP,null,U)))):null))},ZspbpBGx:(S,g,s)=>{s.d(g,{Z:()=>M});var e=s("Z7aTuO5B"),o=s("SfPIQIJE"),m=s("d4kzUuQm"),f=s("uZqmR+ju");const i=[{title:"Manage pipelines",path:m.ZP.SYSTEM.PIPELINES.OVERVIEW,exactPathMatch:!0},{title:"Manage rules",path:m.ZP.SYSTEM.PIPELINES.RULES},{title:"Simulator",path:m.ZP.SYSTEM.PIPELINES.SIMULATOR}],M=()=>e.createElement(f.Row,null,e.createElement(o.Z,{items:i}))},UkvfjvOJ:(S,g,s)=>{s.r(g),s.d(g,{default:()=>Te});var e=s("Z7aTuO5B"),o=s("uZqmR+ju"),m=s("/GOzvPf6"),f=s("ii0bleBb"),i=s.n(f),c=s("4E3oowBb"),M=s("ty2gyrHp"),y=s("IoWmmmFK"),$=s("d4kzUuQm"),L=s("JnTtTRmZ"),d=s.n(L),R=s("MdYBRjRJ"),U=s("U1Iufsob"),I=s("eFxcQyPT"),x=s("mr1MxJ4D"),ne=s("QdZ7Yq43"),w=s("IA3Ku5lS");const N=(0,w.ei)("core.Simulator",()=>d().createActions({simulate:{asyncResult:!0}})),Ce=(0,w.dS)("core.Simulator",()=>d().createStore({listenables:[N],simulate(n,a,t){const l=R.DC(U.Z.SimulatorController.simulate().url),r={stream_id:n.id,message:a,input_id:t};let u=(0,I.ZP)("POST",l,r);u=u.then(p=>{const P=ne.Z.clone(p);return P.messages=p.messages.map(V=>x.Z.formatMessageSummary(V)),P}),N.simulate.promise(u)}}));var z=s("wzrLaWZc"),J=s("zkmy/ViL"),A=s("J6y4/h8P"),le=s("D4SbLiE/"),X=s.n(le);const oe=A.default.div`
  padding-top: 15px;

  dl {
    margin-bottom: 10px;
    margin-top: 5px;
  }

  dd {
    padding: 1px 9px 3px;
  }

  dt {
    margin-top: 1px;
    padding: 3px 9px 1px;

    &::after {
      content: ': ';
    }

    &:first-child {
      border-radius: 4px 4px 0 0;
    }

    ~ dd:last-child {
      border-radius: 0 0 4px 4px;
    }
  }
`,re=A.default.div`
  margin-top: 10px;
`,Z=A.default.div(({resultType:n,theme:a})=>{const{success:t,danger:l,info:r}=a.colors.variant.light,u={added:t,removed:l,mutated:r};return`
    dt,
    dd {
      background-color: ${u[n]};
      color: ${a.utils.contrastingColor(u[n])};
    }
  `}),ie=A.default.dd(({removed:n,theme:a})=>(0,A.css)`
  font-family: ${a.fonts.family.monospace};

  ${n&&(0,A.css)`
    text-decoration: line-through;
    font-style: italic;
  `}
`),me=X()({displayName:"SimulationChanges",propTypes:{originalMessage:i().object.isRequired,simulationResults:i().object.isRequired},_isOriginalMessageRemoved(n,a){return!a.find(t=>t.id===n.id)},_formatFieldTitle(n){return e.createElement("dt",{key:`${n}-key`},n)},_formatFieldValue(n,a,t=!1){return e.createElement(ie,{key:`${n}-value`,removed:t},String(a))},_formatAddedFields(n){const a=Object.keys(n);if(a.length===0)return null;const t=[];return a.sort().forEach(l=>{t.push(this._formatFieldTitle(l)),t.push(this._formatFieldValue(l,n[l]))}),e.createElement(Z,{resultType:"added"},e.createElement("h4",null,"Added fields"),e.createElement("dl",null,t))},_formatRemovedFields(n){const a=Object.keys(n);if(a.length===0)return null;const t=[];return a.sort().forEach(l=>{t.push(this._formatFieldTitle(l)),t.push(this._formatFieldValue(l,n[l]))}),e.createElement(Z,{resultType:"removed"},e.createElement("h4",null,"Removed fields"),e.createElement("dl",null,t))},_formatMutatedFields(n){const a=Object.keys(n);if(a.length===0)return null;const t=[];return a.sort().forEach(l=>{t.push(this._formatFieldTitle(l)),t.push(this._formatFieldValue(`${l}-original`,n[l].before,!0)),t.push(this._formatFieldValue(l,n[l].after))}),e.createElement(Z,{resultType:"mutated"},e.createElement("h4",null,"Mutated fields"),e.createElement("dl",null,t))},_getOriginalMessageChanges(){const{originalMessage:n,simulationResults:a}=this.props,t=a.messages;if(this._isOriginalMessageRemoved(n,t))return e.createElement("p",null,"Original message would be dropped during processing.");const l=t.find(P=>P.id===n.id),r=this._formatAddedFields(l.decoration_stats.added_fields),u=this._formatRemovedFields(l.decoration_stats.removed_fields),p=this._formatMutatedFields(l.decoration_stats.changed_fields);return!r&&!u&&!p?e.createElement("p",null,"Original message would be not be modified during processing."):e.createElement(re,null,r,u,p)},_formatOriginalMessageChanges(){const{originalMessage:n}=this.props;return e.createElement(o.Row,{className:"row-sm"},e.createElement(o.Col,{md:12},e.createElement("h3",null,"Changes in original message"," ",e.createElement("small",null,e.createElement("em",null,n.id))),this._getOriginalMessageChanges()))},_formatOtherChanges(){const{originalMessage:n,simulationResults:a}=this.props,t=a.messages.filter(l=>l.id!==n.id);return t.length===0?null:e.createElement(o.Row,{className:"row-sm"},e.createElement(o.Col,{md:12},e.createElement("h3",null,"Other changes"),e.createElement("p",null,"There would be ",t.length," ",e.createElement(m.qX,{singular:"message",plural:"messages",value:t.length})," created."," ","Switch to the ",e.createElement("em",null,"Results preview")," view option to see"," ",e.createElement(m.qX,{singular:"it",plural:"them",value:t.length}),".")))},render(){return e.createElement(oe,null,this._formatOriginalMessageChanges(),this._formatOtherChanges())}}),G=({simulationResults:n,streams:a})=>{const{messages:t}=n;if(t.length===0)return e.createElement(o.Alert,{bsStyle:"info",title:"Message would be dropped"},e.createElement("p",null,"The pipeline processor would drop such a message. That means that the message",e.createElement("strong",null,"would not be stored"),", and would not be available for searches, alerts, outputs, or dashboards."));const l=t.map(r=>e.createElement(z.Z,{key:r.id,message:r,streams:a}));return e.createElement("div",{className:"message-preview-wrapper"},l)};G.propTypes={simulationResults:i().object.isRequired,streams:i().object.isRequired};const ue=G;var de=s("dFpwyWHg"),Y=s.n(de),ce=s("C2ikvoS0"),H=s.n(ce),ge=s("1IntWRSu"),Q=s.n(ge),Ee=s("8nGWeFnd"),k=s.n(Ee),pe=s("TeAcaicX"),q=s.n(pe),fe=s("eE3+5goe"),ee=s.n(fe),T=s("OCCnKtt5"),O={};T.Z&&T.Z.locals&&(O.locals=T.Z.locals);var W=0,F,h={};h.styleTagTransform=ee(),h.setAttributes=k(),h.insert=Q().bind(null,"head"),h.domAPI=H(),h.insertStyleElement=q(),O.use=function(n){return h.options=n||{},W++||(F=Y()(T.Z,h)),O},O.unuse=function(){W>0&&!--W&&(F(),F=null)};const te=O,he=X()({displayName:"SimulationTrace",propTypes:{simulationResults:i().object.isRequired},componentDidMount(){te.use()},componentWillUnmount(){te.unuse()},render(){const{simulationResults:n}=this.props,a=n.simulation_trace,t=[];return a.forEach((l,r)=>{t.push(e.createElement("dt",{key:`${l.time}-${r}-title`},J.Z.formatNumber(l.time)," \u03BCs")),t.push(e.createElement("dd",{key:`${l}-${r}-description`},e.createElement("span",null,l.message)))}),e.createElement("dl",{className:"dl-horizontal dl-simulation-trace"},t)}});var C=s("OnngdBD8"),_={};C.Z&&C.Z.locals&&(_.locals=C.Z.locals);var b=0,j,v={};v.styleTagTransform=ee(),v.setAttributes=k(),v.insert=Q().bind(null,"head"),v.domAPI=H(),v.insertStyleElement=q(),_.use=function(n){return v.options=n||{},b++||(j=Y()(C.Z,v)),_},_.unuse=function(){b>0&&!--b&&(j(),j=null)};const se=_;var ve=Object.defineProperty,Se=(n,a,t)=>a in n?ve(n,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[a]=t,D=(n,a,t)=>(Se(n,typeof a!="symbol"?a+"":a,t),t);const E={SIMULATION_PREVIEW:1,SIMULATION_SUMMARY:2,SIMULATION_TRACE:3};class K extends e.Component{constructor(a){super(a),D(this,"_changeViewOptions",t=>{const l=Object.keys(E).find(r=>E[r]===t);this.setState({viewOption:E[l]})}),D(this,"_getViewOptionsMenuItems",()=>[this._getViewOptionsMenuItem(E.SIMULATION_SUMMARY,"Changes summary"),this._getViewOptionsMenuItem(E.SIMULATION_PREVIEW,"Results preview"),this._getViewOptionsMenuItem(E.SIMULATION_TRACE,"Simulation trace")]),D(this,"_getViewOptionsMenuItem",(t,l)=>{const{viewOption:r}=this.state;return e.createElement(o.MenuItem,{key:t,eventKey:t,active:r===t},l)}),D(this,"_getViewComponent",t=>{const{simulationResults:l,isLoading:r,originalMessage:u}=this.props;if(r||!l)return e.createElement(m.$j,null);const{viewOption:p}=this.state;switch(p){case E.SIMULATION_PREVIEW:return e.createElement(ue,{simulationResults:l,streams:t});case E.SIMULATION_SUMMARY:return e.createElement(me,{originalMessage:u,simulationResults:l});case E.SIMULATION_TRACE:return e.createElement(he,{simulationResults:l});default:}return null}),this.state={viewOption:E.SIMULATION_SUMMARY}}componentDidMount(){se.use()}componentWillUnmount(){se.unuse()}render(){const{stream:a,simulationResults:t,isLoading:l,error:r,originalMessage:u}=this.props;if(!u&&!t)return null;const p={[a.id]:a},P=l?e.createElement(m.$j,null):u?e.createElement(z.Z,{message:u,streams:p}):null,V=r?e.createElement(o.Alert,{bsStyle:"danger",title:"Error simulating message processing"},e.createElement("p",null,"Could not simulate processing of message ",e.createElement("em",null,u.id)," in stream"," ",e.createElement("em",null,a.title),".",e.createElement("br",null),"Please try loading the message again, or use another message for the simulation.")):null;return e.createElement(o.Row,null,e.createElement(o.Col,{md:12},e.createElement("hr",null)),e.createElement(o.Col,{md:6},e.createElement("h1",null,"Original message"),e.createElement("p",null,"This is the original message loaded from Graylog."),e.createElement("div",{className:"message-preview-wrapper"},P)),e.createElement(o.Col,{md:6},e.createElement("div",{className:"pull-right"},e.createElement(o.DropdownButton,{id:"simulation-view-options",title:"More results",onSelect:this._changeViewOptions,bsStyle:"default",bsSize:"small",pullRight:!0},this._getViewOptionsMenuItems())),e.createElement("h1",null,"Simulation results"),e.createElement("p",null,l?"Simulating message processing, please wait a moment.":`These are the results of processing the loaded message. Processing took ${J.Z.formatNumber(t==null?void 0:t.took_microseconds)} \xB5s.`),V,this._getViewComponent(p)))}}K.propTypes={stream:i().object.isRequired,originalMessage:i().object,simulationResults:i().object,isLoading:i().bool,error:i().object},K.defaultProps={originalMessage:void 0,simulationResults:void 0,isLoading:!1,error:void 0};const Ae=K;var Pe=Object.defineProperty,Me=(n,a,t)=>a in n?Pe(n,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[a]=t,B=(n,a,t)=>(Me(n,typeof a!="symbol"?a+"":a,t),t);const Re="000000000000000000000001";class ae extends e.Component{constructor(a){super(a),B(this,"_onMessageLoad",(t,l)=>{this.setState({message:t,simulation:void 0,loading:!0,error:void 0}),N.simulate.triggerPromise(this.state.stream,t.fields,l.inputId).then(r=>{this.setState({simulation:r,loading:!1})},r=>{this.setState({loading:!1,error:r})})}),B(this,"_getFormattedStreams",t=>t?t.map(l=>({value:l.id,label:l.title})).sort((l,r)=>(0,c.S)(l.label,r.label)):[]),B(this,"_onStreamSelect",t=>{const l=this.props.streams.find(r=>r.id.toLowerCase()===t.toLowerCase());this.setState({stream:l})}),this.defaultStream=a.streams.find(t=>t.id===Re)||a.streams[0],this.state={message:void 0,stream:this.defaultStream,simulation:void 0,loading:!1,error:void 0}}render(){if(this.props.streams.length===0)return e.createElement("div",null,e.createElement(o.Row,{className:"row-sm"},e.createElement(o.Col,{md:8,mdOffset:2},e.createElement(o.Panel,{bsStyle:"danger",header:"No streams found"},"Pipelines operate on streams, but your system currently has no streams. Please"," ",e.createElement(M.r,{to:$.ZP.STREAMS},"create a stream")," ","and come back here later to test pipelines processing messages in your new stream."))));const a=e.createElement("span",null,"Select a stream to use during simulation, the ",e.createElement("em",null,this.defaultStream.title)," stream is used by default.");return e.createElement("div",null,e.createElement(o.Row,null,e.createElement(o.Col,{md:12},e.createElement("h1",null,"Load a message"),e.createElement("p",null,"Build an example message that will be used in the simulation."," ",e.createElement("strong",null,"No real messages stored in Graylog will be changed. All actions are purely simulated on the temporary input you provide below.")),e.createElement(o.Row,{className:"row-sm"},e.createElement(o.Col,{md:7},e.createElement(o.FormGroup,{id:"streamSelectorSimulation"},e.createElement(o.ControlLabel,null,"Stream"),e.createElement(m.Ph,{options:this._getFormattedStreams(this.props.streams),onChange:this._onStreamSelect,value:this.state.stream.id,required:!0,clearable:!1}),e.createElement(o.HelpBlock,null,a)))),e.createElement(y.Z,{onMessageLoaded:this._onMessageLoad,inputIdSelector:!0}))),e.createElement(Ae,{stream:this.state.stream,originalMessage:this.state.message,simulationResults:this.state.simulation,isLoading:this.state.loading,error:this.state.error}))}}B(ae,"propTypes",{streams:i().array.isRequired});const Oe=ae;var _e=s("E+CaPsQD"),ye=s("pUKP3+Pg"),Ie=s("ZspbpBGx");const Te=()=>{const[n,a]=(0,e.useState)();(0,e.useEffect)(()=>{ye.ZP.listStreams().then(l=>{const r=l.filter(u=>u.is_editable);a(r)})},[]);const t=n?e.createElement(Oe,{streams:n}):e.createElement(m.$j,null);return e.createElement(m.$4,{title:"Simulate processing"},e.createElement(Ie.Z,null),e.createElement(m.mr,{title:"Simulate processing",documentationLink:{title:"Pipelines documentation",path:_e.Z.PAGES.PIPELINE_RULES}},e.createElement("span",null,"Processing messages can be complex. Use this page to simulate the result of processing an incoming message using your current set of pipelines and rules.")),e.createElement(o.Row,{className:"content"},e.createElement(o.Col,{md:12},t)))}}}]);})();

//# sourceMappingURL=1255d548-5208.fa6065c6e394611402c8.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy