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

//# sourceMappingURL=DashboardPage-react19.b5d95c777d35f34d95fc.js.map