1
0
Files
build.ems/build/usr/local/omc/htdocs/front/js/index.3lS6in7J.js
2024-10-25 14:59:47 +08:00

2 lines
7.9 KiB
JavaScript

import{g as Y,r as Z,_ as O,W as ee,A as te,k as v,m as y,n as t,t as n,p as o,E as h,F as f,az as E,B as b,J as P,I as V,ak as ae,l,V as oe,aB as ne,aF as le}from"./vendor/index.CRpmXtWV.js";import{g as ce,c as ie,l as re,a as se,b as de,d as me}from"./cache.v_rt5LR2.js";import{d as ue,$ as pe,R as x}from"../index.D-NvtsOM.js";const he={style:{padding:"8px"}},fe={style:{padding:"8px"}},xe=Y({__name:"index",setup(ge){const{t:e}=ue();let i=Z(!1),r=O({loading:!0,data:{cacheKey:"",cacheName:"",cacheValue:"",remark:""}});function F(a){pe(["monitor:cache:query"])&&(i.value||(i.value=!0,r.loading=!0,ce(m.cacheName,a).then(c=>{i.value=!1,c.code===x&&(r.data=Object.assign(r.data,c.data),r.loading=!1)})))}let q=[{title:e("common.rowId"),dataIndex:"num",width:"50px",align:"center",customRender(a){return a.index+1}},{title:e("views.monitor.cache.cacheKey"),dataIndex:"cacheKey",align:"left",ellipsis:!0,customRender(a){return a.text},customFilterDropdown:!0,onFilter:(a,c)=>{if(typeof a=="string")return c.cacheKey.toLowerCase().includes(a.toLowerCase())}},{title:e("common.operate"),key:"option",align:"center",width:"50px"}],m=O({loading:!1,data:[],cacheName:""});function M(a){if(i.value)return;i.value=!0;const c=l.message.loading(e("common.loading"),0);ie(m.cacheName,a).then(u=>{c(),i.value=!1,u.code===x?(l.message.success({content:e("views.monitor.cache.clearCacheKeyOk",{txt:a}),duration:3}),!r.loading&&r.data.cacheKey===a&&(r.loading=!0)):l.message.error({content:u.msg,duration:3}),w()})}function w(a="load"){if(a==="load"&&(a=m.cacheName),!a){l.message.warning(e("views.monitor.cache.cacheKeyListErr"),3);return}i.value||(i.value=!0,m.loading=!0,re(a).then(c=>{i.value=!1,c.code===x&&c.data&&(m.cacheName=a,m.data=c.data,m.loading=!1)}))}let C=O({loading:!0,data:[]}),U=[{title:e("common.rowId"),dataIndex:"num",width:"50px",align:"center",customRender(a){return a.index+1}},{title:e("views.monitor.cache.cacheName"),dataIndex:"cacheName",align:"left",ellipsis:!0,customRender(a){return a.text},customFilterDropdown:!0,onFilter:(a,c)=>{if(typeof a=="string")return c.cacheName.toLowerCase().includes(a.toLowerCase())}},{title:e("views.monitor.cache.remark"),dataIndex:"remark",align:"left",ellipsis:!0},{title:e("common.operate"),key:"option",align:"center",width:"50px"}];function j(){if(i.value)return;i.value=!0;const a=l.message.loading(e("common.loading"),0);se().then(c=>{a(),i.value=!1,c.code===x?(l.message.success({content:e("views.monitor.cache.clearCacheSafeOk"),duration:3}),m.loading=!0,r.loading=!0):l.message.error({content:c.msg,duration:3})})}function A(a){if(i.value)return;i.value=!0;const c=l.message.loading(e("common.loading"),0);de(a).then(u=>{c(),i.value=!1,u.code===x?(l.message.success({content:e("views.monitor.cache.clearCacheNameOk",{txt:a}),duration:3}),!r.loading&&r.data.cacheName===a&&(r.loading=!0)):l.message.error({content:u.msg,duration:3}),w(a)})}function S(){i.value||(i.value=!0,C.loading=!0,me().then(a=>{i.value=!1,a.code===x&&a.data&&(C.data=a.data,C.loading=!1)}))}return ee(()=>{S()}),(a,c)=>{const u=oe,p=l.Button,N=l.Tooltip,$=ne,K=l.Popconfirm,J=l.Space,z=l.Input,B=l.Table,L=l.Card,T=l.Col,W=le,R=l.DescriptionsItem,G=l.Textarea,H=l.TypographyParagraph,Q=l.Descriptions,X=l.Row,k=te("perms");return v(),y(o(ae),null,{default:t(()=>[n(X,{gutter:20},{default:t(()=>[n(T,{lg:8,md:8,xs:24},{default:t(()=>[n(L,{title:o(e)("views.monitor.cache.cacheList"),bordered:!1,"body-style":{marginBottom:"24px",padding:0}},{extra:t(()=>[n(J,{size:8,align:"center"},{default:t(()=>[n(N,null,{title:t(()=>[h(f(o(e)("common.reloadText")),1)]),default:t(()=>[n(p,{type:"text",onClick:E(S,["prevent"])},{icon:t(()=>[n(u)]),_:1})]),_:1}),n(N,null,{title:t(()=>[h(f(o(e)("views.monitor.cache.clearCacheSafe")),1)]),default:t(()=>[n(K,{placement:"bottomRight",title:o(e)("views.monitor.cache.clearCacheSafeTip"),"ok-text":o(e)("common.ok"),"cancel-text":o(e)("common.cancel"),onConfirm:c[0]||(c[0]=s=>j())},{default:t(()=>[b((v(),y(p,{type:"text"},{icon:t(()=>[n($)]),_:1})),[[k,["monitor:cache:remove"],"has"]])]),_:1},8,["title","ok-text","cancel-text"])]),_:1})]),_:1})]),default:t(()=>[n(B,{"row-key":"cacheName",size:"small",columns:o(U),"data-source":o(C).data,loading:o(C).loading,scroll:{y:"calc(100vh - 350px)"},pagination:!1,"row-selection":{type:"radio",onChange:s=>w(s[0])}},{customFilterDropdown:t(({setSelectedKeys:s,selectedKeys:g,confirm:_,clearFilters:D,column:I})=>[P("div",he,[n(z,{placeholder:o(e)("views.monitor.cache.filterPlace",{txt:I.title}),value:g[0],style:{width:"188px","margin-bottom":"8px",display:"block"},onChange:d=>s(d.target.value?[d.target.value]:[]),onPressEnter:d=>_()},null,8,["placeholder","value","onChange","onPressEnter"]),n(p,{type:"primary",size:"small",style:{width:"90px","margin-right":"8px"},onClick:d=>_()},{default:t(()=>[h(f(o(e)("views.monitor.cache.filter")),1)]),_:2},1032,["onClick"]),n(p,{size:"small",style:{width:"90px"},onClick:d=>D({confirm:!0})},{default:t(()=>[h(f(o(e)("common.reset")),1)]),_:2},1032,["onClick"])])]),bodyCell:t(({column:s,record:g})=>[s.key==="option"?(v(),y(K,{key:0,placement:"topRight",title:o(e)("views.monitor.cache.clearCacheNameTip"),",":"","ok-text":o(e)("common.ok"),"cancel-text":o(e)("common.cancel"),onConfirm:_=>A(g.cacheName)},{default:t(()=>[b((v(),y(p,{type:"text"},{icon:t(()=>[n($)]),_:1})),[[k,["monitor:cache:remove"],"has"]])]),_:2},1032,["title","ok-text","cancel-text","onConfirm"])):V("",!0)]),_:1},8,["columns","data-source","loading","scroll","row-selection"])]),_:1},8,["title"])]),_:1}),n(T,{lg:8,md:8,xs:24},{default:t(()=>[n(L,{title:o(e)("views.monitor.cache.keyNameList"),bordered:!1,"body-style":{marginBottom:"24px",padding:0}},{extra:t(()=>[n(N,null,{title:t(()=>[h(f(o(e)("common.reloadText")),1)]),default:t(()=>[n(p,{type:"text",onClick:c[1]||(c[1]=E(s=>w(),["prevent"]))},{icon:t(()=>[n(u)]),_:1})]),_:1})]),default:t(()=>[n(B,{"row-key":"cacheKey",size:"small",columns:o(q),"data-source":o(m).data,loading:o(m).loading,scroll:{y:"calc(100vh - 350px)"},pagination:!1,"row-selection":{type:"radio",onChange:s=>F(s[0])}},{customFilterDropdown:t(({setSelectedKeys:s,selectedKeys:g,confirm:_,clearFilters:D,column:I})=>[P("div",fe,[n(z,{placeholder:o(e)("views.monitor.cache.filterPlace",{txt:I.title}),value:g[0],style:{width:"188px","margin-bottom":"8px",display:"block"},onChange:d=>s(d.target.value?[d.target.value]:[]),onPressEnter:d=>_()},null,8,["placeholder","value","onChange","onPressEnter"]),n(p,{type:"primary",size:"small",style:{width:"90px","margin-right":"8px"},onClick:d=>_()},{default:t(()=>[h(f(o(e)("views.monitor.cache.filter")),1)]),_:2},1032,["onClick"]),n(p,{size:"small",style:{width:"90px"},onClick:d=>D({confirm:!0})},{default:t(()=>[h(f(o(e)("common.reset")),1)]),_:2},1032,["onClick"])])]),bodyCell:t(({column:s,record:g})=>[s.key==="option"?(v(),y(K,{key:0,placement:"topRight",title:o(e)("views.monitor.cache.clearCacheKeyTip"),",":"","ok-text":o(e)("common.ok"),"cancel-text":o(e)("common.cancel"),onConfirm:_=>M(g.cacheKey)},{default:t(()=>[b((v(),y(p,{type:"text"},{icon:t(()=>[n(W)]),_:1})),[[k,["monitor:cache:remove"],"has"]])]),_:2},1032,["title","ok-text","cancel-text","onConfirm"])):V("",!0)]),_:1},8,["columns","data-source","loading","scroll","row-selection"])]),_:1},8,["title"])]),_:1}),b((v(),y(T,{lg:8,md:8,xs:24},{default:t(()=>[n(L,{title:o(e)("views.monitor.cache.keyContent"),bordered:!1,"body-style":{marginBottom:"24px",padding:0},loading:o(r).loading},{default:t(()=>[n(Q,{size:"small",layout:"vertical",bordered:!0,column:1},{default:t(()=>[n(R,{label:o(e)("views.monitor.cache.cacheName")},{default:t(()=>[h(f(o(r).data.cacheName),1)]),_:1},8,["label"]),n(R,{label:o(e)("views.monitor.cache.cacheKey")},{default:t(()=>[h(f(o(r).data.cacheKey),1)]),_:1},8,["label"]),n(R,{label:o(e)("views.monitor.cache.cacheValue")},{default:t(()=>[n(H,null,{default:t(()=>[n(G,{value:o(r).data.cacheValue,"auto-size":{minRows:4,maxRows:20},maxlength:4e3,disabled:!0},null,8,["value"])]),_:1})]),_:1},8,["label"])]),_:1})]),_:1},8,["title","loading"])]),_:1})),[[k,["monitor:cache:query"],"has"]])]),_:1})]),_:1})}}});export{xe as default};