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

web-interface.assets.bb8c8232-1031.5aae1cecf2f44e7528df.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([["bb8c8232-1031"],{ljflnqX7:(N,I,t)=>{t.d(I,{A:()=>P});var e=t("pmX897Fv"),p=t.n(e),a=t("DjJvgDaP"),n=t.n(a),c=n()(p());c.push([N.id,`.btn.Hi7bFFbRdcngspsKDSna {
    margin-left: 5px;
}
`,"",{version:3,sources:["webpack://./src/components/content-packs/ContentPackUploadControls.css"],names:[],mappings:"AAAA;IACI,gBAAgB;AACpB",sourcesContent:[`.btn:local(.button) {
    margin-left: 5px;
}
`],sourceRoot:""}]),c.locals={button:"Hi7bFFbRdcngspsKDSna"};const P=c},tDHZr5uI:(N,I,t)=>{t.d(I,{A:()=>u});var e=t("Z7aTuO5B"),p=t("ii0bleBb"),a=t.n(p),n=t("MdYBRjRJ"),c=t("U1Iufsob"),P=t("rIl5IEuP"),C=t("IOI9nV80"),h=t("gqVHlIxA");const B=({contentPackId:f,revision:T,show:K,onHide:v})=>{const[l,m]=(0,e.useState)(K),s=()=>(0,n.H3)(c.A.ContentPacksController.downloadRev(f,T).url),r=()=>{m(!1),v()};return e.createElement(h.A,{showModal:l,onHide:r,bsSize:"large"},e.createElement(P.Modal.Header,{closeButton:!0},e.createElement(P.Modal.Title,null,"Download Content Pack")),e.createElement(P.Modal.Body,null,e.createElement("p",null,'Please right click the download link below and choose "Save Link As..." to download the JSON file.'),e.createElement("p",null,e.createElement("a",{href:s(),target:"_blank",rel:"noopener noreferrer"},e.createElement(C.In,{name:"download"})," ","Download"))),e.createElement(P.Modal.Footer,null,e.createElement(P.Button,{onClick:r},"Close")))};B.propTypes={contentPackId:a().string.isRequired,revision:a().number.isRequired,show:a().bool,onHide:a().func},B.defaultProps={show:!1,onHide:()=>{}};const u=B},KfDYZOy6:(N,I,t)=>{t.d(I,{A:()=>K});var e=t("ii0bleBb"),p=t.n(e),a=t("Z7aTuO5B"),n=t("rbG+3kLS"),c=t("rIl5IEuP"),P=t("EHQ1CSeg"),C=t("iAkLQLhv"),h=t("vyEB9hoZ"),B=Object.defineProperty,u=(v,l,m)=>l in v?B(v,l,{enumerable:!0,configurable:!0,writable:!0,value:m}):v[l]=m,f=(v,l,m)=>(u(v,typeof l!="symbol"?l+"":l,m),m);class T extends a.Component{constructor(l){super(l),f(this,"onInstall",()=>{if(this._validateInput()){const s=this.props.contentPack.id,r=this.props.contentPack.rev,i=this._convertedParameters();this.props.onInstall(s,r,{parameters:i,comment:this.state.comment})}}),f(this,"_convertedParameters",()=>Object.keys(this.state.parameterInput).reduce((s,r)=>{const i=s,D=this.props.contentPack.parameters.find(W=>W.name===r).type,k=C.A.convertValue(D,this.state.parameterInput[r]);return i[r]=P.A.createValueRef(D,k),i},{})),f(this,"_getValue",(s,r)=>{const i=this.state.parameterInput;i[s]=r,this.setState({parameterInput:i})}),f(this,"_getComment",s=>{this.setState({comment:s.target.value})}),f(this,"_validateInput",()=>{const{parameterInput:s}=this.state,r=this.props.contentPack.parameters.reduce((i,D)=>{if(s[D.name]&&s[D.name].length>0)return i;const k=i;return k[D.name]="Needs to be filled.",k},{});return this.setState({errorMessages:r}),Object.keys(r).length<=0});const m=l.contentPack.parameters.reduce((s,r)=>{if(r.default_value){const i=s;return i[r.name]=C.A.convertToString(r),i}return s},{});this.state={parameterInput:m,comment:"",errorMessages:{}}}renderParameter(l){const m=this.state.errorMessages[l.name];return a.createElement(c.Input,{name:l.name,id:l.name,key:l.name,type:"text",maxLength:250,value:this.state.parameterInput[l.name]||"",onChange:s=>{this._getValue(l.name,s.target.value)},labelClassName:"col-sm-3",wrapperClassName:"col-sm-7",label:l.title,help:m||l.description,bsStyle:m?"error":void 0,required:!0})}render(){const l=this.props.contentPack.parameters.map(s=>this.renderParameter(s)),m=n.A.fromJSON(this.props.contentPack);return a.createElement("div",null,a.createElement(c.Row,null,a.createElement(c.Col,{smOffset:1,sm:10},a.createElement("h2",null,"Install comment"),a.createElement("br",null),a.createElement("br",null),a.createElement(c.Input,{name:"comment",id:"comment",type:"text",maxLength:512,value:this.state.comment,onChange:this._getComment,labelClassName:"col-sm-3",wrapperClassName:"col-sm-7",label:"Comment"}))),l.length>0&&a.createElement(c.Row,null,a.createElement(c.Col,{smOffset:1,sm:10},a.createElement("h2",null,"Configure Parameter"),a.createElement("br",null),a.createElement("br",null),l)),a.createElement(c.Row,null,a.createElement(c.Col,{smOffset:1,sm:10},a.createElement(h.A,{contentPack:m,readOnly:!0}))))}}f(T,"propTypes",{contentPack:p().object.isRequired,onInstall:p().func}),f(T,"defaultProps",{onInstall:()=>{}});const K=T},xhcXzwie:(N,I,t)=>{t.r(I),t.d(I,{default:()=>Pe});var e=t("Z7aTuO5B"),p=t("J6y4/h8P"),a=t("ty2gyrHp"),n=t("rIl5IEuP"),c=t("d4kzUuQm"),P=t("dsvqAVKU"),C=t("jAGDuYSC"),h=t("IOI9nV80"),B=t("ii0bleBb"),u=t.n(B),f=t("Z6NUVhuV"),T=t("9gxkERa8"),K=t("9tOV9VDw"),v=t("EL/SQmS6"),l=t("gqVHlIxA"),m=t("KfDYZOy6"),s=t("tDHZr5uI");const r=({pack:o,contentPackMetadata:d,onDeletePack:E,onInstall:A})=>{const[S,M]=(0,e.useState)(!1),[g,b]=(0,e.useState)(!1),R=(0,e.useRef)(null),x=d[o.id]||{},F=Object.keys(x).find(U=>x[U].installation_count>0)?["installed"]:[],V=F.includes("updatable")?e.createElement(n.Button,{bsSize:"small",bsStyle:"primary"},"Update"):"",j=()=>M(!0),H=()=>b(!0),z=()=>E(o.id),w=()=>M(!1),y=()=>{var U;R.current!==null&&((U=R.current)==null||U.onInstall()),M(!1)};return e.createElement(K.A,null,e.createElement(n.Row,{className:"row-sm"},e.createElement(n.Col,{md:9},e.createElement("h3",null,e.createElement(a.N,{to:c.Ay.SYSTEM.CONTENTPACKS.show(o.id)},o.name)," ",e.createElement("small",null,"Latest Version: ",o.rev," ",e.createElement(v.A,{contentPackId:o.id,states:F})))),e.createElement(n.Col,{md:3,className:"text-right"},e.createElement(n.ButtonToolbar,{className:"pull-right"},V,e.createElement(n.Button,{bsSize:"small",onClick:j},"Install"),e.createElement(n.DropdownButton,{id:`more-actions-${o.id}`,title:"More Actions",bsSize:"small",pullRight:!0},e.createElement(a.m,{to:c.Ay.SYSTEM.CONTENTPACKS.show(o.id)},e.createElement(n.MenuItem,null,"Show")),e.createElement(a.m,{to:c.Ay.SYSTEM.CONTENTPACKS.edit(encodeURIComponent(o.id),encodeURIComponent(o.rev))},e.createElement(n.MenuItem,null,"Create New Version")),e.createElement(n.MenuItem,{onSelect:H},"Download"),e.createElement(n.MenuItem,{divider:!0}),e.createElement(n.MenuItem,{onSelect:z},"Delete All Versions"))))),e.createElement(n.Row,{className:"row-sm content-packs-summary"},e.createElement(n.Col,{md:12},o.summary,"\xA0")),S&&e.createElement(l.A,{showModal:S,onHide:w,bsSize:"large"},e.createElement(n.Modal.Header,{closeButton:!0},e.createElement(n.Modal.Title,null,"Install Content Pack")),e.createElement(n.Modal.Body,null,e.createElement(m.A,{ref:R,contentPack:o,onInstall:A})),e.createElement(n.Modal.Footer,null,e.createElement(h.E6,{submitButtonText:"Install",onSubmit:y,onCancel:w}))),g&&e.createElement(s.A,{show:g,onHide:()=>b(!1),contentPackId:o.id,revision:o.rev}))};r.propTypes={pack:u().object.isRequired,contentPackMetadata:u().object.isRequired,onDeletePack:u().func.isRequired,onInstall:u().func.isRequired},r.defaultProps={};const i=r;var D=t("ij/cnY+3");const k=(0,p.default)(h.t7)(({theme:o})=>(0,p.css)`
  display: flex;
  align-items: center;
  gap: ${o.spacings.xs};
  float: right;
`),W=({contentPacks:o,contentPackMetadata:d,onDeletePack:E,onInstall:A})=>{const[S,M]=(0,e.useState)(o),[g,b]=(0,e.useState)(D.n),R=y=>{const{perPage:U,page:Ce}=g,X=U*(Ce-1),he=X+U;return y.slice(X,he).map(Z=>e.createElement(i,{key:Z.id,pack:Z,contentPackMetadata:d,onDeletePack:E,onInstall:A}))},x=y=>{M(y)},Y=y=>{b({...g,perPage:y})},F=y=>{b({...g,page:y})},V=Math.ceil(S.length/g.perPage),j=e.createElement(h.dK,{totalPages:V,currentPage:g.page,onChange:F}),H=e.createElement(k,{onChange:Y,pageSize:g.perPage,pageSizes:[10,25,50,100]}),z=o.length<=0?e.createElement(h.WE,null,"No content packs found. Please create or upload one"):e.createElement(h.EO,null,"No matching content packs have been found"),w=S.length<=0?e.createElement("div",{className:"has-bm"},z):e.createElement(T.A,null,e.createElement(T.A.Header,null),R(S));return e.createElement("div",null,e.createElement(n.Row,{className:"has-bm"},e.createElement(n.Col,{md:5},e.createElement(f.A,{id:"content-packs-filter",label:"Filter",data:o,displayKey:"name",onDataFiltered:x,searchInKeys:["name","summary"],filterSuggestions:[]})),e.createElement(n.Col,{md:5},j),e.createElement(n.Col,{md:2,className:"text-right"},H)),w,e.createElement(n.Row,{className:"row-sm"},e.createElement(n.Col,{md:5}),e.createElement(n.Col,{md:5},j),e.createElement(n.Col,{md:2,className:"text-right"},H)))};W.propTypes={contentPacks:u().arrayOf(u().object),contentPackMetadata:u().object,onDeletePack:u().func,onInstall:u().func},W.defaultProps={contentPacks:[],contentPackMetadata:{},onDeletePack:()=>{},onInstall:()=>{}};const G=W;var O=t("nPaY1a0P"),$=t("dFpwyWHg"),J=t.n($),Q=t("C2ikvoS0"),q=t.n(Q),ee=t("1IntWRSu"),te=t.n(ee),ne=t("8nGWeFnd"),oe=t.n(ne),ae=t("TeAcaicX"),le=t.n(ae),se=t("eE3+5goe"),re=t.n(se),_=t("ljflnqX7"),L={};L.styleTagTransform=re(),L.setAttributes=oe(),L.insert=te().bind(null,"head"),L.domAPI=q(),L.insertStyleElement=le();var fe=J()(_.A,L);const ce=_.A&&_.A.locals?_.A.locals:void 0;class de extends e.Component{constructor(d){super(d),this.state={isOpen:!1},this._openModal=this._openModal.bind(this),this._closeModal=this._closeModal.bind(this),this._save=this._save.bind(this)}_openModal(){this.setState({isOpen:!0})}_closeModal(){this.setState({isOpen:!1})}_save(d){if(d.preventDefault(),!this.uploadInput.getInputDOMNode().files||!this.uploadInput.getInputDOMNode().files[0])return;const E=new FileReader;E.onload=A=>{const S=A.target.result;O.T.create.triggerPromise(S).then(()=>{C.A.success("Content pack imported successfully","Success!"),O.T.list()},M=>{const g="Error importing content pack, please ensure it is a valid JSON file. Check your Graylog logs for more information.",b="Could not import content pack";let R="";M.additional&&M.additional.body&&M.additional.body.message&&(R=`
${M.additional.body.message}`),C.A.error(g+R,b)})},E.readAsText(this.uploadInput.getInputDOMNode().files[0]),this._closeModal()}render(){const{isOpen:d}=this.state;return e.createElement("span",null,e.createElement(n.Button,{className:ce.button,active:d,id:"upload-content-pack-button",bsStyle:"info",onClick:this._openModal},"Upload"),e.createElement(n.BootstrapModalForm,{onCancel:this._closeModal,show:d,onSubmitForm:this._save,title:"Upload Content Pack",submitButtonText:"Upload"},e.createElement(n.Input,{ref:E=>{this.uploadInput=E},id:"upload-content-pack",label:"Choose File",type:"file",help:"Choose Content Pack from disk"})))}}const me=de;var ie=t("8fnsnG21");const ue=p.default.div(({theme:o})=>(0,p.css)` font-size: ${o.fonts.size.body}; font-weight: normal; margin-top: 15px; `),Ee=o=>{window.confirm("You are about to delete this Content Pack, are you sure?")&&O.T.delete(o).then(()=>{C.A.success("Content Pack deleted successfully.","Success"),O.T.list()},d=>{let E=d.message;const A=d.additional.body;A&&A.message&&(E=d.additional.body.message),C.A.error(`Deleting bundle failed: ${E}`,"Error")})},pe=(o,d,E)=>{O.T.install(o,d,E).then(()=>{C.A.success("Content Pack installed successfully.","Success"),O.T.list()},A=>{C.A.error(`Installing content pack failed with status: ${A}. Could not install Content Pack with ID: ${o}`)})},Pe=()=>{const{contentPacks:o,contentPackMetadata:d}=(0,ie.P)(O.D);return(0,e.useEffect)(()=>{O.T.list()},[]),o?e.createElement(h.Qc,{title:"Content Packs"},e.createElement("span",null,e.createElement(h.zY,{title:"Content Packs",topActions:e.createElement(n.Button,{bsStyle:"info"},"Content Packs"),actions:e.createElement(n.ButtonToolbar,null,e.createElement(me,null),e.createElement(a.m,{to:c.Ay.SYSTEM.CONTENTPACKS.CREATE},e.createElement(n.Button,{bsStyle:"success"},"Create a content pack")))},e.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.",e.createElement("br",null),"Find more Content Packs in "," ",e.createElement("a",{href:"https://marketplace.graylog.org/",target:"_blank",rel:"noopener noreferrer"},"the Graylog Marketplace"),".")),e.createElement(n.Row,{className:"content"},e.createElement(n.Col,{md:12},e.createElement(ue,null,e.createElement(G,{contentPacks:o,contentPackMetadata:d,onDeletePack:Ee,onInstall:pe})))))):e.createElement(P.A,null)}},"ij/cnY+3":(N,I,t)=>{t.d(I,{n:()=>e});const e={page:1,perPage:10,query:""}}}]);})(); //# sourceMappingURL=bb8c8232-1031.5aae1cecf2f44e7528df.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy