Spaces:
Running
Running
| import{u as G,j as e,m as f}from"./vendor-Dy_Aqit6.js";import{a as b}from"./plotly-BRtgkqNO.js";import{c as V,u as T,R as w,G as v,D as g,L as F,B as h,y as P,v as U,Z as I,i as y,F as O,z as B}from"./index-DkRDPfDI.js";import{N as Q}from"./network-Dm95YjDZ.js";import{S as q}from"./shield-D8iK2QH3.js";import{C as H}from"./check-circle-2-B9yEnqr0.js";import{D as Z}from"./download-CY4MswlO.js";/** | |
| * @license lucide-react v0.344.0 - ISC | |
| * | |
| * This source code is licensed under the ISC license. | |
| * See the LICENSE file in the root directory of this source tree. | |
| */const z=V("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),W={database:e.jsx(g,{className:"w-6 h-6 text-blue-500"}),cpu:e.jsx(B,{className:"w-6 h-6 text-indigo-500"}),brain:e.jsx(h,{className:"w-6 h-6 text-amber-500"}),layout:e.jsx(O,{className:"w-6 h-6 text-emerald-500"})},te=()=>{const $=G(),{isDark:s}=T(),[o,D]=b.useState(null),[L,k]=b.useState(!0),[S,p]=b.useState(!1),x=s?"bg-white/[0.03]":"bg-white",d=s?"border-white/[0.06]":"border-slate-200",r=s?"text-white":"text-slate-900",m=s?"text-slate-400":"text-slate-600",i="text-slate-500",u=async()=>{try{const a=await y.get("/api/v1/lineage/");D(a.data)}catch(a){console.error("Failed to load lineage",a)}finally{k(!1)}};b.useEffect(()=>{u()},[]);const C=async()=>{p(!0),await u(),p(!1)},R=async()=>{try{const a=await y.get("/api/v1/lineage/export",{responseType:"blob"}),l=window.URL.createObjectURL(a.data),n=document.createElement("a");n.href=l,n.download="datavision_audit_log.csv",document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(l)}catch(a){console.error("Failed to export audit log",a)}},c=(o==null?void 0:o.stats)||{},j=(o==null?void 0:o.nodes)||[];return e.jsxs("div",{className:`p-4 md:p-6 lg:p-8 max-w-7xl mx-auto min-h-screen ${s?"bg-[#0a0b10]":"bg-slate-50"}`,children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 text-white shadow-lg shadow-indigo-500/20",children:e.jsx(Q,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h2",{className:`text-xl font-bold tracking-tight ${r}`,children:"Data Lineage & Governance"}),e.jsx("p",{className:`text-xs ${m}`,children:"Visual audit trails, data flow compliance, and semantic indexing."})]})]}),e.jsxs("button",{onClick:C,className:"flex items-center gap-2 px-4 py-2 bg-indigo-500 hover:bg-indigo-400 text-white rounded-xl font-bold text-xs shadow-lg shadow-indigo-500/20 transition-all",children:[e.jsx(w,{className:`w-3.5 h-3.5 ${S?"animate-spin":""}`}),"Re-scan Flows"]})]}),e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-6",children:[{label:"GDPR Compliance",value:c.gdpr_status==="Verified"?"100% Verified":"No Data",icon:q,color:c.gdpr_status==="Verified"?"text-emerald-500":i,bg:c.gdpr_status==="Verified"?s?"bg-emerald-500/10":"bg-emerald-50":s?"bg-white/[0.02]":"bg-slate-50"},{label:"Active Pipelines",value:`${c.total_pipelines||0} Streams`,icon:v,color:s?"text-blue-400":"text-blue-600",bg:s?"bg-blue-500/10":"bg-blue-50"},{label:"Data Nodes",value:`${c.total_nodes||0} Nodes`,icon:g,color:s?"text-purple-400":"text-purple-600",bg:s?"bg-purple-500/10":"bg-purple-50"},{label:"Encryption",value:c.encryption||"AES-256",icon:F,color:s?"text-teal-400":"text-teal-600",bg:s?"bg-teal-500/10":"bg-teal-50"}].map((a,l)=>e.jsxs(f.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:l*.08},className:`p-4 rounded-2xl border ${x} ${d} transition-all hover:border-indigo-500/30`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("div",{className:`p-1.5 rounded-lg ${a.bg}`,children:e.jsx(a.icon,{className:`w-4 h-4 ${a.color}`})}),e.jsx("span",{className:`text-[9px] font-bold uppercase tracking-wider ${i}`,children:a.label})]}),e.jsx("p",{className:`text-lg font-extrabold ${a.color}`,children:a.value})]},l))}),e.jsx("div",{className:`p-5 rounded-2xl border mb-6 ${x} ${d}`,children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:`p-2.5 rounded-xl shrink-0 ${s?"bg-amber-500/10":"bg-amber-50"}`,children:e.jsx(h,{className:`w-5 h-5 ${s?"text-amber-400":"text-amber-600"}`})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1.5 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:`text-sm font-bold ${r}`,children:"Semantic Search & RAG (Qdrant + MiniLM-L6)"}),e.jsx("span",{className:`text-[9px] font-bold px-2 py-0.5 rounded ${s?"bg-amber-500/10 text-amber-400":"bg-amber-50 text-amber-600"} tracking-wider`,children:"VECTOR AI"})]}),e.jsxs("button",{onClick:()=>$("/vector"),className:`px-3.5 py-1.5 rounded-xl text-xs font-semibold flex items-center gap-2 shadow-sm transition-all ${s?"bg-gradient-to-r from-amber-500/20 to-indigo-500/20 text-amber-300 border border-amber-500/30 hover:border-amber-400":"bg-amber-500 text-white hover:bg-amber-600"}`,children:[e.jsx(P,{className:"w-3.5 h-3.5"}),"Inspect Vector DB & Test Queries"]})]}),e.jsxs("p",{className:`text-xs leading-relaxed ${m} mb-3`,children:["When you upload datasets, DataVision automatically creates ",e.jsx("strong",{className:r,children:"vector embeddings"})," of your column names, data descriptions, and metadata using the ",e.jsx("strong",{className:r,children:"MiniLM-L6 transformer"}),". These embeddings are stored in ",e.jsx("strong",{className:r,children:"Qdrant"})," (a vector database) enabling:"]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[{icon:U,title:"Natural Language Search",desc:'Search datasets by meaning β "find revenue columns" matches total_sales, gross_income, etc.'},{icon:h,title:"AI Analyst Memory",desc:"The Gemini/GPT analyst uses RAG to recall relevant data context when answering your questions."},{icon:I,title:"Smart Column Matching",desc:"AutoML and Dashboard generators use semantic search to intelligently map and correlate columns."}].map((a,l)=>e.jsxs("div",{className:`p-3 rounded-xl border ${d} ${s?"bg-white/[0.02]":"bg-slate-50"}`,children:[e.jsx(a.icon,{className:`w-4 h-4 mb-1.5 ${s?"text-amber-400":"text-amber-600"}`}),e.jsx("h4",{className:`text-xs font-bold ${r} mb-0.5`,children:a.title}),e.jsx("p",{className:`text-[10px] leading-relaxed ${i}`,children:a.desc})]},l))}),e.jsx("div",{className:`mt-3 p-3 rounded-lg ${s?"bg-emerald-500/[0.06] border border-emerald-500/15":"bg-emerald-50 border border-emerald-200"}`,children:e.jsxs("p",{className:`text-[11px] ${m} flex items-center gap-2`,children:[e.jsx(H,{className:"w-3.5 h-3.5 text-emerald-500 shrink-0"}),e.jsxs("span",{children:[e.jsx("strong",{className:r,children:"Auto-connected"})," β Qdrant indexing runs automatically when you upload data in DataHub. No manual setup required."]})]})})]})]})}),e.jsxs("div",{className:`p-6 rounded-2xl border min-h-[400px] flex flex-col ${x} ${d}`,children:[e.jsxs("div",{className:`flex justify-between items-center border-b pb-4 mb-6 ${d}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(v,{className:`w-4 h-4 ${s?"text-indigo-400":"text-indigo-600"}`}),e.jsx("span",{className:`text-sm font-bold ${r}`,children:"Interactive Data Flow Diagram"})]}),e.jsxs("button",{onClick:R,className:`px-3 py-1.5 rounded-lg border text-xs font-bold flex items-center gap-1.5 transition-colors ${s?"border-indigo-500/30 text-indigo-400 hover:bg-indigo-500/10":"border-indigo-200 text-indigo-600 hover:bg-indigo-50"}`,children:[e.jsx(Z,{className:"w-3.5 h-3.5"})," Export Audit Log"]})]}),L?e.jsx("div",{className:"flex-1 flex justify-center items-center",children:e.jsx(w,{className:"w-6 h-6 text-indigo-500 animate-spin"})}):j.length===0?e.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center text-center",children:[e.jsx(g,{className:`w-10 h-10 mb-3 ${s?"text-slate-700":"text-slate-300"}`}),e.jsx("h3",{className:`text-base font-bold mb-1 ${r}`,children:"No Data Pipelines Yet"}),e.jsx("p",{className:`text-xs max-w-md ${i}`,children:"Upload a dataset in the Data Hub to see your data lineage flow appear here automatically."})]}):e.jsx("div",{className:"flex-1 space-y-2",children:["source","transform","dashboard"].map((a,l)=>{const n=j.filter(t=>t.type===a||a==="dashboard"&&t.type==="dashboard");if(n.length===0)return null;const A=a==="source"?"π₯ Data Sources":a==="transform"?"βοΈ Processing Pipeline":"π Outputs";return e.jsxs("div",{children:[e.jsx("h4",{className:`text-[10px] font-bold uppercase tracking-wider mb-3 ${i}`,children:A}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:n.map((t,M)=>{const E={active:"text-emerald-500",success:"text-emerald-500",pending:"text-amber-500",error:"text-red-500"};return e.jsxs(f.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{delay:l*.1+M*.04},className:`p-4 rounded-xl border transition-all hover:border-indigo-500/30 ${x} ${d}`,children:[e.jsxs("div",{className:"flex items-start justify-between mb-2.5",children:[W[t.icon]||e.jsx(g,{className:`w-6 h-6 ${i}`}),e.jsxs("span",{className:`text-[9px] uppercase font-bold tracking-wider px-1.5 py-0.5 rounded ${s?"bg-white/[0.05]":"bg-slate-100"} ${E[t.status]||i}`,children:["β ",t.status]})]}),e.jsx("h5",{className:`font-bold text-sm mb-0.5 ${r}`,children:t.label}),e.jsx("p",{className:`text-[10px] uppercase tracking-wider mb-2.5 ${i}`,children:t.type}),t.metadata&&e.jsx("div",{className:"space-y-1",children:Object.entries(t.metadata).map(([N,_])=>e.jsxs("div",{className:"flex justify-between text-[11px]",children:[e.jsxs("span",{className:i,children:[N,":"]}),e.jsx("span",{className:`font-medium ${m}`,children:String(_)})]},N))})]},t.id)})}),a!=="dashboard"&&n.length>0&&e.jsx("div",{className:"flex justify-center my-4",children:e.jsxs("div",{className:`flex flex-col items-center gap-1 ${s?"text-indigo-400":"text-indigo-500"}`,children:[e.jsx("div",{className:`w-px h-6 ${s?"bg-indigo-500/30":"bg-indigo-300"}`}),e.jsx(z,{className:"w-4 h-4"}),e.jsx("div",{className:`w-px h-6 ${s?"bg-indigo-500/30":"bg-indigo-300"}`})]})})]},a)})})]})]})};export{te as default}; | |