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

web-interface.assets.1255d548-7892.bbf0a3663e8e1e6ca414.js Maven / Gradle / Ivy

There is a newer version: 6.1.4
Show newest version
(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["1255d548-7892"],{"u/saNNwg":(O,R,n)=>{"use strict";n.d(R,{Z:()=>T});var S=n("pmX897Fv"),d=n.n(S),e=n("DjJvgDaP"),P=n.n(e),_=P()(d());_.push([O.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:""}]),_.locals={marginQuickReferenceText:"xPV2VE7mx5w5RbxBVwcf",marginTab:"vjxO58xdx2DWfSbCtDqn",exampleFunction:"nV67tChjqzGMJgFSXjEh",tableMaxHeight:"Ljky5PvbEjtFMEvWjPom",monoSpaceFont:"cqjNB6UHuqa0fd42yYFA",ulStyle:"heyPYufeKzilLrTBlkcz",actionsColumn:"IukKgOWYiWDLjEX1JJif"};const T=_},SfPIQIJE:(O,R,n)=>{"use strict";n.d(R,{Z:()=>B});var S=n("Z7aTuO5B"),d=n("J6y4/h8P"),e=n("uZqmR+ju"),P=n("ty2gyrHp"),_=n("/GOzvPf6"),T=n("NV1/EHMi");const E=(0,d.default)(e.ButtonToolbar)`
  margin-bottom: 10px;
`,f=(0,d.default)(e.Button)(({theme:p})=>(0,d.css)`
  font-family: ${p.fonts.family.navigation};
  font-size: ${p.fonts.size.navigation};

  &&&& {
    color: ${p.colors.variant.darker.default};
    
    &:hover,
    &:focus {
      text-decoration: none;
    }

    > div {
      &:hover,
      &:focus {
        color: ${p.colors.variant.darker.default};
      }
    }

    &:hover {
      ${(0,T.RF)(p)}
    }

    &.active {
      color: ${p.colors.global.textDefault};

      ${(0,T.A7)(p)}

      &:hover,
      &:focus {
        ${(0,T.A7)(p)}
      }
    }
  }
`);f.displayName="Button";const B=({items:p})=>S.createElement(E,null,p.map(({path:A,title:t,permissions:r,exactPathMatch:i})=>A?S.createElement(_.AE,{permissions:r!=null?r:[],key:A},S.createElement(P.J,{to:A,relativeActive:!i},S.createElement(f,{bsStyle:"link"},S.createElement(T.ZP,null,t)))):null))},tBcsAR17:(O,R,n)=>{"use strict";n.d(R,{Z:()=>E});var S=n("Z7aTuO5B"),d=n("SfPIQIJE"),e=n("d4kzUuQm"),P=n("uZqmR+ju");const _=[{title:"Overview",path:e.ZP.SYSTEM.SIDECARS.OVERVIEW,exactPathMatch:!0},{title:"Administration",path:e.ZP.SYSTEM.SIDECARS.ADMINISTRATION},{title:"Configuration",path:e.ZP.SYSTEM.SIDECARS.CONFIGURATION},{title:"Failure Tracking",path:e.ZP.SYSTEM.SIDECARS.FAILURE_TRACKING}],E=()=>S.createElement(P.Row,null,S.createElement(d.Z,{items:_}))},GMQ8jKGb:(O,R,n)=>{"use strict";n.d(R,{Z:()=>ot});var S=n("ii0bleBb"),d=n.n(S),e=n("Z7aTuO5B"),P=n("VZ0CjfW1"),_=n.n(P),T=n("IW7priiX"),E=n.n(T),f=n("Mx+G+HdB"),C=n.n(f),B=n("Dg7SLLbb"),p=n.n(B),A=n("/GOzvPf6"),t=n("uZqmR+ju"),r=n("d4kzUuQm"),i=n("1LOzeRr1"),s=n("djwd899R"),m=n("kHvj/lAD");const Ce=()=>{const l=a=>`\${sidecar.${a}}`;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),"  "))))))};var ve=n("JnTtTRmZ"),q=n.n(ve),Se=n("wXrUUKFq"),Me=n.n(Se),L=n("MdYBRjRJ"),$=n("jAGDuYSC"),N=n("eFxcQyPT"),k=n("IA3Ku5lS");const b=(0,k.ei)("core.ConfigurationVariable",()=>q().createActions({all:{asyncResult:!0},save:{asyncResult:!0},delete:{asyncResult:!0},validate:{asyncResult:!0},getConfigurations:{asyncResult:!0}})),At=(0,k.dS)("core.ConfigurationVariable",()=>q().createStore({listenables:[b],sourceUrl:"/sidecar/configuration_variables",all(){const l=(0,N.ZP)("GET",L.DC(this.sourceUrl));l.catch(a=>{$.Z.error(`Fetching configuration variables failed with status: ${a}`,"Could not retrieve configuration variables")}),b.all.promise(l)},save(l){const a={id:l.id,name:l.name,description:l.description,content:l.content};let o=L.DC(`${this.sourceUrl}`),u,h;l.id===""?(u="POST",h="created"):(o+=`/${l.id}`,u="PUT",h="updated");const v=(0,N.ZP)(u,o,a);v.then(()=>{$.Z.success(`Configuration variable "${l.name}" successfully ${h}`)},M=>{$.Z.error(`Saving variable "${l.name}" failed with status: ${M.message}`,"Could not save variable")}),b.save.promise(v)},getConfigurations(l){const a=L.DC(`${this.sourceUrl}/${l.id}/configurations`),o=(0,N.ZP)("GET",a);o.catch(u=>{$.Z.error(`Fetching configurations for this variable failed with status: ${u}`)}),b.getConfigurations.promise(o)},delete(l){const a=L.DC(`${this.sourceUrl}/${l.id}`),o=(0,N.ZP)("DELETE",a);o.then(()=>{$.Z.success(`Configuration variable "${l.name}" successfully deleted`)},u=>{$.Z.error(`Deleting variable "${l.name}" failed with status: ${u.message}`,"Could not delete variable")}),b.delete.promise(o)},validate(l){const a={id:" ",name:" ",content:" "};Me()(a,l);const o=(0,N.ZP)("POST",L.DC(`${this.sourceUrl}/validate`),a);o.catch(u=>{$.Z.error(`Validating variable "${l.name}" failed with status: ${u.message}`,"Could not validate variable")}),b.validate.promise(o)}}));var ye=n("dFpwyWHg"),Ae=n.n(ye),De=n("C2ikvoS0"),Pe=n.n(De),_e=n("1IntWRSu"),Te=n.n(_e),Re=n("8nGWeFnd"),be=n.n(Re),Ie=n("TeAcaicX"),Ue=n.n(Ie),Be=n("eE3+5goe"),Oe=n.n(Be),K=n("u/saNNwg"),x={};x.styleTagTransform=Oe(),x.setAttributes=be(),x.insert=Te().bind(null,"head"),x.domAPI=Pe(),x.insertStyleElement=Ue();var Dt=Ae()(K.Z,x);const Z=K.Z&&K.Z.locals?K.Z.locals:void 0;var $e=Object.defineProperty,Ze=(l,a,o)=>a in l?$e(l,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):l[a]=o,D=(l,a,o)=>(Ze(l,typeof a!="symbol"?a+"":a,o),o);class Y extends e.Component{constructor(a){super(a),D(this,"_cleanState",()=>{const{name:o,id:u,description:h,content:v}=this.props;return{showModal:!1,error:!1,validation_errors:{},savedName:o,formData:{id:u,name:o,description:h,content:v}}}),D(this,"_hasErrors",()=>{const{error:o}=this.state;return o}),D(this,"openModal",()=>{this.setState({...this._cleanState(),showModal:!0})}),D(this,"closeModal",()=>{this.setState(this._cleanState())}),D(this,"_getId",o=>{const{id:u}=this.state;return`${o} ${u}`||"new"}),D(this,"_saved",()=>{this.setState({showModal:!1})}),D(this,"_validateFormData",o=>{b.validate(o).then(u=>{this.setState({validation_errors:u.errors,error:u.failed})})}),D(this,"_debouncedValidateFormData",C()(this._validateFormData,200)),D(this,"_formDataUpdate",o=>{const{formData:u}=this.state;return h=>{const v=E()(u);v[o]=h,this._debouncedValidateFormData(v),this.setState({formData:v})}}),D(this,"_save",()=>{const{formData:o,savedName:u}=this.state,{saveConfigurationVariable:h}=this.props;if(this._hasErrors()){this._validateFormData(o);return}h(o,u,this._saved)}),D(this,"_handleInputChange",o=>{this._formDataUpdate(o.target.name)(o.target.value)}),D(this,"_formatValidationMessage",(o,u)=>{const{validation_errors:h}=this.state;return h[o]?e.createElement("span",null,h[o][0]):e.createElement("span",null,u)}),D(this,"_validationState",o=>{const{validation_errors:u}=this.state;return u[o]?"error":null}),this.state=this._cleanState()}render(){const{create:a}=this.props,{formData:o,showModal:u}=this.state;let h;return a?h="Create Variable":h=e.createElement("span",null,"Edit"),e.createElement(e.Fragment,null,e.createElement(t.Button,{onClick:this.openModal,bsStyle:a?"success":"info",bsSize:a?"small":"xsmall",className:a?"pull-right":""},h),e.createElement(t.BootstrapModalForm,{show:u,title:e.createElement(e.Fragment,null,a?"Create":"Edit"," Variable ${user.",o.name,"}"),"data-telemetry-title":`${a?"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:Z.monoSpaceFont,defaultValue:o.content,onChange:this._handleInputChange,bsStyle:this._validationState("content"),help:this._formatValidationMessage("content","Write your variable content"),spellCheck:!1,required:!0}))))}}D(Y,"propTypes",{create:d().bool,id:d().string,name:d().string,description:d().string,content:d().string,saveConfigurationVariable:d().func.isRequired}),D(Y,"defaultProps",{create:!1,id:"",name:"",description:"",content:""});const ee=Y;var Fe=Object.defineProperty,we=(l,a,o)=>a in l?Fe(l,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):l[a]=o,I=(l,a,o)=>(we(l,typeof a!="symbol"?a+"":a,o),o);const xe=l=>e.createElement("ul",{className:Z.ulStyle},l.map(a=>e.createElement("li",{key:a.id},e.createElement("a",{href:r.ZP.SYSTEM.SIDECARS.EDIT_CONFIGURATION(a.id)},a.name))));class te extends e.Component{constructor(a){super(a),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(u=>{u.length>0?(this.setState({errorModalContent:xe(u)}),this._openErrorModal()):this._openErrorConfirmModal()})}),I(this,"_configurationVariableListBuilder",()=>{const o=[],{configurationVariables:u}=this.state;return Object.values(u).forEach(h=>{const v=`\${user.${h.name}}`;o.push(e.createElement("tr",{key:h.id},e.createElement("td",null,e.createElement("code",null,v)),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(ee,{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,u,h)=>{const{onVariableRename:v}=this.props;b.save.triggerPromise(o).then(()=>this._onSuccessfulUpdate(()=>{v(u,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(A.$j,null);const{variableToDelete:a,errorModalContent:o,showModal:u,showConfirmModal:h}=this.state;return e.createElement("div",null,e.createElement(ee,{create:!0,saveConfigurationVariable:this._saveConfigurationVariable}),e.createElement("div",{className:"clearfix"}),e.createElement("div",{className:`table-responsive ${Z.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:Z.actionsColumn},"Actions"))),e.createElement("tbody",null,this._configurationVariableListBuilder()))),e.createElement(t.BootstrapModalWrapper,{showModal:u,onHide:this._closeErrorModal},e.createElement(t.Modal.Header,null,e.createElement(t.Modal.Title,null,"Error deleting configuration variable ",e.createElement("strong",null,"${user.",a.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,a.name),"?")))}}I(te,"propTypes",{onVariableRename:d().func.isRequired});const Le=te;var Ne=Object.defineProperty,Ve=(l,a,o)=>a in l?Ne(l,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):l[a]=o,oe=(l,a,o)=>(Ve(l,typeof a!="symbol"?a+"":a,o),o);class ae extends e.Component{constructor(){super(...arguments),oe(this,"_getId",(a,o)=>{const u=o!==void 0?`. ${o}`:"";return a+u})}render(){const{onVariableRename:a}=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:Z.marginQuickReferenceText},"These variables will be filled with the runtime information from each Sidecar"),e.createElement(Ce,null)),e.createElement(t.Tab,{eventKey:2,title:"Variables"},e.createElement("p",{className:Z.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(Le,{onVariableRename:a})),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:Z.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:Z.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")," ")))))))))}}oe(ae,"propTypes",{onVariableRename:d().func.isRequired});const We=ae;var Ke=n("/7OuCFNo"),He=n("8OvTct/Z"),je=n("v4GbOr/o"),ze=n("+KM7MH1U"),ne=n.n(ze),Ge=Object.defineProperty,Ye=(l,a,o)=>a in l?Ge(l,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):l[a]=o,V=(l,a,o)=>(Ye(l,typeof a!="symbol"?a+"":a,o),o);const H=class G extends e.Component{constructor(a){super(a),V(this,"resetState",()=>{this.setState(G.initialState)}),V(this,"_loadConfiguration",()=>{!this.props.templateString&&!this.props.configurationId||(this.props.templateString?s.Z.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.Z.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=G.initialState}componentDidUpdate(a){!ne()(this.state,G.initialState)&&!ne()(a,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")))}};V(H,"propTypes",{configurationId:d().string,templateString:d().string,showModal:d().bool.isRequired,onHide:d().func.isRequired}),V(H,"defaultProps",{configurationId:void 0,templateString:void 0}),V(H,"initialState",{source:void 0,name:void 0});const Je=H;var Xe=n("gqVHlIxA"),Qe=Object.defineProperty,qe=(l,a,o)=>a in l?Qe(l,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):l[a]=o,w=(l,a,o)=>(qe(l,typeof a!="symbol"?a+"":a,o),o);const J=class Ee extends e.Component{constructor(a){super(a),w(this,"PAGE_SIZE",10),w(this,"_isLoading",()=>!this.state.uploads),w(this,"_loadUploads",o=>{s.Z.listUploads({page:o}).then(u=>{this.setState({uploads:u.uploads,totalUploads:u.total})},u=>{this.setState({uploads:[],totalUploads:0}),$.Z.error(`Fetching uploads failed with error: ${u}`,"Could not get configuration uploads")})}),w(this,"_onApplyButton",o=>{this.props.onApply(o)}),w(this,"_buildVariableName",o=>`\${sidecar.${o}}`),this.state=Ee.initialState}componentDidUpdate(){this.props.showModal&&this._loadUploads(this.state.pagination.page)}_formatUpload(a){const o=e.createElement(t.Tooltip,{id:`${a.id}-status-tooltip`},a.collector_id);return e.createElement("tr",{key:a.id},e.createElement("td",null,e.createElement(A.Ox,{placement:"top",overlay:o,rootClose:!0},e.createElement("span",null,a.node_id))),e.createElement("td",null,a.collector_name),e.createElement("td",null,e.createElement(A.EK,{dateTime:a.created})),e.createElement("td",null,e.createElement(t.Button,{bsStyle:"info",bsSize:"xsmall",onClick:()=>this._onApplyButton(a.rendered_configuration)},"Apply")))}_formatModalBody(){if(this._isLoading())return e.createElement(A.$j,null);const a=this.PAGE_SIZE,{uploads:o,totalUploads:u}=this.state,h=o.map(v=>this._formatUpload(v));return u===0?e.createElement(t.Alert,{bsStyle:"info"},"There are no configuration uploads available. Please go to",e.createElement("strong",null,"System -> Collectors (legacy) -> Details -> Import Configuration")," and import your first configuration. You need at least Sidecar version 0.1.8 to make this feature available."):e.createElement(A.l9,{totalItems:u,pageSize:a,showPageSizeSelect:!1,onChange:this._loadUploads,useQueryParameter:!1},e.createElement("table",{className:"table"},e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",null,"Sidecar"),e.createElement("th",null,"Collector"),e.createElement("th",null,"Created"),e.createElement("th",null,"Action"))),e.createElement("tbody",null,h)))}render(){return e.createElement(Xe.Z,{showModal:this.props.showModal,onHide:this.props.onHide,bsSize:"large"},e.createElement(t.Modal.Header,{closeButton:!0},e.createElement(t.Modal.Title,null,e.createElement("span",null,"Imports from the old Collector system")),"Edit the imported configuration after pressing the Apply button by hand. Dynamic values like the node ID can be replaced with the variables system, e.g. ",e.createElement("code",null,this._buildVariableName("nodeId"))),e.createElement(t.Modal.Body,null,this._formatModalBody()),e.createElement(t.Modal.Footer,null,e.createElement(t.Button,{type:"button",onClick:this.props.onHide},"Close")))}};w(J,"propTypes",{onApply:d().func.isRequired,showModal:d().bool.isRequired,onHide:d().func.isRequired}),w(J,"initialState",{uploads:void 0,totalUploads:0,pagination:{page:1}});const ke=J;var et=n("kTp6yg80");const re=({tags:l,availableTags:a,onChange:o})=>{const u=l.join(","),h=a.map(v=>({value:v.name,label:v.name}));return e.createElement(et.Z,{options:h,value:u,onChange:o,placeholder:"Choose tags...",allowCreate:!0})};re.propTypes={tags:d().arrayOf(d().string).isRequired,availableTags:d().array.isRequired,onChange:d().func.isRequired};const tt=re,X=({action:l,configuration:a,configurationSidecars:o})=>{const u={id:a.id,name:a.name,color:a.color,collector_id:a.collector_id,template:a.template||"",tags:a.tags||[]},[h,v]=(0,e.useState)([]),[M,le]=(0,e.useState)(u),[at,nt]=(0,e.useState)(!1),[Q,rt]=(0,e.useState)({}),[lt,se]=(0,e.useState)(!1),[st,it]=(0,e.useState)(!1),ie=(0,e.useRef)({}),ce=(0,Ke.Z)(),ct=(0,He.Z)();(0,e.useEffect)(()=>{m.v.all().then(c=>v(c.collectors))},[]);const ue=c=>c!==void 0&&c!=="",de=()=>at||!ue(M.template),me=(c,g)=>{s.Z.validate(c).then(y=>{const F=_()(y);g&&!ue(c.template)&&(F.errors.template=["Please fill out the configuration field."],F.failed=!0),rt(F.errors),nt(F.failed)})},ut=async()=>{const c=l==="create";if(ct(je.A.SIDECARS[`CONFIGURATION_${c?"CREATED":"UPDATED"}`],{app_pathname:"sidecars",app_section:"configuration"}),de()){me(M,!0);return}let g;c?g=s.Z.createConfiguration(M).then(()=>ce.push(r.ZP.SYSTEM.SIDECARS.CONFIGURATION)):g=s.Z.updateConfiguration(M),await g},pe=C()(me,200),j=c=>(g,y,F)=>{const W=E()(M);W[c]=g,pe(W,!1),le(W),F&&F()},z=c=>{j("template")(c)},dt=(c,g)=>{if(c===""||c===g)return;const y=M.template.split(`\${user.${c}}`).join(`\${user.${g}}`);z(y)},mt=c=>{const g=c.target.value;j("name")(g)},pt=c=>{const g=c.split(",");j("tags")(g)},ht=c=>{const g=ie.current[c];return g!==void 0?new Promise(y=>y(g)):m.v.getCollector(c).then(y=>(ie.current[c]=y.default_template,y.default_template))},gt=async c=>{const g=await ht(c),y=E()(M);y.collector_id=c,(!y.template||window.confirm("Do you want to use the default template for the selected Configuration?"))&&(z(g),y.template=g),pe(y,!0),le(y)},ft=c=>{(!E()(M).template||window.confirm("Do you want to overwrite your current work with this Configuration?"))&&z(c)},Et=c=>{c.preventDefault(),ut()},Ct=()=>{ce.goBack()},vt=()=>{se(!0)},he=c=>c?`${c.name} on ${p()(c.node_operating_system)}`:"Unknown collector",St=()=>{const c=[];return h?h.forEach(g=>{c.push({value:g.id,label:he(g)})}):c.push({value:"none",label:"Loading collector list...",disable:!0}),c},ge=(c,g)=>Q[c]?e.createElement("span",null,Q[c][0]):e.createElement("span",null,g),fe=c=>Q[c]?"error":null,Mt=(c,g,y)=>{if(y.sidecar_ids&&y.sidecar_ids.length>0){const W=g?g.find(yt=>yt.id===c):void 0;return e.createElement("span",null,e.createElement(t.FormControl.Static,null,he(W)),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(A.Ph,{inputId:"collector_id",options:St(),value:c,onChange:gt,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:Et},e.createElement("fieldset",null,e.createElement(t.Input,{type:"text",id:"name",label:"Name",onChange:mt,bsStyle:fe("name"),help:ge("name","Required. Name for this configuration"),value:M.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.Z,{color:M.color}),e.createElement("div",{style:{display:"inline-block",marginLeft:15}},e.createElement(A.h4,{id:"color",placement:"right",color:M.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(tt,{availableTags:M.tags.map(c=>({name:c})),tags:M.tags,onChange:pt})),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"),Mt(M.collector_id,h,o)),e.createElement(t.FormGroup,{controlId:"template",validationState:fe("template")},e.createElement(t.ControlLabel,null,"Configuration"),e.createElement(A.KB,{id:"template",height:400,value:M.template||"",onChange:z}),e.createElement(t.Button,{className:"pull-right",bsStyle:"link",bsSize:"sm",onClick:vt},"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(A.Ow,{submitButtonText:`${l==="create"?"Create":"Update"} configuration`,disabledSubmit:de(),onCancel:Ct})))),e.createElement(Je,{showModal:lt,onHide:()=>se(!1),templateString:M.template}),e.createElement(ke,{showModal:st,onHide:()=>it(!1),onApply:ft}))),e.createElement(t.Col,{md:6},e.createElement(We,{onVariableRename:dt})))};X.propTypes={action:d().oneOf(["create","edit"]),configuration:d().shape({id:d().string.isRequired,name:d().string.isRequired,color:d().string.isRequired,collector_id:d().string.isRequired,template:d().string.isRequired,tags:d().array.isRequired}),configurationSidecars:d().object},X.defaultProps={action:"edit",configuration:{id:"",name:"",collector_id:"",template:"",color:"#FFFFFF",tags:[]},configurationSidecars:{}};const ot=X},djwd899R:(O,R,n)=>{"use strict";n.d(R,{Z:()=>p,m:()=>A});var S=n("JnTtTRmZ"),d=n.n(S),e=n("oCSEoDew"),P=n.n(e),_=n("wXrUUKFq"),T=n.n(_),E=n("MdYBRjRJ"),f=n("jAGDuYSC"),C=n("eFxcQyPT"),B=n("IA3Ku5lS");const p=(0,B.ei)("core.CollectorConfigurations",()=>d().createActions({all:{asyncResult:!0},list:{asyncResult:!0},listUploads:{asyncResult:!0},getConfiguration:{asyncResult:!0},getConfigurationSidecars:{asyncResult:!0},getUploads:{asyncResult:!0},createConfiguration:{asyncResult:!0},updateConfiguration:{asyncResult:!0},renderPreview:{asyncResult:!0},copyConfiguration:{asyncResult:!0},delete:{asyncResult:!0},validate:{asyncResult:!0}})),A=(0,B.dS)("core.CollectorConfigurations",()=>d().createStore({listenables:[p],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},U=P()(s).search(m).toString();return(0,C.ZP)("GET",E.DC(U))},_fetchUploads({page:t}){const r=`${this.sourceUrl}/configurations/uploads`,i={page:t},s=P()(r).search(i).toString();return(0,C.ZP)("GET",E.DC(s))},all(){const t=this._fetchConfigurations({pageSize:0});t.then(r=>(this.configurations=r.configurations,this.propagateChanges(),r.configurations),r=>{f.Z.error(`Fetching collector configurations failed with status: ${r}`,"Could not retrieve configurations")}),p.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=>{f.Z.error(`Fetching collector configurations failed with status: ${m}`,"Could not retrieve configurations")}),p.list.promise(s)},listUploads({page:t=1}){const r=this._fetchUploads({page:t});r.catch(i=>{f.Z.error(`Fetching configuration uploads failed with status: ${i}`,"Could not retrieve configurations")}),p.listUploads.promise(r)},refreshList(){this.list({query:this.query,page:this.page,pageSize:this.pageSize})},getConfiguration(t){const r=(0,C.ZP)("GET",E.DC(`${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.`),f.Z.error(s,"Could not retrieve Configuration")}),p.getConfiguration.promise(r)},getConfigurationSidecars(t){const r=(0,C.ZP)("GET",E.DC(`${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.`),f.Z.error(s,"Could not retrieve Configuration")}),p.getConfigurationSidecars.promise(r)},renderPreview(t){const r={template:t},i=(0,C.ZP)("POST",E.DC(`${this.sourceUrl}/configurations/render/preview`),r);i.catch(s=>{f.Z.error(`Fetching configuration preview failed with status: ${s}`,"Could not retrieve preview")}),p.renderPreview.promise(i)},createConfiguration(t){const r=E.DC(`${this.sourceUrl}/configurations`),i="POST",s=(0,C.ZP)(i,r,t);s.then(m=>(f.Z.success("","Configuration successfully created"),m),m=>{f.Z.error(m.status===400?m.responseMessage:`Creating configuration failed with status: ${m.message}`,"Could not save configuration")}),p.createConfiguration.promise(s)},updateConfiguration(t){const r=E.DC(`${this.sourceUrl}/configurations/${t.id}`),i=(0,C.ZP)("PUT",r,t);i.then(s=>(f.Z.success("","Configuration successfully updated"),this.refreshList(),s),s=>{f.Z.error(`Updating Configuration failed: ${s.status===400?s.responseMessage:s.message}`,`Could not update Configuration ${t.name}`)}),p.updateConfiguration.promise(i)},copyConfiguration(t,r){const i=E.DC(`${this.sourceUrl}/configurations/${t}/${r}`),s="POST",m=(0,C.ZP)(s,i);m.then(U=>(f.Z.success("",`Configuration "${r}" successfully copied`),this.refreshList(),U),U=>{f.Z.error(`Saving configuration "${r}" failed with status: ${U.message}`,"Could not save Configuration")}),p.copyConfiguration.promise(m)},delete(t){const r=E.DC(`${this.sourceUrl}/configurations/${t.id}`),i=(0,C.ZP)("DELETE",r);i.then(s=>(f.Z.success("",`Configuration "${t.name}" successfully deleted`),this.refreshList(),s),s=>{f.Z.error(`Deleting Configuration failed: ${s.status===400?s.responseMessage:s.message}`,`Could not delete Configuration ${t.name}`)}),p.delete.promise(i)},validate(t){const r={name:" ",collector_id:" ",color:" ",template:" "};T()(r,t);const i=(0,C.ZP)("POST",E.DC(`${this.sourceUrl}/configurations/validate`),r);i.then(s=>s,s=>f.Z.error(`Validating configuration "${r.name}" failed with status: ${s.message}`,"Could not validate configuration")),p.validate.promise(i)}}))},"kHvj/lAD":(O,R,n)=>{"use strict";n.d(R,{d:()=>A,v:()=>p});var S=n("JnTtTRmZ"),d=n.n(S),e=n("oCSEoDew"),P=n.n(e),_=n("wXrUUKFq"),T=n.n(_),E=n("MdYBRjRJ"),f=n("eFxcQyPT"),C=n("jAGDuYSC"),B=n("IA3Ku5lS");const p=(0,B.ei)("core.Collectors",()=>d().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}})),A=(0,B.dS)("core.Collectors",()=>d().createStore({listenables:[p],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,f.ZP)("GET",E.DC(`${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.`),C.Z.error(s,"Could not retrieve Collector")}),p.getCollector.promise(r)},_fetchCollectors({query:t,page:r,pageSize:i}){const s={query:t,page:r,per_page:i},m=P()(`${this.sourceUrl}/collectors/summary`).search(s).toString();return(0,f.ZP)("GET",E.DC(m))},all(){const t=this._fetchCollectors({pageSize:0});t.then(r=>(this.collectors=r.collectors,this.propagateChanges(),r.collectors),r=>{C.Z.error(`Fetching collectors failed with status: ${r}`,"Could not retrieve collectors")}),p.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=>{C.Z.error(`Fetching collectors failed with status: ${m}`,"Could not retrieve collectors")}),p.list.promise(s)},refreshList(){this.list({query:this.query,page:this.pagination.page,pageSize:this.pagination.pageSize})},create(t){const r=(0,f.ZP)("POST",E.DC(`${this.sourceUrl}/collectors`),t);r.then(i=>(C.Z.success("","Collector successfully created"),this.collectors=i.collectors,this.propagateChanges(),this.collectors),i=>{C.Z.error(`Fetching collectors failed with status: ${i}`,"Could not retrieve collectors")}),p.create.promise(r)},update(t){const r=(0,f.ZP)("PUT",E.DC(`${this.sourceUrl}/collectors/${t.id}`),t);r.then(i=>(C.Z.success("","Collector successfully updated"),this.collectors=i.collectors,this.propagateChanges(),this.collectors),i=>{C.Z.error(`Fetching collectors failed with status: ${i}`,"Could not retrieve collectors")}),p.update.promise(r)},delete(t){const r=E.DC(`${this.sourceUrl}/collectors/${t.id}`),i=(0,f.ZP)("DELETE",r);i.then(s=>(C.Z.success("",`Collector "${t.name}" successfully deleted`),this.refreshList(),s),s=>{C.Z.error(`Deleting Collector failed: ${s.status===400?s.responseMessage:s.message}`,`Could not delete Collector "${t.name}"`)}),p.delete.promise(i)},copy(t,r){const i=E.DC(`${this.sourceUrl}/collectors/${t}/${r}`),s="POST",m=(0,f.ZP)(s,i);m.then(U=>(C.Z.success("",`Collector "${r}" successfully copied`),this.refreshList(),U),U=>{C.Z.error(`Saving collector "${r}" failed with status: ${U.message}`,"Could not save Collector")}),p.copy.promise(m)},validate(t){const r={id:" ",service_type:"exec",executable_path:" ",default_template:" "};T()(r,t);const i=(0,f.ZP)("POST",E.DC(`${this.sourceUrl}/collectors/validate`),r);i.then(s=>s,s=>C.Z.error(`Validating collector "${r.name}" failed with status: ${s.message}`,"Could not validate collector")),p.validate.promise(i)}}))},VZ0CjfW1:(O,R,n)=>{var S=n("8U3oBBH1"),d=4;function e(P){return S(P,d)}O.exports=e}}]);})();

//# sourceMappingURL=1255d548-7892.bbf0a3663e8e1e6ca414.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy