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

web-interface.assets.1255d548-7644.700d87c9dc4bd7b53225.js Maven / Gradle / Ivy

There is a newer version: 6.1.4
Show newest version
"use strict";(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["1255d548-7644"],{ODdtntEF:(_,g,r)=>{r.r(g),r.d(g,{default:()=>O});var P=r("ii0bleBb"),f=r.n(P),o=r("Z7aTuO5B"),m=r("D4SbLiE/"),v=r.n(m),u=r("JnTtTRmZ"),l=r.n(u),x=r("/GOzvPf6"),a=r("uZqmR+ju"),C=r("jAGDuYSC"),y=r("8UzJguce"),t=Object.defineProperty,e=(d,i,E)=>i in d?t(d,i,{enumerable:!0,configurable:!0,writable:!0,value:E}):d[i]=E,s=(d,i,E)=>(e(d,typeof i!="symbol"?i+"":i,E),E);class n extends o.Component{constructor(){super(...arguments),s(this,"_onSubmit",i=>{i.preventDefault();try{const E=JSON.parse(this.extractorsInput.getValue()),{extractors:R}=E;y.e.import(this.props.input.id,R)}catch(E){C.Z.error(`There was an error while parsing extractors. Are they in JSON format? ${E}`,"Could not import extractors")}})}render(){return o.createElement(a.Row,{className:"content"},o.createElement(a.Col,{md:12},o.createElement(a.Row,null,o.createElement(a.Col,{md:12},o.createElement("h2",null,"Extractors JSON"))),o.createElement(a.Row,null,o.createElement(a.Col,{md:12},o.createElement("form",{onSubmit:this._onSubmit},o.createElement(a.Input,{type:"textarea",ref:i=>{this.extractorsInput=i},id:"extractor-export-textarea",rows:30}),o.createElement(a.Button,{type:"submit",bsStyle:"success"},"Add extractors to input"))))))}}s(n,"propTypes",{input:f().object.isRequired});const c=n;var p=r("c9JM82dZ"),h=r("yEuO7gC5");const D=v()({displayName:"ImportExtractorsPage",propTypes:{params:f().object.isRequired},mixins:[l().connect(h.Q)],componentDidMount(){const{params:d}=this.props;h.x.get.triggerPromise(d.inputId).then(i=>this.setState({input:i}))},_isLoading(){return!this.state.input},render(){if(this._isLoading())return o.createElement(x.$j,null);const{input:d}=this.state;return o.createElement(x.$4,{title:`Import extractors to ${d.title}`},o.createElement("div",null,o.createElement(x.mr,{title:o.createElement("span",null,"Import extractors to ",o.createElement("em",null,d.title))},o.createElement("span",null,"Exported extractors can be imported to an input. All you need is the JSON export of extractors from any other Graylog setup or from"," ",o.createElement("a",{href:"https://marketplace.graylog.org/",rel:"noopener noreferrer",target:"_blank"},"the Graylog Marketplace"),".")),o.createElement(c,{input:d})))}}),O=(0,p.Z)(D)},c9JM82dZ:(_,g,r)=>{r.d(g,{Z:()=>m});var P=r("Z7aTuO5B"),f=r("yAXMqwrl");const m=v=>u=>{const l=(0,f.useParams)();return P.createElement(v,{...u,params:l})}},"8UzJguce":(_,g,r)=>{r.d(g,{F:()=>y,e:()=>a});var P=r("JnTtTRmZ"),f=r.n(P),o=r("U1Iufsob"),m=r("eFxcQyPT"),v=r("xS8q27Jr"),u=r("MdYBRjRJ"),l=r("jAGDuYSC"),x=r("IA3Ku5lS");const a=(0,x.ei)("core.Extractors",()=>f().createActions({list:{asyncResult:!0},get:{asyncResult:!0},create:{asyncResult:!0},save:{asyncResult:!0},update:{asyncResult:!0},delete:{asyncResult:!0},order:{asyncResult:!0},import:{}}));function C(t){const e=t.condition_type&&t.condition_type!=="none"?t.condition_value:"";return{title:t.title,cursor_strategy:t.cursor_strategy||"copy",source_field:t.source_field,target_field:t.target_field,extractor_type:t.type||t.extractor_type,extractor_config:t.extractor_config,converters:t.converters,condition_type:t.condition_type||"none",condition_value:e,order:t.order}}const y=(0,x.dS)("core.Extractors",()=>f().createStore({listenables:[a],sourceUrl:"/system/inputs/",extractors:void 0,extractor:void 0,init(){this.trigger({extractors:this.extractors,extractor:this.extractor})},list(t){const e=(0,m.ZP)("GET",u.DC(u.em(this.sourceUrl,t,"extractors")));e.then(s=>{this.extractors=s.extractors,this.trigger({extractors:this.extractors})}),a.list.promise(e)},new(t,e){if(v.Z.EXTRACTOR_TYPES.indexOf(t)===-1)throw new Error(`Invalid extractor type provided: ${t}`);return{type:t,source_field:e,converters:[],extractor_config:{},target_field:""}},get(t,e){const s=(0,m.ZP)("GET",u.DC(u.em(this.sourceUrl,t,"extractors",e)));s.then(n=>{this.extractor=n,this.trigger({extractor:this.extractor})}),a.get.promise(s)},save(t,e){let s;e.id?s=this.update(t,e,!0):s=this.create(t,e,!0),a.save.promise(s)},_silentExtractorCreate(t,e){const s=u.DC(o.Z.ExtractorsController.create(t).url);return(0,m.ZP)("POST",s,C(e))},create(t,e,s){const n=this._silentExtractorCreate(t,e);return n.then(()=>{l.Z.success(`Extractor ${e.title} created successfully`),this.extractor&&a.get.triggerPromise(t,e.id)}).catch(c=>{l.Z.error(`Creating extractor failed: ${c}`,"Could not create extractor")}),s||a.create.promise(n),n},update(t,e,s){const n=u.DC(o.Z.ExtractorsController.update(t,e.id).url),c=(0,m.ZP)("PUT",n,C(e));return c.then(()=>{l.Z.success(`Extractor "${e.title}" updated successfully`),this.extractor&&a.get.triggerPromise(t,e.id)}).catch(p=>{l.Z.error(`Updating extractor failed: ${p}`,"Could not update extractor")}),s||a.update.promise(c),c},delete(t,e){const s=u.DC(o.Z.ExtractorsController.delete(t,e.id).url),n=(0,m.ZP)("DELETE",s);n.then(()=>{l.Z.success(`Extractor "${e.title}" deleted successfully`),this.extractors&&a.list.triggerPromise(t)}).catch(c=>{l.Z.error(`Deleting extractor failed: ${c}`,`Could not delete extractor ${e.title}`)}),a.delete.promise(n)},order(t,e){const s=u.DC(o.Z.ExtractorsController.order(t).url),n={};e.forEach((p,h)=>{n[h]=p.id});const c=(0,m.ZP)("POST",s,{order:n});c.then(()=>{l.Z.success("Extractor positions updated successfully"),this.extractors&&a.list.triggerPromise(t)}),c.catch(p=>{l.Z.error(`Changing extractor positions failed: ${p}`,"Could not update extractor positions")}),a.order.promise(c)},import(t,e){let s=0,n=0;const c=[];e.forEach(p=>{const h=this._silentExtractorCreate(t,p);h.then(()=>{s+=1}).catch(()=>{n+=1}),c.push(h)}),Promise.allSettled(c).then(()=>{n===0?l.Z.success(`Import results: ${s} extractor(s) imported.`,"Import operation successful"):l.Z.warning(`Import results: ${s} extractor(s) imported, ${n} error(s).`,"Import operation completed")})}}))}}]);})();

//# sourceMappingURL=1255d548-7644.700d87c9dc4bd7b53225.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy