web-interface.assets.bb8c8232-6242.c2a95ef1ada95f268da4.js Maven / Gradle / Ivy
"use strict";(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["bb8c8232-6242"],{ODdtntEF:(_,h,r)=>{r.r(h),r.d(h,{default:()=>O});var y=r("ii0bleBb"),f=r.n(y),o=r("Z7aTuO5B"),m=r("D4SbLiE/"),A=r.n(m),u=r("JnTtTRmZ"),l=r.n(u),x=r("IOI9nV80"),a=r("rIl5IEuP"),v=r("jAGDuYSC"),P=r("GwgrM4FY"),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:T}=E;P.Z.import(this.props.input.id,T)}catch(E){v.A.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"),g=r("yEuO7gC5");const C=A()({displayName:"ImportExtractorsPage",propTypes:{params:f().object.isRequired},mixins:[l().connect(g.C)],componentDidMount(){const{params:d}=this.props;g.j.get.triggerPromise(d.inputId).then(i=>this.setState({input:i}))},_isLoading(){return!this.state.input},render(){if(this._isLoading())return o.createElement(x.y$,null);const{input:d}=this.state;return o.createElement(x.Qc,{title:`Import extractors to ${d.title}`},o.createElement("div",null,o.createElement(x.zY,{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.A)(C)},c9JM82dZ:(_,h,r)=>{r.d(h,{A:()=>m});var y=r("Z7aTuO5B"),f=r("yAXMqwrl");const m=A=>u=>{const l=(0,f.useParams)();return y.createElement(A,{...u,params:l})}},GwgrM4FY:(_,h,r)=>{r.d(h,{Z:()=>a,v:()=>P});var y=r("JnTtTRmZ"),f=r.n(y),o=r("U1Iufsob"),m=r("eFxcQyPT"),A=r("xS8q27Jr"),u=r("MdYBRjRJ"),l=r("jAGDuYSC"),x=r("IA3Ku5lS");const a=(0,x.rN)("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:{asyncResult:!0}}));function v(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 P=(0,x.Bv)("core.Extractors",()=>f().createStore({listenables:[a],sourceUrl:"/system/inputs/",extractors:void 0,extractor:void 0,getInitialState(){return this.getState()},init(){this.trigger({extractors:this.extractors,extractor:this.extractor})},getState(){return{extractors:this.extractors,extractor:this.extractor}},propagateState(){this.trigger(this.getState())},list(t){const e=(0,m.Ay)("GET",u.H3(u.Tp(this.sourceUrl,t,"extractors")));e.then(s=>{this.extractors=s.extractors,this.propagateState()}),a.list.promise(e)},new(t,e){if(A.A.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.Ay)("GET",u.H3(u.Tp(this.sourceUrl,t,"extractors",e)));s.then(n=>{this.extractor=n,this.propagateState()}),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.H3(o.A.ExtractorsController.create(t).url);return(0,m.Ay)("POST",s,v(e))},create(t,e,s){const n=this._silentExtractorCreate(t,e);return n.then(()=>{l.A.success(`Extractor ${e.title} created successfully`),this.extractor&&a.get.triggerPromise(t,e.id)}).catch(c=>{l.A.error(`Creating extractor failed: ${c}`,"Could not create extractor")}),s||a.create.promise(n),n},update(t,e,s){const n=u.H3(o.A.ExtractorsController.update(t,e.id).url),c=(0,m.Ay)("PUT",n,v(e));return c.then(()=>{l.A.success(`Extractor "${e.title}" updated successfully`),this.extractor&&a.get.triggerPromise(t,e.id)}).catch(p=>{l.A.error(`Updating extractor failed: ${p}`,"Could not update extractor")}),s||a.update.promise(c),c},delete(t,e){const s=u.H3(o.A.ExtractorsController.delete(t,e.id).url),n=(0,m.Ay)("DELETE",s);n.then(()=>{l.A.success(`Extractor "${e.title}" deleted successfully`),this.extractors&&a.list.triggerPromise(t)}).catch(c=>{l.A.error(`Deleting extractor failed: ${c}`,`Could not delete extractor ${e.title}`)}),a.delete.promise(n)},order(t,e){const s=u.H3(o.A.ExtractorsController.order(t).url),n={};e.forEach((p,g)=>{n[g]=p.id});const c=(0,m.Ay)("POST",s,{order:n});c.then(()=>{l.A.success("Extractor positions updated successfully"),this.extractors&&a.list.triggerPromise(t)}),c.catch(p=>{l.A.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 g=this._silentExtractorCreate(t,p);g.then(()=>{s+=1}).catch(()=>{n+=1}),c.push(g)}),Promise.allSettled(c).then(()=>{n===0?(l.A.success(`Import results: ${s} extractor(s) imported.`,"Import operation successful"),this.propagateState()):l.A.warning(`Import results: ${s} extractor(s) imported, ${n} error(s).`,"Import operation completed")})}}))}}]);})();
//# sourceMappingURL=bb8c8232-6242.c2a95ef1ada95f268da4.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy