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

web-interface.assets.325e2d4b-7160.78b62be7ae35ed616410.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-7160"],{RNpIj37G:(t,e,i)=>{i.d(e,{Z:()=>H});var s=i("Z7aTuO5B"),o=i("D4SbLiE/"),n=i.n(o),a=i("F9olzlTR"),r=i("4af3+9mh"),l=i("EUJYvlA3"),u=i("8pZttqbT"),p=i("xxwliabF"),d=i("JnTtTRmZ"),c=i.n(d),m=i("OqsMdpSm"),h=i("rkoyttmq"),f=i("0wQfx7YJ");const y=(0,i("xc00RsLr").dS)("core.Outputs",(()=>c().createStore({OUTPUTS_URL:f.DC(h.Z.OutputsApiController.index().url),load(t){(0,m.ZP)("GET",this.OUTPUTS_URL).then(t,this._failCallback)},loadForStreamId(t,e){const i=f.DC(h.Z.StreamOutputsApiController.index(t).url);(0,m.ZP)("GET",i).then(e,this._failCallback)},loadAvailableTypes(t){const e=f.DC(h.Z.OutputsApiController.availableTypes().url);(0,m.ZP)("GET",e).then(t,this._failCallback)},loadAvailable(t,e){const i=f.DC(h.Z.OutputsApiController.availableTypes().url);(0,m.ZP)("GET",i).then((e=>e.types[t]),this._failCallback).then(e)},remove(t,e){const i=f.DC(h.Z.OutputsApiController.delete(t).url);(0,m.ZP)("DELETE",i).then(e,(t=>{r.Z.error(`Terminating output failed with status: ${t}`,"Could not terminate output")}))},save(t,e){const i=f.DC(h.Z.OutputsApiController.create().url);(0,m.ZP)("POST",i,t).then(e,(e=>{r.Z.error(`Saving Output "${t.title}" failed with status: ${e}`,"Could not save Output")}))},update(t,e,i){const s=f.DC(h.Z.OutputsApiController.update(t.id).url);(0,m.ZP)("PUT",s,e).then(i,(e=>{r.Z.error(`Updating Output "${t.title}" failed with status: ${e}`,"Could not update Output")}))},_failCallback(t){r.Z.error(`Loading outputs failed with status: ${t}`,"Could not load outputs")}})));var b=i("ii0bleBb"),E=i.n(b),g=i("6n4dw8v3"),O=i("0zTRKSqx"),v=i("J6y4/h8P"),C=i("Vpcj0rDf");function _(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class D extends s.Component{constructor(t){super(t),_(this,"handleClick",(()=>{const{getTypeDefinition:t,output:e}=this.props;t(e.type,(t=>{this.setState({typeDefinition:t.requested_configuration}),this.configurationForm.open()}))})),_(this,"_handleSubmit",(t=>{const{onUpdate:e,output:i}=this.props;e(i,t)})),this.state={typeDefinition:void 0},this.handleClick=this.handleClick.bind(null,t.output)}render(){const{typeDefinition:t}=this.state,{disabled:e,output:i}=this.props;let o;return t&&(o=s.createElement(C.fI,{ref:t=>{this.configurationForm=t},key:`configuration-form-output-${i.id}`,configFields:t,title:`Editing Output ${i.title}`,typeName:i.type,helpBlock:"Select a name of your new output that describes it.",submitAction:this._handleSubmit,submitButtonText:"Update output",values:i.configuration,titleValue:i.title})),s.createElement("span",null,s.createElement(a.zx,{disabled:e,onClick:this.handleClick},"Edit"),o)}}_(D,"propTypes",{output:E().object.isRequired,disabled:E().bool,getTypeDefinition:E().func.isRequired,onUpdate:E().func}),_(D,"defaultProps",{disabled:!1,onUpdate:()=>{}});const T=D;var S=i("0zEavvpT");function w(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}const x=v.default.div.withConfig({displayName:"Output__NodeRow",componentId:"sc-nvqwbr-0"})((t=>{let{theme:e}=t;return(0,v.css)(["border-bottom:1px solid ",";padding-bottom:8px;margin-bottom:8px;margin-top:0;.hostname{font-size:",";}.well{margin-bottom:0;margin-top:3px;font-family:",";font-size:",";}.xtrc-converters{margin-top:10px;}.xtrc-config li{margin-left:10px;}.xtrc-converters li{margin-left:10px;}.xtrc-converter-config li{margin-left:20px;}.dropdown-menu a.selected{font-weight:bold;}"],e.colors.gray[80],e.fonts.size.small,e.fonts.family.monospace,e.fonts.size.small)})),R=(0,v.default)(S.Z).withConfig({displayName:"Output__NodeRowInfo",componentId:"sc-nvqwbr-1"})(["position:relative;top:2px;form{display:inline;}.text{position:relative;top:3px;}"]);class A extends s.Component{constructor(t){super(t),w(this,"_onDeleteFromStream",(()=>{const{removeOutputFromStream:t,output:e,streamId:i}=this.props;t(e.id,i)})),w(this,"_onDeleteGlobally",(()=>{const{removeOutputGlobally:t,output:e}=this.props;t(e.id)})),w(this,"_typeNotAvailable",(()=>{const{types:t,output:e}=this.props;return void 0===t[e.type]})),this.state={typeDefinition:void 0}}componentDidMount(){const{getTypeDefinition:t,output:e}=this.props;this._typeNotAvailable()||t(e.type,(t=>{this.setState({typeDefinition:t})}))}render(){const{typeDefinition:t}=this.state,{onUpdate:e,getTypeDefinition:i}=this.props;if(!this._typeNotAvailable()&&!t)return s.createElement(O.$j,null);const{output:o}=this.props,n=o.content_pack?s.createElement("span",{title:"Created from content pack"},s.createElement(O.JO,{name:"gift"})):null;let r,l;this._typeNotAvailable()?r=s.createElement(a.bZ,{bsStyle:"danger"},"The plugin required for this output is not loaded. Editing it is not possible. Please load the plugin or delete the output."):l=s.createElement(C.$O,{key:`configuration-well-output-${o.id}`,id:o.id,configuration:o.configuration,typeDefinition:t});const{streamId:u}=this.props;let p;return p=u?s.createElement(O.AE,{permissions:"stream_outputs:delete"},s.createElement(a.zx,{bsStyle:"info",onClick:this._onDeleteFromStream},"Delete from stream")):"",s.createElement(x,{key:o.id,className:"row content"},s.createElement(a.JX,{md:12},s.createElement(a.X2,{className:"row-sm"},s.createElement(a.JX,{md:6},s.createElement("h2",{className:"extractor-title"},o.title," ",n,s.createElement("small",null,"ID: ",o.id)),"Type: ",o.type),s.createElement(a.JX,{md:6},s.createElement(R,{className:"text-right pull-right"},s.createElement(O.AE,{permissions:"outputs:edit"},s.createElement(T,{disabled:this._typeNotAvailable(),output:o,onUpdate:e,getTypeDefinition:i})),p,s.createElement(O.AE,{permissions:"outputs:terminate"},s.createElement(a.zx,{bsStyle:"danger",onClick:this._onDeleteGlobally},"Delete globally"))))),s.createElement(a.X2,null,s.createElement(a.JX,{md:8},r,l))))}}w(A,"propTypes",{streamId:E().string,output:E().object.isRequired,types:E().object.isRequired,getTypeDefinition:E().func.isRequired,onUpdate:E().func,removeOutputFromStream:E().func.isRequired,removeOutputGlobally:E().func.isRequired}),w(A,"defaultProps",{streamId:"",onUpdate:()=>{}});const P=A;function N(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class k extends s.Component{constructor(){super(...arguments),N(this,"_sortByTitle",((t,e)=>(0,g.S)(t.title.toLowerCase(),e.title.toLowerCase()))),N(this,"_formatOutput",(t=>s.createElement(P,{key:t.id,output:t,streamId:this.props.streamId,removeOutputFromStream:this.props.onRemove,removeOutputGlobally:this.props.onTerminate,onUpdate:this.props.onUpdate,getTypeDefinition:this.props.getTypeDefinition,types:this.props.types})))}render(){if(!this.props.outputs)return s.createElement(O.$j,null);if(0===this.props.outputs.length)return s.createElement(a.X2,{className:"content"},s.createElement(a.JX,{md:12},s.createElement(a.bZ,{bsStyle:"info"},"No outputs configured.")));const t=this.props.outputs.sort(this._sortByTitle).map(this._formatOutput);return s.createElement("div",null,t)}}N(k,"propTypes",{streamId:E().string,outputs:E().array,onRemove:E().func.isRequired,onTerminate:E().func.isRequired,onUpdate:E().func.isRequired,getTypeDefinition:E().func.isRequired,types:E().object.isRequired});const U=k;var Z=i("kqAR+wt5"),L=i.n(Z);function I(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}const q=(t,e)=>s.createElement("option",{key:e,value:e},t.name);class F extends s.Component{constructor(t){super(t),I(this,"PLACEHOLDER","placeholder"),I(this,"_openModal",(()=>{this.state.typeName!==this.PLACEHOLDER&&""!==this.state.typeName&&this.configurationForm.open()})),I(this,"_onTypeChange",(t=>{const e=t.target.value;this.setState({typeName:t.target.value}),this.props.getTypeDefinition(e,(t=>{this.setState({typeDefinition:t.requested_configuration})}))})),this.state={typeDefinition:[],typeName:this.PLACEHOLDER}}render(){const t=L().map(this.props.types,q);return s.createElement("div",null,s.createElement("div",{className:"form-inline"},s.createElement("select",{id:"input-type",defaultValue:this.PLACEHOLDER,value:this.state.typeName,onChange:this._onTypeChange,className:"form-control"},s.createElement("option",{value:this.PLACEHOLDER,disabled:!0},"Select Output Type"),t)," ",s.createElement(a.zx,{bsStyle:"success",disabled:this.state.typeName===this.PLACEHOLDER,onClick:this._openModal},"Launch new output")),s.createElement(C.fI,{ref:t=>{this.configurationForm=t},key:"configuration-form-output",configFields:this.state.typeDefinition,title:"Create new Output",helpBlock:"Select a name of your new output that describes it.",typeName:this.state.typeName,submitButtonText:"Create output",submitAction:this.props.onSubmit}))}}I(F,"propTypes",{getTypeDefinition:E().func.isRequired,types:E().array.isRequired,onSubmit:E().func.isRequired});const j=F;function z(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class G extends s.Component{constructor(){super(...arguments),z(this,"PLACEHOLDER","placeholder"),z(this,"state",{selectedOutput:this.PLACEHOLDER}),z(this,"_formatOutput",(t=>s.createElement("option",{key:t.id,value:t.id},t.title))),z(this,"_handleUpdate",(t=>{this.setState({selectedOutput:t.target.value})})),z(this,"_handleClick",(()=>{const{onSubmit:t}=this.props,{selectedOutput:e}=this.state;t(e),this.setState({selectedOutput:this.PLACEHOLDER})}))}render(){const{outputs:t}=this.props,{selectedOutput:e}=this.state,i=t.length>0?t.map(this._formatOutput):s.createElement("option",{disabled:!0},"No outputs available");return s.createElement("div",{className:"output-add"},s.createElement("div",{className:"form-inline"},s.createElement("select",{value:e,name:"outputId",className:"form-control",onChange:this._handleUpdate},s.createElement("option",{value:this.PLACEHOLDER,disabled:!0},"Select existing output"),i)," ",s.createElement(a.zx,{id:"add-existing-output",bsStyle:"success",type:"button",disabled:e===this.PLACEHOLDER,onClick:this._handleClick},"Assign existing Output")))}}z(G,"propTypes",{outputs:E().array.isRequired,onSubmit:E().func.isRequired});const J=G,H=n()({displayName:"OutputsComponent",mixins:[l.ZP],componentDidMount(){this.loadData()},loadData(){const t=t=>{this.setState({outputs:t.outputs}),this.props.streamId&&this._fetchAssignableOutputs(t.outputs)};this.props.streamId?y.loadForStreamId(this.props.streamId,t):y.load(t),y.loadAvailableTypes((t=>{this.setState({types:t.types})}))},getInitialState:()=>({}),_handleUpdate(){this.loadData()},_handleCreateOutput(t){y.save(t,(t=>(this.setState({typeName:"placeholder"}),this.props.streamId?p.ZP.addOutput(this.props.streamId,t.id,(t=>(this._handleUpdate(),t))):this._handleUpdate(),t)))},_fetchAssignableOutputs(t){y.load((e=>{const i=t.map((t=>t.id)),s=e.outputs.filter((t=>-1===i.indexOf(t.id))).sort(((t,e)=>t.title.localeCompare(e.title)));this.setState({assignableOutputs:s})}))},_handleAssignOutput(t){p.ZP.addOutput(this.props.streamId,t,(t=>(this._handleUpdate(),t)))},_removeOutputGlobally(t){window.confirm("Do you really want to terminate this output?")&&y.remove(t,(t=>(r.Z.success("Output was terminated.","Success"),this._handleUpdate(),t)))},_removeOutputFromStream(t,e){window.confirm("Do you really want to remove this output from the stream?")&&p.ZP.removeOutput(e,t,(t=>(r.Z.success("Output was removed from stream.","Success"),this._handleUpdate(),t)))},_handleOutputUpdate(t,e){y.update(t,e,(()=>{this._handleUpdate()}))},render(){if(this.state.outputs&&this.state.types&&(!this.props.streamId||this.state.assignableOutputs)){const{permissions:t}=this.props,{streamId:e}=this.props,i=this.isPermitted(t,["outputs:create"])?s.createElement(j,{types:this.state.types,onSubmit:this._handleCreateOutput,getTypeDefinition:y.loadAvailable,streamId:e}):null,o=e?s.createElement(J,{streamId:e,outputs:this.state.assignableOutputs,onSubmit:this._handleAssignOutput}):null;return s.createElement("div",{className:"outputs"},s.createElement(a.X2,{className:"content"},s.createElement(a.JX,{md:4},i),s.createElement(a.JX,{md:8},o)),s.createElement(U,{streamId:e,outputs:this.state.outputs,permissions:t,getTypeDefinition:y.loadAvailable,types:this.state.types,onRemove:this._removeOutputFromStream,onTerminate:this._removeOutputGlobally,onUpdate:this._handleOutputUpdate}))}return s.createElement(u.Z,null)}})}}]);
//# sourceMappingURL=325e2d4b-7160.78b62be7ae35ed616410.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy