← Back
Editing: index342.js
import{c as a,g as e,e as s,B as l,D as t,H as i,G as o,ax as n,av as r,aR as d,b0 as p,a5 as u,q as c,v as f,y as m,x as v}from"./base-lib.js?v=1765440387";import{M as x,f5 as g,l as _,L as b,o as h,K as w,f3 as y,it as j,iu as k,f1 as L,G as C,e as R}from"./utils-lib.js?v=1765440387";import{h as q}from"./form-item.js?v=1765440387";import{u as D,h as G,f as I}from"./index63.js?v=1765440387";import"./__commonjsHelpers__.js?v=1765440387";import"./index94.js?v=1765440387";import"./index93.js?v=1765440387";import"./column.js?v=1765440387";import"./useController6.js?v=1765440387";import"./site.js?v=1765440387";import"./validator.js?v=1765440387";import"./useStore3.js?v=1765440387";const{redisGroupDetail:S,isRedisRefreshList:T}=D(),O=async a=>{const{row:e,slaveListLoad:s,api:l,loadingText:t,needConfirm:i,confirmOptions:o}=a,n=e.data.node_id,r=S.value.group_info.group_id;try{i&&o&&await h(o),await w({loading:t,request:l({group_id:r,slave_node_id:n}),message:!0,success:async a=>{s.value=!0;const{data:e}=await y({group_id:r});S.value.slave_details=e.data.slave_details,s.value=!1,T.value=!0}})}catch(d){}},P={class:"p-[2rem] redis-mgt-group-page"},B=R(a({__name:"index",setup(a){const{redisGroupDetail:h,slaveListLoad:w}=D(),y=e(()=>{var a,e,t,i,o,n,r;const d=(null==(e=null==(a=h.value)?void 0:a.master_detail)?void 0:e.data)||{},p=d.memory||{},u=d.performance||{},c=s("span",{class:"text-[#999]"},[l("...")]);return[{label:"节点地址",value:null!=(t=d.address)?t:c},{label:"Redis版本",value:null!=(i=d.redis_version)?i:c},{label:"运行天数",value:L(d.uptime_days)?c:d.uptime_days+"天"},{label:"内存使用",value:null!=(o=p.used_memory_human)?o:c},{label:"当前QPS",value:null!=(n=u.qps)?n:c},{label:"连接数",value:null!=(r=d.connected_slaves)?r:c}]}),{BtForm:R}=C({data:h.value,options:a=>e(()=>[q("",()=>s("div",{class:"w-full mb-[32px]"},[s("div",{class:"flex items-center mb-[20px]"},[s("span",{class:"text-[14px] mr-[1rem]"},[l("基本信息")]),s(t,{disabled:w.value,type:"default",class:"!h-[28px] !text-[12px]",onClick:()=>G(h,"master")},{default:()=>[l("查看详细信息")]})]),s("div",{class:"grid grid-cols-2 gap-x-[24px] gap-y-[12px] text-[#666]"},[y.value.map(a=>s("div",{class:"flex justify-between items-center bg-[#fafafa] rounded-[6px] px-[16px] py-[8px]"},[s("span",{class:"font-bold w-[90px] flex-shrink-0"},[a.label]),s("span",{class:"flex-1 text-right"},[a.value])]))])]),"base_info"),q("",()=>{var a;return s("div",{class:"w-full"},[s("div",{class:"flex items-center mb-[12px]"},[s("span",{class:"text-[14px]"},[l("从节点列表")]),s(t,{type:"primary",class:"ml-auto !h-[28px] !px-[12px] !text-[12px]",onClick:()=>(async a=>{var e;const s=null==(e=a.group_info)?void 0:e.group_id,l=x.load("正在获取可用从节点,请稍后...");try{const{data:a}=await g();a.status||x.error(a.msg||"获取可用节点数据失败!");const e=a.data.filter(a=>null===a.group_info);_({title:"添加从节点",area:50,btn:["添加从节点","取消"],component:()=>b(()=>import("./add-slave-node.js?v=1765440387"),__vite__mapDeps([]),import.meta.url),compData:{group_id:s,nodes:e||[]}})}catch(t){}finally{null==l||l.close()}})(h.value)},{default:()=>[l("添加从节点")]})]),i(s(n,{data:h.value.slave_details,"table-layout":"auto",height:(null==(a=h.value.slave_details)?void 0:a.length)>10?"40rem":"auto",class:"w-full"},{default:()=>[s(r,{prop:"server_ip",label:"地址","min-width":"140"},{default:({row:a})=>s("span",{class:"text-[12px]"},[a.data.server_ip])}),s(r,{prop:"status",label:"状态",width:"80"},{default:({row:a})=>"online"===a.data.status?s("span",{class:"bg-[#eaffea] text-[#20a53a] px-[8px] py-[2px] rounded"},[l("在线")]):s("span",{class:"bg-[#fff1f0] text-[#ff4d4f] cursor-pointer px-[8px] py-[2px] rounded"},[l("离线"),s(d,{content:a.data.replication.error,placement:"top"},{default:()=>[s("span",{class:"ml-4px bt-ico-ask"},[l("?")])]})])}),s(r,{prop:"health_score",label:"健康度",width:"80"},{default:({row:a})=>{const e=a.data.health_score||0,t="online"===a.data.status;return s("span",{style:{display:"inline-flex",alignItems:"center"}},[s("span",{style:{display:"inline-flex",justifyContent:"center",alignItems:"center",width:"40px",height:"40px",borderRadius:"50%",background:t?"#22c55e":"#ef4444",color:"#fff",fontWeight:700,fontSize:"12px",marginRight:"4px",transition:"background 0.2s"}},[e,l("%")])])}}),s(r,{prop:"memory",label:"内存",width:"60"},{default:({row:a})=>I(a.data.memory.usage_percent)}),s(r,{prop:"qps",label:"QPS",width:"80"},{default:({row:a})=>a.data.performance.qps||"--"}),s(r,{prop:"lag",label:"延迟(秒)",width:"80"},{default:({row:a})=>a.data.replication.lag||"--"}),s(r,{prop:"delay",label:"偏移量",width:"80"},{default:({row:a})=>a.data.replication.repl_offset||"--"}),s(r,{align:"right",label:"操作",width:"140"},{default:({$index:a,row:e})=>s("div",{class:"flex items-center justify-end"},["offline"===e.data.status&&s("span",null,[s("span",{class:"bt-link",onClick:()=>((a,e)=>O({row:a,slaveListLoad:e,api:k,loadingText:"正在重连,请稍后..."}))(e,w)},[l("重启")]),s(p,{direction:"vertical"},null)]),s("span",{class:"bt-link",onClick:()=>G(e,"slave")},[l("详情")]),"online"===e.data.status&&s("span",null,[s(p,{direction:"vertical"},null),s("span",{class:"bt-link",onClick:()=>((a,e)=>O({row:a,slaveListLoad:e,api:j,loadingText:"正在移除从节点,请稍后...",needConfirm:!0,confirmOptions:{icon:"warning-filled",title:"移除从节点",content:"即将移除该从节点,是否继续操作?"}}))(e,w)},[l("移除")])])])})]}),[[o("bt-loading"),w.value]])])},"slave_table")])});return u(()=>{h.value={},w.value=!0}),(a,e)=>(c(),f("div",P,[m("div",null,[s(v(R))])]))}}),[["__scopeId","data-v-a251a9c0"]]);export{B as default}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) }
Save File
Cancel