web-interface.assets.bb8c8232-1207.f9940377ebd9556d2994.js Maven / Gradle / Ivy
(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["bb8c8232-1207"],{"u/saNNwg":(U,R,a)=>{"use strict";a.d(R,{A:()=>_});var v=a("pmX897Fv"),u=a.n(v),e=a("DjJvgDaP"),T=a.n(e),D=T()(u());D.push([U.id,`.xPV2VE7mx5w5RbxBVwcf {
margin-top: 20px;
}
.vjxO58xdx2DWfSbCtDqn {
margin-top: 10px;
}
.nV67tChjqzGMJgFSXjEh {
white-space: pre-wrap;
}
.panel-body h3 {
margin-bottom: 5px;
}
.Ljky5PvbEjtFMEvWjPom {
max-height: 400px;
}
.cqjNB6UHuqa0fd42yYFA {
font-family: "Roboto Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
}
.heyPYufeKzilLrTBlkcz {
list-style-type: disc;
padding-left: 20px;
padding-top: 20px;
}
.IukKgOWYiWDLjEX1JJif {
width: 120px;
}
`,"",{version:3,sources:["webpack://./src/components/sidecars/configuration-forms/ConfigurationHelper.css"],names:[],mappings:"AAAA;IACI,gBAAgB;AACpB;;AAEA;IACI,gBAAgB;AACpB;;AAEA;IACI,qBAAqB;AACzB;;AAEA;IACI,kBAAkB;AACtB;;AAEA;CACC,iBAAiB;AAClB;;AAEA;IACI,6EAA6E;AACjF;;AAEA;IACI,qBAAqB;IACrB,kBAAkB;IAClB,iBAAiB;AACrB;;AAEA;IACI,YAAY;AAChB",sourcesContent:[`:local(.marginQuickReferenceText) {
margin-top: 20px;
}
:local(.marginTab) {
margin-top: 10px;
}
:local(.exampleFunction) {
white-space: pre-wrap;
}
.panel-body h3 {
margin-bottom: 5px;
}
:local(.tableMaxHeight) {
max-height: 400px;
}
:local(.monoSpaceFont) {
font-family: "Roboto Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
}
:local(.ulStyle) {
list-style-type: disc;
padding-left: 20px;
padding-top: 20px;
}
:local(.actionsColumn) {
width: 120px;
}
`],sourceRoot:""}]),D.locals={marginQuickReferenceText:"xPV2VE7mx5w5RbxBVwcf",marginTab:"vjxO58xdx2DWfSbCtDqn",exampleFunction:"nV67tChjqzGMJgFSXjEh",tableMaxHeight:"Ljky5PvbEjtFMEvWjPom",monoSpaceFont:"cqjNB6UHuqa0fd42yYFA",ulStyle:"heyPYufeKzilLrTBlkcz",actionsColumn:"IukKgOWYiWDLjEX1JJif"};const _=D},SfPIQIJE:(U,R,a)=>{"use strict";a.d(R,{A:()=>B});var v=a("Z7aTuO5B"),u=a("J6y4/h8P"),e=a("rIl5IEuP"),T=a("ty2gyrHp"),D=a("IOI9nV80"),_=a("NV1/EHMi");const C=(0,u.default)(e.ButtonToolbar)`
margin-bottom: 10px;
`,p=(0,u.default)(e.Button)(({theme:g})=>(0,u.css)`
font-family: ${g.fonts.family.navigation};
font-size: ${g.fonts.size.navigation};
color: ${g.colors.variant.darker.default};
&:hover,
&:focus {
background: inherit;
text-decoration: none;
}
&:hover {
color: inherit;
${(0,_.WS)(g)}
}
&.active {
color: ${g.colors.global.textDefault};
${(0,_.at)(g)}
&:hover,
&:focus {
${(0,_.at)(g)}
}
`);p.displayName="Button";const B=({items:g})=>v.createElement(C,null,g.map(({path:P,title:t,permissions:r,exactPathMatch:i})=>P?v.createElement(D.Wj,{permissions:r!=null?r:[],key:P},v.createElement(T.m,{to:P,relativeActive:!i},v.createElement(p,{bsStyle:"link"},v.createElement(_.Ay,null,t)))):null))},tBcsAR17:(U,R,a)=>{"use strict";a.d(R,{A:()=>C});var v=a("Z7aTuO5B"),u=a("SfPIQIJE"),e=a("d4kzUuQm"),T=a("rIl5IEuP");const D=[{title:"Overview",path:e.Ay.SYSTEM.SIDECARS.OVERVIEW,exactPathMatch:!0},{title:"Administration",path:e.Ay.SYSTEM.SIDECARS.ADMINISTRATION},{title:"Configuration",path:e.Ay.SYSTEM.SIDECARS.CONFIGURATION},{title:"Failure Tracking",path:e.Ay.SYSTEM.SIDECARS.FAILURE_TRACKING}],C=()=>v.createElement(T.Row,null,v.createElement(u.A,{items:D}))},SMtZVlps:(U,R,a)=>{"use strict";a.d(R,{A:()=>Xe});var v=a("ii0bleBb"),u=a.n(v),e=a("Z7aTuO5B"),T=a("VZ0CjfW1"),D=a.n(T),_=a("IW7priiX"),C=a.n(_),p=a("Mx+G+HdB"),E=a.n(p),B=a("Dg7SLLbb"),g=a.n(B),P=a("IOI9nV80"),t=a("rIl5IEuP"),r=a("d4kzUuQm"),i=a("1LOzeRr1"),s=a("djwd899R"),m=a("kHvj/lAD");const fe=()=>{const l=n=>`\${sidecar.${n}}`;return e.createElement("div",null,e.createElement(t.Table,{responsive:!0},e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",null,"Name"),e.createElement("th",null,"Description"))),e.createElement("tbody",null,e.createElement("tr",null,e.createElement("td",null,e.createElement("code",null,l("operatingSystem"))),e.createElement("td",null,"Name of the operating system the sidecar is running on, e.g. ",e.createElement("code",null,'"Linux", "Windows"'))),e.createElement("tr",null,e.createElement("td",null,e.createElement("code",null,l("nodeName"))),e.createElement("td",null,"The name of the sidecar, defaults to hostname if not set.")),e.createElement("tr",null,e.createElement("td",null,e.createElement("code",null,l("nodeId"))),e.createElement("td",null,"UUID of the sidecar.")),e.createElement("tr",null,e.createElement("td",null,e.createElement("code",null,l("sidecarVersion"))),e.createElement("td",null,"Version string of the running sidecar.")),e.createElement("tr",null,e.createElement("td",null,e.createElement("code",null,l("spoolDir"))),e.createElement("td",null,"A directory that is unique per configuration and can be used to store collector data.")),e.createElement("tr",null,e.createElement("td",null,e.createElement("code",null,l("tags."))),e.createElement("td",null,"A map of tags that are set for the sidecar. This can be used to render conditional configuration snippets. e.g.: ",e.createElement("br",null),e.createElement("code",null," <#if sidecar.tags.webserver??>",e.createElement("br",null),"\xA0\xA0- /var/log/apache/*.log",e.createElement("br",null),"#if> "))))))};var pe=a("JnTtTRmZ"),Q=a.n(pe),Ee=a("wXrUUKFq"),Ce=a.n(Ee),N=a("MdYBRjRJ"),x=a("jAGDuYSC"),w=a("eFxcQyPT"),Z=a("IA3Ku5lS");const b=(0,Z.rN)("core.ConfigurationVariable",()=>Q().createActions({all:{asyncResult:!0},save:{asyncResult:!0},delete:{asyncResult:!0},validate:{asyncResult:!0},getConfigurations:{asyncResult:!0}})),gt=(0,Z.Bv)("core.ConfigurationVariable",()=>Q().createStore({listenables:[b],sourceUrl:"/sidecar/configuration_variables",all(){const l=(0,w.Ay)("GET",N.H3(this.sourceUrl));l.catch(n=>{x.A.error(`Fetching configuration variables failed with status: ${n}`,"Could not retrieve configuration variables")}),b.all.promise(l)},save(l){const n={id:l.id,name:l.name,description:l.description,content:l.content};let o=N.H3(`${this.sourceUrl}`),d,h;l.id===""?(d="POST",h="created"):(o+=`/${l.id}`,d="PUT",h="updated");const y=(0,w.Ay)(d,o,n);y.then(()=>{x.A.success(`Configuration variable "${l.name}" successfully ${h}`)},S=>{x.A.error(`Saving variable "${l.name}" failed with status: ${S.message}`,"Could not save variable")}),b.save.promise(y)},getConfigurations(l){const n=N.H3(`${this.sourceUrl}/${l.id}/configurations`),o=(0,w.Ay)("GET",n);o.catch(d=>{x.A.error(`Fetching configurations for this variable failed with status: ${d}`)}),b.getConfigurations.promise(o)},delete(l){const n=N.H3(`${this.sourceUrl}/${l.id}`),o=(0,w.Ay)("DELETE",n);o.then(()=>{x.A.success(`Configuration variable "${l.name}" successfully deleted`)},d=>{x.A.error(`Deleting variable "${l.name}" failed with status: ${d.message}`,"Could not delete variable")}),b.delete.promise(o)},validate(l){const n={id:" ",name:" ",content:" "};Ce()(n,l);const o=(0,w.Ay)("POST",N.H3(`${this.sourceUrl}/validate`),n);o.catch(d=>{x.A.error(`Validating variable "${l.name}" failed with status: ${d.message}`,"Could not validate variable")}),b.validate.promise(o)}}));var ve=a("dFpwyWHg"),Ae=a.n(ve),ye=a("C2ikvoS0"),Se=a.n(ye),Me=a("1IntWRSu"),Te=a.n(Me),De=a("8nGWeFnd"),_e=a.n(De),Pe=a("TeAcaicX"),Re=a.n(Pe),be=a("eE3+5goe"),Ie=a.n(be),W=a("u/saNNwg"),L={};L.styleTagTransform=Ie(),L.setAttributes=_e(),L.insert=Te().bind(null,"head"),L.domAPI=Se(),L.insertStyleElement=Re();var ht=Ae()(W.A,L);const $=W.A&&W.A.locals?W.A.locals:void 0;var Oe=Object.defineProperty,Be=(l,n,o)=>n in l?Oe(l,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):l[n]=o,M=(l,n,o)=>(Be(l,typeof n!="symbol"?n+"":n,o),o);class G extends e.Component{constructor(n){super(n),M(this,"_cleanState",()=>{const{name:o,id:d,description:h,content:y}=this.props;return{showModal:!1,error:!1,validation_errors:{},savedName:o,formData:{id:d,name:o,description:h,content:y}}}),M(this,"_hasErrors",()=>{const{error:o}=this.state;return o}),M(this,"openModal",()=>{this.setState({...this._cleanState(),showModal:!0})}),M(this,"closeModal",()=>{this.setState(this._cleanState())}),M(this,"_getId",o=>{const{id:d}=this.state;return`${o} ${d}`||"new"}),M(this,"_saved",()=>{this.setState({showModal:!1})}),M(this,"_validateFormData",o=>{b.validate(o).then(d=>{this.setState({validation_errors:d.errors,error:d.failed})})}),M(this,"_debouncedValidateFormData",E()(this._validateFormData,200)),M(this,"_formDataUpdate",o=>{const{formData:d}=this.state;return h=>{const y=C()(d);y[o]=h,this._debouncedValidateFormData(y),this.setState({formData:y})}}),M(this,"_save",()=>{const{formData:o,savedName:d}=this.state,{saveConfigurationVariable:h}=this.props;if(this._hasErrors()){this._validateFormData(o);return}h(o,d,this._saved)}),M(this,"_handleInputChange",o=>{this._formDataUpdate(o.target.name)(o.target.value)}),M(this,"_formatValidationMessage",(o,d)=>{const{validation_errors:h}=this.state;return h[o]?e.createElement("span",null,h[o][0]):e.createElement("span",null,d)}),M(this,"_validationState",o=>{const{validation_errors:d}=this.state;return d[o]?"error":null}),this.state=this._cleanState()}render(){const{create:n}=this.props,{formData:o,showModal:d}=this.state;let h;return n?h="Create Variable":h=e.createElement("span",null,"Edit"),e.createElement(e.Fragment,null,e.createElement(t.Button,{onClick:this.openModal,bsStyle:n?"success":"info",bsSize:n?"small":"xsmall",className:n?"pull-right":""},h),e.createElement(t.BootstrapModalForm,{show:d,title:e.createElement(e.Fragment,null,n?"Create":"Edit"," Variable ${user.",o.name,"}"),"data-telemetry-title":`${n?"Create":"Edit"} Variable user`,onSubmitForm:this._save,onCancel:this.closeModal,submitButtonDisabled:this._hasErrors(),submitButtonText:"Save"},e.createElement("fieldset",null,e.createElement(t.Input,{type:"text",id:this._getId("variable-name"),label:"Name",name:"name",defaultValue:o.name,onChange:this._handleInputChange,bsStyle:this._validationState("name"),help:this._formatValidationMessage("name","Type a name for this variable"),autoFocus:!0,spellCheck:!1,required:!0}),e.createElement(t.Input,{type:"text",id:this._getId("variable-description"),label:e.createElement("span",null,"Description ",e.createElement("small",{className:"text-muted"},"(Optional)")),name:"description",defaultValue:o.description,onChange:this._handleInputChange,help:"Type a description for this variable",spellCheck:!1}),e.createElement(t.Input,{type:"textarea",id:this._getId("variable-content"),label:"Content",name:"content",rows:"10",className:$.monoSpaceFont,defaultValue:o.content,onChange:this._handleInputChange,bsStyle:this._validationState("content"),help:this._formatValidationMessage("content","Write your variable content"),spellCheck:!1,required:!0}))))}}M(G,"propTypes",{create:u().bool,id:u().string,name:u().string,description:u().string,content:u().string,saveConfigurationVariable:u().func.isRequired}),M(G,"defaultProps",{create:!1,id:"",name:"",description:"",content:""});const q=G;var Ue=Object.defineProperty,$e=(l,n,o)=>n in l?Ue(l,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):l[n]=o,I=(l,n,o)=>($e(l,typeof n!="symbol"?n+"":n,o),o);const Fe=l=>e.createElement("ul",{className:$.ulStyle},l.map(n=>e.createElement("li",{key:n.id},e.createElement("a",{href:r.Ay.SYSTEM.SIDECARS.EDIT_CONFIGURATION(n.id)},n.name))));class k extends e.Component{constructor(n){super(n),I(this,"_reloadVariables",()=>{b.all().then(o=>{this.setState({configurationVariables:o})})}),I(this,"_openErrorModal",()=>{this.setState({showModal:!0})}),I(this,"_openErrorConfirmModal",()=>{this.setState({showConfirmModal:!0})}),I(this,"_closeErrorModal",()=>{this.setState({showModal:!1,showConfirmModal:!1})}),I(this,"_handleDeleteConfirm",()=>{const{variableToDelete:o}=this.state;b.delete(o).then(()=>this._onSuccessfulUpdate(()=>this._closeErrorModal()))}),I(this,"_handleDeleteCheck",o=>()=>{this.setState({variableToDelete:o}),b.getConfigurations(o).then(d=>{d.length>0?(this.setState({errorModalContent:Fe(d)}),this._openErrorModal()):this._openErrorConfirmModal()})}),I(this,"_configurationVariableListBuilder",()=>{const o=[],{configurationVariables:d}=this.state;return Object.values(d).forEach(h=>{const y=`\${user.${h.name}}`;o.push(e.createElement("tr",{key:h.id},e.createElement("td",null,e.createElement("code",null,y)),e.createElement("td",null,h.description),e.createElement("td",null,e.createElement(t.Button,{bsStyle:"primary",bsSize:"xsmall",onClick:this._handleDeleteCheck(h)},"Delete"),"\xA0",e.createElement(q,{id:h.id,name:h.name,description:h.description,content:h.content,create:!1,saveConfigurationVariable:this._saveConfigurationVariable}))))}),o}),I(this,"_isLoading",()=>{const{configurationVariables:o}=this.state;return!o}),I(this,"_saveConfigurationVariable",(o,d,h)=>{const{onVariableRename:y}=this.props;b.save.triggerPromise(o).then(()=>this._onSuccessfulUpdate(()=>{y(d,o.name),h()}))}),I(this,"_onSuccessfulUpdate",o=>{typeof o=="function"&&o(),this._reloadVariables()}),this.state={showModal:!1,showConfirmModal:!1,configurationVariables:void 0,errorModalContent:{},variableToDelete:{}}}componentDidMount(){this._reloadVariables()}render(){if(this._isLoading())return e.createElement(P.y$,null);const{variableToDelete:n,errorModalContent:o,showModal:d,showConfirmModal:h}=this.state;return e.createElement("div",null,e.createElement(q,{create:!0,saveConfigurationVariable:this._saveConfigurationVariable}),e.createElement("div",{className:"clearfix"}),e.createElement("div",{className:`table-responsive ${$.tableMaxHeight}`},e.createElement(t.Table,{responsive:!0},e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",null,"Name"),e.createElement("th",null,"Description"),e.createElement("th",{className:$.actionsColumn},"Actions"))),e.createElement("tbody",null,this._configurationVariableListBuilder()))),e.createElement(t.BootstrapModalWrapper,{showModal:d,onHide:this._closeErrorModal},e.createElement(t.Modal.Header,null,e.createElement(t.Modal.Title,null,"Error deleting configuration variable ",e.createElement("strong",null,"${user.",n.name,"}"))),e.createElement(t.Modal.Body,null,e.createElement(t.Alert,{bsStyle:"warning"},e.createElement("p",null,"Cannot delete this configuration variable as it is still in use. Please remove the variable from the following configurations and try again.",o))),e.createElement(t.Modal.Footer,null,e.createElement(t.Button,{onClick:this._closeErrorModal},"Close"))),e.createElement(t.BootstrapModalConfirm,{showModal:h,title:"Delete Configuration Variable?",onConfirm:this._handleDeleteConfirm,onCancel:this._closeErrorModal},e.createElement("p",null,"Are you sure you want to remove the configuration variable ",e.createElement("strong",null,n.name),"?")))}}I(k,"propTypes",{onVariableRename:u().func.isRequired});const xe=k;var Le=Object.defineProperty,Ne=(l,n,o)=>n in l?Le(l,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):l[n]=o,ee=(l,n,o)=>(Ne(l,typeof n!="symbol"?n+"":n,o),o);class te extends e.Component{constructor(){super(...arguments),ee(this,"_getId",(n,o)=>{const d=o!==void 0?`. ${o}`:"";return n+d})}render(){const{onVariableRename:n}=this.props;return e.createElement(t.Panel,{header:"Collector Configuration Reference"},e.createElement(t.Row,{className:"row-sm"},e.createElement(t.Col,{md:12},e.createElement(t.Tabs,{id:"configurationsHelper",defaultActiveKey:1,animation:!1},e.createElement(t.Tab,{eventKey:1,title:"Runtime Variables"},e.createElement("p",{className:$.marginQuickReferenceText},"These variables will be filled with the runtime information from each Sidecar"),e.createElement(fe,null)),e.createElement(t.Tab,{eventKey:2,title:"Variables"},e.createElement("p",{className:$.marginQuickReferenceText},"Use variables to share text snippets across multiple configurations.",e.createElement("br",null),"If your configuration format needs to use literals like ",e.createElement("code",null,"${foo}"),", which shall not act as a variable, you will have to write it as",e.createElement("code",null,"${'$'}{foo}"),"."),e.createElement(xe,{onVariableRename:n})),e.createElement(t.Tab,{eventKey:3,title:"Reference"},e.createElement(t.Row,{className:"row-sm"},e.createElement(t.Col,{md:12},e.createElement("p",{className:$.marginQuickReferenceText},"We provide collector configuration templates to get you started.",e.createElement("br",null),"For further information please refer to the official documentation of your collector."),e.createElement("ul",{className:$.ulStyle},e.createElement("li",null,e.createElement("a",{href:"https://www.elastic.co/guide/en/beats/filebeat/current/index.html",target:"_blank",rel:"noopener noreferrer"},"Filebeat Reference")," "),e.createElement("li",null,e.createElement("a",{href:"https://www.elastic.co/guide/en/beats/winlogbeat/current/index.html",target:"_blank",rel:"noopener noreferrer"},"Winlogbeat Reference")," "),e.createElement("li",null,e.createElement("a",{href:"https://nxlog.co/docs/nxlog-ce/nxlog-reference-manual.html",target:"_blank",rel:"noopener noreferrer"},"NXLog Reference Manual")," ")))))))))}}ee(te,"propTypes",{onVariableRename:u().func.isRequired});const we=te;var He=a("/7OuCFNo"),Ve=a("8OvTct/Z"),We=a("v4GbOr/o"),Ke=a("+KM7MH1U"),oe=a.n(Ke),je=Object.defineProperty,ze=(l,n,o)=>n in l?je(l,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):l[n]=o,H=(l,n,o)=>(ze(l,typeof n!="symbol"?n+"":n,o),o);const K=class z extends e.Component{constructor(n){super(n),H(this,"resetState",()=>{this.setState(z.initialState)}),H(this,"_loadConfiguration",()=>{!this.props.templateString&&!this.props.configurationId||(this.props.templateString?s.s.renderPreview(this.props.templateString).then(o=>{this.setState({source:o.preview,name:"preview"})},o=>{this.setState({source:`Error rendering preview: ${o.responseMessage?o.responseMessage:o}`})}):s.s.getConfiguration(this.props.configurationId).then(o=>{this.setState({source:o.template,name:o.name})},o=>{this.setState({source:`Error fetching configuration: ${o.responseMessage||o}`})}))}),this.state=z.initialState}componentDidUpdate(n){!oe()(this.state,z.initialState)&&!oe()(n,this.props)&&this.resetState(),this.props.showModal&&this._loadConfiguration()}render(){return e.createElement(t.BootstrapModalWrapper,{showModal:this.props.showModal,onHide:this.props.onHide},e.createElement(t.Modal.Header,{closeButton:!0},e.createElement(t.Modal.Title,null,e.createElement("span",null,"Configuration ",e.createElement("em",null,this.state.name)))),e.createElement(t.Modal.Body,null,e.createElement("div",{className:"configuration"},e.createElement("pre",null,this.state.source||""))),e.createElement(t.Modal.Footer,null,e.createElement(t.Button,{type:"button",onClick:this.props.onHide},"Close")))}};H(K,"propTypes",{configurationId:u().string,templateString:u().string,showModal:u().bool.isRequired,onHide:u().func.isRequired}),H(K,"defaultProps",{configurationId:void 0,templateString:void 0}),H(K,"initialState",{source:void 0,name:void 0});const Ge=K;var Ye=a("kTp6yg80");const ae=({tags:l,availableTags:n,onChange:o})=>{const d=l.join(","),h=n.map(y=>({value:y.name,label:y.name}));return e.createElement(Ye.A,{options:h,value:d,onChange:o,placeholder:"Choose tags...",allowCreate:!0})};ae.propTypes={tags:u().arrayOf(u().string).isRequired,availableTags:u().array.isRequired,onChange:u().func.isRequired};const Je=ae,Y=({action:l,configuration:n,configurationSidecars:o})=>{const d={id:n.id,name:n.name,color:n.color,collector_id:n.collector_id,template:n.template||"",tags:n.tags||[]},[h,y]=(0,e.useState)([]),[S,ne]=(0,e.useState)(d),[Qe,Ze]=(0,e.useState)(!1),[J,qe]=(0,e.useState)({}),[ke,re]=(0,e.useState)(!1),le=(0,e.useRef)({}),se=(0,He.A)(),et=(0,Ve.A)();(0,e.useEffect)(()=>{m.C.all().then(c=>y(c.collectors))},[]);const ie=c=>c!==void 0&&c!=="",ce=()=>Qe||!ie(S.template),ue=(c,f)=>{s.s.validate(c).then(A=>{const F=D()(A);f&&!ie(c.template)&&(F.errors.template=["Please fill out the configuration field."],F.failed=!0),qe(F.errors),Ze(F.failed)})},tt=async()=>{const c=l==="create";if(et(We.g.SIDECARS[`CONFIGURATION_${c?"CREATED":"UPDATED"}`],{app_pathname:"sidecars",app_section:"configuration"}),ce()){ue(S,!0);return}let f;c?f=s.s.createConfiguration(S).then(()=>se.push(r.Ay.SYSTEM.SIDECARS.CONFIGURATION)):f=s.s.updateConfiguration(S),await f},de=E()(ue,200),j=c=>(f,A,F)=>{const V=C()(S);V[c]=f,de(V,!1),ne(V),F&&F()},X=c=>{j("template")(c)},ot=(c,f)=>{if(c===""||c===f)return;const A=S.template.split(`\${user.${c}}`).join(`\${user.${f}}`);X(A)},at=c=>{const f=c.target.value;j("name")(f)},nt=c=>{const f=c.split(",");j("tags")(f)},rt=c=>{const f=le.current[c];return f!==void 0?new Promise(A=>A(f)):m.C.getCollector(c).then(A=>(le.current[c]=A.default_template,A.default_template))},lt=async c=>{const f=await rt(c),A=C()(S);A.collector_id=c,(!A.template||window.confirm("Do you want to use the default template for the selected Configuration?"))&&(X(f),A.template=f),de(A,!0),ne(A)},st=c=>{c.preventDefault(),tt()},it=()=>{se.goBack()},ct=()=>{re(!0)},me=c=>c?`${c.name} on ${g()(c.node_operating_system)}`:"Unknown collector",ut=()=>{const c=[];return h?h.forEach(f=>{c.push({value:f.id,label:me(f)})}):c.push({value:"none",label:"Loading collector list...",disable:!0}),c},ge=(c,f)=>J[c]?e.createElement("span",null,J[c][0]):e.createElement("span",null,f),he=c=>J[c]?"error":null,dt=(c,f,A)=>{if(A.sidecar_ids&&A.sidecar_ids.length>0){const V=f?f.find(mt=>mt.id===c):void 0;return e.createElement("span",null,e.createElement(t.FormControl.Static,null,me(V)),e.createElement(t.HelpBlock,{bsClass:"warning"},e.createElement("b",null,"Note:")," Log Collector cannot change while the Configuration is in use. Clone the Configuration to test it using another Collector."))}return e.createElement("span",null,e.createElement(P.l6,{inputId:"collector_id",options:ut(),value:c,onChange:lt,placeholder:"Collector",required:!0}),e.createElement(t.HelpBlock,null,"Choose the log collector this configuration is meant for."))};return e.createElement(t.Row,{className:"content"},e.createElement(t.Col,{md:6},e.createElement("div",null,e.createElement("form",{onSubmit:st},e.createElement("fieldset",null,e.createElement(t.Input,{type:"text",id:"name",label:"Name",onChange:at,bsStyle:he("name"),help:ge("name","Required. Name for this configuration"),value:S.name||"",autoFocus:!0,required:!0}),e.createElement(t.FormGroup,{controlId:"color"},e.createElement(t.ControlLabel,null,"Configuration color"),e.createElement("div",null,e.createElement(i.A,{color:S.color}),e.createElement("div",{style:{display:"inline-block",marginLeft:15}},e.createElement(P.$I,{id:"color",placement:"right",color:S.color,triggerNode:e.createElement(t.Button,{bsSize:"xsmall"},"Change color"),onChange:j("color")}))),e.createElement(t.HelpBlock,null,"Choose a color to use for this configuration.")),e.createElement(t.FormGroup,{controlId:"tags"},e.createElement(t.ControlLabel,null,"Configuration Assignment Tags"),e.createElement("div",null,e.createElement(Je,{availableTags:S.tags.map(c=>({name:c})),tags:S.tags,onChange:nt})),e.createElement(t.HelpBlock,null,"Sidecars which are configured with a matching tag will automatically receive this configuration.")),e.createElement(t.FormGroup,{controlId:"collector_id"},e.createElement(t.ControlLabel,null,"Collector"),dt(S.collector_id,h,o)),e.createElement(t.FormGroup,{controlId:"template",validationState:he("template")},e.createElement(t.ControlLabel,null,"Configuration"),e.createElement(P.Qb,{id:"template",height:400,value:S.template||"",onChange:X}),e.createElement(t.Button,{className:"pull-right",bsStyle:"link",bsSize:"sm",onClick:ct},"Preview"),e.createElement(t.HelpBlock,null,ge("template","Required. Collector configuration, see quick reference for more information.")))),e.createElement(t.Row,null,e.createElement(t.Col,{md:12},e.createElement(P.hP,{submitButtonText:`${l==="create"?"Create":"Update"} configuration`,disabledSubmit:ce(),onCancel:it})))),e.createElement(Ge,{showModal:ke,onHide:()=>re(!1),templateString:S.template}))),e.createElement(t.Col,{md:6},e.createElement(we,{onVariableRename:ot})))};Y.propTypes={action:u().oneOf(["create","edit"]),configuration:u().shape({id:u().string.isRequired,name:u().string.isRequired,color:u().string.isRequired,collector_id:u().string.isRequired,template:u().string.isRequired,tags:u().array.isRequired}),configurationSidecars:u().object},Y.defaultProps={action:"edit",configuration:{id:"",name:"",collector_id:"",template:"",color:"#FFFFFF",tags:[]},configurationSidecars:{}};const Xe=Y},djwd899R:(U,R,a)=>{"use strict";a.d(R,{g:()=>P,s:()=>g});var v=a("JnTtTRmZ"),u=a.n(v),e=a("oCSEoDew"),T=a.n(e),D=a("wXrUUKFq"),_=a.n(D),C=a("MdYBRjRJ"),p=a("jAGDuYSC"),E=a("eFxcQyPT"),B=a("IA3Ku5lS");const g=(0,B.rN)("core.CollectorConfigurations",()=>u().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}})),P=(0,B.Bv)("core.CollectorConfigurations",()=>u().createStore({listenables:[g],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:t,page:r,pageSize:i}){const s=`${this.sourceUrl}/configurations`,m={query:t,page:r,per_page:i},O=T()(s).search(m).toString();return(0,E.Ay)("GET",C.H3(O))},all(){const t=this._fetchConfigurations({pageSize:0});t.then(r=>(this.configurations=r.configurations,this.propagateChanges(),r.configurations),r=>{p.A.error(`Fetching collector configurations failed with status: ${r}`,"Could not retrieve configurations")}),g.all.promise(t)},list({query:t="",page:r=1,pageSize:i=10}){const s=this._fetchConfigurations({query:t,page:r,pageSize:i});s.then(m=>(this.query=m.query,this.pagination={page:m.pagination.page,pageSize:m.pagination.per_page,total:m.pagination.total},this.total=m.total,this.paginatedConfigurations=m.configurations,this.propagateChanges(),m.configurations),m=>{p.A.error(`Fetching collector configurations failed with status: ${m}`,"Could not retrieve configurations")}),g.list.promise(s)},refreshList(){this.list({query:this.query,page:this.page,pageSize:this.pageSize})},getConfiguration(t){const r=(0,E.Ay)("GET",C.H3(`${this.sourceUrl}/configurations/${t}`));r.catch(i=>{let s=`Fetching Configuration failed with status: ${i}`;i.status===404&&(s=`Unable to find a Configuration with ID <${t}>, please ensure it was not deleted.`),p.A.error(s,"Could not retrieve Configuration")}),g.getConfiguration.promise(r)},getConfigurationSidecars(t){const r=(0,E.Ay)("GET",C.H3(`${this.sourceUrl}/configurations/${t}/sidecars`));r.catch(i=>{let s=`Fetching Configuration failed with status: ${i}`;i.status===404&&(s=`Unable to find a Configuration with ID <${t}>, please ensure it was not deleted.`),p.A.error(s,"Could not retrieve Configuration")}),g.getConfigurationSidecars.promise(r)},renderPreview(t){const r={template:t},i=(0,E.Ay)("POST",C.H3(`${this.sourceUrl}/configurations/render/preview`),r);i.catch(s=>{p.A.error(`Fetching configuration preview failed with status: ${s}`,"Could not retrieve preview")}),g.renderPreview.promise(i)},createConfiguration(t){const r=C.H3(`${this.sourceUrl}/configurations`),s=(0,E.Ay)("POST",r,t);s.then(m=>(p.A.success("","Configuration successfully created"),m),m=>{p.A.error(m.status===400?m.responseMessage:`Creating configuration failed with status: ${m.message}`,"Could not save configuration")}),g.createConfiguration.promise(s)},updateConfiguration(t){const r=C.H3(`${this.sourceUrl}/configurations/${t.id}`),i=(0,E.Ay)("PUT",r,t);i.then(s=>(p.A.success("","Configuration successfully updated"),this.refreshList(),s),s=>{p.A.error(`Updating Configuration failed: ${s.status===400?s.responseMessage:s.message}`,`Could not update Configuration ${t.name}`)}),g.updateConfiguration.promise(i)},copyConfiguration(t,r){const i=C.H3(`${this.sourceUrl}/configurations/${t}/${r}`),m=(0,E.Ay)("POST",i);m.then(O=>(p.A.success("",`Configuration "${r}" successfully copied`),this.refreshList(),O),O=>{p.A.error(`Saving configuration "${r}" failed with status: ${O.message}`,"Could not save Configuration")}),g.copyConfiguration.promise(m)},delete(t){const r=C.H3(`${this.sourceUrl}/configurations/${t.id}`),i=(0,E.Ay)("DELETE",r);i.then(s=>(p.A.success("",`Configuration "${t.name}" successfully deleted`),this.refreshList(),s),s=>{p.A.error(`Deleting Configuration failed: ${s.status===400?s.responseMessage:s.message}`,`Could not delete Configuration ${t.name}`)}),g.delete.promise(i)},validate(t){const r={name:" ",collector_id:" ",color:" ",template:" "};_()(r,t);const i=(0,E.Ay)("POST",C.H3(`${this.sourceUrl}/configurations/validate`),r);i.then(s=>s,s=>p.A.error(`Validating configuration "${r.name}" failed with status: ${s.message}`,"Could not validate configuration")),g.validate.promise(i)}}))},"kHvj/lAD":(U,R,a)=>{"use strict";a.d(R,{C:()=>g,k:()=>P});var v=a("JnTtTRmZ"),u=a.n(v),e=a("oCSEoDew"),T=a.n(e),D=a("wXrUUKFq"),_=a.n(D),C=a("MdYBRjRJ"),p=a("eFxcQyPT"),E=a("jAGDuYSC"),B=a("IA3Ku5lS");const g=(0,B.rN)("core.Collectors",()=>u().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}})),P=(0,B.Bv)("core.Collectors",()=>u().createStore({listenables:[g],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(t){const r=(0,p.Ay)("GET",C.H3(`${this.sourceUrl}/collectors/${t}`));r.catch(i=>{let s=`Fetching Collector failed with status: ${i}`;i.status===404&&(s=`Unable to find a collector with ID <${t}>, please ensure it was not deleted.`),E.A.error(s,"Could not retrieve Collector")}),g.getCollector.promise(r)},_fetchCollectors({query:t,page:r,pageSize:i}){const s={query:t,page:r,per_page:i},m=T()(`${this.sourceUrl}/collectors/summary`).search(s).toString();return(0,p.Ay)("GET",C.H3(m))},all(){const t=this._fetchCollectors({pageSize:0});t.then(r=>(this.collectors=r.collectors,this.propagateChanges(),r.collectors),r=>{E.A.error(`Fetching collectors failed with status: ${r}`,"Could not retrieve collectors")}),g.all.promise(t)},list({query:t="",page:r=1,pageSize:i=10}){const s=this._fetchCollectors({query:t,page:r,pageSize:i});s.then(m=>(this.query=m.query,this.pagination={page:m.pagination.page,pageSize:m.pagination.per_page,total:m.pagination.total},this.total=m.total,this.paginatedCollectors=m.collectors,this.propagateChanges(),m.collectors),m=>{E.A.error(`Fetching collectors failed with status: ${m}`,"Could not retrieve collectors")}),g.list.promise(s)},refreshList(){this.list({query:this.query,page:this.pagination.page,pageSize:this.pagination.pageSize})},create(t){const r=(0,p.Ay)("POST",C.H3(`${this.sourceUrl}/collectors`),t);r.then(i=>(E.A.success("","Collector successfully created"),this.collectors=i.collectors,this.propagateChanges(),this.collectors),i=>{E.A.error(`Fetching collectors failed with status: ${i}`,"Could not retrieve collectors")}),g.create.promise(r)},update(t){const r=(0,p.Ay)("PUT",C.H3(`${this.sourceUrl}/collectors/${t.id}`),t);r.then(i=>(E.A.success("","Collector successfully updated"),this.collectors=i.collectors,this.propagateChanges(),this.collectors),i=>{E.A.error(`Fetching collectors failed with status: ${i}`,"Could not retrieve collectors")}),g.update.promise(r)},delete(t){const r=C.H3(`${this.sourceUrl}/collectors/${t.id}`),i=(0,p.Ay)("DELETE",r);i.then(s=>(E.A.success("",`Collector "${t.name}" successfully deleted`),this.refreshList(),s),s=>{E.A.error(`Deleting Collector failed: ${s.status===400?s.responseMessage:s.message}`,`Could not delete Collector "${t.name}"`)}),g.delete.promise(i)},copy(t,r){const i=C.H3(`${this.sourceUrl}/collectors/${t}/${r}`),m=(0,p.Ay)("POST",i);m.then(O=>(E.A.success("",`Collector "${r}" successfully copied`),this.refreshList(),O),O=>{E.A.error(`Saving collector "${r}" failed with status: ${O.message}`,"Could not save Collector")}),g.copy.promise(m)},validate(t){const r={id:" ",service_type:"exec",executable_path:" ",default_template:" "};_()(r,t);const i=(0,p.Ay)("POST",C.H3(`${this.sourceUrl}/collectors/validate`),r);i.then(s=>s,s=>E.A.error(`Validating collector "${r.name}" failed with status: ${s.message}`,"Could not validate collector")),g.validate.promise(i)}}))},VZ0CjfW1:(U,R,a)=>{var v=a("8U3oBBH1"),u=4;function e(T){return v(T,u)}U.exports=e}}]);})();
//# sourceMappingURL=bb8c8232-1207.f9940377ebd9556d2994.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy