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

//# sourceMappingURL=DashboardPage.1cffff14d02ce9b3d68b.js.map