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

web-interface.assets.ShowViewPage.e3bf67c5aa42ea3bdc0b.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-2882"],{icrwsL0X:(Z,y,t)=>{t.d(y,{A:()=>A});var e=t("Z7aTuO5B"),E=t("J6y4/h8P"),w=t("rIl5IEuP"),P=t("IOI9nV80"),T=t("z6QEDyg6"),p=t("9oVghaOd"),N=t.n(p),K=t("Dg7SLLbb"),V=t.n(K),H=t("Z/o2hWBZ"),G=t("UMMlOSMl"),$=t("ATOIS62c"),F=t("ty2gyrHp"),z=t("d4kzUuQm"),c=t("NhiTWmq4"),C=t("nxMFMmDQ"),L=t("m81tulV4"),W=t("YcvsU7cw"),r=t("dogTzS57"),o=t("gofDlXL2"),D=t("UnwAqHt2"),g=t("orDZ6Vj2");const f=({name:n})=>e.createElement("i",null,"No ",n.toLowerCase()," provided"),X=E.default.div`
  display: flex;
  gap: 5px;
`,J=E.default.div`
  display: flex;
  gap: 5px;
  align-items: center;
`,j=E.default.div`
  width: 13px;
  height: 13px;
  border-radius: 2px;
  cursor: pointer;
`,x=()=>(0,W.A)(r.W),k=()=>{const n=(0,g.A)(),{aggregations:i}=(0,T.A)(),a=x(),s=(0,e.useMemo)(()=>new Map(i.map(v=>[`${v.fnSeries}${v.expr}${v.value}`,v])),[i]),d=(0,e.useCallback)(({rule:v,newColor:O,condition:_})=>{if(v)n((0,o.lf)(v,{color:c.QU.create(O)}));else{const{value:m,fnSeries:R,expr:Q}=s.get(_);n((0,o.iw)([{value:m,field:R,color:(0,D.XL)(),condition:L.p[Q]}]))}},[s,n]),B=(0,e.useMemo)(()=>{const v=new Map(i.map(({fnSeries:O,value:_,expr:m})=>[`${O}${m}${_}`,void 0]));return a.reduce((O,_)=>{var m;const{field:R,value:Q,condition:Y}=_,st=(m=L.d)==null?void 0:m[Y];let at=O;if(st){const et=`${R}${st}${Q}`;O.has(et)&&(at=at.set(et,_))}return at},v)},[i,a]);return B!=null&&B.size?e.createElement(X,null,Array.from(B).map(([v,O])=>{const _=O==null?void 0:O.color,m=_==null?void 0:_.color;return e.createElement(J,{title:v,key:v},e.createElement(P.$I,{id:"formatting-rule-color",placement:"right",color:m,colors:C.X1.map(R=>[R]),triggerNode:e.createElement(j,{style:{backgroundColor:m}},!m&&e.createElement(P.In,{name:"colors",size:"xs"})),onChange:(R,Q,Y)=>{Y(),d({newColor:R,rule:O,condition:v})}}),e.createElement("span",null,v))})):e.createElement(f,{name:"Aggregation conditions"})};var q=t("8fnsnG21"),nt=t("J7MaobQD");const ot=()=>{const{eventDefinition:n}=(0,T.A)(),i=(0,q.P)(nt.c,({all:s})=>s.reduce((d,B)=>(d[B.id]=B,d),{})),a=(0,e.useMemo)(()=>n.notifications.reduce((s,d)=>(i[d.notification_id]&&s.push(i[d.notification_id]),s),[]),[n,i]);return a.length?e.createElement(e.Fragment,null,a.map(({id:s,title:d},B)=>{const v=B>0?", ":"";return e.createElement("span",{key:s},v,e.createElement(F.N,{target:"_blank",to:z.Ay.ALERTS.NOTIFICATIONS.show(s)},d))})):e.createElement(f,{name:"Notifications"})},tt=(0,E.default)(P.Dc)(({theme:n})=>(0,E.css)`
  color: ${n.colors.variant.darker.warning};
`),it=()=>{const{eventData:n,eventDefinition:i,isEventDefinition:a}=(0,T.A)();return(0,e.useMemo)(()=>{if(!i)return[{title:"Timestamp",content:e.createElement(P.Dc,{dateTime:n==null?void 0:n.timestamp}),show:!a}];const s=(0,$.z)(i.config.search_within_ms,H.SY),d=(0,$.z)(i.config.execute_every_ms,H.SY),B=!a&&N()(i.updated_at).diff(n.timestamp)>0;return[{title:"Timestamp",content:e.createElement(P.Dc,{dateTime:n==null?void 0:n.timestamp}),show:!a},{title:"Event definition updated at",content:e.createElement(e.Fragment,null,e.createElement(tt,{dateTime:i.updated_at}),e.createElement(P.Zf,{displayLeftMargin:!0,iconSize:"xs"},"Event definition ",e.createElement("i",null,i.title)," was edited after this event happened. Some of aggregations widgets might not be representative for this event.")),show:B},{title:"Event definition",content:e.createElement(F.N,{target:"_blank",to:z.Ay.ALERTS.DEFINITIONS.show(i.id)},i.title),show:!a},{title:"Priority",content:V()(G.A.properties[i.priority].name)},{title:"Execute search every",content:(d==null?void 0:d.duration)&&(d==null?void 0:d.unit)&&`${d.duration} ${d.unit.toLowerCase()}`},{title:"Search within",content:(s==null?void 0:s.duration)&&(s==null?void 0:s.unit)&&`${s.duration} ${s.unit.toLowerCase()}`},{title:"Description",content:i.description},{title:"Notifications",content:e.createElement(ot,null)},{title:"Aggregation conditions",content:e.createElement(k,null)}]},[n==null?void 0:n.timestamp,i,a])},l=E.default.div`
  display: flex;
  align-items: center;
  user-select: none;
  gap: 5px;
`,u=E.default.div`
  display: flex;
  gap: 5px;
  align-items: flex-end;
`,h=E.default.div`
  display: flex;
  flex-direction: column;
  gap: 5px;
`,M=E.default.div`
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
`,I=E.default.div`
  display: flex;
`,A=()=>{const{isEventDefinition:n,isEvent:i,isAlert:a}=(0,T.A)(),[s,d]=(0,e.useState)(!0),B=(0,e.useCallback)(_=>{_.stopPropagation(),d(m=>!m)},[]),v=it(),O=(0,e.useMemo)(()=>n?"event definition":a?"alert":i?"event":"",[a,i,n]);return e.createElement(P.Rq,null,e.createElement(l,null,e.createElement(w.Button,{bsStyle:"link",className:"btn-text",bsSize:"xsmall",onClick:B},e.createElement(P.In,{name:`arrow_${s?"drop_down":"right"}`}),"\xA0",s?`Hide ${O} details`:`Show ${O} details`)),s&&e.createElement(h,{"data-testid":"info-container"},e.createElement(M,null,v.map(({title:_,content:m,show:R})=>R!==!1&&e.createElement(u,{key:_},e.createElement("b",null,_,": "),e.createElement(I,{title:_},m||e.createElement(f,{name:_})))))))}},pStb38mj:(Z,y,t)=>{t.d(y,{A:()=>z});var e=t("DUKaTDO2"),E=t("c20giJr8"),w=t.n(E),P=t("+KM7MH1U"),T=t.n(P),p=t("jAGDuYSC"),N=t("eFxcQyPT"),K=t("MdYBRjRJ");const V=c=>(0,K.H3)(`/events/definitions/${c}`),H=({series:c,conditions:C})=>{const L=[],W=r=>{if(!r)return"No condition configured";switch(r.expr){case"number":return{value:r.value};case"number-ref":const o=c.find(f=>f.id===r.ref);return o!=null&&o.type?{field:`${o.type}(${o.field||""})`}:null;case"&&":case"||":return[W(r.left),W(r.right)];case"group":return[W(r.child)];case"<":case"<=":case">":case">=":case"==":const{ref:D}=r.left,g=c.find(f=>f.id===D),U=g!=null&&g.type?`${g.type}(${g.field||""})`:void 0;return L.push({expr:r.expr,value:r.right.value,function:g==null?void 0:g.type,fnSeries:U,field:g==null?void 0:g.field}),[W(r.left),W(r.right)];default:return null}};return W(C.expression),L},G=c=>{var C,L;return{eventDefinition:c,aggregations:(C=c==null?void 0:c.config)!=null&&C.series&&((L=c==null?void 0:c.config)!=null&&L.conditions)?w()(H({series:c.config.series,conditions:c.config.conditions}),T()):[]}},$=c=>(0,N.Ay)("GET",V(c)).then(G),z=(c,{onErrorHandler:C}={})=>{const{data:L,refetch:W,isLoading:r,isFetched:o}=(0,e.useQuery)(["event-definition-by-id",c],()=>$(c),{onError:D=>{C&&C(D),p.A.error(`Loading event definition failed with status: ${D}`,"Could not load event definition")},keepPreviousData:!0,enabled:!!c,initialData:{eventDefinition:null,aggregations:[]}});return{data:L,refetch:W,isLoading:r,isFetched:o}}},wi0Y4c9s:(Z,y,t)=>{t.d(y,{A:()=>p});var e=t("Z7aTuO5B"),E=t("wXrUUKFq"),w=t.n(E),P=t("DjctQb+S");const p=({children:N,value:K})=>{const V=(0,e.useMemo)(()=>w()({},P.Ke,K),[K]);return e.createElement(P.Ay.Provider,{value:V},N)}},iPvR7dhw:(Z,y,t)=>{t.d(y,{A:()=>P});var e=t("Z7aTuO5B"),E=t("g2NQZb9A");const P=T=>(0,e.useMemo)(()=>T.then(async p=>(await(0,E.A)(p.search),p)),[T])},m81tulV4:(Z,y,t)=>{t.d(y,{d:()=>E,p:()=>e});const e={"<":"less","<=":"less_equal",">=":"greater_equal",">":"greater","==":"equal"},E={less:"<",less_equal:"<=",greater_equal:">=",greater:">",equal:"=="}},OuvOTzCp:(Z,y,t)=>{t.d(y,{Ay:()=>it,JY:()=>tt});var e=t("Z7aTuO5B"),E=t("VPaD/Np4"),w=t.n(E),P=t("efAt+LzL"),T=t.n(P),p=t("UmnljV2q"),N=t("ZJjLtB2e"),K=t("/coHI+Jz"),V=t("dcP8FKpJ"),H=t("gbXdylj1"),G=t("6BCpJW2W"),$=t("mTnbNx1k"),F=t("FfX57J1C"),z=t("pa3lbc7X"),c=t("iltCXley"),C=t("ugp+BYjv"),L=t("jlRcBdjT"),W=t("/QVctsfe"),r=t("fCul1Qwh"),o=t("7J1sc9Ol"),D=t("Wk8izdHL"),g=t("7VrSCphN"),U=t("BcOICGB7"),f=t("I4XORk+Y"),X=t("UnwAqHt2"),J=t("m81tulV4"),j=t("4/JSMBsA");const x=3,b=({rowPivots:l,fnSeries:u,sort:h=[]})=>W.A.builder().id((0,c.A)()).config(r.A.builder().columnPivots([]).rowPivots(l).series(u).sort(h).visualization("table").rollup(!0).build()).build(),k=({index:l,SUMMARY_ROW_DELTA:u})=>{const M=(l+1)%2===0?7:1,I=l>=2?x:0,S=Math.ceil((l+1)/2)+I+u;return new F.A(M,S,x,6)},q=({field:l,groupBy:u,fnSeries:h,expr:M})=>{const I=T()([l,...u].filter(a=>!!a)),S=I.length?[(0,C.A)(I,new L.Ay("value",[],[]))]:[],A=o.Ay.forFunction(h),n=[">",">=","=="].includes(M)?g.A.Descending:g.A.Ascending,i=[new D.A(D.A.SERIES_TYPE,h,n)];return b({rowPivots:S,fnSeries:[A],sort:i})},nt=({aggregations:l,groupBy:u})=>{const{summaryFnSeries:h,summaryRowPivots:M,summaryTitle:I}=l.reduce((A,{field:n,value:i,expr:a,fnSeries:s})=>{const d=`${s} ${a} ${i}`;return A.summaryFnSeries.push(s),n&&A.summaryRowPivots.push(n),A.summaryTitle=`${A.summaryTitle} ${d}`,A},{summaryFnSeries:[],summaryRowPivots:[],summaryTitle:"Summary: "}),S=b({rowPivots:[(0,C.A)(T()([...M,...u]),new L.Ay("value",[],[]))],fnSeries:h.map(A=>o.Ay.forFunction(A))});return{summaryTitle:I,summaryWidget:S,summaryPosition:new F.A(1,1,x,1/0)}},rt=async({streams:l,aggregations:u,groupBy:h})=>{const M=await z.A.list(),I=(0,V.f)(l),S=M!=null&&M.length?M.filter(I):[],A=(0,$.s0)(),n=(0,$.Wk)(void 0,S),i=u.length>1,a=i?x:0,{aggregationWidgets:s,aggregationTitles:d,aggregationPositions:B}=u.reduce((m,{field:R,value:Q,expr:Y,fnSeries:st},at)=>{const et=q({fnSeries:st,field:R,groupBy:h,expr:Y});return m.aggregationWidgets.push(et),m.aggregationTitles[et.id]=`${st} ${Y} ${Q}`,m.aggregationPositions[et.id]=k({index:at,SUMMARY_ROW_DELTA:a}),m},{aggregationTitles:{},aggregationWidgets:[],aggregationPositions:{}}),v=[...s,A,n],O={widget:{...d,[A.id]:"Message Count",[n.id]:"All Messages"}},_={...B,[A.id]:new F.A(1,x*s.length+1+a,2,1/0),[n.id]:new F.A(1,x*s.length+3+a,6,1/0)};if(i){const{summaryTitle:m,summaryWidget:R,summaryPosition:Q}=nt({aggregations:u,groupBy:h});v.push(R),O.widget[R.id]=m,_[R.id]=Q}return{titles:O,widgets:v,positions:_}},ot=async({streams:l,aggregations:u,groupBy:h})=>{const{titles:M,widgets:I,positions:S}=await rt({streams:l,aggregations:u,groupBy:h}),A=u==null?void 0:u.map(({fnSeries:n,value:i,expr:a})=>X.Ay.create(n,i,J.p[a]||"equal",(0,X.XL)()));return G.A.create().toBuilder().titles(M).widgets(E.List(I)).widgetPositions(S).formatting(j.A.create(A)).build()},tt=async({streams:l,timeRange:u,queryString:h,aggregations:M,groupBy:I,queryParameters:S,searchFilters:A})=>{const n=(0,N.A)(l,void 0,u,h,A||[]),i=K.A.create().toBuilder().queries([n]).parameters(S.map(d=>U.A.fromJSON(d))).build(),a=await ot({streams:l,aggregations:M,groupBy:I}),s=p.A.create().toBuilder().newId().type(p.A.Type.Search).state({[n.id]:a}).search(i).build();return(0,H.A)(s)},it=({eventData:l,eventDefinition:u,aggregations:h})=>{var M,I,S,A,n,i,a;const s=(0,f.nu)(Object.entries(l.group_by_fields).map(([Q,Y])=>`${Q}:${(0,f.ih)(Y)}`),{withBrackets:!1}),d=((M=l==null?void 0:l.replay_info)==null?void 0:M.query)||"",{streams:B}=l.replay_info,v={type:"absolute",from:(I=l==null?void 0:l.replay_info)==null?void 0:I.timerange_start,to:(S=l==null?void 0:l.replay_info)==null?void 0:S.timerange_end},O={type:"elasticsearch",query_string:(0,f.nu)([d,s])},_=((A=u==null?void 0:u.config)==null?void 0:A.query_parameters)||[],m=(i=(n=u==null?void 0:u.config)==null?void 0:n.group_by)!=null?i:[],R=(a=u.config)==null?void 0:a.filters;return(0,e.useMemo)(()=>tt({streams:B,timeRange:v,queryString:O,aggregations:h,groupBy:m,queryParameters:_,searchFilters:R}),[])}},cXPoJEmv:(Z,y,t)=>{t.r(y),t.d(y,{default:()=>r,onErrorHandler:()=>L});var e=t("Z7aTuO5B"),E=t("6dLKCZdN"),w=t("pStb38mj"),P=t("IOI9nV80"),T=t("MDn/VShH"),p=t("J7MaobQD"),N=t("z6QEDyg6"),K=t("OuvOTzCp");const H=({eventDefinition:o,aggregations:D})=>{var g,U,f,X,J,j,x,b,k,q;const nt=(U=(g=o==null?void 0:o.config)==null?void 0:g.streams)!=null?U:[],rt={type:"relative",range:((X=(f=o==null?void 0:o.config)==null?void 0:f.search_within_ms)!=null?X:0)/1e3},ot={type:"elasticsearch",query_string:((J=o==null?void 0:o.config)==null?void 0:J.query)||""},tt=((j=o==null?void 0:o.config)==null?void 0:j.query_parameters)||[],lt=(b=(x=o==null?void 0:o.config)==null?void 0:x.group_by)!=null?b:[],it=(q=(k=o==null?void 0:o.config)==null?void 0:k.filters)!=null?q:[];return(0,e.useMemo)(()=>(0,K.JY)({streams:nt,timeRange:rt,queryString:ot,aggregations:D,groupBy:lt,queryParameters:tt,searchFilters:it}),[])};var G=t("icrwsL0X"),$=t("9tc+dS6Z"),F=t("62FDaRYn"),z=t("iPvR7dhw"),c=t("wi0Y4c9s");const C=()=>{const{eventDefinition:o,aggregations:D}=(0,N.A)(),g=H({eventDefinition:o,aggregations:D}),U=(0,z.A)(g),f=(0,e.useMemo)(()=>({infoBar:{component:G.A}}),[]);return e.createElement(c.A,{value:f},e.createElement(T.A,{view:U,isNew:!0}))},L=o=>{o.status===404&&F.A.report((0,$.fE)(o))},r=()=>{const[o,D]=(0,e.useState)(!1),{definitionId:g}=(0,E.A)(),{isLoading:U,isFetched:f}=(0,w.A)(g,{onErrorHandler:L});return(0,e.useEffect)(()=>{p.M.listAll().then(()=>D(!0))},[D]),U||!f||!o?e.createElement(P.y$,null):e.createElement(C,null)}},zWgILaST:(Z,y,t)=>{t.r(y),t.d(y,{default:()=>W,onErrorHandler:()=>C});var e=t("Z7aTuO5B"),E=t("6dLKCZdN"),w=t("0k5v4UPt"),P=t("pStb38mj"),T=t("IOI9nV80"),p=t("MDn/VShH"),N=t("J7MaobQD"),K=t("OuvOTzCp"),V=t("z6QEDyg6"),H=t("icrwsL0X"),G=t("9tc+dS6Z"),$=t("62FDaRYn"),F=t("iPvR7dhw"),z=t("wi0Y4c9s");const c=()=>{const{eventData:r,eventDefinition:o,aggregations:D}=(0,V.A)(),g=(0,K.Ay)({eventData:r,eventDefinition:o,aggregations:D}),U=(0,F.A)(g),f=(0,e.useMemo)(()=>({infoBar:{component:H.A}}),[]);return e.createElement(z.A,{value:f},e.createElement(p.A,{view:U,isNew:!0}))},C=r=>{r.status===404&&$.A.report((0,G.fE)(r))},W=()=>{const[r,o]=(0,e.useState)(!1),{alertId:D}=(0,E.A)(),{data:g,isLoading:U,isFetched:f}=(0,w.A)(D,{onErrorHandler:C}),{isLoading:X,isFetched:J}=(0,P.A)(g==null?void 0:g.event_definition_id);return(0,e.useEffect)(()=>{N.M.listAll().then(()=>o(!0))},[o]),U||X||!f||!J||!r?e.createElement(T.y$,null):e.createElement(c,null)}}}]);})();

//# sourceMappingURL=ShowViewPage.e3bf67c5aa42ea3bdc0b.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy