"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[5761],{69579(O,P,t){t.r(P),t.d(P,{ListPublicDashboardPage:()=>C,default:()=>F});var a=t(14553),h=t(22803),j=t(55501),L=t(49045),T=t(51898),r=t(92745),I=t(27489),x=t(63142),u=t(8073),B=t(21285),v=t(45861),N=t(68079),U=t(50201),A=t(89640),M=t(34213),y=t(13791),R=t(15130),p=t(62905),D=t(24313),$=t(11257),z=t(8515),E=t(61730);const Y=({dashboard:s,publicDashboard:i,loader:e,children:n,onDismiss:l,...b})=>{const[o,{isLoading:m}]=(0,p.bN)(),f=(g,c)=>{o({dashboard:s,uid:g.uid,dashboardUid:g.dashboardUid}),c()};return(0,a.jsx)(z.$s,{children:({showModal:g,hideModal:c})=>{const d=(0,r.t)("shared-dashboard-list.button.revoke-button-text","Revoke access");return(0,a.jsx)(v.$n,{"aria-label":d,title:d,onClick:()=>g(E.m,{onConfirm:()=>f(i,c),onDismiss:()=>{l?l():c()}}),...b,children:m&&e?e:n})}})},Z=({pd:s})=>{const i=(0,x.of)(S),e=(0,x.$j)(),n=(0,L.A)(`(max-width: ${e.breakpoints.values.sm}px)`),[l,{isLoading:b}]=(0,p.T2)(),o=T.Tp.pages.PublicDashboards,m=R.TP.hasPermission($.w.DashboardsPublicWrite),f=(d,H)=>{const K={dashboard:{uid:d.dashboardUid},payload:{uid:d.uid,isEnabled:!H}};l(K)},g=(0,j.useMemo)(()=>n?u.Z.Actions:u.Z.SecondaryActions,[n]),c=(0,r.t)("shared-dashboard-list.toggle.pause-sharing-toggle-text","Pause access");return(0,a.jsxs)(u.Z,{noMargin:!0,className:i.card,href:`/d/${s.dashboardUid}`,children:[(0,a.jsx)(u.Z.Heading,{className:i.heading,children:(0,a.jsx)("span",{children:s.title})}),(0,a.jsxs)(g,{className:i.actions,children:[(0,a.jsxs)("div",{className:i.pauseSwitch,children:[(0,a.jsx)(B.d,{value:!s.isEnabled,label:c,disabled:b,onChange:d=>{(0,I.rR)("grafana_dashboards_public_enable_clicked",{action:d.currentTarget.checked?"disable":"enable"}),f(s,d.currentTarget.checked)},"data-testid":o.ListItem.pauseSwitch}),(0,a.jsx)("span",{children:c})]}),(0,a.jsx)(v.z9,{fill:"text",icon:"external-link-alt",variant:"secondary",target:"_blank",color:e.colors.warning.text,href:(0,D.mL)(s.accessToken),tooltip:(0,r.t)("shared-dashboard-list.button.view-button-tooltip","View shared dashboard"),"data-testid":o.ListItem.linkButton},"public-dashboard-url"),(0,a.jsx)(v.z9,{fill:"text",icon:"cog",variant:"secondary",color:e.colors.warning.text,href:(0,D.gN)(s.dashboardUid,s.slug),tooltip:(0,r.t)("shared-dashboard-list.button.config-button-tooltip","Configure shared dashboard"),"data-testid":o.ListItem.configButton},"public-dashboard-config-url"),m&&(0,a.jsx)(Y,{fill:"text",icon:"trash-alt",variant:"secondary",publicDashboard:s,tooltip:(0,r.t)("shared-dashboard-list.button.revoke-button-tooltip","Revoke access"),loader:(0,a.jsx)(N.y,{}),"data-testid":o.ListItem.trashcanButton})]})]})},W=()=>{const[s,i]=(0,j.useState)(1),e=(0,x.of)(S),{data:n,isLoading:l,isError:b}=(0,p._e)(s);return(0,a.jsx)(y.Y,{navId:"dashboards/public",children:(0,a.jsx)(y.Y.Contents,{isLoading:l,children:!l&&!b&&!!n&&(0,a.jsx)("div",{children:n.publicDashboards.length===0?(0,a.jsx)(U.p,{variant:"call-to-action",message:(0,r.t)("shared-dashboard-list.empty-state.message","You haven't created any shared dashboards yet"),children:(0,a.jsxs)(r.x6,{i18nKey:"shared-dashboard-list.empty-state.more-info",children:["Create a shared dashboard from any existing dashboard through the ",(0,a.jsx)("b",{children:"Share"})," modal."," ",(0,a.jsx)(A.Y,{external:!0,href:"https://grafana.com/docs/grafana/latest/dashboards/share-dashboards-panels/shared-dashboards",children:"Learn more"})]})}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("ul",{className:e.list,children:n.publicDashboards.map(o=>(0,a.jsx)("li",{children:(0,a.jsx)(Z,{pd:o})},o.uid))}),(0,a.jsx)(M.d,{onNavigate:i,currentPage:n.page,numberOfPages:n.totalPages,hideWhenSinglePage:!0})]})})})})},S=s=>({list:(0,h.css)({listStyleType:"none",marginBottom:s.spacing(2),display:"flex",flexDirection:"column",gap:s.spacing(1)}),card:(0,h.css)({[s.breakpoints.up("sm")]:{display:"flex"}}),heading:(0,h.css)({display:"flex",alignItems:"center",gap:s.spacing(1),flex:1}),orphanedTitle:(0,h.css)({display:"flex",alignItems:"center",gap:s.spacing(1)}),actions:(0,h.css)({display:"flex",alignItems:"center",position:"relative",gap:s.spacing(.5),[s.breakpoints.up("sm")]:{gap:s.spacing(1)}}),pauseSwitch:(0,h.css)({display:"flex",gap:s.spacing(1),alignItems:"center",fontSize:s.typography.bodySmall.fontSize,marginBottom:0,flex:1,[s.breakpoints.up("sm")]:{paddingRight:s.spacing(2)}})}),C=({})=>(0,a.jsx)(W,{}),F=C}}]);

//# sourceMappingURL=ListPublicDashboardPage-react19.c33377ed696f0a353d33.js.map