web-interface.assets.07ba022f-3488.61a3cad183d022366945.js Maven / Gradle / Ivy
"use strict";(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["07ba022f-3488"],{"oUJj821/":(ye,C,n)=>{n.r(C),n.d(C,{default:()=>ce});var e=n("Z7aTuO5B"),S=n("ty2gyrHp"),y=n("uZqmR+ju"),d=n("/GOzvPf6"),p=n("d4kzUuQm"),L=n("E+CaPsQD"),A=n("ZaccISJq"),I=n("rlwexfKi"),M=n("fkNiwXiR"),R=n("rVdVsuGH"),w=n("+gqrR506"),P=n("J6y4/h8P"),H=n("QL8i6bcz"),$=n("HQjpSCKK"),Q=n("HqzDVmZB"),U=n("SqY3hYJN"),N=n("MXZnZFI9"),F=n("iSSis/Yq"),O=n("0hhBr0/b"),Z=n("HhRuy6uH");const j=async t=>window.confirm(`Are you sure you want to delete "${t.title}"?`),J=P.default.span(({theme:t})=>(0,P.css)`
color: ${t.colors.variant.danger};
`),Y=({dashboard:t,refetchDashboards:o})=>{const[a,r]=(0,e.useState)(!1),s=(0,R.ZP)(),l=(0,O.Z)("views.components.dashboardActions"),c=(0,e.useRef)({}),u=(0,e.useMemo)(()=>l.map(({component:i,key:m})=>e.createElement(i,{key:`dashboard-action-${m}`,dashboard:t,modalRef:()=>c.current[m]})),[l,t]),v=(0,e.useMemo)(()=>l.filter(({modal:i})=>!!i).map(({modal:i,key:m})=>e.createElement(i,{key:`dashboard-action-modal-${m}`,dashboard:t,ref:b=>{c.current[m]=b}})),[l,t]),E=(0,e.useCallback)(async()=>{const i=H.G.exports("views.hooks.confirmDeletingDashboard");await(0,N.Z)([...i,j],t)&&(await F.T.delete(t),o(),s.resetPage())},[t,o,s]);return e.createElement(e.Fragment,null,e.createElement(d.Tz,{bsSize:"xsmall",entityId:t.id,entityType:"dashboard",onClick:()=>r(!0)}),e.createElement($.Z,{bsSize:"xsmall",title:Z.zN,buttonTitle:Z.V},u.length>0?e.createElement(e.Fragment,null,u,e.createElement(y.MenuItem,{divider:!0})):null,e.createElement(d.AE,{permissions:[`view:edit:${t.id}`,"view:edit"],anyPermissions:!0},e.createElement(y.MenuItem,{onClick:E},e.createElement(J,{role:"button"},"Delete")))),a&&e.createElement(Q.Z,{entityId:t.id,entityType:"dashboard",description:`Search for a User or Team to add as collaborator on this ${(0,U.Z)({type:t.type})}.`,entityTitle:t.title,onClose:()=>r(!1)}),v)};var T=n("DUKaTDO2");const G=(t,o)=>Object.entries(t).filter(([a])=>!o.includes(a)).reduce((a,[r,s])=>({...a,[r]:s}),{}),V=({requirements:t})=>e.createElement("div",null,Object.values(t).map(({url:o,name:a})=>e.createElement("a",{href:o,target:"_blank",rel:"noopener noreferrer"},e.createElement("strong",null,a)))),K=({dashboard:{id:t,requires:o,title:a},requirementsProvided:r})=>{const s=G(o,r);return Object.keys(s).length>0?e.createElement(e.Fragment,null,a,e.createElement(d.kF,{title:"Missing Requirements"},e.createElement(V,{requirements:s}))):e.createElement(S.r,{to:p.ZP.pluginRoute("DASHBOARDS_VIEWID")(t)},a)};var x=n("YwMFjcSm"),W=n("Q1zRxDOP");const X=({searchParams:t})=>{const o=(0,T.useQueryClient)(),a=(0,O.Z)("views.requires.provided");return(0,e.useMemo)(()=>({attributes:{title:{renderCell:(s,l)=>e.createElement(K,{dashboard:l,requirementsProvided:a})},favorite:{renderCell:(s,l)=>e.createElement(x.Z,{isFavorite:s,grn:(0,W.L)("dashboard",l.id),onChange:c=>{o.setQueriesData(["dashboards","overview",t],u=>({...u,list:u.list.map(v=>v.id===l.id?v.toBuilder().favorite(c).build():v)}))}})}}}),[o,a,t])},z="dashboards",D={pageSize:20,sort:{attributeId:"title",direction:"asc"},displayedColumns:["title","description","summary","favorite"],columnsOrder:["title","summary","description","owner","created_at","favorite"]};var k=n("Dg3D5NJi"),q=n("qO9czYNI"),_=n("Z2BtcgLJ"),B=n("TJOheZRu"),ee=n("eFxcQyPT"),te=n("MdYBRjRJ"),f=n("jAGDuYSC"),ne=n("cB7h3AEX");const ae="/views/bulk_delete",se=({selectedDashboardIds:t,setSelectedDashboardIds:o})=>{const a=(0,T.useQueryClient)(),r=t==null?void 0:t.length,s=B.Z.pluralize(r,"dashboard","dashboards"),l=(0,e.useCallback)(()=>{window.confirm(`Do you really want to remove ${r} ${s}?`)&&(0,ee.ZP)("POST",(0,te.DC)(ae),{entity_ids:t}).then(({failures:c})=>{if(c!=null&&c.length){const u=c.map(({entity_id:v})=>v);o(u),f.Z.error(`${u.length} out of ${r} selected ${s} could not be deleted.`)}else o([]),f.Z.success(`${r} ${s} ${B.Z.pluralize(r,"was","were")} deleted successfully.`,"Success")}).catch(c=>{f.Z.error(`An error occurred while deleting dashboards. ${c}`)}).finally(()=>{a.invalidateQueries(["dashboards","overview"])})},[s,a,r,t,o]);return e.createElement(_.Z,{selectedEntities:t,setSelectedEntities:o},e.createElement(ne.Z,{onSelect:l},"Delete"))},oe=(t,o)=>e.createElement(se,{selectedDashboardIds:t,setSelectedDashboardIds:o}),re=()=>{const[t,o]=(0,A.useQueryParam)("query",A.StringParam),{layoutConfig:a,isInitialLoading:r}=(0,k.Z)({entityTableId:z,defaultPageSize:D.pageSize,defaultDisplayedAttributes:D.displayedColumns,defaultSort:D.sort}),s=(0,R.ZP)(void 0,a.pageSize,!1),l=(0,e.useMemo)(()=>({query:t,page:s.page,pageSize:a.pageSize,sort:a.sort}),[a.pageSize,a.sort,s.page,t]),c=X({searchParams:l}),{data:u,isInitialLoading:v,refetch:E}=(0,w.Z)(l,{enabled:!r}),{mutate:i}=(0,q.Z)(z),m=(0,e.useCallback)(g=>{s.resetPage(),o(g)},[s,o]),b=(0,e.useCallback)(g=>{i({displayedAttributes:g})},[i]),de=(0,e.useCallback)(g=>e.createElement(Y,{dashboard:g,refetchDashboards:E}),[E]),ue=(0,e.useCallback)(()=>{m("")},[m]),me=g=>{s.resetPage(),i({perPage:g})},ve=(0,e.useCallback)(g=>{i({sort:g}),s.resetPage()},[s,i]);if(v||r)return e.createElement(d.$j,null);const{list:h,pagination:ge,attributes:he}=u;return e.createElement(d.l9,{pageSize:a.pageSize,showPageSizeSelect:!1,totalItems:ge.total},e.createElement("div",{style:{marginBottom:5}},e.createElement(d.UI,{onSearch:m,queryHelpComponent:e.createElement(I.Z,{entityName:"dashboard",commonFields:["id","title","description","summary"]}),onReset:ue,query:t,topMargin:0})),!(h!=null&&h.length)&&!t&&e.createElement(d.dX,null,"No dashboards have been created yet."),!(h!=null&&h.length)&&t&&e.createElement(d.pJ,null,"No dashboards have been found."),!!(h!=null&&h.length)&&e.createElement(M.Z,{activeSort:a.sort,bulkSelection:{actions:oe},columnDefinitions:he,columnRenderers:c,columnsOrder:D.columnsOrder,data:h,onColumnsChange:b,onPageSizeChange:me,onSortChange:ve,pageSize:a.pageSize,rowActions:de,actionsCellWidth:160,visibleColumns:a.displayedAttributes}))};var le=n("8OvTct/Z"),ie=n("v4GbOr/o");const ce=()=>{const t=(0,le.Z)();return e.createElement(d.$4,{title:"Dashboards"},e.createElement(d.mr,{title:"Dashboards",actions:e.createElement(d.AE,{permissions:"dashboards:create"},e.createElement(S.J,{to:p.ZP.pluginRoute("DASHBOARDS_NEW")},e.createElement(y.Button,{bsStyle:"success",onClick:()=>{t(ie.A.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:L.Z.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(y.Row,{className:"content"},e.createElement(y.Col,{md:12},e.createElement(re,null))))}}}]);})();
//# sourceMappingURL=07ba022f-3488.61a3cad183d022366945.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy