web-interface.assets.bb8c8232-6203.50837924daa1f365aed8.js Maven / Gradle / Ivy
"use strict";(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["bb8c8232-6203"],{rDZEPRYo:($,A,n)=>{n.d(A,{A:()=>E});var e=n("Z7aTuO5B"),D=n("P98ee3gW"),g=n("HhRuy6uH");const u=({children:C,disabled:f})=>e.createElement(D.A,{title:g.$N,bsSize:"xsmall",pullRight:!0,buttonTitle:g.qE,disabled:f},C);u.defaultProps={disabled:!1};const E=u},"oUJj821/":($,A,n)=>{n.r(A),n.d(A,{default:()=>he});var e=n("Z7aTuO5B"),D=n("ty2gyrHp"),g=n("rIl5IEuP"),u=n("IOI9nV80"),E=n("d4kzUuQm"),C=n("E+CaPsQD"),f=n("ZaccISJq"),H=n("rlwexfKi"),Q=n("MZSqcZgA"),p=n("rVdVsuGH"),N=n("+gqrR506"),P=n("J6y4/h8P"),Z=n("QL8i6bcz"),h=n("jAGDuYSC"),Y=n("HqzDVmZB"),w=n("SqY3hYJN"),W=n("MXZnZFI9"),F=n("iSSis/Yq"),R=n("0hhBr0/b"),O=n("JNPySgKz"),j=n("yGRmSjYM"),J=n("q2j1bVbz"),K=n("rDZEPRYo");const V=async t=>window.confirm(`Are you sure you want to delete "${t.title}"?`),x=t=>t&&t.additional&&t.additional.body&&t.additional.body.message?t.additional.body.message:t,G=P.default.span(({theme:t})=>(0,P.css)`
color: ${t.colors.variant.danger};
`),X=t=>{const a=(0,e.useRef)({}),s=(0,R.A)("views.components.dashboardActions").filter(i=>i.useCondition?!!i.useCondition():!0),r=s.map(({component:i,key:d})=>e.createElement(i,{key:`dashboard-action-${d}`,dashboard:t,modalRef:()=>a.current[d]})),l=s.filter(({modal:i})=>!!i).map(({modal:i,key:d})=>e.createElement(i,{key:`dashboard-action-modal-${d}`,dashboard:t,ref:c=>{a.current[d]=c}}));return{actions:r,actionModals:l}},T=({dashboard:t,refetchDashboards:a,isEvidenceModal:o})=>{const{deselectEntity:s}=(0,O.A)(),r=(0,p.Ay)(),l=(0,e.useCallback)(async()=>{const i=Z.d.exports("views.hooks.confirmDeletingDashboard");await(0,W.A)([...i,V],t)&&F.u.delete(t).then(()=>{h.A.success(`Deleting dashboard "${t.title}" was successful!`,"Success!"),s(t.id),a(),r.resetPage()}).catch(c=>{h.A.error(`Deleting dashboard failed: ${x(c)}`,"Error!")})},[t,s,a,r]);return o?null:e.createElement(g.MenuItem,{onClick:l},e.createElement(G,{role:"button"},"Delete"))};T.defaultProps={isEvidenceModal:!1};const I=({dashboard:t,refetchDashboards:a,isEvidenceModal:o})=>{const[s,r]=(0,e.useState)(!1),{actions:l,actionModals:i}=X(t),d=(0,J.A)(),c=[l.length?l:null,l.length&&!o?e.createElement(g.MenuItem,{divider:!0,key:"divider"}):null,(0,j.h5)(d.permissions,[`view:edit:${t.id}`,"view:edit"])?e.createElement(T,{dashboard:t,refetchDashboards:a,key:"delete-action",isEvidenceModal:o}):null].filter(Boolean);return e.createElement(e.Fragment,null,o||e.createElement(u.wD,{bsSize:"xsmall",entityId:t.id,entityType:"dashboard",onClick:()=>r(!0)}),c.length&&o?c[0]:e.createElement(K.A,null,c),s&&e.createElement(Y.A,{entityId:t.id,entityType:"dashboard",description:`Search for a User or Team to add as collaborator on this ${(0,w.A)({type:t.type})}.`,entityTitle:t.title,onClose:()=>r(!1)}),i)};I.defaultProps={isEvidenceModal:!1};const k=I;var B=n("DUKaTDO2");const q=(t,a)=>Object.entries(t).filter(([o])=>!a.includes(o)).reduce((o,[s,r])=>({...o,[s]:r}),{}),_=({requirements:t})=>e.createElement("div",null,Object.values(t).map(({url:a,name:o})=>e.createElement("a",{href:a,target:"_blank",rel:"noopener noreferrer"},e.createElement("strong",null,o)))),ee=({dashboard:{id:t,requires:a,title:o},requirementsProvided:s})=>{const r=q(a,s);return Object.keys(r).length>0?e.createElement(e.Fragment,null,o,e.createElement(u.Zf,{title:"Missing Requirements"},e.createElement(_,{requirements:r}))):e.createElement(D.N,{to:E.Ay.pluginRoute("DASHBOARDS_VIEWID")(t)},o)};var te=n("YwMFjcSm"),ne=n("Q1zRxDOP");const se=({searchParams:t})=>{const a=(0,B.useQueryClient)(),o=(0,R.A)("views.requires.provided");return(0,e.useMemo)(()=>({attributes:{title:{renderCell:(r,l)=>e.createElement(ee,{dashboard:l,requirementsProvided:o})},favorite:{renderCell:(r,l)=>e.createElement(te.A,{isFavorite:r,grn:(0,ne.i)("dashboard",l.id),onChange:i=>{a.setQueriesData(["dashboards","overview",t],d=>({...d,list:d.list.map(c=>c.id===l.id?c.toBuilder().favorite(i).build():c)}))}})}}}),[a,o,t])},M="dashboards",b={pageSize:20,sort:{attributeId:"title",direction:"asc"},displayedColumns:t=>t?["title","description","summary"]:["title","description","summary","favorite"],columnsOrder:["title","summary","description","owner","created_at","favorite"]};var ae=n("Dg3D5NJi"),oe=n("qO9czYNI"),re=n("Z2BtcgLJ"),z=n("TJOheZRu"),le=n("eFxcQyPT"),ie=n("MdYBRjRJ"),de=n("cB7h3AEX");const ce="/views/bulk_delete",ue=()=>{const t=(0,B.useQueryClient)(),{selectedEntities:a,setSelectedEntities:o}=(0,O.A)(),s=a==null?void 0:a.length,r=z.A.pluralize(s,"dashboard","dashboards"),l=(0,e.useCallback)(()=>{window.confirm(`Do you really want to remove ${s} ${r}?`)&&(0,le.Ay)("POST",(0,ie.H3)(ce),{entity_ids:a}).then(({failures:i})=>{if(i!=null&&i.length){const d=i.map(({entity_id:c})=>c);o(d),h.A.error(`${d.length} out of ${s} selected ${r} could not be deleted.`)}else o([]),h.A.success(`${s} ${r} ${z.A.pluralize(s,"was","were")} deleted successfully.`,"Success")}).catch(i=>{h.A.error(`An error occurred while deleting dashboards. ${i}`)}).finally(()=>{t.invalidateQueries(["dashboards","overview"])})},[r,t,s,a,o]);return e.createElement(re.A,null,e.createElement(de.A,{onSelect:l},"Delete"))},L=({isEvidenceModal:t})=>{const[a,o]=(0,f.useQueryParam)("query",f.StringParam),{layoutConfig:s,isInitialLoading:r}=(0,ae.A)({entityTableId:M,defaultPageSize:b.pageSize,defaultDisplayedAttributes:b.displayedColumns(t),defaultSort:b.sort}),l=(0,p.Ay)(void 0,s.pageSize,!1),i=(0,e.useMemo)(()=>({query:a,page:l.page,pageSize:s.pageSize,sort:s.sort}),[s.pageSize,s.sort,l.page,a]),d=se({searchParams:i}),{data:c,isInitialLoading:ye,refetch:U}=(0,N.A)(i,{enabled:!r}),{mutate:y}=(0,oe.A)(M),S=(0,e.useCallback)(m=>{l.resetPage(),o(m)},[l,o]),Ae=(0,e.useCallback)(m=>{y({displayedAttributes:m})},[y]),De=(0,e.useCallback)(m=>e.createElement(k,{dashboard:m,refetchDashboards:U,isEvidenceModal:t}),[U,t]),Ee=(0,e.useCallback)(()=>{S("")},[S]),fe=m=>{l.resetPage(),y({perPage:m})},be=(0,e.useCallback)(m=>{y({sort:m}),l.resetPage()},[l,y]);if(ye||r)return e.createElement(u.y$,null);const{list:v,pagination:Ce,attributes:Se}=c;return e.createElement(u.OW,{pageSize:s.pageSize,showPageSizeSelect:!1,totalItems:Ce.total},e.createElement("div",{style:{marginBottom:5}},e.createElement(u.B9,{onSearch:S,queryHelpComponent:e.createElement(H.A,{entityName:"dashboard",commonFields:["id","title","description","summary"]}),onReset:Ee,query:a,topMargin:0})),!(v!=null&&v.length)&&!a&&e.createElement(u.WE,null,"No dashboards have been created yet."),!(v!=null&&v.length)&&a&&e.createElement(u.EO,null,"No dashboards have been found."),!!(v!=null&&v.length)&&e.createElement(Q.A,{activeSort:s.sort,bulkSelection:t?void 0:{actions:e.createElement(ue,null)},columnDefinitions:Se,columnRenderers:d,columnsOrder:b.columnsOrder,data:v,onColumnsChange:Ae,onPageSizeChange:fe,onSortChange:be,pageSize:s.pageSize,rowActions:De,actionsCellWidth:160,visibleColumns:s.displayedAttributes}))};L.defaultProps={isEvidenceModal:!1};const me=L;var ge=n("8OvTct/Z"),ve=n("v4GbOr/o");const he=()=>{const t=(0,ge.A)();return e.createElement(u.Qc,{title:"Dashboards"},e.createElement(u.zY,{title:"Dashboards",actions:e.createElement(u.Wj,{permissions:"dashboards:create"},e.createElement(D.m,{to:E.Ay.pluginRoute("DASHBOARDS_NEW")},e.createElement(g.Button,{bsStyle:"success",onClick:()=>{t(ve.g.DASHBOARD_ACTION.DASHBOARD_CREATE_CLICKED,{app_pathname:"dashboard",app_section:"dashboard",app_action_value:"dashboard-create-button"})}},"Create new dashboard"))),documentationLink:{title:"Dashboard documentation",path:C.A.PAGES.DASHBOARDS}},e.createElement("span",null,"Use dashboards to create specific views on your messages. Create a new dashboard here and add any graph or chart you create in other parts of Graylog with one click.")),e.createElement(g.Row,{className:"content"},e.createElement(g.Col,{md:12},e.createElement(me,null))))}}}]);})();
//# sourceMappingURL=bb8c8232-6203.50837924daa1f365aed8.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy