planche 0.8.6 → 0.8.8

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.
Files changed (72) hide show
  1. package/app/assets/{B-yXhF3b.js → 40YxirOy.js} +1 -1
  2. package/app/assets/4_c4BD6i.js +1 -0
  3. package/app/assets/{DyJPwVZe.js → 8DjNs_2Q.js} +1 -1
  4. package/app/assets/{NYrZ_KG4.js → 9U3RO0MO.js} +1 -1
  5. package/app/assets/9YYClKHB.js +1 -0
  6. package/app/assets/AiAiN2FW.js +2 -0
  7. package/app/assets/{DTxGpkJp.js → B3nhMsGp.js} +1 -1
  8. package/app/assets/{BM_rLXLv.js → B7ofUN9Z.js} +1 -1
  9. package/app/assets/BFDfeOJg.js +2 -0
  10. package/app/assets/BNkgLUl5.js +1 -0
  11. package/app/assets/BVrYyQUV.js +1 -0
  12. package/app/assets/B_UAjgBr.js +959 -0
  13. package/app/assets/Baj0YiGk.js +1 -0
  14. package/app/assets/{C1RY7wUM.js → BfSKVZnY.js} +1 -1
  15. package/app/assets/{vKCvRvxP.js → BjlaUaDI.js} +1 -1
  16. package/app/assets/{BuiqFOkR.js → BteHmqJi.js} +1 -1
  17. package/app/assets/{CAHFhps_.js → BwrB7xZ-.js} +2 -2
  18. package/app/assets/BxdVjvjj.js +2 -0
  19. package/app/assets/Bz1cma8F.js +1 -0
  20. package/app/assets/C5SHWmPn.js +2 -0
  21. package/app/assets/{B3UjY7jq.js → C8pwHENI.js} +1 -1
  22. package/app/assets/{CnOZTyPx.js → CCQZjXae.js} +2 -2
  23. package/app/assets/{DtU_PUOl.js → CCcRP83D.js} +1 -1
  24. package/app/assets/{B1mA7CRG.js → CFzRFS2A.js} +1 -1
  25. package/app/assets/{Bxa5htLS.js → CKDAL3sp.js} +1 -1
  26. package/app/assets/COkWw8gt.js +1 -0
  27. package/app/assets/{BgDlbKXF.js → COuEjUso.js} +1 -1
  28. package/app/assets/CQLuUHsS.js +2 -0
  29. package/app/assets/CRr_nYUE.js +2 -0
  30. package/app/assets/CYAMmigV.js +1 -0
  31. package/app/assets/{BdPEUnLq.js → Ca4g4XbM.js} +1 -1
  32. package/app/assets/{2rC1LDx2.js → CcgrsKRV.js} +1 -1
  33. package/app/assets/{CfsL8_WC.js → CgWXabLX.js} +1 -1
  34. package/app/assets/{XlrBcEaO.js → Cni8dWDa.js} +1 -1
  35. package/app/assets/{YjhzJVQZ.js → CoElGuoC.js} +2 -2
  36. package/app/assets/{DbRMSZEW.js → Cr6Fx4T5.js} +1 -1
  37. package/app/assets/{Cw_LYT6k.js → CtXRSNHU.js} +1 -1
  38. package/app/assets/CytzrZ6l.js +1 -0
  39. package/app/assets/{Cd_45PFU.js → D7TzN7zW.js} +1 -1
  40. package/app/assets/{BM5G_YA7.js → D8QuNkWm.js} +1 -1
  41. package/app/assets/{DsAlsNTl.js → DUi2bIfW.js} +1 -1
  42. package/app/assets/{DKjjOKsl.js → Dc-epzIX.js} +1 -1
  43. package/app/assets/{ohBkXlZt.js → DmnLfXty.js} +1 -1
  44. package/app/assets/{Bm1X7uTX.js → DnMHkY8_.js} +2 -2
  45. package/app/assets/{B4JrGAXR.js → DouS7NHO.js} +1 -1
  46. package/app/assets/{pp1UmAJW.js → DprcmWG4.js} +1 -1
  47. package/app/assets/{Cl5bGhXD.js → HtYgLQZp.js} +1 -1
  48. package/app/assets/{CQieSTGh.js → KZSCUzXE.js} +1 -1
  49. package/app/assets/MJ9qDdN_.css +2 -0
  50. package/app/assets/{D-RWduy5.js → RCiVSH3E.js} +1 -1
  51. package/app/assets/{CPgI8it1.js → ZjgMfDAG.js} +1 -1
  52. package/app/assets/{ClyAuDY9.js → fDSXGLmI.js} +2 -2
  53. package/app/assets/xc6SHidZ.js +1 -0
  54. package/app/assets/{BluggY4N.js → zrrdltej.js} +1 -1
  55. package/app/index.html +16 -14
  56. package/package.json +1 -1
  57. package/app/assets/B1lNzsWx.js +0 -959
  58. package/app/assets/B3LyCSVJ.js +0 -1
  59. package/app/assets/BGIwW6nZ.js +0 -1
  60. package/app/assets/BP4mxS6-.js +0 -1
  61. package/app/assets/BV9jV2YU.js +0 -1
  62. package/app/assets/BXX-BtBa.js +0 -2
  63. package/app/assets/BziT-o8V.js +0 -2
  64. package/app/assets/CB6XKkDn.js +0 -1
  65. package/app/assets/CChaTOPr.js +0 -1
  66. package/app/assets/CFQ-2DAt.js +0 -2
  67. package/app/assets/CWY0kZPK.js +0 -2
  68. package/app/assets/D3Eb1tV7.css +0 -2
  69. package/app/assets/D8nrOvmh.js +0 -2
  70. package/app/assets/bDuhhOB6.js +0 -1
  71. package/app/assets/mSiUHQYe.js +0 -1
  72. package/app/assets/u80owQsI.js +0 -2
@@ -0,0 +1 @@
1
+ import{r as e}from"./hePW80VL.js";import{c as t,h as n,n as r,t as i}from"./XzPc-eVf.js";import{l as a,m as ee,t as o}from"./CKOS5Y-e.js";import{a as s,i as c,n as l,r as u,t as d}from"./Bz1cma8F.js";import{t as f}from"./B3nhMsGp.js";import{a as p}from"./CtXRSNHU.js";import{n as m}from"./Cr6Fx4T5.js";import{a as h,d as te}from"./CCQZjXae.js";import{c as g,kt as _,l as ne,lt as re,mt as ie,ot as v}from"./B_UAjgBr.js";import{a as ae,i as oe,n as se,o as ce,r as le,t as y}from"./DxuXBECK.js";var b=e(n(),1),ue=[`SUM`,`AVG`,`MIN`,`MAX`],x=`row_count`;function de(e,t){if(t.columns.length===0)return``;let n=t=>e.quoteIdentifier(t),r=t.columns.map(n),i=[...r,`COUNT(*) AS ${n(x)}`];if(t.aggregate){let{fn:e,column:r}=t.aggregate;i.push(`${e}(${n(r)}) AS ${n(`${e.toLowerCase()}_${r}`)}`)}let a=[];return t.where&&a.push(t.where),a.push(`GROUP BY ${r.join(`, `)}`),t.minCount&&t.minCount>1&&a.push(`HAVING COUNT(*) >= ${Math.floor(t.minCount)}`),a.push(`ORDER BY COUNT(*) DESC`),t.limit>0&&a.push(e.limitClause(t.limit)),e.getQuery(`SELECT_TABLE`,t.database,t.table,i.join(`, `),a.join(` `))}function S(e){let t=new Set;for(let n of e){let e=n.columns[0];e&&t.add(e.toLowerCase())}return t}function C(e,t){return t.has(e.toLowerCase())}function fe(e,t){let n=S(t);return e.some(e=>C(e,n))}var w=a(),T=`none`,pe=/\b(int|dec|numeric|number|float|double|real|money|serial)/i;function E(){let{t:e}=ee(),n=r(e=>e.activeDialog),a=r(e=>e.closeDialog),x=i(`group-by`),E=n===`group-by`,D=f(e=>e.activeConnections),me=f(e=>e.activeConnectionId),he=(0,b.useMemo)(()=>D.filter(e=>e.serverConnectionId),[D]),[O,ge]=(0,b.useState)(()=>x?.connectionId??me??``),[k,A]=(0,b.useState)(()=>x?.database??``),[j,M]=(0,b.useState)(()=>x?.table??``),[N,P]=(0,b.useState)([]),[F,I]=(0,b.useState)([]),L=x&&O===x.connectionId&&k===x.database&&j===x.table?x.where??``:``,[R,z]=(0,b.useState)([]),[B,_e]=(0,b.useState)([]),[V,H]=(0,b.useState)(()=>x?.column?[x.column]:[]),[U,ve]=(0,b.useState)(T),[W,ye]=(0,b.useState)(``),[G,be]=(0,b.useState)(`1`),[K,xe]=(0,b.useState)(!0),[q,J]=(0,b.useState)(``),[Se,Y]=(0,b.useState)(!1),X=e=>f.getState().activeConnections.find(t=>t.id===e)?.serverConnectionId;(0,b.useEffect)(()=>{if(!E||!O)return;let e=X(O);if(!e)return;let t=!1;return(async()=>{try{let n=await m(O).introspect.listDatabases(p(e));if(t)return;P(n),A(e=>e&&n.includes(e)?e:n[0]??``)}catch(e){t||J(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[E,O]),(0,b.useEffect)(()=>{if(!E||!O||!k)return;let e=X(O);if(!e)return;let t=!1;return(async()=>{try{let n=await m(O).introspect.listTables(p(e),k);if(t)return;let r=n.map(e=>e.name);I(r),M(e=>e&&r.includes(e)?e:r[0]??``)}catch(e){t||J(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[E,O,k]),(0,b.useEffect)(()=>{if(!E||!O||!j)return;let e=X(O);if(!e)return;let t=!1;return(async()=>{let n=p(e),r=m(O).introspect;try{let[e,i]=await Promise.all([r.listColumns(n,k,j),r.listIndexes(n,k,j).catch(()=>[])]);if(t)return;z(e),_e(i),H(t=>t.filter(t=>e.some(e=>e.name===t)))}catch(e){t||J(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[E,O,k,j]);let Ce=(0,b.useMemo)(()=>S(B),[B]),we=(0,b.useMemo)(()=>R.filter(e=>pe.test(e.type)),[R]),Z=(0,b.useMemo)(()=>!O||V.length===0?``:de(m(O),{database:k,table:j,columns:V,aggregate:U!==T&&W?{fn:U,column:W}:null,where:K?L:``,minCount:Number(G)||1,limit:te()}),[O,k,j,V,U,W,G,K,L]),Q=V.length>0&&B.length>0&&!fe(V,B);function Te(e){H(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function $(e){t(`group_by`,{action:e,dbms:m(O).id,columns:V.length,aggregate:U,filtered:!!(K&&L),indexed:!Q})}function Ee(){Z&&($(`open`),v(O,Z,k,e(`database.groupBy.tabTitle`,{table:j})),a())}async function De(){if(!Z)return;$(`run`),Y(!0);let t=v(O,Z,k,e(`database.groupBy.tabTitle`,{table:j}));a();try{await h(O,t)}finally{Y(!1)}}return(0,w.jsx)(y,{open:E,onOpenChange:e=>{e||a()},children:(0,w.jsxs)(se,{className:`flex max-h-[85vh] flex-col sm:max-w-[720px]`,children:[(0,w.jsxs)(ae,{children:[(0,w.jsx)(ce,{children:e(`database.groupBy.title`)}),(0,w.jsx)(le,{children:e(`database.groupBy.description`,{table:j})})]}),q&&(0,w.jsx)(`p`,{className:`rounded-md border border-destructive/40 px-3 py-2 text-xs text-destructive`,children:q}),(0,w.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,w.jsxs)(`div`,{className:`space-y-1`,children:[(0,w.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.connection`)}),(0,w.jsxs)(d,{value:O,onValueChange:ge,children:[(0,w.jsx)(c,{className:`h-8 text-xs`,children:(0,w.jsx)(s,{})}),(0,w.jsx)(l,{children:he.map(e=>(0,w.jsx)(u,{value:e.id,children:e.hostName||e.host||e.file||e.id},e.id))})]})]}),(0,w.jsxs)(`div`,{className:`space-y-1`,children:[(0,w.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.database`)}),(0,w.jsxs)(d,{value:k,onValueChange:A,children:[(0,w.jsx)(c,{className:`h-8 text-xs`,children:(0,w.jsx)(s,{})}),(0,w.jsx)(l,{children:N.map(e=>(0,w.jsx)(u,{value:e,children:e},e))})]})]}),(0,w.jsxs)(`div`,{className:`space-y-1`,children:[(0,w.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.table`)}),(0,w.jsxs)(d,{value:j,onValueChange:M,children:[(0,w.jsx)(c,{className:`h-8 text-xs`,children:(0,w.jsx)(s,{})}),(0,w.jsx)(l,{children:F.map(e=>(0,w.jsx)(u,{value:e,children:e},e))})]})]})]}),(0,w.jsxs)(`div`,{className:`grid min-h-0 grid-cols-[1fr_1fr] gap-4`,children:[(0,w.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-1.5`,children:[(0,w.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.columns`)}),(0,w.jsx)(re,{className:`h-[260px] rounded-md border`,children:(0,w.jsx)(`ul`,{className:`p-1`,children:R.map(t=>{let n=C(t.name,Ce);return(0,w.jsx)(`li`,{children:(0,w.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded px-2 py-1 text-xs hover:bg-accent`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:V.includes(t.name),onChange:()=>Te(t.name)}),(0,w.jsx)(`span`,{className:`truncate font-medium`,children:t.name}),(0,w.jsx)(`span`,{className:`truncate text-muted-foreground`,children:t.type}),n&&(0,w.jsx)(_,{className:`ml-auto h-3 w-3 shrink-0 text-muted-foreground`,"aria-label":e(`database.groupBy.indexed`)})]})},t.name)})})})]}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,w.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,w.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.aggregate`)}),(0,w.jsxs)(`div`,{className:`flex gap-2`,children:[(0,w.jsxs)(d,{value:U,onValueChange:ve,children:[(0,w.jsx)(c,{className:`h-8 w-[110px] text-xs`,children:(0,w.jsx)(s,{})}),(0,w.jsxs)(l,{children:[(0,w.jsx)(u,{value:T,children:e(`database.groupBy.countOnly`)}),ue.map(e=>(0,w.jsx)(u,{value:e,children:e},e))]})]}),(0,w.jsxs)(d,{value:W,onValueChange:ye,disabled:U===T,children:[(0,w.jsx)(c,{className:`h-8 flex-1 text-xs`,children:(0,w.jsx)(s,{placeholder:e(`database.groupBy.column`)})}),(0,w.jsx)(l,{children:we.map(e=>(0,w.jsx)(u,{value:e.name,children:e.name},e.name))})]})]})]}),(0,w.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,w.jsx)(g,{htmlFor:`gb-min`,className:`text-xs`,children:e(`database.groupBy.minCount`)}),(0,w.jsx)(ne,{id:`gb-min`,type:`number`,min:1,value:G,onChange:e=>be(e.target.value),className:`h-8 text-xs`})]}),L&&(0,w.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:K,onChange:e=>xe(e.target.checked)}),e(`database.groupBy.useFilter`)]}),Q&&(0,w.jsxs)(`p`,{className:`flex gap-1.5 rounded-md border border-dashed px-2 py-1.5 text-xs text-muted-foreground`,children:[(0,w.jsx)(ie,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,w.jsx)(`span`,{children:e(`database.groupBy.noIndexWarning`)})]})]})]}),(0,w.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,w.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.preview`)}),(0,w.jsx)(`pre`,{className:`max-h-[120px] overflow-auto rounded-md border bg-muted p-2 font-mono text-xs whitespace-pre-wrap`,children:Z||e(`database.groupBy.pickColumn`)})]}),(0,w.jsxs)(oe,{children:[(0,w.jsx)(o,{variant:`outline`,onClick:a,children:e(`command.close`)}),(0,w.jsx)(o,{variant:`outline`,onClick:Ee,disabled:!Z,children:e(`database.groupBy.openInTab`)}),(0,w.jsx)(o,{onClick:De,disabled:!Z||Se,children:e(`database.groupBy.run`)})]})]})})}export{E as GroupByDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{c as t,h as n,n as r,t as i}from"./XzPc-eVf.js";import{l as a,m as o,t as s}from"./CKOS5Y-e.js";import{a as c,i as l,n as u,r as d,t as f}from"./BGIwW6nZ.js";import{t as p}from"./DTxGpkJp.js";import{a as m}from"./Cw_LYT6k.js";import{n as h}from"./DbRMSZEW.js";import{t as ee}from"./B3LyCSVJ.js";import{J as g,Y as _,c as v,l as y}from"./B1lNzsWx.js";import{a as b,i as x,n as S,o as C,t as w}from"./DxuXBECK.js";var T=e(n(),1),E=a(),D=e=>e instanceof Error?e.message:String(e);function O(){let{t:e}=o(),n=r(e=>e.activeDialog),a=r(e=>e.closeDialog),O=i(`link-column`),k=n===`link-column`&&!!O,A=O?.connectionId??``,j=p(e=>e.activeConnections),M=j.filter(e=>e.serverConnectionId),N=_(e=>e.links),P=_(e=>e.setLink),F=_(e=>e.removeLink),I=O?g(N,A,O.database,O.table).find(e=>e.column===O.column)??null:null,[L,R]=(0,T.useState)(I?.targetConnectionId??A),z=j.find(e=>e.id===L)?.serverConnectionId,[B,V]=(0,T.useState)([]),[H,U]=(0,T.useState)([]),[W,G]=(0,T.useState)([]),[K,q]=(0,T.useState)(I?.targetDatabase??O?.database??``),[J,Y]=(0,T.useState)(I?.targetTable??``),[X,Z]=(0,T.useState)(I?.targetColumn??``),[Q,$]=(0,T.useState)(null);if((0,T.useEffect)(()=>{if(!k||!z)return;let e=!1;return(async()=>{try{let t=await h(L).introspect.listDatabases(m(z));if(e)return;V(t),q(e=>t.includes(e)?e:t[0]??``)}catch(t){e||$(D(t))}})(),()=>{e=!0}},[k,z,L]),(0,T.useEffect)(()=>{if(!k||!z||!K)return;let e=!1;return(async()=>{try{let t=await h(L).introspect.listTables(m(z),K);if(e)return;U(t.map(e=>e.name))}catch(t){e||$(D(t))}})(),()=>{e=!0}},[k,z,L,K]),(0,T.useEffect)(()=>{if(!k||!z||!K||!J)return;let e=!1;return(async()=>{try{let t=await h(L).introspect.listColumns(m(z),K,J);if(e)return;G(t.map(e=>e.name)),Z(e=>t.some(t=>t.name===e)?e:t.find(e=>e.key===`PRI`)?.name??t[0]?.name??``)}catch(t){e||$(D(t))}})(),()=>{e=!0}},[k,z,L,K,J]),!O)return null;function te(){if(!O||!K||!J||!X)return;let e=L!==A;P(A,{database:O.database,table:O.table,column:O.column,...e?{targetConnectionId:L}:{},targetDatabase:K,targetTable:J,targetColumn:X}),ee(`column_link`),t(`column_link_set`,{dbms:h(A).id,target_dbms:h(L).id,cross_database:K!==O.database,cross_connection:e}),a()}function ne(){O&&(F(A,O),a())}return(0,E.jsx)(w,{open:k,onOpenChange:e=>{e||a()},children:(0,E.jsxs)(S,{className:`sm:max-w-[460px]`,children:[(0,E.jsx)(b,{children:(0,E.jsx)(C,{children:e(`result.link.title`)})}),(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{children:e(`result.link.source`)}),(0,E.jsx)(y,{value:`${O.database}.${O.table}.${O.column}`,disabled:!0})]}),(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`result.link.hint`)}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-conn`,children:e(`result.link.targetConnection`)}),(0,E.jsxs)(f,{value:L,onValueChange:e=>{R(e),Y(``),U([]),G([])},children:[(0,E.jsx)(l,{id:`link-conn`,className:`w-full`,children:(0,E.jsx)(c,{})}),(0,E.jsx)(u,{children:M.map(e=>(0,E.jsx)(d,{value:e.id,children:e.hostName||e.host||e.file||e.id},e.id))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-db`,children:e(`result.link.targetDatabase`)}),(0,E.jsxs)(f,{value:K,onValueChange:e=>{q(e),Y(``),G([])},children:[(0,E.jsx)(l,{id:`link-db`,className:`w-full`,children:(0,E.jsx)(c,{})}),(0,E.jsx)(u,{children:B.map(e=>(0,E.jsx)(d,{value:e,children:e},e))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-table`,children:e(`result.link.targetTable`)}),(0,E.jsxs)(f,{value:J,onValueChange:Y,disabled:H.length===0,children:[(0,E.jsx)(l,{id:`link-table`,className:`w-full`,children:(0,E.jsx)(c,{placeholder:e(`result.link.pickTable`)})}),(0,E.jsx)(u,{children:H.map(e=>(0,E.jsx)(d,{value:e,children:e},e))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-column`,children:e(`result.link.targetColumn`)}),(0,E.jsxs)(f,{value:X,onValueChange:Z,disabled:W.length===0,children:[(0,E.jsx)(l,{id:`link-column`,className:`w-full`,children:(0,E.jsx)(c,{placeholder:e(`result.link.pickColumn`)})}),(0,E.jsx)(u,{children:W.map(e=>(0,E.jsx)(d,{value:e,children:e},e))})]})]}),Q&&(0,E.jsx)(`p`,{className:`text-xs text-destructive`,children:Q})]}),(0,E.jsxs)(x,{children:[I&&(0,E.jsx)(s,{variant:`destructive`,onClick:ne,className:`mr-auto`,children:e(`result.link.remove`)}),(0,E.jsx)(s,{variant:`outline`,onClick:a,children:e(`result.link.cancel`)}),(0,E.jsx)(s,{onClick:te,disabled:!K||!J||!X,children:e(`result.link.save`)})]})]})})}export{O as LinkColumnDialog};
1
+ import{r as e}from"./hePW80VL.js";import{c as t,h as n,n as r,t as i}from"./XzPc-eVf.js";import{l as a,m as o,t as s}from"./CKOS5Y-e.js";import{a as c,i as l,n as u,r as d,t as f}from"./Bz1cma8F.js";import{t as p}from"./B3nhMsGp.js";import{a as m}from"./CtXRSNHU.js";import{n as h}from"./Cr6Fx4T5.js";import{t as ee}from"./4_c4BD6i.js";import{X as g,Y as _,c as v,l as y}from"./B_UAjgBr.js";import{a as b,i as x,n as S,o as C,t as w}from"./DxuXBECK.js";var T=e(n(),1),E=a(),D=e=>e instanceof Error?e.message:String(e);function O(){let{t:e}=o(),n=r(e=>e.activeDialog),a=r(e=>e.closeDialog),O=i(`link-column`),k=n===`link-column`&&!!O,A=O?.connectionId??``,j=p(e=>e.activeConnections),M=j.filter(e=>e.serverConnectionId),N=g(e=>e.links),P=g(e=>e.setLink),F=g(e=>e.removeLink),I=O?_(N,A,O.database,O.table).find(e=>e.column===O.column)??null:null,[L,R]=(0,T.useState)(I?.targetConnectionId??A),z=j.find(e=>e.id===L)?.serverConnectionId,[B,V]=(0,T.useState)([]),[H,U]=(0,T.useState)([]),[W,G]=(0,T.useState)([]),[K,q]=(0,T.useState)(I?.targetDatabase??O?.database??``),[J,Y]=(0,T.useState)(I?.targetTable??``),[X,Z]=(0,T.useState)(I?.targetColumn??``),[Q,$]=(0,T.useState)(null);if((0,T.useEffect)(()=>{if(!k||!z)return;let e=!1;return(async()=>{try{let t=await h(L).introspect.listDatabases(m(z));if(e)return;V(t),q(e=>t.includes(e)?e:t[0]??``)}catch(t){e||$(D(t))}})(),()=>{e=!0}},[k,z,L]),(0,T.useEffect)(()=>{if(!k||!z||!K)return;let e=!1;return(async()=>{try{let t=await h(L).introspect.listTables(m(z),K);if(e)return;U(t.map(e=>e.name))}catch(t){e||$(D(t))}})(),()=>{e=!0}},[k,z,L,K]),(0,T.useEffect)(()=>{if(!k||!z||!K||!J)return;let e=!1;return(async()=>{try{let t=await h(L).introspect.listColumns(m(z),K,J);if(e)return;G(t.map(e=>e.name)),Z(e=>t.some(t=>t.name===e)?e:t.find(e=>e.key===`PRI`)?.name??t[0]?.name??``)}catch(t){e||$(D(t))}})(),()=>{e=!0}},[k,z,L,K,J]),!O)return null;function te(){if(!O||!K||!J||!X)return;let e=L!==A;P(A,{database:O.database,table:O.table,column:O.column,...e?{targetConnectionId:L}:{},targetDatabase:K,targetTable:J,targetColumn:X}),ee(`column_link`),t(`column_link_set`,{dbms:h(A).id,target_dbms:h(L).id,cross_database:K!==O.database,cross_connection:e}),a()}function ne(){O&&(F(A,O),a())}return(0,E.jsx)(w,{open:k,onOpenChange:e=>{e||a()},children:(0,E.jsxs)(S,{className:`sm:max-w-[460px]`,children:[(0,E.jsx)(b,{children:(0,E.jsx)(C,{children:e(`result.link.title`)})}),(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{children:e(`result.link.source`)}),(0,E.jsx)(y,{value:`${O.database}.${O.table}.${O.column}`,disabled:!0})]}),(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`result.link.hint`)}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-conn`,children:e(`result.link.targetConnection`)}),(0,E.jsxs)(f,{value:L,onValueChange:e=>{R(e),Y(``),U([]),G([])},children:[(0,E.jsx)(l,{id:`link-conn`,className:`w-full`,children:(0,E.jsx)(c,{})}),(0,E.jsx)(u,{children:M.map(e=>(0,E.jsx)(d,{value:e.id,children:e.hostName||e.host||e.file||e.id},e.id))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-db`,children:e(`result.link.targetDatabase`)}),(0,E.jsxs)(f,{value:K,onValueChange:e=>{q(e),Y(``),G([])},children:[(0,E.jsx)(l,{id:`link-db`,className:`w-full`,children:(0,E.jsx)(c,{})}),(0,E.jsx)(u,{children:B.map(e=>(0,E.jsx)(d,{value:e,children:e},e))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-table`,children:e(`result.link.targetTable`)}),(0,E.jsxs)(f,{value:J,onValueChange:Y,disabled:H.length===0,children:[(0,E.jsx)(l,{id:`link-table`,className:`w-full`,children:(0,E.jsx)(c,{placeholder:e(`result.link.pickTable`)})}),(0,E.jsx)(u,{children:H.map(e=>(0,E.jsx)(d,{value:e,children:e},e))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-column`,children:e(`result.link.targetColumn`)}),(0,E.jsxs)(f,{value:X,onValueChange:Z,disabled:W.length===0,children:[(0,E.jsx)(l,{id:`link-column`,className:`w-full`,children:(0,E.jsx)(c,{placeholder:e(`result.link.pickColumn`)})}),(0,E.jsx)(u,{children:W.map(e=>(0,E.jsx)(d,{value:e,children:e},e))})]})]}),Q&&(0,E.jsx)(`p`,{className:`text-xs text-destructive`,children:Q})]}),(0,E.jsxs)(x,{children:[I&&(0,E.jsx)(s,{variant:`destructive`,onClick:ne,className:`mr-auto`,children:e(`result.link.remove`)}),(0,E.jsx)(s,{variant:`outline`,onClick:a,children:e(`result.link.cancel`)}),(0,E.jsx)(s,{onClick:te,disabled:!K||!J||!X,children:e(`result.link.save`)})]})]})})}export{O as LinkColumnDialog};
package/app/index.html CHANGED
@@ -50,28 +50,30 @@
50
50
  "offers": { "@type": "Offer", "price": "0", "priceCurrency": "USD" }
51
51
  }
52
52
  </script>
53
- <script type="module" crossorigin src="/assets/B1lNzsWx.js"></script>
53
+ <script type="module" crossorigin src="/assets/B_UAjgBr.js"></script>
54
54
  <link rel="modulepreload" crossorigin href="/assets/hePW80VL.js">
55
55
  <link rel="modulepreload" crossorigin href="/assets/XzPc-eVf.js">
56
56
  <link rel="modulepreload" crossorigin href="/assets/CKOS5Y-e.js">
57
- <link rel="modulepreload" crossorigin href="/assets/ClyAuDY9.js">
57
+ <link rel="modulepreload" crossorigin href="/assets/fDSXGLmI.js">
58
58
  <link rel="modulepreload" crossorigin href="/assets/CZQ1r4zz.js">
59
+ <link rel="modulepreload" crossorigin href="/assets/CytzrZ6l.js">
60
+ <link rel="modulepreload" crossorigin href="/assets/BVrYyQUV.js">
59
61
  <link rel="modulepreload" crossorigin href="/assets/eFSiW0Lh.js">
60
62
  <link rel="modulepreload" crossorigin href="/assets/BBSxV90W.js">
61
- <link rel="modulepreload" crossorigin href="/assets/DTxGpkJp.js">
63
+ <link rel="modulepreload" crossorigin href="/assets/B3nhMsGp.js">
62
64
  <link rel="modulepreload" crossorigin href="/assets/Bit0Kfog.js">
63
- <link rel="modulepreload" crossorigin href="/assets/BdPEUnLq.js">
64
- <link rel="modulepreload" crossorigin href="/assets/CChaTOPr.js">
65
- <link rel="modulepreload" crossorigin href="/assets/Cw_LYT6k.js">
66
- <link rel="modulepreload" crossorigin href="/assets/C1RY7wUM.js">
67
- <link rel="modulepreload" crossorigin href="/assets/DbRMSZEW.js">
65
+ <link rel="modulepreload" crossorigin href="/assets/Ca4g4XbM.js">
66
+ <link rel="modulepreload" crossorigin href="/assets/BNkgLUl5.js">
67
+ <link rel="modulepreload" crossorigin href="/assets/CtXRSNHU.js">
68
+ <link rel="modulepreload" crossorigin href="/assets/BfSKVZnY.js">
69
+ <link rel="modulepreload" crossorigin href="/assets/Cr6Fx4T5.js">
68
70
  <link rel="modulepreload" crossorigin href="/assets/DAFA-E1-.js">
69
- <link rel="modulepreload" crossorigin href="/assets/BM5G_YA7.js">
70
- <link rel="modulepreload" crossorigin href="/assets/CfsL8_WC.js">
71
- <link rel="modulepreload" crossorigin href="/assets/CnOZTyPx.js">
72
- <link rel="modulepreload" crossorigin href="/assets/B3LyCSVJ.js">
71
+ <link rel="modulepreload" crossorigin href="/assets/D8QuNkWm.js">
72
+ <link rel="modulepreload" crossorigin href="/assets/CgWXabLX.js">
73
+ <link rel="modulepreload" crossorigin href="/assets/CCQZjXae.js">
74
+ <link rel="modulepreload" crossorigin href="/assets/4_c4BD6i.js">
73
75
  <link rel="modulepreload" crossorigin href="/assets/Bs5VSn0X.js">
74
- <link rel="stylesheet" crossorigin href="/assets/D3Eb1tV7.css">
76
+ <link rel="stylesheet" crossorigin href="/assets/MJ9qDdN_.css">
75
77
  </head>
76
78
  <body>
77
79
  <div id="boot">Loading…</div>
@@ -114,7 +116,7 @@
114
116
  <li>Schema browser: databases, tables, views, columns, indexes, procedures, users</li>
115
117
  <li>ERD viewer generated from foreign keys</li>
116
118
  <li>Query history, local snapshots, read-only and production guard rails</li>
117
- <li>SSH tunnels, multiple connections, nine color themes</li>
119
+ <li>SSH tunnels, multiple connections, twelve color themes</li>
118
120
  </ul>
119
121
 
120
122
  <h2>How it connects</h2>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "planche",
3
- "version": "0.8.6",
3
+ "version": "0.8.8",
4
4
  "description": "Local agent for Planche — lets the browser-based Planche SQL client reach MySQL/MariaDB/PostgreSQL/SQLite/SQL Server/Oracle/Neon/Supabase/Cloudflare D1 databases and local Durable Object storage from your machine.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://planche.dev",