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

web-interface.assets.07ba022f-5690.2ec13237f5d86537d85e.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([["07ba022f-5690"],{"1QJjgPIC":(yt,w,r)=>{r.d(w,{Z:()=>ht});var s=r("Z7aTuO5B"),Z=r("ii0bleBb"),a=r.n(Z),F=r("D4SbLiE/"),I=r.n(F),u=r("uZqmR+ju"),h=r("jAGDuYSC"),B=r("0TVxnHwi"),G=r("dsvqAVKU"),C=r("pUKP3+Pg"),H=r("JnTtTRmZ"),$=r.n(H),d=r("eFxcQyPT"),c=r("U1Iufsob"),l=r("MdYBRjRJ"),_=r("IA3Ku5lS");const p=(0,_.dS)("core.Outputs",()=>$().createStore({OUTPUTS_URL:l.DC(c.Z.OutputsApiController.index().url),load(e){(0,d.ZP)("GET",this.OUTPUTS_URL).then(e,this._failCallback)},loadForStreamId(e,t){const o=l.DC(c.Z.StreamOutputsApiController.index(e).url);(0,d.ZP)("GET",o).then(t,this._failCallback)},loadAvailableTypes(e){const t=l.DC(c.Z.OutputsApiController.availableTypes().url);(0,d.ZP)("GET",t).then(e,this._failCallback)},loadAvailable(e,t){const o=l.DC(c.Z.OutputsApiController.availableTypes().url);(0,d.ZP)("GET",o).then(n=>n.types[e],this._failCallback).then(t)},remove(e,t){const o=l.DC(c.Z.OutputsApiController.delete(e).url);(0,d.ZP)("DELETE",o).then(t,n=>{h.Z.error(`Terminating output failed with status: ${n}`,"Could not terminate output")})},save(e,t){const o=i=>{h.Z.error(`Saving Output "${e.title}" failed with status: ${i}`,"Could not save Output")},n=l.DC(c.Z.OutputsApiController.create().url);(0,d.ZP)("POST",n,e).then(t,o)},update(e,t,o){const n=v=>{h.Z.error(`Updating Output "${e.title}" failed with status: ${v}`,"Could not update Output")},i=l.DC(c.Z.OutputsApiController.update(e.id).url);(0,d.ZP)("PUT",i,t).then(o,n)},_failCallback(e){h.Z.error(`Loading outputs failed with status: ${e}`,"Could not load outputs")}}));var M=r("BqxuktKK"),y=r("v4GbOr/o"),j=r("HCsT5Gmk"),V=r("4E3oowBb"),m=r("/GOzvPf6"),b=r("J6y4/h8P"),T=r("+qc3iAHh"),q=Object.defineProperty,z=(e,t,o)=>t in e?q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,g=(e,t,o)=>(z(e,typeof t!="symbol"?t+"":t,o),o);class D extends s.Component{constructor(t){super(t),g(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()})}),g(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(T.fI,{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)}}g(D,"propTypes",{output:a().object.isRequired,disabled:a().bool,getTypeDefinition:a().func.isRequired,onUpdate:a().func}),g(D,"defaultProps",{disabled:!1,onUpdate:()=>{}});const J=D;var K=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 W=b.default.div(({theme:e})=>(0,b.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,b.default)(K.Z)`
  position: relative;
  top: 2px;

  form {
    display: inline;
  }

  .text {
    position: relative;
    top: 3px;
  }
`;class P 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.$j,null);const{output:i}=this.props,v=i.content_pack?s.createElement("span",{title:"Created from content pack"},s.createElement(m.JO,{name:"gift"})):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(T.$O,{key:`configuration-well-output-${i.id}`,id:i.id,configuration:i.configuration,typeDefinition:t});const{streamId:ft}=this.props;let S;return ft?S=s.createElement(m.AE,{permissions:"stream_outputs:delete"},s.createElement(u.Button,{bsStyle:"info",onClick:this._onDeleteFromStream},"Delete from stream")):S="",s.createElement(W,{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," ",v,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.AE,{permissions:"outputs:edit"},s.createElement(J,{disabled:this._typeNotAvailable(),output:i,onUpdate:o,getTypeDefinition:n})),S,s.createElement(m.AE,{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(P,"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(P,"defaultProps",{streamId:"",onUpdate:()=>{}});const k=P;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,R=(e,t,o)=>(et(e,typeof t!="symbol"?t+"":t,o),o);const ot=(e,t)=>(0,V.S)(e.title.toLowerCase(),t.title.toLowerCase());class A extends s.Component{constructor(){super(...arguments),R(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.$j,null);if(this.props.outputs.length===0)return s.createElement(u.Row,{className:"content"},s.createElement(u.Col,{md:12},s.createElement(m.dX,null,"No outputs configured.")));const t=this.props.outputs.sort(ot).map(this._formatOutput);return s.createElement("div",null,t)}}R(A,"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}),A.defaultProps={streamId:"",outputs:[]};const st=A;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 U 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(T.fI,{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(U,"propTypes",{getTypeDefinition:a().func.isRequired,types:a().array.isRequired,onSubmit:a().func.isRequired});const lt=U;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=I()({displayName:"OutputsComponent",propTypes:{streamId:a().string.isRequired,permissions:a().array.isRequired,sendTelemetry:a().func.isRequired,location:a().object.isRequired},mixins:[B.ZP],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.A.OUTPUTS.OUTPUT_CREATED,{app_pathname:(0,l.av)(this.props.location.pathname),app_action_value:"create-output"}),p.save(e,t=>(this.props.streamId?C.ZP.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,v)=>i.title.localeCompare(v.title));this.setState({assignableOutputs:n})})},_handleAssignOutput(e){this.props.sendTelemetry(y.A.OUTPUTS.OUTPUT_ASSIGNED,{app_pathname:(0,l.av)(this.props.location.pathname),app_action_value:"assign-output"}),C.ZP.addOutput(this.props.streamId,e,t=>(this._handleUpdate(),t))},_removeOutputGlobally(e){this.props.sendTelemetry(y.A.OUTPUTS.OUTPUT_GLOBALLY_REMOVED,{app_pathname:(0,l.av)(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.Z.success("Output was terminated.","Success"),this._handleUpdate(),t))},_removeOutputFromStream(e,t){this.props.sendTelemetry(y.A.OUTPUTS.OUTPUT_FROM_STREAM_REMOVED,{app_pathname:(0,l.av)(this.props.location.pathname),app_action_value:"remove-output-from-stream"}),window.confirm("Do you really want to remove this output from the stream?")&&C.ZP.removeOutput(t,e,o=>(h.Z.success("Output was removed from stream.","Success"),this._handleUpdate(),o))},_handleOutputUpdate(e,t){this.props.sendTelemetry(y.A.OUTPUTS.OUTPUT_UPDATED,{app_pathname:(0,l.av)(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.Z,null)}}),ht=(0,j.Z)((0,M.Z)(mt))}}]);})();

//# sourceMappingURL=07ba022f-5690.2ec13237f5d86537d85e.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy