"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[2859,2976,8638,9136],{50749(s,e,a){a.d(e,{EmbeddedDashboard:()=>x});var t=a(74848),d=a(22803),n=a(96540),o=a(91715),E=a(52358),c=a(36736),i=a(46633),D=a(33100),O=a(91660),P=a(49439),h=a(25948),v=a(82311),u=a(46333),b=a(74352);function x(r){const _=(0,u.sP)(),{dashboard:l,loadError:g}=_.useState();return(0,b.kt)(),(0,n.useEffect)(()=>(_.loadDashboard({uid:r.uid,route:v.Z4.Embedded}),()=>{_.clearState()}),[_,r.uid]),g?(0,t.jsx)(D.F,{severity:"error",title:(0,E.t)("dashboard.errors.failed-to-load","Failed to load dashboard"),children:(0,h.q6)(g)}):l?(0,t.jsx)(T,{model:l,...r}):(0,t.jsx)(O.y,{})}function T({model:r,initialState:_,onStateChange:l}){const[g,p]=(0,n.useState)(!1),{controls:f,body:M}=r.useState(),m=(0,P.of)(C);return(0,n.useEffect)(()=>{if(p(!0),_){const U=new URLSearchParams(_);c.Go.syncStateFromSearchParams(r,U)}return r.activate()},[r]),A(l,r),g?(0,t.jsxs)("div",{className:(0,d.cx)(m.canvas,f&&m.canvasWithControls),children:[f&&(0,t.jsx)("div",{className:m.controlsWrapper,children:(0,t.jsx)(f.Component,{model:f})}),(0,t.jsx)("div",{className:m.body,children:(0,t.jsx)(M.Component,{model:M})})]}):null}function A(r,_){(0,n.useEffect)(()=>{if(!r)return;let l="";const g=_.subscribeToEvent(i.b,p=>{if(p.payload.changedObject.urlSync){const f=c.Go.getUrlState(_),M=o.kM.renderUrl("",f);l!==M&&(l=M,r(M))}});return()=>g.unsubscribe()},[_,r])}function C(r){return{canvas:(0,d.css)({label:"canvas-content",display:"grid",gridTemplateAreas:`
        "panels"`,gridTemplateColumns:"1fr",gridTemplateRows:"1fr",flexBasis:"100%",flexGrow:1}),canvasWithControls:(0,d.css)({gridTemplateAreas:`
        "controls"
        "panels"`,gridTemplateRows:"auto 1fr"}),body:(0,d.css)({label:"body",flexGrow:1,display:"flex",flexDirection:"column",gap:"8px",gridArea:"panels",marginBottom:r.spacing(2)}),controlsWrapper:(0,d.css)({display:"flex",flexDirection:"column",flexGrow:0,gridArea:"controls",padding:r.spacing(2,0,2,2)})}}},43188(s,e,a){a.r(e),a.d(e,{EmbeddedDashboardTestPage:()=>D,default:()=>O});var t=a(74848),d=a(96540),n=a(64342),o=a(52358),E=a(5195),c=a(5246),i=a(50749);function D(){const[P,h]=(0,d.useState)("?from=now-5m&to=now");return(0,t.jsxs)(c.Y,{navId:"dashboards/browse",pageNav:{text:(0,o.t)("dashboard-scene.embedded-dashboard-test-page.text.embedding-dashboard","Embedding dashboard"),subTitle:(0,o.t)("dashboard-scene.embedded-dashboard-test-page.subTitle.showing-dashboard-panel-tests-pie-chart","Showing dashboard: Panel Tests - Pie chart")},layout:n.k.Canvas,children:[(0,t.jsxs)(E.a,{paddingY:2,children:["Internal url state: ",P]}),(0,t.jsx)(i.EmbeddedDashboard,{uid:"lVE-2YFMz",initialState:P,onStateChange:h})]})}const O=D},26506(s,e,a){a.r(e),a.d(e,{default:()=>o});var t=a(74848),d=a(58348);function n(E){return(0,t.jsx)(d.default,{...E})}const o=n},67628(s,e,a){a.r(e),a.d(e,{default:()=>P});var t=a(74848),d=a(96540),n=a(54148),o=a(52358),E=a(6737),c=a(98391),i=a(5246),D=a(96694),O=a(14459);function P(){const[h,v]=(0,d.useState)(null),{datasourceUid:u}=(0,n.g)(),b=(0,D.wA)();return(0,d.useEffect)(()=>{if(!(0,E.l)().getInstanceSettings(u)){v("Data source not found");return}b((0,O.Ub)(u)),c.Ny.replace("/dashboard/new")},[u,b]),h?(0,t.jsx)(i.Y,{navId:"dashboards",children:(0,t.jsx)(i.Y.Contents,{children:(0,t.jsx)("div",{children:(0,t.jsxs)(o.x6,{i18nKey:"dashboard.new-dashboard-with-ds.not-found",children:['Data source with UID "',{datasourceUid:u},'" not found.']})})})}):null}},97484(s,e,a){s.exports=a.p+"static/img/dashboard_library_1.93b7e752.jpg"},7728(s,e,a){s.exports=a.p+"static/img/dashboard_library_2.e540bb1d.jpg"},52621(s,e,a){s.exports=a.p+"static/img/dashboard_library_3.8f41d293.jpg"},36422(s,e,a){s.exports=a.p+"static/img/dashboard_library_4.0a1e811b.jpg"},26531(s,e,a){s.exports=a.p+"static/img/dashboard_library_5.7f4bc831.jpg"},96820(s,e,a){s.exports=a.p+"static/img/dashboard_library_6.cf5e2209.jpg"},12326(s,e,a){s.exports=a.p+"static/img/grafana_text_logo_dark.70a1e5ee.svg"},71542(s,e,a){s.exports=a.p+"static/img/grafana_text_logo_light.467e047c.svg"}}]);

//# sourceMappingURL=DashboardPage.fe40798e664a0d9aba2b.js.map