web-interface.assets.bb8c8232-2523.e603772f6adf3bb9c29d.js Maven / Gradle / Ivy
"use strict";(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["bb8c8232-2523"],{"1QJjgPIC":(yt,I,r)=>{r.d(I,{A:()=>ht});var s=r("Z7aTuO5B"),w=r("ii0bleBb"),a=r.n(w),F=r("D4SbLiE/"),H=r.n(F),u=r("rIl5IEuP"),h=r("jAGDuYSC"),B=r("yGRmSjYM"),G=r("dsvqAVKU"),b=r("pUKP3+Pg"),_=r("JnTtTRmZ"),$=r.n(_),d=r("eFxcQyPT"),c=r("U1Iufsob"),l=r("MdYBRjRJ"),M=r("IA3Ku5lS");const p=(0,M.Bv)("core.Outputs",()=>$().createStore({OUTPUTS_URL:l.H3(c.A.OutputsApiController.index().url),load(e){(0,d.Ay)("GET",this.OUTPUTS_URL).then(e,this._failCallback)},loadForStreamId(e,t){const o=l.H3(c.A.StreamOutputsApiController.index(e).url);(0,d.Ay)("GET",o).then(t,this._failCallback)},loadAvailableTypes(e){const t=l.H3(c.A.OutputsApiController.availableTypes().url);(0,d.Ay)("GET",t).then(e,this._failCallback)},loadAvailable(e,t){const o=l.H3(c.A.OutputsApiController.availableTypes().url);(0,d.Ay)("GET",o).then(n=>n.types[e],this._failCallback).then(t)},remove(e,t){const o=l.H3(c.A.OutputsApiController.delete(e).url);(0,d.Ay)("DELETE",o).then(t,n=>{h.A.error(`Terminating output failed with status: ${n}`,"Could not terminate output")})},save(e,t){const o=i=>{h.A.error(`Saving Output "${e.title}" failed with status: ${i}`,"Could not save Output")},n=l.H3(c.A.OutputsApiController.create().url);(0,d.Ay)("POST",n,e).then(t,o)},update(e,t,o){const n=g=>{h.A.error(`Updating Output "${e.title}" failed with status: ${g}`,"Could not update Output")},i=l.H3(c.A.OutputsApiController.update(e.id).url);(0,d.Ay)("PUT",i,t).then(o,n)},_failCallback(e){h.A.error(`Loading outputs failed with status: ${e}`,"Could not load outputs")}}));var j=r("BqxuktKK"),y=r("v4GbOr/o"),V=r("HCsT5Gmk"),z=r("4E3oowBb"),m=r("IOI9nV80"),T=r("J6y4/h8P"),A=r("+qc3iAHh"),K=Object.defineProperty,W=(e,t,o)=>t in e?K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,v=(e,t,o)=>(W(e,typeof t!="symbol"?t+"":t,o),o);class C extends s.Component{constructor(t){super(t),v(this,"handleClick",()=>{const{getTypeDefinition:o,output:n}=this.props;o(n.type,i=>{this.setState({typeDefinition:i.requested_configuration}),this.configurationForm.current&&this.configurationForm.current.open()})}),v(this,"_handleSubmit",o=>{const{onUpdate:n,output:i}=this.props;n(i,o)}),this.configurationForm=s.createRef(),this.state={typeDefinition:void 0},this.handleClick=this.handleClick.bind(null,t.output)}render(){const{typeDefinition:t}=this.state,{disabled:o,output:n}=this.props;let i;return t&&(i=s.createElement(A.lD,{ref:this.configurationForm,key:`configuration-form-output-${n.id}`,configFields:t,title:`Editing Output ${n.title}`,typeName:n.type,titleHelpText:"Select a name of your new output that describes it.",submitAction:this._handleSubmit,submitButtonText:"Update output",values:n.configuration,titleValue:n.title})),s.createElement("span",null,s.createElement(u.Button,{disabled:o,onClick:this.handleClick},"Edit"),i)}}v(C,"propTypes",{output:a().object.isRequired,disabled:a().bool,getTypeDefinition:a().func.isRequired,onUpdate:a().func}),v(C,"defaultProps",{disabled:!1,onUpdate:()=>{}});const q=C;var J=r("CrIFpfDF"),Y=Object.defineProperty,Q=(e,t,o)=>t in e?Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,O=(e,t,o)=>(Q(e,typeof t!="symbol"?t+"":t,o),o);const Z=T.default.div(({theme:e})=>(0,T.css)`
border-bottom: 1px solid ${e.colors.gray[80]};
padding-bottom: 8px;
margin-bottom: 8px;
margin-top: 0;
.hostname {
font-size: ${e.fonts.size.small};
}
.well {
margin-bottom: 0;
margin-top: 3px;
font-family: ${e.fonts.family.monospace};
font-size: ${e.fonts.size.small};
}
.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;
}
`),X=(0,T.default)(J.A)`
position: relative;
top: 2px;
form {
display: inline;
}
.text {
position: relative;
top: 3px;
}
`;class D extends s.Component{constructor(t){super(t),O(this,"_onDeleteFromStream",()=>{const{removeOutputFromStream:o,output:n,streamId:i}=this.props;o(n.id,i)}),O(this,"_onDeleteGlobally",()=>{const{removeOutputGlobally:o,output:n}=this.props;o(n.id)}),O(this,"_typeNotAvailable",()=>{const{types:o,output:n}=this.props;return o[n.type]===void 0}),this.state={typeDefinition:void 0}}componentDidMount(){const{getTypeDefinition:t,output:o}=this.props;this._typeNotAvailable()||t(o.type,n=>{this.setState({typeDefinition:n})})}render(){const{typeDefinition:t}=this.state,{onUpdate:o,getTypeDefinition:n}=this.props;if(!this._typeNotAvailable()&&!t)return s.createElement(m.y$,null);const{output:i}=this.props,g=i.content_pack?s.createElement("span",{title:"Created from content pack"},s.createElement(m.In,{name:"redeem"})):null;let x,N;this._typeNotAvailable()?x=s.createElement(u.Alert,{bsStyle:"danger"},"The plugin required for this output is not loaded. Editing it is not possible. Please load the plugin or delete the output."):N=s.createElement(A.Xz,{key:`configuration-well-output-${i.id}`,id:i.id,configuration:i.configuration,typeDefinition:t});const{streamId:ft}=this.props;let R;return ft?R=s.createElement(m.Wj,{permissions:"stream_outputs:delete"},s.createElement(u.Button,{bsStyle:"info",onClick:this._onDeleteFromStream},"Delete from stream")):R="",s.createElement(Z,{key:i.id,className:"row content"},s.createElement(u.Col,{md:12},s.createElement(u.Row,{className:"row-sm"},s.createElement(u.Col,{md:6},s.createElement("h2",{className:"extractor-title"},i.title," ",g,s.createElement("small",null,"ID: ",i.id)),"Type: ",i.type),s.createElement(u.Col,{md:6},s.createElement(X,{className:"text-right pull-right"},s.createElement(m.Wj,{permissions:"outputs:edit"},s.createElement(q,{disabled:this._typeNotAvailable(),output:i,onUpdate:o,getTypeDefinition:n})),R,s.createElement(m.Wj,{permissions:"outputs:terminate"},s.createElement(u.Button,{bsStyle:"danger",onClick:this._onDeleteGlobally},"Delete globally"))))),s.createElement(u.Row,null,s.createElement(u.Col,{md:8},x,N))))}}O(D,"propTypes",{streamId:a().string,output:a().object.isRequired,types:a().object.isRequired,getTypeDefinition:a().func.isRequired,onUpdate:a().func,removeOutputFromStream:a().func.isRequired,removeOutputGlobally:a().func.isRequired}),O(D,"defaultProps",{streamId:"",onUpdate:()=>{}});const k=D;var tt=Object.defineProperty,et=(e,t,o)=>t in e?tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,U=(e,t,o)=>(et(e,typeof t!="symbol"?t+"":t,o),o);const ot=(e,t)=>(0,z.j)(e.title.toLowerCase(),t.title.toLowerCase());class S extends s.Component{constructor(){super(...arguments),U(this,"_formatOutput",t=>s.createElement(k,{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(m.y$,null);if(this.props.outputs.length===0)return s.createElement(u.Row,{className:"content"},s.createElement(u.Col,{md:12},s.createElement(m.WE,null,"No outputs configured.")));const t=this.props.outputs.sort(ot).map(this._formatOutput);return s.createElement("div",null,t)}}U(S,"propTypes",{streamId:a().string,outputs:a().array,onRemove:a().func.isRequired,onTerminate:a().func.isRequired,onUpdate:a().func.isRequired,getTypeDefinition:a().func.isRequired,types:a().object.isRequired}),S.defaultProps={streamId:"",outputs:[]};const st=S;var nt=r("kqAR+wt5"),it=r.n(nt),rt=Object.defineProperty,at=(e,t,o)=>t in e?rt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,E=(e,t,o)=>(at(e,typeof t!="symbol"?t+"":t,o),o);const ut=(e,t)=>s.createElement("option",{key:t,value:t},e.name);class P extends s.Component{constructor(t){super(t),E(this,"PLACEHOLDER","placeholder"),E(this,"_openModal",()=>{this.state.typeName!==this.PLACEHOLDER&&this.state.typeName!==""&&this.configurationForm.current&&this.configurationForm.current.open()}),E(this,"_onTypeChange",o=>{const n=o.target.value;this.setState({typeName:o.target.value}),this.props.getTypeDefinition(n,i=>{this.setState({typeDefinition:i.requested_configuration})})}),this.configurationForm=s.createRef(),this.state={typeDefinition:[],typeName:this.PLACEHOLDER}}render(){const t=it().map(this.props.types,ut);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),"\xA0",s.createElement(u.Button,{bsStyle:"success",disabled:this.state.typeName===this.PLACEHOLDER,onClick:this._openModal},"Launch new output")),s.createElement(A.lD,{ref:this.configurationForm,key:"configuration-form-output",configFields:this.state.typeDefinition,title:"Create new Output",titleHelpText:"Select a name of your new output that describes it.",typeName:this.state.typeName,submitButtonText:"Create output",submitAction:this.props.onSubmit}))}}E(P,"propTypes",{getTypeDefinition:a().func.isRequired,types:a().array.isRequired,onSubmit:a().func.isRequired});const lt=P;var pt=Object.defineProperty,dt=(e,t,o)=>t in e?pt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,f=(e,t,o)=>(dt(e,typeof t!="symbol"?t+"":t,o),o);class L extends s.Component{constructor(){super(...arguments),f(this,"PLACEHOLDER","placeholder"),f(this,"state",{selectedOutput:this.PLACEHOLDER}),f(this,"_formatOutput",t=>s.createElement("option",{key:t.id,value:t.id},t.title)),f(this,"_handleUpdate",t=>{this.setState({selectedOutput:t.target.value})}),f(this,"_handleClick",()=>{const{onSubmit:t}=this.props,{selectedOutput:o}=this.state;t(o),this.setState({selectedOutput:this.PLACEHOLDER})})}render(){const{outputs:t}=this.props,{selectedOutput:o}=this.state,n=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:o,name:"outputId",className:"form-control",onChange:this._handleUpdate},s.createElement("option",{value:this.PLACEHOLDER,disabled:!0},"Select existing output"),n),"\xA0",s.createElement(u.Button,{id:"add-existing-output",bsStyle:"success",type:"button",disabled:o===this.PLACEHOLDER,onClick:this._handleClick},"Assign existing Output")))}}f(L,"propTypes",{outputs:a().array.isRequired,onSubmit:a().func.isRequired});const ct=L,mt=H()({displayName:"OutputsComponent",propTypes:{streamId:a().string.isRequired,permissions:a().array.isRequired,sendTelemetry:a().func.isRequired,location:a().object.isRequired},mixins:[B.Ay],getInitialState(){return{}},componentDidMount(){this.loadData()},loadData(){const e=t=>{this.setState({outputs:t.outputs}),this.props.streamId&&this._fetchAssignableOutputs(t.outputs)};this.props.streamId?p.loadForStreamId(this.props.streamId,e):p.load(e),p.loadAvailableTypes(t=>{this.setState({types:t.types})})},_handleUpdate(){this.loadData()},_handleCreateOutput(e){this.props.sendTelemetry(y.g.OUTPUTS.OUTPUT_CREATED,{app_pathname:(0,l.i)(this.props.location.pathname),app_action_value:"create-output"}),p.save(e,t=>(this.props.streamId?b.Ay.addOutput(this.props.streamId,t.id,o=>(this._handleUpdate(),o)):this._handleUpdate(),t))},_fetchAssignableOutputs(e){p.load(t=>{const o=e.map(i=>i.id),n=t.outputs.filter(i=>o.indexOf(i.id)===-1).sort((i,g)=>i.title.localeCompare(g.title));this.setState({assignableOutputs:n})})},_handleAssignOutput(e){this.props.sendTelemetry(y.g.OUTPUTS.OUTPUT_ASSIGNED,{app_pathname:(0,l.i)(this.props.location.pathname),app_action_value:"assign-output"}),b.Ay.addOutput(this.props.streamId,e,t=>(this._handleUpdate(),t))},_removeOutputGlobally(e){this.props.sendTelemetry(y.g.OUTPUTS.OUTPUT_GLOBALLY_REMOVED,{app_pathname:(0,l.i)(this.props.location.pathname),app_action_value:"globally-remove-output"}),window.confirm("Do you really want to terminate this output?")&&p.remove(e,t=>(h.A.success("Output was terminated.","Success"),this._handleUpdate(),t))},_removeOutputFromStream(e,t){this.props.sendTelemetry(y.g.OUTPUTS.OUTPUT_FROM_STREAM_REMOVED,{app_pathname:(0,l.i)(this.props.location.pathname),app_action_value:"remove-output-from-stream"}),window.confirm("Do you really want to remove this output from the stream?")&&b.Ay.removeOutput(t,e,o=>(h.A.success("Output was removed from stream.","Success"),this._handleUpdate(),o))},_handleOutputUpdate(e,t){this.props.sendTelemetry(y.g.OUTPUTS.OUTPUT_UPDATED,{app_pathname:(0,l.i)(this.props.location.pathname),app_action_value:"output-update"}),p.update(e,t,()=>{this._handleUpdate()})},render(){if(this.state.outputs&&this.state.types&&(!this.props.streamId||this.state.assignableOutputs)){const{permissions:e}=this.props,{streamId:t}=this.props,o=this.isPermitted(e,["outputs:create"])?s.createElement(lt,{types:this.state.types,onSubmit:this._handleCreateOutput,getTypeDefinition:p.loadAvailable,streamId:t}):null,n=t?s.createElement(ct,{streamId:t,outputs:this.state.assignableOutputs,onSubmit:this._handleAssignOutput}):null;return s.createElement("div",{className:"outputs"},s.createElement(u.Row,{className:"content"},s.createElement(u.Col,{md:4},o),s.createElement(u.Col,{md:8},n)),s.createElement(st,{streamId:t,outputs:this.state.outputs,permissions:e,getTypeDefinition:p.loadAvailable,types:this.state.types,onRemove:this._removeOutputFromStream,onTerminate:this._removeOutputGlobally,onUpdate:this._handleOutputUpdate}))}return s.createElement(G.A,null)}}),ht=(0,V.A)((0,j.A)(mt))}}]);})();
//# sourceMappingURL=bb8c8232-2523.e603772f6adf3bb9c29d.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy