1"use strict";(globalThis.webpackChunkedupark_client||=[]).push([[5735],{65735(e,s,t){t.r(s);var r=t(58878),n=t(15021),a=t(43681),i=t(96452),l=t(41868),d=t(65852),o=t(1060),c=t(39018),m=t(20909),x=t(97307),u=t(98639),p=t(90782);const b=e=>{let{status:s,label:t,loading:r}=e;return r?(0,p.jsxs)("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-sm bg-surface-sunken text-text-muted",children:[(0,p.jsx)(n.A,{size:12,className:"animate-spin mr-2"}),t]}):null===s?(0,p.jsxs)("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-sm bg-surface-sunken text-text-subtle",children:[(0,p.jsx)("span",{className:"mr-2",children:"?"}),t]}):s?(0,p.jsxs)("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-sm bg-success-100 text-success-800",children:[(0,p.jsx)("span",{className:"mr-2",children:"\u2713"}),t]}):(0,p.jsxs)("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-sm bg-error-100 text-error-800",children:[(0,p.jsx)("span",{className:"mr-2",children:"\u2717"}),t]})},h=e=>{let{syncStatus:s,hasNaturalKey:t}=e;return t?s?s.inSync?(0,p.jsx)("span",{className:"text-xs text-success-600 bg-success-50 px-2 py-0.5 rounded",children:"\u2713 In sync"}):(0,p.jsxs)("div",{className:"flex gap-1.5 flex-wrap",children:[s.newRecords>0&&(0,p.jsxs)("span",{className:"text-xs text-primary-600 bg-primary-50 px-2 py-0.5 rounded",children:[s.isEstimated?"~":"","+",s.newRecords," new"]}),s.modifiedRecords>0&&(0,p.jsxs)("span",{className:"text-xs text-warning-600 bg-warning-50 px-2 py-0.5 rounded",children:[s.isEstimated?"~":"","~",s.modifiedRecords," modified"]})]}):(0,p.jsx)("span",{className:"text-xs text-text-subtle bg-surface-sunken px-2 py-0.5 rounded",children:"Loading..."}):(0,p.jsx)("span",{className:"text-xs text-text-subtle bg-surface-sunken px-2 py-0.5 rounded",children:"N/A"})},f=e=>{let{isOpen:s,tableName:t,preview:n,loading:i,error:l,onClose:d}=e;const[o,c]=(0,r.useState)("new");return s?(0,p.jsx)(x.A,{children:(0,p.jsx)("div",{className:"fixed inset-0 z-[200] overflow-y-auto",children:(0,p.jsxs)("div",{className:"flex items-center justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:p-0",children:[(0,p.jsx)("div",{className:"fixed inset-0 bg-neutral-900/50 backdrop-blur-sm transition-opacity",onClick:d}),(0,p.jsxs)("div",{className:"relative inline-block bg-surface-raised rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:max-w-4xl sm:w-full",children:[(0,p.jsxs)("div",{className:"px-6 py-4 border-b border-border flex items-center justify-between",children:[(0,p.jsxs)("h3",{className:"text-lg font-medium text-text",children:["Diff Preview: ",t]}),(0,p.jsx)("button",{onClick:d,className:"text-text-subtle hover:text-text-subtle",children:(0,p.jsx)("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,p.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,p.jsxs)("div",{className:"px-6 py-4 max-h-[70vh] overflow-y-auto",children:[i&&(0,p.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,p.jsx)(a.k,{size:"md"}),(0,p.jsx)("span",{className:"ml-2 text-text-subtle",children:"Loading diff preview..."})]}),l&&(0,p.jsxs)("div",{className:"p-4 bg-error-50 border border-error-200 rounded-md text-error-700",children:["Error: ",l]}),!i&&!l&&n&&(0,p.jsx)(p.Fragment,{children:n.hasNaturalKey?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"mb-4 p-3 bg-surface-sunken rounded-lg",children:(0,p.jsxs)("div",{className:"flex gap-6 text-sm",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("span",{className:"text-text-subtle",children:"New Records:"})," ",(0,p.jsx)("span",{className:"font-medium text-primary-600",children:n.totalNewRecords})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("span",{className:"text-text-subtle",children:"Modified Records:"})," ",(0,p.jsx)("span",{className:"font-medium text-warning-600",children:n.totalModifiedRecords})]})]})}),(0,p.jsx)("div",{className:"border-b border-border mb-4",children:(0,p.jsxs)("nav",{className:"-mb-px flex gap-6",children:[(0,p.jsxs)("button",{onClick:()=>c("new"),className:"py-2 px-1 border-b-2 text-sm font-medium "+("new"===o?"border-primary-500 text-primary-600":"border-transparent text-text-subtle hover:text-text-muted hover:border-border-strong"),children:["New Records (",n.newRecords.length,")"]}),(0,p.jsxs)("button",{onClick:()=>c("modified"),className:"py-2 px-1 border-b-2 text-sm font-medium "+("modified"===o?"border-warning-500 text-warning-600":"border-transparent text-text-subtle hover:text-text-muted hover:border-border-strong"),children:["Modified Records (",n.modifiedRecords.length,")"]})]})}),"new"===o&&(0,p.jsx)("div",{className:"space-y-3",children:0===n.newRecords.length?(0,p.jsx)("p",{className:"text-text-subtle text-sm py-4 text-center",children:"No new records foun
1d"}):n.newRecords.map((e,s)=>(0,p.jsx)("div",{className:"p-3 bg-primary-50 border border-primary-100 rounded-md",children:(0,p.jsx)("pre",{className:"text-xs text-text-muted overflow-x-auto",children:JSON.stringify(e,null,2)})},s))}),"modified"===o&&(0,p.jsx)("div",{className:"space-y-4",children:0===n.modifiedRecords.length?(0,p.jsx)("p",{className:"text-text-subtle text-sm py-4 text-center",children:"No modified records found"}):n.modifiedRecords.map((e,s)=>(0,p.jsxs)("div",{className:"border border-border rounded-md overflow-hidden",children:[(0,p.jsxs)("div",{className:"px-3 py-2 bg-surface-sunken border-b border-border",children:[(0,p.jsxs)("span",{className:"text-xs font-medium text-text-subtle",children:["Changed fields:"," "]}),(0,p.jsx)("span",{className:"text-xs text-warning-600",children:e.changedFields.join(", ")})]}),(0,p.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-border",children:[(0,p.jsxs)("div",{className:"p-3",children:[(0,p.jsx)("p",{className:"text-xs font-medium text-primary-600 mb-2",children:"Intern"}),(0,p.jsx)("pre",{className:"text-xs text-text-muted overflow-x-auto",children:JSON.stringify(e.internRecord,null,2)})]}),(0,p.jsxs)("div",{className:"p-3",children:[(0,p.jsx)("p",{className:"text-xs font-medium text-success-600 mb-2",children:"Production"}),(0,p.jsx)("pre",{className:"text-xs text-text-muted overflow-x-auto",children:JSON.stringify(e.prodRecord,null,2)})]})]})]},s))})]}):(0,p.jsx)("div",{className:"p-4 bg-warning-50 border border-warning-200 rounded-md text-warning-700",children:"This table has no natural key defined, so record-level comparison is not available."})})]}),(0,p.jsx)("div",{className:"px-6 py-4 border-t border-border flex justify-end",children:(0,p.jsx)("button",{onClick:d,className:"px-4 py-2 text-sm font-medium text-text-muted bg-surface-raised border border-border-strong rounded-md hover:bg-surface-sunken",children:"Close"})})]})]})})}):null},g=e=>{let{isOpen:s,title:t,message:r,confirmLabel:n,confirmVariant:a,onConfirm:i,onCancel:l}=e;return s?(0,p.jsx)(x.A,{children:(0,p.jsx)("div",{className:"fixed inset-0 z-[200] overflow-y-auto",children:(0,p.jsxs)("div",{className:"flex items-center justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:p-0",children:[(0,p.jsx)("div",{className:"fixed inset-0 bg-neutral-900/50 backdrop-blur-sm transition-opacity",onClick:l}),(0,p.jsxs)("div",{className:"relative inline-block bg-surface-raised rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:max-w-lg sm:w-full sm:p-6",children:[(0,p.jsx)("div",{children:(0,p.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:text-left",children:[(0,p.jsx)("h3",{className:"text-lg font-medium leading-6 text-text",children:t}),(0,p.jsx)("div",{className:"mt-2 text-sm text-text-subtle",children:r})]})}),(0,p.jsxs)("div",{className:"mt-5 sm:mt-4 sm:flex sm:flex-row-reverse gap-3",children:[(0,p.jsx)("button",{type:"button",className:"inline-flex justify-center rounded-md px-4 py-2 text-sm font-semibold text-white shadow-sm "+("danger"===a?"bg-error-600 hover:bg-error-700":"bg-brand hover:bg-brand-hover"),onClick:i,children:n}),(0,p.jsx)("button",{type:"button",className:"inline-flex justify-center rounded-md bg-surface-raised px-4 py-2 text-sm font-semibold text-text shadow-sm ring-1 ring-inset ring-border hover:bg-surface-sunken",onClick:l,children:"Cancel"})]})]})]})})}):null},j=()=>{var e,s,t,x;const[j,N]=(0,r.useState)(new Set),[v,y]=(0,r.useState)("upsert"),[w,C]=(0,r.useState)(500),[k,R]=(0,r.useState)(null),[P,S]=(0,r.useState)(null),[_,I]=(0,r.useState)(!1),[D,T]=(0,r.useState)(null),[F,L]=(0,r.useState)(null),{data:z,loading:E,refetch:$}=(0,o.IT)(m.Qx,{...(0,u.X)("session")}),{data:V,loading:J,refetch:O}=(0,o.IT)(m.CL,{...(0,u.X)("session")}),{data:A,loading:M}=(0,o.IT)(m.ne,{...(0,u.X)("session")}),[q,{loading:H}]=(0,l._)(m.Cj,{...(0,u.X)("oneshot")}),[K,{loading:G}]=(0,d.n)(m.JC),[W,{loading:Z}]=(0,l._)(m.Hj,{...(0,u.X)("oneshot")}),X=null===z||void 0===z?void 0:z.checkDatabaseHealth,B=null===V||void 0===V?void 0:V.compareSchemaVersions,U=(0,r.useMemo)(()=>{var e;return(null===A||void 0===A||null===(e=A.getPromotableTables)||void 0===e?void 0:e.tables)||[]},[null===A||void 0===A||null===(e=A.getPromotableTables)||void 0===e?void 0:e.tables]),Q=(null===X||void 0===X?void 0:X.intern)&&(null===X||void 0===X?void 0:X.production),Y=Q&&j.size>0,ee=U.reduce((e,s)=>
1(e[s.tier]||(e[s.tier]=[]),e[s.tier].push(s),e),{}),se=(0,r.useCallback)(async()=>{await Promise.all([$(),O()])},[$,O]),te=(0,r.useCallback)(e=>{N(s=>{const t=new Set(s);if(t.has(e))t.delete(e);else{t.add(e);const s=U.find(s=>s.name===e);s&&s.dependencies.forEach(e=>{e.required&&t.add(e.table)})}return t}),R(null),S(null)},[U]),re=(0,r.useCallback)(e=>{const s=ee[e]||[];N(e=>{const t=new Set(e);return s.every(e=>t.has(e.name))?s.forEach(e=>t.delete(e.name)):s.forEach(e=>t.add(e.name)),t}),R(null),S(null)},[ee]),ne=(0,r.useCallback)(async()=>{if(0!==j.size)try{const e=await q({variables:{tables:Array.from(j)}});e.data&&R(e.data.getPromotionPreview)}catch(e){console.error("Preview failed:",e)}},[j,q]),ae=(0,r.useCallback)(async()=>{if(0!==j.size)try{const e=await K({variables:{input:{tables:Array.from(j),conflictStrategy:v,dryRun:!0,batchSize:w}}});e.data&&S(e.data.promoteContent)}catch(e){console.error("Dry run failed:",e)}},[j,v,w,K]),ie=(0,r.useCallback)(async()=>{I(!1);try{const e=await K({variables:{input:{tables:Array.from(j),conflictStrategy:v,dryRun:!1,batchSize:w}}});e.data&&S(e.data.promoteContent)}catch(e){console.error("Live promotion failed:",e)}},[j,v,w,K]),le=(0,r.useCallback)(()=>{N(new Set),R(null),S(null)},[]),de=(0,r.useCallback)(async e=>{T(e),L(null);try{var s;const t=await W({variables:{tableName:e,limit:10}});null!==(s=t.data)&&void 0!==s&&s.getTableDiffPreview.preview&&L(t.data.getTableDiffPreview.preview)}catch(t){console.error("Failed to get diff preview:",t)}},[W]),oe=(0,r.useCallback)(()=>{T(null),L(null)},[]);return(0,p.jsxs)("div",{className:"space-y-6",children:[(0,p.jsx)("div",{className:"border-b border-border pb-4",children:(0,p.jsxs)("div",{className:"flex items-center justify-between",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("h1",{className:"text-2xl font-bold text-text",children:"Content Promotion"}),(0,p.jsx)("p",{className:"text-sm text-text-subtle mt-1",children:"Promote educational content from intern database to production"})]}),(0,p.jsx)(c.N_,{to:"/admin/content-promotion/history",className:"inline-flex items-center px-4 py-2 border border-border-strong rounded-md shadow-sm text-sm font-medium text-text-muted bg-surface-raised hover:bg-surface-sunken",children:"View History"})]})}),(0,p.jsxs)("div",{className:"bg-surface-raised rounded-lg shadow p-6",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,p.jsx)("h2",{className:"text-lg font-semibold text-text",children:"Database Health Check"}),(0,p.jsx)("button",{onClick:se,disabled:E||J,className:"inline-flex items-center px-3 py-1.5 border border-border-strong rounded-md text-sm font-medium text-text-muted bg-surface-raised hover:bg-surface-sunken disabled:opacity-50",children:E||J?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(n.A,{size:16,className:"animate-spin mr-2"}),"Checking..."]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("svg",{className:"w-4 h-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,p.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]})})]}),(0,p.jsxs)("div",{className:"flex flex-wrap gap-4",children:[(0,p.jsx)(b,{status:null!==(s=null===X||void 0===X?void 0:X.intern)&&void 0!==s?s:null,label:"Intern Database",loading:E}),(0,p.jsx)(b,{status:null!==(t=null===X||void 0===X?void 0:X.production)&&void 0!==t?t:null,label:"Production Database",loading:E}),(0,p.jsx)(b,{status:null!==(x=null===B||void 0===B?void 0:B.match)&&void 0!==x?x:null,label:"Schema Versions "+(null!==B&&void 0!==B&&B.match?"Match":"Mismatch"),loading:J})]}),B&&!B.match&&(0,p.jsxs)("div",{className:"mt-4 p-3 bg-warning-50 border border-warning-200 rounded-md",children:[(0,p.jsxs)("p",{className:"text-sm text-warning-800",children:[(0,p.jsx)("strong",{children:"Warning:"})," Schema versions do not match."]}),(0,p.jsxs)("p",{className:"text-xs text-warning-700 mt-1",children:["Intern: ",B.intern||"unknown"," | Production:"," ",B.production||"unknown"]})]}),(null===X||void 0===X?void 0:X.errors)&&X.errors.length>0&&(0,p.jsxs)("div",{className:"mt-4 p-3 bg-error-50 border border-error-200 rounded-md",children:[(0,p.jsx)("p",{className:"text-sm text-error-800 font-medium",children:"Connection
1Errors:"}),(0,p.jsx)("ul",{className:"text-xs text-error-700 mt-1 list-disc list-inside",children:X.errors.map((e,s)=>(0,p.jsx)("li",{children:e},s))})]})]}),(0,p.jsxs)("div",{className:"bg-surface-raised rounded-lg shadow p-6",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,p.jsx)("h2",{className:"text-lg font-semibold text-text",children:"Select Tables to Promote"}),j.size>0&&(0,p.jsxs)("button",{onClick:le,className:"text-sm text-text-subtle hover:text-text-muted",children:["Clear selection (",j.size,")"]})]}),M?(0,p.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,p.jsx)(a.k,{size:"md"}),(0,p.jsx)("span",{className:"ml-2 text-text-subtle",children:"Loading tables..."})]}):(0,p.jsx)("div",{className:"space-y-6",children:m.uV.map(e=>{const s=ee[e]||[];if(0===s.length)return null;const t=s.every(e=>j.has(e.name)),r=s.some(e=>j.has(e.name));return(0,p.jsxs)("div",{className:"border border-border rounded-lg",children:[(0,p.jsx)("div",{className:"flex items-center justify-between px-4 py-3 bg-surface-sunken rounded-t-lg border-b border-border",children:(0,p.jsxs)("div",{className:"flex items-center",children:[(0,p.jsx)("input",{type:"checkbox",checked:t,ref:e=>{e&&(e.indeterminate=r&&!t)},onChange:()=>re(e),className:"h-4 w-4 text-primary-600 rounded border-border-strong focus:ring-primary-500"}),(0,p.jsx)("span",{className:"ml-3 text-sm font-medium text-text",children:m.d4[e]||e}),(0,p.jsxs)("span",{className:"ml-2 text-xs text-text-subtle",children:["(",s.length," tables)"]})]})}),(0,p.jsx)("div",{className:"p-4 grid grid-cols-1 md:grid-cols-2 gap-3",children:s.map(e=>{const s=!!(e.naturalKey&&e.naturalKey.length>0),t=!(!e.syncStatus||e.syncStatus.inSync);return(0,p.jsx)("div",{className:"p-3 rounded-lg border transition-colors "+(j.has(e.name)?"border-primary-500 bg-primary-50":"border-border hover:border-border-strong"),children:(0,p.jsxs)("div",{className:"flex items-start",children:[(0,p.jsx)("input",{type:"checkbox",checked:j.has(e.name),onChange:()=>te(e.name),className:"h-4 w-4 mt-0.5 text-primary-600 rounded border-border-strong focus:ring-primary-500 cursor-pointer"}),(0,p.jsxs)("div",{className:"ml-3 flex-1 min-w-0",children:[(0,p.jsx)("p",{className:"text-sm font-medium text-text truncate",children:e.name}),(0,p.jsx)("p",{className:"text-xs text-text-subtle truncate",children:e.description}),(0,p.jsxs)("div",{className:"mt-2 p-2 bg-surface-sunken rounded text-xs",children:[(0,p.jsxs)("div",{className:"flex items-center gap-4 text-text-muted",children:[(0,p.jsxs)("span",{children:[(0,p.jsx)("span",{className:"text-text-subtle",children:"Intern:"})," ",(0,p.jsx)("span",{className:"font-medium",children:null!==e.actualRowCount&&void 0!==e.actualRowCount?(0,i.ZV)(e.actualRowCount):"-"})]}),(0,p.jsxs)("span",{children:[(0,p.jsx)("span",{className:"text-text-subtle",children:"Prod:"})," ",(0,p.jsx)("span",{className:"font-medium",children:null!==e.prodRowCount&&void 0!==e.prodRowCount?(0,i.ZV)(e.prodRowCount):"-"})]})]}),(0,p.jsxs)("div",{className:"mt-1.5 flex items-center justify-between",children:[(0,p.jsx)(h,{syncStatus:e.syncStatus,hasNaturalKey:s}),t&&(0,p.jsx)("button",{onClick:s=>{s.stopPropagation(),de(e.name)},className:"text-xs text-primary-600 hover:text-primary-800 font-medium",children:"Preview Diff \u2192"})]})]})]})]})},e.name)})})]},e)})})]}),(0,p.jsxs)("div",{className:"bg-surface-raised rounded-lg shadow p-6",children:[(0,p.jsx)("h2",{className:"text-lg font-semibold text-text mb-4",children:"Promotion Options"}),(0,p.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"block text-sm font-medium text-text-muted mb-2",children:"Conflict Strategy"}),(0,p.jsxs)("select",{value:v,onChange:e=>y(e.target.value),className:"w-full px-3 py-2 border border-border-strong rounded-md shadow-sm focus:ring-primary-500 focus:border-primary-500",children:[(0,p.jsx)("option",{value:"upsert",children:"Upsert (Update existing, insert new)"}),(0,p.jsx)("option",{value:"skip",children:"Skip (Only insert new)"}),(0,p.jsx)("option",{value:"overwrite",children:"Overwrite (Delete existing, insert new)"}),(0,p.jsx)("option",{value:"error",children:"Error (Fail on any conflict)"})]}),(0,p.jsx)("p",{className:"mt-1 text-xs text-text-subtle",children:"How to handle records that already exist in production"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"block text-sm font-medium text-text-muted mb-2",children:"Batch Size"}),(0,p.jsx)("input",{type:"number",value:w,onChange:e=>C(Math.max(1,parseInt(e.target.value)||500)),min:1,max:5e3,className:"w-full px-3 py-2 border border-border-strong rounded-md shadow-sm focus:ring-primary-500 focus:border-primary-500"}),(0,p.jsx)("p",{className:"mt-1 text-xs text-text-subtle",children:"Number of rows to process per batch (default: 500)"})]})]})]}),(0,p.jsxs)("div",{className:"bg-surface-raised rounded-lg shadow p-6",children:[(0,p.jsx)("h2",{className:"text-lg font-semibold text-text mb-4",children:"Preview & Execute"}),(0,p.jsxs)("div",{className:"flex flex-wrap gap-3 mb-6",children:[(0,p.jsx)("button",{onClick:ne,disabled:!Y||H,className:"inline-flex items-center px-4 py-2 border border-border-strong rounded-md shadow-sm text-sm font-medium text-text-muted bg-surface-raised hover:bg-surface-sunken disabled:opacity-50 disabled:cursor-not-allowed",children:H?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(n.A,{size:16,className:"animate-spin mr-2"}),"Generating Preview..."]}):"Preview"}),(0,p.jsx)("button",{onClick:ae,disabled:!Y||G,className:"inline-flex items-center px-4 py-2 border border-primary-300 rounded-md shadow-sm text-sm font-medium text-primary-700 bg-primary-50 hover:bg-primary-100 disabled:opacity-50 disabled:cursor-not-allowed",children:G&&!1!==(null===P||void 0===P?void 0:P.dryRun)?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(n.A,{size:16,className:"animate-spin mr-2"}),"Running Dry Run..."]}):"Dry Run"}),(0,p.jsx)("button",{onClick:()=>I(!0),disabled:!Y||G,className:"inline-flex items-center px-4 py-2 border border-transparent roun
1ded-md shadow-sm text-sm font-medium text-white bg-error-600 hover:bg-error-700 disabled:opacity-50 disabled:cursor-not-allowed",children:G&&!1===(null===P||void 0===P?void 0:P.dryRun)?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(n.A,{size:16,className:"animate-spin mr-2"}),"Executing..."]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("span",{className:"mr-2",children:"!"}),"Execute Live"]})})]}),!Y&&(0,p.jsx)("div",{className:"mb-6 p-3 bg-warning-50 border border-warning-200 rounded-md",children:(0,p.jsx)("p",{className:"text-sm text-warning-800",children:Q?"Please select at least one table to promote.":"Cannot promote: One or more database connections are unhealthy."})}),k&&(0,p.jsxs)("div",{className:"mb-6 border border-border rounded-lg",children:[(0,p.jsx)("div",{className:"px-4 py-3 bg-surface-sunken border-b border-border rounded-t-lg",children:(0,p.jsx)("h3",{className:"text-sm font-medium text-text",children:"Promotion Preview"})}),(0,p.jsxs)("div",{className:"p-4",children:[(0,p.jsxs)("div",{className:"mb-4",children:[(0,p.jsx)("p",{className:"text-xs font-medium text-text-subtle uppercase tracking-wider mb-2",children:"Promotion Order"}),(0,p.jsx)("div",{className:"flex flex-wrap gap-2",children:k.promotionOrder.map((e,s)=>(0,p.jsxs)("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-primary-100 text-primary-800",children:[s+1,". ",e]},e))})]}),(0,p.jsxs)("div",{className:"mb-4",children:[(0,p.jsx)("p",{className:"text-xs font-medium text-text-subtle uppercase tracking-wider mb-2",children:"Table Details"}),(0,p.jsx)("div",{className:"overflow-x-auto",children:(0,p.jsxs)("table",{className:"min-w-full divide-y divide-border",children:[(0,p.jsx)("thead",{children:(0,p.jsxs)("tr",{children:[(0,p.jsx)("th",{className:"px-3 py-2 text-left text-xs font-medium text-text-subtle uppercase",children:"Table"}),(0,p.jsx)("th",{className:"px-3 py-2 text-right text-xs font-medium text-text-subtle uppercase",children:"Rows"}),(0,p.jsx)("th",{className:"px-3 py-2 text-right text-xs font-medium text-text-subtle uppercase",children:"Est. Conflicts"}),(0,p.jsx)("th",{className:"px-3 py-2 text-left text-xs font-medium text-text-subtle uppercase",children:"Dependencies"})]})}),(0,p.jsx)("tbody",{className:"divide-y divide-border",children:k.tables.map(e=>(0,p.jsxs)("tr",{children:[(0,p.jsx)("td",{className:"px-3 py-2 text-sm text-text",children:e.name}),(0,p.jsx)("td",{className:"px-3 py-2 text-sm text-text-subtle text-right",children:(0,i.ZV)(e.rowCount)}),(0,p.jsx)("td",{className:"px-3 py-2 text-sm text-text-subtle text-right",children:(0,i.ZV)(e.estimatedConflicts)}),(0,p.jsx)("td",{className:"px-3 py-2 text-sm text-text-subtle",children:e.dependencies.length>0?e.dependencies.join(", "):"-"})]},e.name))})]})})]}),k.warnings.length>0&&(0,p.jsxs)("div",{className:"p-3 bg-warning-50 border border-warning-200 rounded-md",children:[(0,p.jsx)("p",{className:"text-sm font-medium text-warning-800",children:"Warnings:"}),(0,p.jsx)("ul",{className:"text-xs text-warning-700 mt-1 list-disc list-inside",children:k.warnings.map((e,s)=>(0,p.jsx)("li",{children:e},s))})]})]})]}),P&&(0,p.jsxs)("div",{className:"border rounded-lg "+(P.success?"border-success-200":"border-error-200"),children:[(0,p.jsxs)("div",{className:"px-4 py-3 border-b rounded-t-lg flex items-center justify-between "+(P.success?"bg-success-50 border-success-200":"bg-error-50 border-error-200"),children:[(0,p.jsxs)("h3",{className:"text-sm font-medium "+(P.success?"text-success-800":"text-error-800"),children:[P.dryRun?"Dry Run Results":"Promotion Results",P.dryRun&&(0,p.jsx)("span",{className:"ml-2 px-2 py-0.5 text-xs bg-primary-100 text-primary-800 rounded-full",children:"DRY RUN"}),!P.dryRun&&(0,p.jsx)("span",{className:"ml-2 px-2 py-0.5 text-xs bg-error-100 text-error-800 rounded-full",children:"LIVE"})]}),P.promotionId&&(0,p.jsx)(c.N_,{to:`/admin/content-promotion/history?id=${P.promotionId}`,className:"text-xs text-primary-600 hover:text-primary-800",children:"View Details"})]}),(0,p.jsxs)("div",{className:"p-4",children:[(0,p.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[(0,p.jsxs)("div",{className:"text-center p-3 bg-surface-sunken rounded-lg",children:[(0,p.jsx)("p",{className:"text-2xl font-bold text-text",children:P.tablesPromoted.length}),(0,p.jsx)("p",{className:"text-xs text-text-subtle",children:"Tables Promoted"})]}),(0,p.jsxs)("div",{className:"text-center p-3 bg-surface-sunken rounded-lg",children:[(0,p.jsx)("p",{className:"text-2xl font-bold text-text",children:(0,i.ZV)(P.totalRows)}),(0,p.jsx)("p",{className:"text-xs text-text-subtle",children:"Total Rows"})]}),(0,p.jsxs)("div",{className:"text-center p-3 bg-surface-sunken rounded-lg",children:[(0,p.jsxs)("p",{className:"text-2xl font-bold text-text",children:[(P.duration/1e3).toFixed(1),"s"]}),(0,p.jsx)("p",{className:"text-xs text-text-subtle",children:"Duration"})]}),(0,p.jsxs)("div",{className:"text-center p-3 bg-surface-sunken rounded-lg",children:[(0,p.jsx)("p",{className:"text-2xl font-bold "+(P.tablesFailed.length>0?"text-error-600":"text-success-600"),children:P.tablesFailed.length}),(0,p.jsx)("p",{className:"text-xs text-text-subtle",children:"Failed Tables"})]})]}),P.tablesPromoted.length>0&&(0,p.jsxs)("div",{className:"mb-4",children:[(0,p.jsx)("p",{className:"text-xs font-medium text-text-subtle uppercase tracking-wider mb-2",children:"Tables Promoted"}),(0,p.jsx)("div",{className:"flex flex-wrap gap-2",children:P.tablesPromoted.map(e=>(0,p.jsx)("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-success-100 text-success-800",children:e},e))})]}),P.tablesFailed.length>0&&(0,p.jsxs)("div",{className:"mb-4",children:[(0,p.jsx)("p",{className:"text-xs font-medium text-text-subtle uppercase tracking-wider mb-2",children:"Tables Failed"}),(0,p.jsx)("div",{className:"flex flex-wrap gap-2",children:P.tablesFailed.map(e=>(0,p.jsx)("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-error-100 text-error-800",children:e},e))})]}),P.warnings.length>0&&(0,p.jsxs)("div",{className:"mb-4 p-3 bg-warning-50 border border-warning-200 rounded-md",children:[(0,p.jsx)("p",{className:"text-sm font-medium text-warning-800",children:"Warnings:"}),(0,p.jsx)("ul",{className:"text-xs text-warning-700 mt-1 list-disc list-inside",children:P.warnings.map((e,s)=>(0,p.jsx)("li",{children:e},s))})]}),P.errors.length>0&&(0,p.jsxs)("div",{className:"p-3 bg-error-50 border border-error-200 rounded-md",children:[(0,p.jsx)("p",{className:"text-sm font-medium text-error-800",children:"Errors:"}),(0,p.jsx)("ul",{className:"text-xs text-error-700 mt-1 list-disc list-inside",children:P.errors.map((e,s)=>(0,p.jsx)("li",{children:e},s))})]})]})]})]}),(0,p.jsx)(g,{isOpen:_,title:"Confirm Live Promotion",message:(0,p.jsxs)("div",{children:[(0,p.jsxs)("p",{className:"mb-2",children:["You are about to promote"," ",(0,p.jsxs)("strong",{children:[j.size," tables"]})," to production."]}),(0,p.jsxs)("p",{className:"mb-2",children:["Strategy: ",(0,p.jsx)("strong",{children:v})]}),(0,p.jsx)("p",{className:"text-error-600 font-medium",children:"This action will modify the production database. This cannot be easily undone."})]}),confirmLabel:"Execute Live Promotion",confirmVariant:"danger",onConfirm:ie,onCancel:()=>I(!1)}),(0,p.jsx)(f,{isOpen:null!==D,tableName:D||"",preview:F,loading:Z,onClose:oe})]})};t.d(s,["default",0,j])},20909(e,s,t){var r=t(19765);const n=r.J1` 2 query CheckDatabaseHealth { 3 checkDatabaseHealth { 4 success 5 intern 6 production 7 errors 8 } 9 } 10`,a=r.J1` 11 query CompareSchemaVersions { 12 compareSchemaVersions { 13 success 14 intern 15 production 16 match 17 } 18 } 19`,i=r.J1` 20 query GetPromotableTables { 21 getPromotableTables { 22 success 23 totalCount 24 tables { 25 name 26 tier 27 description 28 primaryKey 29 naturalKey 30 defaultConflictStrategy 31 estimatedRowCount 32 actualRowCount 33 prodRowCount 34 syncStatus { 35 inSync 36 newRecords 37 modifiedRecords 38 isEstimated 39 } 40 dependencies { 41 table 42 column 43 required 44 } 45 promotionRules { 46 filter 47 transformations 48 excludeColumns 49 } 50 } 51 error 52 } 53 } 54`,l=r.J1` 55 query GetTableDiffPreview($tableName: String!, $limit: Int) { 56 getTableDiffPreview(tableName: $tableName, limit: $limit) { 57 success 58 preview { 59 tableName 60 hasNaturalKey 61 newRecords 62 modifiedRecords { 63 naturalKey 64 internRecord 65 prodRecord 66 changedFields 67 } 68 totalNewRecords 69 totalModifiedRecords 70 } 71 error 72 } 73 } 74`,d=r.J1` 75 query GetPromotionPreview($tables: [String!]!) { 76 getPromotionPreview(tables: $tables) { 77 tables { 78 name 79 rowCount 80 estimatedConflicts 81 dependencies 82 } 83 promotionOrder 84 warnings 85 } 86 } 87`,o=r.J1` 88 query GetPromotionSession($promotionId: ID!) { 89 getPromotionSession(promotionId: $promotionId) { 90 success 91 session { 92 id 93 promotion_id 94 tables 95 status 96 total_tables 97 completed_tables 98 failed_tables 99 total_rows 100 performed_by 101 started_at 102 completed_at 103 error_summary 104 } 105 error 106 } 107 } 108`,c=r.J1` 109 query GetRecentPromotions($limit: Int) {
110 getRecentPromotions(limit: $limit) { 111 success 112 sessions { 113 id 114 promotion_id 115 tables 116 status 117 total_tables 118 completed_tables 119 failed_tables 120 total_rows 121 performed_by 122 started_at 123 completed_at 124 error_summary 125 } 126 totalCount 127 error 128 } 129 } 130`,m=r.J1` 131 query GetPromotionLogs($promotionId: ID!) { 132 getPromotionLogs(promotionId: $promotionId) { 133 success 134 logs { 135 id 136 promotion_id 137 table_name 138 operation 139 status 140 rows_affected 141 conflict_strategy 142 performed_by 143 started_at 144 completed_at 145 error_message 146 metadata 147 } 148 totalCount 149 error 150 } 151 } 152`,x=r.J1` 153 query GetPromotionReport($promotionId: ID!) { 154 getPromotionReport(promotionId: $promotionId) { 155 success 156 report 157 error 158 } 159 } 160`,u=r.J1` 161 mutation PromoteContent($input: PromoteContentInput!) { 162 promoteContent(input: $input) { 163 success 164 promotionId 165 tablesPromoted 166 tablesFailed 167 totalRows 168 errors 169 warnings 170 dryRun 171 duration 172 } 173 } 174`;t.d(s,["CL",0,a,"Cj",0,d,"Hj",0,l,"JC",0,u,"Qx",0,n,"ZC",0,m,"_z",0,o,"aW",0,x,"d4",0,{foundation:"Foundation (Tags, Exam Types)",core:"Core Content (Problems, Problem Sets)",learning:"Learning Hub (Modules, Paths)",config:"Configuration (Feature Flags, Plans)"},"i1",0,c,"ne",0,i,"uV",0,["foundation","core","learning","config"]])}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.