web-interface.assets.1255d548-8373.282dae638c3b2547cce7.js Maven / Gradle / Ivy
"use strict";(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["1255d548-8373"],{"6otxL8V5":(Et,Z,s)=>{s.r(Z),s.d(Z,{default:()=>mt});var t=s("Z7aTuO5B"),m=s("/GOzvPf6"),i=s("J6y4/h8P"),_=s("/W/x1zfW"),w=s("QBkUz07U"),h=s("ty2gyrHp"),T=s("d4kzUuQm"),y=s("DUKaTDO2"),q=s("GRU0vAV6"),ee=s("PLazxdob");const te={defaultOptions:{queries:{cacheTime:1e3*60*60*24}}},ne=(0,ee.K)({storage:window.localStorage}),oe=({children:e})=>{const n=(0,t.useMemo)(()=>new y.QueryClient(te),[]);return t.createElement(q.S,{client:n,persistOptions:{persister:ne}},e)};var k=s("3yfJIRSb"),re=s("oc9db6Tt"),R=s.n(re),ae=s("UEhMhaHZ"),se=s("2GbzTNI4");const le="open-feed",pt="enterprise-feed",yt="smb-feed";var ie=s("RCNj0OY4"),ce=s("gToK60tD"),P=s("3ca6MVhH");const N={error(e,n="Error"){P.N9.show({message:e,title:n,autoClose:1e4,color:"red"})},warning(e,n="Attention"){P.N9.show({message:e,title:n})},success(e,n="Success"){P.N9.show({message:e,title:n,color:"green"})}};var L=s("q2j1bVbz");const G=["content-stream","settings"],me=["content-stream","tags"],M=()=>{const e=(0,y.useQueryClient)(),n=(0,L.Z)(),{getContentStreamUserSettings:o,setContentStreamUserSettings:r,getContentStreamTags:l}=ce.ContentStream,E=async({settings:f,username:dt})=>{await r(f,dt)},{data:a,isLoading:c,refetch:u}=(0,y.useQuery)([G],()=>o(n.username),{onError:f=>{N.error(`Loading content stream config failed with status: ${f}`,"Could not load content stream.")}}),{data:g,isLoading:p,refetch:S,error:F}=(0,y.useQuery)([me],()=>l(),{onError:f=>{N.error(`Loading content stream tag failed with status: ${f}`,"Could not load content stream tags.")}}),{mutateAsync:ut}=(0,y.useMutation)(E,{onSuccess:()=>{e.invalidateQueries(G),e.invalidateQueries(U)},onError:f=>{N.error(`Enabling content stream failed with status: ${f}`,"Could not cancel instant archiving jobs")}});return{contentStreamSettings:{contentStreamTopics:a==null?void 0:a.content_stream_topics,releasesSectionEnabled:a==null?void 0:a.releases_enabled,contentStreamEnabled:a==null?void 0:a.content_stream_enabled},contenStreamTags:{currentTag:g==null?void 0:g[0],isLoadingTags:p,refetchContentStreamTag:S,contentStreamTagError:F},isLoadingContentStreamSettings:c,refetchContentStream:u,onSaveContentStreamSetting:ut}},ue=e=>{const n={ignoreAttributes:!1,attributeNamePrefix:"attr_"},r=new se.XMLParser(n).parse(e),{rss:{channel:{item:l=void 0}}}=r;return Array.isArray(l)?l:[l]},de=e=>e&&window.fetch(e,{method:"GET"}).then(n=>n.text()).then(ue).catch(n=>n),U=["content-stream","content"],B=e=>{const{contenStreamTags:{currentTag:n,isLoadingTags:o,contentStreamTagError:r}}=M(),{rss_url:l}=ie.Z.contentStream()||{},E=(0,t.useCallback)(()=>e||(o||r||!n?le:n),[r,n,o,e]),a=l&&`${l}/${E()}/feed`,{data:c,isLoading:u,error:g}=(0,y.useQuery)([...U,a],()=>de(a),{initialData:[]});return{error:g,feedList:c,isLoadingFeed:u}};var Ee=s("AbA4Yk3R"),Q=s.n(Ee),d=s("uZqmR+ju"),A=s("8OvTct/Z"),v=s("v4GbOr/o");const ge=i.default.img(({theme:e})=>(0,i.css)`
max-width: 100%;
width: 100%;
object-fit: contain;
border-radius: ${e.spacings.xxs} ${e.spacings.xxs} 0 0;
`),pe=(0,i.default)(d.Panel.Body)(({theme:e})=>(0,i.css)`
flex-grow: 1;
background-color: ${e.colors.table.backgroundAlt};
> a {
font-weight: bold;
}
`),ye=(0,i.default)(d.Panel.Footer)(({theme:e})=>(0,i.css)`
background-color: ${e.colors.table.backgroundAlt};
border-radius: 0 0 ${e.spacings.xxs} ${e.spacings.xxs};
`),Se=(0,i.default)(d.Panel)(({theme:e})=>(0,i.css)`
display: flex;
flex-direction: column;
height: 100%;
border: none;
border-radius: ${e.spacings.xxs};
`),W=e=>Q().sanitize(e),he=e=>{var n;return Array.isArray(e)?(n=e==null?void 0:e[0])==null?void 0:n.attr_url:e==null?void 0:e.attr_url},fe=({feed:e})=>{const n=(0,A.Z)(),o=()=>{n(v.A.CONTENTSTREAM.ARTICLE_CLICKED,{app_pathname:"welcome",app_section:"content-stream",event_details:{title:e==null?void 0:e.title,link:e==null?void 0:e.link}})};return t.createElement(m.lr.Slide,null,t.createElement(Se,null,t.createElement("a",{href:e==null?void 0:e.link,onClick:()=>o(),target:"_blank",rel:"noreferrer"},t.createElement(ge,{src:he(e==null?void 0:e["media:content"]),alt:e==null?void 0:e.title})),t.createElement(pe,null,t.createElement("a",{href:e==null?void 0:e.link,target:"_blank",onClick:()=>o(),rel:"noreferrer"},t.createElement("span",{dangerouslySetInnerHTML:{__html:W(e==null?void 0:e.title)}}))),t.createElement(ye,null,t.createElement(m.EK,{dateTime:W(e==null?void 0:e.pubDate),format:"shortReadable"}))))},ve=()=>{const{feedList:e,isLoadingFeed:n,error:o}=B();return n?t.createElement(m.$j,null):o||R()(e)?t.createElement(d.Alert,{bsStyle:"info"},t.createElement("p",null,"Unable to load RSS feed at the moment ! You can read more on "," ",t.createElement(m.dL,{href:"https://www.graylog.org/blog/"},"Graylog"),".")):t.createElement(ae.Z,null,e==null?void 0:e.map(r=>t.createElement(fe,{key:(r==null?void 0:r.guid["#text"])||(r==null?void 0:r.title),feed:r})))};var Ce=s("J6dJly1Q");const Te=e=>{const[n,o]=(0,t.useState)(void 0);(0,t.useEffect)(()=>{n||setInterval(()=>{o(document.querySelector(e))},200)},[n,e]);const r=(0,t.useMemo)(()=>n&&(0,Ce.Z)(n,{containScroll:"trimSnaps"}),[n]),l=(0,t.useCallback)(()=>{r&&r.scrollPrev()},[r]);return{scrollNext:(0,t.useCallback)(()=>{r&&r.scrollNext()},[r]),scrollPrev:l}},Le=()=>{const{scrollPrev:e,scrollNext:n}=Te(".carousel"),o=(0,A.Z)(),r=()=>{o(v.A.CONTENTSTREAM.PREV_ARROW_CLICKED,{app_pathname:"welcome",app_section:"content-stream"}),e()},l=()=>{o(v.A.CONTENTSTREAM.NEXT_ARROW_CLICKED,{app_pathname:"welcome",app_section:"content-stream"}),n()};return t.createElement(t.Fragment,null,t.createElement(d.Button,{onClick:()=>r()},t.createElement(m.JO,{name:"arrow-left"})),t.createElement(d.Button,{onClick:()=>l()},t.createElement(m.JO,{name:"arrow-right"})))},Ae=i.default.div(({theme:e})=>(0,i.css)`
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr;
grid-auto-flow: row;
margin-top: ${e.spacings.sm};
`),we=i.default.div`
display: flex;
align-items: center;
justify-content: right;
`,Re=i.default.div`
justify-content: center;
display: flex;
flex-direction: column;
`,Pe=()=>t.createElement(Ae,null,t.createElement(Re,null,t.createElement(m.dL,{href:"https://www.graylog.org/blog/"},"Read more")),t.createElement(we,null,t.createElement(Le,null))),Ne=(0,i.default)(d.ListGroupItem)(({theme:e})=>(0,i.css)`
display: flex;
gap: ${e.spacings.md};
align-items: flex-start;
`),be=i.default.i(({theme:e})=>(0,i.css)`
color: ${e.colors.gray[60]};
`),wt=(0,i.default)(d.Label)`
cursor: default;
width: 110px;
display: block;
`,xe=(e="")=>Q().sanitize(e),Ie=()=>{const e="release-info",{feedList:n,isLoadingFeed:o,error:r}=B(e),l=(0,A.Z)(),E=a=>{l(v.A.CONTENTSTREAM.RELESE_ARTICLE_CLICKED,{app_pathname:"welcome",app_section:"content-stream",event_details:{title:a==null?void 0:a.title,link:a==null?void 0:a.link}})};return o&&!R()(n)?t.createElement(m.$j,null):r||R()(n)?t.createElement(d.Alert,{bsStyle:"info"},t.createElement("p",null,"Unable to load RSS feed at the moment ! You can read more on "," ",t.createElement(m.dL,{href:"https://www.graylog.org/post/tag/release-info"},"Graylog.org"),".")):t.createElement(d.ListGroup,null,n.map(a=>t.createElement(Ne,{key:(a==null?void 0:a.guid["#text"])||(a==null?void 0:a.title)},t.createElement("a",{href:a==null?void 0:a.link,onClick:()=>E(a),target:"_blank",rel:"noreferrer"},t.createElement("span",{dangerouslySetInnerHTML:{__html:xe(a==null?void 0:a.title)}})),a!=null&&a.pubDate?t.createElement(be,null,t.createElement(m.ij,{dateTime:a.pubDate})):null)))},Oe=(0,i.default)(d.Button)(({theme:e})=>(0,i.css)`
border: 0;
font-size: ${e.fonts.size.large};
&:hover {
text-decoration: none;
}
`),Y=({onClick:e,isOpen:n})=>t.createElement(Oe,{bsStyle:"link",onClick:()=>e(),type:"button"},n?"Close":"Open",t.createElement(m.JO,{name:n?"angle-down":"angle-right",fixedWidth:!0})),$e=(0,i.default)(w.Z)(({$enabled:e,theme:n})=>(0,i.css)`
overflow: hidden;
flex-grow: 3;
height: ${e?"initial":"min-content"};
@media (max-width: ${n.breakpoints.max.md}) {
flex-grow: 1;
}
`),De=(0,i.default)(w.Z)(({$enabled:e})=>(0,i.css)`
flex-grow: 1;
height: ${e?"initial":"min-content"};
`),Fe=()=>{const{username:e}=(0,L.Z)(),n=(0,A.Z)(),{contentStreamSettings:o,isLoadingContentStreamSettings:r,onSaveContentStreamSetting:l,refetchContentStream:E}=M();if(r||!o)return null;const a=async({enableContentStream:S,enableRelease:F})=>{await l({settings:{content_stream_enabled:S,releases_enabled:F,content_stream_topics:o.contentStreamTopics},username:e}),E()},{contentStreamEnabled:c,releasesSectionEnabled:u}=o,g=()=>{n(v.A.CONTENTSTREAM.NEWS_OPT_IN_TOGGLED,{app_pathname:"welcome",app_section:"content-stream",event_details:{contentStreamEnabled:!c}}),a({enableContentStream:!c,enableRelease:u})},p=()=>{n(v.A.CONTENTSTREAM.RELEASE_OPT_IN_TOGGLED,{app_pathname:"welcome",app_section:"content-stream",event_details:{contentStreamEnabled:!u}}),a({enableContentStream:c,enableRelease:!u})};return t.createElement(k.Z,{$columns:"2fr 1fr"},t.createElement($e,{title:"News",$enabled:c,headerActions:t.createElement(Y,{onClick:g,isOpen:c})},c&&t.createElement(t.Fragment,null,t.createElement(ve,null),t.createElement(Pe,null))),t.createElement(De,{title:"Releases",$enabled:u,headerActions:t.createElement(Y,{onClick:p,isOpen:u})},u&&t.createElement(Ie,null)))},Ze=()=>t.createElement(oe,null,t.createElement(Fe,null)),xt={dashboard:{link:"DASHBOARDS_VIEWID",typeTitle:"dashboard"},search:{link:"SEARCH_VIEWID",typeTitle:"search"},search_filter:{link:"MY-FILTERS_DETAILS_FILTERID",typeTitle:"search filter"},unknown:{typeTitle:"unknown",link:void 0}},C={per_page:5,page:1,count:0,total:0};var ke=s("PH5VRLCQ"),Ge=s.n(ke);const Me=e=>{throw new Error(`Can't find title for type: ${e!=null?e:"(undefined)"}`)},Ue=new Set(["user","team","dashboard","event_definition","notification","search","stream","search_filter","report","role","output"]),z=(e,n=!0)=>Ue.has(e)?Ge()(e):n?Me(e):void 0;var b=s("Q1zRxDOP");const Be=e=>{throw new Error(`Can't find prefix for type: ${e!=null?e:"(undefined)"}`)},Qe=new Set(["user","team","dashboard","event_definition","notification","search","stream","search_filter","report","role","output"]),We={event_definition:"eventdefinitions:",notification:"eventnotifications:",search:"view:",report:"report:"},Ye=(e,n=!0)=>{var o;return Qe.has(e)?(o=We[e])!=null?o:`${e}s:`:n?Be(e):`(unsupported type ${e})`};var ze=s("0TVxnHwi");const H=(e,n="read")=>{const{id:o,type:r}=(0,b.C)(e),{permissions:l}=(0,L.Z)();return(0,t.useMemo)(()=>(0,ze.rq)(l,`${Ye(r)}${n}:${o}`),[o,n,l,r])};var j=s("tz1fbBRX");const He=(0,i.default)(d.ListGroupItem)`
display: flex;
gap: 16px;
align-items: flex-start;
`,K=(0,i.default)(d.Label)`
cursor: default;
width: 110px;
display: block;
`,je=i.default.i(({theme:e})=>(0,i.css)`
color: ${e.colors.gray[60]};
`),J=({title:e,grn:n,timestamp:o})=>{const{id:r,type:l}=(0,b.C)(n),E=H(n,"read"),a=(0,t.useMemo)(()=>{var p;return(p=z(l,!1))!=null?p:"unknown"},[l]),c=(0,j.Z)(n),u=e||r,g=!!c&&E;return t.createElement(He,null,t.createElement(K,{bsStyle:"info"},a),g?t.createElement(h.r,{to:c},u):t.createElement("i",null,u),o?t.createElement(je,null,t.createElement(m.ij,{dateTime:o})):null)};J.defaultProps={timestamp:void 0};const V=J;var x=s("gyRmhZSW"),I=s("eFxcQyPT"),O=s("MdYBRjRJ"),$=s("jAGDuYSC");const Ke="/startpage",Je="last_open_query_key",Ve=async({page:e})=>{const n=(0,x.Z)(`${Ke}/lastOpened`,e,5,"");return(0,I.ZP)("GET",(0,O.DC)(n))},Xe=e=>(0,y.useQuery)([Je,e],()=>Ve(e),{onError:n=>{$.Z.error(`Loading last opened items failed with status: ${n}`,"Could not load last opened items")},retry:0,initialData:{lastOpened:[],...C}}),_e=()=>{const{data:{lastOpened:e},isFetching:n}=Xe(C);return n?t.createElement(m.$j,null):e.length===0?t.createElement(m.pJ,null,"You do not have opened any searches/dashboards yet.",t.createElement("br",null),"From now on, whenever you open a saved search/dashboard, it will show up here. In the meantime, you can start a new ",t.createElement(h.r,{to:T.ZP.SEARCH},"Search")," or ",t.createElement(h.r,{to:T.ZP.pluginRoute("DASHBOARDS_NEW")},"Dashboard"),"."):t.createElement(d.ListGroup,null,e.map(({grn:o,title:r,timestamp:l})=>t.createElement(V,{key:o,grn:o,title:r,timestamp:l})))},qe="favorite_items_query_key",et=async({page:e})=>{const n=(0,x.Z)("/favorites",e,5,"");return(0,I.ZP)("GET",(0,O.DC)(n))},tt=e=>(0,y.useQuery)([qe,e],()=>et(e),{onError:n=>{$.Z.error(`Loading favorite items failed with status: ${n}`,"Could not load favorite items")},retry:0,initialData:{favorites:[],...C}}),nt=()=>{const[e,n]=(0,t.useState)(C),{data:{favorites:o,total:r},isFetching:l}=tt(e),E=(0,t.useCallback)(a=>{n(c=>({...c,page:a}))},[n]);return l?t.createElement(m.$j,null):o.length===0?t.createElement(m.pJ,null,"You do not have any favorite items yet.",t.createElement("br",null),"Make any ",t.createElement(h.r,{to:T.ZP.SEARCH},"Search")," or ",t.createElement(h.r,{to:T.ZP.pluginRoute("DASHBOARDS_NEW")},"Dashboard")," favorite to show up here."):t.createElement(m.l9,{onChange:E,useQueryParameter:!1,activePage:e.page,totalItems:r,pageSize:e.per_page,showPageSizeSelect:!1,hideFirstAndLastPageLinks:!0},t.createElement(d.ListGroup,null,o.map(({grn:a,title:c})=>t.createElement(V,{key:a,grn:a,title:c}))))},ot="/startpage",rt="recent_actions_query_key",at=async({page:e})=>{const n=(0,x.Z)(`${ot}/recentActivity`,e,5,"");return(0,I.ZP)("GET",(0,O.DC)(n)).then(o=>({page:o.page,per_page:o.per_page,count:o.count,total:o.total,recentActivity:o.recentActivity.map(r=>({id:r.id,itemTitle:r.item_title,timestamp:r.timestamp,activityType:r.activity_type,itemGrn:r.item_grn,userName:r.user_name}))}))},st=e=>(0,y.useQuery)([rt,e],()=>at(e),{onError:n=>{$.Z.error(`Loading recent activity failed with status: ${n}`,"Could not load recent activity")},retry:0,initialData:{recentActivity:[],...C}}),X=({itemGrn:e,activityType:n,itemTitle:o,userName:r})=>{const l=H(e,"read"),{id:E,type:a}=(0,b.C)(e),c=(0,t.useMemo)(()=>{var S;return(S=z(a,!1))!=null?S:`(unsupported type ${a})`},[a]),u=(0,j.Z)(e),g=o||E,p=n!=="delete"&&!!u&&l;return t.createElement("div",null,`The ${c} `,p?t.createElement(h.r,{target:"_blank",to:u},g):t.createElement("i",null,g)," was ",`${n}d`,r?` by ${r}`:"")};X.defaultProps={userName:null};const lt=()=>{const[e,n]=(0,t.useState)(C),{data:{recentActivity:o,total:r},isFetching:l}=st(e),E=(0,t.useCallback)(a=>{n(c=>({...c,page:a}))},[n]);return l?t.createElement(m.$j,null):o.length===0?t.createElement(m.pJ,null,"There is no recent activity yet.",t.createElement("p",null,"Whenever any other user will update content you have access to, or share new content with you, it will show up here.")):t.createElement(m.l9,{onChange:E,useQueryParameter:!1,activePage:e.page,totalItems:r,pageSize:e.per_page,showPageSizeSelect:!1,hideFirstAndLastPageLinks:!0},t.createElement(d.Table,{striped:!0},t.createElement("tbody",null,o.map(({id:a,timestamp:c,activityType:u,itemGrn:g,itemTitle:p,userName:S})=>t.createElement("tr",{key:a},t.createElement("td",{style:{width:110}},t.createElement(K,{bsStyle:"primary"},t.createElement(m.ij,{dateTime:c}))),t.createElement("td",null,t.createElement(X,{itemGrn:g,activityType:u,itemTitle:p,userName:S})))))))},D=(0,i.default)(w.Z)`
flex-grow: 1;
`,it=({readOnly:e,userId:n,startpage:o})=>o!==null||e?t.createElement("span",null,"This is your personal page, allowing easy access to the content most relevant for you."):t.createElement(t.Fragment,null,t.createElement("span",null,"This is your personal start page, allowing easy access to the content most relevant for you."),t.createElement("span",null," ","You can change your personal start page on the ",t.createElement(h.r,{to:T.ZP.SYSTEM.USERS.edit(n)},"edit profile")," page.")),ct=()=>{const{permissions:e,readOnly:n,id:o,startpage:r}=(0,L.Z)(),l=e.includes("*");return t.createElement(t.Fragment,null,t.createElement(_.Z,{title:"Welcome to Graylog!"},t.createElement(it,{userId:o,readOnly:n,startpage:r})),t.createElement(k.Z,null,t.createElement(D,{title:"Last Opened"},t.createElement("p",{className:"description"},"Overview of recently visited saved searches and dashboards."),t.createElement(_e,null)),t.createElement(D,{title:"Favorite Items"},t.createElement("p",{className:"description"},"Overview of your favorite saved searches and dashboards."),t.createElement(nt,null))),t.createElement(D,{title:"Recent Activity"},t.createElement("p",{className:"description"},l?"This list includes all actions Graylog users performed, like creating or sharing an entity.":"Overview of actions you made with entities or somebody else made with entities which relates to you, like creating or sharing an entity."),t.createElement(lt,null)),t.createElement(Ze,null))},mt=()=>t.createElement(m.$4,{title:"Welcome"},t.createElement(ct,null))}}]);})();
//# sourceMappingURL=1255d548-8373.282dae638c3b2547cce7.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy