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

//# sourceMappingURL=DashboardPage.7c3907bd4b972c5927cf.js.map