"use strict";(self.webpackChunkgrafana_metricsdrilldown_app=self.webpackChunkgrafana_metricsdrilldown_app||[]).push([[222],{45222:(e,t,n)=>{n.r(t),n.d(t,{MiniBreakdown:()=>p,default:()=>f});var a=n(46089),r=n(82007),o=n(85959),s=n.n(o),i=n(77307),c=n(28464),l=n(87073),m=n(69989),d=n(76217),u=n(82473);const p=({query:e,initialStart:t,initialEnd:n,dataSource:a})=>{const[p]=(0,c.n)(),f=(0,r.useStyles2)(g),h=(0,o.useRef)(!1);(0,o.useEffect)(()=>{h.current||(h.current=!0,(0,l.z)("exposed_component_viewed",{component:"mini_breakdown"}))},[]);const{metric:w,labels:b}=(0,d.$9)(e),E=(0,o.useMemo)(()=>(0,m.ef)({metric:w,initialDS:a,initialFilters:b.map(({label:e,op:t,value:n})=>({key:e,operator:t,value:n})),$timeRange:(0,u._)(t,n),embedded:!0,embeddedMini:!0}),[w,a,b,t,n]);return s().createElement("div",{"data-testid":"metrics-drilldown-mini-breakdown",className:f.container},p?s().createElement(i.E,{error:p}):s().createElement(E.Component,{model:E}))};function g(){return{container:(0,a.css)({width:"300px"})}}const f=p},77307:(e,t,n)=>{n.d(t,{E:()=>m});var a=n(46089),r=n(37768),o=n(82007),s=n(85959),i=n.n(s),c=n(81159),l=n(60341);function m({error:e}){const t=(0,o.useStyles2)(d),n=(0,c.useNavigate)(),{pathname:a,search:m}=(0,c.useLocation)(),u=(0,s.useCallback)(()=>{const e=new URLSearchParams(m),t=new URLSearchParams;["from","to","timezone"].filter(t=>e.has(t)).forEach(n=>t.set(n,e.get(n))),n({pathname:a,search:t.toString()}),window.location.reload()},[n,a,m]),[p,g]=(0,s.useState)(!1);return i().createElement("div",{className:t.container},i().createElement(l._,{severity:"error",title:(0,r.t)("error-view.title","Fatal error!"),error:e,errorContext:{handheldBy:"React error boundary"},message:i().createElement(i().Fragment,null,i().createElement("p",{className:t.message},i().createElement(r.x6,{i18nKey:"error-view.message"},"Please"," ",i().createElement(o.TextLink,{href:"#",onClick:u},"try reloading the page")," ","or, if the problem persists, contact your organization admin. Sorry for the inconvenience.")),i().createElement("p",null,i().createElement(o.Collapse,{className:t.callStack,label:(0,r.t)("error-view.stack-trace-label","View stack trace"),isOpen:p,onToggle:()=>g(!p)},i().createElement("pre",null,i().createElement("code",null,e.stack)))))}))}function d(e){return{container:(0,a.css)({margin:e.spacing(2)}),message:(0,a.css)({margin:e.spacing(2,0,1,0)}),callStack:(0,a.css)({backgroundColor:"transparent",border:"0 none","& button":(0,a.css)({paddingLeft:e.spacing(1.5)}),"& button:focus":(0,a.css)({outline:"none",boxShadow:"none"}),"& button > svg":(0,a.css)({marginLeft:e.spacing(-2),marginRight:e.spacing(.5)}),'& [class$="collapse__loader"]':(0,a.css)({display:"none"})})}}},82473:(e,t,n)=>{n.d(t,{_:()=>s});var a=n(87781),r=n(28904);function o(e){return"string"==typeof e&&a.dateMath.isMathString(e)?e:a.dateMath.toDateTime(new Date(e),{roundUp:!1}).toISOString()}function s(e,t){return new r.SceneTimeRange({from:o(e),to:o(t)})}}}]);
//# sourceMappingURL=222.js.map?_cache=4d035532ffa2ed07da05