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

web-interface.assets.07ba022f-4440.3b167f062a1b8e5235d3.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([["07ba022f-4440"],{ljflnqX7:(K,v,t)=>{t.d(v,{Z:()=>P});var e=t("pmX897Fv"),p=t.n(e),a=t("DjJvgDaP"),n=t.n(a),c=n()(p());c.push([K.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:(K,v,t)=>{t.d(v,{Z:()=>u});var e=t("Z7aTuO5B"),p=t("ii0bleBb"),a=t.n(p),n=t("MdYBRjRJ"),c=t("U1Iufsob"),P=t("uZqmR+ju"),C=t("/GOzvPf6"),h=t("gqVHlIxA");const B=({contentPackId:f,revision:y,show:L,onHide:I})=>{const[l,i]=(0,e.useState)(L),s=()=>(0,n.DC)(c.Z.ContentPacksController.downloadRev(f,y).url),r=()=>{i(!1),I()},m='Please right click the download link below and choose "Save Link As..." to download the JSON file.',M="Download Content Pack";return e.createElement(h.Z,{showModal:l,onHide:r,bsSize:"large"},e.createElement(P.Modal.Header,{closeButton:!0},e.createElement(P.Modal.Title,null,M)),e.createElement(P.Modal.Body,null,e.createElement("p",null,m),e.createElement("p",null,e.createElement("a",{href:s(),target:"_blank",rel:"noopener noreferrer"},e.createElement(C.JO,{name:"cloud-download-alt"})," ","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:(K,v,t)=>{t.d(v,{Z:()=>L});var e=t("ii0bleBb"),p=t.n(e),a=t("Z7aTuO5B"),n=t("rbG+3kLS"),c=t("uZqmR+ju"),P=t("EHQ1CSeg"),C=t("iAkLQLhv"),h=t("vyEB9hoZ"),B=Object.defineProperty,u=(I,l,i)=>l in I?B(I,l,{enumerable:!0,configurable:!0,writable:!0,value:i}):I[l]=i,f=(I,l,i)=>(u(I,typeof l!="symbol"?l+"":l,i),i);class y extends a.Component{constructor(l){super(l),f(this,"onInstall",()=>{if(this._validateInput()){const s=this.props.contentPack.id,r=this.props.contentPack.rev,m=this._convertedParameters();this.props.onInstall(s,r,{parameters:m,comment:this.state.comment})}}),f(this,"_convertedParameters",()=>Object.keys(this.state.parameterInput).reduce((s,r)=>{const m=s,M=this.props.contentPack.parameters.find(N=>N.name===r).type,Z=C.Z.convertValue(M,this.state.parameterInput[r]);return m[r]=P.Z.createValueRef(M,Z),m},{})),f(this,"_getValue",(s,r)=>{const m=this.state.parameterInput;m[s]=r,this.setState({parameterInput:m})}),f(this,"_getComment",s=>{this.setState({comment:s.target.value})}),f(this,"_validateInput",()=>{const{parameterInput:s}=this.state,r=this.props.contentPack.parameters.reduce((m,M)=>{if(s[M.name]&&s[M.name].length>0)return m;const Z=m;return Z[M.name]="Needs to be filled.",Z},{});return this.setState({errorMessages:r}),Object.keys(r).length<=0});const i=l.contentPack.parameters.reduce((s,r)=>{if(r.default_value){const m=s;return m[r.name]=C.Z.convertToString(r),m}return s},{});this.state={parameterInput:i,comment:"",errorMessages:{}}}renderParameter(l){const i=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:i||l.description,bsStyle:i?"error":void 0,required:!0})}render(){const l=this.props.contentPack.parameters.map(s=>this.renderParameter(s)),i=n.Z.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.Z,{contentPack:i,readOnly:!0}))))}}f(y,"propTypes",{contentPack:p().object.isRequired,onInstall:p().func}),f(y,"defaultProps",{onInstall:()=>{}});const L=y},xhcXzwie:(K,v,t)=>{t.r(v),t.d(v,{default:()=>Pe});var e=t("Z7aTuO5B"),p=t("J6y4/h8P"),a=t("ty2gyrHp"),n=t("uZqmR+ju"),c=t("d4kzUuQm"),P=t("dsvqAVKU"),C=t("jAGDuYSC"),h=t("/GOzvPf6"),B=t("ii0bleBb"),u=t.n(B),f=t("Z6NUVhuV"),y=t("9gxkERa8"),L=t("9tOV9VDw"),I=t("EL/SQmS6"),l=t("gqVHlIxA"),i=t("KfDYZOy6"),s=t("tDHZr5uI");const r=({pack:o,contentPackMetadata:d,onDeletePack:E,onInstall:D})=>{const[A,O]=(0,e.useState)(!1),[g,b]=(0,e.useState)(!1),R=(0,e.useRef)(null),W=d[o.id]||{},j=Object.keys(W).find(U=>W[U].installation_count>0)?["installed"]:[],H=j.includes("updatable")?e.createElement(n.Button,{bsSize:"small",bsStyle:"primary"},"Update"):"",x=()=>O(!0),F=()=>b(!0),V=()=>E(o.id),w=()=>O(!1),S=()=>{var U;R.current!==null&&((U=R.current)==null||U.onInstall()),O(!1)};return e.createElement(L.Z,null,e.createElement(n.Row,{className:"row-sm"},e.createElement(n.Col,{md:9},e.createElement("h3",null,e.createElement(a.r,{to:c.ZP.SYSTEM.CONTENTPACKS.show(o.id)},o.name)," ",e.createElement("small",null,"Latest Version: ",o.rev," ",e.createElement(I.Z,{contentPackId:o.id,states:j})))),e.createElement(n.Col,{md:3,className:"text-right"},e.createElement(n.ButtonToolbar,{className:"pull-right"},H,e.createElement(n.Button,{bsSize:"small",onClick:x},"Install"),e.createElement(n.DropdownButton,{id:`more-actions-${o.id}`,title:"More Actions",bsSize:"small",pullRight:!0},e.createElement(a.J,{to:c.ZP.SYSTEM.CONTENTPACKS.show(o.id)},e.createElement(n.MenuItem,null,"Show")),e.createElement(a.J,{to:c.ZP.SYSTEM.CONTENTPACKS.edit(encodeURIComponent(o.id),encodeURIComponent(o.rev))},e.createElement(n.MenuItem,null,"Create New Version")),e.createElement(n.MenuItem,{onSelect:F},"Download"),e.createElement(n.MenuItem,{divider:!0}),e.createElement(n.MenuItem,{onSelect:V},"Delete All Versions"))))),e.createElement(n.Row,{className:"row-sm content-packs-summary"},e.createElement(n.Col,{md:12},o.summary,"\xA0")),A&&e.createElement(l.Z,{showModal:A,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(i.Z,{ref:R,contentPack:o,onInstall:D})),e.createElement(n.Modal.Footer,null,e.createElement(h.os,{submitButtonText:"Install",onSubmit:S,onCancel:w}))),g&&e.createElement(s.Z,{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 m=r;var M=t("ij/cnY+3");const Z=(0,p.default)(h.IE)(({theme:o})=>(0,p.css)`
  display: flex;
  align-items: center;
  gap: ${o.spacings.xs};
  float: right;
`),N=({contentPacks:o,contentPackMetadata:d,onDeletePack:E,onInstall:D})=>{const[A,O]=(0,e.useState)(o),[g,b]=(0,e.useState)(M._),R=S=>{const{perPage:U,page:Ce}=g,Y=U*(Ce-1),he=Y+U;return S.slice(Y,he).map(J=>e.createElement(m,{key:J.id,pack:J,contentPackMetadata:d,onDeletePack:E,onInstall:D}))},W=S=>{O(S)},z=S=>{b({...g,perPage:S})},j=S=>{b({...g,page:S})},H=Math.ceil(A.length/g.perPage),x=e.createElement(h.tl,{totalPages:H,currentPage:g.page,onChange:j}),F=e.createElement(Z,{onChange:z,pageSize:g.perPage,pageSizes:[10,25,50,100]}),V=o.length<=0?e.createElement(h.dX,null,"No content packs found. Please create or upload one"):e.createElement(h.pJ,null,"No matching content packs have been found"),w=A.length<=0?e.createElement("div",{className:"has-bm"},V):e.createElement(y.Z,null,e.createElement(y.Z.Header,null),R(A));return e.createElement("div",null,e.createElement(n.Row,{className:"has-bm"},e.createElement(n.Col,{md:5},e.createElement(f.Z,{id:"content-packs-filter",label:"Filter",data:o,displayKey:"name",onDataFiltered:W,searchInKeys:["name","summary"],filterSuggestions:[]})),e.createElement(n.Col,{md:5},x),e.createElement(n.Col,{md:2,className:"text-right"},F)),w,e.createElement(n.Row,{className:"row-sm"},e.createElement(n.Col,{md:5}),e.createElement(n.Col,{md:5},x),e.createElement(n.Col,{md:2,className:"text-right"},F)))};N.propTypes={contentPacks:u().arrayOf(u().object),contentPackMetadata:u().object,onDeletePack:u().func,onInstall:u().func},N.defaultProps={contentPacks:[],contentPackMetadata:{},onDeletePack:()=>{},onInstall:()=>{}};const X=N;var T=t("nPaY1a0P"),G=t("dFpwyWHg"),$=t.n(G),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"),k={};k.styleTagTransform=re(),k.setAttributes=oe(),k.insert=te().bind(null,"head"),k.domAPI=q(),k.insertStyleElement=le();var fe=$()(_.Z,k);const ce=_.Z&&_.Z.locals?_.Z.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=D=>{const A=D.target.result;T.K.create.triggerPromise(A).then(()=>{C.Z.success("Content pack imported successfully","Success!"),T.K.list()},O=>{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="";O.additional&&O.additional.body&&O.additional.body.message&&(R=`
${O.additional.body.message}`),C.Z.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?")&&T.K.delete(o).then(()=>{C.Z.success("Content Pack deleted successfully.","Success"),T.K.list()},d=>{let E=d.message;const D=d.additional.body;D&&D.message&&(E=d.additional.body.message),C.Z.error(`Deleting bundle failed: ${E}`,"Error")})},pe=(o,d,E)=>{T.K.install(o,d,E).then(()=>{C.Z.success("Content Pack installed successfully.","Success"),T.K.list()},D=>{C.Z.error(`Installing content pack failed with status: ${D}. Could not install Content Pack with ID: ${o}`)})},Pe=()=>{const{contentPacks:o,contentPackMetadata:d}=(0,ie.o)(T.V);return(0,e.useEffect)(()=>{T.K.list()},[]),o?e.createElement(h.$4,{title:"Content Packs"},e.createElement("span",null,e.createElement(h.mr,{title:"Content Packs",topActions:e.createElement(n.Button,{bsStyle:"info",active:!0},"Content Packs"),actions:e.createElement(n.ButtonToolbar,null,e.createElement(me,null),e.createElement(a.J,{to:c.ZP.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(X,{contentPacks:o,contentPackMetadata:d,onDeletePack:Ee,onInstall:pe})))))):e.createElement(P.Z,null)}},"ij/cnY+3":(K,v,t)=>{t.d(v,{_:()=>e});const e={page:1,perPage:10,query:""}}}]);})(); //# sourceMappingURL=07ba022f-4440.3b167f062a1b8e5235d3.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy