web-interface.assets.bb8c8232-1956.e7938ecf4a07dcbf9709.js Maven / Gradle / Ivy
"use strict";(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["bb8c8232-1956"],{"5WTdac/v":(T,E,t)=>{t.r(E),t.d(E,{default:()=>k});var r=t("Z7aTuO5B"),d=t("ii0bleBb"),m=t.n(d),O=t("JnTtTRmZ"),_=t.n(O),D=t("D4SbLiE/"),M=t.n(D),y=t("IW7priiX"),I=t.n(y),v=t("t5bvLtVB"),R=t.n(v),f=t("N6x7vnl1"),B=t("ty2gyrHp"),h=t("d4kzUuQm"),K=t("rIl5IEuP"),g=t("jAGDuYSC"),u=t("IOI9nV80"),L=t("znhYcHoq"),S=t("FhPlv95w"),A=t("PAFhOglk"),U=t("c9JM82dZ"),p=t("FKyXQK1p"),C=t("nPaY1a0P");const W=M()({displayName:"EditContentPackPage",propTypes:{history:m().object.isRequired,params:m().object.isRequired},mixins:[_().connect(p.P),_().connect(C.D)],getInitialState(){return{selectedEntities:{},contentPackEntities:void 0,appliedParameter:{},entityCatalog:{}}},componentDidMount(){const{params:e}=this.props;C.T.get(e.contentPackId).then(o=>{const{contentPackRevisions:n}=o,c=e.contentPackRev,i=n.createNewVersionFromRev(c);this.setState({contentPack:i,contentPackEntities:I()(i.entities)}),p.V.showEntityIndex().then(()=>{this._createEntityCatalog(),this._getSelectedEntities(),this._getAppliedParameter()})})},_createEntityCatalog(){const{contentPack:e,contentPackEntities:o,entityIndex:n}=this.state;if(!e||!n)return;const c=R()(o,"type.name"),i=Object.keys(n).reduce((a,s)=>(a[s]=n[s].concat(c[s]||[]),a),{});this.setState({entityCatalog:i})},_getSelectedEntities(){const{contentPack:e,entityCatalog:o,entityIndex:n}=this.state;if(!e||!n)return;const c=e.entities.reduce((i,a)=>{if(o[a.type.name]&&o[a.type.name].findIndex(s=>s.id===a.id)>=0){const s=i;return s[a.type.name]=i[a.type.name]||[],s[a.type.name].push(a),s}return i},{});this.setState({selectedEntities:c})},_getAppliedParameter(){const{contentPack:e}=this.state,o=e.entities.reduce((n,c)=>{const a=new L.A(c.data).getPaths(),s=Object.keys(a).filter(P=>a[P].isValueParameter()).map(P=>({configKey:P,paramName:a[P].getValue(),readOnly:!0})),l=n;return s.length>0&&(l[c.id]=s),l},{});this.setState({appliedParameter:o})},_onStateChanged(e){const{contentPack:o,selectedEntities:n,appliedParameter:c}=this.state;this.setState({contentPack:e.contentPack||o,selectedEntities:e.selectedEntities||n,appliedParameter:e.appliedParameter||c})},_onSave(){const{contentPack:e}=this.state,{history:o}=this.props;C.T.create.triggerPromise(e.toJSON()).then(()=>{g.A.success("Content pack imported successfully","Success!"),o.push(h.Ay.SYSTEM.CONTENTPACKS.LIST)},n=>{const c="Error importing content pack, please ensure it is a valid JSON file. Check your Graylog logs for more information.",i="Could not import content pack";let a="";n.additional&&n.additional.body&&n.additional.body.message&&(a=`
${n.additional.body.message}`),g.A.error(c+a,i)})},_getEntities(e){const{contentPack:o}=this.state;p.V.getSelectedEntities(e).then(n=>{const i=Object.keys(e).reduce((s,l)=>s.concat(e[l]),[]).filter(s=>s instanceof A.A).concat(n.entities.map(s=>A.A.fromJSON(s,!0))),a=o.toBuilder().entities(i).build();this.setState({contentPack:a,fetchedEntities:a.entities})})},render(){const{contentPack:e,fetchedEntities:o,selectedEntities:n,entityCatalog:c,appliedParameter:i}=this.state;return r.createElement(u.Qc,{title:"Content packs"},r.createElement("span",null,r.createElement(u.zY,{title:"Edit content pack",topActions:r.createElement(B.m,{to:h.Ay.SYSTEM.CONTENTPACKS.LIST},r.createElement(K.Button,{bsStyle:"info"},"Content Packs"))},r.createElement("span",null,"Content packs accelerate the set up process for a specific data source. A content pack can include inputs/extractors, streams, and dashboards.",r.createElement("br",null),"Find more content packs in "," ",r.createElement("a",{href:"https://marketplace.graylog.org/",target:"_blank",rel:"noopener noreferrer"},"the Graylog Marketplace"),".")),r.createElement(S.A,{contentPack:e,onGetEntities:this._getEntities,onStateChange:this._onStateChanged,fetchedEntities:o,selectedEntities:n,entityIndex:c,appliedParameter:i,edit:!0,onSave:this._onSave})))}}),k=(0,f.A)((0,U.A)(W))},c9JM82dZ:(T,E,t)=>{t.d(E,{A:()=>O});var r=t("Z7aTuO5B"),d=t("yAXMqwrl");const O=_=>D=>{const M=(0,d.useParams)();return r.createElement(_,{...D,params:M})}}}]);})();
//# sourceMappingURL=bb8c8232-1956.e7938ecf4a07dcbf9709.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy