web-interface.assets.1255d548-5534.890176091ac76b162587.js Maven / Gradle / Ivy
"use strict";(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["1255d548-5534"],{"6bzBY7Xo":(q,W,s)=>{s.d(W,{Go:()=>p,Oi:()=>D,uA:()=>Z,zB:()=>y});var e=s("ii0bleBb"),o=s.n(e);const A=o().exact({max_index_retention_period:o().string}),S=o().exact({type:o().string,max_size:o().number}),_=o().exact({type:o().string,max_docs_per_index:o().number}),m=o().exact({type:o().string,rotation_period:o().string,max_rotation_period:o().string,rotate_empty_index_set:o().bool}),M=o().exact({type:o().string,index_lifetime_max:o().string,index_lifetime_min:o().string}),Z=o().oneOfType([S,_,m,M]),C=o().string,y=o().shape({type:o().string.isRequired,max_number_of_indices:o().number,index_action:o().string}),g=o().exact({type:o().string.isRequired}),b=o().exact({type:o().string.isRequired,enum:o().arrayOf(o().string).isRequired}),x=o().exact({rotation_period:g,max_rotation_period:g,type:g.isRequired,max_size:g,max_docs_per_index:g,rotate_empty_index_set:g,index_lifetime_max:g,index_lifetime_min:g}),R=o().exact({type:o().string.isRequired,id:o().string,properties:x.isRequired}),U=o().exact({max_number_of_indices:g.isRequired,type:g.isRequired,index_action:b}),f=o().exact({type:o().string.isRequired,id:o().string,properties:U}),D=o().exact({type:o().string.isRequired,default_config:Z.isRequired,json_schema:R.isRequired}),p=o().exact({type:o().string.isRequired,default_config:y.isRequired,json_schema:f.isRequired})},FBcshu83:(q,W,s)=>{s.d(W,{Z:()=>y});var e=s("ii0bleBb"),o=s.n(e),A=s("Z7aTuO5B"),S=s("r3NKmxcf"),_=s("JOCOSU54");const m="",M=(g,b)=>{if(b.type===S.Z.MATCH_INPUT){const x=g.find(({id:R})=>R===b.value);return x?`${x.title} (${x.name}: ${x.id})`:`: ${b.value})`}return b.type!==S.Z.FIELD_PRESENCE?b.value?b.value:m:null},Z=g=>g.field?g.field:g.type===S.Z.MATCH_INPUT?"gl_source_input":m,C=({streamRule:g,inputs:b=[]})=>{const{data:x}=(0,_.Z)(),R=x==null?void 0:x.find(({id:D})=>D===g.type),U=g.inverted?"not ":null,f=R?R.long_desc:null;return g.type===S.Z.ALWAYS_MATCHES?A.createElement("span",null,"Rule always matches"):A.createElement("span",null,A.createElement("em",null,Z(g))," ",A.createElement("strong",null,"must ",U),f," ",A.createElement("em",null,M(b,g)))};C.propTypes={streamRule:o().object.isRequired,inputs:o().array.isRequired};const y=C},RfX2tXzp:(q,W,s)=>{s.d(W,{Z:()=>$});var e=s("ii0bleBb"),o=s.n(e),A=s("Z7aTuO5B"),S=s("oc9db6Tt"),_=s.n(S),m=s("J6y4/h8P"),M=s("FBcshu83"),Z=s("8fnsnG21"),C=s("/GOzvPf6"),y=s("uZqmR+ju"),g=s("0TVxnHwi"),b=s("0CyR/E1C"),x=s("jAGDuYSC"),R=s("W/ejv//U"),U=s("apKKh8n6"),f=s("q2j1bVbz");const D=m.default.span`
margin-right: 6px;
`,p=({matchData:K,stream:w,streamRule:G,onSubmit:Y,onDelete:se})=>{const{permissions:ae}=(0,f.Z)(),[ie,z]=(0,A.useState)(!1),{inputs:ee}=(0,Z.o)(R.R);(0,A.useEffect)(()=>{R.l.list()},[]);const P=X=>{X.preventDefault(),z(!0)},le=X=>{X.preventDefault(),window.confirm("Do you really want to delete this stream rule?")&&U.b.remove(w.id,G.id,()=>{se&&se(G.id),x.Z.success("Stream rule has been successfully deleted.","Success")})},J=(X,he)=>U.b.update(w.id,X,he,()=>{Y&&Y(X,he),x.Z.success("Stream rule has been successfully updated.","Success")}),N=()=>A.createElement(D,null,A.createElement(y.Button,{bsStyle:"link",bsSize:"xsmall",onClick:le,title:"Delete stream rule"},A.createElement(C.JO,{name:"trash-alt",type:"regular"})),A.createElement(y.Button,{bsStyle:"link",bsSize:"xsmall",onClick:P,title:"Edit stream rule"},A.createElement(C.JO,{name:"edit"}))),te=()=>K.rules[G.id]?"success":"danger",ne=(0,g.rq)(ae,[`streams:edit:${w.id}`])?N():null,k=G.description?A.createElement("small",null," ","(",G.description,")"):null,re=_()(K)?null:te();return A.createElement(y.ListGroupItem,{bsStyle:re},ne,A.createElement(M.Z,{streamRule:G,inputs:ee}),ie&&A.createElement(b.Z,{initialValues:G,onClose:()=>z(!1),title:"Edit Stream Rule",submitButtonText:"Update Rule",submitLoadingText:"Updating Rule...",onSubmit:J}),k)};p.propTypes={matchData:o().shape({matches:o().bool,rules:o().object}),onDelete:o().func,onSubmit:o().func,stream:o().object.isRequired,streamRule:o().object.isRequired},p.defaultProps={matchData:{},onSubmit:()=>{},onDelete:()=>{}};const h=p,Q=({matchData:K,onDelete:w,onSubmit:G,stream:Y})=>{if(!Y)return A.createElement(C.$j,null);const se=!!Y.rules.length;return A.createElement(y.ListGroup,{componentClass:"ul"},se&&Y.rules.map(ae=>A.createElement(h,{key:ae.id,matchData:K,onSubmit:G,onDelete:w,stream:Y,streamRule:ae})),!se&&A.createElement(y.ListGroupItem,null,"No rules defined."))};Q.propTypes={matchData:o().shape({matches:o().bool,rules:o().object}),onSubmit:o().func,onDelete:o().func,stream:o().object.isRequired},Q.defaultProps={matchData:{},onSubmit:()=>{},onDelete:()=>{}};const $=Q},"0CyR/E1C":(q,W,s)=>{s.d(W,{Z:()=>D});var e=s("Z7aTuO5B"),o=s("UiXZqrDE"),A=s("kbGtT3aS"),S=s("/GOzvPf6"),_=s("FBcshu83"),m=s("uZqmR+ju"),M=s("fVisTAey"),Z=s("E+CaPsQD"),C=s("8fnsnG21"),y=s("W/ejv//U"),g=s("r3NKmxcf"),b=s("JOCOSU54");const x=p=>p!==g.Z.FIELD_PRESENCE&&p!==g.Z.ALWAYS_MATCHES,R=p=>p!==g.Z.ALWAYS_MATCHES&&p!==g.Z.MATCH_INPUT,U=p=>{let h={};return p.type||(h={...h,type:"Type is required"}),x(p.type)&&!p.value&&(h={...h,value:"Value is required"}),R(p.type)&&!p.field&&(h={...h,field:"Field is required"}),h},f=({title:p,onClose:h,submitButtonText:Q,submitLoadingText:$,onSubmit:K,initialValues:w})=>{const{inputs:G}=(0,C.o)(y.R),{data:Y}=(0,b.Z)();(0,e.useEffect)(()=>{y.l.list()},[]);const se=(0,e.useCallback)(z=>K(w==null?void 0:w.id,z).then(()=>h()),[K,w==null?void 0:w.id,h]),ae=(0,e.useMemo)(()=>Y==null?void 0:Y.map(({id:z,short_desc:ee})=>({value:z,label:ee})),[Y]),ie=(0,e.useMemo)(()=>G==null?void 0:G.map(({id:z,title:ee,name:P})=>({label:`${ee} (${P})`,value:z})),[G]);return e.createElement(m.Modal,{title:p,onHide:h,show:!0},e.createElement(o.Formik,{initialValues:w,onSubmit:se,validate:U},({values:z,setFieldValue:ee,isSubmitting:P,isValidating:le})=>e.createElement(o.Form,null,e.createElement(m.Modal.Header,{closeButton:!0},e.createElement(m.Modal.Title,null,p)),e.createElement(m.Modal.Body,null,Y!=null&&Y.length?e.createElement(m.Row,null,e.createElement(m.Col,{md:8},R(z.type)&&e.createElement(o.Field,{name:"field"},({field:{name:J,value:N,onChange:te,onBlur:ne},meta:{error:k,touched:re}})=>e.createElement(S.jY,{id:J,onBlur:ne,type:"text",label:"Field",name:J,error:k&&re?k:void 0,defaultValue:N,onChange:te})),e.createElement(o.Field,{name:"type"},({field:{name:J,value:N,onChange:te,onBlur:ne},meta:{error:k,touched:re}})=>e.createElement(m.Input,{label:"Type",id:"type",error:k&&re?k:void 0},e.createElement(S.Ph,{onBlur:ne,onChange:X=>((X===g.Z.MATCH_INPUT||X===g.Z.ALWAYS_MATCHES)&&(ee("value",""),ee("field","")),te({target:{value:X,name:J}})),options:ae,inputId:J,placeholder:"Select a type",inputProps:{"aria-label":"Select a type"},value:N}))),x(z.type)&&(z.type===g.Z.MATCH_INPUT?e.createElement(o.Field,{name:"value"},({field:{name:J,value:N,onChange:te,onBlur:ne},meta:{error:k,touched:re}})=>e.createElement(m.Input,{id:"value",label:"Input",error:k&&re?k:void 0},e.createElement(S.Ph,{onBlur:ne,onChange:X=>{te({target:{value:X,name:J}})},options:ie,inputId:J,placeholder:"Select an input",inputProps:{"aria-label":"Select an input"},value:N}))):e.createElement(S.jc,{id:"value",label:"Value",name:"value"})),e.createElement(S.jc,{id:"inverted",label:"Inverted",name:"inverted",type:"checkbox"}),e.createElement(S.jc,{id:"description",label:e.createElement(e.Fragment,null,"Description ",e.createElement(S.Sr,null)),name:"description",type:"textarea"}),e.createElement("p",null,e.createElement("strong",null,"Result:")," ",e.createElement(_.Z,{streamRule:z,inputs:G}))),e.createElement(m.Col,{md:4},e.createElement(m.Well,{bsSize:"small",className:"matcher-github"},"The server will try to convert to strings or numbers based on the matcher type as well as it can.",e.createElement("br",null),e.createElement("br",null),e.createElement(S.JO,{name:"github",type:"brand"}),"\xA0",e.createElement("a",{href:`https://github.com/Graylog2/graylog2-server/tree/${A.ZP.getMajorAndMinorVersion()}/graylog2-server/src/main/java/org/graylog2/streams/matchers`,target:"_blank",rel:"noopener noreferrer"}," Take a look at the matcher code on GitHub"),e.createElement("br",null),e.createElement("br",null),"Regular expressions use Java syntax. ",e.createElement(M.eb,{page:Z.Z.PAGES.STREAMS,title:"More information",text:e.createElement(S.JO,{name:"lightbulb",type:"regular"})})))):e.createElement(S.$j,null)),e.createElement(m.Modal.Footer,null,e.createElement(S.os,{submitButtonText:Q,submitLoadingText:$,onCancel:h,disabledSubmit:le,isSubmitting:P})))))};f.defaultProps={initialValues:{field:"",type:1,value:"",inverted:!1,description:""}};const D=f},JOCOSU54:(q,W,s)=>{s.d(W,{Z:()=>_});var e=s("DUKaTDO2"),o=s("apKKh8n6"),A=s("jAGDuYSC");const _=()=>{const{data:m}=(0,e.useQuery)(["streams","rule-types"],()=>o.b.types(),{onError:M=>{A.Z.error(`Loading stream rule types failed with status: ${M}`,"Could not load stream rule types")},keepPreviousData:!0,staleTime:36e5});return{data:m}}},BmExNlEo:(q,W,s)=>{s.d(W,{Z:()=>Z});var e=s("DUKaTDO2"),o=s("jAGDuYSC"),A=s("pUKP3+Pg");const _=C=>{if(C)return C.entrySeq().flatMap(([y,g])=>g.map(b=>`${y}:${b}`)).toArray()},m={pagination:{total:0},elements:[],attributes:[]},Z=(C,{enabled:y}={enabled:!0})=>{const{data:g,refetch:b,isInitialLoading:x}=(0,e.useQuery)(["streams","overview",C],()=>A.ZP.searchPaginated(C.page,C.pageSize,C.query,{sort:C==null?void 0:C.sort.attributeId,order:C==null?void 0:C.sort.direction,filters:_(C.filters)}),{onError:R=>{o.Z.error(`Loading streams failed with status: ${R}`,"Could not load streams")},keepPreviousData:!0,enabled:y});return{data:g!=null?g:m,refetch:b,isInitialLoading:x}}},r3NKmxcf:(q,W,s)=>{s.d(W,{Z:()=>o});const o={FIELD_PRESENCE:5,ALWAYS_MATCHES:7,MATCH_INPUT:8}},TVIxvOFy:(q,W,s)=>{s.r(W),s.d(W,{default:()=>Fn});var e=s("Z7aTuO5B"),o=s("uZqmR+ju"),A=s("ii0bleBb"),S=s.n(A),_=s("UiXZqrDE"),m=s("/GOzvPf6"),M=s("hhdCSTZj");const Z=({indexSets:t,help:n})=>{const r=(0,e.useMemo)(()=>t.filter(i=>i.can_be_default).map(({id:i,title:l})=>({value:i,label:l})),[t]);return e.createElement(_.Field,{name:"index_set_id"},({field:{name:i,value:l,onChange:a,onBlur:u},meta:{error:c,touched:d}})=>e.createElement(o.Input,{label:"Index Set",help:n,id:i,error:c&&d?c:void 0},e.createElement(M.Z,{onBlur:u,onChange:E=>a({target:{value:E,name:i}}),options:r,inputId:i,placeholder:"Select an index set",inputProps:{"aria-label":"Select an index set"},value:l})))};Z.defaultProps={help:"Messages that match this stream will be written to the configured index set."};const C=Z,y=(t,n)=>{var r,i,l,a,u;return{index_set_id:(i=t.index_set_id)!=null?i:(r=n==null?void 0:n.find(c=>c.default))==null?void 0:r.id,description:(l=t.description)!=null?l:void 0,title:(a=t.title)!=null?a:void 0,remove_matches_from_default_stream:(u=t.remove_matches_from_default_stream)!=null?u:void 0}},g=t=>{let n={};return t.title||(n={...n,title:"Title is required"}),t.index_set_id||(n={...n,index_set_id:"Index set is required"}),n},b=({initialValues:t,title:n,submitButtonText:r,submitLoadingText:i,onClose:l,onSubmit:a,indexSets:u})=>{const c=(0,e.useMemo)(()=>y(t,u),[u,t]),d=(0,e.useCallback)(E=>a(E).then(()=>l()),[l,a]);return e.createElement(o.Modal,{title:n,onHide:l,show:!0},e.createElement(_.Formik,{initialValues:c,onSubmit:d,validate:g},({isSubmitting:E,isValidating:T})=>e.createElement(_.Form,null,e.createElement(o.Modal.Header,{closeButton:!0},e.createElement(o.Modal.Title,null,n)),e.createElement(o.Modal.Body,null,e.createElement(m.jc,{label:"Title",name:"title",id:"title",help:"A descriptive name of the new stream"}),e.createElement(m.jc,{label:e.createElement(e.Fragment,null,"Description ",e.createElement(m.Sr,null)),name:"description",id:"description",help:"What kind of messages are routed into this stream?"}),e.createElement(C,{indexSets:u}),e.createElement(m.jc,{label:e.createElement(e.Fragment,null,"Remove matches from \u2018Default Stream\u2019"),help:e.createElement("span",null,"Don't assign messages that match this stream to the \u2018Default Stream\u2019."),name:"remove_matches_from_default_stream",id:"remove_matches_from_default_stream",type:"checkbox"})),e.createElement(o.Modal.Footer,null,e.createElement(m.os,{submitButtonText:r,submitLoadingText:i,onCancel:l,disabledSubmit:T,isSubmitting:E})))))};b.defaultProps={initialValues:{title:"",description:"",remove_matches_from_default_stream:!1}};const x=b;var R=s("8OvTct/Z"),U=s("v4GbOr/o");const f=({bsSize:t,bsStyle:n,buttonText:r,className:i,indexSets:l,onCreate:a})=>{const[u,c]=(0,e.useState)(!1),d=(0,R.Z)(),E=(0,e.useCallback)(()=>(d(U.A.STREAMS.CREATE_FORM_MODAL_OPENED,{app_pathname:"streams"}),c(T=>!T)),[d]);return e.createElement(e.Fragment,null,e.createElement(o.Button,{bsSize:t,bsStyle:n,className:i,onClick:E},r),u&&e.createElement(x,{title:"Create stream",submitButtonText:"Create stream",submitLoadingText:"Creating stream...",indexSets:l,onSubmit:a,onClose:E}))};f.propTypes={buttonText:S().string,bsStyle:S().string,bsSize:S().string,className:S().string,onCreate:S().func.isRequired,indexSets:S().array.isRequired},f.defaultProps={buttonText:"Create stream",bsSize:void 0,bsStyle:void 0,className:void 0};const D=f;var p=s("ZaccISJq"),h=s("dsvqAVKU"),Q=s("rlwexfKi"),$=s("pUKP3+Pg"),K=s("apKKh8n6"),w=s("rVdVsuGH"),G=s("fkNiwXiR"),Y=s("BmExNlEo"),se=s("qO9czYNI"),ae=s("Dg3D5NJi");const ie="streams",z={pageSize:20,sort:{attributeId:"title",direction:"asc"},displayedColumns:["title","description","index_set_title","rules","throughput","disabled"],columnsOrder:["title","description","index_set_title","rules","throughput","disabled","created_at"]},ee=[{id:"index_set_title",title:"Index Set",sortable:!0,permissions:["indexsets:read"]},{id:"throughput",title:"Throughput"},{id:"rules",title:"Rules"}];var P=s("J6y4/h8P"),le=s("VPaD/Np4"),J=s("HQjpSCKK"),N=s("cB7h3AEX");const te=({type:t})=>t==="DATE",ne=({filter_options:t})=>!!(t!=null&&t.length),k=({related_collection:t})=>!!t;var re=s("4E3oowBb");const he=({allActiveFilters:t,attribute:n,filterValueRenderer:r,onSubmit:i})=>e.createElement(e.Fragment,null,n.filter_options.sort(({title:l},{title:a})=>(0,re.S)(l.toLowerCase(),a.toLowerCase())).map(({title:l,value:a})=>{var u;const c=!!((u=t==null?void 0:t.get(n.id))!=null&&u.find(({value:d})=>a===d));return e.createElement(N.Z,{onSelect:()=>i({value:a,title:l}),key:`filter-value-${l}`,disabled:c},r?r(a,l):l)}));var qe=s("Mx+G+HdB"),et=s.n(qe);const tt=t=>{const[n,r]=(0,e.useState)(!1);return(0,e.useEffect)(()=>{function i({key:a}){a===t&&r(!0)}function l({key:a}){a===t&&r(!1)}return window.addEventListener("keydown",i),window.addEventListener("keyup",l),()=>{window.removeEventListener("keydown",i),window.removeEventListener("keyup",l)}},[r,t]),n};var ve=s("DUKaTDO2"),j=s("jAGDuYSC"),nt=s("gyRmhZSW"),pe=s("eFxcQyPT"),ge=s("MdYBRjRJ");const st={pagination:{total:0},suggestions:[]},lt=async(t,{query:n,page:r,pageSize:i})=>{const l={collection:t,column:"title"},a=(0,nt.Z)("entity_suggestions",r,i,n,l);return(0,pe.ZP)("GET",(0,ge.DC)(a))},rt=(t,n,r)=>{if(!n)throw Error(`Attribute meta data for attribute "${t}" is missing related collection.`);const{data:i,isInitialLoading:l}=(0,ve.useQuery)(["filters","suggestions",r],()=>lt(n,r),{onError:a=>{j.Z.error(`Loading suggestions for filter failed with status: ${a}`,"Could not load filter suggestions")},retry:0,keepPreviousData:!0});return{data:i!=null?i:st,isInitialLoading:l}},Oe={query:"",pageSize:10,page:1},at=P.default.div(({theme:t})=>(0,P.css)`
color: ${t.colors.global.textDefault};
padding: 3px 10px;
`),ot=(0,P.default)(o.Input)`
margin-bottom: 6px;
`,it=P.default.div`
margin-bottom: 0;
`,ut=P.default.div(({theme:t})=>(0,P.css)`
margin-top: 9px;
font-size: ${t.fonts.size.small};
`),ct=({attribute:t,filterValueRenderer:n,onSubmit:r,allActiveFilters:i,filter:l})=>{const a=tt("Shift"),[u,c]=(0,e.useState)(Oe),{data:{pagination:d,suggestions:E},isInitialLoading:T}=rt(t.id,t.related_collection,u),v=(0,e.useCallback)(O=>{c(I=>({...I,page:Oe.page,query:O}))},[c]),B=(0,e.useCallback)(O=>{c(I=>({...I,page:O}))},[]),F=et()(O=>v(O),1e3);return e.createElement(at,null,e.createElement(ot,{type:"text",id:"search-filters-input",formGroupClassName:"",placeholder:`Search for ${t.title.toLowerCase()}`,onChange:({target:{value:O}})=>F(O)}),T&&e.createElement(h.Z,null),!!(E!=null&&E.length)&&e.createElement(m.l9,{showPageSizeSelect:!1,totalItems:d.total,hidePreviousAndNextPageLinks:!0,hideFirstAndLastPageLinks:!0,activePage:u.page,pageSize:u.pageSize,onChange:B,useQueryParameter:!1},e.createElement(it,null,E.map(O=>{var I;const H=!!((I=i==null?void 0:i.get(t.id))!=null&&I.find(({value:oe})=>oe===O.id)),V=()=>{H||r({value:O.id,title:O.value},!a)};return e.createElement(o.ListGroupItem,{onClick:V,key:`filter-value-${O.id}`,disabled:H},n?n(O.id,O.value):O.value)}))),!(E!=null&&E.length)&&e.createElement(m.pJ,null,"No entities found"),!l&&e.createElement(ut,null,e.createElement("i",null,"Hold Shift to select multiple")))};var dt=s("9oVghaOd"),mt=s.n(dt),Ce=s("O/XpfGnR"),Et=s("Y15zKX1V"),ye=s("IZYxBTgT");const _e="><",Ze=t=>t.split(_e),Ie=(t,n)=>`${t||"All time"} - ${n||"Now"}`,pt=P.default.div`
padding: 3px 10px;
max-width: 250px;
`,gt=P.default.p(({theme:t})=>(0,P.css)`
font-size: ${t.fonts.size.small};
margin: 0 0 10px;
`),St=P.default.div`
margin-bottom: 10px;
`,Fe=P.default.div`
&:not(:last-child) {
margin-bottom: 10px;
}
`,ft=P.default.div`
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 3px;
`,ht=P.default.label`
margin: 0;
`,vt=(0,P.default)(o.Checkbox)`
&.checkbox {
margin: 0;
}
`,Ct=P.default.code`
padding: 0;
`,yt=P.default.span(({theme:t})=>(0,P.css)`
color: ${t.colors.variant.dark.danger};
font-size: ${t.fonts.size.small};
font-style: italic;
padding: 3px 3px 9px;
height: 1.5em;
`),Le=({name:t,label:n,checkboxLabel:r})=>{const{formatTime:i}=(0,Ce.Z)();return e.createElement(_.Field,{name:t},({field:{value:l,onChange:a,name:u},meta:{error:c}})=>{const d=T=>a({target:{name:u,value:T}}),E=()=>d(l?void 0:i(new Date,"complete"));return e.createElement("div",null,e.createElement(ft,null,e.createElement(ht,{htmlFor:`date-input-${u}`},n),e.createElement(vt,{onChange:E,checked:!l},r)),e.createElement(Et.Z,{name:"from",value:l,disabled:!l,onChange:d}),c&&e.createElement(yt,null,c))})},Tt=t=>{const{formatTime:n}=(0,Ce.Z)();if(t){const[r,i]=Ze(t.value);return{from:r?n(r,"complete"):void 0,until:i?n(i,"complete"):void 0}}return{from:n(mt()().subtract(5,"minutes"),"complete"),until:void 0}},Ue="Format must be: YYYY-MM-DD [HH:mm:ss[.SSS]].",Rt='The "Until" date must come after the "From" date.',At=t=>{let n={};return t.from&&!(0,ye.qb)(t.from)&&(n={...n,from:Ue}),t.until&&!(0,ye.qb)(t.until)&&(n={...n,until:Ue}),t.from>=t.until&&(n={...n,until:Rt}),!t.from&&!t.until&&(n={...n,from:'Remove filter to search from "All time" until "Now".'}),n},Pt=({filter:t,onSubmit:n})=>{const{userTimezone:r}=(0,Ce.Z)(),i=Tt(t),l=a=>{const u=E=>(0,ye.Od)((0,ye.U2)(E,r),"internal"),c=a.from?u(a.from):"",d=a.until?u(a.until):"";n({title:Ie(a.from,a.until),value:`${c}${_e}${d}`})};return e.createElement(pt,{"data-testid":"time-range-form"},e.createElement(_.Formik,{initialValues:i,onSubmit:l,validate:At},({isValid:a})=>e.createElement(_.Form,null,e.createElement(St,null,e.createElement(Fe,null,e.createElement(Le,{name:"from",label:"From",checkboxLabel:"All time"})),e.createElement(Fe,null,e.createElement(Le,{name:"until",label:"Until",checkboxLabel:"Now"}))),e.createElement(gt,null,"Format: ",e.createElement(Ct,null,"YYYY-MM-DD [HH:mm:ss[.SSS]]"),".",e.createElement("br",null),"All timezones using: ",e.createElement("b",null,r),"."),e.createElement(m.os,{submitButtonText:`${t?"Update":"Create"} filter`,bsSize:"small",disabledSubmit:!a,displayCancel:!1}))))},Be=({allActiveFilters:t,attribute:n,filter:r,filterValueRenderer:i,onSubmit:l})=>e.createElement(e.Fragment,null,e.createElement(N.Z,{header:!0},r?"Edit":"Create"," ",n.title.toLowerCase()," filter"),ne(n)&&e.createElement(he,{attribute:n,filterValueRenderer:i,onSubmit:l,allActiveFilters:t}),k(n)&&e.createElement(ct,{attribute:n,filterValueRenderer:i,onSubmit:l,allActiveFilters:t,filter:r}),te(n)&&e.createElement(Pt,{onSubmit:l,filter:r}));Be.defaultProps={filter:void 0};const $e=Be,xt=P.default.div`
margin-left: 5px;
`,Dt=({attributes:t,setSelectedAttributeId:n,activeFilters:r})=>e.createElement(e.Fragment,null,e.createElement(N.Z,{header:!0},"Create Filter"),t.map(({id:i,title:l,type:a})=>{var u;const c=!!((u=r==null?void 0:r.get(i))!=null&&u.length),d=a==="BOOLEAN"?c:!1;return e.createElement(N.Z,{onSelect:()=>n(i),key:`${l}-filter`,disabled:d},l,a==="BOOLEAN"&&d&&e.createElement(m.kF,{displayLeftMargin:!0},"You can only create one filter for a boolean attribute.",e.createElement("br",null),"If you want to change the filter value, you can update the existing one."))})),Mt=({filterableAttributes:t,filterValueRenderers:n,onCreateFilter:r,activeFilters:i})=>{const[l,a]=(0,e.useState)(),u=t.find(({id:d})=>d===l),c=()=>a(void 0);return e.createElement(xt,null,e.createElement(J.Z,{title:e.createElement(m.JO,{name:"plus"}),bsSize:"small",buttonTitle:"Create Filter",onToggle:c,closeOnSelect:!1,dropdownMinWidth:120,dropdownZIndex:1e3},({toggleDropdown:d})=>{const E=(T,v=!0)=>{v&&d(),r(l,{value:T.value,title:T.title})};return l?e.createElement($e,{onSubmit:E,allActiveFilters:i,attribute:u,filterValueRenderer:n==null?void 0:n[l]}):e.createElement(Dt,{attributes:t,setSelectedAttributeId:a,activeFilters:i})}))};var bt=s("F3uT4N0K");const Ot=P.default.div`
display: flex;
`,Re=(0,P.default)(o.Button)`
display: flex;
align-items: center;
`,_t=({attribute:t,allActiveFilters:n,onChangeFilter:r,filterValueRenderer:i,filter:l})=>{const[a,u]=(0,e.useState)(!1),{value:c,title:d}=l,E=()=>{u(v=>!v)},T=v=>{r(t.id,c,{value:v.value,title:v.title}),E()};return e.createElement(bt.Z,{show:a,closeOnSelect:!1,renderToggle:({onToggle:v,toggleTarget:B})=>e.createElement(Re,{bsSize:"xsmall",onClick:v,title:"Change filter value",ref:B},i?i(c,d):d),placement:"bottom",onToggle:E},e.createElement($e,{attribute:t,filterValueRenderer:i,onSubmit:T,filter:l,allActiveFilters:n}))},Zt=({attribute:t,allActiveFilters:n,filter:r,filterValueRenderer:i,onDeleteFilter:l,onChangeFilter:a})=>{const{value:u,title:c}=r,d=()=>{if(t.type==="BOOLEAN"){const E=t.filter_options.find(({value:T})=>T!==u);a(t.id,u,{value:E.value,title:E.title})}};return e.createElement(Ot,{className:"btn-group","data-testid":`${t.id}-filter-${u}`},t.type==="BOOLEAN"&&e.createElement(Re,{bsSize:"xsmall",onClick:d,title:"Change filter value"},i?i(u,c):c),t.type!=="BOOLEAN"&&e.createElement(_t,{onChangeFilter:a,attribute:t,filter:r,allActiveFilters:n,filterValueRenderer:i}),e.createElement(Re,{bsSize:"xsmall",onClick:()=>l(t.id,u),title:"Delete filter"},e.createElement(m.JO,{name:"times"})))},We=34,It=P.default.div`
display: inline-flex;
align-items: center;
min-height: ${We}px;
gap: 3px;
flex-wrap: wrap;
`,Ft=P.default.div`
margin-right: 3px;
`,Lt=({attributes:t=[],filters:n,filterValueRenderers:r,onDeleteFilter:i,onChangeFilter:l})=>e.createElement(e.Fragment,null,n.entrySeq().map(([a,u])=>{const c=t.find(({id:d})=>d===a);return e.createElement(It,{key:a},e.createElement(Ft,null,c.title,":"),u.map(d=>e.createElement(Zt,{filter:d,allActiveFilters:n,key:`${c.id}-${d.value}`,attribute:c,filterValueRenderer:r==null?void 0:r[a],onChangeFilter:l,onDeleteFilter:i})))})),Ut=t=>t==null?void 0:t.reduce((n,{id:r,related_collection:i})=>i?{...n,[r]:i}:n,{}),Ke=(t,n)=>t.entrySeq().reduce((r,[i,l])=>(n==null?void 0:n[i])?r.set(i,l):r,(0,le.OrderedMap)()),ze=(t,n)=>({entities:t.entrySeq().reduce((r,[i,l])=>{const a=n[i];return[...r,...l.map(u=>({id:u,type:a}))]},[])}),Bt=(t,n,r,i,l,a)=>{var u,c;if(te(t)){const[d,E]=Ze(r),T=d?i(d):void 0,v=E?i(E):void 0;return Ie(T,v)}if(ne(t)){const d=t.filter_options.find(({value:E})=>E===r);return(u=d==null?void 0:d.title)!=null?u:r}if(k(t)){if(a||l!=null&&l.includes(r))return r;const d=(c=n==null?void 0:n.find(({id:E,type:T})=>T===t.related_collection&&E===r))==null?void 0:c.title;return d!=null?d:"Loading..."}return r},$t=(t,n,r,i,l,a)=>t.entrySeq().reduce((u,[c,d])=>{const E=r==null?void 0:r.find(({id:v})=>v===c),T=d.map(v=>({title:Bt(E,n,v,i,l,a),value:v}));return u.set(c,T)},(0,le.OrderedMap)()),Wt=(t,n)=>t.entrySeq().reduce((r,[i,l])=>{var a;const u=(a=n==null?void 0:n.find(({id:c})=>c===i))==null?void 0:a.related_collection;return u?[...r,...l.map(({value:c,title:d})=>({id:c,type:u,title:d}))]:r},[]),Kt=t=>(0,pe.ZP)("POST",ge.ZP.qualifyUrl("/system/catalog/entities/titles"),t),zt=(t,n,r=!0)=>{var i;const l=(0,ve.useQueryClient)(),{formatTime:a}=(0,Ce.Z)(),u=Ut(n),c=Ke(t,u),d=ze(c,u),{data:E,isInitialLoading:T,isError:v}=(0,ve.useQuery)(["entity_titles",d],()=>Kt(d),{onError:H=>{j.Z.error(`Loading filter titles failed with status: ${H}`,"Could not load streams")},keepPreviousData:!0,enabled:r&&!!d.entities.length}),B=l.getQueryData(["entity_titles",d]),F=(i=B!=null?B:E)==null?void 0:i.entities,O=$t(t,F,n,a,E==null?void 0:E.not_permitted_to_view,v),I=(0,e.useCallback)((H,V)=>{const oe=Ke(V,u),me=ze(oe,u),Ee=Wt(H,n);l.setQueryData(["entity_titles",me],{entities:Ee})},[n,u,l]);return{data:O,isInitialLoading:T,onChange:I}},Ht=["STRING","BOOLEAN","DATE"],Nt=P.default.div`
display: inline-flex;
height: ${We}px;
align-items: center;
margin-left: 5px;
&& {
margin-right: 10px;
}
`,He=({attributes:t=[],filterValueRenderers:n,urlQueryFilters:r,setUrlQueryFilters:i})=>{const{data:l,onChange:a}=zt(r,t,!!t),u=t.filter(({filterable:v,type:B})=>v&&Ht.includes(B)),c=(0,e.useCallback)(v=>{const B=v.entrySeq().reduce((F,[O,I])=>{var H;return F.set(O,[...(H=F.get(O))!=null?H:[],...I.map(({value:V})=>V)])},(0,le.OrderedMap)());a(v,B),i(B)},[a,i]),d=(0,e.useCallback)((v,B)=>{var F;c((0,le.OrderedMap)(l).set(v,[...(F=l==null?void 0:l.get(v))!=null?F:[],B]))},[l,c]),E=(0,e.useCallback)((v,B)=>{const O=l.get(v).filter(({value:I})=>I!==B);return O.length?c(l.set(v,O)):c(l.remove(v))},[l,c]),T=(0,e.useCallback)((v,B,F)=>{const O=l.get(v),I=O.findIndex(({value:V})=>V===B),H=[...O];H[I]=F,c(l.set(v,H))},[l,c]);return u.length?e.createElement(e.Fragment,null,e.createElement(Nt,null,"Filters",e.createElement(Mt,{filterableAttributes:u,onCreateFilter:d,activeFilters:l,filterValueRenderers:n})),l&&e.createElement(Lt,{filters:l,attributes:t,onChangeFilter:T,onDeleteFilter:E,filterValueRenderers:n})):null};He.defaultProps={filterValueRenderers:void 0};const Gt=He,jt=P.default.div(({$disabled:t,theme:n})=>(0,P.css)`
display: flex;
border-radius: 50%;
height: 10px;
width: 10px;
background-color: ${t==="true"?n.colors.variant.warning:n.colors.variant.success};
margin-right: 3px;
border: 1px solid ${n.colors.gray[70]};
`),Yt={disabled:(t,n)=>e.createElement(e.Fragment,null,e.createElement(jt,{$disabled:t}),n)};var ue=s("ty2gyrHp"),ce=s("d4kzUuQm"),Qt=s("8wYeYPUw"),wt=s("YTcgvcFD"),Ne=s("0CyR/E1C"),Jt=s("HqzDVmZB"),Ge=s("q2j1bVbz"),je=s("HhRuy6uH");const de=()=>e.createElement(m.kF,{displayLeftMargin:!0},"Action not available for the default stream"),kt=({stream:t,indexSets:n})=>{const r=(0,Ge.Z)(),[i,l]=(0,e.useState)(!1),[a,u]=(0,e.useState)(!1),[c,d]=(0,e.useState)(!1),[E,T]=(0,e.useState)(!1),[v,B]=(0,e.useState)(!1),F=(0,R.Z)(),O=(0,e.useCallback)(()=>wt.A.set(r.id,"stream",t.id),[t.id,r.id]),I=t.is_default,H=!t.is_editable,V=(0,e.useCallback)(async()=>{F(U.A.STREAMS.STREAM_ITEM_STATUS_TOGGLED,{app_pathname:"streams",app_action_value:" stream-item-status",event_details:{enabled:!t.disabled}}),B(!0),t.disabled&&await $.ZP.resume(t.id,L=>L),!t.disabled&&window.confirm(`Do you really want to pause stream '${t.title}'?`)&&await $.ZP.pause(t.id,L=>L),B(!1)},[F,t.disabled,t.id,t.title]),oe=(0,e.useCallback)(()=>{F(U.A.STREAMS.STREAM_ITEM_SHARE_MODAL_OPENED,{app_pathname:"streams"}),l(L=>!L)},[F]),me=(0,e.useCallback)(()=>{d(L=>!L)},[]),Ee=(0,e.useCallback)(()=>{T(L=>!L)},[]),Te=(0,e.useCallback)(()=>{u(L=>!L)},[]),De=(0,e.useCallback)(()=>{window.confirm("Do you really want to remove this stream?")&&(F(U.A.STREAMS.STREAM_ITEM_DELETED,{app_pathname:"streams",app_action_value:"stream-item-delete"}),$.ZP.remove(t.id,L=>(j.Z.success(`Stream '${t.title}' was deleted successfully.`,"Success"),L)).catch(L=>{j.Z.error(`An error occurred while deleting the stream. ${L}`)}))},[F,t.id,t.title]),Se=(0,e.useCallback)((L,fe)=>K.b.create(t.id,fe,()=>{F(U.A.STREAMS.STREAM_ITEM_RULE_SAVED,{app_pathname:"streams",app_action_value:"stream-item-rule"}),j.Z.success("Stream rule was created successfully.","Success")}),[F,t.id]),Me=(0,e.useCallback)(L=>$.ZP.update(t.id,L,fe=>(F(U.A.STREAMS.STREAM_ITEM_UPDATED,{app_pathname:"streams"}),j.Z.success(`Stream '${L.title}' was updated successfully.`,"Success"),fe)),[F,t.id]),be=(0,e.useCallback)(L=>(F(U.A.STREAMS.STREAM_ITEM_CLONED,{app_pathname:"streams"}),$.ZP.cloneStream(t.id,L,fe=>(j.Z.success(`Stream was successfully cloned as '${L.title}'.`,"Success"),fe))),[F,t.id]);return e.createElement(o.ButtonToolbar,null,e.createElement(m.Tz,{entityId:t.id,entityType:"stream",onClick:oe,bsSize:"xsmall"}),e.createElement(J.Z,{title:je.zN,bsSize:"xsmall",buttonTitle:je.V,disabled:H,dropdownZIndex:1e3},e.createElement(m.AE,{permissions:[`streams:changestate:${t.id}`,`streams:edit:${t.id}`],anyPermissions:!0},e.createElement(o.MenuItem,{bsStyle:"success",onSelect:V,disabled:I||H},v?e.createElement("span",null,t.disabled?"Starting Stream...":"Stopping Stream..."):e.createElement("span",null,t.disabled?"Start Stream":"Stop Stream"),I&&e.createElement(de,null))),e.createElement(m.AE,{permissions:`streams:edit:${t.id}`},e.createElement(o.MenuItem,{onSelect:Te,disabled:I},"Quick add rule ",I&&e.createElement(de,null))),e.createElement(m.AE,{permissions:`streams:edit:${t.id}`},e.createElement(o.MenuItem,{onSelect:me,disabled:I},"Edit stream ",I&&e.createElement(de,null))),e.createElement(m.AE,{permissions:[`streams:edit:${t.id}`]},e.createElement(o.MenuItem,{divider:!0})),e.createElement(m.AE,{permissions:[`streams:edit:${t.id}`]},e.createElement(ue.J,{to:ce.ZP.stream_edit(t.id)},e.createElement(o.MenuItem,{disabled:I||H},"Manage Rules ",I&&e.createElement(de,null)))),e.createElement(Qt.Z,null,e.createElement(m.AE,{permissions:"stream_outputs:read"},e.createElement(ue.J,{to:ce.ZP.stream_outputs(t.id)},e.createElement(o.MenuItem,null,"Manage Outputs")))),e.createElement(m.AE,{permissions:`streams:edit:${t.id}`},e.createElement(ue.J,{to:ce.ZP.stream_alerts(t.id)},e.createElement(o.MenuItem,null,"Manage Alerts"))),e.createElement(m.AE,{permissions:`streams:edit:${t.id}`},e.createElement(o.MenuItem,{divider:!0})),e.createElement(o.MenuItem,{onSelect:O,disabled:r.readOnly},"Set as startpage"),e.createElement(m.AE,{permissions:["streams:create",`streams:read:${t.id}`]},e.createElement(o.MenuItem,{onSelect:Ee,disabled:I},"Clone this stream ",I&&e.createElement(de,null))),e.createElement(m.AE,{permissions:`streams:edit:${t.id}`},e.createElement(o.MenuItem,{onSelect:De,disabled:I},"Delete this stream ",I&&e.createElement(de,null)))),c&&e.createElement(x,{title:"Editing Stream",onSubmit:Me,onClose:me,submitButtonText:"Update stream",submitLoadingText:"Updating stream...",initialValues:t,indexSets:n}),E&&e.createElement(x,{title:"Cloning Stream",onSubmit:be,onClose:Ee,submitButtonText:"Clone stream",submitLoadingText:"Cloning stream...",indexSets:n}),a&&e.createElement(Ne.Z,{onClose:Te,title:"New Stream Rule",submitButtonText:"Create Rule",submitLoadingText:"Creating Rule...",onSubmit:Se}),i&&e.createElement(Jt.Z,{entityId:t.id,entityType:"stream",entityTitle:t.title,description:"Search for a User or Team to add as collaborator on this stream.",onClose:oe}))};var Ae=s("TJOheZRu"),Pe=s("U1Iufsob"),Xt=s("Z2BtcgLJ"),Ye=s("0TVxnHwi"),Vt=s("gToK60tD"),qt=s("rp7UD7rK");const en=({selectedStreamIds:t,toggleShowModal:n,indexSets:r,refetchStreams:i,setSelectedStreamIds:l,descriptor:a})=>{const u=`Assign Index Set To ${t.length} ${Ae.Z.capitalizeFirstLetter(a)}`,c=({index_set_id:E})=>Vt.VE.assignToIndexSet(E,t).then(()=>{i(),j.Z.success(`Index set was assigned to ${t.length} ${a} successfully.`,"Success"),l([]),n()}).catch(T=>{j.Z.error(`Assigning index set failed with status: ${T}`,"Error")}),d=({index_set_id:E})=>{let T={};return E||(T={...T,index_set_id:"Index set is required"}),T};return e.createElement(o.Modal,{title:u,onHide:n,show:!0},e.createElement(_.Formik,{initialValues:{index_set_id:void 0},onSubmit:c,validate:d},({isSubmitting:E,isValidating:T})=>e.createElement(_.Form,null,e.createElement(o.Modal.Header,{closeButton:!0},e.createElement(o.Modal.Title,null,u)),e.createElement(o.Modal.Body,null,e.createElement(C,{indexSets:r,help:"Messages that match the selected streams will be written to the configured index set."})),e.createElement(o.Modal.Footer,null,e.createElement(qt.Z,{submitButtonText:"Assign index set",submitLoadingText:"Assigning index set...",onCancel:n,disabledSubmit:T,isSubmitting:E})))))},Qe=({indexSets:t,selectedStreamIds:n,setSelectedStreamIds:r,descriptor:i,refetchStreams:l,onSelect:a})=>{const[u,c]=(0,e.useState)(!1),d=(0,e.useCallback)(()=>{!u&&typeof a=="function"&&a(),c(E=>!E)},[a,u]);return(0,Ye.rq)("indexsets:read")?e.createElement(e.Fragment,null,e.createElement(N.Z,{onSelect:d},"Assign index set"),u&&e.createElement(en,{selectedStreamIds:n,setSelectedStreamIds:r,toggleShowModal:d,indexSets:t,descriptor:i,refetchStreams:l})):null};Qe.defaultProps={onSelect:void 0};const tn=Qe,we=({selectedStreamIds:t,handleFailures:n,refetchStreams:r,descriptor:i,onSelect:l})=>{const a=(0,e.useCallback)(()=>{typeof l=="function"&&l(),(0,pe.ZP)("POST",(0,ge.DC)(Pe.Z.StreamsApiController.bulk_pause().url),{entity_ids:t}).then(({failures:u})=>n(u,"stopped")).catch(u=>{j.Z.error(`An error occurred while stopping streams. ${u}`)}).finally(()=>{r()})},[n,l,r,t]);return e.createElement(N.Z,{onSelect:a},"Stop ",i)};we.defaultProps={onSelect:void 0};const nn=we;var sn=s("nxMFMmDQ"),ln=s("/8lbhT5j"),rn=s("CHWvwBKE");const an=t=>ln.Z.builder().timerange(sn.nn).query((0,rn.Eg)()).streams(t).build().toURL(),on=({selectedStreamIds:t})=>{const n=an(t);return e.createElement(N.Z,{href:n,target:"_blank"},"Search in streams")},Je=({selectedStreamIds:t,handleFailures:n,refetchStreams:r,descriptor:i,onSelect:l})=>{const a=(0,e.useCallback)(()=>{typeof l=="function"&&l(),(0,pe.ZP)("POST",(0,ge.DC)(Pe.Z.StreamsApiController.bulk_resume().url),{entity_ids:t}).then(({failures:u})=>n(u,"started")).catch(u=>{j.Z.error(`An error occurred while starting streams. ${u}`)}).finally(()=>{r()})},[n,l,r,t]);return e.createElement(N.Z,{onSelect:a},"Start ",i)};Je.defaultProps={onSelect:void 0};const un=Je,cn=({selectedStreamIds:t,setSelectedStreamIds:n,indexSets:r})=>{const i=(0,ve.useQueryClient)(),l=t==null?void 0:t.length,a=Ae.Z.pluralize(l,"stream","streams"),u=(0,e.useCallback)(()=>i.invalidateQueries(["streams","overview"]),[i]),c=(0,e.useCallback)((E,T)=>{if(E!=null&&E.length){const v=E.map(({entity_id:B})=>B);n(v),j.Z.error(`${v.length} out of ${l} selected ${a} could not be ${T}.`)}else n([]),j.Z.success(`${l} ${a} ${Ae.Z.pluralize(l,"was","were")} ${T} successfully.`,"Success")},[a,l,n]),d=(0,e.useCallback)(()=>{window.confirm(`Do you really want to remove ${l} ${a}? This action cannot be undone.`)&&(0,pe.ZP)("POST",(0,ge.DC)(Pe.Z.StreamsApiController.bulk_delete().url),{entity_ids:t}).then(({failures:E})=>c(E,"deleted")).catch(E=>{j.Z.error(`An error occurred while deleting streams. ${E}`)}).finally(()=>{u()})},[a,c,u,l,t]);return e.createElement(Xt.Z,{selectedEntities:t,setSelectedEntities:n},e.createElement(tn,{indexSets:r,selectedStreamIds:t,setSelectedStreamIds:n,descriptor:a,refetchStreams:u}),e.createElement(on,{selectedStreamIds:t}),e.createElement(un,{handleFailures:c,selectedStreamIds:t,refetchStreams:u,descriptor:a}),e.createElement(nn,{handleFailures:c,selectedStreamIds:t,refetchStreams:u,descriptor:a}),e.createElement(N.Z,{onSelect:d},"Delete"))};var dn=s("RfX2tXzp");const mn=t=>{switch(t){case"OR":return"at least one";case"AND":default:return"all"}},En=({stream:t})=>e.createElement(e.Fragment,null,e.createElement("p",null,"Must match ",mn(t.matching_type)," of the ",t.rules.length," configured stream ",e.createElement(m.qX,{value:t.rules.length,plural:"rules",singular:"rule"}),"."),e.createElement(dn.Z,{stream:t})),pn=({stream:t})=>{const[n,r]=(0,e.useState)(!1),i=t.is_default,l=!t.is_editable,a=(0,e.useCallback)(()=>{r(c=>!c)},[]),u=(0,e.useCallback)((c,d)=>K.b.create(t.id,d,()=>j.Z.success("Stream rule was created successfully.","Success")),[t.id]);return e.createElement(e.Fragment,null,e.createElement(m.AE,{permissions:[`streams:edit:${t.id}`]},e.createElement(ue.J,{to:ce.ZP.stream_edit(t.id)},e.createElement(o.Button,{bsStyle:"link",bsSize:"xsmall",disabled:i||l},"Manage Rules"))),e.createElement(m.AE,{permissions:[`streams:edit:${t.id}`]},e.createElement(o.Button,{bsStyle:"info",bsSize:"xsmall",disabled:i||l,onClick:a},"Quick add rule")),n&&e.createElement(Ne.Z,{onClose:a,title:"New Stream Rule",submitButtonText:"Create Rule",submitLoadingText:"Creating Rule...",onSubmit:u}))},gn=({indexSets:t})=>{const n=(0,e.useCallback)(u=>e.createElement(kt,{stream:u,indexSets:t}),[t]),r=(0,e.useCallback)((u,c)=>e.createElement(cn,{selectedStreamIds:u,setSelectedStreamIds:c,indexSets:t}),[t]),i=(0,e.useCallback)(u=>e.createElement(En,{stream:u}),[]),l=(0,e.useCallback)(u=>e.createElement(pn,{stream:u}),[]),a=(0,e.useMemo)(()=>({rules:{title:"Rules",content:i,actions:l}}),[i,l]);return{entityActions:n,bulkActions:r,expandedSections:a}},Sn=()=>{const[t,n]=(0,p.useQueryParam)("filters",p.ArrayParam),r=(0,e.useMemo)(()=>(t!=null?t:[]).reduce((l,a)=>{var u;const[c,d]=a.split(/=(.*)/);return l.set(c,[...(u=l.get(c))!=null?u:[],d])},(0,le.OrderedMap)()),[t]),i=(0,e.useCallback)(l=>{const a=l.entrySeq().reduce((u,[c,d])=>[...u,...d.map(E=>`${c}=${E}`)],[]);n(a)},[n]);return[r,i]},fn=({stream:t,indexSets:n})=>{const r=(0,Ge.Z)();if(!(0,Ye.rq)(r.permissions,["indexsets:read"]))return null;const i=n.find(l=>l.id===t.index_set_id)||n.find(l=>l.default);return i?e.createElement(ue.r,{to:ce.ZP.SYSTEM.INDEX_SETS.SHOW(i.id)},i.title):e.createElement("i",null,"not found")};var xe=s("woUyHGxd"),ke=s("8fnsnG21");const hn=({stream:t})=>{const{metrics:n}=(0,ke.o)(xe.q),r=`org.graylog2.plugin.streams.Stream.${t.id}.incomingMessages.1-sec-rate`;if((0,e.useEffect)(()=>(xe.K.addGlobal(r),()=>{xe.K.removeGlobal(r)})),!n)return e.createElement(m.$j,null);const i=Object.keys(n).map(l=>{var a;const u=(a=n[l])==null?void 0:a[r];return u!=null&&u.metric&&"value"in u.metric?u.metric.value:0}).reduce((l,a)=>l+a,0);return e.createElement(e.Fragment,null,i," msg/s")},vn=(0,P.default)(o.Label)(({$clickable:t})=>(0,P.css)`
cursor: ${t?"pointer":"default"};
display: inline-flex;
justify-content: center;
gap: 4px;
`),Cn=P.default.div`
border-left: 1px solid currentColor;
height: 1em;
`,yn=(t,n,r)=>n?r:t?"Start stream":"Pause stream",Tn=({stream:t})=>{const n=t.is_default||!t.is_editable,r=t.disabled?"Paused":"Running",i=yn(t.disabled,n,r),l=(0,R.Z)(),a=(0,e.useCallback)(async()=>{l(U.A.STREAMS.STREAM_ITEM_STATUS_TOGGLED,{app_pathname:"streams",app_action_value:"stream-item-status",event_details:{enabled:!t.disabled}}),t.disabled&&await $.sH.resume(t.id,u=>u),!t.disabled&&window.confirm(`Do you really want to pause stream '${t.title}'?`)&&await $.sH.pause(t.id,u=>u)},[l,t.disabled,t.id,t.title]);return e.createElement(vn,{bsStyle:t.disabled?"warning":"success",onClick:n?void 0:a,title:i,"aria-label":i,role:"button",$clickable:!n},t.disabled?"Paused":"Running",!n&&e.createElement(e.Fragment,null,e.createElement(Cn,null),e.createElement(m.JO,{name:t.disabled?"play":"pause"})))};var Rn=s("Nm+SUS6U");const An=()=>{const t=(0,e.useContext)(Rn.Z);if(!t)throw new Error("useExpandedSections hook needs to be used inside ExpandedSectionsProvider");return t},Pn=(0,P.default)(m.Z2)`
cursor: pointer;
`,xn=({stream:t})=>{var n;const r=(0,e.useRef)(),{toggleSection:i,expandedSections:l}=An(),a=(0,e.useCallback)(()=>i(t.id,"rules"),[t.id,i]);if(t.is_default||!t.is_editable)return null;const u=(n=l==null?void 0:l[t.id])==null?void 0:n.includes("rules");return e.createElement(Pn,{onClick:a,ref:r,title:`${u?"Hide":"Show"} stream rules`},t.rules.length)},Dn=(0,P.default)(o.Label)`
display: inline-flex;
margin-left: 5px;
vertical-align: inherit;
`,Mn=t=>({attributes:{title:{renderCell:(n,r)=>e.createElement(e.Fragment,null,e.createElement(ue.r,{to:ce.ZP.stream_search(r.id)},n),r.is_default&&e.createElement(Dn,{bsStyle:"primary",bsSize:"xsmall"},"Default"))},index_set_title:{renderCell:(n,r)=>e.createElement(fn,{indexSets:t,stream:r}),width:.7},throughput:{renderCell:(n,r)=>e.createElement(hn,{stream:r}),staticWidth:120},disabled:{renderCell:(n,r)=>e.createElement(Tn,{stream:r}),staticWidth:100},rules:{renderCell:(n,r)=>e.createElement(xn,{stream:r}),staticWidth:70}}}),bn=({updateTableLayout:t,paginationQueryParameter:n,setQuery:r})=>{const i=(0,e.useCallback)(d=>{n.setPagination({page:1,pageSize:d}),t({perPage:d})},[n,t]),l=(0,e.useCallback)(d=>{n.resetPage(),r(d)},[n,r]),a=(0,e.useCallback)(()=>{l("")},[l]),u=(0,e.useCallback)(d=>{t({displayedAttributes:d})},[t]),c=(0,e.useCallback)(d=>{n.resetPage(),t({sort:d})},[n,t]);return{onPageSizeChange:i,onSearch:l,onSearchReset:a,onColumnsChange:u,onSortChange:c}},On=t=>{(0,e.useEffect)(()=>($.ZP.onChange(()=>t()),K.b.onChange(()=>t()),()=>{$.ZP.unregister(()=>t()),K.b.unregister(()=>t())}),[t])},Xe=({indexSets:t})=>{const[n,r]=Sn(),[i,l]=(0,p.useQueryParam)("query",p.StringParam),{layoutConfig:a,isInitialLoading:u}=(0,ae.Z)({entityTableId:ie,defaultPageSize:z.pageSize,defaultDisplayedAttributes:z.displayedColumns,defaultSort:z.sort}),c=(0,w.ZP)(void 0,a.pageSize,!1),{mutate:d}=(0,se.Z)(ie),{data:E,isInitialLoading:T,refetch:v}=(0,Y.Z)({query:i,page:c.page,pageSize:a.pageSize,sort:a.sort,filters:n},{enabled:!u}),{entityActions:B,expandedSections:F,bulkActions:O}=gn({indexSets:t}),{onPageSizeChange:I,onSearch:H,onSearchReset:V,onColumnsChange:oe,onSortChange:me}=bn({paginationQueryParameter:c,updateTableLayout:d,setQuery:l}),Ee=(0,e.useCallback)(L=>{c.resetPage(),r(L)},[c,r]);On(v);const Te=(0,e.useMemo)(()=>Mn(t),[t]),De=(0,e.useMemo)(()=>{var L;return[...(L=E==null?void 0:E.attributes)!=null?L:[],...ee]},[E==null?void 0:E.attributes]);if(u||T)return e.createElement(h.Z,null);const{elements:Se,attributes:Me,pagination:{total:be}}=E;return e.createElement(m.l9,{pageSize:a.pageSize,showPageSizeSelect:!1,totalItems:be},e.createElement("div",{style:{marginBottom:5}},e.createElement(m.UI,{onSearch:H,onReset:V,query:i,queryHelpComponent:e.createElement(Q.Z,{entityName:"stream"})},e.createElement(Gt,{attributes:Me,urlQueryFilters:n,setUrlQueryFilters:Ee,filterValueRenderers:Yt}))),e.createElement("div",null,(Se==null?void 0:Se.length)===0?e.createElement(m.pJ,null,"No streams have been found"):e.createElement(G.Z,{data:Se,visibleColumns:a.displayedAttributes,columnsOrder:z.columnsOrder,onColumnsChange:oe,onSortChange:me,onPageSizeChange:I,pageSize:a.pageSize,bulkSelection:{actions:O},expandedSectionsRenderer:F,activeSort:a.sort,rowActions:B,actionsCellWidth:160,columnRenderers:Te,columnDefinitions:De,entityAttributesAreCamelCase:!1})))};Xe.propTypes={indexSets:S().array.isRequired};const _n=Xe;var Zn=s("/W/x1zfW"),In=s("E+CaPsQD"),Ve=s("PhRf2fIG");const Fn=()=>{const{indexSets:t}=(0,ke.o)(Ve.Fp),n=(0,R.Z)(),r=l=>(n(U.A.STREAMS.NEW_STREAM_CREATED,{app_pathname:"streams"}),$.ZP.save(l,()=>{j.Z.success("Stream has been successfully created.","Success")}));return(0,e.useEffect)(()=>{Ve.p1.list(!1)},[]),t?e.createElement(m.$4,{title:"Streams"},e.createElement(Zn.Z,{title:"Streams",documentationLink:{title:"Streams documentation",path:In.Z.PAGES.STREAMS},actions:e.createElement(m.AE,{permissions:"streams:create"},e.createElement(D,{bsStyle:"success",onCreate:r,indexSets:t}))},e.createElement("span",null,"You can route incoming messages into streams by applying rules against them. Messages matching the rules of a stream are routed into it. A message can also be routed into multiple streams.")),e.createElement(o.Row,{className:"content"},e.createElement(o.Col,{md:12},e.createElement(_n,{indexSets:t})))):e.createElement(m.$j,null)}},PhRf2fIG:(q,W,s)=>{s.d(W,{Fp:()=>U,p1:()=>R,wv:()=>x});var e=s("JnTtTRmZ"),o=s.n(e),A=s("ii0bleBb"),S=s.n(A),_=s("8u9vblRK"),m=s.n(_),M=s("U1Iufsob"),Z=s("eFxcQyPT"),C=s("MdYBRjRJ"),y=s("jAGDuYSC"),g=s("IA3Ku5lS"),b=s("6bzBY7Xo");const x=S().shape({can_be_default:S().bool,id:S().string,title:S().string,description:S().string.isRequired,index_prefix:S().string.isRequired,shards:S().number.isRequired,replicas:S().number.isRequired,rotation_strategy_class:S().string.isRequired,rotation_strategy:b.uA.isRequired,retention_strategy_class:S().string.isRequired,retention_strategy:b.zB.isRequired,creation_date:S().string,index_analyzer:S().string.isRequired,index_optimization_max_num_segments:S().number.isRequired,index_optimization_disabled:S().bool.isRequired,field_type_refresh_interval:S().number.isRequired,index_template_type:S().string,writable:S().bool.isRequired,default:S().bool.isRequired}),R=(0,g.ei)("core.IndexSets",()=>o().createActions({list:{asyncResult:!0},listPaginated:{asyncResult:!0},get:{asyncResult:!0},update:{asyncResult:!0},create:{asyncResult:!0},delete:{asyncResult:!0},searchPaginated:{asyncResult:!0},setDefault:{asyncResult:!0},stats:{asyncResult:!0}})),U=(0,g.dS)("core.IndexSets",()=>o().createStore({listenables:[R],indexSetsCount:void 0,indexSets:void 0,indexSetStats:void 0,indexSet:void 0,globalIndexSetStats:void 0,getInitialState(){return this.getState()},getState(){return{indexSetsCount:this.indexSetsCount,indexSets:this.indexSets,indexSetStats:this.indexSetStats,indexSet:this.indexSet,globalIndexSetStats:this.globalIndexSetStats}},propagateChanges(){this.trigger(this.getState())},list(f){const D=(0,C.DC)(M.Z.IndexSetsApiController.list(f).url),p=(0,Z.ZP)("GET",D);p.then(h=>(this.indexSetsCount=h.total,this.indexSets=h.index_sets,this.indexSetStats=h.stats,this.propagateChanges(),h),h=>{y.Z.error(`Fetching index sets list failed: ${h.message}`,"Could not retrieve index sets.")}),R.list.promise(p)},listPaginated(f,D,p){const h=(0,C.DC)(M.Z.IndexSetsApiController.listPaginated(f,D,p).url),Q=(0,Z.ZP)("GET",h);Q.then($=>(this.indexSetsCount=$.total,this.indexSets=$.index_sets,this.indexSetStats=$.stats,this.propagateChanges(),$),$=>{y.Z.error(`Fetching index sets list failed: ${this._errorMessage($)}`,"Could not retrieve index sets.")}),R.listPaginated.promise(Q)},searchPaginated(f,D,p,h){const Q=(0,C.DC)(M.Z.IndexSetsApiController.searchPaginated(f,D,p,h).url),$=(0,Z.ZP)("GET",Q);$.then(K=>(this.indexSetsCount=K.total,this.indexSets=K.index_sets,this.indexSetStats=K.stats,this.propagateChanges(),K),K=>{y.Z.error(`Fetching index sets list failed: ${this._errorMessage(K)}`,"Could not retrieve index sets.")}),R.searchPaginated.promise($)},get(f){const D=(0,C.DC)(M.Z.IndexSetsApiController.get(f).url),p=(0,Z.ZP)("GET",D);p.then(h=>(this.indexSet=h,this.propagateChanges(),h),h=>{y.Z.error(`Fetching index set '${f}' failed with status: ${this._errorMessage(h)}`,"Could not retrieve index set.")}),R.get.promise(p)},update(f){const D=(0,C.DC)(M.Z.IndexSetsApiController.get(f.id).url),p=(0,Z.ZP)("PUT",D,f);p.then(h=>(y.Z.success(`Successfully updated index set '${f.title}'`,"Success"),this.indexSet=h,this.propagateChanges(),h),h=>{y.Z.error(`Updating index set '${f.title}' failed with status: ${this._errorMessage(h)}`,"Could not update index set.")}),R.update.promise(p)},create(f){const D=(0,C.DC)(M.Z.IndexSetsApiController.create().url),p=(0,Z.ZP)("POST",D,f);p.then(h=>(y.Z.success(`Successfully created index set '${f.title}'`,"Success"),this.indexSet=h,this.propagateChanges(),h),h=>{y.Z.error(`Creating index set '${f.title}' failed with status: ${this._errorMessage(h)}`,"Could not create index set.")}),R.create.promise(p)},delete(f,D){const p=(0,C.DC)(M.Z.IndexSetsApiController.delete(f.id,D).url),h=(0,Z.ZP)("DELETE",p);h.then(()=>{y.Z.success(`Successfully deleted index set '${f.title}'`,"Success")},Q=>{y.Z.error(`Deleting index set '${f.title}' failed with status: ${this._errorMessage(Q)}`,"Could not delete index set.")}),R.delete.promise(h)},setDefault(f){const D=(0,C.DC)(M.Z.IndexSetsApiController.setDefault(f.id).url),p=(0,Z.ZP)("PUT",D);p.then(()=>{y.Z.success(`Successfully set index set '${f.title}' as default`,"Success")},h=>{y.Z.error(`Setting index set '${f.title}' as default failed with status: ${this._errorMessage(h)}`,"Could not set default index set.")}),R.setDefault.promise(p)},stats(){const f=(0,C.DC)(M.Z.IndexSetsApiController.stats().url),D=(0,Z.ZP)("GET",f);D.then(p=>(this.globalIndexSetStats={indices:p.indices,documents:p.documents,size:p.size},this.propagateChanges(),p),p=>{y.Z.error(`Fetching global index stats failed: ${p.message}`,"Could not retrieve global index stats.")}),R.stats.promise(D)},_errorMessage(f){try{return m()(f.additional.body)?f.additional.body.map(({message:D,path:p})=>`${p!=null?p:""} ${D}.`).join(" "):f.additional.body.message}catch{return f.message}}}))},"W/ejv//U":(q,W,s)=>{s.d(W,{R:()=>Z,l:()=>M});var e=s("JnTtTRmZ"),o=s.n(e),A=s("jAGDuYSC"),S=s("MdYBRjRJ"),_=s("eFxcQyPT"),m=s("IA3Ku5lS");const M=(0,m.ei)("core.StreamRulesInputs",()=>o().createActions({list:{asyncResult:!0}})),Z=(0,m.dS)("core.StreamRulesInputs",()=>o().createStore({listenables:[M],sourceUrl:"/streams/rules/inputs",inputs:void 0,init(){this.list()},_state(){return{inputs:this.inputs}},getInitialState(){return this._state()},list(){const C=(0,_.ZP)("GET",(0,S.DC)(this.sourceUrl));C.then(y=>(this.inputs=y.inputs,this.trigger(this._state()),this.inputs),y=>{A.Z.error(`Fetching Stream Rule Inputs List failed with status: ${y}`,"Could not retrieve Stream Rule Inputs")}),M.list.promise(C)}}))},apKKh8n6:(q,W,s)=>{s.d(W,{b:()=>y});var e=s("JnTtTRmZ"),o=s.n(e),A=s("XYSsaeV4"),S=s.n(A),_=s("eFxcQyPT"),m=s("U1Iufsob"),M=s("MdYBRjRJ"),Z=s("jAGDuYSC"),C=s("IA3Ku5lS");const y=(0,C.dS)("core.StreamRules",()=>o().createStore({callbacks:[],types(){const g="/streams/null/rules/types";return(0,_.ZP)("GET",M.DC(g))},update(g,b,x,R){const U=p=>{Z.Z.error(`Updating Stream Rule failed with status: ${p}`,"Could not update Stream Rule")},f=M.DC(m.Z.StreamRulesApiController.update(g,b).url),D={field:x.field,type:x.type,value:x.value,inverted:x.inverted,description:x.description};return(0,_.ZP)("PUT",f,D).then(R,U).then(this._emitChange.bind(this))},remove(g,b,x){const R=f=>{Z.Z.error(`Deleting Stream Rule failed with status: ${f}`,"Could not delete Stream Rule")},U=M.DC(m.Z.StreamRulesApiController.delete(g,b).url);(0,_.ZP)("DELETE",U).then(x,R).then(this._emitChange.bind(this))},create(g,b,x){const R=f=>{Z.Z.error(`Creating Stream Rule failed with status: ${f}`,"Could not create Stream Rule")},U=M.DC(m.Z.StreamRulesApiController.create(g).url);return(0,_.ZP)("POST",U,b).then(x,R).then(this._emitChange.bind(this))},onChange(g){this.callbacks.push(g)},_emitChange(){this.callbacks.forEach(g=>g())},unregister(g){S()(this.callbacks,g)}}))}}]);})();
//# sourceMappingURL=1255d548-5534.890176091ac76b162587.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy