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

web-interface.assets.e508fb3d-8156.09284ce35628a7b40ed7.js Maven / Gradle / Ivy

There is a newer version: 6.0.6
Show newest version
"use strict";(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["e508fb3d-8156"],{"xrxrnD+s":(e,t,a)=>{a.d(t,{Z:()=>C});var n=a("ii0bleBb"),o=a.n(n),r=a("Z7aTuO5B"),i=a("D4SbLiE/"),c=a.n(i),s=a("JnTtTRmZ"),l=a.n(s),u=a("nHcjWeCO"),p=a.n(u),f=a("Mygg+ecz"),g=a("Mr++nPjW"),d=a("BSHS2nUH"),h=a("DeVaSktS"),m=a("NVA6hUPo"),v=a("dfn/QTgc");const C=c()({displayName:"CollectorForm",propTypes:{action:o().oneOf(["create","edit"]),collector:o().object},mixins:[l().connect(v.d)],getDefaultProps:function(){return{action:"edit",collector:{default_template:""}}},getInitialState:function(){var e=this.props.collector;return{error:!1,validation_errors:{},formData:{id:e.id,name:e.name,service_type:e.service_type,node_operating_system:e.node_operating_system,executable_path:e.executable_path,execute_parameters:e.execute_parameters,validation_parameters:e.validation_parameters,default_template:String(e.default_template)}}},UNSAFE_componentWillMount:function(){this._debouncedValidateFormData=p().debounce(this._validateFormData,200)},componentDidMount:function(){v.v.all(),m.Z.all()},hasErrors:function(){return this.state.error},_save:function(){var e=this.props.action,t=this.state.formData;this.hasErrors()||("create"===e?v.v.create(t).then((function(){return d.Z.push(h.ZP.SYSTEM.SIDECARS.CONFIGURATION)})):v.v.update(t))},_formDataUpdate:function(e){var t=this,a=this.state.formData;return function(n){var o=p().cloneDeep(a);o[e]=n,t._debouncedValidateFormData(o),t.setState({formData:o})}},_validateFormData:function(e){var t=this;e.name&&e.node_operating_system&&v.v.validate(e).then((function(e){return t.setState({validation_errors:e.errors,error:e.failed})}))},_onNameChange:function(e){var t=e.target.value;this._formDataUpdate("name")(t)},_onInputChange:function(e){var t=this;return function(a){t._formDataUpdate(e)(a.target.value)}},_onSubmit:function(e){e.preventDefault(),this._save()},_onCancel:function(){d.Z.goBack()},_formatServiceTypes:function(){var e=[];return e.push({value:"exec",label:"Foreground execution"}),e.push({value:"svc",label:"Windows service"}),e},_formatOperatingSystems:function(){var e=[];return e.push({value:"linux",label:"Linux"}),e.push({value:"windows",label:"Windows"}),e},_formatValidationMessage:function(e,t){var a=this.state.validation_errors;return a[e]?r.createElement("span",null,a[e][0]):r.createElement("span",null,t)},_validationState:function(e){return this.state.validation_errors[e]?"error":null},render:function(){var e=this.props.action,t=this.state.formData,a="",n="";return t.validation_parameters&&(a=t.validation_parameters),t.execute_parameters&&(n=t.execute_parameters),r.createElement("div",null,r.createElement("form",{onSubmit:this._onSubmit},r.createElement("fieldset",null,r.createElement(g.II,{type:"text",id:"name",label:"Name",onChange:this._onNameChange,bsStyle:this._validationState("name"),help:this._formatValidationMessage("name","Name for this collector"),value:t.name||"",autoFocus:!0,required:!0}),r.createElement(g.cw,{controlId:"service_type",validationState:this._validationState("service_type")},r.createElement(g.J$,null,"Process management"),r.createElement(f.Ph,{inputId:"service_type",options:this._formatServiceTypes(),value:t.service_type,onChange:this._formDataUpdate("service_type"),placeholder:"Service Type",required:!0}),r.createElement(g.Qb,null,this._formatValidationMessage("service_type","Choose the service type this collector is meant for."))),r.createElement(g.cw,{controlId:"node_operating_system",validationState:this._validationState("node_operating_system")},r.createElement(g.J$,null,"Operating System"),r.createElement(f.Ph,{inputId:"node_operating_system",options:this._formatOperatingSystems(),value:t.node_operating_system,onChange:this._formDataUpdate("node_operating_system"),placeholder:"Name",required:!0}),r.createElement(g.Qb,null,this._formatValidationMessage("node_operating_system","Choose the operating system this collector is meant for."))),r.createElement(g.II,{type:"text",id:"executablePath",label:"Executable Path",onChange:this._onInputChange("executable_path"),bsStyle:this._validationState("executable_path"),help:this._formatValidationMessage("executable_path","Path to the collector executable"),value:t.executable_path||"",required:!0}),r.createElement(g.II,{type:"text",id:"executeParameters",label:r.createElement("span",null,"Execute Parameters ",r.createElement("small",{className:"text-muted"},"(Optional)")),onChange:this._onInputChange("execute_parameters"),help:r.createElement("span",null,"Parameters the collector is started with.",r.createElement("strong",null," %s will be replaced by the path to the configuration file.")),value:n||""}),r.createElement(g.II,{type:"text",id:"validationParameters",label:r.createElement("span",null,"Parameters for Configuration Validation ",r.createElement("small",{className:"text-muted"},"(Optional)")),onChange:this._onInputChange("validation_parameters"),help:r.createElement("span",null,"Parameters that validate the configuration file. ",r.createElement("strong",null," %s will be replaced by the path to the configuration file.")),value:a||""}),r.createElement(g.cw,{controlId:"defaultTemplate"},r.createElement(g.J$,null,r.createElement("span",null,"Default Template ",r.createElement("small",{className:"text-muted"},"(Optional)"))),r.createElement(f.KB,{id:"template",value:t.default_template||"",onChange:this._formDataUpdate("default_template")}),r.createElement(g.Qb,null,"The default Collector configuration."))),r.createElement(g.X2,null,r.createElement(g.JX,{md:12},r.createElement(g.cw,null,r.createElement(g.Si,null,r.createElement(g.zx,{type:"submit",bsStyle:"primary",disabled:this.hasErrors()},"create"===e?"Create":"Update"),r.createElement(g.zx,{type:"button",onClick:this._onCancel},"create"===e?"Cancel":"Back")))))))}})},NVA6hUPo:(e,t,a)=>{a.d(t,{Z:()=>g,m:()=>d});var n=a("JnTtTRmZ"),o=a.n(n),r=a("oCSEoDew"),i=a.n(r),c=a("nHcjWeCO"),s=a.n(c),l=a("0wQfx7YJ"),u=a("4af3+9mh"),p=a("OqsMdpSm"),f=a("xc00RsLr"),g=(0,f.ei)("core.CollectorConfigurations",(function(){return o().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}})})),d=(0,f.dS)("core.CollectorConfigurations",(function(){return o().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,propagateChanges:function(){this.trigger({configurations:this.configurations,query:this.query,total:this.total,pagination:this.pagination,paginatedConfigurations:this.paginatedConfigurations})},_fetchConfigurations:function(e){var t=e.query,a=e.page,n=e.pageSize,o="".concat(this.sourceUrl,"/configurations"),r={query:t,page:a,per_page:n},c=i()(o).search(r).toString();return(0,p.ZP)("GET",l.DC(c))},_fetchUploads:function(e){var t=e.page,a="".concat(this.sourceUrl,"/configurations/uploads"),n={page:t},o=i()(a).search(n).toString();return(0,p.ZP)("GET",l.DC(o))},all:function(){var e=this,t=this._fetchConfigurations({pageSize:0});t.then((function(t){return e.configurations=t.configurations,e.propagateChanges(),t.configurations}),(function(e){u.Z.error("Fetching collector configurations failed with status: ".concat(e),"Could not retrieve configurations")})),g.all.promise(t)},list:function(e){var t=this,a=e.query,n=void 0===a?"":a,o=e.page,r=void 0===o?1:o,i=e.pageSize,c=void 0===i?10:i,s=this._fetchConfigurations({query:n,page:r,pageSize:c});s.then((function(e){return t.query=e.query,t.pagination={page:e.pagination.page,pageSize:e.pagination.per_page,total:e.pagination.total},t.total=e.total,t.paginatedConfigurations=e.configurations,t.propagateChanges(),e.configurations}),(function(e){u.Z.error("Fetching collector configurations failed with status: ".concat(e),"Could not retrieve configurations")})),g.list.promise(s)},listUploads:function(e){var t=e.page,a=void 0===t?1:t,n=this._fetchUploads({page:a});n.catch((function(e){u.Z.error("Fetching configuration uploads failed with status: ".concat(e),"Could not retrieve configurations")})),g.listUploads.promise(n)},refreshList:function(){this.list({query:this.query,page:this.page,pageSize:this.pageSize})},getConfiguration:function(e){var t=(0,p.ZP)("GET",l.DC("".concat(this.sourceUrl,"/configurations/").concat(e)));t.catch((function(t){var a="Fetching Configuration failed with status: ".concat(t);404===t.status&&(a="Unable to find a Configuration with ID <".concat(e,">, please ensure it was not deleted.")),u.Z.error(a,"Could not retrieve Configuration")})),g.getConfiguration.promise(t)},getConfigurationSidecars:function(e){var t=(0,p.ZP)("GET",l.DC("".concat(this.sourceUrl,"/configurations/").concat(e,"/sidecars")));t.catch((function(t){var a="Fetching Configuration failed with status: ".concat(t);404===t.status&&(a="Unable to find a Configuration with ID <".concat(e,">, please ensure it was not deleted.")),u.Z.error(a,"Could not retrieve Configuration")})),g.getConfigurationSidecars.promise(t)},renderPreview:function(e){var t={template:e},a=(0,p.ZP)("POST",l.DC("".concat(this.sourceUrl,"/configurations/render/preview")),t);a.catch((function(e){u.Z.error("Fetching configuration preview failed with status: ".concat(e),"Could not retrieve preview")})),g.renderPreview.promise(a)},createConfiguration:function(e){var t=l.DC("".concat(this.sourceUrl,"/configurations")),a=(0,p.ZP)("POST",t,e);a.then((function(e){return u.Z.success("","Configuration successfully created"),e}),(function(e){u.Z.error(400===e.status?e.responseMessage:"Creating configuration failed with status: ".concat(e.message),"Could not save configuration")})),g.createConfiguration.promise(a)},updateConfiguration:function(e){var t=this,a=l.DC("".concat(this.sourceUrl,"/configurations/").concat(e.id)),n=(0,p.ZP)("PUT",a,e);n.then((function(e){return u.Z.success("","Configuration successfully updated"),t.refreshList(),e}),(function(t){u.Z.error("Updating Configuration failed: ".concat(400===t.status?t.responseMessage:t.message),"Could not update Configuration ".concat(e.name))})),g.updateConfiguration.promise(n)},copyConfiguration:function(e,t){var a=this,n=l.DC("".concat(this.sourceUrl,"/configurations/").concat(e,"/").concat(t)),o=(0,p.ZP)("POST",n);o.then((function(e){return u.Z.success("",'Configuration "'.concat(t,'" successfully copied')),a.refreshList(),e}),(function(e){u.Z.error('Saving configuration "'.concat(t,'" failed with status: ').concat(e.message),"Could not save Configuration")})),g.copyConfiguration.promise(o)},delete:function(e){var t=this,a=l.DC("".concat(this.sourceUrl,"/configurations/").concat(e.id)),n=(0,p.ZP)("DELETE",a);n.then((function(a){return u.Z.success("",'Configuration "'.concat(e.name,'" successfully deleted')),t.refreshList(),a}),(function(t){u.Z.error("Deleting Configuration failed: ".concat(400===t.status?t.responseMessage:t.message),"Could not delete Configuration ".concat(e.name))})),g.delete.promise(n)},validate:function(e){var t={name:" ",collector_id:" ",color:" ",template:" "};s().merge(t,e);var a=(0,p.ZP)("POST",l.DC("".concat(this.sourceUrl,"/configurations/validate")),t);a.then((function(e){return e}),(function(e){return u.Z.error('Validating configuration "'.concat(t.name,'" failed with status: ').concat(e.message),"Could not validate configuration")})),g.validate.promise(a)}})}))},"dfn/QTgc":(e,t,a)=>{a.d(t,{v:()=>g,d:()=>d});var n=a("JnTtTRmZ"),o=a.n(n),r=a("oCSEoDew"),i=a.n(r),c=a("nHcjWeCO"),s=a.n(c),l=a("0wQfx7YJ"),u=a("OqsMdpSm"),p=a("4af3+9mh"),f=a("xc00RsLr"),g=(0,f.ei)("core.Collectors",(function(){return o().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}})})),d=(0,f.dS)("core.Collectors",(function(){return o().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:function(){return{collectors:this.collectors}},propagateChanges:function(){this.trigger({collectors:this.collectors,paginatedCollectors:this.paginatedCollectors,query:this.query,total:this.total,pagination:this.pagination})},getCollector:function(e){var t=(0,u.ZP)("GET",l.DC("".concat(this.sourceUrl,"/collectors/").concat(e)));t.catch((function(t){var a="Fetching Collector failed with status: ".concat(t);404===t.status&&(a="Unable to find a collector with ID <".concat(e,">, please ensure it was not deleted.")),p.Z.error(a,"Could not retrieve Collector")})),g.getCollector.promise(t)},_fetchCollectors:function(e){var t={query:e.query,page:e.page,per_page:e.pageSize},a=i()("".concat(this.sourceUrl,"/collectors/summary")).search(t).toString();return(0,u.ZP)("GET",l.DC(a))},all:function(){var e=this,t=this._fetchCollectors({pageSize:0});t.then((function(t){return e.collectors=t.collectors,e.propagateChanges(),t.collectors}),(function(e){p.Z.error("Fetching collectors failed with status: ".concat(e),"Could not retrieve collectors")})),g.all.promise(t)},list:function(e){var t=this,a=e.query,n=void 0===a?"":a,o=e.page,r=void 0===o?1:o,i=e.pageSize,c=void 0===i?10:i,s=this._fetchCollectors({query:n,page:r,pageSize:c});s.then((function(e){return t.query=e.query,t.pagination={page:e.pagination.page,pageSize:e.pagination.per_page,total:e.pagination.total},t.total=e.total,t.paginatedCollectors=e.collectors,t.propagateChanges(),e.collectors}),(function(e){p.Z.error("Fetching collectors failed with status: ".concat(e),"Could not retrieve collectors")})),g.list.promise(s)},refreshList:function(){this.list({query:this.query,page:this.pagination.page,pageSize:this.pagination.pageSize})},create:function(e){var t=this,a=(0,u.ZP)("POST",l.DC("".concat(this.sourceUrl,"/collectors")),e);a.then((function(e){return p.Z.success("","Collector successfully created"),t.collectors=e.collectors,t.propagateChanges(),t.collectors}),(function(e){p.Z.error("Fetching collectors failed with status: ".concat(e),"Could not retrieve collectors")})),g.create.promise(a)},update:function(e){var t=this,a=(0,u.ZP)("PUT",l.DC("".concat(this.sourceUrl,"/collectors/").concat(e.id)),e);a.then((function(e){return p.Z.success("","Collector successfully updated"),t.collectors=e.collectors,t.propagateChanges(),t.collectors}),(function(e){p.Z.error("Fetching collectors failed with status: ".concat(e),"Could not retrieve collectors")})),g.update.promise(a)},delete:function(e){var t=this,a=l.DC("".concat(this.sourceUrl,"/collectors/").concat(e.id)),n=(0,u.ZP)("DELETE",a);n.then((function(a){return p.Z.success("",'Collector "'.concat(e.name,'" successfully deleted')),t.refreshList(),a}),(function(t){p.Z.error("Deleting Collector failed: ".concat(400===t.status?t.responseMessage:t.message),'Could not delete Collector "'.concat(e.name,'"'))})),g.delete.promise(n)},copy:function(e,t){var a=this,n=l.DC("".concat(this.sourceUrl,"/collectors/").concat(e,"/").concat(t)),o=(0,u.ZP)("POST",n);o.then((function(e){return p.Z.success("",'Collector "'.concat(t,'" successfully copied')),a.refreshList(),e}),(function(e){p.Z.error('Saving collector "'.concat(t,'" failed with status: ').concat(e.message),"Could not save Collector")})),g.copy.promise(o)},validate:function(e){var t={id:" ",service_type:"exec",executable_path:" ",default_template:" "};s().merge(t,e);var a=(0,u.ZP)("POST",l.DC("".concat(this.sourceUrl,"/collectors/validate")),t);a.then((function(e){return e}),(function(e){return p.Z.error('Validating collector "'.concat(t.name,'" failed with status: ').concat(e.message),"Could not validate collector")})),g.validate.promise(a)}})}))}}]);
//# sourceMappingURL=e508fb3d-8156.09284ce35628a7b40ed7.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy