web-interface.assets.1255d548-5573.dde1fd14d40070a42601.js Maven / Gradle / Ivy
"use strict";(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["1255d548-5573"],{"5WTdac/v":(f,E,t)=>{t.r(E),t.d(E,{default:()=>U});var r=t("Z7aTuO5B"),d=t("ii0bleBb"),m=t.n(d),O=t("JnTtTRmZ"),_=t.n(O),p=t("D4SbLiE/"),h=t.n(p),R=t("IW7priiX"),v=t.n(R),A=t("t5bvLtVB"),y=t.n(A),B=t("ty2gyrHp"),M=t("d4kzUuQm"),I=t("uZqmR+ju"),g=t("jAGDuYSC"),u=t("/GOzvPf6"),K=t("znhYcHoq"),S=t("FhPlv95w"),T=t("PAFhOglk"),L=t("c9JM82dZ"),D=t("FKyXQK1p"),C=t("nPaY1a0P");const k=h()({displayName:"EditContentPackPage",propTypes:{history:m().object.isRequired,params:m().object.isRequired},mixins:[_().connect(D.Z),_().connect(C.V)],getInitialState(){return{selectedEntities:{},contentPackEntities:void 0,appliedParameter:{},entityCatalog:{}}},componentDidMount(){const{params:e}=this.props;C.K.get(e.contentPackId).then(o=>{const{contentPackRevisions:n}=o,c=e.contentPackRev,i=n.createNewVersionFromRev(c);this.setState({contentPack:i,contentPackEntities:v()(i.entities)}),D.h.showEntityIndex().then(()=>{this._createEntityCatalog(),this._getSelectedEntities(),this._getAppliedParameter()})})},_createEntityCatalog(){const{contentPack:e,contentPackEntities:o,entityIndex:n}=this.state;if(!e||!n)return;const c=y()(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 K.Z(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.K.create.triggerPromise(e.toJSON()).then(()=>{g.Z.success("Content pack imported successfully","Success!"),o.push(M.ZP.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.Z.error(c+a,i)})},_getEntities(e){const{contentPack:o}=this.state;D.h.getSelectedEntities(e).then(n=>{const i=Object.keys(e).reduce((s,l)=>s.concat(e[l]),[]).filter(s=>s instanceof T.Z).concat(n.entities.map(s=>T.Z.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.$4,{title:"Content packs"},r.createElement("span",null,r.createElement(u.mr,{title:"Edit content pack",topActions:r.createElement(B.J,{to:M.ZP.SYSTEM.CONTENTPACKS.LIST},r.createElement(I.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.Z,{contentPack:e,onGetEntities:this._getEntities,onStateChange:this._onStateChanged,fetchedEntities:o,selectedEntities:n,entityIndex:c,appliedParameter:i,edit:!0,onSave:this._onSave})))}}),U=(0,L.Z)(k)},c9JM82dZ:(f,E,t)=>{t.d(E,{Z:()=>O});var r=t("Z7aTuO5B"),d=t("yAXMqwrl");const O=_=>p=>{const h=(0,d.useParams)();return r.createElement(_,{...p,params:h})}}}]);})();
//# sourceMappingURL=1255d548-5573.dde1fd14d40070a42601.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy