mirror of https://github.com/allinssl/allinssl
2 lines
12 KiB
JavaScript
2 lines
12 KiB
JavaScript
import{Q as e,T as t,_ as n,Z as r,bK as i,a7 as a,d as s,z as o,aO as l,aQ as d,U as c,aD as u,A as p,bL as v,P as h,Y as m,b2 as f,az as _,bM as b,a0 as x,bN as g,bO as z,a3 as y,aT as C,l as k,aE as $,X as S,a6 as I,a as j,f as w,bP as P,bQ as N,$ as R,r as O,c as U,m as F,x as T,o as A,C as B,B as D,ab as E,i as M}from"./main-BmqS3eLK.js";import{u as V}from"./index-C_7a5LS7.js";import{u as q,k as Q}from"./index-Zywn3kCB.js";import{S as H}from"./index-k-OEQfGn.js";import{D as K}from"./index-BhDSqxaX.js";import{r as L}from"./verify-fZRjvHAZ.js";import{N as W}from"./text-DPlfrKva.js";import"./test-D7CJdghp.js";import"./useStore-BMPYCWDp.js";import"./useStore-CYjFYZXo.js";import"./setting-CnG8cL2V.js";import"./index-8c80EMX1.js";import"./index-C6SaIU_0.js";import"./Flex-DCEGdbt1.js";import"./business-Brwm-BYV.js";const X=e("steps","\n width: 100%;\n display: flex;\n",[e("step","\n position: relative;\n display: flex;\n flex: 1;\n ",[t("disabled","cursor: not-allowed"),t("clickable","\n cursor: pointer;\n "),n("&:last-child",[e("step-splitor","display: none;")])]),e("step-splitor","\n background-color: var(--n-splitor-color);\n margin-top: calc(var(--n-step-header-font-size) / 2);\n height: 1px;\n flex: 1;\n align-self: flex-start;\n margin-left: 12px;\n margin-right: 12px;\n transition:\n color .3s var(--n-bezier),\n background-color .3s var(--n-bezier);\n "),e("step-content","flex: 1;",[e("step-content-header","\n color: var(--n-header-text-color);\n margin-top: calc(var(--n-indicator-size) / 2 - var(--n-step-header-font-size) / 2);\n line-height: var(--n-step-header-font-size);\n font-size: var(--n-step-header-font-size);\n position: relative;\n display: flex;\n font-weight: var(--n-step-header-font-weight);\n margin-left: 9px;\n transition:\n color .3s var(--n-bezier),\n background-color .3s var(--n-bezier);\n ",[r("title","\n white-space: nowrap;\n flex: 0;\n ")]),r("description","\n color: var(--n-description-text-color);\n margin-top: 12px;\n margin-left: 9px;\n transition:\n color .3s var(--n-bezier),\n background-color .3s var(--n-bezier);\n ")]),e("step-indicator","\n background-color: var(--n-indicator-color);\n box-shadow: 0 0 0 1px var(--n-indicator-border-color);\n height: var(--n-indicator-size);\n width: var(--n-indicator-size);\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n transition:\n background-color .3s var(--n-bezier),\n box-shadow .3s var(--n-bezier);\n ",[e("step-indicator-slot","\n position: relative;\n width: var(--n-indicator-icon-size);\n height: var(--n-indicator-icon-size);\n font-size: var(--n-indicator-icon-size);\n line-height: var(--n-indicator-icon-size);\n ",[r("index","\n display: inline-block;\n text-align: center;\n position: absolute;\n left: 0;\n top: 0;\n white-space: nowrap;\n font-size: var(--n-indicator-index-font-size);\n width: var(--n-indicator-icon-size);\n height: var(--n-indicator-icon-size);\n line-height: var(--n-indicator-icon-size);\n color: var(--n-indicator-text-color);\n transition: color .3s var(--n-bezier);\n ",[i()]),e("icon","\n color: var(--n-indicator-text-color);\n transition: color .3s var(--n-bezier);\n ",[i()]),e("base-icon","\n color: var(--n-indicator-text-color);\n transition: color .3s var(--n-bezier);\n ",[i()])])]),t("vertical","flex-direction: column;",[a("show-description",[n(">",[e("step","padding-bottom: 8px;")])]),n(">",[e("step","margin-bottom: 16px;",[n("&:last-child","margin-bottom: 0;"),n(">",[e("step-indicator",[n(">",[e("step-splitor","\n position: absolute;\n bottom: -8px;\n width: 1px;\n margin: 0 !important;\n left: calc(var(--n-indicator-size) / 2);\n height: calc(100% - var(--n-indicator-size));\n ")])]),e("step-content",[r("description","margin-top: 8px;")])])])])])]);function Y(e){return e.map(((e,t)=>function(e,t){return"object"!=typeof e||null===e||Array.isArray(e)?null:(e.props||(e.props={}),e.props.internalIndex=t+1,e)}(e,t)))}const Z=Object.assign(Object.assign({},p.props),{current:Number,status:{type:String,default:"process"},size:{type:String,default:"medium"},vertical:Boolean,"onUpdate:current":[Function,Array],onUpdateCurrent:[Function,Array]}),G=h("n-steps"),J=s({name:"Steps",props:Z,slots:Object,setup(e,{slots:t}){const{mergedClsPrefixRef:n,mergedRtlRef:r}=c(e),i=u("Steps",r,n),a=p("Steps","-steps",X,v,e,n);return m(G,{props:e,mergedThemeRef:a,mergedClsPrefixRef:n,stepsSlots:t}),{mergedClsPrefix:n,rtlEnabled:i}},render(){const{mergedClsPrefix:e}=this;return o("div",{class:[`${e}-steps`,this.rtlEnabled&&`${e}-steps--rtl`,this.vertical&&`${e}-steps--vertical`]},Y(l(d(this))))}}),ee=s({name:"Step",props:{status:String,title:String,description:String,disabled:Boolean,internalIndex:{type:Number,default:0}},slots:Object,setup(e){const t=y(G,null);t||C("step","`n-step` must be placed inside `n-steps`.");const{inlineThemeDisabled:n}=c(),{props:r,mergedThemeRef:i,mergedClsPrefixRef:a,stepsSlots:s}=t,o=k((()=>r.vertical)),l=k((()=>{const{status:t}=e;if(t)return t;{const{internalIndex:t}=e,{current:n}=r;if(void 0===n)return"process";if(t<n)return"finish";if(t===n)return r.status||"process";if(t>n)return"wait"}return"process"})),d=k((()=>{const{value:e}=l,{size:t}=r,{common:{cubicBezierEaseInOut:n},self:{stepHeaderFontWeight:a,[$("stepHeaderFontSize",t)]:s,[$("indicatorIndexFontSize",t)]:o,[$("indicatorSize",t)]:d,[$("indicatorIconSize",t)]:c,[$("indicatorTextColor",e)]:u,[$("indicatorBorderColor",e)]:p,[$("headerTextColor",e)]:v,[$("splitorColor",e)]:h,[$("indicatorColor",e)]:m,[$("descriptionTextColor",e)]:f}}=i.value;return{"--n-bezier":n,"--n-description-text-color":f,"--n-header-text-color":v,"--n-indicator-border-color":p,"--n-indicator-color":m,"--n-indicator-icon-size":c,"--n-indicator-index-font-size":o,"--n-indicator-size":d,"--n-indicator-text-color":u,"--n-splitor-color":h,"--n-step-header-font-size":s,"--n-step-header-font-weight":a}})),u=n?S("step",k((()=>{const{value:e}=l,{size:t}=r;return`${e[0]}${t[0]}`})),d,r):void 0,p=k((()=>{if(e.disabled)return;const{onUpdateCurrent:t,"onUpdate:current":n}=r;return t||n?()=>{t&&I(t,e.internalIndex),n&&I(n,e.internalIndex)}:void 0}));return{stepsSlots:s,mergedClsPrefix:a,vertical:o,mergedStatus:l,handleStepClick:p,cssVars:n?void 0:d,themeClass:null==u?void 0:u.themeClass,onRender:null==u?void 0:u.onRender}},render(){const{mergedClsPrefix:e,onRender:t,handleStepClick:n,disabled:r}=this,i=f(this.$slots.default,(t=>{const n=t||this.description;return n?o("div",{class:`${e}-step-content__description`},n):null}));return null==t||t(),o("div",{class:[`${e}-step`,r&&`${e}-step--disabled`,!r&&n&&`${e}-step--clickable`,this.themeClass,i&&`${e}-step--show-description`,`${e}-step--${this.mergedStatus}-status`],style:this.cssVars,onClick:n},o("div",{class:`${e}-step-indicator`},o("div",{class:`${e}-step-indicator-slot`},o(b,null,{default:()=>f(this.$slots.icon,(t=>{const{mergedStatus:n,stepsSlots:r}=this;return"finish"!==n&&"error"!==n?t||o("div",{key:this.internalIndex,class:`${e}-step-indicator-slot__index`},this.internalIndex):"finish"===n?o(x,{clsPrefix:e,key:"finish"},{default:()=>_(r["finish-icon"],(()=>[o(g,null)]))}):"error"===n?o(x,{clsPrefix:e,key:"error"},{default:()=>_(r["error-icon"],(()=>[o(z,null)]))}):null}))})),this.vertical?o("div",{class:`${e}-step-splitor`}):null),o("div",{class:`${e}-step-content`},o("div",{class:`${e}-step-content-header`},o("div",{class:`${e}-step-content-header__title`},_(this.$slots.title,(()=>[this.title]))),this.vertical?null:o("div",{class:`${e}-step-splitor`})),i))}}),te="_cardContainer_1sh9u_4",ne="_optionCard_1sh9u_9",re="_optionCardSelected_1sh9u_14",ie="_cardContent_1sh9u_40",ae="_icon_1sh9u_45",se="_iconSelected_1sh9u_49",oe="_footer_1sh9u_54",le="_footerButton_1sh9u_58",de="_container_1sh9u_63",ce="_formContainer_1sh9u_68";function ue(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!M(e)}const pe=s({name:"DeployNodeDrawer",props:{node:{type:Object,default:()=>({id:"",inputs:[],config:{provider:"",provider_id:"",inputs:{fromNodeId:"",name:""}}})}},setup(e){const{updateNode:t,updateNodeConfig:n,findApplyUploadNodesUp:r,isRefreshNode:i}=q(),{useFormInput:a,useFormTextarea:s,useFormSelect:o}=F(),l=j(["primaryColor","borderColor"]),{handleError:d}=V(),c=w(),u=P(),p=N(),v=[{label:R("t_5_1744958839222"),value:"ssh"},{label:R("t_10_1745735765165"),value:"btpanel"},{label:R("t_11_1745735766456"),value:"btpanel-site"},{label:R("t_12_1745735765571"),value:"1panel"},{label:R("t_13_1745735766084"),value:"1panel-site"},{label:R("t_14_1745735766121"),value:"tencentcloud-cdn"},{label:R("t_15_1745735768976"),value:"tencentcloud-cos"},{label:R("t_16_1745735766712"),value:"aliyun-cdn"},{label:R("t_2_1746697487164"),value:"aliyun-oss"}],h=O([]),m=O(1),f=O(!0),_=O("process"),b=O(Q(e.node.config)),x=k((()=>{var e;return b.value.provider?R("t_4_1746858917773")+":"+(null==(e=v.find((e=>e.value===b.value.provider)))?void 0:e.label):R("t_19_1745735766810")})),g=k((()=>{const e=[];switch(e.push({type:"custom",render:()=>U(K,{type:b.value.provider,path:"provider_id",value:b.value.provider_id,"onUpdate:value":e=>{b.value.provider_id=e.value}},null)},o(R("t_1_1745748290291"),"inputs.fromNodeId",h.value,{onUpdateValue:(e,t)=>{b.value.inputs.fromNodeId=e,b.value.inputs.name=null==t?void 0:t.label}})),b.value.provider){case"ssh":e.push(a("证书文件路径(仅支持PEM格式)","certPath",{placeholder:R("t_30_1746667591892"),onInput:e=>b.value.certPath=e.trim()}),a("私钥文件路径","keyPath",{placeholder:R("t_31_1746667593074"),onInput:e=>b.value.keyPath=e.trim()}),s("前置命令","beforeCmd",{placeholder:R("t_21_1745735769154"),onInput:e=>b.value.beforeCmd=e.trim()},{showRequireMark:!1}),s("后置命令","afterCmd",{placeholder:R("t_22_1745735767366"),onInput:e=>b.value.afterCmd=e.trim()},{showRequireMark:!1}));break;case"btpanel-site":e.push(a("站点名称","siteName",{placeholder:R("t_23_1745735766455"),onInput:e=>b.value.siteName=e.trim()}));break;case"1panel-site":e.push(a("站点ID","site_id",{placeholder:R("t_24_1745735766826"),onInput:e=>b.value.site_id=e.trim()}));break;case"tencentcloud-cdn":case"aliyun-cdn":e.push(a("域名","domain",{placeholder:R("t_0_1744958839535"),onInput:e=>b.value.domain=e.trim()}));break;case"tencentcloud-cos":case"aliyun-oss":e.push(a("域名","domain",{placeholder:R("t_0_1744958839535"),onInput:e=>b.value.domain=e.trim()})),e.push(a("区域","region",{placeholder:R("t_25_1745735766651"),onInput:e=>b.value.region=e.trim()})),e.push(a("存储桶","bucket",{placeholder:R("t_26_1745735767144"),onInput:e=>b.value.bucket=e.trim()}))}return e})),z=async()=>{var t,n,i;if(!b.value.provider)return c.error(R("t_0_1746858920894"));h.value=r(e.node.id).map((e=>({label:e.name,value:e.id}))),h.value.length?(null==(t=b.value.inputs)?void 0:t.fromNodeId)||(b.value.inputs={name:(null==(n=h.value[0])?void 0:n.label)||"",fromNodeId:(null==(i=h.value[0])?void 0:i.value)||""}):c.warning(R("t_3_1745748298161")),m.value++,f.value=!1},y=()=>{m.value--,f.value=!0,b.value.provider_id="",b.value.provider=""},{component:C,example:$}=T({config:g,defaultValue:b,rules:L}),S=async()=>{var r;try{await(null==(r=$.value)?void 0:r.validate());const a=b.value,s=a.inputs;t(e.node.id,{inputs:[s],config:{}},!1),delete a.inputs,n(e.node.id,{...a}),i.value=e.node.id,p()}catch(a){d(a)}};return A((()=>{u.value.footer=!1,b.value.provider&&(e.node.inputs&&(b.value.inputs=e.node.inputs[0]),z())})),()=>{let e,t;return U("div",{class:de,style:l.value},[U(J,{size:"small",current:m.value,status:_.value},{default:()=>[U(ee,{title:R("t_28_1745735766626"),description:x.value},null),U(ee,{title:R("t_29_1745735768933"),description:R("t_2_1745738969878")},null)]}),1===m.value&&U("div",{class:te},[v.map((e=>U("div",{key:e.value,class:`${ne} ${b.value.provider===e.value?re:""}`,onClick:()=>{b.value.provider=e.value}},[U(B,{contentClass:ie,hoverable:!0,bordered:!1},{default:()=>[U(H,{icon:`resources-${e.value.replace(/-[a-z]+$/,"")}`,size:"2rem",class:`${ae} ${b.value.provider===e.value?se:""}`},null),U(W,{type:b.value.provider===e.value?"primary":"default"},{default:()=>[e.label]})]})])))]),2===m.value&&U(B,{class:ce},{default:()=>[U(C,{labelPlacement:"top"},null)]}),U("div",{class:oe},[U(D,{class:le,onClick:p},ue(e=R("t_4_1744870861589"))?e:{default:()=>[e]}),U(E,{trigger:"hover",disabled:!!b.value.provider},{default:()=>[f.value?R("t_4_1745765868807"):null],trigger:()=>U(D,{type:f.value?"primary":"default",class:le,disabled:!b.value.provider,onClick:f.value?z:y},{default:()=>[f.value?R("t_27_1745735764546"):R("t_0_1745738961258")]})}),!f.value&&U(D,{type:"primary",onClick:S},ue(t=R("t_1_1745738963744"))?t:{default:()=>[t]})])])}}});export{pe as default};
|