planche 0.9.0 → 0.9.2
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/{tQiLT0zv.js → 7jD5h8Yx.js} +3 -1
- package/app/assets/{C4QyqQoa.js → 7jG9Xw-H.js} +1 -1
- package/app/assets/{Br4335vw.js → 84VwJAQi.js} +1 -1
- package/app/assets/9gOj-Ty3.js +1 -0
- package/app/assets/{1p4z4GHT.js → B4S-lOKS.js} +2 -2
- package/app/assets/{BniymiMs.js → BDtsGuIR.js} +3 -1
- package/app/assets/{DFeHpd8Y.js → BEH9Jqkv.js} +1 -1
- package/app/assets/{CCQ6oQgi.js → BGvsBpIS.js} +1 -1
- package/app/assets/BMBWoD5w.js +1 -0
- package/app/assets/{BgvMpmFj.js → BMFLhX-x.js} +1 -1
- package/app/assets/{DDeeBXtX.js → BNB62Dfu.js} +1 -1
- package/app/assets/{D3_CBO8-.js → BPPUDpI0.js} +1 -1
- package/app/assets/{Bvu_eiyU.js → BPmMKRmE.js} +3 -3
- package/app/assets/{CP2U-viH.js → BQ1Rcyw6.js} +1 -1
- package/app/assets/{CWota0kb.js → BSziALTN.js} +1 -1
- package/app/assets/{f6MhVR01.js → BTaXXwBP.js} +1 -1
- package/app/assets/{BhPOHTk7.js → BbOETtQZ.js} +2 -2
- package/app/assets/{CIIDOG9Y.js → Bbx7_Uyd.js} +1 -1
- package/app/assets/{CkIm3SJy.js → BhX9zWzC.js} +1 -1
- package/app/assets/{C5Yv1gpQ.js → BixvbqFe.js} +1 -1
- package/app/assets/BjwrN_ch.js +11 -0
- package/app/assets/{BHe42P9W.js → BkXrfAoR.js} +1 -1
- package/app/assets/{BvEGx3Si.js → BnJGrP6V.js} +2 -2
- package/app/assets/{BnI4D_rY.js → BrVnzO7b.js} +1 -1
- package/app/assets/{BVwlLPu6.js → ByKF67UY.js} +1 -1
- package/app/assets/{DKf3DkR6.js → C1kpKIsO.js} +1 -1
- package/app/assets/{DkqeIq13.js → C6712dxU.js} +1 -1
- package/app/assets/{B_1rFijd.js → C77ZEZfM.js} +1 -1
- package/app/assets/{B8zpsP_u.js → CExE8dKz.js} +209 -209
- package/app/assets/{CVZ3Bw6o.js → CFUkTo-F.js} +1 -1
- package/app/assets/{BMGo7X_N.js → CFu5QMhX.js} +3 -1
- package/app/assets/{DnRoHgQS.js → CHx7zgT8.js} +1 -1
- package/app/assets/{BsYZ-U7K.js → CRnmOOqq.js} +1 -1
- package/app/assets/{CDfSdkjY.js → CTnwm-29.js} +1 -1
- package/app/assets/{DO0W14Ho.js → CaU3pCK6.js} +1 -1
- package/app/assets/{BYWnKgIY.js → CoZCOAph.js} +1 -1
- package/app/assets/{6NUleTnS.js → CrhJJH3f.js} +1 -1
- package/app/assets/{DDjCZLb0.js → CrlnxAGW.js} +1 -1
- package/app/assets/{Dy6-E_uL.js → D0Ya12SQ.js} +1 -1
- package/app/assets/{BiyRPyXV.js → D1kyupCL.js} +1 -1
- package/app/assets/{C3w9xAkk.js → D3lUezEb.js} +1 -1
- package/app/assets/{DeNEO8HN.js → D9QeXBOk.js} +1 -1
- package/app/assets/{DPnYgSl3.js → DCHRj2vY.js} +1 -1
- package/app/assets/{CwsH45Wr.js → DF7EZh_S.js} +2 -2
- package/app/assets/{DyQ8cEic.js → DHZOxCSJ.js} +1 -1
- package/app/assets/{Cdop6jK1.js → DNHPk-9r.js} +3 -1
- package/app/assets/{Q6DQerac.js → DPyLA6Dl.js} +1 -1
- package/app/assets/{Bkq2aetC.js → DTkqO0Em.js} +1 -1
- package/app/assets/{FAouNaq9.js → DaBfnZOJ.js} +1 -1
- package/app/assets/{D6oRJsd8.js → Djxg54qH.js} +1 -1
- package/app/assets/{ClytWHSf.js → Do7KpDxk.js} +1 -1
- package/app/assets/{CnoXRrek.js → DpEN2jyA.js} +1 -1
- package/app/assets/{C2S2GXdP.js → DzdX4vRD.js} +1 -1
- package/app/assets/{D4l4mWtD.js → G06qjCej.js} +1 -1
- package/app/assets/{ANL7Od0T.js → W7D4Svcn.js} +1 -1
- package/app/assets/{BJFk0Zzq.js → aIFwnVFr.js} +3 -1
- package/app/assets/{UX-csQNt.js → kXDKfUfE.js} +3 -1
- package/app/assets/{B9NCreMu.js → qRIRkBN0.js} +1 -1
- package/app/assets/{DY1k-USH.js → tJkeLYCp.js} +1 -1
- package/app/assets/w46wk7KI.css +2 -0
- package/app/index.html +8 -8
- package/package.json +1 -1
- package/app/assets/B9DHeSQH.js +0 -1
- package/app/assets/Bgu3teFB.js +0 -11
- package/app/assets/CWb3a6Xp.js +0 -1
- package/app/assets/CqTgU2vp.css +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{t as n}from"./CiL8zoYm.js";import{i as r,r as i}from"./Cu_sGzNJ.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./DzRyVlxz.js";import{a as d,i as f,n as p,r as m,t as h}from"./
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{t as n}from"./CiL8zoYm.js";import{i as r,r as i}from"./Cu_sGzNJ.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./DzRyVlxz.js";import{a as d,i as f,n as p,r as m,t as h}from"./G06qjCej.js";import{n as g,s as _}from"./DU-Eln5x.js";import{C as v,l as y,p as b}from"./BjwrN_ch.js";import{n as x}from"./D8_hwGjG.js";import{D as S,c as C,l as w}from"./CExE8dKz.js";var T=e(t(),1),E=i(),D={autoComplete:`off`,"data-1p-ignore":!0,"data-lpignore":`true`,"data-bwignore":!0};function O(){let{t:e}=r(),[t,i]=(0,T.useState)(null),[a,o]=(0,T.useState)(!1),[s,c]=(0,T.useState)(`anthropic`),[l,u]=(0,T.useState)(``),[x,O]=(0,T.useState)(``),[k,A]=(0,T.useState)(``),[j,M]=(0,T.useState)(!1),[N,P]=(0,T.useState)([]),[F,I]=(0,T.useState)(!1),[L,R]=(0,T.useState)(!1),[z,B]=(0,T.useState)(null),V=g(e=>e.setAiPreferences),H=(0,T.useCallback)(()=>{b().then(e=>{i(e);let t=g.getState().aiPreferences,n=e.storage!==`none`;c(n?e.provider:t.provider),u(n?e.model:t.model),O((n?e.baseUrl:t.baseUrl)??``),M(n?e.storage===`file`:t.remember),P(e.clis??[]),I(e.anthropicProfile===!0)}).catch(()=>o(!0))},[]);(0,T.useEffect)(H,[H]);let U=(0,T.useCallback)(e=>{c(e),u(t=>_(t,e))},[]),W=(0,T.useCallback)(()=>{R(!0),B(null),v({provider:s,model:l.trim()||void 0,baseUrl:x.trim()||void 0,key:k,remember:j}).then(t=>{i(t),A(``),V({provider:s,model:l.trim()||t.model,baseUrl:x.trim(),remember:j}),B(e(`settings.ai.saved`)),S()}).catch(e=>B(e instanceof Error?e.message:String(e))).finally(()=>R(!1))},[s,l,x,k,j,V,e]),G=(0,T.useCallback)(()=>{R(!0),B(null),y().then(e=>{i(e),A(``),S()}).catch(e=>B(e instanceof Error?e.message:String(e))).finally(()=>R(!1))},[]);if(a)return(0,E.jsx)(`p`,{className:`rounded-md border p-3 text-xs text-muted-foreground`,children:e(`settings.ai.unreachable`)});if(!t)return null;let K=t.fromEnvironment,q=s===`cli`||s===`anthropic-profile`;return(0,E.jsxs)(`div`,{className:`grid gap-3 rounded-md border p-3`,children:[(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.intro`)}),(0,E.jsx)(`p`,{className:`text-xs`,children:t.storage===`environment`?e(`settings.ai.configuredEnv`):t.storage===`file`?e(t.provider===`cli`||t.provider===`anthropic-profile`?`settings.ai.configuredChoice`:`settings.ai.configuredFile`,{path:t.path,provider:t.provider===`cli`?t.model:e(`settings.ai.profile`)}):t.storage===`session`?e(`settings.ai.configuredSession`):e(`settings.ai.none`)}),!K&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-[1fr_220px] items-center gap-3`,children:[(0,E.jsx)(C,{htmlFor:`ai-provider`,className:`text-sm font-medium`,children:e(`settings.ai.provider`)}),(0,E.jsxs)(h,{value:s,onValueChange:e=>U(e),children:[(0,E.jsx)(f,{id:`ai-provider`,children:(0,E.jsx)(d,{})}),(0,E.jsxs)(p,{children:[(0,E.jsx)(m,{value:`anthropic`,children:`Anthropic`}),(0,E.jsx)(m,{value:`anthropic-profile`,children:e(`settings.ai.profile`)}),(0,E.jsx)(m,{value:`openai`,children:e(`settings.ai.openaiCompatible`)}),(0,E.jsx)(m,{value:`gemini`,children:`Google Gemini`}),(0,E.jsx)(m,{value:`cli`,children:e(`settings.ai.cli`)})]})]})]}),s===`cli`?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.cliHint`)}),N.length===0?(0,E.jsx)(`p`,{className:`rounded-md border p-2 text-xs text-muted-foreground`,children:e(`settings.ai.cliNone`)}):(0,E.jsxs)(`div`,{className:`grid grid-cols-[1fr_220px] items-center gap-3`,children:[(0,E.jsx)(C,{htmlFor:`ai-cli`,className:`text-sm font-medium`,children:e(`settings.ai.cliCommand`)}),(0,E.jsxs)(h,{value:N.includes(l)?l:N[0],onValueChange:u,children:[(0,E.jsx)(f,{id:`ai-cli`,children:(0,E.jsx)(d,{})}),(0,E.jsx)(p,{children:N.map(e=>(0,E.jsx)(m,{value:e,children:e},e))})]})]})]}):(0,E.jsxs)(`div`,{className:`grid gap-3`,children:[s===`anthropic-profile`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.profileHint`)}),!F&&(0,E.jsx)(`p`,{className:`rounded-md border p-2 text-xs text-muted-foreground`,children:e(`settings.ai.profileNone`)})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-[1fr_220px] items-center gap-3`,children:[(0,E.jsx)(C,{htmlFor:`ai-model`,className:`text-sm font-medium`,children:e(`settings.ai.model`)}),(0,E.jsx)(w,{id:`ai-model`,value:l,onChange:e=>u(e.target.value),spellCheck:!1,...D})]})]}),s===`openai`&&(0,E.jsxs)(`div`,{className:`grid grid-cols-[1fr_220px] items-center gap-3`,children:[(0,E.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,E.jsx)(C,{htmlFor:`ai-base-url`,className:`text-sm font-medium`,children:e(`settings.ai.baseUrl`)}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.baseUrlHint`)})]}),(0,E.jsx)(w,{id:`ai-base-url`,value:x,onChange:e=>O(e.target.value),placeholder:`https://api.openai.com/v1`,spellCheck:!1,...D})]}),q||(0,E.jsxs)(`div`,{className:`grid gap-1`,children:[(0,E.jsx)(C,{htmlFor:`ai-key`,className:`text-sm font-medium`,children:e(`settings.ai.key`)}),(0,E.jsx)(w,{id:`ai-key`,type:`password`,value:k,onChange:e=>A(e.target.value),spellCheck:!1,placeholder:t.configured?`••••••••`:``,...D,autoComplete:`new-password`}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.keyHint`)})]}),q||(0,E.jsxs)(`label`,{htmlFor:`ai-remember`,className:`flex cursor-pointer items-start gap-3 rounded-md border p-3 hover:bg-accent/40`,children:[(0,E.jsx)(`input`,{id:`ai-remember`,type:`checkbox`,checked:j,onChange:e=>M(e.target.checked),className:`mt-0.5 size-4 accent-primary`}),(0,E.jsxs)(`span`,{className:`grid flex-1 gap-0.5`,children:[(0,E.jsx)(`span`,{className:`text-sm font-medium`,children:e(`settings.ai.remember`)}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.rememberHint`,{path:t.path})})]})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(n,{size:`sm`,onClick:W,disabled:L||(s===`cli`?N.length===0:!q&&!k.trim()),children:e(`settings.ai.save`)}),t.configured&&(0,E.jsx)(n,{size:`sm`,variant:`ghost`,onClick:G,disabled:L,children:e(`settings.ai.forget`)}),z&&(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:z})]})]})]})}function k(){let e=x(e=>e.activeDialog),t=x(e=>e.closeDialog),{t:i}=r();return(0,E.jsx)(u,{open:e===`ai-settings`,onOpenChange:e=>{e||t()},children:(0,E.jsxs)(s,{className:`sm:max-w-[560px]`,children:[(0,E.jsxs)(a,{children:[(0,E.jsx)(c,{children:i(`settings.ai.title`)}),(0,E.jsx)(l,{children:i(`settings.ai.description`)})]}),(0,E.jsx)(O,{}),(0,E.jsx)(o,{children:(0,E.jsx)(n,{onClick:t,children:i(`settings.done`)})})]})})}export{k as AiSettingsDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r}from"./Cu_sGzNJ.js";import{t as i}from"./
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r}from"./Cu_sGzNJ.js";import{t as i}from"./84VwJAQi.js";import{a,n as o,o as s,r as c,t as l}from"./Udlj1Cgf.js";import{t as u}from"./BQ1Rcyw6.js";var d=e(t(),1),f=r();function p({title:e,rows:t}){return(0,f.jsxs)(`div`,{className:`rounded-lg border bg-card p-3`,children:[(0,f.jsx)(`h3`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),(0,f.jsx)(`dl`,{className:`grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-xs`,children:t.map(([e,t])=>(0,f.jsxs)(`div`,{className:`contents`,children:[(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,f.jsx)(`dd`,{className:`font-mono`,children:t??`—`})]},e))})]})}function m({connectionId:e,tabId:t}){let{t:r}=n(),m=i(e,t,``),[h,g]=(0,d.useState)(null),[_,v]=(0,d.useState)(null),[y,b]=(0,d.useState)(``),x=(0,d.useCallback)(async()=>{try{g(a(String(await m.read(`INFO`)))),v(null)}catch(e){v(e instanceof Error?e.message:String(e))}},[m]);(0,d.useEffect)(()=>{Promise.resolve().then(()=>x())},[x]);let S=e=>h?c(h,e):void 0,C=h?o(h):null,w=(0,d.useMemo)(()=>Object.entries(h?.keyspace??{}).map(([e,t])=>({db:e,...s(t)})),[h]),T=(0,d.useMemo)(()=>Object.entries(h??{}).flatMap(([e,t])=>Object.entries(t).map(([t,n])=>[e,t,n])).filter(([,e,t])=>!y||e.includes(y)||t.includes(y)),[h,y]);return(0,f.jsx)(u,{title:r(`tools.redis.server`),onRefresh:x,autoRefresh:!0,error:_,onDismissError:()=>v(null),children:h&&(0,f.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,f.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-3`,children:[(0,f.jsx)(p,{title:r(`tools.redis.cardServer`),rows:[[`version`,S(`redis_version`)??S(`valkey_version`)],[`mode`,S(`redis_mode`)],[`uptime`,S(`uptime_in_seconds`)?l(Number(S(`uptime_in_seconds`))):void 0],[`os`,S(`os`)]]}),(0,f.jsx)(p,{title:r(`tools.redis.cardMemory`),rows:[[`used`,S(`used_memory_human`)],[`peak`,S(`used_memory_peak_human`)],[`maxmemory`,S(`maxmemory_human`)===`0B`?r(`tools.redis.unlimited`):S(`maxmemory_human`)],[`policy`,S(`maxmemory_policy`)],[`fragmentation`,S(`mem_fragmentation_ratio`)]]}),(0,f.jsx)(p,{title:r(`tools.redis.cardActivity`),rows:[[`ops/sec`,S(`instantaneous_ops_per_sec`)],[`hit rate`,C===null?void 0:`${(C*100).toFixed(1)}%`],[`clients`,S(`connected_clients`)],[`blocked`,S(`blocked_clients`)],[`evicted keys`,S(`evicted_keys`)],[`expired keys`,S(`expired_keys`)]]}),(0,f.jsx)(p,{title:r(`tools.redis.cardPersistence`),rows:[[`role`,S(`role`)],[`replicas`,S(`connected_slaves`)],[`last save`,S(`rdb_last_save_time`)?new Date(Number(S(`rdb_last_save_time`))*1e3).toLocaleString():void 0],[`changes since save`,S(`rdb_changes_since_last_save`)],[`AOF`,S(`aof_enabled`)===`1`?`on`:S(`aof_enabled`)===`0`?`off`:void 0]]})]}),(0,f.jsxs)(`section`,{children:[(0,f.jsx)(`h3`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`tools.redis.keyspace`)}),(0,f.jsxs)(`table`,{className:`w-full max-w-2xl border-collapse text-xs`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,f.jsx)(`th`,{className:`border-b py-1`,children:`db`}),(0,f.jsx)(`th`,{className:`border-b py-1 text-right`,children:`keys`}),(0,f.jsx)(`th`,{className:`border-b py-1 text-right`,children:`expires`}),(0,f.jsx)(`th`,{className:`border-b py-1 text-right`,children:`avg ttl`})]})}),(0,f.jsx)(`tbody`,{children:w.map(e=>(0,f.jsxs)(`tr`,{className:`border-b border-border/50`,children:[(0,f.jsx)(`td`,{className:`py-1 font-mono`,children:e.db}),(0,f.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:e.keys.toLocaleString()}),(0,f.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:e.expires.toLocaleString()}),(0,f.jsx)(`td`,{className:`py-1 text-right`,children:e.avgTtl?l(e.avgTtl/1e3):`—`})]},e.db))})]})]}),(0,f.jsxs)(`section`,{children:[(0,f.jsxs)(`div`,{className:`mb-2 flex items-center gap-3`,children:[(0,f.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`tools.redis.allFields`)}),(0,f.jsx)(`input`,{className:`h-7 w-56 rounded border bg-background px-2 text-xs`,placeholder:r(`tools.filter`),value:y,onChange:e=>b(e.target.value)})]}),(0,f.jsx)(`table`,{className:`w-full border-collapse text-xs`,children:(0,f.jsx)(`tbody`,{children:T.map(([e,t,n])=>(0,f.jsxs)(`tr`,{className:`border-b border-border/40`,children:[(0,f.jsx)(`td`,{className:`w-28 py-0.5 text-muted-foreground`,children:e}),(0,f.jsx)(`td`,{className:`w-72 py-0.5 font-mono`,children:t}),(0,f.jsx)(`td`,{className:`break-all py-0.5 font-mono`,children:n})]},`${e}.${t}`))})})]})]})})}export{m as ServerInfo};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r}from"./Cu_sGzNJ.js";import{F as i}from"./S7HbowYz.js";import{ft as a,
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r}from"./Cu_sGzNJ.js";import{F as i}from"./S7HbowYz.js";import{ft as a,mt as o}from"./CExE8dKz.js";import{r as s}from"./B7zF7RU4.js";import{t as c}from"./84VwJAQi.js";import{t as l}from"./BYvM8E39.js";import{t as u}from"./BQ1Rcyw6.js";import{t as d}from"./_zaonxnw.js";var f=e(t(),1);function p(e){let t=e.indexOf(`:`);return t===-1?`(no prefix)`:e.slice(0,t+1)}function m(e){return e<0?`none`:e<36e5?`lt1h`:e<864e5?`lt1d`:e<6048e5?`lt1w`:`ge1w`}function h(){let e=()=>({count:0,bytes:0});return{analyzed:0,totalBytes:0,byType:{},byPrefix:{},ttl:{none:e(),lt1h:e(),lt1d:e(),lt1w:e(),ge1w:e()},top:[],missingSizes:0}}function g(e,t,n){let r=e[t]??={count:0,bytes:0};r.count+=1,r.bytes+=n}function _(e,t){let n={...e,byType:{...e.byType},byPrefix:{...e.byPrefix},ttl:{...e.ttl},top:[...e.top]};for(let e of Object.keys(n.byType))n.byType[e]={...n.byType[e]};for(let e of Object.keys(n.byPrefix))n.byPrefix[e]={...n.byPrefix[e]};for(let e of Object.keys(n.ttl))n.ttl[e]={...n.ttl[e]};for(let e of t){if(e.ttlMs===-2||e.type===`none`)continue;let t=e.bytes??0;e.bytes===null&&(n.missingSizes+=1),n.analyzed+=1,n.totalBytes+=t,g(n.byType,e.type,t),g(n.byPrefix,p(e.key),t);let r=n.ttl[m(e.ttlMs)];r.count+=1,r.bytes+=t,e.bytes!==null&&(n.top.length<50||t>n.top[n.top.length-1].bytes)&&(n.top.push({key:e.key,type:e.type,bytes:t}),n.top.sort((e,t)=>t.bytes-e.bytes),n.top.length>50&&(n.top.length=50))}return n}function v(e){return Object.entries(e).sort((e,t)=>t[1].bytes-e[1].bytes||t[1].count-e[1].count)}var y=r(),b=300,x=[1e4,1e5,1e6];function S({title:e,rows:t,onRow:n}){return(0,y.jsxs)(`section`,{className:`min-w-0`,children:[(0,y.jsx)(`h3`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),(0,y.jsx)(`table`,{className:`w-full border-collapse text-xs`,children:(0,y.jsx)(`tbody`,{children:t.map(([e,t,r,i])=>(0,y.jsxs)(`tr`,{className:`border-b border-border/50 ${n?`cursor-pointer hover:bg-muted/50`:``}`,onClick:n?()=>n(e):void 0,children:[(0,y.jsx)(`td`,{className:`max-w-0 truncate py-1 pr-2 font-mono`,title:e,children:e}),(0,y.jsx)(`td`,{className:`w-20 py-1 text-right tabular-nums text-muted-foreground`,children:t}),(0,y.jsx)(`td`,{className:`w-24 py-1 text-right tabular-nums`,children:r}),(0,y.jsx)(`td`,{className:`w-14 py-1 text-right tabular-nums text-muted-foreground`,children:i??``})]},e))})})]})}function C({connectionId:e,tabId:t,input:r}){let{t:p}=n(),m=c(e,t,``),[g,C]=(0,f.useState)(r.trim().split(/\s+/)[0]||`db0`),[w,T]=(0,f.useState)(x[1]),[E,D]=(0,f.useState)(null),[O,k]=(0,f.useState)(null),[A,j]=(0,f.useState)(!1),[M,N]=(0,f.useState)(null),P=(0,f.useRef)(!1),[F,I]=(0,f.useState)(0),L=async()=>{P.current=!1,j(!0),N(null);let e=h();D(e);try{let t=Number(await m.read(`DBSIZE`,g));k({scanned:0,total:Number.isFinite(t)?t:null});let n=`0`,r=0;do{let a=await m.read(`SCAN ${n} COUNT ${b}`,g);n=String(a[0]);let o=a[1].slice(0,Math.max(0,w-r));if(o.length>0){let t=await m.readBatch(o.flatMap(e=>{let t=i(e);return[`MEMORY USAGE ${t}`,`TYPE ${t}`,`PTTL ${t}`]}),g),n=o.map((e,n)=>{let[r,i,a]=t.slice(n*3,n*3+3);return{key:e,type:typeof i==`string`?i:`unknown`,bytes:r instanceof Error||r==null?null:Number(r),ttlMs:a instanceof Error?-1:Number(a)}});e=_(e,n),D(e)}r+=o.length,k({scanned:r,total:Number.isFinite(t)?t:null})}while(n!==`0`&&r<w&&!P.current)}catch(e){N(d(e))}finally{j(!1),I(e=>e+1)}},R=e=>E&&E.totalBytes>0?`${(e/E.totalBytes*100).toFixed(1)}%`:``,z={none:p(`tools.redis.ttlNone`),lt1h:`< 1h`,lt1d:`< 1d`,lt1w:`< 1w`,ge1w:`≥ 1w`},B=O?.total?Math.min(100,Math.round(O.scanned/O.total*100)):null;return(0,y.jsx)(u,{title:p(`tools.redis.memory`),onRefresh:async()=>{A||await L()},error:M,onDismissError:()=>N(null),actions:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l,{access:m,value:g,onChange:C,disabled:A,version:F}),(0,y.jsx)(`select`,{value:w,disabled:A,onChange:e=>T(Number(e.target.value)),className:`h-7 rounded border bg-background px-1 text-xs`,children:x.map(e=>(0,y.jsx)(`option`,{value:e,children:p(`tools.redis.upTo`,{count:e.toLocaleString()})},e))}),A?(0,y.jsx)(`button`,{type:`button`,onClick:()=>{P.current=!0},className:`flex h-7 items-center rounded border bg-background px-2 text-muted-foreground hover:text-foreground`,children:p(`tools.stop`)}):(0,y.jsx)(`button`,{type:`button`,onClick:()=>void L(),className:`flex h-7 items-center rounded border border-primary/30 bg-primary/10 px-2 text-primary hover:bg-primary/20`,children:p(`tools.redis.analyze`)})]}),children:(0,y.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:p(`tools.redis.memoryNote`)}),O&&(0,y.jsxs)(`div`,{className:`space-y-1`,children:[(0,y.jsx)(`div`,{className:`h-1.5 w-full max-w-xl overflow-hidden rounded bg-muted`,children:(0,y.jsx)(`div`,{className:`h-full bg-primary transition-all`,style:{width:`${B??(A?30:100)}%`}})}),(0,y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[p(`tools.redis.scanned`,{scanned:O.scanned.toLocaleString(),total:O.total?.toLocaleString()??`?`}),!A&&O.total!==null&&O.scanned<O.total&&` · ${p(`tools.redis.partial`)}`]})]}),E&&E.analyzed===0&&!A&&(0,y.jsx)(`p`,{className:`rounded border border-dashed p-6 text-center text-sm text-muted-foreground`,children:p(`tools.redis.noKeys`,{database:g})}),E&&E.analyzed>0&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap gap-6 text-sm`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:p(`tools.redis.keysAnalyzed`)}),(0,y.jsx)(`div`,{className:`font-semibold tabular-nums`,children:E.analyzed.toLocaleString()})]}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:p(`tools.redis.totalMemory`)}),(0,y.jsx)(`div`,{className:`font-semibold`,children:s(E.totalBytes)})]}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:p(`tools.redis.average`)}),(0,y.jsx)(`div`,{className:`font-semibold`,children:s(Math.round(E.totalBytes/E.analyzed))})]})]}),E.missingSizes>0&&(0,y.jsx)(`p`,{className:`text-xs text-catppuccin-yellow`,children:p(`tools.redis.missingSizes`,{count:E.missingSizes})}),(0,y.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-6`,children:[(0,y.jsx)(S,{title:p(`tools.redis.byType`),rows:v(E.byType).map(([e,t])=>[e,t.count.toLocaleString(),s(t.bytes),R(t.bytes)])}),(0,y.jsx)(S,{title:p(`tools.redis.byTtl`),rows:Object.keys(z).map(e=>[z[e],E.ttl[e].count.toLocaleString(),s(E.ttl[e].bytes),R(E.ttl[e].bytes)])}),(0,y.jsx)(S,{title:p(`tools.redis.byPrefix`),rows:v(E.byPrefix).slice(0,100).map(([e,t])=>[e,t.count.toLocaleString(),s(t.bytes),R(t.bytes)]),onRow:m.readOnly?void 0:t=>{t.endsWith(`:`)&&o(e,`redis-delete`,p(`tools.redis.delete`),`${g} ${t}*`)}}),(0,y.jsx)(S,{title:p(`tools.redis.largest`),rows:E.top.map(e=>[e.key,e.type,s(e.bytes)]),onRow:t=>a(e,{database:g,name:t})})]}),!m.readOnly&&(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:p(`tools.redis.prefixHint`)})]})]})})}export{C as MemoryAnalysis};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r}from"./Cu_sGzNJ.js";import{F as i}from"./S7HbowYz.js";import{n as a}from"./C1gqjEN3.js";import{h as o}from"./
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r}from"./Cu_sGzNJ.js";import{F as i}from"./S7HbowYz.js";import{n as a}from"./C1gqjEN3.js";import{h as o}from"./BnJGrP6V.js";import{t as s}from"./84VwJAQi.js";import{t as c}from"./BYvM8E39.js";import{t as l}from"./BQ1Rcyw6.js";import{t as u}from"./_zaonxnw.js";var d=e(t(),1),f=r(),p=1e5,m=500,h=20;function g({connectionId:e,tabId:t,input:r}){let{t:g}=n(),_=s(e,t,``),[v,...y]=r.trim().split(/\s+/),[b,x]=(0,d.useState)(v||`db0`),[S,C]=(0,d.useState)(y.join(` `)||``),[w,T]=(0,d.useState)(null),[E,D]=(0,d.useState)(``),[O,k]=(0,d.useState)(null),[A,j]=(0,d.useState)(null),[M,N]=(0,d.useState)(null),P=(0,d.useRef)(!1),[F,I]=(0,d.useState)(0),L=async()=>{if(S.trim()){k(`preview`),N(null),j(null),D(``),P.current=!1;try{let e=new Set,t=`0`;do{let n=await _.read(`SCAN ${t} MATCH ${i(S)} COUNT 1000`,b);t=String(n[0]);for(let t of n[1])e.add(t)}while(t!==`0`&&e.size<p&&!P.current);T({pattern:S,database:b,keys:[...e].slice(0,p),capped:t!==`0`})}catch(e){N(u(e))}finally{k(null)}}},R=async()=>{if(!w||E!==w.pattern)return;k(`delete`),N(null),P.current=!1;let n=0,r=performance.now();try{for(let e=0;e<w.keys.length&&!P.current;e+=m){let t=w.keys.slice(e,e+m);await _.write(`UNLINK ${t.map(i).join(` `)}`,{confirmed:!0,database:w.database,skipHistory:!0}),n+=t.length,j(n)}}catch(e){e instanceof Error&&e.name===`ExecutionCancelled`||N(u(e))}finally{a.getState().recordExecution({connectionId:e,tabId:t,query:`UNLINK <${n} keys matching ${w.pattern}>`,database:w.database,executionTime:Math.round(performance.now()-r),kind:`UNLINK`,affectedRows:n}),k(null),T(null),D(``),I(e=>e+1),o(e)}};return _.readOnly?(0,f.jsx)(l,{title:g(`tools.redis.delete`),onRefresh:async()=>{},error:null,onDismissError:()=>{},children:(0,f.jsx)(`p`,{className:`p-6 text-sm text-muted-foreground`,children:g(`tools.redis.deleteReadOnly`)})}):(0,f.jsx)(l,{title:g(`tools.redis.delete`),onRefresh:async()=>{O||await L()},error:M,onDismissError:()=>N(null),children:(0,f.jsxs)(`div`,{className:`max-w-3xl space-y-4 p-4 text-xs`,children:[(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:g(`tools.redis.deleteIntro`)}),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsx)(c,{access:_,value:b,onChange:e=>{x(e),T(null)},disabled:O!==null,version:F}),(0,f.jsx)(`input`,{className:`h-7 w-80 rounded border bg-background px-2 font-mono`,placeholder:`session:*`,value:S,disabled:O!==null,onChange:e=>{C(e.target.value),T(null)},onKeyDown:e=>{e.key===`Enter`&&L()}}),O===`preview`?(0,f.jsx)(`button`,{type:`button`,onClick:()=>{P.current=!0},className:`h-7 rounded border bg-background px-2 text-muted-foreground`,children:g(`tools.stop`)}):(0,f.jsx)(`button`,{type:`button`,disabled:!S.trim()||O!==null,onClick:()=>void L(),className:`h-7 rounded border border-primary/30 bg-primary/10 px-2 text-primary hover:bg-primary/20 disabled:opacity-40`,children:g(`tools.redis.preview`)})]}),S.trim()===`*`&&(0,f.jsx)(`p`,{className:`text-catppuccin-yellow`,children:g(`tools.redis.deleteAllWarning`)}),w&&(0,f.jsxs)(`div`,{className:`space-y-3 rounded-lg border p-3`,children:[(0,f.jsxs)(`p`,{children:[(0,f.jsx)(`strong`,{children:g(`tools.redis.matchCount`,{count:w.keys.length.toLocaleString(),database:w.database})}),w.capped&&(0,f.jsx)(`span`,{className:`ml-2 text-catppuccin-yellow`,children:g(`tools.redis.matchCapped`,{cap:p.toLocaleString()})})]}),w.keys.length>0&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`ul`,{className:`max-h-48 overflow-auto rounded bg-muted/40 p-2 font-mono`,children:[w.keys.slice(0,h).map(e=>(0,f.jsx)(`li`,{className:`truncate`,children:e},e)),w.keys.length>h&&(0,f.jsxs)(`li`,{className:`text-muted-foreground`,children:[`… `,(w.keys.length-h).toLocaleString()]})]}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:g(`tools.redis.deleteConfirm`,{pattern:w.pattern})}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`input`,{className:`h-7 w-80 rounded border bg-background px-2 font-mono`,value:E,onChange:e=>D(e.target.value),placeholder:w.pattern}),O===`delete`?(0,f.jsx)(`button`,{type:`button`,onClick:()=>{P.current=!0},className:`h-7 rounded border bg-background px-2 text-muted-foreground`,children:g(`tools.stop`)}):(0,f.jsx)(`button`,{type:`button`,disabled:E!==w.pattern,onClick:()=>void R(),className:`h-7 rounded bg-destructive px-3 text-white disabled:opacity-40`,children:g(`tools.redis.deleteKeys`,{count:w.keys.length.toLocaleString()})})]}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:g(`tools.redis.deleteNote`)})]})]}),A!==null&&(0,f.jsx)(`p`,{className:`text-primary`,children:g(`tools.redis.deletedCount`,{count:A.toLocaleString()})})]})})}export{g as BulkDelete};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{n as t,o as n,p as r}from"./CYz610vE.js";import{t as i}from"./CiL8zoYm.js";import{i as a,r as o}from"./Cu_sGzNJ.js";import{a as s,i as c,n as l,o as ee,r as u,t as d}from"./DzRyVlxz.js";import{i as f,t as p}from"./S7HbowYz.js";import{n as m}from"./DU-Eln5x.js";import{n as h}from"./D8_hwGjG.js";import{n as g,t as _}from"./C1gqjEN3.js";import{O as v,
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{n as t,o as n,p as r}from"./CYz610vE.js";import{t as i}from"./CiL8zoYm.js";import{i as a,r as o}from"./Cu_sGzNJ.js";import{a as s,i as c,n as l,o as ee,r as u,t as d}from"./DzRyVlxz.js";import{i as f,t as p}from"./S7HbowYz.js";import{n as m}from"./DU-Eln5x.js";import{n as h}from"./D8_hwGjG.js";import{n as g,t as _}from"./C1gqjEN3.js";import{O as v,dn as y,jt as b,l as x,pt as S,tt as C,vt as w,wt as T}from"./CExE8dKz.js";var E=e(r(),1),D=o(),O={execute:`command.localHistory.reason.execute`,edit:`command.localHistory.reason.edit`,replaced:`command.localHistory.reason.replaced`,restore:`command.localHistory.reason.restore`,close:`command.localHistory.reason.close`},k=Object.freeze([]);function A(e){let t=(Date.now()-e)/36e5;return t<1?`<1h`:t<24?`1-24h`:t<168?`1-7d`:`7d+`}function j(){let{t:e}=a(),r=h(e=>e.activeDialog),o=h(e=>e.closeDialog),j=h(e=>e.setFooterMessage),M=p(e=>e.activeConnectionId),N=g(e=>M?e.activeTabId[M]:null),P=g(e=>M?e.tabs[M]??_:_),F=f(e=>M?e.revisions[M]??k:k),I=m(e=>e.persistQueryHistory),L=C(e=>e.themeId),R=v(L),[z,B]=(0,E.useState)(!0),[V,H]=(0,E.useState)(``),[U,W]=(0,E.useState)(null),[G,K]=(0,E.useState)(`current`),q=P.find(e=>e.id===N),J=r===`local-history`;(0,E.useEffect)(()=>{if(!J)return;let e=N?F.filter(e=>e.docId===N).length:0;n(`local_history_open`,{revisions:t(F.length),tab_revisions:t(e)})},[J]);let Y=(0,E.useMemo)(()=>{let e=V.trim().toLowerCase();return F.filter(t=>z&&N&&t.docId!==N?!1:!e||t.text.toLowerCase().includes(e)||t.title.toLowerCase().includes(e))},[F,V,z,N]),X=q?.query??``,Z=Y.find(e=>e.id===U)??Y.find(e=>e.text!==X)??Y[0],Q=(0,E.useMemo)(()=>{if(!Z)return;let e=F.filter(e=>e.docId===Z.docId);return e[e.findIndex(e=>e.id===Z.id)+1]},[F,Z]),te=G===`current`?X:Q?.text??``;function $(e,t){n(`local_history_recover`,{action:e,reason:t.reason,age:A(t.timestamp),same_tab:t.docId===N,compare:G})}function ne(){if(!M||!N||!Z)return;$(`restore`,Z);let t=g.getState();t.captureRevision(M,N,`restore`),t.setEditorContent(M,N,Z.text),j(e(`command.localHistory.restored`)),o()}function re(){!M||!Z||($(`new_tab`,Z),S(M,Z.text,Z.database,Z.title),j(e(`command.localHistory.openedInTab`)),o())}function ie(e){M&&(f.getState().removeRevision(M,e.id),U===e.id&&W(null))}function ae(){M&&(f.getState().clearRevisions(M),W(null))}return(0,D.jsx)(d,{open:J,onOpenChange:e=>{e||o()},children:(0,D.jsxs)(l,{className:`flex max-h-[85vh] flex-col sm:max-w-[1000px]`,children:[(0,D.jsxs)(s,{children:[(0,D.jsx)(ee,{children:e(`command.localHistory.title`)}),(0,D.jsx)(u,{children:e(`command.localHistory.description`)})]}),!I&&(0,D.jsx)(`p`,{className:`rounded-md border border-dashed px-3 py-2 text-xs text-muted-foreground`,children:e(`command.localHistory.notPersisted`)}),(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsxs)(`div`,{className:`relative min-w-[200px] flex-1`,children:[(0,D.jsx)(b,{className:`absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,D.jsx)(x,{value:V,onChange:e=>H(e.target.value),placeholder:e(`command.localHistory.searchPlaceholder`),className:`h-8 pl-7 text-xs`})]}),(0,D.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:()=>B(!0),className:`px-2 py-1 text-xs ${z?`bg-accent`:`hover:bg-accent/50`}`,children:e(`command.localHistory.scopeTab`)}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>B(!1),className:`border-l px-2 py-1 text-xs ${z?`hover:bg-accent/50`:`bg-accent`}`,children:e(`command.localHistory.scopeAll`)})]}),(0,D.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:()=>K(`current`),className:`px-2 py-1 text-xs ${G===`current`?`bg-accent`:`hover:bg-accent/50`}`,children:e(`command.localHistory.compareCurrent`)}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>K(`previous`),className:`border-l px-2 py-1 text-xs ${G===`previous`?`bg-accent`:`hover:bg-accent/50`}`,children:e(`command.localHistory.comparePrevious`)})]})]}),Y.length===0?(0,D.jsx)(`div`,{className:`py-10 text-center text-sm text-muted-foreground`,children:F.length===0?e(`command.localHistory.empty`):e(`command.localHistory.noMatch`)}):(0,D.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[260px_1fr] gap-3`,children:[(0,D.jsx)(w,{className:`h-[440px] rounded-md border`,children:(0,D.jsx)(`ul`,{className:`divide-y`,children:Y.map(t=>(0,D.jsxs)(`li`,{className:`group relative`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>W(t.id),className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 pr-8 text-left text-xs hover:bg-accent ${t.id===Z?.id?`bg-accent`:``}`,children:[(0,D.jsx)(`span`,{className:`font-medium`,children:new Date(t.timestamp).toLocaleString()}),(0,D.jsxs)(`span`,{className:`w-full truncate text-muted-foreground`,children:[t.title,` · `,e(O[t.reason]),` · `,e(`command.localHistory.chars`,{count:t.text.length})]})]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>ie(t),title:e(`command.localHistory.delete`),className:`absolute right-1.5 top-1.5 rounded p-1 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100`,children:(0,D.jsx)(T,{className:`h-3.5 w-3.5`})})]},t.id))})}),(0,D.jsxs)(`div`,{className:`flex h-[440px] flex-col overflow-hidden rounded-md border`,children:[(0,D.jsx)(`div`,{className:`border-b bg-muted/40 px-3 py-1.5 text-xs text-muted-foreground`,children:G===`current`?e(`command.localHistory.diffAgainstCurrent`):Q?e(`command.localHistory.diffAgainstPrevious`,{time:new Date(Q.timestamp).toLocaleString()}):e(`command.localHistory.noPrevious`)}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,D.jsx)(y,{language:`sql`,theme:R,original:Z?.text??``,modified:te,options:{readOnly:!0,renderSideBySide:!1,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12,renderOverviewRuler:!1}})})]})]}),(0,D.jsxs)(c,{className:`sm:justify-between`,children:[(0,D.jsx)(i,{variant:`ghost`,onClick:ae,disabled:F.length===0,children:e(`command.localHistory.clearAll`)}),(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[(0,D.jsx)(i,{variant:`outline`,onClick:o,children:e(`command.close`)}),(0,D.jsx)(i,{variant:`outline`,onClick:re,disabled:!Z,children:e(`command.localHistory.openInNewTab`)}),(0,D.jsx)(i,{onClick:ne,disabled:!Z||!q,children:e(`command.localHistory.restore`)})]})]})]})})}export{j as LocalHistoryDialog};
|