goldpankit
Version:
GoldPanKit是一款极速研发套件,可在套件中快速构建各类技术框架和项目。开源作者可发布自己的项目,并为其设定金额,实现开源项目的盈利。
2 lines (1 loc) • 9.99 kB
JavaScript
import{_ as P,M as V,Z as N,r,A as W,o as a,c as d,B as v,b as t,w as c,a as l,t as n,e as k,T as M,m as q,s as U,a1 as H,a2 as R,j as g,F as A,J as p,K as b,h as w}from"./index-bc20a01a.js";import{S as J,V as K,P as L,B as Z,I as G,a as O}from"./SystemVariableTable-8ddd2227.js";import{a as Q,b as X}from"./service.space-d54e0248.js";import{S as Y}from"./ServiceCodeErrorWindow-ce95a6ed.js";import{c as $,d as x,e as ee}from"./service-4d76ce0a.js";import{S as ie}from"./ServiceTitle-493263bf.js";import"./CompilerSelect-602d4f77.js";import"./plugin-51ac256a.js";import"./QueryModelView-b2e270ca.js";import"./InnerRouterViewWindow-c82bd9e7.js";import"./service.version-2a85500c.js";const se={name:"SpaceSettings",components:{MarkdownEditor:V,HelpButton:N},props:{space:{required:!0}},data(){return{loading:!1,isWorking:!1,form:{id:null,name:"",withPrivate:!1,subServiceReceivable:!1,homepage:"",introduce:"",description:""},rules:{introduce:[{required:!0,message:"Please input space introduce"}],description:[{required:!0,message:"Please input space description"}]}}},methods:{fetchSpace(){this.loading||(this.loading=!0,Q(this.space).then(i=>{for(const s in this.form)this.form[s]=i[s]}).catch(i=>{this.$tip.apiFailed(i)}).finally(()=>{this.loading=!1}))},save(){this.$refs.form.validate().then(()=>{this.isWorking||(this.isWorking=!0,X(this.form).then(()=>{this.$tip.success(this.$t("common.saveSuccessfully"))}).catch(i=>{this.$tip.apiFailed(i)}).finally(()=>{this.isWorking=!1}))}).catch(()=>{})}},created(){this.fetchSpace()}},te={class:"space-settings"},re={class:"form-wrap"},le={class:"opera"};function oe(i,s,j,D,e,o){const h=r("el-form-item"),f=r("el-input"),_=r("el-checkbox"),C=r("el-form"),y=r("MarkdownEditor"),S=r("el-button"),T=W("loading");return a(),d("div",te,[v((a(),d("div",re,[t(C,{ref:"form",model:e.form,rules:e.rules},{default:c(()=>[t(h,{label:i.$t("space.spaceName"),prop:"name"},{default:c(()=>[l("h3",null,n(e.form.name),1)]),_:1},8,["label"]),t(h,{label:i.$t("space.homePage"),prop:"homepage"},{default:c(()=>[t(f,{modelValue:e.form.homepage,"onUpdate:modelValue":s[0]||(s[0]=m=>e.form.homepage=m)},null,8,["modelValue"])]),_:1},8,["label"]),t(h,{label:i.$t("space.otherSettings"),class:"item-other-settings"},{default:c(()=>[l("div",null,[t(_,{modelValue:e.form.withPrivate,"onUpdate:modelValue":s[1]||(s[1]=m=>e.form.withPrivate=m),label:i.$t("space.isPrivateServiceTip")},null,8,["modelValue","label"])])]),_:1},8,["label"])]),_:1},8,["model","rules"]),t(C,{ref:"descForm",class:"description-form",model:e.form},{default:c(()=>[t(h,{label:i.$t("space.spaceDescriptionLabel"),prop:"description",required:""},{default:c(()=>[t(y,{modelValue:e.form.description,"onUpdate:modelValue":s[2]||(s[2]=m=>e.form.description=m),placeholder:i.$t("space.spaceDescription")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1},8,["model"])])),[[T,e.loading]]),l("div",le,[t(S,{type:"primary",disabled:e.isWorking,onClick:o.save},{default:c(()=>[k(n(i.$t("common.save")),1)]),_:1},8,["disabled","onClick"])])])}const ne=P(se,[["render",oe],["__scopeId","data-v-90ba3e91"]]);const ce={components:{ServiceTitle:ie,SystemVariableTable:J,ServiceCodeErrorWindow:Y,SpaceSettings:ne,MarkdownEditor:V,Variables:K,PublishWindow:L,BasicSetting:Z,InitializeView:G,DirectorySelect:M,SettingFiles:O},data(){return{loading:!0,isWorking:{compile:!1,cleanCompile:!1},route:{space:"",service:""},currentTab:"basic",service:null,serviceConfig:null}},computed:{...q(["currentProject","currentProjectDetail","currentDatabase","installData"]),initialized(){return this.serviceConfig!=null&&this.serviceConfig.version!=null},compileTip(){return this.currentProjectDetail!=null?this.$t("service.settings.compileTipWithProject",{project:this.currentProjectDetail.name}):this.$t("service.settings.compileTip")},cleanCompileTip(){return this.currentProjectDetail!=null?this.$t("service.settings.cleanCompileTipWithProject",{project:this.currentProjectDetail.name}):this.$t("service.settings.cleanCompileTip")}},methods:{...U(["setInstallData"]),saveConfig(){$({...this.route,readme:this.service.description}).then(()=>{}).catch(i=>{this.$tip.apiFailed(i)})},fetchProfile(){this.loading=!0,x({spaceName:this.route.space,serviceName:this.route.service}).then(i=>{this.service=i}).then(()=>ee({space:this.route.space,service:this.route.service})).then(i=>{i!=null&&(this.serviceConfig=i,this.serviceConfig.label=this.serviceConfig.label||this.serviceConfig.name,this.service.label=this.serviceConfig.label,this.service.description=this.serviceConfig.readme)}).catch(i=>{this.$tip.apiFailed(i)}).finally(()=>{this.loading=!1})},compile(){this.isWorking.compile||this.currentProject==null||this.currentProject===""||(this.isWorking.compile=!0,H({...this.route,serviceType:this.service.type,projectId:this.currentProject,database:this.currentDatabase,variables:this.$refs.variables.getVariables()}).then(i=>{this.setInstallData(i),this.$tip.success(this.$t("common.compileSuccessfully"))}).catch(i=>{if(i.code===6e3){this.$refs.serviceCodeErrorWindow.open(i.errorData);return}this.$tip.apiFailed(i)}).finally(()=>{this.isWorking.compile=!1}))},cleanCompile(){this.isWorking.cleanCompile||this.currentProject==null||this.currentProject===""||(this.isWorking.cleanCompile=!0,R({...this.route,projectId:this.currentProject,database:this.currentDatabase,variables:this.$refs.variables.getVariables()}).then(i=>{this.$tip.success("Clean Compile successfully."),this.setInstallData(i)}).catch(i=>{if(i.code===6e3){this.$refs.serviceCodeErrorWindow.open(i.errorData);return}this.$tip.apiFailed(i)}).finally(()=>{this.isWorking.cleanCompile=!1}))}},created(){this.route.space=this.$route.query.space,this.route.service=this.$route.query.service,this.fetchProfile()}},ae={key:0,class:"wrap"},pe={class:"header-wrap"},ue={class:"header"},me={key:0,class:"opera"},ve={key:0,class:"text-info-1 service-path"},de={class:"main"},he={class:"tabs"},fe={class:"tab-content"};function ge(i,s,j,D,e,o){const h=r("ServiceTitle"),f=r("el-button"),_=r("el-popover"),C=r("SpaceSettings"),y=r("BasicSetting"),S=r("MarkdownEditor"),T=r("Variables"),m=r("SettingFiles"),I=r("SystemVariableTable"),z=r("InitializeView"),E=r("PublishWindow"),F=r("ServiceCodeErrorWindow"),B=W("loading");return v((a(),d("div",{class:p(["page",{"page-un-initialize":!o.initialized}])},[e.service!=null?(a(),d("div",ae,[l("div",pe,[l("div",ue,[t(h,{space:e.service.space.name,service:e.service.name,"service-label":e.service.label,"with-new-page":!0},null,8,["space","service","service-label"]),o.initialized?(a(),d("div",me,[t(_,{placement:"top-start",title:i.$t("service.settings.compileTipTitle"),width:200,trigger:"hover",content:o.compileTip},{reference:c(()=>[t(f,{type:"primary",class:p({"is-disabled":i.currentProject==null||e.isWorking.compile}),loading:e.isWorking.compile,onClick:o.compile},{default:c(()=>[k(n(i.$t("service.settings.compile")),1)]),_:1},8,["class","loading","onClick"])]),_:1},8,["title","content"]),t(_,{placement:"top-start",title:i.$t("service.settings.cleanCompileTipTitle"),width:200,trigger:"hover",content:o.cleanCompileTip},{reference:c(()=>[t(f,{type:"primary",class:p({"is-disabled":i.currentProject==null||e.isWorking.cleanCompile}),loading:e.isWorking.cleanCompile,onClick:o.cleanCompile},{default:c(()=>[k(n(i.$t("service.settings.cleanCompile")),1)]),_:1},8,["class","loading","onClick"])]),_:1},8,["title","content"]),t(f,{type:"important",onClick:s[0]||(s[0]=u=>i.$refs.publishWindow.open(e.route.space,e.route.service))},{default:c(()=>[k(n(i.$t("service.settings.publish")),1)]),_:1})])):g("",!0)]),o.initialized?(a(),d("p",ve,n(i.$t("service.settings.at"))+" "+n(e.service.local.codespace),1)):g("",!0)]),l("div",de,[o.initialized?(a(),d(A,{key:0},[l("ul",he,[l("li",{class:p({selected:e.currentTab==="space"}),onClick:s[1]||(s[1]=u=>e.currentTab="space")},n(i.$t("service.settings.space")),3),l("li",{class:p({selected:e.currentTab==="basic"}),onClick:s[2]||(s[2]=u=>e.currentTab="basic")},n(i.$t("service.settings.service")),3),l("li",{class:p({selected:e.currentTab==="readme"}),onClick:s[3]||(s[3]=u=>e.currentTab="readme")},n(i.$t("service.settings.readme")),3),l("li",{class:p({selected:e.currentTab==="variables"}),onClick:s[4]||(s[4]=u=>e.currentTab="variables")},n(i.$t("service.settings.variables")),3),l("li",{class:p({selected:e.currentTab==="files"}),onClick:s[5]||(s[5]=u=>e.currentTab="files")},n(i.$t("service.settings.files")),3),l("li",{class:p({selected:e.currentTab==="system_variables"}),onClick:s[6]||(s[6]=u=>e.currentTab="system_variables")},n(i.$t("service.settings.systemVariables")),3)]),l("div",fe,[v(t(C,{space:e.route.space},null,8,["space"]),[[b,e.currentTab==="space"]]),v(t(y,{space:e.route.space,service:e.route.service,"service-type":e.service.type,"service-config":e.serviceConfig,onCloneSuccess:o.fetchProfile},null,8,["space","service","service-type","service-config","onCloneSuccess"]),[[b,e.currentTab==="basic"]]),e.service.description!=null?v((a(),w(S,{key:0,modelValue:e.service.description,"onUpdate:modelValue":[s[7]||(s[7]=u=>e.service.description=u),o.saveConfig],placeholder:i.$t("service.settings.serviceReadmeHolder")},null,8,["modelValue","placeholder","onUpdate:modelValue"])),[[b,e.currentTab==="readme"]]):g("",!0),v(t(T,{ref:"variables",space:e.route.space,service:e.route.service},null,8,["space","service"]),[[b,e.currentTab==="variables"]]),v(t(m,{space:e.route.space,service:e.route.service},null,8,["space","service"]),[[b,e.currentTab==="files"]]),e.currentTab==="system_variables"?(a(),w(I,{key:1})):g("",!0)])],64)):(a(),w(z,{key:1,"space-name":e.service.space.name,"service-name":e.service.name,"service-label":e.service.label,onInitialized:o.fetchProfile},null,8,["space-name","service-name","service-label","onInitialized"]))])])):g("",!0),t(E,{ref:"publishWindow"},null,512),t(F,{ref:"serviceCodeErrorWindow"},null,512)],2)),[[B,e.loading]])}const je=P(ce,[["render",ge],["__scopeId","data-v-e0592f67"]]);export{je as default};