"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[1586],{41585(B,E,t){t.d(E,{D:()=>M});var e=t(14553),i=t(22803),r=t(55501),v=t(49439);const j=n=>({metaContainer:(0,i.css)({flex:1,color:n.colors.text.secondary,marginBottom:n.spacing(2),minWidth:"30%",display:"flex",flexWrap:"wrap"}),metaItem:(0,i.css)({marginRight:n.spacing(2),marginTop:n.spacing(.5),display:"flex",alignItems:"center",".logs-meta-item__error":{color:n.colors.error.text}}),metaLabel:(0,i.css)({marginRight:`calc(${n.spacing(2)} / 2)`,fontSize:n.typography.bodySmall.fontSize,fontWeight:n.typography.fontWeightMedium,whiteSpace:"nowrap"}),metaValue:(0,i.css)({fontFamily:n.typography.fontFamilyMonospace,fontSize:n.typography.bodySmall.fontSize})}),S=(0,r.memo)(function(L){const h=(0,v.of)(j),{label:l,value:g}=L;return(0,e.jsxs)("div",{"data-testid":"meta-info-text-item",className:h.metaItem,children:[l&&(0,e.jsxs)("span",{className:h.metaLabel,children:[l,":"]}),(0,e.jsx)("span",{className:h.metaValue,children:g})]})}),M=(0,r.memo)(function(L){const h=(0,v.of)(j),{metaItems:l}=L;return(0,e.jsx)("div",{className:h.metaContainer,"data-testid":"meta-info-text",children:l.map((g,P)=>(0,e.jsx)(S,{label:g.label,value:g.value},`${P}-${g.label}`))})})},51586(B,E,t){t.d(E,{RawPrometheusContainerPure:()=>V});var e=t(14553),i=t(22803),r=t(55501),v=t(34448),j=t(64702),S=t(49439),M=t(23820),n=t(70950),L=t(57416),h=t(85272),l=t(29640),g=t(41585),P=t(2543),z=t(52908),F=t(91793),T=t(52358),K=t(49669),$=t(29798),U=t(43985),G=t(25602),O=t(33662);const y={wrapper:(0,i.css)({height:"100%",overflow:"scroll"}),switchWrapper:(0,i.css)({display:"flex",flexDirection:"row",marginBottom:0}),switchLabel:(0,i.css)({marginLeft:"15px",marginBottom:0}),switch:(0,i.css)({marginLeft:"10px"}),resultCount:(0,i.css)({marginBottom:"4px"}),header:(0,i.css)({display:"flex",justifyContent:"space-between",alignItems:"center",padding:"10px 0",fontSize:"12px",lineHeight:1.25})},X=480,Y=2,Z=C=>{const{tableResult:A}=C,u=(0,P.cloneDeep)(A),w=(0,r.useRef)(null),d=u.fields.filter(a=>a.name.includes("Value")),c=(0,O.E)(u),{width:D}=(0,z.A)(),[s,b]=(0,r.useState)(D<=X||d.length>Y),H=()=>{b(!s);const a={isExpanded:!s};(0,v.rR)("grafana_explore_prometheus_instant_query_ui_raw_toggle_expand",a)};(0,r.useEffect)(()=>{w.current?.resetAfterIndex(0,!0)},[s]);const N=a=>{if(a<10){let x=0;for(let o=0;o<a;o++)x+=R(o,!0);return Math.min(600,x)}return 600},R=(a,m)=>{if(!m)return 32;const o=c[a];return 1.5*32+(Object.keys(o).length-d.length)*22},W=`isExpandedView ${(0,r.useId)()}`;return(0,e.jsxs)("section",{children:[(0,e.jsxs)("header",{className:y.header,children:[(0,e.jsx)(K.D,{className:y.switchWrapper,label:(0,T.t)("explore.raw-list-container.label-expand-results","Expand results"),htmlFor:"isExpandedView",noMargin:!0,children:(0,e.jsx)("div",{className:y.switch,children:(0,e.jsx)($.d,{onChange:H,id:W,value:s,label:(0,T.t)("explore.raw-list-container.label-expand-results","Expand results")})})}),(0,e.jsx)("div",{className:y.resultCount,children:(0,e.jsxs)(T.x6,{i18nKey:"explore.raw-list-container.item-count",values:{numItems:c.length},children:["Result series: ","{{numItems}}"]})})]}),(0,e.jsx)("div",{role:"table",children:(0,e.jsxs)(e.Fragment,{children:[d.length>1&&!s&&(0,e.jsx)(U.d,{valueLabels:d,expanded:s}),(0,e.jsx)(F._m,{ref:w,itemCount:c.length,className:y.wrapper,itemSize:a=>R(a,s),height:N(c.length),width:"100%",children:({index:a,style:m})=>{let f;return s&&(f=d.filter(x=>{const o=c[a][x.name];return o&&o!==O.M})),(0,e.jsx)("div",{role:"row",style:{...m,overflow:"hidden"},children:(0,e.jsx)(G.Ay,{isExpandedView:s,valueLabels:f,totalNumberOfValues:d.length,listKey:c[a].__name__||`item-${a}`,listItemData:c[a]})})}})]})})]})},J=C=>({spacing:(0,i.css)({display:"flex",justifyContent:"space-between",flex:"1"})}),V=(0,r.memo)(({loading:C,onCellFilterAdded:A,tableResult:u,width:w,ariaLabel:d,showRawPrometheus:c})=>{const D=(0,S.of)(J),[s,b]=(0,r.useState)(c?l.aA.raw:void 0),H=p=>{b(p)},N=()=>!u||u.length===0?200:Math.max(Math.min(600,u[0].length*35)+35),R=()=>{const p=l.jH.map(I=>({value:I,label:I[0].toUpperCase()+I.slice(1).replace(/_/," ")}));return(0,e.jsx)("div",{className:D.spacing,children:(0,e.jsx)(M.z,{onClick:()=>{const I={state:s===l.aA.table?l.aA.raw:l.aA.table};(0,v.rR)("grafana_explore_prometheus_instant_query_ui_toggle_clicked",I)},size:"sm",options:p,value:s,onChange:H})})},W=N(),a=w-j.$.theme.panelPadding*2-h.IZ,m=u?.filter(p=>!!p&&p.length!==0),f=s===l.aA.raw?"Raw":"Table",x=s!==void 0?R():"Table",o=!s||s===l.aA.table;return(0,e.jsxs)(n.NR,{title:f,actions:x,loadingState:C,children:[m?.length&&(0,e.jsxs)(e.Fragment,{children:[o&&(0,e.jsx)(L.X,{ariaLabel:d,data:m[0],width:a,height:W,onCellFilterAdded:A}),s===l.aA.raw&&(0,e.jsx)(Z,{tableResult:m[0]})]}),!m?.length&&(0,e.jsx)(g.D,{metaItems:[{value:"0 series returned"}]})]})});V.displayName="RawPrometheusContainerPure"}}]);

//# sourceMappingURL=1586-react19.2771656e28b212218472.js.map