UNPKG

goldpankit

Version:

GoldPanKit是一款极速研发套件,可在套件中快速构建各类技术框架和项目。开源作者可发布自己的项目,并为其设定金额,实现开源项目的盈利。

2 lines (1 loc) 4.44 kB
import{P as k}from"./Pagination-8282e6ee.js";import{_ as P,E as $,m as w,r as h,A as I,o as i,c as p,a as n,t as s,B as N,F as A,f as B,g as d,b as m,w as g,e as f,i as E,p as T,k as D}from"./index-10e8cffd.js";import{d as F,f as M}from"./user.service-8a03f1c3.js";import{b as z}from"./service-440332f7.js";import{B as L}from"./BeanAmount-b7d4fa2a.js";import{S as V}from"./ServiceTitle-c589949d.js";import{S as q}from"./ServiceStatus-38311c4f.js";const O={components:{ServiceStatus:q,ServiceTitle:V,BeanAmount:L,Empty:$,Pagination:k},data(){return{loading:!1,pagination:{page:1,capacity:10,total:0},services:[]}},computed:{...w(["userInfo"])},methods:{openSettings(e){if(e.type==="MAIN"){this.$router.push({name:"ServiceSettings",query:{space:e.space.name,service:e.name}});return}this.$router.push({name:"PluginSettings",query:{space:e.space.name,service:e.mainService.name,plugin:e.name}})},deleteService(e){let a;e.type==="MAIN"?a={space:e.space.name,service:e.name}:a={space:e.space.name,service:e.mainService.name,plugin:e.name},this.deleteConfirm(this.$t("service.confirmDeleteTip")).then(()=>{F({id:e.id,...a}).then(()=>{this.services.length===1&&(this.pagination.page-=1),this.fetchPage(),this.$tip.success(this.$t("common.deleteSuccessfully"))}).catch(c=>{this.$tip.apiFailed(c)})}).catch(()=>{})},handleCurrentChange(e){this.pagination.page=e,this.fetchPage()},handleSizeChange(e){this.pagination.capacity=e,this.fetchPage()},fetchPage(){this.loading||(this.loading=!0,this.pagination.page<1&&(this.pagination.page=1),M({...this.pagination,model:{}}).then(e=>{this.services=e.records,this.pagination.total=e.total,this.fetchLocalServices()}).catch(e=>{this.$tip.apiFailed(e)}).finally(()=>{this.loading=!1}))},fetchLocalServices(){z().then(e=>{this.services.forEach(a=>{if(a.codespace=null,a.type==="MAIN"){const o=e.find(l=>l.space===a.space.name&&l.name===a.name);o!=null&&(a.repository=o.repository,a.codespace=o.codespace);return}const c=e.find(o=>o.space===a.space.name&&o.service===a.mainService.name&&o.name===a.name);c!=null&&(a.repository=c.repository,a.codespace=c.codespace)})}).catch(e=>{this.$tip.apiFailed(e)})}},created(){this.fetchPage()}},j=e=>(T("data-v-14fd7790"),e=e(),D(),e),x={class:"page"},G={class:"wrap"},H={class:"header"},J={class:"service-list-wrap"},K={key:0,class:"service-list"},Q={class:"introduce"},R={class:"info"},U={class:"info"},W={class:"footer-info"},X=j(()=>n("span",null,"|",-1)),Y={class:"text-info-1 text-mini"},Z={key:2,class:"opera"};function ee(e,a,c,o,l,r){const _=h("ServiceTitle"),y=h("ServiceStatus"),u=h("el-button"),v=h("Empty"),C=h("Pagination"),b=I("loading");return i(),p("div",x,[n("div",G,[n("div",H,[n("h2",null,s(e.$t("user.leasedAndPrivateServices")),1)]),N((i(),p("div",J,[l.services.length>0?(i(),p("ul",K,[(i(!0),p(A,null,B(l.services,t=>(i(),p("li",{key:t.id},[t.type==="MAIN"?(i(),d(_,{key:0,space:t.space.name,service:t.name,"service-label":t.label,"with-type":!0},null,8,["space","service","service-label"])):(i(),d(_,{key:1,space:t.space.name,service:t.mainService.name,"service-label":t.mainService.label,plugin:t.name,"plugin-label":t.label,"with-type":!0},null,8,["space","service","service-label","plugin","plugin-label"])),n("p",Q,s(t.introduce),1),n("div",R,[n("label",null,s(e.$t("service.codespace"))+":",1),n("p",null,s(t.codespace),1)]),n("div",U,[n("label",null,s(e.$t("service.repository"))+":",1),n("p",null,s(t.repository),1)]),n("div",W,[m(y,{"with-private":t.withPrivate},null,8,["with-private"]),X,n("p",Y,s(t.lastPublish==null?e.$t("service.unPublish"):e.getDateOffsetText(t.lastPublish)),1)]),t.user!=null&&e.userInfo.id===t.user.id?(i(),p("ul",Z,[n("li",null,[t.type==="MAIN"?(i(),d(u,{key:0,onClick:S=>r.openSettings(t)},{default:g(()=>[f(s(e.$t("service.serviceSettings")),1)]),_:2},1032,["onClick"])):(i(),d(u,{key:1,onClick:S=>r.openSettings(t)},{default:g(()=>[f(s(e.$t("plugin.settings")),1)]),_:2},1032,["onClick"]))]),n("li",null,[m(u,{text:"",type:"danger",onClick:S=>r.deleteService(t)},{default:g(()=>[f(s(e.$t("common.delete")),1)]),_:2},1032,["onClick"])])])):E("",!0)]))),128))])):(i(),d(v,{key:1,description:e.$t("service.noServices")},null,8,["description"])),m(C,{pagination:l.pagination,onCurrentChange:r.handleCurrentChange,onSizeChange:r.handleSizeChange},null,8,["pagination","onCurrentChange","onSizeChange"])])),[[b,l.loading]])])])}const ce=P(O,[["render",ee],["__scopeId","data-v-14fd7790"]]);export{ce as default};