grafana/plugins/grafana-lokiexplore-app/475.js

52 lines
242 KiB
JavaScript
Raw Normal View History

2025-01-10 20:54:04 -08:00
"use strict";(self.webpackChunkgrafana_lokiexplore_app=self.webpackChunkgrafana_lokiexplore_app||[]).push([[475],{5218:(e,t,n)=>{n.d(t,{F:()=>o});var r=n(6089),a=n(2007),i=n(5959),l=n.n(i),s=n(1220);const o=e=>{const{isExcluded:t,isIncluded:n,onInclude:r,onExclude:i,onClear:o,titles:d,buttonFill:u}=e,p=(0,a.useStyles2)(c,n,t);return l().createElement("div",{className:p.container},l().createElement(a.Button,{variant:n?"primary":"secondary",fill:u,size:"sm","aria-selected":n,className:p.includeButton,onClick:n?o:r,"data-testid":s.b.exploreServiceDetails.buttonFilterInclude,title:null==d?void 0:d.include},"Include"),l().createElement(a.Button,{variant:t?"primary":"secondary",fill:u,size:"sm","aria-selected":t,className:p.excludeButton,onClick:t?o:i,title:null==d?void 0:d.exclude,"data-testid":s.b.exploreServiceDetails.buttonFilterExclude},"Exclude"))},c=(e,t,n)=>({container:(0,r.css)({display:"flex",justifyContent:"center"}),includeButton:(0,r.css)({borderRadius:0,borderRight:t?void 0:"none"}),excludeButton:(0,r.css)({borderRadius:`0 ${e.shape.radius.default} ${e.shape.radius.default} 0`,borderLeft:n?void 0:"none"})})},4482:(e,t,n)=>{n.d(t,{R:()=>c});var r=n(5959),a=n.n(r),i=n(6089),l=n(1575),s=n(2007);const o=e=>({graphicContainer:(0,i.css)({display:"flex",justifyContent:"center",margin:"0 auto"}),graphic:(0,i.css)({width:"200px",height:"120px",padding:e.spacing(1)}),text:(0,i.css)({display:"flex",justifyContent:"center",alignItems:"center"}),wrap:(0,i.css)({margin:"0 auto"})}),c=({children:e})=>{const t=(0,s.useStyles2)(o),n=(0,s.useTheme2)();return a().createElement("div",{className:t.wrap},a().createElement("div",{className:t.graphicContainer},a().createElement(l.A,{className:t.graphic,src:n.isDark?"/public/plugins/grafana-lokiexplore-app/img/grot_err.svg":"/public/plugins/grafana-lokiexplore-app/img/grot_err_light.svg"})),a().createElement("div",{className:t.text},a().createElement(s.Text,{textAlignment:"center",color:"primary",element:"span"},e||"An error occurred")))}},7311:(e,t,n)=>{n.d(t,{P:()=>Oe});var r=n(5959),a=n.n(r),i=n(1119),l=n(3143),s=n(227),o=n(1475),c=n(2007),d=n(6089),u=n(1220);const p=({onRemove:e,pattern:t,size:n="lg"})=>{const i=(0,c.useStyles2)(v),[l,s]=(0,r.useState)(!1);return a().createElement("div",{className:i.pattern,onClick:()=>s(!l),onMouseLeave:()=>s(!1)},a().createElement(c.Tag,{title:t,key:t,name:l?t:m(t,n),className:i.tag}),a().createElement(c.Button,{"aria-label":"Remove pattern","data-testid":u.b.exploreServiceDetails.buttonRemovePattern,variant:"secondary",size:"sm",className:i.removeButton,onClick:e},a().createElement(c.Icon,{name:"times"})))},g={sm:50,lg:Math.round(window.innerWidth/8)};function m(e,t){const n=e.length;if(n<g[t])return e;const r=Math.round(.4*g[t]);return`${e.substring(0,r)}${e.substring(n-r)}`}const v=e=>({pattern:(0,d.css)({display:"flex",fontFamily:"monospace",gap:e.spacing(.25),cursor:"pointer",overflow:"hidden"}),tag:(0,d.css)({borderTopRightRadius:0,borderBottomRightRadius:0,backgroundColor:e.colors.secondary.main,border:`solid 1px ${e.colors.secondary.border}`,color:e.colors.secondary.text,boxSizing:"border-box",padding:e.spacing(.25,.75),overflow:"hidden",textOverflow:"ellipsis"}),removeButton:(0,d.css)({paddingLeft:2.5,paddingRight:2.5})});var h=n(2718);const f=({patterns:e,onRemove:t})=>{const n=(0,c.useStyles2)(b);if(!e||0===e.length)return null;const r=e.filter((e=>"include"===e.type)),i=e.filter((e=>"include"!==e.type)),l=n=>{t(e.filter((e=>e!==n))),(0,h.EE)(h.NO.service_details,h.ir.service_details.pattern_removed,{includePatternsLength:r.length-("include"===(null==n?void 0:n.type)?1:0),excludePatternsLength:i.length-("include"!==(null==n?void 0:n.type)?1:0),type:n.type})};return a().createElement("div",null,r.length>0&&a().createElement("div",{className:n.patternsContainer},a().createElement(c.Text,{variant:"bodySmall",weight:"bold","data-testid":u.b.patterns.buttonIncludedPattern},"Included pattern",e.length>1?"s":""),a().createElement("div",{className:n.patterns},r.map((e=>a().createElement(p,{key:e.pattern,pattern:e.pattern,size:"lg",onRemove
position: absolute;
right: 0;
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 20px;
top: 32px;
margin-top: -24px;
// For some reason clicking on this button causes text to be selected in the following row
user-select: none;
`,scrollLeft:S.css`
cursor: pointer;
background: ${e.colors.background.primary};
&:hover {
background: ${e.colors.background.secondary};
}
`,scrollRight:S.css`
cursor: pointer;
background: ${e.colors.background.primary};
&:hover {
background: ${e.colors.background.secondary};
}
`}))((0,s.useTheme2)());return a().createElement("div",{className:t.scroller},a().createElement("span",{onPointerDown:()=>{var t,n;null==(t=e)||null===(n=t.current)||void 0===n||n.scrollTo({top:0,left:0,behavior:"smooth"})},onPointerUp:()=>Ie(e),className:t.scrollLeft},a().createElement(s.Icon,{name:"arrow-left"})),a().createElement("span",{onPointerDown:()=>{var t,n;null==(t=e)||null===(n=t.current)||void 0===n||n.scrollTo({top:0,left:t.current.scrollWidth,behavior:"smooth"})},onPointerUp:()=>Ie(e),className:t.scrollRight},a().createElement(s.Icon,{name:"arrow-right"})))}function Me(e){const t=(0,s.useTheme2)(),n=Be(t);return a().createElement("div",{className:n.rawLogLine},a().createElement(a().Fragment,null,e.value))}const Be=(e,t)=>({rawLogLine:(0,S.css)({fontFamily:e.typography.fontFamilyMonospace,height:"35px",lineHeight:"35px",paddingRight:e.spacing(1.5),paddingLeft:e.spacing(1),fontSize:e.typography.bodySmall.fontSize})}),Re=e=>{let t=e.value;const n=e.field,l=n.display(t),o=(0,s.useTheme2)(),c=Ve(o),{columns:d,setVisible:u,bodyState:p}=z(),{logsFrame:g}=Ce(),[m,v]=(0,r.useState)(!1),h=(0,r.useRef)(null);t=a().isValidElement(e.value)?e.value:"object"==typeof t?JSON.stringify(e.value):(0,i.formattedValueToString)(l);const f=(t=>Object.keys(d).filter((e=>e!==$(g))).sort(((e,t)=>e===Pe?-1:t===Pe?1:"LINK_FIELD"===d[e].type?-1:"LINK_FIELD"===d[t].type?1:d[e].cardinality>d[t].cardinality?-1:1)).filter((e=>!d[e].active&&d[e].cardinality>1)).map((r=>{var l;const s=t[r],o=null==g||null===(l=g.raw)||void 0===l?void 0:l.fields.find((e=>e.name===r)),c=null==n?void 0:n.values[e.rowIndex],p=!s&&!!c;if(s)return a().createElement(Ne,{originalFrame:void 0,field:n,columns:d,rowIndex:e.rowIndex,frame:e.frame,showColumns:()=>u(!0),key:r,label:r,isDerivedField:!1,value:s});if(p&&(null==o?void 0:o.name)){const t=null==o?void 0:o.values[e.rowIndex];if((null==o?void 0:o.type)===i.FieldType.string&&t)return a().createElement(Ne,{originalFrame:null==g?void 0:g.raw,originalField:o,field:n,value:t,columns:d,rowIndex:e.rowIndex,frame:e.frame,showColumns:()=>u(!0),key:o.name,label:o.name,isDerivedField:!0})}return null})).filter((e=>e)))(e.labels),b=p===B.auto,y=f.length>0;return a().createElement(Se,{onMouseIn:()=>{v(!0)},onMouseOut:()=>{v(!1)},rowIndex:e.rowIndex,field:e.field},a().createElement(H.ScrollSyncPane,{innerRef:h,group:"horizontal"},a().createElement("div",{className:c.content},0===e.fieldIndex&&a().createElement(ke,{rowIndex:e.rowIndex,value:t}),b&&y&&a().createElement(a().Fragment,null,f),p===B.labels&&y&&a().createElement(a().Fragment,null,f),p===B.labels&&!y&&a().createElement(Me,{value:t}),b&&!y&&a().createElement(Me,{value:t}),p===B.text&&a().createElement(Me,{value:t}),m&&a().createElement(Ae,{scrollerRef:h}))))},Ve=e=>({content:S.css`
white-space: nowrap;
overflow-x: auto;
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
padding-right: 30px;
display: flex;
align-items: flex-start;
height: 100%;
&::-webkit-scrollbar {
display: none; /* Chrome, Safari and Opera */
}
&:after {
pointer-events: none;
content: '';
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
// Fade out text in last 10px to background color to add affordance to horiziontal scroll
background: linear-gradient(to right, transparent calc(100% - 10px), ${e.colors.background.primary});
}
`}),We=e=>{const{setHeaderMenuActive:t,isHeaderMenuActive:n}=Z(),{logsFrame:i}=Ce(),l=(0,r.useRef)(null),o=((e,t,n)=>({tableHeaderMenu:(0,S.css)({label:"tableHeaderMenu",width:"100%",minWidth:"250px",height:"100%",maxHeight:"400px",backgroundColor:e.colors.background.primary,border:`1px solid ${e.colors.border.weak}`,padding:e.spacing(2),margin:e.spacing(1,0),boxShadow:e.shadows.z3,borderRadius:e.shape.radius.default}),button:(0,S.css)({appearance:"none",right:"5px",background:"none",border:"none",padding:0}),wrapper:(0,S.css)({display:"flex",marginLeft:t?"56px":"6px",width:n?"calc(100% + 6px)":"100%",borderRight:`1px solid ${e.colors.border.weak}`,marginRight:"-6px"}),defaultContentWrapper:(0,S.css)({borderLeft:t?`1px solid ${e.colors.border.weak}`:"none",marginLeft:t?"-6px":0,paddingLeft:t?"12px":0,display:"flex"})}))((0,s.useTheme2)(),0===e.fieldIndex,e.field.name===$(i));return a().createElement("span",{className:o.wrapper},a().createElement("span",{className:o.defaultContentWrapper},e.defaultContent),a().createElement("button",{className:o.button,ref:l,onClick:e=>{t(!n)}},a().createElement(s.Icon,{title:"Show menu",name:"ellipsis-v"})),l.current&&a().createElement(s.Popover,{show:n,content:a().createElement(s.ClickOutsideWrapper,{onClick:()=>t(!1),useCapture:!0},a().createElement("div",{className:o.tableHeaderMenu},e.children)),referenceElement:l.current}))};function ze(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function He(e){const{setHeaderMenuActive:t}=Z(),{columns:n,setColumns:i,bodyState:l,setBodyState:o}=z(),{logsFrame:c}=Ce(),d=qe(),u=(0,r.useCallback)((e=>{const t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ze(e,t,n[t])}))}return e}({},n);Object.keys(t).filter((n=>{const r=t[n].index,a=t[e.name].index;return t[n].active&&a&&r&&r>a})).map((e=>t[e])).forEach((e=>{void 0!==e.index&&e.index--})),t[e.name].active=!1,t[e.name].index=void 0,i(t)}),[n,i]),p=e.headerProps.field.name===$(c);return a().createElement(We,e.headerProps,a().createElement("div",{className:d.linkWrap},a().createElement("a",{className:d.link,onClick:()=>{e.openColumnManagementDrawer(),t(!1)}},a().createElement(s.Icon,{className:d.icon,name:"columns",size:"md"}),"Manage columns")),a().createElement("div",{className:d.linkWrap},a().createElement("a",{className:d.link,onClick:()=>u(e.headerProps.field)},a().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 17 16",width:"17",height:"16",className:"css-q2u0ig-Icon"},a().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.73446 1.33301H12.2345C12.3892 1.33301 12.5375 1.40325 12.6469 1.52827C12.7563 1.65329 12.8178 1.82286 12.8178 1.99967V4.74967C12.8178 5.07184 12.5566 5.33301 12.2345 5.33301C11.9123 5.33301 11.6511 5.07184 11.6511 4.74967V2.66634H7.56779V13.333H11.6511V10.9163C11.6511 10.5942 11.9123 10.333 12.2345 10.333C12.5566 10.333 12.8178 10.5942 12.8178 10.9163V13.9997C12.8178 14.1765 12.7563 14.3461 12.6469 14.4711C12.5375 14.5961 12.3892 14.6663 12.2345 14.6663H1.73446C1.57975 14.6663 1.43137 14.5961 1.32198 14.4711C1.21258 14.3461 1.15112 14.1765 1.15112 13.9997V1.99967C1.15112 1.82286 1.21258 1.65329 1.32198 1.52827C1.43137 1.40325 1.57975 1.33301 1.73446 1.33301ZM2.31779 13.333H6.40112V2.66634H2.31779V13.333Z",fill:"#CCCCDC",fillOpacity:"1"}),a().createElement("path",{d:"M15.9893 10.6315C15.9498 10.7263 15.8919 10.8123 15.819 10.8846C15.7467 10.9575 15.6607 11.0154 15.5659 11.0549C15.4712 11.0943 15.3695 11.1147 15.2668 11.1147C15.1641 11.1147 15.0625 11.0943 14.9677 11.0549C14.8729 11.0154 14.7869 10.9575 14.7146 10.8846L12.9335 9.09573L11.1524 10.8846C11.0801 10.9575 10.9941 11.0154 10.8993 11.0549C10.8045 11.0943 10.7028 11.1147 10.6002 11.1147C10.4975 11.1147 10.3958 11.0943 10.301 11.0549C10.2063 11.0154 10.1202 10.9575 10.0479
//# sourceMappingURL=475.js.map