"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7197],{20302:(ie,T,a)=>{a.r(T),a.d(T,{default:()=>ce});var t=a(96540),R=a(32264),n=a(32196),y=a(64388),b=a(13544),d=a(40845),N=a(67061),z=a(14578),v=a(17205),G=a(39419);const k="https://grafana.com/?src=grafananet&cnt=public-dashboards",O="public/img/grafana_text_logo_light.svg",U="public/img/grafana_text_logo_dark.svg",S="grafana-logo",L=e=>{const o=(0,d.$j)(),s=(0,d.of)(B),{footerHide:l,footerText:c,footerLink:g,footerLogo:i,headerLogoHide:u}=e||{footerHide:!1,footerText:"Powered by",footerLogo:S,footerLink:k,headerLogoHide:!1};return{footerHide:l,footerText:t.createElement("span",{className:s.text},c),footerLogo:i===S?o.isDark?O:U:i,footerLink:g,headerLogoHide:u}};let P=()=>L();function de(e){P=()=>L(e)}const B=e=>({text:(0,n.css)({color:e.colors.text.secondary,fontSize:e.typography.body.fontSize})}),j=b.Tp.pages.PublicDashboard,C=function(){const e=(0,d.of)(M),o=P();return o.footerHide?null:t.createElement("div",{className:e.footer,"data-testid":j.footer},t.createElement("a",{className:e.link,href:o.footerLink,target:"_blank",rel:"noreferrer noopener"},o.footerText," ",t.createElement("img",{className:e.logoImg,alt:"",src:o.footerLogo})))},M=e=>({footer:(0,n.css)({display:"flex",justifyContent:"end",height:"30px",backgroundColor:e.colors.background.canvas,position:"sticky",bottom:0,zIndex:e.zIndex.navbarFixed,padding:e.spacing(.5,0)}),link:(0,n.css)({display:"flex",alignItems:"center"}),logoImg:(0,n.css)({height:"16px",marginLeft:e.spacing(.5)})});var E=a(19361),$=a(20851);const x=b.Tp.pages.PublicDashboard.NotAvailable,h=({paused:e})=>{const o=(0,d.of)(H),s=(0,d.of)($.YO),l=E.M.LoginBoxBackground();return t.createElement(E.M.LoginBackground,{className:o.container,"data-testid":x.container},t.createElement("div",{className:(0,n.cx)(o.box,l)},t.createElement(E.M.LoginLogo,{className:s.loginLogo}),t.createElement("p",{className:o.title,"data-testid":x.title},e?"This dashboard has been paused by the administrator":"The dashboard your are trying to access does not exist"),e&&t.createElement("p",{className:o.description,"data-testid":x.pausedDescription},"Try again later")))},H=e=>({container:(0,n.css)`
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;

    :before {
      opacity: 1;
    }
  `,box:(0,n.css)`
    width: 608px;
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: ${e.spacing(4)};
    z-index: 1;
    border-radius: ${e.shape.borderRadius(4)};
    padding: ${e.spacing(6,8)};
    opacity: 1;
  `,title:(0,n.css)`
    font-size: ${e.typography.h3.fontSize};
    text-align: center;
    margin: 0;
  `,description:(0,n.css)`
    font-size: ${e.typography.h5.fontSize};
    margin: 0;
  `});var Y=a(95425),Z=a(72255);const A=b.Tp.pages.PublicDashboardScene;function K({match:e,route:o}){const s=(0,Z.sP)(),l=(0,d.of)(F),{dashboard:c,isLoading:g,loadError:i}=s.useState();return(0,t.useEffect)(()=>(s.loadDashboard({uid:e.params.accessToken,route:Y.Z4.Public}),()=>{s.clearState()}),[s,e.params.accessToken,o.routeName]),c?c.state.meta.publicDashboardEnabled===!1?t.createElement(h,{paused:!0}):c.state.meta.dashboardNotFound?t.createElement(h,null):t.createElement(V,{model:c}):t.createElement(v.Y,{layout:y.k.Custom,className:l.loadingPage,"data-testid":A.loadingPage},g&&t.createElement(G.A,null),i&&t.createElement("h2",null,i))}function V({model:e}){const[o,s]=(0,t.useState)(!1),{controls:l,title:c}=e.useState(),{timePicker:g,refreshPicker:i,hideTimeControls:u}=l.useState(),f=e.getBodyToRender(),r=(0,d.of)(F);return(0,t.useEffect)(()=>(s(!0),e.activate()),[e]),o?t.createElement(v.Y,{layout:y.k.Custom,className:r.page,"data-testid":A.page},t.createElement("div",{className:r.controls},t.createElement(N.B,{alignItems:"center"},t.createElement("div",{className:r.iconTitle},t.createElement(z.I,{name:"grafana",size:"lg","aria-hidden":!0})),t.createElement("span",{className:r.title},c)),!u&&t.createElement(N.B,null,t.createElement(g.Component,{model:g}),t.createElement(i.Component,{model:i}))),t.createElement("div",{className:r.body},t.createElement(f.Component,{model:f})),t.createElement(C,null)):null}function F(e){return{loadingPage:(0,n.css)({justifyContent:"center"}),page:(0,n.css)({padding:e.spacing(0,2)}),controls:(0,n.css)({display:"flex",justifyContent:"space-between",alignItems:"center",position:"sticky",top:0,zIndex:e.zIndex.navbarFixed,background:e.colors.background.canvas,padding:e.spacing(2,0),[e.breakpoints.down("sm")]:{flexDirection:"column",gap:e.spacing(1),alignItems:"stretch"}}),iconTitle:(0,n.css)({display:"none",[e.breakpoints.up("sm")]:{display:"flex",alignItems:"center"}}),title:(0,n.css)({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"flex",fontSize:e.typography.h4.fontSize,margin:0}),body:(0,n.css)({label:"body",flex:1,overflowY:"auto"})}}var J=a(84596),Q=a(95247),W=a(76888),X=a(81862),D=a(31678),w=a(62367),q=a(59757),_=a(9980),ee=a(2118),I=a(74856),te=a(79999);const ae=b.Tp.pages.PublicDashboard,oe=({dashboard:e})=>{const o=(0,D.useDispatch)(),s=P(),l=c=>{o((0,X.Cj)(c))};return t.createElement(Q.d,{title:e.title,pageIcon:s.headerLogoHide?void 0:"grafana",buttonOverflowAlignment:"right"},!e.timepicker.hidden&&t.createElement(w.$,{dashboard:e,onChangeTimeZone:l}))},ne=e=>{const{match:o,route:s,location:l}=e,c=(0,D.useDispatch)(),g=(0,W.Il)(),i=(0,J.A)(e),u=(0,d.of)(se),f=(0,D.useSelector)(m=>m.dashboard),r=f.getModel();return(0,t.useEffect)(()=>{c((0,te.vR)({routeName:s.routeName,fixUrl:!1,accessToken:o.params.accessToken,keybindingSrv:g.keybindings}))},[]),(0,t.useEffect)(()=>{if(i?.location.search!==l.search){const m=i?.queryParams,p=e.queryParams;(p?.from!==m?.from||p?.to!==m?.to)&&!r?.timepicker.hidden&&(0,I.jG)().updateTimeRangeFromUrl(),!m?.refresh&&p?.refresh&&(0,I.jG)().setAutoRefresh(p.refresh)}},[i,l.search,e.queryParams,r?.timepicker.hidden]),r?r.meta.publicDashboardEnabled===!1?t.createElement(h,{paused:!0}):r.meta.dashboardNotFound?t.createElement(h,null):t.createElement(v.Y,{pageNav:{text:r.title},layout:y.k.Custom,"data-testid":ae.page},t.createElement(oe,{dashboard:r}),f.initError&&t.createElement(q.y,{initError:f.initError}),t.createElement("div",{className:u.gridContainer},t.createElement(ee.N,{dashboard:r,isEditable:!1,viewPanel:null,editPanel:null,hidePanelMenus:!0})),t.createElement("div",{className:u.footer},t.createElement(C,null))):t.createElement(_.P,{initPhase:f.initPhase})},se=e=>({gridContainer:(0,n.css)({flex:1,padding:e.spacing(2,2,2,2),overflow:"auto"}),footer:(0,n.css)({padding:e.spacing(0,2)})}),re=ne;function le(e){return R.$.featureToggles.publicDashboardsScene?t.createElement(K,{...e}):t.createElement(re,{...e})}const ce=le}}]);

//# sourceMappingURL=PublicDashboardPage.29bc64ae2e78eef06b9b.js.map