2 lines
5.4 KiB
JavaScript
2 lines
5.4 KiB
JavaScript
var B=(n,g,c)=>new Promise((f,C)=>{var v=o=>{try{a(c.next(o))}catch(_){C(_)}},k=o=>{try{a(c.throw(o))}catch(_){C(_)}},a=o=>o.done?f(o.value):Promise.resolve(o.value).then(v,k);a((c=c.apply(n,g)).next())});import{d_ as F,k as O,aJ as R,a as I,d$ as A,cX as N,dW as z,cU as V,cF as E,aL as u,o as t,h as p,j as w,p as r,t as h,aN as b,F as y,aM as T,q as m,b5 as P,cI as j,bi as q,x}from"./index.f8bcf808.js";import{T as G}from"./index.8cf0b441.js";import{S as J}from"./index.b5bef3a7.js";import{T as K}from"./index.4439470b.js";import{B as W,u as X}from"./useTable.1f9e9a8e.js";import"./BasicForm.82e222ab.js";import{a as H,b as D,g as Q}from"./common.4f9a0f43.js";import Y from"./Login.3ad5f2f7.js";import{b as Z}from"./index.a4e346ff.js";import"./transButton.ce0379fb.js";import"./CopyOutlined.b31829d4.js";import"./index.d82b2be8.js";import"./useForm.15b4451f.js";import"./index.d4c4849e.js";import"./index.40c44490.js";import"./index.060f9061.js";import"./index.0e7d1863.js";import"./useWindowSizeFn.d2a0a89b.js";import"./useContentViewHeight.0d100a60.js";import"./ArrowLeftOutlined.73a6b26e.js";import"./index.05080ca7.js";import"./_baseIteratee.f49fbaac.js";import"./index.91cad2d2.js";import"./sortable.esm.c20789c1.js";import"./RedoOutlined.ed3d1686.js";import"./FullscreenOutlined.f88b6f65.js";import"./fromPairs.2341303e.js";import"./scrollTo.d51d60f9.js";import"./index.fe83b607.js";import"./index.bf9f5082.js";import"./index.14ba2351.js";import"./index.293b5840.js";import"./index.26a767f7.js";import"./uniqBy.0ae55b98.js";import"./download.b66616ed.js";import"./index.f2e779e6.js";import"./useLogin.7cc7f83b.js";function ee(n){let g,c=document.body;if(Reflect.has(n,"target")||Reflect.has(n,"props")){const a=n;g=a.props||{},c=a.target||document.body}else g=n;const f=F(g,void 0,!0);return[()=>{const a=O(c);!a||f.open(a)},()=>{f.close()},a=>{f.setTip(a)}]}const te="/app/admin/plugin/app/list",ne="/app/admin/plugin/app/schema",ae=I({components:{BasicTable:W,Tag:G,Switch:J,ModalLogin:Y,DropdownButton:A,Menu:N,MenuItem:z,DownOutlined:V,TypographyText:K},setup(){const{createMessage:n}=x(),{success:g,error:c}=n,[f,{openModal:C}]=Z(),[v,k]=ee({tip:"Processing..."});E(()=>B(this,null,function*(){S(yield H(ne))}));const a=(l,s)=>{o("OK to uninstall\uFF1F","",function(){M(l,s)})},o=(l,s,e)=>{j.confirm({centered:!0,title:()=>l,icon:()=>w(q),content:()=>w("div",{style:"color:red;"},s),onOk(){e()},class:"test"})};function _(l,s,e){return B(this,null,function*(){if(e!=s){v();try{const i=yield D("/app/admin/plugin/app/install",{name:l,version:s},{timeout:6e4});if(i.code==401){C();return}if(i.code){c(i.message);return}g("Successful installation"),setTimeout(()=>{location.reload()},1e3)}catch(i){}finally{k()}}})}function M(l,s){return B(this,null,function*(){try{v(),yield D("/app/admin/plugin/app/uninstall",{name:l,version:s})}catch(e){k();return}k(),setTimeout(()=>{location.reload()},1e3),g("Uninstallation succeeded")})}function U(l){console.log(l)}const[$,{reload:L,setColumns:S}]=X({api:Q(te),bordered:!0,showTableSetting:!0});return{registerTable:$,reload:L,onStateChanged:U,install:_,uninstall:M,register:f,showConfirmUninstall:a}}}),se={class:"p-4"},oe={key:0,style:{"text-align":"left"}};function ie(n,g,c,f,C,v){const k=u("Tag"),a=u("Switch"),o=u("TypographyText"),_=u("a-button"),M=u("MenuItem"),U=u("Menu"),$=u("DownOutlined"),L=u("DropdownButton"),S=u("BasicTable"),l=u("ModalLogin");return t(),p("div",se,[w(S,{onRegister:n.registerTable},{bodyCell:r(({column:s,record:e,text:i})=>[s.key==="title"?(t(),p("div",oe,h(i),1)):b("",!0),s.key==="author"?(t(),p(y,{key:1},[i==="official"?(t(),T(k,{key:0,color:"green"},{default:r(()=>[m(h(i),1)]),_:2},1024)):(t(),p(y,{key:1},[m(h(i),1)],64))],64)):b("",!0),s.key==="state"?(t(),T(a,{key:2,"checked-children":"on","un-checked-children":"disabled","default-checked":"",class:"extra",checked:e.state,"onUpdate:checked":d=>e.state=d,onChange:d=>n.onStateChanged(e)},null,8,["checked","onUpdate:checked","onChange"])):b("",!0),s.key==="version"?(t(),p(y,{key:3},[e.installed?(t(),p(y,{key:0},[m(h(e.installed),1)],64)):(t(),p(y,{key:1},[m(h(i),1)],64))],64)):b("",!0),s.key==="price"?(t(),p(y,{key:4},[i==0?(t(),T(o,{key:0,type:"success"},{default:r(()=>[m("free")]),_:1})):(t(),T(o,{key:1,type:"danger"},{default:r(()=>[m(h(i)+"\xA5",1)]),_:2},1024))],64)):b("",!0),s.key==="installed"?(t(),p(y,{key:5},[e.installed?(t(),p(y,{key:0},[e.name!=="admin"?(t(),T(_,{key:0,type:"danger",size:"small",disabled:e.disabled,onClick:d=>n.showConfirmUninstall(e.name,e.installed)},{default:r(()=>[m("Uninstall")]),_:2},1032,["disabled","onClick"])):b("",!0)],64)):(t(),T(_,{key:1,type:"success",disabled:e.disabled,size:"small",onClick:d=>n.install(e.name,e.version)},{default:r(()=>[m("Install")]),_:2},1032,["disabled","onClick"])),e.installed&&e.releases&&e.releases.length>1?(t(),T(L,{key:2,onClick:d=>n.install(e.name,e.version,e.installed),size:"small",type:e.version===e.installed?"info":"success",disabled:e.disabled},{overlay:r(()=>[w(U,null,{default:r(()=>[(t(!0),p(y,null,P(e.releases,d=>(t(),T(M,{key:d,disabled:d===e.installed,onClick:le=>n.install(e.name,d,e.installed)},{default:r(()=>[m(h(d),1)]),_:2},1032,["disabled","onClick"]))),128))]),_:2},1024)]),icon:r(()=>[w($)]),default:r(()=>[m(h(e.version===e.installed?"Downgrade":"Upgrade")+" ",1)]),_:2},1032,["onClick","type","disabled"])):b("",!0)],64)):b("",!0)]),_:1},8,["onRegister"]),w(l,{onRegister:n.register,height:350,width:450},null,8,["onRegister"])])}var Je=R(ae,[["render",ie]]);export{Je as default};
|