"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[2859,2976,9136],{72340(E,e,a){a.d(e,{EmbeddedDashboard:()=>P});var s=a(74848),r=a(22803),d=a(96540),l=a(5556),g=a(92745),o=a(45863),c=a(34999),D=a(68079),O=a(63142),i=a(47797),h=a(6262),T=a(41644);function P(t){const n=(0,T.sP)(),{dashboard:_,loadError:M}=n.useState();return(0,d.useEffect)(()=>(n.loadDashboard({uid:t.uid,route:h.Z4.Embedded}),()=>{n.clearState()}),[n,t.uid]),M?(0,s.jsx)(c.F,{severity:"error",title:(0,g.t)("dashboard.errors.failed-to-load","Failed to load dashboard"),children:(0,i.q6)(M)}):_?(0,s.jsx)(v,{model:_,...t}):(0,s.jsx)(D.y,{})}function v({model:t,initialState:n,onStateChange:_}){const[M,A]=(0,d.useState)(!1),{controls:u,body:f}=t.useState(),m=(0,O.of)(C);return(0,d.useEffect)(()=>{if(A(!0),n){const U=new URLSearchParams(n);o.Go.syncStateFromSearchParams(t,U)}return t.activate()},[t]),b(_,t),M?(0,s.jsxs)("div",{className:(0,r.cx)(m.canvas,u&&m.canvasWithControls),children:[u&&(0,s.jsx)("div",{className:m.controlsWrapper,children:(0,s.jsx)(u.Component,{model:u})}),(0,s.jsx)("div",{className:m.body,children:(0,s.jsx)(f.Component,{model:f})})]}):null}function b(t,n){(0,d.useEffect)(()=>{if(!t)return;let _="";const M=n.subscribeToEvent(o.bZ,A=>{if(A.payload.changedObject.urlSync){const u=o.Go.getUrlState(n),f=l.kM.renderUrl("",u);_!==f&&(_=f,t(f))}});return()=>M.unsubscribe()},[n,t])}function C(t){return{canvas:(0,r.css)({label:"canvas-content",display:"grid",gridTemplateAreas:`
        "panels"`,gridTemplateColumns:"1fr",gridTemplateRows:"1fr",flexBasis:"100%",flexGrow:1}),canvasWithControls:(0,r.css)({gridTemplateAreas:`
        "controls"
        "panels"`,gridTemplateRows:"auto 1fr"}),body:(0,r.css)({label:"body",flexGrow:1,display:"flex",gap:"8px",gridArea:"panels",marginBottom:t.spacing(2)}),controlsWrapper:(0,r.css)({display:"flex",flexDirection:"column",flexGrow:0,gridArea:"controls",padding:t.spacing(2,0,2,2)})}}},77437(E,e,a){a.r(e),a.d(e,{EmbeddedDashboardTestPage:()=>D,default:()=>O});var s=a(74848),r=a(96540),d=a(75683),l=a(92745),g=a(31286),o=a(13791),c=a(72340);function D(){const[i,h]=(0,r.useState)("?from=now-5m&to=now");return(0,s.jsxs)(o.Y,{navId:"dashboards/browse",pageNav:{text:(0,l.t)("dashboard-scene.embedded-dashboard-test-page.text.embedding-dashboard","Embedding dashboard"),subTitle:(0,l.t)("dashboard-scene.embedded-dashboard-test-page.subTitle.showing-dashboard-panel-tests-pie-chart","Showing dashboard: Panel Tests - Pie chart")},layout:d.k.Canvas,children:[(0,s.jsxs)(g.a,{paddingY:2,children:["Internal url state: ",i]}),(0,s.jsx)(c.EmbeddedDashboard,{uid:"lVE-2YFMz",initialState:i,onStateChange:h})]})}const O=D},373(E,e,a){a.r(e),a.d(e,{default:()=>i});var s=a(74848),r=a(96540),d=a(54148),l=a(92745),g=a(78282),o=a(36490),c=a(13791),D=a(52763),O=a(37918);function i(){const[h,T]=(0,r.useState)(null),{datasourceUid:P}=(0,d.g)(),v=(0,D.wA)();return(0,r.useEffect)(()=>{if(!(0,g.l)().getInstanceSettings(P)){T("Data source not found");return}v((0,O.Ub)(P)),o.Ny.replace("/dashboard/new")},[P,v]),h?(0,s.jsx)(c.Y,{navId:"dashboards",children:(0,s.jsx)(c.Y.Contents,{children:(0,s.jsx)("div",{children:(0,s.jsxs)(l.x6,{i18nKey:"dashboard.new-dashboard-with-ds.not-found",children:['Data source with UID "',{datasourceUid:P},'" not found.']})})})}):null}},20230(E,e,a){E.exports=a.p+"static/img/grab_dark.4ee8d28b.svg"},5878(E,e,a){E.exports=a.p+"static/img/grab_light.322c3334.svg"}}]);

//# sourceMappingURL=DashboardPage.617a2933cc3368b9b139.js.map