"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8259],{98337:(lt,p,t)=>{t.r(p),t.d(p,{plugin:()=>w});var T=t(65158),W=t(37055),c=t(24293),a=t(52622),H=t(11404),L=t(22680),I=t(89654),n=t(74848),r=t(96540),y=t(94624),R=t(40845),D=t(79041),z=t(68268),f=t(38761),$=t(82389),g=t(28895),B=t(87232),Y=t(62567),K=t(7874),U=t(82915);const E=({data:e,timeRange:l,timeZone:o,options:s,width:u,height:J,replaceVariables:S,onChangeTimeRange:C})=>{const d=(0,R.$j)(),[X,h]=(0,r.useState)(null),{sync:Z,eventsScope:b,canAddAnnotations:j,dataLinkPostProcessor:k,eventBus:q}=(0,D.d2)(),v=Z?.()??y.y.Off,A=!!(j&&j()),{frames:i,warn:O}=(0,r.useMemo)(()=>(0,g.Qe)(e.series,!1,l,d),[e.series,l,d]),_=(0,r.useMemo)(()=>(0,g.Or)(i,s.legend,d),[i,s.legend,d]),tt=(0,r.useMemo)(()=>(0,U.Fg)(s.timezone,o),[s.timezone,o]);return!i||O?(0,n.jsx)("div",{className:"panel-empty",children:(0,n.jsx)("p",{children:O??"No data found in response"})}):i[0].length>u/2?(0,n.jsx)("div",{className:"panel-empty",children:(0,n.jsxs)("p",{children:["Too many points to visualize properly. ",(0,n.jsx)("br",{}),"Update the query to return fewer points. ",(0,n.jsx)("br",{}),"(",i[0].length," points received)"]})}):(0,n.jsx)($.I,{theme:d,frames:i,structureRev:e.structureRev,timeRange:l,timeZone:tt,width:u,height:J,legendItems:_,...s,mode:g.pm.Samples,replaceVariables:S,dataLinkPostProcessor:k,cursorSync:v,children:(m,N)=>(0,n.jsxs)(n.Fragment,{children:[v!==y.y.Off&&(0,n.jsx)(z.K,{config:m,eventBus:q,frame:N}),s.tooltip.mode!==a.$N.None&&(0,n.jsx)(f.xl,{config:m,hoverMode:s.tooltip.mode===a.$N.Multi?f.b3.xAll:f.b3.xOne,queryZoom:C,syncMode:v,syncScope:b,render:(P,nt,et,st,V,F,ot)=>{if(A&&F!=null){h(F),V();return}const at=()=>{let M=P.posToVal(P.cursor.left,"x");h({from:M,to:M}),V()};return(0,n.jsx)(B.K,{series:N,dataIdxs:nt,seriesIdx:et,mode:ot?a.$N.Multi:s.tooltip.mode,sortOrder:s.tooltip.sort,isPinned:st,timeRange:l,annotate:A?at:void 0,withDuration:!1,maxHeight:s.tooltip.maxHeight,replaceVariables:S})},maxWidth:s.tooltip.maxWidth}),(0,n.jsx)(Y.W,{annotations:e.annotations??[],config:m,timeZone:o,newRange:X,setNewRange:h,canvasRegionRendering:!1}),(0,n.jsx)(K.U,{config:m,onChangeTimeRange:C})]})})},it={colWidth:.9,rowHeight:.9,showValue:a.yL.Auto},x={fillOpacity:70,lineWidth:1};var G=t(38824);class Q{getSuggestionsForData(l){const{dataSummary:o}=l;if(!o.hasData||!o.hasTimeField||!o.hasStringField&&!o.hasNumberField||o.numberFieldCount>=30||o.rowCountMax>100||o.preferredVisualisationType==="logs")return;l.getListAppender({name:"",pluginId:"status-history",options:{},fieldConfig:{defaults:{color:{mode:c.Y.ContinuousGrYlRd},custom:{}},overrides:[]},cardOptions:{previewModifier:u=>{u.options.colWidth=.7}}}).append({name:G.m.StatusHistory})}}const w=new T.m(E).useFieldConfig({standardOptions:{[W.uo.Color]:{settings:{byValueSupport:!0},defaultValue:{mode:c.Y.Thresholds}}},useCustomConfig:e=>{e.addSliderInput({path:"lineWidth",name:"Line width",defaultValue:x.lineWidth,settings:{min:0,max:10,step:1}}).addSliderInput({path:"fillOpacity",name:"Fill opacity",defaultValue:x.fillOpacity,settings:{min:0,max:100,step:1}}),H.e(e)}}).setPanelOptions(e=>{e.addRadio({path:"showValue",name:"Show values",settings:{options:[{value:a.yL.Auto,label:"Auto"},{value:a.yL.Always,label:"Always"},{value:a.yL.Never,label:"Never"}]},defaultValue:a.yL.Auto}).addSliderInput({path:"rowHeight",name:"Row height",defaultValue:.9,settings:{min:0,max:1,step:.01}}).addSliderInput({path:"colWidth",name:"Column width",defaultValue:.9,settings:{min:0,max:1,step:.01}}),L.H(e,!1),I.D(e)}).setSuggestionsSupplier(new Q).setDataSupport({annotations:!0})}}]);

//# sourceMappingURL=statusHistoryPanel.2ba3ae1df928d17856a2.js.map