UNPKG

pulse-dashboard

Version:

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

1 lines 11.3 kB
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[744],{7323:(e,r,t)=>{t.d(r,{O:()=>a});var o=t(12115);function a(){let[e,r]=(0,o.useState)({currentRun:null,historicalTrends:[],loadingCurrent:!0,loadingHistorical:!0,errorCurrent:null,errorHistorical:null}),t=(0,o.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 o=await t.json();r(e=>({...e,currentRun:o,loadingCurrent:!1,errorCurrent:null}))}catch(o){console.error("PulseDashboard Fetch Error (currentRun at ".concat(e,"):"),o);let t="An unknown error occurred while fetching current run data from ".concat(e,".");t=o instanceof TypeError&&o.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."):o instanceof Error?o.message:String(o),r(e=>({...e,currentRun:null,loadingCurrent:!1,errorCurrent:t}))}},[]),a=(0,o.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 o=await t.json();r(e=>({...e,historicalTrends:o,loadingHistorical:!1,errorHistorical:null}))}catch(o){console.error("PulseDashboard Fetch Error (historicalTrends at ".concat(e,"):"),o);let t="An unknown error occurred while fetching historical trends from ".concat(e,".");t=o instanceof TypeError&&o.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."):o instanceof Error?o.message:String(o),r(e=>({...e,historicalTrends:[],loadingHistorical:!1,errorHistorical:t}))}},[]);return(0,o.useEffect)(()=>{t(),a()},[t,a]),e}},10549:(e,r,t)=>{t.d(r,{$m:()=>d,As:()=>i,nD:()=>c,ub:()=>u});var o=t(95155),a=t(12115),n=t(23478),s=t(79556),l=t(59434);let c=n.bL,i=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,o.jsx)(n.q7,{ref:r,className:(0,l.cn)("border-b",t),...a})});i.displayName="AccordionItem";let d=a.forwardRef((e,r)=>{let{className:t,children:a,...c}=e;return(0,o.jsx)(n.Y9,{className:"flex",children:(0,o.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),...c,children:[a,(0,o.jsx)(s.A,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})})});d.displayName=n.l9.displayName;let u=a.forwardRef((e,r)=>{let{className:t,children:a,...s}=e;return(0,o.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,o.jsx)("div",{className:(0,l.cn)("pb-4 pt-0",t),children:a})})});u.displayName=n.UC.displayName},26126:(e,r,t)=>{t.d(r,{E:()=>l});var o=t(95155);t(12115);var a=t(74466),n=t(59434);let s=(0,a.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,...a}=e;return(0,o.jsx)("div",{className:(0,n.cn)(s({variant:t}),r),...a})}},30285:(e,r,t)=>{t.d(r,{$:()=>i});var o=t(95155),a=t(12115),n=t(99708),s=t(74466),l=t(59434);let c=(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"}}),i=a.forwardRef((e,r)=>{let{className:t,variant:a,size:s,asChild:i=!1,...d}=e,u=i?n.DX:"button";return(0,o.jsx)(u,{className:(0,l.cn)(c({variant:a,size:s,className:t})),ref:r,...d})});i.displayName="Button"},55365:(e,r,t)=>{t.d(r,{Fc:()=>c,TN:()=>d,XL:()=>i});var o=t(95155),a=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"}}),c=a.forwardRef((e,r)=>{let{className:t,variant:a,...n}=e;return(0,o.jsx)("div",{ref:r,role:"alert",className:(0,s.cn)(l({variant:a}),t),...n})});c.displayName="Alert";let i=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,o.jsx)("h5",{ref:r,className:(0,s.cn)("mb-1 font-medium leading-none tracking-tight",t),...a})});i.displayName="AlertTitle";let d=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,o.jsx)("div",{ref:r,className:(0,s.cn)("text-sm [&_p]:leading-relaxed",t),...a})});d.displayName="AlertDescription"},59434:(e,r,t)=>{t.d(r,{O:()=>c,c:()=>l,cn:()=>s});var o=t(52596),a=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,a.QP)((0,o.$)(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=[],o="",a=!1,n=()=>{if(a&&(o+="</span>",a=!1),t.length>0){let e=t.filter(e=>e).join(";");e&&(o+='<span style="'.concat(e,'">'),a=!0)}},s=e=>{let o=e.split(";");for(let e of(o.includes("0")&&(t=[],r["0"]&&t.push(r["0"])),o))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(";"),o="38"===r[0]?"color":"background-color";5===r.length&&(t=t.filter(e=>!e.startsWith(o+":"))).push("".concat(o,":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;");o+=e}}return a&&(o+="</span>"),o}function c(e){if(!e||"string"!=typeof e||""===e.trim())return"#";let r=e.trim(),t="attachments/",o="attachments\\";return(r.toLowerCase().startsWith(t)?r=r.substring(t.length):r.toLowerCase().startsWith(o)&&(r=r.substring(o.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 o=t(95155),a=t(12115),n=t(47655),s=t(59434);let l=a.forwardRef((e,r)=>{let{className:t,children:a,...l}=e;return(0,o.jsxs)(n.bL,{ref:r,className:(0,s.cn)("relative overflow-hidden",t),...l,children:[(0,o.jsx)(n.LM,{className:"h-full w-full rounded-[inherit]",children:a}),(0,o.jsx)(c,{}),(0,o.jsx)(n.OK,{})]})});l.displayName=n.bL.displayName;let c=a.forwardRef((e,r)=>{let{className:t,orientation:a="vertical",...l}=e;return(0,o.jsx)(n.VM,{ref:r,orientation:a,className:(0,s.cn)("flex touch-none select-none transition-colors","vertical"===a&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===a&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...l,children:(0,o.jsx)(n.lr,{className:"relative flex-1 rounded-full bg-border"})})});c.displayName=n.VM.displayName},66695:(e,r,t)=>{t.d(r,{BT:()=>i,Wu:()=>d,ZB:()=>c,Zp:()=>s,aR:()=>l});var o=t(95155),a=t(12115),n=t(59434);let s=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,o.jsx)("div",{ref:r,className:(0,n.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...a})});s.displayName="Card";let l=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,o.jsx)("div",{ref:r,className:(0,n.cn)("flex flex-col space-y-1.5 p-6",t),...a})});l.displayName="CardHeader";let c=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,o.jsx)("div",{ref:r,className:(0,n.cn)("text-2xl font-semibold leading-none tracking-tight",t),...a})});c.displayName="CardTitle";let i=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,o.jsx)("div",{ref:r,className:(0,n.cn)("text-sm text-muted-foreground",t),...a})});i.displayName="CardDescription";let d=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,o.jsx)("div",{ref:r,className:(0,n.cn)("p-6 pt-0",t),...a})});d.displayName="CardContent",a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,o.jsx)("div",{ref:r,className:(0,n.cn)("flex items-center p-6 pt-0",t),...a})}).displayName="CardFooter"},68856:(e,r,t)=>{t.d(r,{E:()=>n});var o=t(95155),a=t(59434);function n(e){let{className:r,...t}=e;return(0,o.jsx)("div",{className:(0,a.cn)("animate-pulse rounded-md bg-muted",r),...t})}}}]);