UNPKG

pulse-dashboard

Version:

A Next.js Dashboard application for real-time monitoring and historical analysis of Playwright test executions, based on playwright-pulse-report. This component provides the UI for visualizing Playwright test results and can be run as a standalone CLI too

1 lines 14.5 kB
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[616],{7323:(e,r,t)=>{t.d(r,{O:()=>o});var a=t(12115);function o(){let[e,r]=(0,a.useState)({currentRun:null,historicalTrends:[],loadingCurrent:!0,loadingHistorical:!0,errorCurrent:null,errorHistorical:null}),t=(0,a.useCallback)(async()=>{let e="/api/current-run";r(e=>({...e,loadingCurrent:!0,errorCurrent:null}));try{console.log("Attempting to fetch current run data from: ".concat(e));let t=await fetch(e);if(!t.ok){let r="".concat(t.status," ").concat(t.statusText||"Server Error");try{let e=await t.json();e&&"string"==typeof e.message&&""!==e.message.trim()?r=e.message:e&&"object"==typeof e&&null!==e&&(r="Server error (".concat(t.status,"): ").concat(JSON.stringify(e)))}catch(r){console.warn("Could not parse error response body as JSON for ".concat(e,". Status: ").concat(t.status),r)}throw Error("Failed to fetch current run from ".concat(e,": ").concat(r))}let a=await t.json();r(e=>({...e,currentRun:a,loadingCurrent:!1,errorCurrent:null}))}catch(a){console.error("PulseDashboard Fetch Error (currentRun at ".concat(e,"):"),a);let t="An unknown error occurred while fetching current run data from ".concat(e,".");t=a instanceof TypeError&&a.message.toLowerCase().includes("failed to fetch")?"Network error: Could not connect to the API endpoint (".concat(e,"). Please check your network connection and ensure the server is running."):a instanceof Error?a.message:String(a),r(e=>({...e,currentRun:null,loadingCurrent:!1,errorCurrent:t}))}},[]),o=(0,a.useCallback)(async()=>{let e="/api/historical-trends";r(e=>({...e,loadingHistorical:!0,errorHistorical:null}));try{console.log("Attempting to fetch historical trends data from: ".concat(e));let t=await fetch(e);if(!t.ok){let r="".concat(t.status," ").concat(t.statusText||"Server Error");try{let e=await t.json();e&&"string"==typeof e.message&&""!==e.message.trim()?r=e.message:e&&"object"==typeof e&&null!==e&&(r="Server error (".concat(t.status,"): ").concat(JSON.stringify(e)))}catch(r){console.warn("Could not parse historical trends error response body as JSON for ".concat(e,". Status: ").concat(t.status),r)}throw Error("Failed to fetch historical trends from ".concat(e,": ").concat(r))}let a=await t.json();r(e=>({...e,historicalTrends:a,loadingHistorical:!1,errorHistorical:null}))}catch(a){console.error("PulseDashboard Fetch Error (historicalTrends at ".concat(e,"):"),a);let t="An unknown error occurred while fetching historical trends from ".concat(e,".");t=a instanceof TypeError&&a.message.toLowerCase().includes("failed to fetch")?"Network error: Could not connect to the API endpoint (".concat(e,"). Please check your network connection and ensure the server is running."):a instanceof Error?a.message:String(a),r(e=>({...e,historicalTrends:[],loadingHistorical:!1,errorHistorical:t}))}},[]);return(0,a.useEffect)(()=>{t(),o()},[t,o]),e}},10549:(e,r,t)=>{t.d(r,{$m:()=>d,As:()=>c,nD:()=>i,ub:()=>u});var a=t(95155),o=t(12115),n=t(23478),s=t(79556),l=t(59434);let i=n.bL,c=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,a.jsx)(n.q7,{ref:r,className:(0,l.cn)("border-b",t),...o})});c.displayName="AccordionItem";let d=o.forwardRef((e,r)=>{let{className:t,children:o,...i}=e;return(0,a.jsx)(n.Y9,{className:"flex",children:(0,a.jsxs)(n.l9,{ref:r,className:(0,l.cn)("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...i,children:[o,(0,a.jsx)(s.A,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})})});d.displayName=n.l9.displayName;let u=o.forwardRef((e,r)=>{let{className:t,children:o,...s}=e;return(0,a.jsx)(n.UC,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...s,children:(0,a.jsx)("div",{className:(0,l.cn)("pb-4 pt-0",t),children:o})})});u.displayName=n.UC.displayName},26126:(e,r,t)=>{t.d(r,{E:()=>l});var a=t(95155);t(12115);var o=t(74466),n=t(59434);let s=(0,o.F)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function l(e){let{className:r,variant:t,...o}=e;return(0,a.jsx)("div",{className:(0,n.cn)(s({variant:t}),r),...o})}},30285:(e,r,t)=>{t.d(r,{$:()=>c});var a=t(95155),o=t(12115),n=t(99708),s=t(74466),l=t(59434);let i=(0,s.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=o.forwardRef((e,r)=>{let{className:t,variant:o,size:s,asChild:c=!1,...d}=e,u=c?n.DX:"button";return(0,a.jsx)(u,{className:(0,l.cn)(i({variant:o,size:s,className:t})),ref:r,...d})});c.displayName="Button"},55365:(e,r,t)=>{t.d(r,{Fc:()=>i,TN:()=>d,XL:()=>c});var a=t(95155),o=t(12115),n=t(74466),s=t(59434);let l=(0,n.F)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),i=o.forwardRef((e,r)=>{let{className:t,variant:o,...n}=e;return(0,a.jsx)("div",{ref:r,role:"alert",className:(0,s.cn)(l({variant:o}),t),...n})});i.displayName="Alert";let c=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,a.jsx)("h5",{ref:r,className:(0,s.cn)("mb-1 font-medium leading-none tracking-tight",t),...o})});c.displayName="AlertTitle";let d=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,a.jsx)("div",{ref:r,className:(0,s.cn)("text-sm [&_p]:leading-relaxed",t),...o})});d.displayName="AlertDescription"},59409:(e,r,t)=>{t.d(r,{bq:()=>f,eb:()=>h,gC:()=>g,l6:()=>d,yv:()=>u});var a=t(95155),o=t(12115),n=t(31992),s=t(79556),l=t(77381),i=t(10518),c=t(59434);let d=n.bL;n.YJ;let u=n.WT,f=o.forwardRef((e,r)=>{let{className:t,children:o,...l}=e;return(0,a.jsxs)(n.l9,{ref:r,className:(0,c.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...l,children:[o,(0,a.jsx)(n.In,{asChild:!0,children:(0,a.jsx)(s.A,{className:"h-4 w-4 opacity-50"})})]})});f.displayName=n.l9.displayName;let m=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,a.jsx)(n.PP,{ref:r,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",t),...o,children:(0,a.jsx)(l.A,{className:"h-4 w-4"})})});m.displayName=n.PP.displayName;let p=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,a.jsx)(n.wn,{ref:r,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",t),...o,children:(0,a.jsx)(s.A,{className:"h-4 w-4"})})});p.displayName=n.wn.displayName;let g=o.forwardRef((e,r)=>{let{className:t,children:o,position:s="popper",...l}=e;return(0,a.jsx)(n.ZL,{children:(0,a.jsxs)(n.UC,{ref:r,className:(0,c.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===s&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:s,...l,children:[(0,a.jsx)(m,{}),(0,a.jsx)(n.LM,{className:(0,c.cn)("p-1","popper"===s&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:o}),(0,a.jsx)(p,{})]})})});g.displayName=n.UC.displayName,o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,a.jsx)(n.JU,{ref:r,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...o})}).displayName=n.JU.displayName;let h=o.forwardRef((e,r)=>{let{className:t,children:o,...s}=e;return(0,a.jsxs)(n.q7,{ref:r,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...s,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(n.VF,{children:(0,a.jsx)(i.A,{className:"h-4 w-4"})})}),(0,a.jsx)(n.p4,{children:o})]})});h.displayName=n.q7.displayName,o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,a.jsx)(n.wv,{ref:r,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",t),...o})}).displayName=n.wv.displayName},59434:(e,r,t)=>{t.d(r,{OX:()=>i,cA:()=>l,cn:()=>s});var a=t(52596),o=t(39688),n=t(42638);function s(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];return(0,o.QP)((0,a.$)(r))}function l(e){if(!e)return"";let r={0:"color:inherit;font-weight:normal;font-style:normal;text-decoration:none;opacity:1;background-color:inherit;",1:"font-weight:bold",2:"opacity:0.6",3:"font-style:italic",4:"text-decoration:underline",30:"color:#000",31:"color:#d00",32:"color:#0a0",33:"color:#aa0",34:"color:#00d",35:"color:#a0a",36:"color:#0aa",37:"color:#aaa",39:"color:inherit",40:"background-color:#000",41:"background-color:#d00",42:"background-color:#0a0",43:"background-color:#aa0",44:"background-color:#00d",45:"background-color:#a0a",46:"background-color:#0aa",47:"background-color:#aaa",49:"background-color:inherit",90:"color:#555",91:"color:#f55",92:"color:#5f5",93:"color:#ff5",94:"color:#55f",95:"color:#f5f",96:"color:#5ff",97:"color:#fff"},t=[],a="",o=!1,n=()=>{if(o&&(a+="</span>",o=!1),t.length>0){let e=t.filter(e=>e).join(";");e&&(a+='<span style="'.concat(e,'">'),o=!0)}},s=e=>{let a=e.split(";");for(let e of(a.includes("0")&&(t=[],r["0"]&&t.push(r["0"])),a))if("0"!==e){if(r[e])"39"===e?(t=t.filter(e=>!e.startsWith("color:"))).push("color:inherit"):"49"===e?(t=t.filter(e=>!e.startsWith("background-color:"))).push("background-color:inherit"):t.push(r[e]);else if(e.startsWith("38;2;")||e.startsWith("48;2;")){let r=e.split(";"),a="38"===r[0]?"color":"background-color";5===r.length&&(t=t.filter(e=>!e.startsWith(a+":"))).push("".concat(a,":rgb(").concat(r[2],",").concat(r[3],",").concat(r[4],")"))}}n()};for(let r of e.split(/(\x1b\[[0-9;]*m)/g))if(r){if(r.startsWith("\x1b[")&&r.endsWith("m"))s(r.slice(2,-1));else{let e=r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");a+=e}}return o&&(a+="</span>"),a}function i(e){if(!e||"string"!=typeof e||""===e.trim())return"#";let r=e.trim(),t="attachments/",a="attachments\\";return(r.toLowerCase().startsWith(t)?r=r.substring(t.length):r.toLowerCase().startsWith(a)&&(r=r.substring(a.length)),""===(r=r.replace(/^[\/\\]+/,"")))?"#":"/api/assets/".concat(r)}new(t.n(n)())({fg:"#000",bg:"#FFF",newline:!0,escapeXML:!0})},66424:(e,r,t)=>{t.d(r,{F:()=>l});var a=t(95155),o=t(12115),n=t(47655),s=t(59434);let l=o.forwardRef((e,r)=>{let{className:t,children:o,...l}=e;return(0,a.jsxs)(n.bL,{ref:r,className:(0,s.cn)("relative overflow-hidden",t),...l,children:[(0,a.jsx)(n.LM,{className:"h-full w-full rounded-[inherit]",children:o}),(0,a.jsx)(i,{}),(0,a.jsx)(n.OK,{})]})});l.displayName=n.bL.displayName;let i=o.forwardRef((e,r)=>{let{className:t,orientation:o="vertical",...l}=e;return(0,a.jsx)(n.VM,{ref:r,orientation:o,className:(0,s.cn)("flex touch-none select-none transition-colors","vertical"===o&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===o&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...l,children:(0,a.jsx)(n.lr,{className:"relative flex-1 rounded-full bg-border"})})});i.displayName=n.VM.displayName},66695:(e,r,t)=>{t.d(r,{BT:()=>c,Wu:()=>d,ZB:()=>i,Zp:()=>s,aR:()=>l});var a=t(95155),o=t(12115),n=t(59434);let s=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,a.jsx)("div",{ref:r,className:(0,n.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...o})});s.displayName="Card";let l=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,a.jsx)("div",{ref:r,className:(0,n.cn)("flex flex-col space-y-1.5 p-6",t),...o})});l.displayName="CardHeader";let i=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,a.jsx)("div",{ref:r,className:(0,n.cn)("text-2xl font-semibold leading-none tracking-tight",t),...o})});i.displayName="CardTitle";let c=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,a.jsx)("div",{ref:r,className:(0,n.cn)("text-sm text-muted-foreground",t),...o})});c.displayName="CardDescription";let d=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,a.jsx)("div",{ref:r,className:(0,n.cn)("p-6 pt-0",t),...o})});d.displayName="CardContent",o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,a.jsx)("div",{ref:r,className:(0,n.cn)("flex items-center p-6 pt-0",t),...o})}).displayName="CardFooter"},68856:(e,r,t)=>{t.d(r,{E:()=>n});var a=t(95155),o=t(59434);function n(e){let{className:r,...t}=e;return(0,a.jsx)("div",{className:(0,o.cn)("animate-pulse rounded-md bg-muted",r),...t})}}}]);