"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7849,4492],{24880:(L,d,t)=>{t.r(d),t.d(d,{SoloPanelPage:()=>m,SoloPanelRenderer:()=>p,default:()=>v});var n=t(96540),h=t(42418),g=t(62930),S=t(39419),D=t(7392),y=t(80348),M=t(72255),P=t(79065),I=t(11497),c=t(79284),E=t(30195),f=t(74730);function u(a,e){const[o,l]=(0,n.useState)(),[C,O]=(0,n.useState)();return(0,n.useEffect)(()=>{(0,P.Is)().initSync(a);const T=a.activate(),R=(0,f.vL)(a,e);return R?(i(R),l(R)):(0,f.SN)(e)&&s(a,e).then(A=>{A?l(A):O("Panel not found")}),T},[a,e]),[o,C]}function i(a){let e=a.parent;for(;e&&!e.isActive;)e.activate(),e=e.parent}function s(a,e){return new Promise(o=>{a.subscribeToEvent(E.d,()=>{const l=(0,f.vL)(a,e);l?o(l):r(a.state.body)}),r(a.state.body)})}function r(a){a.forEachChild(e=>{if(e instanceof I.w&&!e.isActive){e.activate();return}if(e instanceof P.tI&&e.state.$behaviors){for(const o of e.state.$behaviors)if(o instanceof c.L&&!e.isActive){e.activate();break}r(e)}})}function m({match:a,queryParams:e}){const o=(0,M.sP)(),{dashboard:l}=o.useState();return(0,n.useEffect)(()=>(o.loadDashboard({uid:a.params.uid,route:y.DashboardRoutes.Embedded}),()=>o.clearState()),[o,a,e]),e.panelId?l?n.createElement(p,{dashboard:l,panelId:e.panelId}):n.createElement(S.A,null):n.createElement(D.L,{entity:"Panel"})}const v=m;function p({dashboard:a,panelId:e}){const[o,l]=u(a,e);return l?n.createElement(h.F,{title:l}):o?n.createElement("div",{className:"panel-solo"},n.createElement(o.Component,{model:o})):n.createElement("span",null,"Loading ",n.createElement(g.y,null))}},55087:(L,d,t)=>{t.r(d),t.d(d,{SoloPanel:()=>E,SoloPanelPage:()=>c,default:()=>f});var n=t(96540),h=t(69733),g=t(70713),S=t(76888),D=t(39569),y=t(79999);const M=u=>({dashboard:u.dashboard.getModel()}),P={initDashboard:y.vR},I=(0,h.connect)(M,P);class c extends n.Component{constructor(){super(...arguments),this.state={panel:null,notFound:!1}}componentDidMount(){const{match:i,route:s}=this.props;this.props.initDashboard({urlSlug:i.params.slug,urlUid:i.params.uid,urlType:i.params.type,routeName:s.routeName,fixUrl:!1,keybindingSrv:this.context.keybindings})}getPanelId(){return parseInt(this.props.queryParams.panelId??"0",10)}componentDidUpdate(i){const{dashboard:s}=this.props;if(s&&(!i.dashboard||i.dashboard.uid!==s.uid)){const r=s.getPanelByUrlId(this.props.queryParams.panelId);if(!r){this.setState({notFound:!0});return}r&&s.exitViewPanel(r),this.setState({panel:r}),s.initViewPanel(r)}}render(){return n.createElement(E,{dashboard:this.props.dashboard,notFound:this.state.notFound,panel:this.state.panel,panelId:this.getPanelId(),timezone:this.props.queryParams.timezone})}}c.contextType=S.YE;const E=({dashboard:u,notFound:i,panel:s,panelId:r,timezone:m})=>i?n.createElement("div",{className:"alert alert-error"},"Panel with id ",r," not found"):!s||!u?n.createElement("div",null,"Loading & initializing dashboard"):n.createElement("div",{className:"panel-solo"},n.createElement(g.Ay,null,({width:v,height:p})=>v===0?null:n.createElement(D.L,{stateKey:s.key,width:v,height:p,dashboard:u,panel:s,isEditing:!1,isViewing:!0,lazy:!1,timezone:m,hideMenu:!0}))),f=I(c)}}]);

//# sourceMappingURL=SoloPanelPage.c729750a88c3fa90d1cc.js.map