@testver/testver 1.4.2 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1174 -800
- package/package.json +1 -1
- package/src/ui/static/assets/AIPanel-KQFq4c0Q.js +32 -0
- package/src/ui/static/assets/AIRecordPanel-CAs8fXyS.js +40 -0
- package/src/ui/static/assets/AIStreamUI-p_sMTEDQ.js +9 -0
- package/src/ui/static/assets/{AITestGenPage-D3t2gPAA.js → AITestGenPage-CHaHfmu4.js} +1 -1
- package/src/ui/static/assets/APITestingPage-BSGJY_hd.js +19 -0
- package/src/ui/static/assets/{AboutPage-CjEqKB-q.js → AboutPage-CDa24SCJ.js} +1 -1
- package/src/ui/static/assets/{AdvancedPage-4kAcpE8Y.js → AdvancedPage-BqXP0FLg.js} +1 -1
- package/src/ui/static/assets/{AnalyticsPage-64mYNK2v.js → AnalyticsPage-Lm8noJqC.js} +1 -1
- package/src/ui/static/assets/{AuditLogPage-BQjOzQje.js → AuditLogPage-BvldSIik.js} +1 -1
- package/src/ui/static/assets/ChangesSummary-Cu0_4Ucf.js +3 -0
- package/src/ui/static/assets/{CodeMapPage-B1ezmnlE.js → CodeMapPage-uEjuo3fk.js} +3 -3
- package/src/ui/static/assets/{ConfirmDialog-t7mpeeSN.js → ConfirmDialog-DtotgVmI.js} +1 -1
- package/src/ui/static/assets/{CoveragePage-YMmCbiBk.js → CoveragePage-jNkQJA1P.js} +1 -1
- package/src/ui/static/assets/{CronBuilder-Nk-K-_8I.js → CronBuilder-D2fERHt9.js} +1 -1
- package/src/ui/static/assets/{Dashboard-BDVxO2V4.js → Dashboard-BaIj_IdQ.js} +1 -1
- package/src/ui/static/assets/{DefectsPage-l8yGeCyR.js → DefectsPage-DH0njYFG.js} +3 -3
- package/src/ui/static/assets/{EmptyState-D1T3JWUr.js → EmptyState-utxlJ0fu.js} +1 -1
- package/src/ui/static/assets/{ExportButton-Dt5RhL-h.js → ExportButton-ouKqn9CU.js} +1 -1
- package/src/ui/static/assets/{FileViewer-CrKgh_cB.js → FileViewer-mU3JloJ6.js} +1 -1
- package/src/ui/static/assets/{GitPage-_4nCEzkJ.js → GitPage-TrX-RqNC.js} +5 -5
- package/src/ui/static/assets/{ImportExportPage-BcR7IQi9.js → ImportExportPage-CIhK_raX.js} +1 -1
- package/src/ui/static/assets/{JiraPushDialog-C2sP4_4h.js → JiraPushDialog-DgEZS-0u.js} +1 -1
- package/src/ui/static/assets/{KpiTile-inmeEsy3.js → KpiTile-BHLE3HVj.js} +1 -1
- package/src/ui/static/assets/{LiveExecutionView-D5BRe9jq.js → LiveExecutionView-CaIf7Jux.js} +1 -1
- package/src/ui/static/assets/{ManagePage-B8iG6Q0B.js → ManagePage-SvRQ6L19.js} +1 -1
- package/src/ui/static/assets/{MediaModal-C5n6sHYi.js → MediaModal-DNM45Uz2.js} +1 -1
- package/src/ui/static/assets/{MobileRunPicker-0h-N2c6d.js → MobileRunPicker-DFKm6_nU.js} +1 -1
- package/src/ui/static/assets/{MobileRunTarget-Bo_xekig.js → MobileRunTarget-DHDoDZ_F.js} +3 -3
- package/src/ui/static/assets/{ModuleExplorer-VGcmK167.js → ModuleExplorer-rni7JbsL.js} +1 -1
- package/src/ui/static/assets/{OutputPage-B_1nPPxE.js → OutputPage-Cn2WCpJ6.js} +1 -1
- package/src/ui/static/assets/{PipelinesPanel-PmmPu8pj.js → PipelinesPanel-D6zWcLtD.js} +1 -1
- package/src/ui/static/assets/{ProfilePage-y7tJNNFd.js → ProfilePage-BKNdkSnx.js} +1 -1
- package/src/ui/static/assets/{ProjectExplorer-DbfGhRq0.js → ProjectExplorer-5e7J8t-o.js} +1 -1
- package/src/ui/static/assets/{RemoteFileStrip-WuRKtx_h.js → RemoteFileStrip-C1S2aclP.js} +1 -1
- package/src/ui/static/assets/{ReportCard-G52Q6-2i.js → ReportCard-D4EElEe9.js} +2 -2
- package/src/ui/static/assets/{ReportFullView-Bt8UFP2J.js → ReportFullView-2w2ysKRg.js} +1 -1
- package/src/ui/static/assets/{ReportsPage-DMtDi73Q.js → ReportsPage-9Fx-IEwV.js} +2 -2
- package/src/ui/static/assets/{ResultsPage-BI9jpK2N.js → ResultsPage-DPkfGh-K.js} +1 -1
- package/src/ui/static/assets/{RunState-ifC4zi6M.js → RunState-CRuS_bC2.js} +1 -1
- package/src/ui/static/assets/{RunTargets-C7vpCbck.js → RunTargets-CPKBrefj.js} +1 -1
- package/src/ui/static/assets/{ScriptMappingPage-7vHuvhQw.js → ScriptMappingPage-C3K_uyf0.js} +1 -1
- package/src/ui/static/assets/{SearchableDevicePicker-BYxYJNWl.js → SearchableDevicePicker-DubIldKj.js} +1 -1
- package/src/ui/static/assets/{SettingsPage-DSISg7r7.js → SettingsPage-BuZrrlW2.js} +1 -1
- package/src/ui/static/assets/{SharedReportView-BOqKGJmR.js → SharedReportView-ig5hECRk.js} +1 -1
- package/src/ui/static/assets/{SourcesPage-CgqtYGBi.js → SourcesPage-BPkqRqkC.js} +1 -1
- package/src/ui/static/assets/{TestExplorerPage-gYLhCD4d.js → TestExplorerPage-C_jl93GR.js} +3 -3
- package/src/ui/static/assets/{TestManagementPage-wqYTKP7W.js → TestManagementPage-DJiWpCne.js} +2 -2
- package/src/ui/static/assets/{TestPlansPage-DOKX9p6z.js → TestPlansPage-G1lvK1C0.js} +3 -3
- package/src/ui/static/assets/{TestverCreditsDetail-cSW0SpNx.js → TestverCreditsDetail-BKpt4oLW.js} +1 -1
- package/src/ui/static/assets/{TestverCreditsRing-DpMzl3h7.js → TestverCreditsRing-CEBSy3w3.js} +1 -1
- package/src/ui/static/assets/{UncommittedDiffViewer-BxS0zi-p.js → UncommittedDiffViewer-FKvUZcRi.js} +2 -2
- package/src/ui/static/assets/{UserManagementPage-B5d0uDU_.js → UserManagementPage-gDGhaHE4.js} +3 -3
- package/src/ui/static/assets/{WorkflowsPage-Bk0DFnFS.js → WorkflowsPage-BACdnU-1.js} +1 -1
- package/src/ui/static/assets/{hiddenLlmProviders-CdhhNa5G.js → hiddenLlmProviders-DzwaR-b9.js} +1 -1
- package/src/ui/static/assets/index-D6sQYc_0.js +47 -0
- package/src/ui/static/assets/{index-DpQhqcHv.js → index-DLmlY2Ol.js} +1 -1
- package/src/ui/static/assets/index-aInN0yoR.css +1 -0
- package/src/ui/static/assets/{reportMeta-AKcU_qwq.js → reportMeta-3kxT7BIT.js} +1 -1
- package/src/ui/static/assets/{useChartTheme-BFz2QcND.js → useChartTheme-CTIe6M63.js} +1 -1
- package/src/ui/static/assets/{useDebouncedValue-BsHptIvX.js → useDebouncedValue-C9odz7b2.js} +1 -1
- package/src/ui/static/assets/{useFeatureFlags-DNkIctil.js → useFeatureFlags-DrhvBp0C.js} +1 -1
- package/src/ui/static/assets/{useJiraConnector-D5ysBBvz.js → useJiraConnector-Dwj69Rfh.js} +1 -1
- package/src/ui/static/assets/useOwnership-C1CmzcvJ.js +1 -0
- package/src/ui/static/assets/useSuites-V0AxZYex.js +1 -0
- package/src/ui/static/assets/{useTabParam-ChbOedP1.js → useTabParam-CyYAP90W.js} +1 -1
- package/src/ui/static/assets/{useTestExplorer-DT8frjCK.js → useTestExplorer-CUqC18DV.js} +1 -1
- package/src/ui/static/assets/{useTestLifecycle-OcwQaB1s.js → useTestLifecycle-C2S_vaX2.js} +1 -1
- package/src/ui/static/assets/{useTestManagement-Xm4Bcx3u.js → useTestManagement-DW6AW2mt.js} +2 -2
- package/src/ui/static/assets/{useTestResults-D5EwGIX9.js → useTestResults-yjH1aUy-.js} +1 -1
- package/src/ui/static/assets/{vendor-charts-DWFQlmCz.js → vendor-charts-By5uZ93z.js} +1 -1
- package/src/ui/static/assets/{vendor-flow-YGpC9U9I.js → vendor-flow-B61ZV-pm.js} +1 -1
- package/src/ui/static/assets/{vendor-icons-BKPiFyYV.js → vendor-icons-D_Dmmj8d.js} +277 -282
- package/src/ui/static/assets/vendor-query-DkZSMtfn.js +1 -0
- package/src/ui/static/assets/{vendor-quill-W-RoQfb6.js → vendor-quill-xJF2Jvjc.js} +1 -1
- package/src/ui/static/assets/{vendor-react-CTbHBddL.js → vendor-react-DOVfxdUy.js} +1 -1
- package/src/ui/static/index.html +5 -5
- package/src/ui/static/assets/AIPanel-B_R-CbrF.js +0 -32
- package/src/ui/static/assets/AIRecordPanel-BRQWIU5h.js +0 -40
- package/src/ui/static/assets/AIStreamUI-C3D989_6.js +0 -9
- package/src/ui/static/assets/APITestingPage-Cmwkiiys.js +0 -19
- package/src/ui/static/assets/ChangesSummary-CY_Vb27i.js +0 -2
- package/src/ui/static/assets/DiffViewer-BIU09a_i.js +0 -2
- package/src/ui/static/assets/index-BYVxKLrT.js +0 -47
- package/src/ui/static/assets/index-C2KJt7SI.css +0 -1
- package/src/ui/static/assets/useOwnership-U0AfKBRo.js +0 -1
- package/src/ui/static/assets/useSuites-DyfN9HVv.js +0 -1
- package/src/ui/static/assets/vendor-query-BrzmPFT3.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,r as E,R as Z}from"./vendor-react-CTbHBddL.js";import{u as ee}from"./vendor-query-BrzmPFT3.js";import{u as se}from"./useTabParam-ChbOedP1.js";import{E as te}from"./ExportButton-Dt5RhL-h.js";import{aw as ae,an as re,ax as le,ay as ie,F as ce}from"./useTestManagement-Xm4Bcx3u.js";import{ik as ne}from"./index-BYVxKLrT.js";import{C as G,H as de,cm as W,bP as D,e as Q,c as V,R as H,df as X,aC as oe,u as B,r as P,o as O,ap as xe,y as me,t as he,a0 as ue,q as z,g as ge}from"./vendor-icons-BKPiFyYV.js";const pe=[{key:"health",label:"Health Dashboard",icon:de},{key:"analytics",label:"Execution Analytics",icon:W},{key:"automation",label:"Automation Usage",icon:D},{key:"defects",label:"Defect Analytics",icon:Q},{key:"cases",label:"Test Case Overview",icon:V}],je={critical:"bg-red-500/20 text-red-300",high:"bg-orange-500/20 text-orange-300",medium:"bg-amber-500/20 text-amber-300",low:"bg-emerald-500/20 text-emerald-300"},I={passed:"bg-emerald-500",failed:"bg-red-500",blocked:"bg-amber-500",skipped:"bg-gray-500"},be={passed:"text-emerald-400",failed:"text-red-400",blocked:"text-amber-400",skipped:"text-gray-400"};function A(t){return t.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function q(t){return t?new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"-"}function fe(t){if(!t&&t!==0)return"-";if(t<1e3)return`${Math.round(t)}ms`;if(t<6e4)return`${(t/1e3).toFixed(1)}s`;const n=Math.floor(t/6e4),r=Math.round(t%6e4/1e3);return`${n}m ${r}s`}function Y(t){return t>=75?"text-emerald-400":t>=50?"text-amber-400":"text-red-400"}function J(t){return t>=75?"bg-emerald-500":t>=50?"bg-amber-500":"bg-red-500"}function ye(t){return t>=75?"stroke-emerald-500":t>=50?"stroke-amber-500":"stroke-red-500"}function Ne(t){return t>=90?"Excellent":t>=75?"Good":t>=50?"Fair":t>=25?"Poor":"Critical"}function M(t,n=0,r=100){return Math.min(r,Math.max(n,t))}function R({value:t,color:n,className:r=""}){const l=M(t),x=n||J(l);return e.jsx("div",{className:`h-2 rounded-full bg-white/5 overflow-hidden ${r}`,children:e.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${x}`,style:{width:`${l}%`}})})}function S({icon:t,label:n,value:r,sub:l,color:x}){return e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${x||"bg-brand-500/15"}`,children:e.jsx(t,{className:`w-4 h-4 ${x?"":"text-brand-300"}`})}),e.jsx("span",{className:"text-sm text-gray-400",children:n})]}),e.jsx("p",{className:"text-2xl font-bold text-gray-100",children:r}),l&&e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:l})]})}function U({message:t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-gray-500",children:[e.jsx(G,{className:"w-10 h-10 mb-3 opacity-40"}),e.jsx("p",{className:"text-sm",children:t})]})}function L(){return e.jsxs("div",{className:"space-y-6 animate-pulse",children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[...Array(4)].map((t,n)=>e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-white/5"}),e.jsx("div",{className:"h-3 w-24 rounded bg-white/5"})]}),e.jsx("div",{className:"h-6 w-16 rounded bg-white/5"})]},n))}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsx("div",{className:"h-3 w-32 rounded bg-white/5 mb-4"}),e.jsx("div",{className:"h-32 rounded bg-white/5"})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsx("div",{className:"h-3 w-40 rounded bg-white/5 mb-4"}),e.jsx("div",{className:"space-y-2",children:[...Array(5)].map((t,n)=>e.jsx("div",{className:"h-8 rounded bg-white/5"},n))})]})]})}function K({message:t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-red-400",children:[e.jsx(O,{className:"w-10 h-10 mb-3 opacity-60"}),e.jsx("p",{className:"text-sm",children:t})]})}function ve({score:t}){const n=M(Math.round(t)),r=80,l=2*Math.PI*r,x=l-n/100*l,h=ye(n),d=Y(n),a=Ne(n);return e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("div",{className:"relative w-52 h-52",children:[e.jsxs("svg",{className:"w-full h-full -rotate-90",viewBox:"0 0 200 200",children:[e.jsx("circle",{cx:"100",cy:"100",r,fill:"none",stroke:"rgba(255,255,255,0.05)",strokeWidth:"12"}),e.jsx("circle",{cx:"100",cy:"100",r,fill:"none",className:h,strokeWidth:"12",strokeLinecap:"round",strokeDasharray:l,strokeDashoffset:x,style:{transition:"stroke-dashoffset 1s ease-out"}})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsx("span",{className:`text-5xl font-bold ${d}`,children:n}),e.jsx("span",{className:"text-xs text-gray-500 mt-1",children:a})]})]}),e.jsx("p",{className:"text-sm font-medium text-gray-400 mt-3",children:"Test Health Score"})]})}function _({icon:t,label:n,score:r,description:l}){const x=M(Math.round(r)),h=Y(x),d=J(x);return e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(t,{className:"w-4 h-4 text-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-gray-200",children:n})]}),e.jsx("span",{className:`text-lg font-bold ${h}`,children:x})]}),e.jsx(R,{value:x,color:d,className:"mb-2"}),e.jsx("p",{className:"text-xs text-gray-500",children:l})]})}function we({data:t}){const n=Object.values(t).reduce((r,l)=>r+l,0);return n===0?e.jsx("div",{className:"h-6 rounded-full bg-white/5"}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-6 rounded-full bg-white/5 overflow-hidden flex",children:Object.entries(t).map(([r,l])=>{const x=l/n*100;if(x===0)return null;const h=I[r]||"bg-gray-500";return e.jsx("div",{className:`h-full ${h} transition-all duration-500`,style:{width:`${x}%`},title:`${A(r)}: ${l} (${x.toFixed(1)}%)`},r)})}),e.jsx("div",{className:"flex flex-wrap gap-4",children:Object.entries(t).map(([r,l])=>{const x=n>0?(l/n*100).toFixed(1):"0",h=be[r]||"text-gray-400",d=I[r]||"bg-gray-500";return e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${d}`}),e.jsx("span",{className:h,children:A(r)}),e.jsxs("span",{className:"text-gray-500",children:[l," (",x,"%)"]})]},r)})})]})}function ke({priority:t,total:n,passed:r,failed:l}){const x=je[t]||"bg-gray-500/20 text-gray-300",h=n>0?(r/n*100).toFixed(1):"0",d=n>0?(l/n*100).toFixed(1):"0";return e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${x}`,children:A(t)}),e.jsxs("span",{className:"text-sm text-gray-400",children:[n," total"]})]}),e.jsxs("div",{className:"flex gap-4 mb-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[e.jsx("span",{className:"text-emerald-400",children:"Passed"}),e.jsxs("span",{className:"text-gray-400",children:[r," (",h,"%)"]})]}),e.jsx(R,{value:n>0?r/n*100:0,color:"bg-emerald-500"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[e.jsx("span",{className:"text-red-400",children:"Failed"}),e.jsxs("span",{className:"text-gray-400",children:[l," (",d,"%)"]})]}),e.jsx(R,{value:n>0?l/n*100:0,color:"bg-red-500"})]})]})]})}function Ce(){const{data:t,isLoading:n,error:r,refetch:l}=ae(),{data:x,isLoading:h}=re();if(n||h)return e.jsx(L,{});if(r)return e.jsx(K,{message:"Failed to load health data"});const a=t||{},g=x||{},p=a.healthScore??a.overallScore??a.overall??a.score??0,v=a.automationCoverage??a.automation_coverage??g.automationCoverage??0,j=a.requirementCoverage??a.requirement_coverage??g.requirementCoverage??0,N=a.executionFreshness??a.execution_freshness??0,k=a.qualityAverage??a.qualityScore??a.quality_score??0,b=a.syncHealth??a.sync_health??0,c=a.staleTestCases??a.stale_test_cases??0,s=a.recentlyUpdated??a.recently_updated??0,u=g.totalTestCases??a.totalTestCases??a.total_test_cases??0,o=g.automatedTestCases??a.automatedCount??a.automated_count??0;return e.jsxs("div",{className:"space-y-8",children:[e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{onClick:()=>l(),className:"flex items-center gap-2 text-xs text-gray-400 hover:text-gray-200 transition-colors",children:[e.jsx(H,{className:"w-3.5 h-3.5"}),"Refresh"]})}),e.jsx("div",{className:"flex justify-center",children:e.jsx(ve,{score:p})}),e.jsx("div",{className:"text-center",children:e.jsxs("p",{className:"text-lg text-gray-400",children:[e.jsx("span",{className:"text-gray-200 font-semibold",children:u})," Test Cases"," ","·"," ",e.jsx("span",{className:"text-gray-200 font-semibold",children:o})," Automated"]})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Health Breakdown"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-4",children:[e.jsx(_,{icon:X,label:"Automation Coverage",score:v,description:"Percentage of test cases with automation scripts"}),e.jsx(_,{icon:oe,label:"Requirement Coverage",score:j,description:"Requirements with linked test cases"}),e.jsx(_,{icon:B,label:"Execution Freshness",score:N,description:"How recently tests have been executed"}),e.jsx(_,{icon:P,label:"Quality Score",score:k,description:"Average quality across test executions"}),e.jsx(_,{icon:H,label:"Sync Health",score:b,description:"Script mappings and automation sync status"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Activity Indicators"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-lg bg-amber-500/15",children:e.jsx(O,{className:"w-5 h-5 text-amber-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"Stale Test Cases"}),e.jsx("p",{className:"text-xs text-gray-500",children:">30 days without update"})]}),e.jsx("span",{className:"text-2xl font-bold text-amber-400",children:c})]}),c>0&&u>0&&e.jsxs("div",{className:"mt-3",children:[e.jsx(R,{value:c/u*100,color:"bg-amber-500"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:[(c/u*100).toFixed(1),"% of total test cases"]})]})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-lg bg-emerald-500/15",children:e.jsx(P,{className:"w-5 h-5 text-emerald-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"Recently Updated"}),e.jsx("p",{className:"text-xs text-gray-500",children:"<7 days since last update"})]}),e.jsx("span",{className:"text-2xl font-bold text-emerald-400",children:s})]}),s>0&&u>0&&e.jsxs("div",{className:"mt-3",children:[e.jsx(R,{value:s/u*100,color:"bg-emerald-500"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:[(s/u*100).toFixed(1),"% of total test cases"]})]})]})]})]})]})}function Te(){const{data:t,isLoading:n,error:r,refetch:l}=le(),[x,h]=E.useState(null);if(n)return e.jsx(L,{});if(r)return e.jsx(K,{message:"Failed to load execution analytics"});const d=t||{},a=d.totalExecutions??d.total_executions??0,g=d.passRate??d.pass_rate??0,p=d.failRate??d.fail_rate??0,v=d.avgDuration??d.avg_duration??0,j=d.byStatus??d.by_status??{},N=d.byPriority??d.by_priority??{},k=d.byCycle??d.cycles??d.cycleHistory??d.cycle_history??[],b=d.recentExecutions??d.trends??d.executionTrend??d.execution_trend??[],c=d.flakyTests??d.flaky_tests??[];return e.jsxs("div",{className:"space-y-8",children:[e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{onClick:()=>l(),className:"flex items-center gap-2 text-xs text-gray-400 hover:text-gray-200 transition-colors",children:[e.jsx(H,{className:"w-3.5 h-3.5"}),"Refresh"]})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx(S,{icon:W,label:"Total Executions",value:a.toLocaleString(),color:"bg-brand-500/15"}),e.jsx(S,{icon:P,label:"Pass Rate",value:`${typeof g=="number"?g.toFixed(1):g}%`,color:"bg-emerald-500/15"}),e.jsx(S,{icon:xe,label:"Fail Rate",value:`${typeof p=="number"?p.toFixed(1):p}%`,color:"bg-red-500/15"}),e.jsx(S,{icon:B,label:"Avg Duration",value:fe(v),color:"bg-sky-500/15"})]}),Object.keys(j).length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Status Distribution"}),e.jsx("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:e.jsx(we,{data:j})})]}),Object.keys(N).length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Priority Breakdown"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:["critical","high","medium","low"].map(s=>{const u=N[s]||{},o=u.total??u.count??0,f=u.passed??0,y=u.failed??0;return o===0?null:e.jsx(ke,{priority:s,total:o,passed:f,failed:y},s)})})]}),Array.isArray(k)&&k.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Cycle History"}),e.jsx("div",{className:"bg-surface-1 rounded-xl border border-white/5 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-white/5",children:[e.jsx("th",{className:"text-left px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Cycle"}),e.jsx("th",{className:"text-left px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Plan"}),e.jsx("th",{className:"text-center px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Total"}),e.jsx("th",{className:"text-center px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Passed"}),e.jsx("th",{className:"text-center px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Failed"}),e.jsx("th",{className:"text-center px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Pass Rate"})]})}),e.jsx("tbody",{children:k.map((s,u)=>{const o=s.total??0,f=s.passed??0,y=s.failed??0,w=o>0?f/o*100:0,T=s.id||s._id||`cycle-${u}`,$=x===T,i=s.blocked??0,m=s.skipped??0,C=o-f-y-i-m;return e.jsxs(Z.Fragment,{children:[e.jsxs("tr",{className:"border-b border-white/5 last:border-0 hover:bg-white/[0.02] transition-colors cursor-pointer",onClick:()=>h($?null:T),children:[e.jsx("td",{className:"px-4 py-3 text-gray-200 font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[$?e.jsx(me,{className:"w-3.5 h-3.5 text-gray-500"}):e.jsx(he,{className:"w-3.5 h-3.5 text-gray-500"}),s.cycleName||s.cycle_name||s.name||"Unnamed Cycle"]})}),e.jsx("td",{className:"px-4 py-3 text-gray-400",children:s.planName||s.plan_name||"-"}),e.jsx("td",{className:"px-4 py-3 text-center text-gray-300",children:o}),e.jsx("td",{className:"px-4 py-3 text-center text-emerald-400",children:f}),e.jsx("td",{className:"px-4 py-3 text-center text-red-400",children:y}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsxs("span",{className:`font-medium ${w>=75?"text-emerald-400":w>=50?"text-amber-400":"text-red-400"}`,children:[w.toFixed(1),"%"]})})]}),$&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"bg-surface-2/50 px-6 py-4 border-b border-white/5",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"text-xs text-gray-500 w-20",children:"Distribution"}),e.jsxs("div",{className:"flex-1 h-4 rounded-full bg-white/5 overflow-hidden flex",children:[f>0&&e.jsx("div",{className:"h-full bg-emerald-500",style:{width:`${f/o*100}%`},title:`Passed: ${f}`}),y>0&&e.jsx("div",{className:"h-full bg-red-500",style:{width:`${y/o*100}%`},title:`Failed: ${y}`}),i>0&&e.jsx("div",{className:"h-full bg-amber-500",style:{width:`${i/o*100}%`},title:`Blocked: ${i}`}),m>0&&e.jsx("div",{className:"h-full bg-gray-500",style:{width:`${m/o*100}%`},title:`Skipped: ${m}`}),C>0&&e.jsx("div",{className:"h-full bg-sky-500",style:{width:`${C/o*100}%`},title:`In Progress: ${C}`})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-xs",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-500"})," Passed: ",e.jsx("strong",{className:"text-emerald-400",children:f})," (",o>0?(f/o*100).toFixed(1):0,"%)"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"})," Failed: ",e.jsx("strong",{className:"text-red-400",children:y})," (",o>0?(y/o*100).toFixed(1):0,"%)"]}),i>0&&e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500"})," Blocked: ",e.jsx("strong",{className:"text-amber-400",children:i})]}),m>0&&e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-500"})," Skipped: ",e.jsx("strong",{className:"text-gray-400",children:m})]}),s.passRate!==void 0&&e.jsxs("span",{className:"text-gray-500",children:["| Pass Rate: ",e.jsxs("strong",{className:w>=75?"text-emerald-400":w>=50?"text-amber-400":"text-red-400",children:[w.toFixed(1),"%"]})]})]})]})})})]},T)})})]})})})]}),Array.isArray(b)&&b.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Execution Trend"}),e.jsx("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:(()=>{const s=[...b].sort((o,f)=>String(o.date||o.day||"").localeCompare(String(f.date||f.day||""))).slice(-14),u=Math.max(...s.map(o=>o.total??0),1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex items-end gap-1 h-36",children:s.map((o,f)=>{const y=o.total??0,w=o.passed??0,T=o.failed??0,$=y-w-T,i=y/u*100,m=o.date||o.day||"";return e.jsxs("div",{className:"flex-1 h-full flex flex-col items-center justify-end group relative",children:[e.jsxs("div",{className:"absolute -top-10 bg-surface-2 border border-white/10 rounded px-2 py-1 text-xs text-gray-300 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-10 pointer-events-none",children:[q(m),": ",y," total (",w,"P / ",T,"F)"]}),e.jsx("div",{className:"flex-1 w-full flex flex-col justify-end",children:e.jsxs("div",{className:"w-full rounded-t overflow-hidden flex flex-col justify-end",style:{height:`${i}%`,minHeight:y>0?"4px":"0"},children:[w>0&&e.jsx("div",{className:"bg-emerald-500",style:{flex:w}}),T>0&&e.jsx("div",{className:"bg-red-500",style:{flex:T}}),$>0&&e.jsx("div",{className:"bg-gray-500",style:{flex:$}})]})}),f%2===0&&e.jsx("span",{className:"text-[9px] text-gray-600 mt-1",children:(m||"").toString().slice(5)})]},f)})}),e.jsxs("div",{className:"flex items-center gap-4 mt-3 text-xs",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-500"})," Passed"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"})," Failed"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-500"})," Other"]}),e.jsxs("span",{className:"ml-auto text-gray-500",children:["Last ",s.length," day",s.length===1?"":"s"]})]})]})})()})]}),Array.isArray(c)&&c.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Unstable Tests"}),e.jsx("div",{className:"bg-surface-1 rounded-xl border border-white/5 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-white/5",children:[e.jsx("th",{className:"text-left px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Test Title"}),e.jsx("th",{className:"text-center px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Fail Rate"}),e.jsx("th",{className:"text-center px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Passed"}),e.jsx("th",{className:"text-center px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Failed"})]})}),e.jsx("tbody",{children:[...c].sort((s,u)=>(u.flakyScore??u.flaky_score??0)-(s.flakyScore??s.flaky_score??0)).map((s,u)=>{const o=s.flakyScore??s.flaky_score??0,f=s.passCount??s.pass_count??s.passed??0,y=s.failCount??s.fail_count??s.failed??0,w=s.title??s.testTitle??s.test_title??"Unknown",T=o>=60?"text-red-400":o>=30?"text-amber-400":"text-gray-400",$=o>=60?"bg-red-500":o>=30?"bg-amber-500":"bg-gray-500";return e.jsxs("tr",{className:"border-b border-white/5 last:border-0 hover:bg-white/[0.02]",children:[e.jsx("td",{className:"px-4 py-3 text-gray-200 max-w-xs truncate",children:w}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("div",{className:"w-20 h-2 rounded-full bg-white/5 overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full ${$}`,style:{width:`${M(o)}%`}})}),e.jsxs("span",{className:`text-xs font-medium ${T}`,children:[o.toFixed(0),"%"]})]})}),e.jsx("td",{className:"px-4 py-3 text-center text-emerald-400",children:f}),e.jsx("td",{className:"px-4 py-3 text-center text-red-400",children:y})]},s.id||s._id||u)})})]})})})]}),a===0&&Object.keys(j).length===0&&e.jsx(U,{message:"No execution data available yet. Run some test cycles to see analytics."})]})}function Se(){const{data:t,isLoading:n}=ie();if(n)return e.jsx(L,{});const r=Array.isArray(t)?t:(t==null?void 0:t.defects)??[];if(r.length===0)return e.jsx(U,{message:"No defects found. Create defects in Integrations to see analytics."});const l={},x={},h={};let d=0,a=0,g=0,p=0;for(const c of r)l[c.severity||"unknown"]=(l[c.severity||"unknown"]||0)+1,x[c.status||"open"]=(x[c.status||"open"]||0)+1,h[c.priority||"medium"]=(h[c.priority||"medium"]||0)+1,["open","in_progress","reopened"].includes(c.status)&&d++,["closed","resolved","verified"].includes(c.status)&&a++,c.resolvedAt&&c.createdAt&&(g+=new Date(c.resolvedAt).getTime()-new Date(c.createdAt).getTime(),p++);const v=p>0?Math.round(g/p/36e5):0,j={};for(const c of r){const s=c.createdAt?new Date(c.createdAt).toISOString().slice(0,10):"";s&&(j[s]||(j[s]={total:0,open:0,closed:0}),j[s].total++,["open","in_progress","reopened"].includes(c.status)?j[s].open++:j[s].closed++)}const N=Object.entries(j).sort(([c],[s])=>c.localeCompare(s)).slice(-14),k={critical:"bg-red-500",blocker:"bg-red-600",high:"bg-orange-500",medium:"bg-amber-500",low:"bg-emerald-500",unknown:"bg-gray-500"},b={open:"bg-sky-500",in_progress:"bg-amber-500",resolved:"bg-emerald-500",closed:"bg-gray-500",verified:"bg-emerald-600",reopened:"bg-red-500",rejected:"bg-gray-600",deferred:"bg-violet-500"};return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx(S,{icon:Q,label:"Total Defects",value:r.length,color:"bg-red-500/15"}),e.jsx(S,{icon:O,label:"Open Defects",value:d,sub:`${r.length>0?(d/r.length*100).toFixed(1):0}% of total`,color:"bg-amber-500/15"}),e.jsx(S,{icon:P,label:"Closed/Resolved",value:a,sub:`${r.length>0?(a/r.length*100).toFixed(1):0}% of total`,color:"bg-emerald-500/15"}),e.jsx(S,{icon:B,label:"Avg Resolution Time",value:v>0?`${v}h`:"-",sub:p>0?`Based on ${p} resolved defects`:"No resolved defects yet",color:"bg-sky-500/15"})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsx("h4",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Severity Distribution"}),e.jsx("div",{className:"space-y-3",children:["critical","blocker","high","medium","low"].filter(c=>l[c]).map(c=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-gray-400 w-16 capitalize",children:c}),e.jsx("div",{className:"flex-1 h-5 rounded bg-white/5 overflow-hidden",children:e.jsx("div",{className:`h-full ${k[c]||"bg-gray-500"} rounded`,style:{width:`${l[c]/r.length*100}%`}})}),e.jsx("span",{className:"text-xs text-gray-300 w-8 text-right font-medium",children:l[c]}),e.jsxs("span",{className:"text-xs text-gray-500 w-12 text-right",children:[(l[c]/r.length*100).toFixed(0),"%"]})]},c))})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsx("h4",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Status Distribution"}),e.jsx("div",{className:"space-y-3",children:Object.entries(x).sort(([,c],[,s])=>s-c).map(([c,s])=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-gray-400 w-20 capitalize",children:A(c)}),e.jsx("div",{className:"flex-1 h-5 rounded bg-white/5 overflow-hidden",children:e.jsx("div",{className:`h-full ${b[c]||"bg-gray-500"} rounded`,style:{width:`${s/r.length*100}%`}})}),e.jsx("span",{className:"text-xs text-gray-300 w-8 text-right font-medium",children:s}),e.jsxs("span",{className:"text-xs text-gray-500 w-12 text-right",children:[(s/r.length*100).toFixed(0),"%"]})]},c))})]})]}),N.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Defect Creation Trend"}),e.jsx("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:e.jsx("div",{className:"flex items-end gap-1 h-32",children:N.map(([c,s],u)=>{const o=Math.max(...N.map(([,y])=>y.total),1),f=s.total/o*100;return e.jsxs("div",{className:"flex-1 h-full flex flex-col items-center justify-end gap-1 group relative",children:[e.jsxs("div",{className:"absolute -top-8 bg-surface-2 border border-white/10 rounded px-2 py-1 text-xs text-gray-300 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-10 pointer-events-none",children:[q(c),": ",s.total," (",s.open," open, ",s.closed," closed)"]}),e.jsx("span",{className:"text-[10px] text-gray-500 opacity-0 group-hover:opacity-100",children:s.total}),e.jsx("div",{className:"flex-1 w-full flex flex-col justify-end",children:e.jsx("div",{className:"w-full rounded-t overflow-hidden flex flex-col justify-end",style:{height:`${f}%`,minHeight:s.total>0?"4px":"0"},children:e.jsx("div",{className:"bg-sky-500/70 flex-1"})})}),u%2===0&&e.jsx("span",{className:"text-[9px] text-gray-600 mt-1",children:c.slice(5)})]},u)})})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Priority Breakdown"}),e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:["critical","high","medium","low"].map(c=>{const s=h[c]||0,u=r.length>0?(s/r.length*100).toFixed(1):"0",o={critical:"text-red-400",high:"text-orange-400",medium:"text-amber-400",low:"text-emerald-400"};return e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4 text-center",children:[e.jsx("p",{className:"text-xs text-gray-500 uppercase mb-1",children:c}),e.jsx("p",{className:`text-2xl font-bold ${o[c]||"text-gray-300"}`,children:s}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:[u,"%"]})]},c)})})]})]})}function $e(){var o,f,y,w,T,$;const{data:t,isLoading:n}=ce({limit:1e5});if(n)return e.jsx(L,{});const r=Array.isArray(t)?t:(t==null?void 0:t.testCases)??[],l=r.length;if(l===0)return e.jsx(U,{message:"No test cases found. Create test cases in Test Management to see Test Cases overview."});const x={},h={},d={},a={};let g=0,p=0;const v={};for(const i of r){x[i.status||"draft"]=(x[i.status||"draft"]||0)+1,h[i.priority||"medium"]=(h[i.priority||"medium"]||0)+1,d[i.type||"manual"]=(d[i.type||"manual"]||0)+1;const m=i.automationStatus||i.automation_status||"manual";a[m]=(a[m]||0)+1;const C=i.steps?typeof i.steps=="string"?JSON.parse(i.steps):i.steps:[];if(Array.isArray(C)&&C.length>0?g++:p++,i.createdAt){const F=new Date(i.createdAt).toISOString().slice(0,10);v[F]=(v[F]||0)+1}}const j=Object.entries(v).sort(([i],[m])=>i.localeCompare(m));let N=0;const b=j.map(([i,m])=>(N+=m,{day:i,count:m,cumulative:N})).slice(-30),c=b.length>0?b[b.length-1].cumulative:0,s=a.automated??0,u=l>0?(s/l*100).toFixed(1):"0";return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-4",children:[e.jsx(S,{icon:ge,label:"Total Test Cases",value:l,color:"bg-brand-500/15"}),e.jsx(S,{icon:X,label:"Automated",value:s,sub:`${u}% automation`,color:"bg-violet-500/15"}),e.jsx(S,{icon:P,label:"With Steps",value:g,sub:`${l>0?(g/l*100).toFixed(0):0}% complete`,color:"bg-emerald-500/15"}),e.jsx(S,{icon:O,label:"Without Steps",value:p,sub:"Need step definitions",color:"bg-amber-500/15"}),e.jsx(S,{icon:V,label:"Types",value:Object.keys(d).length,sub:Object.entries(d).map(([i,m])=>`${A(i)}: ${m}`).join(", "),color:"bg-sky-500/15"})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsx("h4",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Status Distribution"}),e.jsx("div",{className:"space-y-3",children:Object.entries(x).sort(([,i],[,m])=>m-i).map(([i,m])=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-gray-400 w-20 capitalize",children:A(i)}),e.jsx("div",{className:"flex-1 h-5 rounded bg-white/5 overflow-hidden",children:e.jsx("div",{className:"h-full bg-brand-500 rounded",style:{width:`${m/l*100}%`}})}),e.jsx("span",{className:"text-xs text-gray-300 w-8 text-right font-medium",children:m})]},i))})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsx("h4",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Priority Distribution"}),e.jsx("div",{className:"space-y-3",children:["critical","high","medium","low"].filter(i=>h[i]).map(i=>{const m=h[i],C={critical:"bg-red-500",high:"bg-orange-500",medium:"bg-amber-500",low:"bg-emerald-500"};return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-gray-400 w-16 capitalize",children:i}),e.jsx("div",{className:"flex-1 h-5 rounded bg-white/5 overflow-hidden",children:e.jsx("div",{className:`h-full ${C[i]} rounded`,style:{width:`${m/l*100}%`}})}),e.jsx("span",{className:"text-xs text-gray-300 w-8 text-right font-medium",children:m}),e.jsxs("span",{className:"text-xs text-gray-500 w-12 text-right",children:[(m/l*100).toFixed(0),"%"]})]},i)})})]})]}),b.length>0&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:["Test Case Growth ",e.jsx("span",{className:"text-gray-500 font-normal",children:"(Last 30 days)"})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsx("div",{className:"flex items-end gap-0.5 h-40",children:b.map((i,m)=>{const C=c>0?i.cumulative/c*100:0;return e.jsxs("div",{className:"flex-1 h-full flex flex-col items-center justify-end group relative",children:[e.jsxs("div",{className:"absolute -top-10 bg-surface-2 border border-white/10 rounded px-2 py-1 text-xs text-gray-300 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-10 pointer-events-none",children:[q(i.day),": +",i.count," (Total: ",i.cumulative,")"]}),e.jsx("div",{className:"flex-1 w-full flex flex-col justify-end",children:e.jsx("div",{className:"w-full bg-gradient-to-t from-brand-600/80 to-brand-400/60 rounded-t transition-all duration-300 group-hover:from-brand-500 group-hover:to-brand-300",style:{height:`${C}%`,minHeight:"2px"}})}),m%5===0&&e.jsx("span",{className:"text-[9px] text-gray-600 mt-1",children:i.day.slice(5)})]},m)})}),e.jsxs("div",{className:"flex items-center justify-between mt-3 text-xs text-gray-500",children:[e.jsxs("span",{children:["Started: ",(((o=b[0])==null?void 0:o.cumulative)??0)-(((f=b[0])==null?void 0:f.count)??0)," test cases"]}),e.jsxs("span",{children:["Current: ",(y=b[b.length-1])==null?void 0:y.cumulative," test cases"]}),e.jsxs("span",{className:"text-emerald-400",children:["+",(((w=b[b.length-1])==null?void 0:w.cumulative)??0)-((((T=b[0])==null?void 0:T.cumulative)??0)-((($=b[0])==null?void 0:$.count)??0))," new"]})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Automation Status"}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsx("div",{className:"h-6 rounded-full bg-white/5 overflow-hidden flex mb-3",children:Object.entries(a).map(([i,m])=>{const C=m/l*100;if(C===0)return null;const F={automated:"bg-emerald-500",manual:"bg-gray-500",in_progress:"bg-amber-500",planned:"bg-sky-500"};return e.jsx("div",{className:`h-full ${F[i]||"bg-gray-500"}`,style:{width:`${C}%`},title:`${A(i)}: ${m}`},i)})}),e.jsx("div",{className:"flex flex-wrap gap-4",children:Object.entries(a).map(([i,m])=>{const C={automated:"text-emerald-400",manual:"text-gray-400",in_progress:"text-amber-400",planned:"text-sky-400"},F={automated:"bg-emerald-500",manual:"bg-gray-500",in_progress:"bg-amber-500",planned:"bg-sky-500"};return e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${F[i]||"bg-gray-500"}`}),e.jsx("span",{className:C[i]||"text-gray-400",children:A(i)}),e.jsxs("span",{className:"text-gray-500",children:[m," (",(m/l*100).toFixed(1),"%)"]})]},i)})})]})]})]})}function Ae(){const{data:t,isLoading:n}=ee({queryKey:["tm-automation-usage"],queryFn:ne}),r=E.useMemo(()=>{const a=(t==null?void 0:t.cycles)||[];return Array.isArray(a)?a:[]},[t]),l=E.useMemo(()=>{let a=0,g=0,p=0,v=0,j=0,N=0,k=0,b=0;for(const s of r)a+=s.manual.total,g+=s.manual.passed,p+=s.manual.failed,v+=s.manual.duration,j+=s.automated.total,N+=s.automated.passed,k+=s.automated.failed,b+=s.automated.duration;const c=a+j;return{manualTotal:a,manualPassed:g,manualFailed:p,manualDuration:v,autoTotal:j,autoPassed:N,autoFailed:k,autoDuration:b,grandTotal:c}},[r]);if(n)return e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(ue,{className:"w-6 h-6 animate-spin text-brand-400"})});if(r.length===0)return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[e.jsx(D,{className:"w-12 h-12 text-gray-600 mb-3"}),e.jsx("h3",{className:"text-gray-300 font-medium",children:"No Cycle Executions Yet"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Execute test cycles to see automation usage statistics"})]});const x=l.grandTotal>0?Math.round(l.autoTotal/l.grandTotal*100):0,h=100-x,d=a=>a>6e4?`${(a/6e4).toFixed(1)}m`:a>0?`${(a/1e3).toFixed(1)}s`:"—";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4",children:[e.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"Total Executions"}),e.jsx("div",{className:"text-2xl font-bold text-gray-100",children:l.grandTotal}),e.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:["Across ",r.length," cycle",r.length!==1?"s":""]})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500 mb-1",children:[e.jsx(D,{size:12})," Automated"]}),e.jsx("div",{className:"text-2xl font-bold text-emerald-300",children:l.autoTotal}),e.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:[x,"% of total · Pass: ",l.autoTotal>0?Math.round(l.autoPassed/l.autoTotal*100):0,"%"]})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500 mb-1",children:[e.jsx(z,{size:12})," Manual"]}),e.jsx("div",{className:"text-2xl font-bold text-amber-300",children:l.manualTotal}),e.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:[h,"% of total · Pass: ",l.manualTotal>0?Math.round(l.manualPassed/l.manualTotal*100):0,"%"]})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4",children:[e.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"Automation Rate"}),e.jsxs("div",{className:"text-2xl font-bold text-emerald-300",children:[x,"%"]}),e.jsx("div",{className:"w-full bg-gray-700/50 rounded-full h-2 mt-2",children:e.jsx("div",{className:"bg-emerald-400 h-2 rounded-full transition-all",style:{width:`${x}%`}})})]})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-200 mb-3",children:"Overall Manual vs Automated Split"}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsx("div",{className:"flex-1",children:e.jsxs("div",{className:"flex h-8 rounded-lg overflow-hidden",children:[x>0&&e.jsx("div",{className:"bg-emerald-500/60 flex items-center justify-center text-xs font-medium text-white transition-all",style:{width:`${x}%`},children:x>10&&`${x}% Auto`}),h>0&&e.jsx("div",{className:"bg-amber-500/50 flex items-center justify-center text-xs font-medium text-white transition-all",style:{width:`${h}%`},children:h>10&&`${h}% Manual`})]})})}),e.jsxs("div",{className:"flex items-center gap-4 mt-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-400",children:[e.jsx("div",{className:"w-3 h-3 rounded bg-emerald-500/60"})," Automated (",l.autoTotal,")"]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-400",children:[e.jsx("div",{className:"w-3 h-3 rounded bg-amber-500/50"})," Manual (",l.manualTotal,")"]})]})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 overflow-hidden",children:[e.jsx("div",{className:"px-5 py-4 border-b border-white/5",children:e.jsx("h3",{className:"text-sm font-semibold text-gray-200",children:"Per-Cycle Breakdown"})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsxs("thead",{children:[e.jsxs("tr",{className:"border-b border-white/5 text-xs text-gray-500 uppercase tracking-wider",children:[e.jsx("th",{className:"text-left px-5 py-3 font-medium",children:"Plan / Cycle"}),e.jsx("th",{className:"text-center px-3 py-3 font-medium",colSpan:5,children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(z,{size:11})," Manual"]})}),e.jsx("th",{className:"text-center px-3 py-3 font-medium",colSpan:5,children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(D,{size:11})," Automated"]})}),e.jsx("th",{className:"text-center px-3 py-3 font-medium",children:"Split"})]}),e.jsxs("tr",{className:"border-b border-white/5 text-[10px] text-gray-600 uppercase",children:[e.jsx("th",{className:"px-5 py-1.5"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Total"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Pass"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Fail"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Rate"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Time"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Total"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Pass"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Fail"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Rate"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Time"}),e.jsx("th",{className:"text-center px-2 py-1.5"})]})]}),e.jsx("tbody",{children:r.map(a=>{const g=a.manual.total,p=a.automated.total,v=g+p,j=v>0?Math.round(p/v*100):0,N=g>0?Math.round(a.manual.passed/g*100):0,k=p>0?Math.round(a.automated.passed/p*100):0;return e.jsxs("tr",{className:"border-b border-white/5 hover:bg-white/[0.02] transition-colors",children:[e.jsxs("td",{className:"px-5 py-3",children:[e.jsx("div",{className:"text-xs font-medium text-gray-200",children:a.planName}),e.jsx("div",{className:"text-[10px] text-gray-500",children:a.cycleName})]}),e.jsx("td",{className:"text-center px-2 py-3 text-xs text-gray-300",children:g||"—"}),e.jsx("td",{className:"text-center px-2 py-3 text-xs text-emerald-400",children:a.manual.passed||"—"}),e.jsx("td",{className:"text-center px-2 py-3 text-xs text-red-400",children:a.manual.failed||"—"}),e.jsx("td",{className:"text-center px-2 py-3",children:g>0?e.jsxs("span",{className:`text-xs font-medium ${N>=80?"text-emerald-400":N>=50?"text-amber-400":"text-red-400"}`,children:[N,"%"]}):e.jsx("span",{className:"text-xs text-gray-600",children:"—"})}),e.jsx("td",{className:"text-center px-2 py-3 text-[10px] text-gray-500",children:d(a.manual.duration)}),e.jsx("td",{className:"text-center px-2 py-3 text-xs text-emerald-300 font-medium",children:p||"—"}),e.jsx("td",{className:"text-center px-2 py-3 text-xs text-emerald-400",children:a.automated.passed||"—"}),e.jsx("td",{className:"text-center px-2 py-3 text-xs text-red-400",children:a.automated.failed||"—"}),e.jsx("td",{className:"text-center px-2 py-3",children:p>0?e.jsxs("span",{className:`text-xs font-medium ${k>=80?"text-emerald-400":k>=50?"text-amber-400":"text-red-400"}`,children:[k,"%"]}):e.jsx("span",{className:"text-xs text-gray-600",children:"—"})}),e.jsx("td",{className:"text-center px-2 py-3 text-[10px] text-gray-500",children:d(a.automated.duration)}),e.jsx("td",{className:"px-3 py-3",children:v>0?e.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[e.jsxs("div",{className:"flex h-2 w-16 rounded-full overflow-hidden bg-gray-700/50",children:[j>0&&e.jsx("div",{className:"bg-emerald-400 h-full",style:{width:`${j}%`}}),100-j>0&&e.jsx("div",{className:"bg-amber-400/60 h-full",style:{width:`${100-j}%`}})]}),e.jsxs("span",{className:"text-[10px] text-gray-500 w-8",children:[j,"%"]})]}):e.jsx("span",{className:"text-xs text-gray-600",children:"—"})})]},a.cycleId)})})]})})]})]})}function Le(){const[t,n]=se("tab",["health","analytics","automation","defects","cases"],"health");return e.jsxs("div",{className:"min-h-screen bg-surface-0 text-gray-200",children:[e.jsx("div",{className:"border-b border-white/5 bg-surface-1",children:e.jsx("div",{className:"max-w-[1400px] mx-auto px-6 py-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-100 flex items-center gap-3",children:[e.jsx(G,{size:24,className:"text-brand-300"}),"Analytics & Reports"]}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"Test health dashboard, execution analytics, and AI-generated reports"})]}),e.jsx(te,{type:"analytics",formats:["pdf"],label:"Export Report"})]})})}),e.jsx("div",{className:"border-b border-white/5 bg-surface-1",children:e.jsx("div",{className:"max-w-[1400px] mx-auto px-6 flex gap-1",children:pe.map(r=>{const l=r.icon,x=t===r.key;return e.jsxs("button",{onClick:()=>n(r.key),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium border-b-2 transition-colors ${x?"border-brand-400 text-brand-300":"border-transparent text-gray-400 hover:text-gray-200 hover:border-white/10"}`,children:[e.jsx(l,{size:16}),r.label]},r.key)})})}),e.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 py-8",children:[t==="health"&&e.jsx(Ce,{}),t==="analytics"&&e.jsx(Te,{}),t==="automation"&&e.jsx(Ae,{}),t==="defects"&&e.jsx(Se,{}),t==="cases"&&e.jsx($e,{})]})]})}export{Le as AnalyticsPage};
|
|
1
|
+
import{j as e,r as E,R as Z}from"./vendor-react-DOVfxdUy.js";import{u as ee}from"./vendor-query-DkZSMtfn.js";import{u as se}from"./useTabParam-CyYAP90W.js";import{E as te}from"./ExportButton-ouKqn9CU.js";import{aw as ae,an as re,ax as le,ay as ie,F as ne}from"./useTestManagement-DW6AW2mt.js";import{iq as ce}from"./index-D6sQYc_0.js";import{b as G,H as de,cm as W,bP as D,g as Q,e as V,R as H,de as X,aC as oe,u as B,r as P,o as O,ap as xe,y as me,t as he,a0 as ue,q as z,i as ge}from"./vendor-icons-D_Dmmj8d.js";const pe=[{key:"health",label:"Health Dashboard",icon:de},{key:"analytics",label:"Execution Analytics",icon:W},{key:"automation",label:"Automation Usage",icon:D},{key:"defects",label:"Defect Analytics",icon:Q},{key:"cases",label:"Test Case Overview",icon:V}],je={critical:"bg-red-500/20 text-red-300",high:"bg-orange-500/20 text-orange-300",medium:"bg-amber-500/20 text-amber-300",low:"bg-emerald-500/20 text-emerald-300"},I={passed:"bg-emerald-500",failed:"bg-red-500",blocked:"bg-amber-500",skipped:"bg-gray-500"},be={passed:"text-emerald-400",failed:"text-red-400",blocked:"text-amber-400",skipped:"text-gray-400"};function A(t){return t.replace(/_/g," ").replace(/\b\w/g,c=>c.toUpperCase())}function q(t){return t?new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"-"}function fe(t){if(!t&&t!==0)return"-";if(t<1e3)return`${Math.round(t)}ms`;if(t<6e4)return`${(t/1e3).toFixed(1)}s`;const c=Math.floor(t/6e4),r=Math.round(t%6e4/1e3);return`${c}m ${r}s`}function Y(t){return t>=75?"text-emerald-400":t>=50?"text-amber-400":"text-red-400"}function J(t){return t>=75?"bg-emerald-500":t>=50?"bg-amber-500":"bg-red-500"}function ye(t){return t>=75?"stroke-emerald-500":t>=50?"stroke-amber-500":"stroke-red-500"}function Ne(t){return t>=90?"Excellent":t>=75?"Good":t>=50?"Fair":t>=25?"Poor":"Critical"}function M(t,c=0,r=100){return Math.min(r,Math.max(c,t))}function R({value:t,color:c,className:r=""}){const l=M(t),x=c||J(l);return e.jsx("div",{className:`h-2 rounded-full bg-white/5 overflow-hidden ${r}`,children:e.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${x}`,style:{width:`${l}%`}})})}function S({icon:t,label:c,value:r,sub:l,color:x}){return e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${x||"bg-brand-500/15"}`,children:e.jsx(t,{className:`w-4 h-4 ${x?"":"text-brand-300"}`})}),e.jsx("span",{className:"text-sm text-gray-400",children:c})]}),e.jsx("p",{className:"text-2xl font-bold text-gray-100",children:r}),l&&e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:l})]})}function U({message:t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-gray-500",children:[e.jsx(G,{className:"w-10 h-10 mb-3 opacity-40"}),e.jsx("p",{className:"text-sm",children:t})]})}function L(){return e.jsxs("div",{className:"space-y-6 animate-pulse",children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[...Array(4)].map((t,c)=>e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-white/5"}),e.jsx("div",{className:"h-3 w-24 rounded bg-white/5"})]}),e.jsx("div",{className:"h-6 w-16 rounded bg-white/5"})]},c))}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsx("div",{className:"h-3 w-32 rounded bg-white/5 mb-4"}),e.jsx("div",{className:"h-32 rounded bg-white/5"})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsx("div",{className:"h-3 w-40 rounded bg-white/5 mb-4"}),e.jsx("div",{className:"space-y-2",children:[...Array(5)].map((t,c)=>e.jsx("div",{className:"h-8 rounded bg-white/5"},c))})]})]})}function K({message:t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-red-400",children:[e.jsx(O,{className:"w-10 h-10 mb-3 opacity-60"}),e.jsx("p",{className:"text-sm",children:t})]})}function ve({score:t}){const c=M(Math.round(t)),r=80,l=2*Math.PI*r,x=l-c/100*l,h=ye(c),d=Y(c),a=Ne(c);return e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("div",{className:"relative w-52 h-52",children:[e.jsxs("svg",{className:"w-full h-full -rotate-90",viewBox:"0 0 200 200",children:[e.jsx("circle",{cx:"100",cy:"100",r,fill:"none",stroke:"rgba(255,255,255,0.05)",strokeWidth:"12"}),e.jsx("circle",{cx:"100",cy:"100",r,fill:"none",className:h,strokeWidth:"12",strokeLinecap:"round",strokeDasharray:l,strokeDashoffset:x,style:{transition:"stroke-dashoffset 1s ease-out"}})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsx("span",{className:`text-5xl font-bold ${d}`,children:c}),e.jsx("span",{className:"text-xs text-gray-500 mt-1",children:a})]})]}),e.jsx("p",{className:"text-sm font-medium text-gray-400 mt-3",children:"Test Health Score"})]})}function _({icon:t,label:c,score:r,description:l}){const x=M(Math.round(r)),h=Y(x),d=J(x);return e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(t,{className:"w-4 h-4 text-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-gray-200",children:c})]}),e.jsx("span",{className:`text-lg font-bold ${h}`,children:x})]}),e.jsx(R,{value:x,color:d,className:"mb-2"}),e.jsx("p",{className:"text-xs text-gray-500",children:l})]})}function we({data:t}){const c=Object.values(t).reduce((r,l)=>r+l,0);return c===0?e.jsx("div",{className:"h-6 rounded-full bg-white/5"}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-6 rounded-full bg-white/5 overflow-hidden flex",children:Object.entries(t).map(([r,l])=>{const x=l/c*100;if(x===0)return null;const h=I[r]||"bg-gray-500";return e.jsx("div",{className:`h-full ${h} transition-all duration-500`,style:{width:`${x}%`},title:`${A(r)}: ${l} (${x.toFixed(1)}%)`},r)})}),e.jsx("div",{className:"flex flex-wrap gap-4",children:Object.entries(t).map(([r,l])=>{const x=c>0?(l/c*100).toFixed(1):"0",h=be[r]||"text-gray-400",d=I[r]||"bg-gray-500";return e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${d}`}),e.jsx("span",{className:h,children:A(r)}),e.jsxs("span",{className:"text-gray-500",children:[l," (",x,"%)"]})]},r)})})]})}function ke({priority:t,total:c,passed:r,failed:l}){const x=je[t]||"bg-gray-500/20 text-gray-300",h=c>0?(r/c*100).toFixed(1):"0",d=c>0?(l/c*100).toFixed(1):"0";return e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${x}`,children:A(t)}),e.jsxs("span",{className:"text-sm text-gray-400",children:[c," total"]})]}),e.jsxs("div",{className:"flex gap-4 mb-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[e.jsx("span",{className:"text-emerald-400",children:"Passed"}),e.jsxs("span",{className:"text-gray-400",children:[r," (",h,"%)"]})]}),e.jsx(R,{value:c>0?r/c*100:0,color:"bg-emerald-500"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[e.jsx("span",{className:"text-red-400",children:"Failed"}),e.jsxs("span",{className:"text-gray-400",children:[l," (",d,"%)"]})]}),e.jsx(R,{value:c>0?l/c*100:0,color:"bg-red-500"})]})]})]})}function Ce(){const{data:t,isLoading:c,error:r,refetch:l}=ae(),{data:x,isLoading:h}=re();if(c||h)return e.jsx(L,{});if(r)return e.jsx(K,{message:"Failed to load health data"});const a=t||{},g=x||{},p=a.healthScore??a.overallScore??a.overall??a.score??0,v=a.automationCoverage??a.automation_coverage??g.automationCoverage??0,j=a.requirementCoverage??a.requirement_coverage??g.requirementCoverage??0,N=a.executionFreshness??a.execution_freshness??0,k=a.qualityAverage??a.qualityScore??a.quality_score??0,b=a.syncHealth??a.sync_health??0,n=a.staleTestCases??a.stale_test_cases??0,s=a.recentlyUpdated??a.recently_updated??0,u=g.totalTestCases??a.totalTestCases??a.total_test_cases??0,o=g.automatedTestCases??a.automatedCount??a.automated_count??0;return e.jsxs("div",{className:"space-y-8",children:[e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{onClick:()=>l(),className:"flex items-center gap-2 text-xs text-gray-400 hover:text-gray-200 transition-colors",children:[e.jsx(H,{className:"w-3.5 h-3.5"}),"Refresh"]})}),e.jsx("div",{className:"flex justify-center",children:e.jsx(ve,{score:p})}),e.jsx("div",{className:"text-center",children:e.jsxs("p",{className:"text-lg text-gray-400",children:[e.jsx("span",{className:"text-gray-200 font-semibold",children:u})," Test Cases"," ","·"," ",e.jsx("span",{className:"text-gray-200 font-semibold",children:o})," Automated"]})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Health Breakdown"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-4",children:[e.jsx(_,{icon:X,label:"Automation Coverage",score:v,description:"Percentage of test cases with automation scripts"}),e.jsx(_,{icon:oe,label:"Requirement Coverage",score:j,description:"Requirements with linked test cases"}),e.jsx(_,{icon:B,label:"Execution Freshness",score:N,description:"How recently tests have been executed"}),e.jsx(_,{icon:P,label:"Quality Score",score:k,description:"Average quality across test executions"}),e.jsx(_,{icon:H,label:"Sync Health",score:b,description:"Script mappings and automation sync status"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Activity Indicators"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-lg bg-amber-500/15",children:e.jsx(O,{className:"w-5 h-5 text-amber-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"Stale Test Cases"}),e.jsx("p",{className:"text-xs text-gray-500",children:">30 days without update"})]}),e.jsx("span",{className:"text-2xl font-bold text-amber-400",children:n})]}),n>0&&u>0&&e.jsxs("div",{className:"mt-3",children:[e.jsx(R,{value:n/u*100,color:"bg-amber-500"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:[(n/u*100).toFixed(1),"% of total test cases"]})]})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-lg bg-emerald-500/15",children:e.jsx(P,{className:"w-5 h-5 text-emerald-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"Recently Updated"}),e.jsx("p",{className:"text-xs text-gray-500",children:"<7 days since last update"})]}),e.jsx("span",{className:"text-2xl font-bold text-emerald-400",children:s})]}),s>0&&u>0&&e.jsxs("div",{className:"mt-3",children:[e.jsx(R,{value:s/u*100,color:"bg-emerald-500"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:[(s/u*100).toFixed(1),"% of total test cases"]})]})]})]})]})]})}function Te(){const{data:t,isLoading:c,error:r,refetch:l}=le(),[x,h]=E.useState(null);if(c)return e.jsx(L,{});if(r)return e.jsx(K,{message:"Failed to load execution analytics"});const d=t||{},a=d.totalExecutions??d.total_executions??0,g=d.passRate??d.pass_rate??0,p=d.failRate??d.fail_rate??0,v=d.avgDuration??d.avg_duration??0,j=d.byStatus??d.by_status??{},N=d.byPriority??d.by_priority??{},k=d.byCycle??d.cycles??d.cycleHistory??d.cycle_history??[],b=d.recentExecutions??d.trends??d.executionTrend??d.execution_trend??[],n=d.flakyTests??d.flaky_tests??[];return e.jsxs("div",{className:"space-y-8",children:[e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{onClick:()=>l(),className:"flex items-center gap-2 text-xs text-gray-400 hover:text-gray-200 transition-colors",children:[e.jsx(H,{className:"w-3.5 h-3.5"}),"Refresh"]})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx(S,{icon:W,label:"Total Executions",value:a.toLocaleString(),color:"bg-brand-500/15"}),e.jsx(S,{icon:P,label:"Pass Rate",value:`${typeof g=="number"?g.toFixed(1):g}%`,color:"bg-emerald-500/15"}),e.jsx(S,{icon:xe,label:"Fail Rate",value:`${typeof p=="number"?p.toFixed(1):p}%`,color:"bg-red-500/15"}),e.jsx(S,{icon:B,label:"Avg Duration",value:fe(v),color:"bg-sky-500/15"})]}),Object.keys(j).length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Status Distribution"}),e.jsx("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:e.jsx(we,{data:j})})]}),Object.keys(N).length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Priority Breakdown"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:["critical","high","medium","low"].map(s=>{const u=N[s]||{},o=u.total??u.count??0,f=u.passed??0,y=u.failed??0;return o===0?null:e.jsx(ke,{priority:s,total:o,passed:f,failed:y},s)})})]}),Array.isArray(k)&&k.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Cycle History"}),e.jsx("div",{className:"bg-surface-1 rounded-xl border border-white/5 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-white/5",children:[e.jsx("th",{className:"text-left px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Cycle"}),e.jsx("th",{className:"text-left px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Plan"}),e.jsx("th",{className:"text-center px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Total"}),e.jsx("th",{className:"text-center px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Passed"}),e.jsx("th",{className:"text-center px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Failed"}),e.jsx("th",{className:"text-center px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Pass Rate"})]})}),e.jsx("tbody",{children:k.map((s,u)=>{const o=s.total??0,f=s.passed??0,y=s.failed??0,w=o>0?f/o*100:0,T=s.id||s._id||`cycle-${u}`,$=x===T,i=s.blocked??0,m=s.skipped??0,C=o-f-y-i-m;return e.jsxs(Z.Fragment,{children:[e.jsxs("tr",{className:"border-b border-white/5 last:border-0 hover:bg-white/[0.02] transition-colors cursor-pointer",onClick:()=>h($?null:T),children:[e.jsx("td",{className:"px-4 py-3 text-gray-200 font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[$?e.jsx(me,{className:"w-3.5 h-3.5 text-gray-500"}):e.jsx(he,{className:"w-3.5 h-3.5 text-gray-500"}),s.cycleName||s.cycle_name||s.name||"Unnamed Cycle"]})}),e.jsx("td",{className:"px-4 py-3 text-gray-400",children:s.planName||s.plan_name||"-"}),e.jsx("td",{className:"px-4 py-3 text-center text-gray-300",children:o}),e.jsx("td",{className:"px-4 py-3 text-center text-emerald-400",children:f}),e.jsx("td",{className:"px-4 py-3 text-center text-red-400",children:y}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsxs("span",{className:`font-medium ${w>=75?"text-emerald-400":w>=50?"text-amber-400":"text-red-400"}`,children:[w.toFixed(1),"%"]})})]}),$&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"bg-surface-2/50 px-6 py-4 border-b border-white/5",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"text-xs text-gray-500 w-20",children:"Distribution"}),e.jsxs("div",{className:"flex-1 h-4 rounded-full bg-white/5 overflow-hidden flex",children:[f>0&&e.jsx("div",{className:"h-full bg-emerald-500",style:{width:`${f/o*100}%`},title:`Passed: ${f}`}),y>0&&e.jsx("div",{className:"h-full bg-red-500",style:{width:`${y/o*100}%`},title:`Failed: ${y}`}),i>0&&e.jsx("div",{className:"h-full bg-amber-500",style:{width:`${i/o*100}%`},title:`Blocked: ${i}`}),m>0&&e.jsx("div",{className:"h-full bg-gray-500",style:{width:`${m/o*100}%`},title:`Skipped: ${m}`}),C>0&&e.jsx("div",{className:"h-full bg-sky-500",style:{width:`${C/o*100}%`},title:`In Progress: ${C}`})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-xs",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-500"})," Passed: ",e.jsx("strong",{className:"text-emerald-400",children:f})," (",o>0?(f/o*100).toFixed(1):0,"%)"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"})," Failed: ",e.jsx("strong",{className:"text-red-400",children:y})," (",o>0?(y/o*100).toFixed(1):0,"%)"]}),i>0&&e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500"})," Blocked: ",e.jsx("strong",{className:"text-amber-400",children:i})]}),m>0&&e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-500"})," Skipped: ",e.jsx("strong",{className:"text-gray-400",children:m})]}),s.passRate!==void 0&&e.jsxs("span",{className:"text-gray-500",children:["| Pass Rate: ",e.jsxs("strong",{className:w>=75?"text-emerald-400":w>=50?"text-amber-400":"text-red-400",children:[w.toFixed(1),"%"]})]})]})]})})})]},T)})})]})})})]}),Array.isArray(b)&&b.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Execution Trend"}),e.jsx("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:(()=>{const s=[...b].sort((o,f)=>String(o.date||o.day||"").localeCompare(String(f.date||f.day||""))).slice(-14),u=Math.max(...s.map(o=>o.total??0),1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex items-end gap-1 h-36",children:s.map((o,f)=>{const y=o.total??0,w=o.passed??0,T=o.failed??0,$=y-w-T,i=y/u*100,m=o.date||o.day||"";return e.jsxs("div",{className:"flex-1 h-full flex flex-col items-center justify-end group relative",children:[e.jsxs("div",{className:"absolute -top-10 bg-surface-2 border border-white/10 rounded px-2 py-1 text-xs text-gray-300 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-10 pointer-events-none",children:[q(m),": ",y," total (",w,"P / ",T,"F)"]}),e.jsx("div",{className:"flex-1 w-full flex flex-col justify-end",children:e.jsxs("div",{className:"w-full rounded-t overflow-hidden flex flex-col justify-end",style:{height:`${i}%`,minHeight:y>0?"4px":"0"},children:[w>0&&e.jsx("div",{className:"bg-emerald-500",style:{flex:w}}),T>0&&e.jsx("div",{className:"bg-red-500",style:{flex:T}}),$>0&&e.jsx("div",{className:"bg-gray-500",style:{flex:$}})]})}),f%2===0&&e.jsx("span",{className:"text-[9px] text-gray-600 mt-1",children:(m||"").toString().slice(5)})]},f)})}),e.jsxs("div",{className:"flex items-center gap-4 mt-3 text-xs",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-500"})," Passed"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"})," Failed"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-500"})," Other"]}),e.jsxs("span",{className:"ml-auto text-gray-500",children:["Last ",s.length," day",s.length===1?"":"s"]})]})]})})()})]}),Array.isArray(n)&&n.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Unstable Tests"}),e.jsx("div",{className:"bg-surface-1 rounded-xl border border-white/5 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-white/5",children:[e.jsx("th",{className:"text-left px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Test Title"}),e.jsx("th",{className:"text-center px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Fail Rate"}),e.jsx("th",{className:"text-center px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Passed"}),e.jsx("th",{className:"text-center px-4 py-3 text-gray-400 font-medium text-xs uppercase tracking-wider",children:"Failed"})]})}),e.jsx("tbody",{children:[...n].sort((s,u)=>(u.flakyScore??u.flaky_score??0)-(s.flakyScore??s.flaky_score??0)).map((s,u)=>{const o=s.flakyScore??s.flaky_score??0,f=s.passCount??s.pass_count??s.passed??0,y=s.failCount??s.fail_count??s.failed??0,w=s.title??s.testTitle??s.test_title??"Unknown",T=o>=60?"text-red-400":o>=30?"text-amber-400":"text-gray-400",$=o>=60?"bg-red-500":o>=30?"bg-amber-500":"bg-gray-500";return e.jsxs("tr",{className:"border-b border-white/5 last:border-0 hover:bg-white/[0.02]",children:[e.jsx("td",{className:"px-4 py-3 text-gray-200 max-w-xs truncate",children:w}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("div",{className:"w-20 h-2 rounded-full bg-white/5 overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full ${$}`,style:{width:`${M(o)}%`}})}),e.jsxs("span",{className:`text-xs font-medium ${T}`,children:[o.toFixed(0),"%"]})]})}),e.jsx("td",{className:"px-4 py-3 text-center text-emerald-400",children:f}),e.jsx("td",{className:"px-4 py-3 text-center text-red-400",children:y})]},s.id||s._id||u)})})]})})})]}),a===0&&Object.keys(j).length===0&&e.jsx(U,{message:"No execution data available yet. Run some test cycles to see analytics."})]})}function Se(){const{data:t,isLoading:c}=ie();if(c)return e.jsx(L,{});const r=Array.isArray(t)?t:(t==null?void 0:t.defects)??[];if(r.length===0)return e.jsx(U,{message:"No defects found. Create defects in Integrations to see analytics."});const l={},x={},h={};let d=0,a=0,g=0,p=0;for(const n of r)l[n.severity||"unknown"]=(l[n.severity||"unknown"]||0)+1,x[n.status||"open"]=(x[n.status||"open"]||0)+1,h[n.priority||"medium"]=(h[n.priority||"medium"]||0)+1,["open","in_progress","reopened"].includes(n.status)&&d++,["closed","resolved","verified"].includes(n.status)&&a++,n.resolvedAt&&n.createdAt&&(g+=new Date(n.resolvedAt).getTime()-new Date(n.createdAt).getTime(),p++);const v=p>0?Math.round(g/p/36e5):0,j={};for(const n of r){const s=n.createdAt?new Date(n.createdAt).toISOString().slice(0,10):"";s&&(j[s]||(j[s]={total:0,open:0,closed:0}),j[s].total++,["open","in_progress","reopened"].includes(n.status)?j[s].open++:j[s].closed++)}const N=Object.entries(j).sort(([n],[s])=>n.localeCompare(s)).slice(-14),k={critical:"bg-red-500",blocker:"bg-red-600",high:"bg-orange-500",medium:"bg-amber-500",low:"bg-emerald-500",unknown:"bg-gray-500"},b={open:"bg-sky-500",in_progress:"bg-amber-500",resolved:"bg-emerald-500",closed:"bg-gray-500",verified:"bg-emerald-600",reopened:"bg-red-500",rejected:"bg-gray-600",deferred:"bg-violet-500"};return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx(S,{icon:Q,label:"Total Defects",value:r.length,color:"bg-red-500/15"}),e.jsx(S,{icon:O,label:"Open Defects",value:d,sub:`${r.length>0?(d/r.length*100).toFixed(1):0}% of total`,color:"bg-amber-500/15"}),e.jsx(S,{icon:P,label:"Closed/Resolved",value:a,sub:`${r.length>0?(a/r.length*100).toFixed(1):0}% of total`,color:"bg-emerald-500/15"}),e.jsx(S,{icon:B,label:"Avg Resolution Time",value:v>0?`${v}h`:"-",sub:p>0?`Based on ${p} resolved defects`:"No resolved defects yet",color:"bg-sky-500/15"})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsx("h4",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Severity Distribution"}),e.jsx("div",{className:"space-y-3",children:["critical","blocker","high","medium","low"].filter(n=>l[n]).map(n=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-gray-400 w-16 capitalize",children:n}),e.jsx("div",{className:"flex-1 h-5 rounded bg-white/5 overflow-hidden",children:e.jsx("div",{className:`h-full ${k[n]||"bg-gray-500"} rounded`,style:{width:`${l[n]/r.length*100}%`}})}),e.jsx("span",{className:"text-xs text-gray-300 w-8 text-right font-medium",children:l[n]}),e.jsxs("span",{className:"text-xs text-gray-500 w-12 text-right",children:[(l[n]/r.length*100).toFixed(0),"%"]})]},n))})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsx("h4",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Status Distribution"}),e.jsx("div",{className:"space-y-3",children:Object.entries(x).sort(([,n],[,s])=>s-n).map(([n,s])=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-gray-400 w-20 capitalize",children:A(n)}),e.jsx("div",{className:"flex-1 h-5 rounded bg-white/5 overflow-hidden",children:e.jsx("div",{className:`h-full ${b[n]||"bg-gray-500"} rounded`,style:{width:`${s/r.length*100}%`}})}),e.jsx("span",{className:"text-xs text-gray-300 w-8 text-right font-medium",children:s}),e.jsxs("span",{className:"text-xs text-gray-500 w-12 text-right",children:[(s/r.length*100).toFixed(0),"%"]})]},n))})]})]}),N.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Defect Creation Trend"}),e.jsx("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:e.jsx("div",{className:"flex items-end gap-1 h-32",children:N.map(([n,s],u)=>{const o=Math.max(...N.map(([,y])=>y.total),1),f=s.total/o*100;return e.jsxs("div",{className:"flex-1 h-full flex flex-col items-center justify-end gap-1 group relative",children:[e.jsxs("div",{className:"absolute -top-8 bg-surface-2 border border-white/10 rounded px-2 py-1 text-xs text-gray-300 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-10 pointer-events-none",children:[q(n),": ",s.total," (",s.open," open, ",s.closed," closed)"]}),e.jsx("span",{className:"text-[10px] text-gray-500 opacity-0 group-hover:opacity-100",children:s.total}),e.jsx("div",{className:"flex-1 w-full flex flex-col justify-end",children:e.jsx("div",{className:"w-full rounded-t overflow-hidden flex flex-col justify-end",style:{height:`${f}%`,minHeight:s.total>0?"4px":"0"},children:e.jsx("div",{className:"bg-sky-500/70 flex-1"})})}),u%2===0&&e.jsx("span",{className:"text-[9px] text-gray-600 mt-1",children:n.slice(5)})]},u)})})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Priority Breakdown"}),e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:["critical","high","medium","low"].map(n=>{const s=h[n]||0,u=r.length>0?(s/r.length*100).toFixed(1):"0",o={critical:"text-red-400",high:"text-orange-400",medium:"text-amber-400",low:"text-emerald-400"};return e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4 text-center",children:[e.jsx("p",{className:"text-xs text-gray-500 uppercase mb-1",children:n}),e.jsx("p",{className:`text-2xl font-bold ${o[n]||"text-gray-300"}`,children:s}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:[u,"%"]})]},n)})})]})]})}function $e(){var o,f,y,w,T,$;const{data:t,isLoading:c}=ne({limit:1e5});if(c)return e.jsx(L,{});const r=Array.isArray(t)?t:(t==null?void 0:t.testCases)??[],l=r.length;if(l===0)return e.jsx(U,{message:"No test cases found. Create test cases in Test Management to see Test Cases overview."});const x={},h={},d={},a={};let g=0,p=0;const v={};for(const i of r){x[i.status||"draft"]=(x[i.status||"draft"]||0)+1,h[i.priority||"medium"]=(h[i.priority||"medium"]||0)+1,d[i.type||"manual"]=(d[i.type||"manual"]||0)+1;const m=i.automationStatus||i.automation_status||"manual";a[m]=(a[m]||0)+1;const C=i.steps?typeof i.steps=="string"?JSON.parse(i.steps):i.steps:[];if(Array.isArray(C)&&C.length>0?g++:p++,i.createdAt){const F=new Date(i.createdAt).toISOString().slice(0,10);v[F]=(v[F]||0)+1}}const j=Object.entries(v).sort(([i],[m])=>i.localeCompare(m));let N=0;const b=j.map(([i,m])=>(N+=m,{day:i,count:m,cumulative:N})).slice(-30),n=b.length>0?b[b.length-1].cumulative:0,s=a.automated??0,u=l>0?(s/l*100).toFixed(1):"0";return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-4",children:[e.jsx(S,{icon:ge,label:"Total Test Cases",value:l,color:"bg-brand-500/15"}),e.jsx(S,{icon:X,label:"Automated",value:s,sub:`${u}% automation`,color:"bg-violet-500/15"}),e.jsx(S,{icon:P,label:"With Steps",value:g,sub:`${l>0?(g/l*100).toFixed(0):0}% complete`,color:"bg-emerald-500/15"}),e.jsx(S,{icon:O,label:"Without Steps",value:p,sub:"Need step definitions",color:"bg-amber-500/15"}),e.jsx(S,{icon:V,label:"Types",value:Object.keys(d).length,sub:Object.entries(d).map(([i,m])=>`${A(i)}: ${m}`).join(", "),color:"bg-sky-500/15"})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsx("h4",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Status Distribution"}),e.jsx("div",{className:"space-y-3",children:Object.entries(x).sort(([,i],[,m])=>m-i).map(([i,m])=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-gray-400 w-20 capitalize",children:A(i)}),e.jsx("div",{className:"flex-1 h-5 rounded bg-white/5 overflow-hidden",children:e.jsx("div",{className:"h-full bg-brand-500 rounded",style:{width:`${m/l*100}%`}})}),e.jsx("span",{className:"text-xs text-gray-300 w-8 text-right font-medium",children:m})]},i))})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsx("h4",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Priority Distribution"}),e.jsx("div",{className:"space-y-3",children:["critical","high","medium","low"].filter(i=>h[i]).map(i=>{const m=h[i],C={critical:"bg-red-500",high:"bg-orange-500",medium:"bg-amber-500",low:"bg-emerald-500"};return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-gray-400 w-16 capitalize",children:i}),e.jsx("div",{className:"flex-1 h-5 rounded bg-white/5 overflow-hidden",children:e.jsx("div",{className:`h-full ${C[i]} rounded`,style:{width:`${m/l*100}%`}})}),e.jsx("span",{className:"text-xs text-gray-300 w-8 text-right font-medium",children:m}),e.jsxs("span",{className:"text-xs text-gray-500 w-12 text-right",children:[(m/l*100).toFixed(0),"%"]})]},i)})})]})]}),b.length>0&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:["Test Case Growth ",e.jsx("span",{className:"text-gray-500 font-normal",children:"(Last 30 days)"})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsx("div",{className:"flex items-end gap-0.5 h-40",children:b.map((i,m)=>{const C=n>0?i.cumulative/n*100:0;return e.jsxs("div",{className:"flex-1 h-full flex flex-col items-center justify-end group relative",children:[e.jsxs("div",{className:"absolute -top-10 bg-surface-2 border border-white/10 rounded px-2 py-1 text-xs text-gray-300 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap z-10 pointer-events-none",children:[q(i.day),": +",i.count," (Total: ",i.cumulative,")"]}),e.jsx("div",{className:"flex-1 w-full flex flex-col justify-end",children:e.jsx("div",{className:"w-full bg-gradient-to-t from-brand-600/80 to-brand-400/60 rounded-t transition-all duration-300 group-hover:from-brand-500 group-hover:to-brand-300",style:{height:`${C}%`,minHeight:"2px"}})}),m%5===0&&e.jsx("span",{className:"text-[9px] text-gray-600 mt-1",children:i.day.slice(5)})]},m)})}),e.jsxs("div",{className:"flex items-center justify-between mt-3 text-xs text-gray-500",children:[e.jsxs("span",{children:["Started: ",(((o=b[0])==null?void 0:o.cumulative)??0)-(((f=b[0])==null?void 0:f.count)??0)," test cases"]}),e.jsxs("span",{children:["Current: ",(y=b[b.length-1])==null?void 0:y.cumulative," test cases"]}),e.jsxs("span",{className:"text-emerald-400",children:["+",(((w=b[b.length-1])==null?void 0:w.cumulative)??0)-((((T=b[0])==null?void 0:T.cumulative)??0)-((($=b[0])==null?void 0:$.count)??0))," new"]})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 uppercase tracking-wider mb-4",children:"Automation Status"}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsx("div",{className:"h-6 rounded-full bg-white/5 overflow-hidden flex mb-3",children:Object.entries(a).map(([i,m])=>{const C=m/l*100;if(C===0)return null;const F={automated:"bg-emerald-500",manual:"bg-gray-500",in_progress:"bg-amber-500",planned:"bg-sky-500"};return e.jsx("div",{className:`h-full ${F[i]||"bg-gray-500"}`,style:{width:`${C}%`},title:`${A(i)}: ${m}`},i)})}),e.jsx("div",{className:"flex flex-wrap gap-4",children:Object.entries(a).map(([i,m])=>{const C={automated:"text-emerald-400",manual:"text-gray-400",in_progress:"text-amber-400",planned:"text-sky-400"},F={automated:"bg-emerald-500",manual:"bg-gray-500",in_progress:"bg-amber-500",planned:"bg-sky-500"};return e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${F[i]||"bg-gray-500"}`}),e.jsx("span",{className:C[i]||"text-gray-400",children:A(i)}),e.jsxs("span",{className:"text-gray-500",children:[m," (",(m/l*100).toFixed(1),"%)"]})]},i)})})]})]})]})}function Ae(){const{data:t,isLoading:c}=ee({queryKey:["tm-automation-usage"],queryFn:ce}),r=E.useMemo(()=>{const a=(t==null?void 0:t.cycles)||[];return Array.isArray(a)?a:[]},[t]),l=E.useMemo(()=>{let a=0,g=0,p=0,v=0,j=0,N=0,k=0,b=0;for(const s of r)a+=s.manual.total,g+=s.manual.passed,p+=s.manual.failed,v+=s.manual.duration,j+=s.automated.total,N+=s.automated.passed,k+=s.automated.failed,b+=s.automated.duration;const n=a+j;return{manualTotal:a,manualPassed:g,manualFailed:p,manualDuration:v,autoTotal:j,autoPassed:N,autoFailed:k,autoDuration:b,grandTotal:n}},[r]);if(c)return e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(ue,{className:"w-6 h-6 animate-spin text-brand-400"})});if(r.length===0)return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[e.jsx(D,{className:"w-12 h-12 text-gray-600 mb-3"}),e.jsx("h3",{className:"text-gray-300 font-medium",children:"No Cycle Executions Yet"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Execute test cycles to see automation usage statistics"})]});const x=l.grandTotal>0?Math.round(l.autoTotal/l.grandTotal*100):0,h=100-x,d=a=>a>6e4?`${(a/6e4).toFixed(1)}m`:a>0?`${(a/1e3).toFixed(1)}s`:"—";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4",children:[e.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"Total Executions"}),e.jsx("div",{className:"text-2xl font-bold text-gray-100",children:l.grandTotal}),e.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:["Across ",r.length," cycle",r.length!==1?"s":""]})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500 mb-1",children:[e.jsx(D,{size:12})," Automated"]}),e.jsx("div",{className:"text-2xl font-bold text-emerald-300",children:l.autoTotal}),e.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:[x,"% of total · Pass: ",l.autoTotal>0?Math.round(l.autoPassed/l.autoTotal*100):0,"%"]})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500 mb-1",children:[e.jsx(z,{size:12})," Manual"]}),e.jsx("div",{className:"text-2xl font-bold text-amber-300",children:l.manualTotal}),e.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:[h,"% of total · Pass: ",l.manualTotal>0?Math.round(l.manualPassed/l.manualTotal*100):0,"%"]})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4",children:[e.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"Automation Rate"}),e.jsxs("div",{className:"text-2xl font-bold text-emerald-300",children:[x,"%"]}),e.jsx("div",{className:"w-full bg-gray-700/50 rounded-full h-2 mt-2",children:e.jsx("div",{className:"bg-emerald-400 h-2 rounded-full transition-all",style:{width:`${x}%`}})})]})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-200 mb-3",children:"Overall Manual vs Automated Split"}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsx("div",{className:"flex-1",children:e.jsxs("div",{className:"flex h-8 rounded-lg overflow-hidden",children:[x>0&&e.jsx("div",{className:"bg-emerald-500/60 flex items-center justify-center text-xs font-medium text-white transition-all",style:{width:`${x}%`},children:x>10&&`${x}% Auto`}),h>0&&e.jsx("div",{className:"bg-amber-500/50 flex items-center justify-center text-xs font-medium text-white transition-all",style:{width:`${h}%`},children:h>10&&`${h}% Manual`})]})})}),e.jsxs("div",{className:"flex items-center gap-4 mt-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-400",children:[e.jsx("div",{className:"w-3 h-3 rounded bg-emerald-500/60"})," Automated (",l.autoTotal,")"]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-400",children:[e.jsx("div",{className:"w-3 h-3 rounded bg-amber-500/50"})," Manual (",l.manualTotal,")"]})]})]}),e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 overflow-hidden",children:[e.jsx("div",{className:"px-5 py-4 border-b border-white/5",children:e.jsx("h3",{className:"text-sm font-semibold text-gray-200",children:"Per-Cycle Breakdown"})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsxs("thead",{children:[e.jsxs("tr",{className:"border-b border-white/5 text-xs text-gray-500 uppercase tracking-wider",children:[e.jsx("th",{className:"text-left px-5 py-3 font-medium",children:"Plan / Cycle"}),e.jsx("th",{className:"text-center px-3 py-3 font-medium",colSpan:5,children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(z,{size:11})," Manual"]})}),e.jsx("th",{className:"text-center px-3 py-3 font-medium",colSpan:5,children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(D,{size:11})," Automated"]})}),e.jsx("th",{className:"text-center px-3 py-3 font-medium",children:"Split"})]}),e.jsxs("tr",{className:"border-b border-white/5 text-[10px] text-gray-600 uppercase",children:[e.jsx("th",{className:"px-5 py-1.5"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Total"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Pass"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Fail"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Rate"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Time"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Total"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Pass"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Fail"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Rate"}),e.jsx("th",{className:"text-center px-2 py-1.5",children:"Time"}),e.jsx("th",{className:"text-center px-2 py-1.5"})]})]}),e.jsx("tbody",{children:r.map(a=>{const g=a.manual.total,p=a.automated.total,v=g+p,j=v>0?Math.round(p/v*100):0,N=g>0?Math.round(a.manual.passed/g*100):0,k=p>0?Math.round(a.automated.passed/p*100):0;return e.jsxs("tr",{className:"border-b border-white/5 hover:bg-white/[0.02] transition-colors",children:[e.jsxs("td",{className:"px-5 py-3",children:[e.jsx("div",{className:"text-xs font-medium text-gray-200",children:a.planName}),e.jsx("div",{className:"text-[10px] text-gray-500",children:a.cycleName})]}),e.jsx("td",{className:"text-center px-2 py-3 text-xs text-gray-300",children:g||"—"}),e.jsx("td",{className:"text-center px-2 py-3 text-xs text-emerald-400",children:a.manual.passed||"—"}),e.jsx("td",{className:"text-center px-2 py-3 text-xs text-red-400",children:a.manual.failed||"—"}),e.jsx("td",{className:"text-center px-2 py-3",children:g>0?e.jsxs("span",{className:`text-xs font-medium ${N>=80?"text-emerald-400":N>=50?"text-amber-400":"text-red-400"}`,children:[N,"%"]}):e.jsx("span",{className:"text-xs text-gray-600",children:"—"})}),e.jsx("td",{className:"text-center px-2 py-3 text-[10px] text-gray-500",children:d(a.manual.duration)}),e.jsx("td",{className:"text-center px-2 py-3 text-xs text-emerald-300 font-medium",children:p||"—"}),e.jsx("td",{className:"text-center px-2 py-3 text-xs text-emerald-400",children:a.automated.passed||"—"}),e.jsx("td",{className:"text-center px-2 py-3 text-xs text-red-400",children:a.automated.failed||"—"}),e.jsx("td",{className:"text-center px-2 py-3",children:p>0?e.jsxs("span",{className:`text-xs font-medium ${k>=80?"text-emerald-400":k>=50?"text-amber-400":"text-red-400"}`,children:[k,"%"]}):e.jsx("span",{className:"text-xs text-gray-600",children:"—"})}),e.jsx("td",{className:"text-center px-2 py-3 text-[10px] text-gray-500",children:d(a.automated.duration)}),e.jsx("td",{className:"px-3 py-3",children:v>0?e.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[e.jsxs("div",{className:"flex h-2 w-16 rounded-full overflow-hidden bg-gray-700/50",children:[j>0&&e.jsx("div",{className:"bg-emerald-400 h-full",style:{width:`${j}%`}}),100-j>0&&e.jsx("div",{className:"bg-amber-400/60 h-full",style:{width:`${100-j}%`}})]}),e.jsxs("span",{className:"text-[10px] text-gray-500 w-8",children:[j,"%"]})]}):e.jsx("span",{className:"text-xs text-gray-600",children:"—"})})]},a.cycleId)})})]})})]})]})}function Le(){const[t,c]=se("tab",["health","analytics","automation","defects","cases"],"health");return e.jsxs("div",{className:"min-h-screen bg-surface-0 text-gray-200",children:[e.jsx("div",{className:"border-b border-white/5 bg-surface-1",children:e.jsx("div",{className:"max-w-[1400px] mx-auto px-6 py-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-100 flex items-center gap-3",children:[e.jsx(G,{size:24,className:"text-brand-300"}),"Analytics & Reports"]}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"Test health dashboard, execution analytics, and AI-generated reports"})]}),e.jsx(te,{type:"analytics",formats:["pdf"],label:"Export Report"})]})})}),e.jsx("div",{className:"border-b border-white/5 bg-surface-1",children:e.jsx("div",{className:"max-w-[1400px] mx-auto px-6 flex gap-1",children:pe.map(r=>{const l=r.icon,x=t===r.key;return e.jsxs("button",{onClick:()=>c(r.key),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium border-b-2 transition-colors ${x?"border-brand-400 text-brand-300":"border-transparent text-gray-400 hover:text-gray-200 hover:border-white/10"}`,children:[e.jsx(l,{size:16}),r.label]},r.key)})})}),e.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 py-8",children:[t==="health"&&e.jsx(Ce,{}),t==="analytics"&&e.jsx(Te,{}),t==="automation"&&e.jsx(Ae,{}),t==="defects"&&e.jsx(Se,{}),t==="cases"&&e.jsx($e,{})]})]})}export{Le as AnalyticsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as j,j as e}from"./vendor-react-CTbHBddL.js";import{f as R}from"./formatDate-T65-Y6Mi.js";import{u as w}from"./vendor-query-BrzmPFT3.js";import{fy as P,fF as M,fG as q,fH as D}from"./index-BYVxKLrT.js";import{i as A,a5 as J,y as $,t as F,ce as G,h as f,S as z,aZ as S,ab as L,l as u,a2 as K,d8 as k,aC as o,z as B,ai as H}from"./vendor-icons-BKPiFyYV.js";const O={"auth.login":{icon:e.jsx(H,{size:14}),color:"text-emerald-400"},"auth.logout":{icon:e.jsx(B,{size:14}),color:"text-gray-400"},"auth.login_failed":{icon:e.jsx(u,{size:14}),color:"text-red-400"},"auth.password_change":{icon:e.jsx(o,{size:14}),color:"text-amber-400"},"auth.setup":{icon:e.jsx(o,{size:14}),color:"text-brand-400"},"auth.2fa_enabled":{icon:e.jsx(o,{size:14}),color:"text-emerald-400"},"auth.2fa_disabled":{icon:e.jsx(o,{size:14}),color:"text-amber-400"},"auth.2fa_failed":{icon:e.jsx(u,{size:14}),color:"text-red-400"},"auth.2fa_recovery_used":{icon:e.jsx(o,{size:14}),color:"text-amber-400"},"user.2fa_reset":{icon:e.jsx(o,{size:14}),color:"text-amber-400"},"user.create":{icon:e.jsx(k,{size:14}),color:"text-brand-400"},"user.update":{icon:e.jsx(f,{size:14}),color:"text-sky-400"},"user.delete":{icon:e.jsx(u,{size:14}),color:"text-red-400"},"user.role_change":{icon:e.jsx(o,{size:14}),color:"text-amber-400"},"user.disable":{icon:e.jsx(u,{size:14}),color:"text-red-400"},"user.enable":{icon:e.jsx(k,{size:14}),color:"text-emerald-400"},"run.start":{icon:e.jsx(K,{size:14}),color:"text-emerald-400"},"run.cancel":{icon:e.jsx(u,{size:14}),color:"text-amber-400"},"file.create":{icon:e.jsx(L,{size:14}),color:"text-sky-400"},"file.update":{icon:e.jsx(L,{size:14}),color:"text-sky-400"},"file.delete":{icon:e.jsx(L,{size:14}),color:"text-red-400"},"git.commit":{icon:e.jsx(S,{size:14}),color:"text-emerald-400"},"git.push":{icon:e.jsx(S,{size:14}),color:"text-brand-400"},"git.pull":{icon:e.jsx(S,{size:14}),color:"text-sky-400"},"ai.generate":{icon:e.jsx(z,{size:14}),color:"text-purple-400"},"ai.fix":{icon:e.jsx(z,{size:14}),color:"text-purple-400"},"ai.chat":{icon:e.jsx(z,{size:14}),color:"text-purple-400"}};function Z(t){return O[t]?O[t]:t.startsWith("settings.")?/_(delete|remove|disconnect|reset)$/.test(t)?{icon:e.jsx(f,{size:14}),color:"text-red-400"}:{icon:e.jsx(f,{size:14}),color:"text-sky-400"}:{icon:e.jsx(f,{size:14}),color:"text-gray-400"}}const h=50,Q=[{value:"",label:"All Actions"},{value:"auth.*",label:"Authentication"},{value:"user.*",label:"User Management"},{value:"run.*",label:"Test Runs"},{value:"file.*",label:"File Operations"},{value:"git.*",label:"Git Operations"},{value:"ai.*",label:"AI Actions"},{value:"settings.*",label:"Settings"}];function le(){const[t,a]=j.useState(0),[i,r]=j.useState(""),[l,y]=j.useState(""),[T,_]=j.useState(null),{data:N}=w({queryKey:["users"],queryFn:P}),{data:n}=w({queryKey:["audit-stats"],queryFn:M}),{data:c,isLoading:I,isFetching:p}=w({queryKey:["audit",t,i,l],placeholderData:s=>s,queryFn:()=>q({limit:h,offset:t*h,action:i||void 0,userId:l||void 0})}),C=(c==null?void 0:c.entries)??[],m=(c==null?void 0:c.total)??0,d=Math.ceil(m/h),U=async()=>{try{const s=await D(),g=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),x=URL.createObjectURL(g),v=document.createElement("a");v.href=x,v.download=`audit-log-${new Date().toISOString().slice(0,10)}.json`,v.click(),URL.revokeObjectURL(x)}catch{}};return e.jsxs("div",{className:"min-h-screen bg-surface-0 text-gray-200",children:[e.jsx("div",{className:"border-b border-white/5 bg-surface-1",children:e.jsx("div",{className:"max-w-[1400px] mx-auto px-6 py-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-100 flex items-center gap-3",children:[e.jsx(A,{size:24,className:"text-brand-300"}),"Audit Log",e.jsxs("span",{className:"text-sm font-normal bg-brand-500/15 text-brand-300 px-2.5 py-0.5 rounded-full",children:[m.toLocaleString()," ",m===1?"entry":"entries"]})]}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"Track all user actions and system events"})]}),e.jsxs("button",{onClick:U,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-brand-600 hover:bg-brand-500 rounded-lg transition-colors",children:[e.jsx(J,{size:16}),"Export JSON"]})]})})}),e.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 py-8 space-y-6",children:[n&&e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(b,{label:"Total Events",value:n.totalEntries}),e.jsx(b,{label:"Unique Users",value:n.uniqueUsers}),e.jsx(b,{label:"Logins (24h)",value:n.recentLoginCount,color:"emerald"}),e.jsx(b,{label:"Failed Logins (24h)",value:n.recentFailedLogins,color:n.recentFailedLogins>0?"red":"gray"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("select",{value:i,onChange:s=>{r(s.target.value),a(0)},className:"px-3.5 py-2 bg-surface-2 border border-white/10 rounded-xl text-[15px] text-gray-300 focus:outline-none focus:border-brand-500/50",children:Q.map(s=>e.jsx("option",{value:s.value,children:s.label},s.value))}),e.jsxs("select",{value:l,onChange:s=>{y(s.target.value),a(0)},className:"px-3.5 py-2 bg-surface-2 border border-white/10 rounded-xl text-[15px] text-gray-300 focus:outline-none focus:border-brand-500/50",children:[e.jsx("option",{value:"",children:"All Users"}),N==null?void 0:N.users.map(s=>e.jsxs("option",{value:s.id,children:[s.displayName," (@",s.username,")"]},s.id))]})]}),I?e.jsx("div",{className:"text-sm text-gray-500",children:"Loading audit log..."}):C.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(A,{size:40,className:"mx-auto text-gray-600 mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No audit entries found"}),e.jsx("p",{className:"text-xs text-gray-600 mt-1",children:"Entries will appear as users perform actions"})]}):e.jsx("div",{className:"bg-surface-1 rounded-xl border border-white/5 overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-white/5 text-sm text-gray-500",children:[e.jsx("th",{className:"text-left px-4 py-3 font-medium w-8"}),e.jsx("th",{className:"text-left px-4 py-3 font-medium",children:"Timestamp"}),e.jsx("th",{className:"text-left px-4 py-3 font-medium",children:"User"}),e.jsx("th",{className:"text-left px-4 py-3 font-medium",children:"Action"}),e.jsx("th",{className:"text-left px-4 py-3 font-medium",children:"Resource"})]})}),e.jsx("tbody",{className:"divide-y divide-white/5",children:C.map(s=>{const g=Z(s.action),x=T===s.id;return e.jsxs(V,{children:[e.jsxs("tr",{className:"hover:bg-white/[0.02] cursor-pointer",onClick:()=>_(x?null:s.id),children:[e.jsx("td",{className:"px-4 py-2.5 text-gray-500",children:s.details?x?e.jsx($,{size:14}):e.jsx(F,{size:14}):null}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-gray-400 whitespace-nowrap",children:X(s.timestamp)}),e.jsxs("td",{className:"px-4 py-2.5 text-sm text-gray-300",children:["@",s.username]}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsxs("span",{className:`flex items-center gap-1.5 text-sm ${g.color}`,children:[g.icon,Y(s.action)]})}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-gray-500",children:s.resourceType&&e.jsxs("span",{children:[s.resourceType,s.resourceId&&e.jsxs("span",{className:"text-gray-600",children:[" / ",s.resourceId]})]})})]}),x&&s.details&&e.jsx("tr",{className:"bg-surface-2/50",children:e.jsx("td",{colSpan:5,className:"px-8 py-3",children:e.jsx(W,{details:s.details})})})]},s.id)})})]})}),d>1&&e.jsxs("div",{className:"flex items-center justify-between gap-3 text-sm",children:[e.jsxs("span",{className:"text-gray-500",children:["Showing ",(t*h+1).toLocaleString(),"–",Math.min((t+1)*h,m).toLocaleString()," of ",m.toLocaleString()]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>a(0),disabled:t===0||p,className:"h-8 px-3 rounded-lg border border-white/10 text-gray-300 hover:bg-white/5 disabled:opacity-40 disabled:cursor-not-allowed",children:"First"}),e.jsxs("button",{onClick:()=>a(Math.max(0,t-1)),disabled:t===0||p,className:"flex items-center gap-1 h-8 px-3 rounded-lg border border-white/10 text-gray-300 hover:bg-white/5 disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(G,{size:14})," Previous"]}),e.jsxs("span",{className:"text-gray-400 tabular-nums min-w-[96px] text-center",children:["Page ",t+1," of ",d]}),e.jsxs("button",{onClick:()=>a(Math.min(d-1,t+1)),disabled:t>=d-1||p,className:"flex items-center gap-1 h-8 px-3 rounded-lg border border-white/10 text-gray-300 hover:bg-white/5 disabled:opacity-40 disabled:cursor-not-allowed",children:["Next ",e.jsx(F,{size:14})]}),e.jsx("button",{onClick:()=>a(d-1),disabled:t>=d-1||p,className:"h-8 px-3 rounded-lg border border-white/10 text-gray-300 hover:bg-white/5 disabled:opacity-40 disabled:cursor-not-allowed",children:"Last"})]})]})]})]})}function V({children:t}){return e.jsx(e.Fragment,{children:t})}function E(t){return t===void 0?"":typeof t=="string"?t:JSON.stringify(t)}function W({details:t}){const a=Array.isArray(t.changes)?t.changes:null,i=Object.fromEntries(Object.entries(t).filter(([l])=>!["changes","tab","item","moreChanges"].includes(l))),r=Object.keys(i).length>0;return!a&&typeof t.tab!="string"?e.jsx("pre",{className:"text-xs text-gray-400 font-mono whitespace-pre-wrap",children:JSON.stringify(t,null,2)}):e.jsxs("div",{className:"space-y-3",children:[typeof t.tab=="string"&&e.jsxs("p",{className:"text-xs text-gray-400",children:["Settings › ",e.jsx("span",{className:"text-gray-300",children:t.tab}),typeof t.item=="string"&&e.jsxs(e.Fragment,{children:[" › ",e.jsx("span",{className:"text-gray-300",children:t.item})]})]}),a&&a.length>0&&e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-gray-500 text-left",children:[e.jsx("th",{className:"py-1 pr-4 font-medium w-1/3",children:"Field"}),e.jsx("th",{className:"py-1 pr-4 font-medium w-1/3",children:"Before"}),e.jsx("th",{className:"py-1 font-medium w-1/3",children:"After"})]})}),e.jsx("tbody",{className:"divide-y divide-white/5",children:a.map((l,y)=>e.jsxs("tr",{className:"align-top",children:[e.jsx("td",{className:"py-1.5 pr-4 font-mono text-gray-300 break-all",children:l.field}),e.jsx("td",{className:"py-1.5 pr-4 font-mono break-all",children:l.from===void 0?e.jsx("span",{className:"text-gray-600 italic",children:"not set"}):e.jsx("span",{className:"text-red-400",children:E(l.from)})}),e.jsx("td",{className:"py-1.5 font-mono break-all",children:l.to===void 0?e.jsx("span",{className:"text-gray-600 italic",children:"removed"}):e.jsx("span",{className:"text-emerald-400",children:E(l.to)})})]},y))})]}),typeof t.moreChanges=="number"&&t.moreChanges>0&&e.jsxs("p",{className:"text-xs text-gray-500",children:["…and ",t.moreChanges," more field(s)"]}),r&&e.jsx("pre",{className:"text-xs text-gray-400 font-mono whitespace-pre-wrap",children:JSON.stringify(i,null,2)})]})}function b({label:t,value:a,color:i="gray"}){const r={gray:"text-gray-200",emerald:"text-emerald-400",red:"text-red-400",brand:"text-brand-400"};return e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4",children:[e.jsx("p",{className:"text-sm text-gray-500",children:t}),e.jsx("p",{className:`text-2xl font-bold mt-1 ${r[i]??r.gray}`,children:a.toLocaleString()})]})}function X(t){const a=new Date(t),r=new Date().getTime()-a.getTime();return r<6e4?"Just now":r<36e5?`${Math.floor(r/6e4)}m ago`:r<864e5?`${Math.floor(r/36e5)}h ago`:R(a)}function Y(t){return t.replace(/\./g," ").replace(/_/g," ").replace(/\b\w/g,a=>a.toUpperCase()).replace(/\b2fa\b/gi,"2FA")}export{le as AuditLogPage};
|
|
1
|
+
import{r as j,j as e}from"./vendor-react-DOVfxdUy.js";import{f as R}from"./formatDate-T65-Y6Mi.js";import{u as w}from"./vendor-query-DkZSMtfn.js";import{fD as M,fK as P,fL as D,fM as q}from"./index-D6sQYc_0.js";import{k as A,a5 as J,y as $,t as k,ce as G,j as f,S as z,aZ as S,ab as L,a as u,a2 as K,d8 as F,aC as o,z as B,ai as Z}from"./vendor-icons-D_Dmmj8d.js";const O={"auth.login":{icon:e.jsx(Z,{size:14}),color:"text-emerald-400"},"auth.logout":{icon:e.jsx(B,{size:14}),color:"text-gray-400"},"auth.login_failed":{icon:e.jsx(u,{size:14}),color:"text-red-400"},"auth.password_change":{icon:e.jsx(o,{size:14}),color:"text-amber-400"},"auth.setup":{icon:e.jsx(o,{size:14}),color:"text-brand-400"},"auth.2fa_enabled":{icon:e.jsx(o,{size:14}),color:"text-emerald-400"},"auth.2fa_disabled":{icon:e.jsx(o,{size:14}),color:"text-amber-400"},"auth.2fa_failed":{icon:e.jsx(u,{size:14}),color:"text-red-400"},"auth.2fa_recovery_used":{icon:e.jsx(o,{size:14}),color:"text-amber-400"},"user.2fa_reset":{icon:e.jsx(o,{size:14}),color:"text-amber-400"},"user.create":{icon:e.jsx(F,{size:14}),color:"text-brand-400"},"user.update":{icon:e.jsx(f,{size:14}),color:"text-sky-400"},"user.delete":{icon:e.jsx(u,{size:14}),color:"text-red-400"},"user.role_change":{icon:e.jsx(o,{size:14}),color:"text-amber-400"},"user.disable":{icon:e.jsx(u,{size:14}),color:"text-red-400"},"user.enable":{icon:e.jsx(F,{size:14}),color:"text-emerald-400"},"run.start":{icon:e.jsx(K,{size:14}),color:"text-emerald-400"},"run.cancel":{icon:e.jsx(u,{size:14}),color:"text-amber-400"},"file.create":{icon:e.jsx(L,{size:14}),color:"text-sky-400"},"file.update":{icon:e.jsx(L,{size:14}),color:"text-sky-400"},"file.delete":{icon:e.jsx(L,{size:14}),color:"text-red-400"},"git.commit":{icon:e.jsx(S,{size:14}),color:"text-emerald-400"},"git.push":{icon:e.jsx(S,{size:14}),color:"text-brand-400"},"git.pull":{icon:e.jsx(S,{size:14}),color:"text-sky-400"},"ai.generate":{icon:e.jsx(z,{size:14}),color:"text-purple-400"},"ai.fix":{icon:e.jsx(z,{size:14}),color:"text-purple-400"},"ai.chat":{icon:e.jsx(z,{size:14}),color:"text-purple-400"}};function H(t){return O[t]?O[t]:t.startsWith("settings.")?/_(delete|remove|disconnect|reset)$/.test(t)?{icon:e.jsx(f,{size:14}),color:"text-red-400"}:{icon:e.jsx(f,{size:14}),color:"text-sky-400"}:{icon:e.jsx(f,{size:14}),color:"text-gray-400"}}const h=50,Q=[{value:"",label:"All Actions"},{value:"auth.*",label:"Authentication"},{value:"user.*",label:"User Management"},{value:"run.*",label:"Test Runs"},{value:"file.*",label:"File Operations"},{value:"git.*",label:"Git Operations"},{value:"ai.*",label:"AI Actions"},{value:"settings.*",label:"Settings"}];function le(){const[t,a]=j.useState(0),[i,r]=j.useState(""),[l,y]=j.useState(""),[T,_]=j.useState(null),{data:N}=w({queryKey:["users"],queryFn:M}),{data:n}=w({queryKey:["audit-stats"],queryFn:P}),{data:c,isLoading:I,isFetching:p}=w({queryKey:["audit",t,i,l],placeholderData:s=>s,queryFn:()=>D({limit:h,offset:t*h,action:i||void 0,userId:l||void 0})}),C=(c==null?void 0:c.entries)??[],m=(c==null?void 0:c.total)??0,d=Math.ceil(m/h),U=async()=>{try{const s=await q(),g=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),x=URL.createObjectURL(g),v=document.createElement("a");v.href=x,v.download=`audit-log-${new Date().toISOString().slice(0,10)}.json`,v.click(),URL.revokeObjectURL(x)}catch{}};return e.jsxs("div",{className:"min-h-screen bg-surface-0 text-gray-200",children:[e.jsx("div",{className:"border-b border-white/5 bg-surface-1",children:e.jsx("div",{className:"max-w-[1400px] mx-auto px-6 py-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-100 flex items-center gap-3",children:[e.jsx(A,{size:24,className:"text-brand-300"}),"Audit Log",e.jsxs("span",{className:"text-sm font-normal bg-brand-500/15 text-brand-300 px-2.5 py-0.5 rounded-full",children:[m.toLocaleString()," ",m===1?"entry":"entries"]})]}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"Track all user actions and system events"})]}),e.jsxs("button",{onClick:U,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-brand-600 hover:bg-brand-500 rounded-lg transition-colors",children:[e.jsx(J,{size:16}),"Export JSON"]})]})})}),e.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 py-8 space-y-6",children:[n&&e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(b,{label:"Total Events",value:n.totalEntries}),e.jsx(b,{label:"Unique Users",value:n.uniqueUsers}),e.jsx(b,{label:"Logins (24h)",value:n.recentLoginCount,color:"emerald"}),e.jsx(b,{label:"Failed Logins (24h)",value:n.recentFailedLogins,color:n.recentFailedLogins>0?"red":"gray"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("select",{value:i,onChange:s=>{r(s.target.value),a(0)},className:"px-3.5 py-2 bg-surface-2 border border-white/10 rounded-xl text-[15px] text-gray-300 focus:outline-none focus:border-brand-500/50",children:Q.map(s=>e.jsx("option",{value:s.value,children:s.label},s.value))}),e.jsxs("select",{value:l,onChange:s=>{y(s.target.value),a(0)},className:"px-3.5 py-2 bg-surface-2 border border-white/10 rounded-xl text-[15px] text-gray-300 focus:outline-none focus:border-brand-500/50",children:[e.jsx("option",{value:"",children:"All Users"}),N==null?void 0:N.users.map(s=>e.jsxs("option",{value:s.id,children:[s.displayName," (@",s.username,")"]},s.id))]})]}),I?e.jsx("div",{className:"text-sm text-gray-500",children:"Loading audit log..."}):C.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(A,{size:40,className:"mx-auto text-gray-600 mb-3"}),e.jsx("p",{className:"text-gray-400",children:"No audit entries found"}),e.jsx("p",{className:"text-xs text-gray-600 mt-1",children:"Entries will appear as users perform actions"})]}):e.jsx("div",{className:"bg-surface-1 rounded-xl border border-white/5 overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-white/5 text-sm text-gray-500",children:[e.jsx("th",{className:"text-left px-4 py-3 font-medium w-8"}),e.jsx("th",{className:"text-left px-4 py-3 font-medium",children:"Timestamp"}),e.jsx("th",{className:"text-left px-4 py-3 font-medium",children:"User"}),e.jsx("th",{className:"text-left px-4 py-3 font-medium",children:"Action"}),e.jsx("th",{className:"text-left px-4 py-3 font-medium",children:"Resource"})]})}),e.jsx("tbody",{className:"divide-y divide-white/5",children:C.map(s=>{const g=H(s.action),x=T===s.id;return e.jsxs(V,{children:[e.jsxs("tr",{className:"hover:bg-white/[0.02] cursor-pointer",onClick:()=>_(x?null:s.id),children:[e.jsx("td",{className:"px-4 py-2.5 text-gray-500",children:s.details?x?e.jsx($,{size:14}):e.jsx(k,{size:14}):null}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-gray-400 whitespace-nowrap",children:X(s.timestamp)}),e.jsxs("td",{className:"px-4 py-2.5 text-sm text-gray-300",children:["@",s.username]}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsxs("span",{className:`flex items-center gap-1.5 text-sm ${g.color}`,children:[g.icon,Y(s.action)]})}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-gray-500",children:s.resourceType&&e.jsxs("span",{children:[s.resourceType,s.resourceId&&e.jsxs("span",{className:"text-gray-600",children:[" / ",s.resourceId]})]})})]}),x&&s.details&&e.jsx("tr",{className:"bg-surface-2/50",children:e.jsx("td",{colSpan:5,className:"px-8 py-3",children:e.jsx(W,{details:s.details})})})]},s.id)})})]})}),d>1&&e.jsxs("div",{className:"flex items-center justify-between gap-3 text-sm",children:[e.jsxs("span",{className:"text-gray-500",children:["Showing ",(t*h+1).toLocaleString(),"–",Math.min((t+1)*h,m).toLocaleString()," of ",m.toLocaleString()]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>a(0),disabled:t===0||p,className:"h-8 px-3 rounded-lg border border-white/10 text-gray-300 hover:bg-white/5 disabled:opacity-40 disabled:cursor-not-allowed",children:"First"}),e.jsxs("button",{onClick:()=>a(Math.max(0,t-1)),disabled:t===0||p,className:"flex items-center gap-1 h-8 px-3 rounded-lg border border-white/10 text-gray-300 hover:bg-white/5 disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(G,{size:14})," Previous"]}),e.jsxs("span",{className:"text-gray-400 tabular-nums min-w-[96px] text-center",children:["Page ",t+1," of ",d]}),e.jsxs("button",{onClick:()=>a(Math.min(d-1,t+1)),disabled:t>=d-1||p,className:"flex items-center gap-1 h-8 px-3 rounded-lg border border-white/10 text-gray-300 hover:bg-white/5 disabled:opacity-40 disabled:cursor-not-allowed",children:["Next ",e.jsx(k,{size:14})]}),e.jsx("button",{onClick:()=>a(d-1),disabled:t>=d-1||p,className:"h-8 px-3 rounded-lg border border-white/10 text-gray-300 hover:bg-white/5 disabled:opacity-40 disabled:cursor-not-allowed",children:"Last"})]})]})]})]})}function V({children:t}){return e.jsx(e.Fragment,{children:t})}function E(t){return t===void 0?"":typeof t=="string"?t:JSON.stringify(t)}function W({details:t}){const a=Array.isArray(t.changes)?t.changes:null,i=Object.fromEntries(Object.entries(t).filter(([l])=>!["changes","tab","item","moreChanges"].includes(l))),r=Object.keys(i).length>0;return!a&&typeof t.tab!="string"?e.jsx("pre",{className:"text-xs text-gray-400 font-mono whitespace-pre-wrap",children:JSON.stringify(t,null,2)}):e.jsxs("div",{className:"space-y-3",children:[typeof t.tab=="string"&&e.jsxs("p",{className:"text-xs text-gray-400",children:["Settings › ",e.jsx("span",{className:"text-gray-300",children:t.tab}),typeof t.item=="string"&&e.jsxs(e.Fragment,{children:[" › ",e.jsx("span",{className:"text-gray-300",children:t.item})]})]}),a&&a.length>0&&e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-gray-500 text-left",children:[e.jsx("th",{className:"py-1 pr-4 font-medium w-1/3",children:"Field"}),e.jsx("th",{className:"py-1 pr-4 font-medium w-1/3",children:"Before"}),e.jsx("th",{className:"py-1 font-medium w-1/3",children:"After"})]})}),e.jsx("tbody",{className:"divide-y divide-white/5",children:a.map((l,y)=>e.jsxs("tr",{className:"align-top",children:[e.jsx("td",{className:"py-1.5 pr-4 font-mono text-gray-300 break-all",children:l.field}),e.jsx("td",{className:"py-1.5 pr-4 font-mono break-all",children:l.from===void 0?e.jsx("span",{className:"text-gray-600 italic",children:"not set"}):e.jsx("span",{className:"text-red-400",children:E(l.from)})}),e.jsx("td",{className:"py-1.5 font-mono break-all",children:l.to===void 0?e.jsx("span",{className:"text-gray-600 italic",children:"removed"}):e.jsx("span",{className:"text-emerald-400",children:E(l.to)})})]},y))})]}),typeof t.moreChanges=="number"&&t.moreChanges>0&&e.jsxs("p",{className:"text-xs text-gray-500",children:["…and ",t.moreChanges," more field(s)"]}),r&&e.jsx("pre",{className:"text-xs text-gray-400 font-mono whitespace-pre-wrap",children:JSON.stringify(i,null,2)})]})}function b({label:t,value:a,color:i="gray"}){const r={gray:"text-gray-200",emerald:"text-emerald-400",red:"text-red-400",brand:"text-brand-400"};return e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/5 p-4",children:[e.jsx("p",{className:"text-sm text-gray-500",children:t}),e.jsx("p",{className:`text-2xl font-bold mt-1 ${r[i]??r.gray}`,children:a.toLocaleString()})]})}function X(t){const a=new Date(t),r=new Date().getTime()-a.getTime();return r<6e4?"Just now":r<36e5?`${Math.floor(r/6e4)}m ago`:r<864e5?`${Math.floor(r/36e5)}h ago`:R(a)}function Y(t){return t.replace(/\./g," ").replace(/_/g," ").replace(/\b\w/g,a=>a.toUpperCase()).replace(/\b2fa\b/gi,"2FA")}export{le as AuditLogPage};
|