"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[2976,2859],{13251:(h,d,a)=>{a.d(d,{EmbeddedDashboard:()=>g});var n=a(32196),t=a(96540),D=a(76885),r=a(79065),o=a(42418),P=a(62930),l=a(40845),f=a(80348),O=a(72255);function g(e){const s=(0,O.sP)(),{dashboard:E,loadError:_}=s.useState();return(0,t.useEffect)(()=>(s.loadDashboard({uid:e.uid,route:f.DashboardRoutes.Embedded}),()=>{s.clearState()}),[s,e.uid]),_?t.createElement(o.F,{severity:"error",title:"Failed to load dashboard"},_):E?t.createElement(c,{model:E,...e}):t.createElement(P.y,null)}function c({model:e,initialState:s,onStateChange:E}){const[_,v]=(0,t.useState)(!1),{controls:M,body:u}=e.useState(),b=(0,l.of)(I);return(0,t.useEffect)(()=>{if(v(!0),s){const i=new URLSearchParams(s);r.Go.syncStateFromSearchParams(e,i)}return e.activate()},[e]),m(E,e),_?t.createElement("div",{className:b.canvas},M&&t.createElement("div",{className:b.controls},M.map(i=>t.createElement(i.Component,{key:i.state.key,model:i}))),t.createElement("div",{className:b.body},t.createElement(u.Component,{model:u}))):null}function m(e,s){(0,t.useEffect)(()=>{if(!e)return;let E="";const _=s.subscribeToEvent(r.bZ,v=>{if(v.payload.changedObject.urlSync){const M=r.Go.getUrlState(s),u=D.kM.renderUrl("",M);E!==u&&(E=u,e(u))}});return()=>_.unsubscribe()},[s,e])}function I(e){return{canvas:(0,n.css)({label:"canvas-content",display:"flex",flexDirection:"column",flexBasis:"100%",flexGrow:1}),body:(0,n.css)({label:"body",flexGrow:1,display:"flex",gap:"8px",marginBottom:e.spacing(2)}),controls:(0,n.css)({display:"flex",flexWrap:"wrap",alignItems:"center",gap:e.spacing(1),top:0,zIndex:e.zIndex.navbarFixed,padding:e.spacing(0,0,2,0)})}}},14962:(h,d,a)=>{a.r(d),a.d(d,{EmbeddedDashboardTestPage:()=>o,default:()=>P});var n=a(96540),t=a(90613),D=a(36830),r=a(13251);function o(){const[l,f]=(0,n.useState)("?from=now-5m&to=now");return n.createElement(D.Y,{navId:"dashboards/browse",pageNav:{text:"Embedding dashboard",subTitle:"Showing dashboard: Panel Tests - Pie chart"}},n.createElement(t.a,{paddingY:2},"Internal url state: ",l),n.createElement(r.EmbeddedDashboard,{uid:"lVE-2YFMz",initialState:l,onStateChange:f}))}const P=o},30798:(h,d,a)=>{a.r(d),a.d(d,{default:()=>l});var n=a(96540),t=a(19347),D=a(12131),r=a(36830),o=a(80348),P=a(28601);function l(f){const[O,g]=(0,n.useState)(null),{datasourceUid:c}=f.match.params,m=(0,o.useDispatch)();return(0,n.useEffect)(()=>{if(!(0,t.l)().getInstanceSettings(c)){g("Data source not found");return}m((0,P.Ub)(c)),D.Ny.replace("/dashboard/new")},[c,m]),O?n.createElement(r.Y,{navId:"dashboards"},n.createElement(r.Y.Contents,null,n.createElement("div",null,'Data source with UID "',c,'" not found.'))):null}}}]);

//# sourceMappingURL=DashboardPage.5e50193556ad6b828f5d.js.map