import{aa as e,l as a,a4 as t,$ as s,ac as l,af as i,x as o,A as n,a7 as u,z as r,a3 as d}from"./utils-lib.js?v=20260328163632";import{B as v}from"./index98.js?v=20260328163632";import{u as c}from"./index92.js?v=20260328163632";import{u as m}from"./store.js?v=20260328163632";import{o as p,k as y,s as k}from"./useMethod2.js?v=20260328163632";import{k as b,l as g,m as f}from"./database.js?v=20260328163632";import{r as _,c as j,O as w}from"./base-lib.js?v=20260328163632";const{pluginInfo:x,rowData:h,isHaveServer:C}=m(),I=_(0),O=_([]);_("all");const R=_(0),A=_(""),E=_([]),S=e=>e.key,B=j((()=>{var e;return-1===(null==(e=x.value)?void 0:e.status_code)&&!C.value})),D=e=>{h.value=e?{...e,dbIndex:I.value}:null,n({title:a("{0}Redis数据库",[a(e?"编辑":"添加")]),area:440,showFooter:!0,component:()=>u((()=>import("./index105.js?v=20260328163632")),[],import.meta.url)})},q=()=>{n({isAsync:!0,title:a("Redis备份列表"),area:800,component:()=>u((()=>import("./index126.js?v=20260328163632")),[],import.meta.url)})},L=_({columns:[e(),{title:a("键"),key:"key"},{title:a("值"),key:"value",width:320,ellipsis:{tooltip:!0}},{title:a("数据类型"),key:"dataType"},{title:a("数据长度"),key:"value",render:e=>e.value.length},{title:a("有效期"),key:"ttl",render:e=>-1e-9===e.ttl?a("永久"):a("{0}秒",[e.ttl])},t([{onClick:D,title:a("编辑")},{onClick:async e=>{await r({title:a("提示"),content:a("此操作将删除选中的数据【{0}】, 是否继续",[e.key])}),o({loading:a("正在删除数据库，请稍后..."),request:g({sid:R.value,dbIndex:I.value,keys:JSON.stringify([e.key])}),message:!0,success:()=>{H()}})},title:a("删除")}])],data:[]}),T=_({page:1,pageSize:20,itemCount:0,pageSlot:5}),[z,M]=s(L),[P]=d(T),{BtBatch:V}=l({tableRef:M,checkedRowKeys:E,options:[{label:a("删除键值"),value:"delete",event:async(e,t,s,l,o,n)=>{const{label:u,value:r}=l,d=new Map([["delete",a("即将批量删除键值")]]),v=async e=>{const a=new Map([["delete",g]]),{key:t}=e,s=a.get(r);if("delete"===r)if(s)return await s({sid:R.value,dbIndex:I.value,keys:JSON.stringify([t])})};await e({title:a("批量{0}",[u]),content:d.get(r)+a("，是否继续操作？"),column:[{title:a("键"),key:"key"},i()],onConfirm:async()=>(await t(v),H(),o&&o(),!1)})}}]}),F=j((()=>{var e;return[{active:!0,label:a("添加Key"),onClick:()=>D()},{label:a("远程服务器"),onClick:p},{label:a("备份列表"),onClick:q},{label:a("清空数据库"),onClick:()=>{n({title:a("清理数据库"),area:420,compData:{sid:R.value,keyList:O.value},showFooter:!0,component:()=>u((()=>import("./index127.js?v=20260328163632")),[],import.meta.url)})}},{type:"custom",hide:-1===(null==(e=x.value)?void 0:e.status_code),render:()=>w(v,{isRequest:!1,pluginInfo:x.value},null)}]})),{BtOperation:J}=c({options:F}),K=async e=>{o({request:f({sid:e}),data:Array,success:e=>{O.value=e.map((e=>({...e,tab:e.name,label:e.name,value:e.id,name:e.id})))}})},N=()=>{T.value.page=1,H()},H=()=>{o({request:b({dbIndex:I.value,sid:R.value,p:T.value.page,limit:T.value.pageSize,search:A.value}),success:e=>{L.value.data=e.data.data||[],T.value.itemCount=e.data.page.total}})},$=e=>{I.value=e,H()},G=e=>{R.value=e,K(e),H()},Q=async()=>{U(),await y(),C.value&&(R.value=k.value[0].value,K(R.value),H())},U=()=>{h.value=null,A.value="",R.value=0,Object.assign(T.value,{page:1,itemCount:0})};export{J as B,H as a,B as b,G as c,O as d,I as e,A as f,K as g,N as h,Q as i,z as j,E as k,S as l,V as m,P as n,$ as o,T as p,U as r,R as s};
