planche 0.7.5 → 0.7.6
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/app/assets/{AboutDialog-BaS5xq_x.js → AboutDialog-DNnLylHg.js} +1 -1
- package/app/assets/{ConnectDialog-ZUCnL4bj.js → ConnectDialog-Bu2hPwDR.js} +1 -1
- package/app/assets/{CopyDatabaseDialog-CkaobagW.js → CopyDatabaseDialog-ChOc_aHQ.js} +1 -1
- package/app/assets/{CopyTableDialog-1-3dQLYK.js → CopyTableDialog-DnuH4LY7.js} +1 -1
- package/app/assets/{CreateDatabaseDialog-SYsBnCht.js → CreateDatabaseDialog-DxJWfyxB.js} +1 -1
- package/app/assets/{DataDiffDialog-DT_hUXsd.js → DataDiffDialog-Cn-eGt63.js} +1 -1
- package/app/assets/{DownloadToCSVDialog-C58OTVYu.js → DownloadToCSVDialog-DOj_AAnH.js} +1 -1
- package/app/assets/{EditSchemaDialog-Ydwc-Ds9.js → EditSchemaDialog-UhHglHzS.js} +1 -1
- package/app/assets/{FindReplaceDialog-DVdNhHDh.js → FindReplaceDialog-DYEerBXx.js} +1 -1
- package/app/assets/{LinkColumnDialog-Chvm6KVD.js → LinkColumnDialog-DbBY5TGQ.js} +1 -1
- package/app/assets/{LocalHistoryDialog-DO47tkuA.js → LocalHistoryDialog-Nojvlhmz.js} +1 -1
- package/app/assets/{ProcessListDialog-Lpkbgpf1.js → ProcessListDialog-C460XY2M.js} +1 -1
- package/app/assets/{QuickCommandPalette-BAYvbmWb.js → QuickCommandPalette-Crdl1lBX.js} +1 -1
- package/app/assets/{RowFormDialog-BhFX6UZq.js → RowFormDialog-A8wtwTwI.js} +1 -1
- package/app/assets/{SafetySettingsDialog-DD-AYrfv.js → SafetySettingsDialog-Mny69ZOZ.js} +1 -1
- package/app/assets/{SchemaDiffDialog-DVvYQfd2.js → SchemaDiffDialog-Bv_hurif.js} +1 -1
- package/app/assets/{SchemaToHTMLDialog-DcMj-dIv.js → SchemaToHTMLDialog-BBskyW7d.js} +1 -1
- package/app/assets/{StatusDialog-wl52QHHA.js → StatusDialog-C46oDW7W.js} +1 -1
- package/app/assets/{UserAddDialog-Coy-2Qgv.js → UserAddDialog-DeXw9R9S.js} +1 -1
- package/app/assets/{UserManagerDialog-CvcVgqnz.js → UserManagerDialog-DVESBSWa.js} +1 -1
- package/app/assets/{VariablesDialog-CUHC6xfE.js → VariablesDialog-BrHFb0LI.js} +1 -1
- package/app/assets/{main-DKu07NSI.js → main-DEK4mnDt.js} +9 -9
- package/app/assets/{query-execution-VhGYqNWO.js → query-execution-DItl2TUQ.js} +2 -2
- package/app/assets/{select-UnuDE6HR.js → select-BoGTNqvN.js} +1 -1
- package/app/assets/{table-copy-THBtnGGd.js → table-copy-DXLY7yKq.js} +1 -1
- package/app/index.html +3 -3
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,m as t,n,t as r}from"./ui-store-DWSBgCoR.js";import{Q as i,Z as a,f as o,h as s,m as c,nt as l,ot as u,p as d,tt as f}from"./main-
|
|
1
|
+
import{_ as e,m as t,n,t as r}from"./ui-store-DWSBgCoR.js";import{Q as i,Z as a,f as o,h as s,m as c,nt as l,ot as u,p as d,tt as f}from"./main-DEK4mnDt.js";import{a as p,l as m,m as h,t as g}from"./button-BGQhw-yz.js";import{t as _}from"./connection-store-B9-4NAfR.js";import{n as ee}from"./settings-store-MJead_iM.js";import{r as v}from"./database-DUBVz1in.js";import{c as y,t as b}from"./query-execution-DItl2TUQ.js";import{n as x}from"./use-engine-5vf18JRu.js";import{a as S,i as C,n as w,o as T,r as E,t as D}from"./dialog-z_ZHxAMN.js";var O=p(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),k=e(t(),1);function A(e){let t=e.slice(e.indexOf(`(`)+1,e.lastIndexOf(`)`)),n=[],r=/'((?:[^']|'')*)'/g,i;for(;i=r.exec(t);)n.push(i[1].replaceAll(`''`,`'`));return n}function j(e,t={}){let{oracleDate:n=!1}=t,r=e.type.trim(),i=r.toLowerCase(),a=/\bunsigned\b/.test(i);if(/^enum\(/.test(i))return{kind:`enum`,options:A(r)};if(/^set\(/.test(i))return{kind:`set`,options:A(r)};if(/^(tinyint\(1\)|bool|boolean|bit\(1\)|bit)(?![\w(])/.test(i))return{kind:`boolean`};let o=/^number(?:\((\d+|\*)(?:,\s*(-?\d+))?\))?$/.exec(i);if(o)return o[2]&&Number(o[2])>0?{kind:`decimal`}:o[1]?{kind:`integer`}:{kind:`decimal`};if(/^(tinyint|smallint|mediumint|int|integer|bigint|int2|int4|int8|serial|bigserial|smallserial)\b/.test(i))return{kind:`integer`,unsigned:a};if(/^(decimal|numeric|float|double|real|money|float4|float8|double precision)\b/.test(i))return{kind:`decimal`,unsigned:a};if(/^(datetime2|datetime|timestamp|smalldatetime|datetimeoffset)\b/.test(i))return{kind:`datetime`};if(/^date\b/.test(i))return{kind:n?`datetime`:`date`};if(/^(time|timetz)\b/.test(i))return{kind:`time`};if(/^(json|jsonb)\b/.test(i))return{kind:`json`};if(/^(uuid|uniqueidentifier)\b/.test(i))return{kind:`uuid`};if(/^(blob|tinyblob|mediumblob|longblob|binary|varbinary|bytea|raw|image|bfile)\b/.test(i))return{kind:`binary`};if(/^(text|ntext|tinytext|mediumtext|longtext|clob|nclob|long)\b/.test(i)||/^n?(?:var)?char2?\(max\)/.test(i))return{kind:`text`};let s=/^n?(?:var)?char2?(?:acter)?(?:\s+varying)?\((\d+)(?:\s+(?:char|byte))?\)/.exec(i);return s?{kind:`string`,maxLength:Number(s[1])}:{kind:`string`}}var M=/auto_increment|identity|generated/i;function N(e){return M.test(e.extra)||/^(serial|bigserial|smallserial)\b/i.test(e.type)?{mode:`auto`,text:``}:e.defaultValue===null?e.nullable?{mode:`null`,text:``}:{mode:`value`,text:``}:{mode:`default`,text:``}}function P(e){return e==null?{mode:`keep`,text:``}:{mode:`keep`,text:F(e)}}function F(e){if(e==null)return``;if(typeof e==`object`){if(ArrayBuffer.isView(e))return``;if(e instanceof Date)return e.toISOString();try{return JSON.stringify(e,null,2)}catch{return String(e)}}return String(e)}function I(e,t){let n=t.trim();switch(e.kind){case`integer`:{if(!/^[+-]?\d+$/.test(n))return{error:`integer`};if(e.unsigned&&n.startsWith(`-`))return{error:`unsigned`};let t=Number(n);return{value:Number.isSafeInteger(t)?t:BigInt(n)}}case`decimal`:return n===``||Number.isNaN(Number(n))?{error:`number`}:{value:Number(n)};case`boolean`:return{value:n===`true`||n===`1`};case`json`:try{return{value:JSON.parse(n===``?`null`:n)}}catch{return{error:`json`}}case`set`:return{value:n};case`date`:return n&&!/^\d{4}-\d{2}-\d{2}$/.test(n)?{error:`date`}:{value:n};case`datetime`:return n&&!/^\d{4}-\d{2}-\d{2}([ T]\d{2}:\d{2}(:\d{2}(\.\d+)?)?)?([+-]\d{2}:?\d{2}|Z)?$/.test(n)?{error:`datetime`}:{value:n};case`time`:return n&&!/^-?\d{1,3}:\d{2}(:\d{2}(\.\d+)?)?$/.test(n)?{error:`time`}:{value:n};default:return{value:t}}}var L=m(),R={integer:`result.rowForm.invalid.integer`,unsigned:`result.rowForm.invalid.unsigned`,number:`result.rowForm.invalid.number`,json:`result.rowForm.invalid.json`,date:`result.rowForm.invalid.date`,datetime:`result.rowForm.invalid.datetime`,time:`result.rowForm.invalid.time`};function z(e){return String(e).padStart(2,`0`)}function B(e){let t=new Date,n=`${t.getFullYear()}-${z(t.getMonth()+1)}-${z(t.getDate())}`,r=`${z(t.getHours())}:${z(t.getMinutes())}:${z(t.getSeconds())}`;return e===`date`?n:e===`time`?r:`${n} ${r}`}function V(e){let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e.trim());if(!t)return;let n=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return Number.isNaN(n.getTime())?void 0:n}function H({spec:e,state:t,disabled:n,onText:r}){let{t:i}=h(),a=`w-full rounded border bg-background px-2 py-1 text-sm font-mono outline-none focus:ring-1 focus:ring-primary disabled:opacity-50`;switch(e.kind){case`boolean`:return(0,L.jsxs)(`select`,{className:a,value:t.text===`true`||t.text===`1`?`true`:`false`,onChange:e=>r(e.target.value),disabled:n,children:[(0,L.jsx)(`option`,{value:`true`,children:`TRUE`}),(0,L.jsx)(`option`,{value:`false`,children:`FALSE`})]});case`enum`:return(0,L.jsxs)(`select`,{className:a,value:t.text,onChange:e=>r(e.target.value),disabled:n,children:[!e.options?.includes(t.text)&&(0,L.jsx)(`option`,{value:t.text,children:t.text||`—`}),e.options?.map(e=>(0,L.jsx)(`option`,{value:e,children:e},e))]});case`set`:{let i=new Set(t.text.split(`,`).map(e=>e.trim()).filter(Boolean));return(0,L.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 rounded border bg-background px-2 py-1.5`,children:e.options?.map(t=>(0,L.jsxs)(`label`,{className:`flex items-center gap-1 text-xs font-mono`,children:[(0,L.jsx)(`input`,{type:`checkbox`,className:`accent-primary`,checked:i.has(t),disabled:n,onChange:n=>{let a=new Set(i);n.target.checked?a.add(t):a.delete(t),r(e.options.filter(e=>a.has(e)).join(`,`))}}),t]},t))})}case`integer`:case`decimal`:return(0,L.jsx)(`input`,{className:`${a} tabular-nums`,inputMode:`decimal`,value:t.text,onChange:e=>r(e.target.value),disabled:n,placeholder:e.kind===`integer`?`0`:`0.00`});case`date`:case`datetime`:{let[l,p]=t.text.trim().split(/[ T]/);return(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(`input`,{className:`${a} flex-1`,value:t.text,onChange:e=>r(e.target.value),disabled:n,placeholder:e.kind===`date`?`YYYY-MM-DD`:`YYYY-MM-DD HH:MM:SS`}),(0,L.jsxs)(d,{children:[(0,L.jsx)(s,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,className:`rounded border bg-background p-1.5 text-muted-foreground hover:text-foreground disabled:opacity-50`,disabled:n,title:i(`result.rowForm.pickDate`),children:(0,L.jsx)(u,{className:`size-3.5`})})}),(0,L.jsx)(c,{className:`w-auto p-0`,align:`end`,children:(0,L.jsx)(o,{mode:`single`,selected:V(l??``),defaultMonth:V(l??``),onSelect:t=>{if(!t)return;let n=`${t.getFullYear()}-${z(t.getMonth()+1)}-${z(t.getDate())}`;r(e.kind===`date`?n:`${n} ${p||`00:00:00`}`)}})})]}),(0,L.jsx)(`button`,{type:`button`,className:`rounded border bg-background px-1.5 py-1 text-[10px] text-muted-foreground hover:text-foreground disabled:opacity-50`,disabled:n,onClick:()=>r(B(e.kind)),title:i(`result.rowForm.now`),children:(0,L.jsx)(f,{className:`size-3.5`})})]})}case`time`:return(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(`input`,{className:`${a} flex-1`,value:t.text,onChange:e=>r(e.target.value),disabled:n,placeholder:`HH:MM:SS`}),(0,L.jsx)(`button`,{type:`button`,className:`rounded border bg-background px-1.5 py-1 text-muted-foreground hover:text-foreground disabled:opacity-50`,disabled:n,onClick:()=>r(B(`time`)),title:i(`result.rowForm.now`),children:(0,L.jsx)(f,{className:`size-3.5`})})]});case`json`:{let e=!0;try{t.text.trim()&&JSON.parse(t.text)}catch{e=!1}return(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsx)(`textarea`,{className:`${a} min-h-[96px] resize-y text-xs ${e?``:`border-destructive`}`,value:t.text,onChange:e=>r(e.target.value),disabled:n,spellCheck:!1,placeholder:`{}`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 rounded border bg-background px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground disabled:opacity-50`,disabled:n||!e||!t.text.trim(),onClick:()=>{try{r(JSON.stringify(JSON.parse(t.text),null,2))}catch{}},children:[(0,L.jsx)(O,{className:`size-3`}),i(`result.rowForm.formatJson`)]}),!e&&(0,L.jsx)(`span`,{className:`text-[10px] text-destructive`,children:i(`result.rowForm.invalid.json`)})]})]})}case`text`:return(0,L.jsx)(`textarea`,{className:`${a} min-h-[72px] resize-y`,value:t.text,onChange:e=>r(e.target.value),disabled:n,spellCheck:!1});case`binary`:return(0,L.jsx)(`div`,{className:`rounded border bg-muted/40 px-2 py-1 text-xs italic text-muted-foreground`,children:i(`result.rowForm.binaryUnsupported`)});case`uuid`:return(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(`input`,{className:`${a} flex-1`,value:t.text,onChange:e=>r(e.target.value),disabled:n,placeholder:`00000000-0000-0000-0000-000000000000`}),(0,L.jsx)(`button`,{type:`button`,className:`rounded border bg-background px-1.5 py-1 text-muted-foreground hover:text-foreground disabled:opacity-50`,disabled:n,onClick:()=>r(crypto.randomUUID()),title:i(`result.rowForm.generateUuid`),children:(0,L.jsx)(O,{className:`size-3.5`})})]});default:{let i=t.text.length>80||t.text.includes(`
|
|
2
2
|
`);return(0,L.jsxs)(`div`,{className:`space-y-0.5`,children:[i?(0,L.jsx)(`textarea`,{className:`${a} min-h-[56px] resize-y`,value:t.text,onChange:e=>r(e.target.value),disabled:n,spellCheck:!1}):(0,L.jsx)(`input`,{className:a,value:t.text,onChange:e=>r(e.target.value),disabled:n,maxLength:e.maxLength}),e.maxLength&&(0,L.jsxs)(`div`,{className:`text-right text-[10px] tabular-nums ${t.text.length>e.maxLength?`text-destructive`:`text-muted-foreground`}`,children:[t.text.length,`/`,e.maxLength]})]})}}}function U(){let{t:e}=h(),t=r(`row-form`),o=n(e=>e.closeDialog),s=n(e=>e.setFooterMessage),c=x(t?.connectionId??``),u=_(e=>t?e.transactionOpen[t.connectionId]:!1),[d,f]=(0,k.useState)(null),[p,m]=(0,k.useState)(null),[O,A]=(0,k.useState)({}),[M,F]=(0,k.useState)({}),[z,B]=(0,k.useState)(null),[V,U]=(0,k.useState)(!1),W=t?.mode===`edit`;(0,k.useEffect)(()=>{if(!t)return;let e=!1,n=v(t.serverConnectionId);return c.introspect.listColumns(n,t.database,t.table).then(n=>{if(e)return;f(n);let r={};for(let e of n)if(t.mode===`edit`){let n=t.fields.find(t=>t.orgName===e.name);r[e.name]=P(n?t.row?.[n.name]:void 0)}else r[e.name]=N(e);A(r)}).catch(t=>{e||m(t instanceof Error?t.message:String(t))}),()=>{e=!0}},[t?.serverConnectionId,t?.database,t?.table,t?.mode]);let G=(0,k.useMemo)(()=>new Map((d??[]).map(e=>[e.name,j(e,{oracleDate:c.id===`oracle`})])),[d,c.id]),K=(0,k.useCallback)((e,t)=>{A(n=>({...n,[e]:{...n[e],mode:t}})),F(t=>{let n={...t};return delete n[e],n})},[]),q=(0,k.useCallback)((e,t)=>{A(n=>({...n,[e]:{mode:`value`,text:t}})),F(t=>{let n={...t};return delete n[e],n})},[]),J=(0,k.useMemo)(()=>({__default:!0}),[]),Y=(0,k.useCallback)(()=>{if(!d)return null;let t=new Map,n={};for(let r of d){let i=O[r.name],a=G.get(r.name);if(!i||i.mode===`auto`||i.mode===`keep`)continue;if(i.mode===`null`){t.set(r.name,null);continue}if(i.mode==="default"){t.set(r.name,J);continue}let o=I(a,i.text);if(`error`in o){n[r.name]=e(R[o.error]??`result.rowForm.invalid.number`);continue}if(a.maxLength&&typeof o.value==`string`&&o.value.length>a.maxLength){n[r.name]=e(`result.rowForm.invalid.length`,{max:a.maxLength});continue}t.set(r.name,o.value)}return F(n),Object.keys(n).length>0?null:{values:t}},[d,O,G,e,J]),X=(0,k.useCallback)(e=>{if(!t)return null;let n=e=>e===J?`DEFAULT`:c.quoteLiteral(e);if(t.mode===`insert`){let r=[...e];return r.length===0?c.getQuery(`INSERT_DEFAULT_VALUES`,t.database,t.table):c.getQuery(`INSERT_TABLE`,t.database,t.table,r.map(([e])=>c.quoteIdentifier(e)).join(`, `),r.map(([,e])=>n(e)).join(`, `))}return!t.where||e.size===0?null:c.getQuery(`UPDATE_TABLE`,t.database,t.table,[...e].map(([e,t])=>`${c.quoteIdentifier(e)} = ${n(t)}`).join(`, `),t.where)},[t,c,J]),Z=(0,k.useMemo)(()=>{if(!d)return``;let e=new Map;for(let t of d){let n=O[t.name];if(!(!n||n.mode===`auto`||n.mode===`keep`)){if(n.mode===`null`)e.set(t.name,null);else if(n.mode==="default")e.set(t.name,J);else{let r=I(G.get(t.name),n.text);e.set(t.name,`error`in r?n.text:r.value)}}}return X(e)??``},[d,O,G,X,J]),Q=e=>{let n={};for(let[r,i]of e){if(i===J)continue;let e=t?.fields.find(e=>e.orgName===r);n[e?.name??r]=typeof i==`bigint`?i.toString():i}return n},te=()=>{let e=Y();!e||!t||(t.onStage?.(t.mode,Q(e.values)),o())},ne=async()=>{let r=Y();if(!r||!t)return;let i=X(r.values);if(!i){B(e(`result.rowForm.nothingToWrite`));return}U(!0),B(null);try{if(ee.getState().previewGridCommit&&!await n.getState().requestDestructiveConfirm({title:e(W?`result.rowForm.confirmUpdateTitle`:`result.rowForm.confirmInsertTitle`,{table:`${t.database}.${t.table}`}),statements:[i],confirmLabel:e(W?`result.rowForm.update`:`result.rowForm.insert`)}))return;await y(t.connectionId,i,{database:t.database,skipDestructiveConfirm:!0}),s(e(W?`result.rowForm.updated`:`result.rowForm.inserted`,{table:`${t.database}.${t.table}`})),t.onCommitted?.(t.mode,Q(r.values)),o()}catch(e){if(e instanceof b)return;B(e instanceof Error?e.message:String(e))}finally{U(!1)}};if(!t)return null;let $=(e,t,n,r)=>(0,L.jsx)(`button`,{type:`button`,className:`rounded px-1.5 py-0.5 text-[10px] font-medium ${r===t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`}`,onClick:()=>K(e,t),children:n});return(0,L.jsx)(D,{open:!0,onOpenChange:e=>{e||o()},children:(0,L.jsxs)(w,{className:`flex max-h-[90vh] flex-col sm:max-w-[860px]`,children:[(0,L.jsxs)(S,{children:[(0,L.jsx)(T,{children:e(W?`result.rowForm.editTitle`:`result.rowForm.insertTitle`)}),(0,L.jsxs)(E,{className:`font-mono text-xs`,children:[t.database,`.`,t.table]})]}),(0,L.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto rounded-md border`,children:[p&&(0,L.jsx)(`div`,{className:`rounded border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:p}),!d&&!p&&(0,L.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-10 text-sm text-muted-foreground`,children:[(0,L.jsx)(a,{className:`size-4 animate-spin`}),e(`result.rowForm.loading`)]}),d&&(0,L.jsxs)(`table`,{className:`w-full border-separate border-spacing-0 text-sm`,children:[(0,L.jsx)(`thead`,{className:`sticky top-0 z-10 bg-background`,children:(0,L.jsxs)(`tr`,{className:`text-left text-[10px] uppercase tracking-wide text-muted-foreground`,children:[(0,L.jsx)(`th`,{className:`w-[38%] border-b px-2 py-1.5 font-medium`,children:e(`result.rowForm.colColumn`)}),(0,L.jsx)(`th`,{className:`border-b px-2 py-1.5 font-medium`,children:e(`result.rowForm.colValue`)})]})}),(0,L.jsx)(`tbody`,{children:d.map(n=>{let r=O[n.name]??{mode:`value`,text:``},a=G.get(n.name),o=r.mode===`auto`,s=M[n.name],c=n.key===`PRI`,u=t.fields.find(e=>e.orgName===n.name),d=!!u&&!!t.row&&t.row[u.name]===null;return(0,L.jsxs)(`tr`,{className:`align-top ${s?`bg-destructive/5`:`hover:bg-muted/30`}`,children:[(0,L.jsxs)(`td`,{className:`border-b border-border/60 px-2 py-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)(`span`,{className:`truncate font-mono text-sm font-medium`,title:n.name,children:n.name}),c&&(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5 rounded border border-catppuccin-yellow/50 px-1 text-[9px] font-semibold text-catppuccin-yellow`,children:[(0,L.jsx)(i,{className:`size-2.5`}),`PK`]})]}),(0,L.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-[10px] text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`rounded bg-muted px-1 py-px font-mono`,children:n.type}),!n.nullable&&(0,L.jsx)(`span`,{children:`NOT NULL`}),n.defaultValue!==null&&(0,L.jsxs)(`span`,{className:`font-mono`,title:e(`result.rowForm.defaultValue`),children:[`= `,n.defaultValue]}),n.extra&&(0,L.jsx)(`span`,{children:n.extra})]}),n.comment&&(0,L.jsx)(`div`,{className:`mt-0.5 text-[10px] text-muted-foreground/80`,children:n.comment})]}),(0,L.jsx)(`td`,{className:`border-b border-border/60 px-2 py-2`,children:(0,L.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r.mode===`keep`?(0,L.jsx)(`div`,{className:`cursor-text truncate rounded border border-dashed bg-muted/30 px-2 py-1 font-mono text-xs text-muted-foreground`,onClick:()=>K(n.name,`value`),title:e(`result.rowForm.clickToChange`),children:d?(0,L.jsx)(`span`,{className:`italic`,children:`NULL`}):r.text||(0,L.jsx)(`span`,{className:`italic`,children:e(`result.rowForm.empty`)})}):r.mode===`value`?(0,L.jsx)(H,{spec:a,state:r,disabled:!1,onText:e=>q(n.name,e)}):(0,L.jsx)(`div`,{className:`rounded border border-dashed bg-muted/30 px-2 py-1 font-mono text-xs italic text-muted-foreground`,children:r.mode===`null`?`NULL`:r.mode==="default"?`DEFAULT (${n.defaultValue??``})`:e(`result.rowForm.autoHint`)}),s&&(0,L.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 text-[11px] text-destructive`,children:[(0,L.jsx)(l,{className:`size-3`}),s]})]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 rounded border bg-background p-0.5`,children:[W&&$(n.name,`keep`,e(`result.rowForm.mode.keep`),r.mode),(o||!W&&/auto_increment|identity/i.test(n.extra))&&$(n.name,`auto`,e(`result.rowForm.mode.auto`),r.mode),$(n.name,`value`,e(`result.rowForm.mode.value`),r.mode),n.nullable&&$(n.name,`null`,`NULL`,r.mode),n.defaultValue!==null&&$(n.name,`default`,`DEFAULT`,r.mode)]})]})})]},n.name)})})]})]}),d&&(0,L.jsxs)(`div`,{className:`shrink-0 rounded-md border bg-muted/30`,children:[(0,L.jsx)(`div`,{className:`border-b px-3 py-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:e(`result.rowForm.preview`)}),(0,L.jsx)(`pre`,{className:`max-h-24 overflow-auto whitespace-pre-wrap break-words px-3 py-2 font-mono text-xs`,children:Z||(0,L.jsx)(`span`,{className:`italic text-muted-foreground`,children:e(`result.rowForm.nothingToWrite`)})})]}),z&&(0,L.jsx)(`div`,{className:`shrink-0 rounded border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:z}),(0,L.jsxs)(C,{className:`items-center`,children:[u&&(0,L.jsx)(`span`,{className:`mr-auto text-[11px] text-catppuccin-yellow`,children:e(`result.rowForm.inTransaction`)}),(0,L.jsx)(g,{variant:`outline`,onClick:()=>o(),disabled:V,children:e(`command.close`)}),t.onStage&&(0,L.jsx)(g,{variant:`outline`,onClick:te,disabled:V||!d,title:e(`result.rowForm.stageHint`),children:e(W?`result.rowForm.stageEdit`:`result.rowForm.stageInsert`)}),(0,L.jsxs)(g,{onClick:()=>void ne(),disabled:V||!d,children:[V&&(0,L.jsx)(a,{className:`mr-1 size-3.5 animate-spin`}),e(W?`result.rowForm.update`:`result.rowForm.insert`)]})]})]})})}export{U as RowFormDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t}from"./ui-store-DWSBgCoR.js";import{l as n,u as r}from"./main-
|
|
1
|
+
import{a as e,n as t}from"./ui-store-DWSBgCoR.js";import{l as n,u as r}from"./main-DEK4mnDt.js";import{l as i,m as a,t as o}from"./button-BGQhw-yz.js";import{r as s,t as c}from"./i18n-DyTdEJ5X.js";import{a as l,i as u,n as d,r as f,t as p}from"./select-BoGTNqvN.js";import{n as m,t as h}from"./settings-store-MJead_iM.js";import{a as g,i as _,n as v,o as y,r as b,t as x}from"./dialog-z_ZHxAMN.js";var S=i();function C({id:e,checked:t,onChange:n,label:r,hint:i}){return(0,S.jsxs)(`label`,{htmlFor:e,className:`flex cursor-pointer items-start gap-3 rounded-md border p-3 hover:bg-accent/40`,children:[(0,S.jsx)(`input`,{id:e,type:`checkbox`,checked:t,onChange:e=>n(e.target.checked),className:`mt-0.5 size-4 accent-primary`}),(0,S.jsxs)(`span`,{className:`grid gap-0.5`,children:[(0,S.jsx)(`span`,{className:`text-sm font-medium`,children:r}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i})]})]})}function w(){let i=t(e=>e.activeDialog),w=t(e=>e.closeDialog),T=m(),E=T.update,{t:D}=a();return(0,S.jsx)(x,{open:i===`safety-settings`,onOpenChange:e=>{e||w()},children:(0,S.jsxs)(v,{className:`sm:max-w-[560px]`,children:[(0,S.jsxs)(g,{children:[(0,S.jsx)(y,{children:D(`settings.title`)}),(0,S.jsx)(b,{children:D(`settings.description`)})]}),(0,S.jsxs)(`div`,{className:`grid gap-2`,children:[(0,S.jsx)(C,{id:`s-history`,checked:T.persistQueryHistory,onChange:e=>T.setPersistQueryHistory(e),label:D(`settings.persistHistory`),hint:D(`settings.persistHistoryHint`)}),(0,S.jsx)(C,{id:`s-confirm`,checked:T.confirmDestructive,onChange:e=>E({confirmDestructive:e}),label:`Confirm destructive statements`,hint:`Ask before DROP TABLE/DATABASE, TRUNCATE, DELETE or UPDATE without WHERE, and ALTER … DROP COLUMN.`}),(0,S.jsx)(C,{id:`s-dryrun`,checked:T.previewAffectedRows,onChange:e=>E({previewAffectedRows:e}),label:`Preview affected rows before UPDATE / DELETE`,hint:`Runs the statement's WHERE (joins included) as a SELECT first and shows the count and a sample of the rows; you confirm before anything is written.`}),(0,S.jsx)(C,{id:`s-warn`,checked:T.warnInEditor,onChange:e=>E({warnInEditor:e}),label:`Warn in the editor`,hint:`Underline destructive statements and statements a read-only connection would refuse.`}),(0,S.jsx)(C,{id:`s-override`,checked:T.allowReadOnlyOverride,onChange:e=>E({allowReadOnlyOverride:e}),label:`Allow "Run anyway" on read-only connections`,hint:`When off, writes on a read-only connection are refused with no override.`}),(0,S.jsx)(C,{id:`s-preview`,checked:T.previewGridCommit,onChange:e=>E({previewGridCommit:e}),label:`Preview SQL before committing grid edits`,hint:`Show the generated UPDATE statements and ask for confirmation.`}),(0,S.jsxs)(`div`,{className:`grid grid-cols-[1fr_140px] items-center gap-3 rounded-md border p-3`,children:[(0,S.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,S.jsx)(n,{htmlFor:`s-limit`,className:`text-sm font-medium`,children:`Result row limit`}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`LIMIT appended to SELECTs that have none. 0 disables.`})]}),(0,S.jsx)(r,{id:`s-limit`,type:`number`,min:0,step:100,value:T.resultRowLimit,onChange:e=>E({resultRowLimit:Math.max(0,Number(e.target.value)||0)})})]}),(0,S.jsxs)(`div`,{className:`grid grid-cols-[1fr_200px] items-center gap-3 rounded-md border p-3`,children:[(0,S.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,S.jsx)(`span`,{className:`text-sm font-medium`,children:`F9 / Run button executes`}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Ctrl+Enter always runs the statement at the cursor; Ctrl+Shift+Enter the whole script.`})]}),(0,S.jsxs)(p,{value:T.executeScope,onValueChange:e=>E({executeScope:e}),children:[(0,S.jsx)(u,{children:(0,S.jsx)(l,{})}),(0,S.jsxs)(d,{children:[(0,S.jsx)(f,{value:`script`,children:`Whole script`}),(0,S.jsx)(f,{value:`statement`,children:`Statement at cursor`})]})]})]}),(0,S.jsxs)(`div`,{className:`grid grid-cols-[1fr_200px] items-center gap-3 rounded-md border p-3`,children:[(0,S.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,S.jsx)(`span`,{className:`text-sm font-medium`,children:D(`settings.language`)}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:D(`settings.languageHint`)})]}),(0,S.jsxs)(p,{value:T.locale,onValueChange:e=>T.setLocale(e),children:[(0,S.jsx)(u,{children:(0,S.jsx)(l,{})}),(0,S.jsxs)(d,{children:[(0,S.jsx)(f,{value:`auto`,children:D(`language.auto`,{name:D(`language.${s()}`)})}),c.map(e=>(0,S.jsx)(f,{value:e,children:D(`language.${e}`)},e))]})]})]}),(0,S.jsx)(C,{id:`s-analytics`,checked:T.analyticsEnabled,onChange:T.setAnalyticsEnabled,label:D(`settings.analytics`),hint:e()?D(`settings.analyticsHint`):D(`settings.analyticsUnavailableHint`)})]}),(0,S.jsxs)(_,{children:[(0,S.jsx)(o,{variant:`ghost`,onClick:()=>E(h),children:D(`settings.resetDefaults`)}),(0,S.jsx)(o,{onClick:w,children:D(`settings.done`)})]})]})})}export{w as SafetySettingsDialog};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e,c as t,m as n,n as r,t as i}from"./ui-store-DWSBgCoR.js";import{A as a,k as o,l as s}from"./main-
|
|
1
|
+
import{_ as e,c as t,m as n,n as r,t as i}from"./ui-store-DWSBgCoR.js";import{A as a,k as o,l as s}from"./main-DEK4mnDt.js";import{l as c,m as l,t as u}from"./button-BGQhw-yz.js";import{a as d,i as f,n as p,r as m,t as h}from"./select-BoGTNqvN.js";import{t as g}from"./connection-store-B9-4NAfR.js";import{r as _}from"./database-DUBVz1in.js";import{n as v}from"./engine-DRzYxvTs.js";import{t as y}from"./table-definition-Bs5VSn0X.js";import{a as ee,i as te,n as b,o as ne,t as x}from"./dialog-z_ZHxAMN.js";var S=e(n(),1),C=[`VIEW`,`PROCEDURE`,`FUNCTION`,`TRIGGER`,`EVENT`];function w(e,t){return e.replace(/\bDEFINER\s*=\s*(?:`[^`]*`|'[^']*'|"[^"]*"|\w+)@(?:`[^`]*`|'[^']*'|"[^"]*"|[\w.%-]+)/gi,``).replace(/\bSQL SECURITY (?:DEFINER|INVOKER)\b/gi,``).replace(/\bALGORITHM\s*=\s*\w+/gi,``).replace(RegExp(`[\`"\\[]?${t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}[\`"\\]]?\\.`,`gi`),``).replace(/\s+/g,` `).replace(/;\s*$/,``).trim()}function T(e,t){let n=[];for(let r of C){let i=e.objects?.get(r),a=t.objects?.get(r);if(!i&&!a)continue;let o=[...new Set([...i?.keys()??[],...a?.keys()??[]])].sort();for(let s of o){let o=i?.get(s)??null,c=a?.get(s)??null,l;l=o?c?o.sql!==null&&c.sql!==null&&w(o.sql,e.database)===w(c.sql,t.database)?`identical`:`changed`:`missingInTarget`:`missingInSource`,n.push({type:r,name:s,status:l,source:o,target:c})}}return n}var E=e=>e.toLowerCase().replace(/\s+/g,` `).trim(),D=e=>e===null?null:e.trim().replace(/^'(.*)'(?:::\w+)?$/s,`$1`),O=e=>e.addedColumns.length+e.removedColumns.length+e.changedColumns.length+e.addedIndexes.length+e.removedIndexes.length+e.changedIndexes.length>0;function k(e,t){let n=[];return E(e.type)!==E(t.type)&&n.push(`type`),e.nullable!==t.nullable&&n.push(`nullable`),D(e.defaultValue)!==D(t.defaultValue)&&n.push(`default`),e.extra.toLowerCase()!==t.extra.toLowerCase()&&n.push(`extra`),n}var A=(e,t)=>e.type===t.type&&e.columns.length===t.columns.length&&e.columns.every((e,n)=>e===t.columns[n]);function j(e,t,n){let r=t.columns.get(e)??[],i=n.columns.get(e)??[],a=new Map(i.map(e=>[e.name,e])),o=new Map(r.map(e=>[e.name,e])),s={table:e,addedColumns:r.filter(e=>!a.has(e.name)),removedColumns:i.filter(e=>!o.has(e.name)),changedColumns:[],addedIndexes:[],removedIndexes:[],changedIndexes:[]};for(let e of r){let t=a.get(e.name);if(!t)continue;let n=k(e,t);n.length>0&&s.changedColumns.push({name:e.name,source:e,target:t,attributes:n})}let c=t.indexes.get(e)??[],l=n.indexes.get(e)??[],u=new Map(l.map(e=>[e.name,e])),d=new Map(c.map(e=>[e.name,e]));s.addedIndexes=c.filter(e=>!u.has(e.name)),s.removedIndexes=l.filter(e=>!d.has(e.name));for(let e of c){let t=u.get(e.name);t&&!A(e,t)&&s.changedIndexes.push({name:e.name,source:e,target:t})}return s}function re(e,t){let n=new Set(t.tables),r=new Set(e.tables),i={missingInTarget:[],missingInSource:[],changed:[],identical:[],objects:T(e,t)};for(let r of e.tables){if(!n.has(r)){i.missingInTarget.push(r);continue}let a=j(r,e,t);O(a)?i.changed.push(a):i.identical.push(r)}return i.missingInSource=t.tables.filter(e=>!r.has(e)),i}var M=e=>e.split(`
|
|
2
2
|
`).map(e=>`-- ${e}`).join(`
|
|
3
3
|
`);function N(e,t,n,r,i={}){let a=n.ddl,o=r.database,s=e=>i.includeDrops?e:M(e),c=[`-- Schema sync: ${t.database} -> ${o} (${n.label})`,`-- Review before running. Statements that drop data are commented out unless "Include DROP statements" was checked.`,``];for(let r of e.missingInTarget)c.push(`-- Table ${r} is missing in the target`),c.push(P(r,t,n,o)),c.push(``);for(let t of e.changed){c.push(`-- Table ${t.table}`);for(let e of t.removedIndexes)c.push(s(a.dropIndex(o,t.table,e.name)));for(let e of t.changedIndexes)c.push(s(a.dropIndex(o,t.table,e.name)));for(let e of t.addedColumns)c.push(a.addColumn(o,t.table,e));for(let e of t.changedColumns){let r=a.alterColumn(o,t.table,e.source);c.push(r??M(`${n.label} cannot alter column ${e.name} in place (${e.attributes.join(`, `)}): recreate the table`))}for(let e of t.removedColumns)c.push(s(a.dropColumn(o,t.table,e.name)));for(let e of t.addedIndexes)c.push(a.createIndex(o,t.table,e));for(let e of t.changedIndexes)c.push(a.createIndex(o,t.table,e.source));c.push(``)}for(let t of e.missingInSource)c.push(`-- Table ${t} exists only in the target`),c.push(s(`DROP TABLE ${n.qualify(o,t)};`)),c.push(``);for(let t of e.objects){if(t.status===`identical`)continue;let e=`${t.type.charAt(0)}${t.type.slice(1).toLowerCase()} ${t.name}`,r=I(n,o,t);t.status===`missingInSource`?(c.push(`-- ${e} exists only in the target`),c.push(s(r))):(c.push(t.status===`changed`?`-- ${e} differs; recreated from the source`:`-- ${e} is missing in the target`),t.status===`changed`&&c.push(s(r)),c.push(t.source?.sql?L(t.source.sql):M(`the source engine did not return a CREATE statement for ${e}`))),c.push(``)}return c.join(`
|
|
4
4
|
`).replace(/\n{3,}/g,`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e,m as t,n}from"./ui-store-DWSBgCoR.js";import{j as r,l as i}from"./main-
|
|
1
|
+
import{_ as e,m as t,n}from"./ui-store-DWSBgCoR.js";import{j as r,l as i}from"./main-DEK4mnDt.js";import{l as a,m as o,t as s}from"./button-BGQhw-yz.js";import{a as c,i as l,n as u,r as d,t as f}from"./select-BoGTNqvN.js";import{t as p}from"./connection-store-B9-4NAfR.js";import{n as m}from"./query-store-fCiE0iiG.js";import{b as h,r as g}from"./database-DUBVz1in.js";import{n as _}from"./engine-DRzYxvTs.js";import{o as v,r as y}from"./schema-nodes-D3-cz2Xk.js";import{a as b,i as x,n as S,o as C,t as w}from"./dialog-z_ZHxAMN.js";import{t as T}from"./file-name-CnYBZPf9.js";var E=e(t(),1),D=a();function O(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function k(){let{t:e}=o(),{activeDialog:t,closeDialog:a}=n(),{activeConnectionId:k,activeConnections:A}=p(),{trees:j}=h(),M=m(),N=t===`export-html`,P=(0,E.useMemo)(()=>k?y(j[k]??[]):[],[k,j]),F=(0,E.useMemo)(()=>{if(!k)return``;let e=M.activeTabId[k];return(M.tabs[k]??[]).find(t=>t.id===e)?.database||``},[k,M.activeTabId,M.tabs]),[I,L]=(0,E.useState)(``),R=(0,E.useMemo)(()=>!k||!I?[]:v(j[k]??[],I),[k,I,j]),[z,B]=(0,E.useState)([]),[V,H]=(0,E.useState)(!0),[U,W]=(0,E.useState)(!0),[G,K]=(0,E.useState)(!0),[q,J]=(0,E.useState)(!1);(0,E.useEffect)(()=>{N&&F&&L(F)},[N,F]);function Y(e){e||(a(),L(``),B([]),H(!0),W(!0),K(!0))}function X(e){B(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function Z(){B(R.length===z.length?[]:[...R])}async function Q(){if(z.length===0||!k)return;let t=A.find(e=>e.id===k);if(!t?.serverConnectionId)return;J(!0);let{introspect:n}=_(k),r=g(t.serverConnectionId),i=(e,t,n)=>{let r=`<h3>${O(e)}</h3>\n<table border="1" cellpadding="4" cellspacing="0">\n`;r+=`<tr>${t.map(e=>`<th>${O(e)}</th>`).join(``)}</tr>\n`;for(let e of n)r+=`<tr>${e.map(e=>`<td>${O(e==null?`NULL`:String(e))}</td>`).join(``)}</tr>\n`;return r+`</table>
|
|
2
2
|
`};try{let t=[];for(let a of z){let o=`<h2>${O(a)}</h2>\n`;if(V){let t=await n.listColumns(r,I,a);t.length>0&&(o+=i(e(`database.html.sectionColumns`),[`Field`,`Type`,`Null`,`Key`,`Default`,`Extra`,`Comment`],t.map(e=>[e.name,e.type,e.nullable?`YES`:`NO`,e.key,e.defaultValue,e.extra,e.comment])))}if(U){let t=await n.listIndexes(r,I,a);t.length>0&&(o+=i(e(`database.html.sectionIndexes`),[`Key_name`,`Type`,`Columns`],t.map(e=>[e.name,e.type,e.columns.join(`, `)])))}if(G){let t=await n.getTableInfo(r,I,a);t&&(o+=i(e(`database.html.sectionProperties`),[`Name`,`Engine`,`Collation`,`Rows`,`Data_length`,`Create_time`,`Update_time`,`Comment`],[[t.name,t.engine,t.collation,t.rows,t.dataLength,t.createTime,t.updateTime,t.comment]]))}t.push(o)}let a=`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,m as t,n}from"./ui-store-DWSBgCoR.js";import{C as r,S as i,b as a,j as o,u as s,w as c,x as l,y as u}from"./main-
|
|
1
|
+
import{_ as e,m as t,n}from"./ui-store-DWSBgCoR.js";import{C as r,S as i,b as a,j as o,u as s,w as c,x as l,y as u}from"./main-DEK4mnDt.js";import{l as d,m as f,t as p}from"./button-BGQhw-yz.js";import{a as m}from"./i18n-DyTdEJ5X.js";import{t as h}from"./connection-store-B9-4NAfR.js";import{o as g}from"./database-DUBVz1in.js";import{t as _}from"./engine-DRzYxvTs.js";import{a as v,i as y,n as b,o as x,t as S}from"./dialog-z_ZHxAMN.js";var C=e(t(),1),w=d();function T(){let e=h.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}async function E(e){let t=T();if(!t)throw Error(m.t(`command.noActiveConnection`));let n=_().getQuery(e===`global`?`SHOW_GLOBAL_STATUS`:`SHOW_SESSION_STATUS`);return(await g(t,n)).records.map(e=>({Variable_name:e[0],Value:e[1]}))}function D(){let{t:e}=f(),{activeDialog:t,closeDialog:d,setFooterMessage:m}=n(),[h,g]=(0,C.useState)([]),[_,T]=(0,C.useState)(``),[D,O]=(0,C.useState)(`session`),k=t===`status`,A=(0,C.useCallback)(t=>E(t).then(g).catch(t=>m(e(`command.status.loadError`,{message:t instanceof Error?t.message:String(t)}))),[m,e]);(0,C.useEffect)(()=>{k&&A(D)},[k,D,A]);let j=(0,C.useMemo)(()=>{if(!_.trim())return h;let e=_.toLowerCase();return h.filter(t=>t.Variable_name.toLowerCase().includes(e)||t.Value.toLowerCase().includes(e))},[h,_]);function M(e){e||(T(``),d())}function N(e){O(e)}return(0,w.jsx)(S,{open:k,onOpenChange:M,children:(0,w.jsxs)(b,{className:`sm:max-w-[900px] max-h-[80vh] flex flex-col`,children:[(0,w.jsx)(v,{children:(0,w.jsx)(x,{children:e(`command.status.title`)})}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3 pb-2`,children:[(0,w.jsxs)(`div`,{className:`flex gap-1`,children:[(0,w.jsx)(p,{variant:D===`session`?`default`:`outline`,size:`sm`,onClick:()=>N(`session`),children:e(`command.scope.session`)}),(0,w.jsx)(p,{variant:D===`global`?`default`:`outline`,size:`sm`,onClick:()=>N(`global`),children:e(`command.scope.global`)})]}),(0,w.jsx)(s,{placeholder:e(`command.status.filterPlaceholder`),value:_,onChange:e=>T(e.target.value),className:`max-w-xs`})]}),(0,w.jsx)(`div`,{className:`flex-1 border rounded-md overflow-hidden min-h-0`,children:(0,w.jsx)(o,{className:`h-[400px]`,children:(0,w.jsxs)(u,{children:[(0,w.jsx)(r,{children:(0,w.jsxs)(c,{children:[(0,w.jsx)(i,{className:`w-[300px]`,children:e(`command.variableName`)}),(0,w.jsx)(i,{children:e(`command.value`)})]})}),(0,w.jsx)(a,{children:j.length===0?(0,w.jsx)(c,{children:(0,w.jsx)(l,{colSpan:2,className:`text-center text-muted-foreground`,children:e(`command.status.empty`)})}):j.map(e=>(0,w.jsxs)(c,{children:[(0,w.jsx)(l,{className:`font-mono text-xs`,children:e.Variable_name}),(0,w.jsx)(l,{className:`font-mono text-xs`,children:e.Value})]},e.Variable_name))})]})})}),(0,w.jsx)(y,{children:(0,w.jsx)(p,{variant:`outline`,onClick:()=>M(!1),children:e(`command.close`)})})]})})}export{D as StatusDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,m as t,n}from"./ui-store-DWSBgCoR.js";import{l as r,u as i}from"./main-
|
|
1
|
+
import{_ as e,m as t,n}from"./ui-store-DWSBgCoR.js";import{l as r,u as i}from"./main-DEK4mnDt.js";import{l as a,m as o,t as s}from"./button-BGQhw-yz.js";import{a as c,i as l,n as u,r as d,t as f}from"./select-BoGTNqvN.js";import{t as p}from"./connection-store-B9-4NAfR.js";import{a as m,i as h,n as g,o as _,t as v}from"./dialog-z_ZHxAMN.js";import{n as y}from"./user-store-D_BMKTT2.js";var b=e(t(),1),x=a();function S(){let{t:e}=o(),{activeDialog:t,closeDialog:a,setFooterMessage:S}=n(),C=p(e=>e.activeConnectionId)??``,w=y(e=>e.addUser),[T,E]=(0,b.useState)(``),[D,O]=(0,b.useState)(`%`),[k,A]=(0,b.useState)(``),[j,M]=(0,b.useState)(``),[N,P]=(0,b.useState)(`caching_sha2_password`),F=t===`user-add`;function I(e){e||(L(),a())}function L(){E(``),O(`%`),A(``),M(``),P(`caching_sha2_password`)}function R(){if(!T.trim()){S(e(`user.add.usernameRequired`));return}if(k!==j){S(e(`user.add.passwordMismatch`));return}w(C,{user:T.trim(),host:D.trim()||`%`,privileges:[],maxQuestions:0,maxUpdates:0,maxConnections:0,maxUserConnections:0,plugin:N,authenticationString:``,passwordExpired:!1,accountLocked:!1}),S(e(`user.add.added`,{user:T,host:D})),L(),a()}return(0,x.jsx)(v,{open:F,onOpenChange:I,children:(0,x.jsxs)(g,{className:`sm:max-w-[450px]`,children:[(0,x.jsx)(m,{children:(0,x.jsx)(_,{children:e(`user.add.title`)})}),(0,x.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(r,{htmlFor:`user-add-username`,children:e(`user.add.username`)}),(0,x.jsx)(i,{id:`user-add-username`,value:T,onChange:e=>E(e.target.value),placeholder:e(`user.add.usernamePlaceholder`)})]}),(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(r,{htmlFor:`user-add-host`,children:e(`user.add.host`)}),(0,x.jsx)(i,{id:`user-add-host`,value:D,onChange:e=>O(e.target.value),placeholder:`%`})]}),(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(r,{htmlFor:`user-add-password`,children:e(`user.add.password`)}),(0,x.jsx)(i,{id:`user-add-password`,type:`password`,value:k,onChange:e=>A(e.target.value),placeholder:e(`user.add.passwordPlaceholder`)})]}),(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(r,{htmlFor:`user-add-confirm-password`,children:e(`user.add.confirmPassword`)}),(0,x.jsx)(i,{id:`user-add-confirm-password`,type:`password`,value:j,onChange:e=>M(e.target.value),placeholder:e(`user.add.confirmPasswordPlaceholder`)})]}),(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(r,{children:e(`user.add.plugin`)}),(0,x.jsxs)(f,{value:N,onValueChange:P,children:[(0,x.jsx)(l,{className:`w-full`,children:(0,x.jsx)(c,{})}),(0,x.jsxs)(u,{children:[(0,x.jsx)(d,{value:`mysql_native_password`,children:`mysql_native_password`}),(0,x.jsx)(d,{value:`caching_sha2_password`,children:`caching_sha2_password`})]})]})]})]}),(0,x.jsxs)(h,{children:[(0,x.jsx)(s,{variant:`outline`,onClick:()=>I(!1),children:e(`user.add.cancel`)}),(0,x.jsx)(s,{onClick:R,children:e(`user.add.add`)})]})]})})}export{S as UserAddDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,m as t,n}from"./ui-store-DWSBgCoR.js";import{$ as r,G as i,U as a,j as o,l as s,rt as c}from"./main-
|
|
1
|
+
import{_ as e,m as t,n}from"./ui-store-DWSBgCoR.js";import{$ as r,G as i,U as a,j as o,l as s,rt as c}from"./main-DEK4mnDt.js";import{a as l,l as u,m as d,o as f,t as p}from"./button-BGQhw-yz.js";import{t as m}from"./connection-store-B9-4NAfR.js";import{a as h,i as g,n as _,o as v,t as y}from"./dialog-z_ZHxAMN.js";import{n as b,t as x}from"./user-store-D_BMKTT2.js";var S=l(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),C=l(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),w=e(t(),1),T=u();function E({databases:e,tables:t,onSelectScope:n}){let{t:a}=d(),[s,l]=(0,w.useState)(new Set),[u,p]=(0,w.useState)(`global`),m=(0,w.useCallback)(e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),h=[{id:`global`,text:a(`user.grantTree.globalPrivileges`),type:`global`,children:e.map(e=>({id:`db:${e}`,text:e,type:`database`,database:e,children:(t[e]??[]).map(t=>({id:`tbl:${e}.${t}`,text:t,type:`table`,database:e,table:t}))}))}];function g(e){p(e.id),n({level:e.type,database:e.database,table:e.table})}function _(e,t){let n=e.children&&e.children.length>0,a=s.has(e.id),o=u===e.id,l=S;return e.type===`database`&&(l=r),e.type===`table`&&(l=i),(0,T.jsxs)(`div`,{children:[(0,T.jsxs)(`div`,{className:f(`flex items-center gap-1 px-2 py-0.5 cursor-pointer text-sm hover:bg-accent rounded-sm`,o&&`bg-accent text-accent-foreground`),style:{paddingLeft:`${t*16+4}px`},onClick:()=>{g(e),n&&m(e.id)},children:[n?(0,T.jsx)(c,{className:f(`h-3 w-3 transition-transform shrink-0`,a&&`rotate-90`)}):(0,T.jsx)(`span`,{className:`w-3 shrink-0`}),(0,T.jsx)(l,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,T.jsx)(`span`,{className:`truncate`,children:e.text})]}),a&&e.children?.map(e=>_(e,t+1))]},e.id)}return(0,T.jsx)(o,{className:`h-full`,children:(0,T.jsx)(`div`,{className:`py-1`,children:h.map(e=>_(e,0))})})}var D={Data:[`SELECT`,`INSERT`,`UPDATE`,`DELETE`],Structure:[`CREATE`,`ALTER`,`DROP`,`INDEX`,`REFERENCES`],Administration:[`GRANT OPTION`,`SUPER`,`PROCESS`,`RELOAD`,`SHUTDOWN`,`SHOW DATABASES`,`LOCK TABLES`,`EXECUTE`,`REPLICATION SLAVE`,`REPLICATION CLIENT`,`CREATE VIEW`,`SHOW VIEW`,`CREATE ROUTINE`,`ALTER ROUTINE`,`CREATE USER`,`EVENT`,`TRIGGER`,`CREATE TABLESPACE`]},O={Data:[`SELECT`,`INSERT`,`UPDATE`,`DELETE`],Structure:[`CREATE`,`ALTER`,`DROP`,`INDEX`,`REFERENCES`],Administration:[`GRANT OPTION`,`LOCK TABLES`,`EXECUTE`,`CREATE VIEW`,`SHOW VIEW`,`CREATE ROUTINE`,`ALTER ROUTINE`,`EVENT`,`TRIGGER`]},k={Data:[`SELECT`,`INSERT`,`UPDATE`,`DELETE`],Structure:[`CREATE`,`ALTER`,`DROP`,`INDEX`,`REFERENCES`],Administration:[`GRANT OPTION`,`TRIGGER`]},A={global:`user.privileges.globalTitle`,database:`user.privileges.databaseTitle`,table:`user.privileges.tableTitle`},j={Data:`user.privileges.categoryData`,Structure:`user.privileges.categoryStructure`,Administration:`user.privileges.categoryAdministration`};function M({scope:e,privileges:t,onChange:n}){let{t:r}=d(),i=(0,w.useMemo)(()=>e===`global`?D:e===`database`?O:k,[e]),a=(0,w.useMemo)(()=>Object.values(i).flat(),[i]);function c(e){n({...t,[e]:!t[e]})}function l(){let e={...t};for(let t of a)e[t]=!0;n(e)}function u(){let e={...t};for(let t of a)e[t]=!1;n(e)}return(0,T.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 p-2 border-b`,children:[(0,T.jsx)(`span`,{className:`text-sm font-medium`,children:r(A[e])}),(0,T.jsxs)(`div`,{className:`ml-auto flex gap-1`,children:[(0,T.jsx)(p,{variant:`outline`,size:`sm`,onClick:l,children:r(`user.privileges.checkAll`)}),(0,T.jsx)(p,{variant:`outline`,size:`sm`,onClick:u,children:r(`user.privileges.uncheckAll`)})]})]}),(0,T.jsx)(o,{className:`flex-1`,children:(0,T.jsx)(`div`,{className:`p-3 space-y-4`,children:Object.entries(i).map(([e,n])=>(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h4`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2`,children:j[e]?r(j[e]):e}),(0,T.jsx)(`div`,{className:`grid grid-cols-2 gap-1`,children:n.map(e=>(0,T.jsxs)(s,{className:`flex items-center gap-2 text-sm font-normal cursor-pointer py-1`,children:[(0,T.jsx)(`input`,{type:`checkbox`,checked:t[e]??!1,onChange:()=>c(e),className:`rounded border-input`}),e]},e))})]},e))})})]})}function N(){let{t:e}=d(),{activeDialog:t,closeDialog:r,openDialog:i,setFooterMessage:s}=n(),c=m(e=>e.activeConnectionId)??``,l=b(e=>e.users[c]??x),u=b(e=>e.selectedUser[c]??null),S=b(e=>e.setSelectedUser),D=b(e=>e.removeUser),O=e=>S(c,e),k=(e,t)=>D(c,e,t),[A,j]=(0,w.useState)({level:`global`}),[N,P]=(0,w.useState)({}),[F]=(0,w.useState)([]),[I]=(0,w.useState)({}),L=t===`user-manager`;function R(e){e||(r(),O(null),j({level:`global`}),P({}))}let z=(0,w.useCallback)(e=>{j(e),P({})},[]);function B(){i(`user-add`)}function V(){u&&(k(u.host,u.user),s(e(`user.manager.removed`,{user:u.user,host:u.host})))}function H(){if(!u){s(e(`user.manager.selectUserFirst`));return}s(e(`user.manager.applied`))}return(0,T.jsx)(y,{open:L,onOpenChange:R,children:(0,T.jsxs)(_,{className:`sm:max-w-[80vw] max-h-[70vh] flex flex-col`,children:[(0,T.jsx)(h,{children:(0,T.jsx)(v,{children:e(`user.manager.title`)})}),(0,T.jsxs)(`div`,{className:`flex flex-1 gap-0 overflow-hidden min-h-0 border rounded-md`,children:[(0,T.jsxs)(`div`,{className:`w-[200px] shrink-0 border-r flex flex-col`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-1 p-2 border-b`,children:[(0,T.jsx)(p,{variant:`ghost`,size:`sm`,onClick:B,title:e(`user.manager.addUser`),children:(0,T.jsx)(C,{className:`h-4 w-4`})}),(0,T.jsx)(p,{variant:`ghost`,size:`sm`,onClick:V,disabled:!u,title:e(`user.manager.removeUser`),children:(0,T.jsx)(a,{className:`h-4 w-4`})})]}),(0,T.jsx)(o,{className:`flex-1`,children:(0,T.jsx)(`div`,{className:`py-1`,children:l.length===0?(0,T.jsx)(`div`,{className:`px-3 py-4 text-sm text-muted-foreground text-center`,children:e(`user.manager.noUsers`)}):l.map(e=>{let t=u?.user===e.user&&u?.host===e.host;return(0,T.jsx)(`div`,{className:f(`flex items-center gap-2 px-3 py-1.5 cursor-pointer text-sm hover:bg-accent`,t&&`bg-accent text-accent-foreground`),onClick:()=>O(e),children:(0,T.jsxs)(`span`,{className:`truncate`,children:[e.user,`@`,e.host]})},`${e.user}@${e.host}`)})})})]}),(0,T.jsxs)(`div`,{className:`w-[250px] shrink-0 border-r`,children:[(0,T.jsx)(`div`,{className:`p-2 border-b text-sm font-medium`,children:e(`user.manager.grantScope`)}),(0,T.jsx)(E,{connectionId:``,databases:F,tables:I,onSelectScope:z})]}),(0,T.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,T.jsx)(M,{scope:A.level,privileges:N,onChange:P})})]}),(0,T.jsxs)(g,{children:[(0,T.jsx)(p,{onClick:H,children:e(`user.manager.apply`)}),(0,T.jsx)(p,{variant:`outline`,onClick:()=>R(!1),children:e(`user.manager.close`)})]})]})})}export{N as UserManagerDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,m as t,n}from"./ui-store-DWSBgCoR.js";import{C as r,S as i,b as a,j as o,u as s,w as c,x as l,y as u}from"./main-
|
|
1
|
+
import{_ as e,m as t,n}from"./ui-store-DWSBgCoR.js";import{C as r,S as i,b as a,j as o,u as s,w as c,x as l,y as u}from"./main-DEK4mnDt.js";import{l as d,m as f,t as p}from"./button-BGQhw-yz.js";import{a as m}from"./i18n-DyTdEJ5X.js";import{t as h}from"./connection-store-B9-4NAfR.js";import{o as g}from"./database-DUBVz1in.js";import{t as _}from"./engine-DRzYxvTs.js";import{a as v,i as y,n as b,o as x,t as S}from"./dialog-z_ZHxAMN.js";var C=e(t(),1),w=d();function T(){let e=h.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}async function E(e){let t=T();if(!t)throw Error(m.t(`command.noActiveConnection`));let n=_().getQuery(e===`global`?`SHOW_GLOBAL_VARIABLES`:`SHOW_SESSION_VARIABLES`);return(await g(t,n)).records.map(e=>({Variable_name:e[0],Value:e[1]}))}function D(){let{t:e}=f(),{activeDialog:t,closeDialog:d,setFooterMessage:m}=n(),[h,g]=(0,C.useState)([]),[_,T]=(0,C.useState)(``),[D,O]=(0,C.useState)(`session`),k=t===`variables`,A=(0,C.useCallback)(t=>E(t).then(g).catch(t=>m(e(`command.variables.loadError`,{message:t instanceof Error?t.message:String(t)}))),[m,e]);(0,C.useEffect)(()=>{k&&A(D)},[k,D,A]);let j=(0,C.useMemo)(()=>{if(!_.trim())return h;let e=_.toLowerCase();return h.filter(t=>t.Variable_name.toLowerCase().includes(e)||t.Value.toLowerCase().includes(e))},[h,_]);function M(e){e||(T(``),d())}function N(e){O(e)}return(0,w.jsx)(S,{open:k,onOpenChange:M,children:(0,w.jsxs)(b,{className:`sm:max-w-[900px] max-h-[80vh] flex flex-col`,children:[(0,w.jsx)(v,{children:(0,w.jsx)(x,{children:e(`command.variables.title`)})}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3 pb-2`,children:[(0,w.jsxs)(`div`,{className:`flex gap-1`,children:[(0,w.jsx)(p,{variant:D===`session`?`default`:`outline`,size:`sm`,onClick:()=>N(`session`),children:e(`command.scope.session`)}),(0,w.jsx)(p,{variant:D===`global`?`default`:`outline`,size:`sm`,onClick:()=>N(`global`),children:e(`command.scope.global`)})]}),(0,w.jsx)(s,{placeholder:e(`command.variables.filterPlaceholder`),value:_,onChange:e=>T(e.target.value),className:`max-w-xs`})]}),(0,w.jsx)(`div`,{className:`flex-1 border rounded-md overflow-hidden min-h-0`,children:(0,w.jsx)(o,{className:`h-[400px]`,children:(0,w.jsxs)(u,{children:[(0,w.jsx)(r,{children:(0,w.jsxs)(c,{children:[(0,w.jsx)(i,{className:`w-[300px]`,children:e(`command.variableName`)}),(0,w.jsx)(i,{children:e(`command.value`)})]})}),(0,w.jsx)(a,{children:j.length===0?(0,w.jsx)(c,{children:(0,w.jsx)(l,{colSpan:2,className:`text-center text-muted-foreground`,children:e(`command.variables.empty`)})}):j.map(e=>(0,w.jsxs)(c,{children:[(0,w.jsx)(l,{className:`font-mono text-xs`,children:e.Variable_name}),(0,w.jsx)(l,{className:`font-mono text-xs`,children:e.Value})]},e.Variable_name))})]})})}),(0,w.jsx)(y,{children:(0,w.jsx)(p,{variant:`outline`,onClick:()=>M(!1),children:e(`command.close`)})})]})})}export{D as VariablesDialog};
|