PageSourceSearch

https://lizard.build/assets/ProjectLogsPage-O8xQy5vM.js

js lizard.build collected 2026-10-05 05:10:50 UTC 5,757 bytes, 1 lines download raw bytes

1import{u as A,r,j as t}from"./LizardLogo-DT5n5QIF.js";import{a4 as Q,b9 as z,aY as K,ba as G,bb as J,s as O,b as k,cB as V,b6 as Y}from"./boot-BD7SsAAc.js";import{u as U,a as W}from"./useDocumentTitle-BtUptWlx.js";import{f as X}from"./MagnifyingGlass.es-DpoYZi-p.js";import{S as Z}from"./ObservabilityCharts-CHUHni-l.js";import{L as I,a as ee,S as te}from"./LevelCombobox-BgwS0lo1.js";import"./index-CvQf7OPb.js";import"./metric-series-Du_W6Y9L.js";import"./Cube.es-DgbtI4s9.js";import"./ChartTooltip-Co7UzF-S.js";import"./CartesianChart-BxvRq5vh.js";import"./index-D6ol-gHy.js";import"./index-dm39h1l8.js";import"./Circle.es-B08ACl7J.js";function se({projectId:d,apps:i,addons:x=[]}){const{t:o}=A(),a=r.useMemo(()=>{const e=new Set;for(const s of i)e.add(s.name);for(const s of x)e.add(s.name||s.type);return[...e].sort((s,l)=>s.localeCompare(l))},[i,x]),[v,f]=r.useState(null);r.useEffect(()=>{f(e=>{if(e===null)return null;const s=new Set;for(const l of a)e.has(l)&&s.add(l);return s.size===a.length?null:s})},[a]);const j=v??new Set(a),P=e=>{f(s=>{const l=s??new Set(a),m=new Set(l);return m.has(e)?m.delete(e):m.add(e),m.size===a.length?null:m})},[N,q]=r.useState(()=>new Set(I)),[w,F]=r.useState(""),[_,L]=r.useState([]),[H,R]=r.useState(!1),p=r.useRef(null),[u,E]=r.useState(!0),[T,B]=r.useState(0),[D,M]=r.useState(0),h=Q();r.useEffect(()=>{if(!h)return;const{sendMessage:e,addListener:s,isReady:l}=h;if(!l)return;L([]),R(!1);const m=s(n=>{if(n.type==="project_log_history"){const b=(n.logs??[]).map(c=>({id:c.id,serviceName:c.service??"",text:c.message,timestamp:c.ts||Date.now(),level:c.level==="error"||c.level==="warn"?c.level:"info"}));L(b),R(!0)}if(n.type==="log"){const b=n.message??"",c=n.service??"";L(y=>{const S=[...y,{id:`${n.ts}-${y.length}`,serviceName:c,text:b,timestamp:n.ts||Date.now(),level:n.level==="error"||n.level==="warn"?n.level:z(b)}];return S.length>1e3?S.slice(S.length-1e3):S}
1),B(y=>y+1)}});return e({type:"subscribe_project_logs"}),()=>{m(),e({type:"unsubscribe_project_logs"})}},[h,h==null?void 0:h.isReady,d]);const g=r.useMemo(()=>{let e=_;if(v!==null&&(e=e.filter(s=>j.has(s.serviceName))),e=e.filter(s=>N.has(s.level??"info")),w){const s=w.toLowerCase();e=e.filter(l=>l.text.toLowerCase().includes(s)||l.serviceName.toLowerCase().includes(s))}return e},[_,w,N,v,j]);r.useLayoutEffect(()=>{u&&p.current&&(p.current.scrollTop=p.current.scrollHeight)},[g,u]),r.useEffect(()=>{u&&M(T)},[g,u,T]);const C=u?0:T-D,$=()=>{const e=p.current;e&&(e.scrollTop=e.scrollHeight,E(!0))};return t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-3 py-2 md:px-4 md:py-[14px] border-b border-[var(--border-primary)] bg-[#070707]",children:[t.jsxs("div",{className:"w-full md:w-auto md:flex-1 min-w-0 relative",children:[t.jsx(X,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-txt-tertiary pointer-events-none"}),t.jsx("input",{type:"text",placeholder:o("Search logs..."),value:w,onChange:e=>F(e.target.value),className:"w-full h-9 bg-white/[0.04] border border-glass rounded-lg pl-9 pr-3 text-sm text-white placeholder:text-txt-tertiary focus:outline-none focus:border-white/[0.16]"})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[a.length>0&&t.jsx(Z,{services:a,selected:j,onToggle:P,onSelectAll:()=>f(null),onClear:()=>f(new Set),apps:i,addons:x}),t.jsx(ee,{value:N,onChange:q})]})]}),t.jsxs("div",{className:"hidden md:grid grid-cols-[200px_140px_1fr] gap-2 px-4 py-2 border-b border-[var(--border-primary)] bg-[#070707] text-xs text-txt-tertiary font-medium flex-shrink-0",children:[t.jsx("span",{children:o("Datetime")}),t.jsx("span",{children:o("Service")}),t.jsx("span",{children:o("Message")})]}),t.jsxs("div",{className:"flex-1 relative overflow-hidden flex flex-col",children:[t.jsx("div",{ref:p,onScroll:()=>{const e=p.current;if(!e)return;const s=e.scrollHeight-e.scrollTop-e.clientHeight<200;s!==u&&E(s)},className:"flex-1 overflow-y-auto",children:g.length===0?H?t.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-center py-20",children:[t.jsx(K,{className:"w-8 h-8 text-white"}),t.jsx("p",{className:"text-sm text-txt-tertiary",children:o("There are no runtime logs yet")})]}):t.jsx("div",{className:"h-full flex items-center justify-center",children:t.jsx(te,{})}):g.map(e=>t.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-[200px_140px_1fr] gap-x-2 gap-y-1 px-3 md:px-4 py-2 md:py-1.5 border-b border-[var(--border-primary)] last:border-b-0 text-xs font-mono select-text",children:[t.jsx("span",{className:"text-txt-tertiary tabular-nums",children:G(e.timestamp)}),t.jsx("span",{className:"text-txt-secondary truncate",children:e.serviceName}
1),t.jsx("span",{className:`col-span-2 md:col-span-1 min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere] ph-mask ${e.level==="error"?"text-accent-red":e.level==="warn"?"text-amber-400":"text-white"}`,children:J(e.text)})]},e.id))}),!u&&g.length>0&&t.jsxs("button",{onClick:$,className:"absolute bottom-4 left-1/2 -translate-x-1/2 h-8 px-3 rounded-lg btn-emerald text-xs font-semibold text-white flex items-center gap-1.5 shadow-modal transition-colors active:scale-[0.97] animate-fade-in",children:[t.jsx(O,{className:"w-3.5 h-3.5",weight:"bold"}),C>0?o("{{value1}} new {{value2}}",{value1:C,value2:C===1?"line":"lines"}):o("Jump to latest")]})]})]})}function ve({projectId:d,scope:i}){const x=U(d);W(x?`Logs · ${x}`:"Logs");const o=i.workspaceId??null,a=i.environmentName??"production",{data:v}=k({queryKey:["apps",d,o,a],queryFn:()=>V(d,i)}),{data:f}=k({queryKey:["addons",d,o,a],queryFn:()=>Y(d,i)});return t.jsx(se,{projectId:d,apps:v??[],addons:f??[],scope:i})}export{ve as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.