web-interface.assets.bb8c8232-816.05699231e5e95479a8f8.js Maven / Gradle / Ivy
"use strict";(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["bb8c8232-816"],{SfPIQIJE:(I,D,e)=>{e.d(D,{A:()=>f});var m=e("Z7aTuO5B"),h=e("J6y4/h8P"),s=e("rIl5IEuP"),A=e("ty2gyrHp"),y=e("IOI9nV80"),C=e("NV1/EHMi");const _=(0,h.default)(s.ButtonToolbar)`
margin-bottom: 10px;
`,c=(0,h.default)(s.Button)(({theme:n})=>(0,h.css)`
font-family: ${n.fonts.family.navigation};
font-size: ${n.fonts.size.navigation};
color: ${n.colors.variant.darker.default};
&:hover,
&:focus {
background: inherit;
text-decoration: none;
}
&:hover {
color: inherit;
${(0,C.WS)(n)}
}
&.active {
color: ${n.colors.global.textDefault};
${(0,C.at)(n)}
&:hover,
&:focus {
${(0,C.at)(n)}
}
`);c.displayName="Button";const f=({items:n})=>m.createElement(_,null,n.map(({path:O,title:o,permissions:t,exactPathMatch:r})=>O?m.createElement(y.Wj,{permissions:t!=null?t:[],key:O},m.createElement(A.m,{to:O,relativeActive:!r},m.createElement(c,{bsStyle:"link"},m.createElement(C.Ay,null,o)))):null))},tBcsAR17:(I,D,e)=>{e.d(D,{A:()=>_});var m=e("Z7aTuO5B"),h=e("SfPIQIJE"),s=e("d4kzUuQm"),A=e("rIl5IEuP");const y=[{title:"Overview",path:s.Ay.SYSTEM.SIDECARS.OVERVIEW,exactPathMatch:!0},{title:"Administration",path:s.Ay.SYSTEM.SIDECARS.ADMINISTRATION},{title:"Configuration",path:s.Ay.SYSTEM.SIDECARS.CONFIGURATION},{title:"Failure Tracking",path:s.Ay.SYSTEM.SIDECARS.FAILURE_TRACKING}],_=()=>m.createElement(A.Row,null,m.createElement(h.A,{items:y}))},"7VnWevY8":(I,D,e)=>{e.d(D,{A:()=>x});var m=e("ii0bleBb"),h=e.n(m),s=e("Z7aTuO5B"),A=e("IW7priiX"),y=e.n(A),C=e("Mx+G+HdB"),_=e.n(C),c=e("PfG+ecgN"),d=e.n(c),f=e("IOI9nV80"),n=e("rIl5IEuP"),O=e("d4kzUuQm"),o=e("djwd899R"),t=e("kHvj/lAD"),r=e("N6x7vnl1"),a=e("v4GbOr/o"),i=e("BqxuktKK"),v=e("8fnsnG21"),B=Object.defineProperty,$=(g,E,u)=>E in g?B(g,E,{enumerable:!0,configurable:!0,writable:!0,value:u}):g[E]=u,P=(g,E,u)=>($(g,typeof E!="symbol"?E+"":E,u),u);const R=({validationErrors:g,fieldName:E,defaultText:u})=>g[E]?s.createElement("span",null,g[E][0]):s.createElement("span",null,u);R.propTypes={validationErrors:h().object.isRequired,fieldName:h().string.isRequired,defaultText:h().string.isRequired};const W=()=>{const g=[];return g.push({value:"exec",label:"Foreground execution"}),g.push({value:"svc",label:"Windows service"}),g},K=()=>{const g=[];return g.push({value:"linux",label:"Linux"}),g.push({value:"windows",label:"Windows"}),g.push({value:"darwin",label:"Darwin"}),g.push({value:"freebsd",label:"FreeBSD"}),g};class U extends s.Component{constructor(E){super(E),P(this,"hasErrors",()=>{const{error:l}=this.state;return l}),P(this,"_save",()=>{const{action:l,history:p,sendTelemetry:M}=this.props,{formData:T}=this.state,L=l==="create";if(!this.hasErrors()){let S;L?S=t.C.create(T).then(()=>p.push(O.Ay.SYSTEM.SIDECARS.CONFIGURATION)):S=t.C.update(T),S.then(()=>{M(a.g.SIDECARS[`LOG_COLLECTOR_${L?"CREATED":"UPDATED"}`],{app_pathname:"sidecars",app_section:"configuration"})})}}),P(this,"handleSelectTelemetry",(l,p)=>{const{sendTelemetry:M}=this.props;(l==="service_type"||l==="node_operating_system")&&M(a.g.SIDECARS[`LOG_COLLECTOR_${d()(l).replace(/\s|\//g,"_")}_CHANGED`],{app_pathname:"sidecars",app_section:"configuration",event_details:{[l]:p}})}),P(this,"_formDataUpdate",l=>{const{formData:p}=this.state;return M=>{const T=y()(p);this.handleSelectTelemetry(l,M),T[l]=M,this._debouncedValidateFormData(T),this.setState({formData:T})}}),P(this,"_validateFormData",l=>{l.name&&l.node_operating_system&&t.C.validate(l).then(p=>this.setState({validation_errors:p.errors,error:p.failed}))}),P(this,"_onNameChange",l=>{const p=l.target.value;this._formDataUpdate("name")(p)}),P(this,"_onInputChange",l=>p=>{this._formDataUpdate(l)(p.target.value)}),P(this,"_onSubmit",l=>{l.preventDefault(),this._save()}),P(this,"_onCancel",()=>{const{history:l}=this.props;l.goBack()}),P(this,"_validationState",l=>{const{validation_errors:p}=this.state;return p[l]?"error":null});const{collector:u}=this.props;this.state={error:!1,validation_errors:{},formData:{id:u.id,name:u.name,service_type:u.service_type,node_operating_system:u.node_operating_system,executable_path:u.executable_path,execute_parameters:u.execute_parameters,validation_parameters:u.validation_parameters,default_template:String(u.default_template)}}}UNSAFE_componentWillMount(){this._debouncedValidateFormData=_()(this._validateFormData,200)}componentDidMount(){t.C.all(),o.s.all()}render(){const{action:E}=this.props,{formData:u,validation_errors:l}=this.state;let p="",M="";return u.validation_parameters&&(p=u.validation_parameters),u.execute_parameters&&(M=u.execute_parameters),s.createElement("div",null,s.createElement("form",{onSubmit:this._onSubmit},s.createElement("fieldset",null,s.createElement(n.Input,{type:"text",id:"name",label:"Name",onChange:this._onNameChange,bsStyle:this._validationState("name"),help:s.createElement(R,{fieldName:"name",defaultText:"Name for this collector",validationErrors:l}),value:u.name||"",autoFocus:!0,required:!0}),s.createElement(n.FormGroup,{controlId:"service_type",validationState:this._validationState("service_type")},s.createElement(n.ControlLabel,null,"Process management"),s.createElement(f.l6,{inputId:"service_type",options:W(),value:u.service_type,onChange:this._formDataUpdate("service_type"),placeholder:"Service Type",required:!0}),s.createElement(n.HelpBlock,null,s.createElement(R,{fieldName:"service_type",defaultText:"Choose the service type this collector is meant for.",validationErrors:l}))),s.createElement(n.FormGroup,{controlId:"node_operating_system",validationState:this._validationState("node_operating_system")},s.createElement(n.ControlLabel,null,"Operating System"),s.createElement(f.l6,{inputId:"node_operating_system",options:K(),value:u.node_operating_system,onChange:this._formDataUpdate("node_operating_system"),placeholder:"Name",required:!0}),s.createElement(n.HelpBlock,null,s.createElement(R,{fieldName:"node_operating_system",defaultText:"Choose the operating system this collector is meant for.",validationErrors:l}))),s.createElement(n.Input,{type:"text",id:"executablePath",label:"Executable Path",onChange:this._onInputChange("executable_path"),bsStyle:this._validationState("executable_path"),help:s.createElement(R,{fieldName:"executable_path",defaultText:"Path to the collector executable",validationErrors:l}),value:u.executable_path||"",required:!0}),s.createElement(n.Input,{type:"text",id:"executeParameters",label:s.createElement("span",null,"Execute Parameters ",s.createElement("small",{className:"text-muted"},"(Optional)")),onChange:this._onInputChange("execute_parameters"),help:s.createElement("span",null,"Parameters the collector is started with.",s.createElement("strong",null," %s will be replaced by the path to the configuration file.")),value:M||""}),s.createElement(n.Input,{type:"text",id:"validationParameters",label:s.createElement("span",null,"Parameters for Configuration Validation ",s.createElement("small",{className:"text-muted"},"(Optional)")),onChange:this._onInputChange("validation_parameters"),help:s.createElement("span",null,"Parameters that validate the configuration file. ",s.createElement("strong",null," %s will be replaced by the path to the configuration file.")),value:p||""}),s.createElement(n.FormGroup,{controlId:"defaultTemplate"},s.createElement(n.ControlLabel,null,s.createElement("span",null,"Default Template ",s.createElement("small",{className:"text-muted"},"(Optional)"))),s.createElement(f.Qb,{id:"template",value:u.default_template||"",onChange:this._formDataUpdate("default_template")}),s.createElement(n.HelpBlock,null,"The default Collector configuration."))),s.createElement(n.Row,null,s.createElement(n.Col,{md:12},s.createElement(f.hP,{submitButtonText:`${E==="create"?"Create":"Update"} collector`,disabledSubmit:this.hasErrors(),onCancel:this._onCancel})))))}}U.propTypes={action:h().oneOf(["create","edit"]),collector:h().object,history:h().object.isRequired,sendTelemetry:h().func},U.defaultProps={action:"edit",collector:{default_template:""},sendTelemetry:()=>{}};const x=(0,i.A)((0,r.A)((0,v.A)(U,{collectors:t.k})))},djwd899R:(I,D,e)=>{e.d(D,{g:()=>O,s:()=>n});var m=e("JnTtTRmZ"),h=e.n(m),s=e("oCSEoDew"),A=e.n(s),y=e("wXrUUKFq"),C=e.n(y),_=e("MdYBRjRJ"),c=e("jAGDuYSC"),d=e("eFxcQyPT"),f=e("IA3Ku5lS");const n=(0,f.rN)("core.CollectorConfigurations",()=>h().createActions({all:{asyncResult:!0},list:{asyncResult:!0},getConfiguration:{asyncResult:!0},getConfigurationSidecars:{asyncResult:!0},createConfiguration:{asyncResult:!0},updateConfiguration:{asyncResult:!0},renderPreview:{asyncResult:!0},copyConfiguration:{asyncResult:!0},delete:{asyncResult:!0},validate:{asyncResult:!0}})),O=(0,f.Bv)("core.CollectorConfigurations",()=>h().createStore({listenables:[n],sourceUrl:"/sidecar",configurations:void 0,pagination:{page:void 0,pageSize:void 0,total:void 0},total:void 0,paginatedConfigurations:void 0,query:void 0,getInitialState(){return{configurations:this.configurations,query:this.query,total:this.total,pagination:this.pagination,paginatedConfigurations:this.paginatedConfigurations}},propagateChanges(){this.trigger({configurations:this.configurations,query:this.query,total:this.total,pagination:this.pagination,paginatedConfigurations:this.paginatedConfigurations})},_fetchConfigurations({query:o,page:t,pageSize:r}){const a=`${this.sourceUrl}/configurations`,i={query:o,page:t,per_page:r},v=A()(a).search(i).toString();return(0,d.Ay)("GET",_.H3(v))},all(){const o=this._fetchConfigurations({pageSize:0});o.then(t=>(this.configurations=t.configurations,this.propagateChanges(),t.configurations),t=>{c.A.error(`Fetching collector configurations failed with status: ${t}`,"Could not retrieve configurations")}),n.all.promise(o)},list({query:o="",page:t=1,pageSize:r=10}){const a=this._fetchConfigurations({query:o,page:t,pageSize:r});a.then(i=>(this.query=i.query,this.pagination={page:i.pagination.page,pageSize:i.pagination.per_page,total:i.pagination.total},this.total=i.total,this.paginatedConfigurations=i.configurations,this.propagateChanges(),i.configurations),i=>{c.A.error(`Fetching collector configurations failed with status: ${i}`,"Could not retrieve configurations")}),n.list.promise(a)},refreshList(){this.list({query:this.query,page:this.page,pageSize:this.pageSize})},getConfiguration(o){const t=(0,d.Ay)("GET",_.H3(`${this.sourceUrl}/configurations/${o}`));t.catch(r=>{let a=`Fetching Configuration failed with status: ${r}`;r.status===404&&(a=`Unable to find a Configuration with ID <${o}>, please ensure it was not deleted.`),c.A.error(a,"Could not retrieve Configuration")}),n.getConfiguration.promise(t)},getConfigurationSidecars(o){const t=(0,d.Ay)("GET",_.H3(`${this.sourceUrl}/configurations/${o}/sidecars`));t.catch(r=>{let a=`Fetching Configuration failed with status: ${r}`;r.status===404&&(a=`Unable to find a Configuration with ID <${o}>, please ensure it was not deleted.`),c.A.error(a,"Could not retrieve Configuration")}),n.getConfigurationSidecars.promise(t)},renderPreview(o){const t={template:o},r=(0,d.Ay)("POST",_.H3(`${this.sourceUrl}/configurations/render/preview`),t);r.catch(a=>{c.A.error(`Fetching configuration preview failed with status: ${a}`,"Could not retrieve preview")}),n.renderPreview.promise(r)},createConfiguration(o){const t=_.H3(`${this.sourceUrl}/configurations`),a=(0,d.Ay)("POST",t,o);a.then(i=>(c.A.success("","Configuration successfully created"),i),i=>{c.A.error(i.status===400?i.responseMessage:`Creating configuration failed with status: ${i.message}`,"Could not save configuration")}),n.createConfiguration.promise(a)},updateConfiguration(o){const t=_.H3(`${this.sourceUrl}/configurations/${o.id}`),r=(0,d.Ay)("PUT",t,o);r.then(a=>(c.A.success("","Configuration successfully updated"),this.refreshList(),a),a=>{c.A.error(`Updating Configuration failed: ${a.status===400?a.responseMessage:a.message}`,`Could not update Configuration ${o.name}`)}),n.updateConfiguration.promise(r)},copyConfiguration(o,t){const r=_.H3(`${this.sourceUrl}/configurations/${o}/${t}`),i=(0,d.Ay)("POST",r);i.then(v=>(c.A.success("",`Configuration "${t}" successfully copied`),this.refreshList(),v),v=>{c.A.error(`Saving configuration "${t}" failed with status: ${v.message}`,"Could not save Configuration")}),n.copyConfiguration.promise(i)},delete(o){const t=_.H3(`${this.sourceUrl}/configurations/${o.id}`),r=(0,d.Ay)("DELETE",t);r.then(a=>(c.A.success("",`Configuration "${o.name}" successfully deleted`),this.refreshList(),a),a=>{c.A.error(`Deleting Configuration failed: ${a.status===400?a.responseMessage:a.message}`,`Could not delete Configuration ${o.name}`)}),n.delete.promise(r)},validate(o){const t={name:" ",collector_id:" ",color:" ",template:" "};C()(t,o);const r=(0,d.Ay)("POST",_.H3(`${this.sourceUrl}/configurations/validate`),t);r.then(a=>a,a=>c.A.error(`Validating configuration "${t.name}" failed with status: ${a.message}`,"Could not validate configuration")),n.validate.promise(r)}}))},"kHvj/lAD":(I,D,e)=>{e.d(D,{C:()=>n,k:()=>O});var m=e("JnTtTRmZ"),h=e.n(m),s=e("oCSEoDew"),A=e.n(s),y=e("wXrUUKFq"),C=e.n(y),_=e("MdYBRjRJ"),c=e("eFxcQyPT"),d=e("jAGDuYSC"),f=e("IA3Ku5lS");const n=(0,f.rN)("core.Collectors",()=>h().createActions({getCollector:{asyncResult:!0},all:{asyncResult:!0},list:{asyncResult:!0},create:{asyncResult:!0},update:{asyncResult:!0},delete:{asyncResult:!0},copy:{asyncResult:!0},validate:{asyncResult:!0}})),O=(0,f.Bv)("core.Collectors",()=>h().createStore({listenables:[n],sourceUrl:"/sidecar",collectors:void 0,query:void 0,pagination:{page:void 0,pageSize:void 0,total:void 0},total:void 0,paginatedCollectors:void 0,getInitialState(){return{collectors:this.collectors}},propagateChanges(){this.trigger({collectors:this.collectors,paginatedCollectors:this.paginatedCollectors,query:this.query,total:this.total,pagination:this.pagination})},getCollector(o){const t=(0,c.Ay)("GET",_.H3(`${this.sourceUrl}/collectors/${o}`));t.catch(r=>{let a=`Fetching Collector failed with status: ${r}`;r.status===404&&(a=`Unable to find a collector with ID <${o}>, please ensure it was not deleted.`),d.A.error(a,"Could not retrieve Collector")}),n.getCollector.promise(t)},_fetchCollectors({query:o,page:t,pageSize:r}){const a={query:o,page:t,per_page:r},i=A()(`${this.sourceUrl}/collectors/summary`).search(a).toString();return(0,c.Ay)("GET",_.H3(i))},all(){const o=this._fetchCollectors({pageSize:0});o.then(t=>(this.collectors=t.collectors,this.propagateChanges(),t.collectors),t=>{d.A.error(`Fetching collectors failed with status: ${t}`,"Could not retrieve collectors")}),n.all.promise(o)},list({query:o="",page:t=1,pageSize:r=10}){const a=this._fetchCollectors({query:o,page:t,pageSize:r});a.then(i=>(this.query=i.query,this.pagination={page:i.pagination.page,pageSize:i.pagination.per_page,total:i.pagination.total},this.total=i.total,this.paginatedCollectors=i.collectors,this.propagateChanges(),i.collectors),i=>{d.A.error(`Fetching collectors failed with status: ${i}`,"Could not retrieve collectors")}),n.list.promise(a)},refreshList(){this.list({query:this.query,page:this.pagination.page,pageSize:this.pagination.pageSize})},create(o){const t=(0,c.Ay)("POST",_.H3(`${this.sourceUrl}/collectors`),o);t.then(r=>(d.A.success("","Collector successfully created"),this.collectors=r.collectors,this.propagateChanges(),this.collectors),r=>{d.A.error(`Fetching collectors failed with status: ${r}`,"Could not retrieve collectors")}),n.create.promise(t)},update(o){const t=(0,c.Ay)("PUT",_.H3(`${this.sourceUrl}/collectors/${o.id}`),o);t.then(r=>(d.A.success("","Collector successfully updated"),this.collectors=r.collectors,this.propagateChanges(),this.collectors),r=>{d.A.error(`Fetching collectors failed with status: ${r}`,"Could not retrieve collectors")}),n.update.promise(t)},delete(o){const t=_.H3(`${this.sourceUrl}/collectors/${o.id}`),r=(0,c.Ay)("DELETE",t);r.then(a=>(d.A.success("",`Collector "${o.name}" successfully deleted`),this.refreshList(),a),a=>{d.A.error(`Deleting Collector failed: ${a.status===400?a.responseMessage:a.message}`,`Could not delete Collector "${o.name}"`)}),n.delete.promise(r)},copy(o,t){const r=_.H3(`${this.sourceUrl}/collectors/${o}/${t}`),i=(0,c.Ay)("POST",r);i.then(v=>(d.A.success("",`Collector "${t}" successfully copied`),this.refreshList(),v),v=>{d.A.error(`Saving collector "${t}" failed with status: ${v.message}`,"Could not save Collector")}),n.copy.promise(i)},validate(o){const t={id:" ",service_type:"exec",executable_path:" ",default_template:" "};C()(t,o);const r=(0,c.Ay)("POST",_.H3(`${this.sourceUrl}/collectors/validate`),t);r.then(a=>a,a=>d.A.error(`Validating collector "${t.name}" failed with status: ${a.message}`,"Could not validate collector")),n.validate.promise(r)}}))}}]);})();
//# sourceMappingURL=bb8c8232-816.05699231e5e95479a8f8.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy