allinssl/frontend/static/js/drawer-4n-SOn6k.js

2 lines
12 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import{Y as e,Z as t,a5 as n,a4 as r,bN as i,ad as a,d as s,J as o,aR as l,aT as d,_ as c,aH as p,K as u,bO as v,X as f,a3 as h,b5 as m,aD as _,bP as b,a6 as x,bQ as g,bR as y,a9 as z,aW as C,w as S,aI as k,a2 as $,ac as j,i as w,n as I,bS as N,bT as R,$ as P,r as q,e as O,x as F,G as T,I as U,L as A,B as D,ah as B,k as E}from"./main-DVBEmEFd.js";import{u as V}from"./index-sztGZ9nB.js";import{u as H}from"./index-BUF9qwGu.js";import{S as M}from"./index-CBR7zAef.js";import{D as W}from"./index-B5g5r0x_.js";import{r as G}from"./verify-fRB3FV12.js";import{N as J}from"./text-BBOsWGWM.js";import"./test-BVQgoLgN.js";import"./useStore-BwTk8hfc.js";import"./useStore-9ut3oD1M.js";import"./setting-DqvEYlnM.js";import"./index-D0u98Vm2.js";import"./index-pbEXObG7.js";import"./access-DqTnWAGY.js";import"./business-BI7cIbpG.js";const K=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 L(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 Q=Object.assign(Object.assign({},u.props),{current:Number,status:{type:String,default:"process"},size:{type:String,default:"medium"},vertical:Boolean,"onUpdate:current":[Function,Array],onUpdateCurrent:[Function,Array]}),X=f("n-steps"),Y=s({name:"Steps",props:Q,slots:Object,setup(e,{slots:t}){const{mergedClsPrefixRef:n,mergedRtlRef:r}=c(e),i=p("Steps",r,n),a=u("Steps","-steps",K,v,e,n);return h(X,{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`]},L(l(d(this))))}}),Z=s({name:"Step",props:{status:String,title:String,description:String,disabled:Boolean,internalIndex:{type:Number,default:0}},slots:Object,setup(e){const t=z(X,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=S((()=>r.vertical)),l=S((()=>{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=S((()=>{const{value:e}=l,{size:t}=r,{common:{cubicBezierEaseInOut:n},self:{stepHeaderFontWeight:a,[k("stepHeaderFontSize",t)]:s,[k("indicatorIndexFontSize",t)]:o,[k("indicatorSize",t)]:d,[k("indicatorIconSize",t)]:c,[k("indicatorTextColor",e)]:p,[k("indicatorBorderColor",e)]:u,[k("headerTextColor",e)]:v,[k("splitorColor",e)]:f,[k("indicatorColor",e)]:h,[k("descriptionTextColor",e)]:m}}=i.value;return{"--n-bezier":n,"--n-description-text-color":m,"--n-header-text-color":v,"--n-indicator-border-color":u,"--n-indicator-color":h,"--n-indicator-icon-size":c,"--n-indicator-index-font-size":o,"--n-indicator-size":d,"--n-indicator-text-color":p,"--n-splitor-color":f,"--n-step-header-font-size":s,"--n-step-header-font-weight":a}})),p=n?$("step",S((()=>{const{value:e}=l,{size:t}=r;return`${e[0]}${t[0]}`})),d,r):void 0,u=S((()=>{if(e.disabled)return;const{onUpdateCurrent:t,"onUpdate:current":n}=r;return t||n?()=>{t&&j(t,e.internalIndex),n&&j(n,e.internalIndex)}:void 0}));return{stepsSlots:s,mergedClsPrefix:a,vertical:o,mergedStatus:l,handleStepClick:u,cssVars:n?void 0:d,themeClass:null==p?void 0:p.themeClass,onRender:null==p?void 0:p.onRender}},render(){const{mergedClsPrefix:e,onRender:t,handleStepClick:n,disabled:r}=this,i=m(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:()=>m(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(y,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))}}),ee="_cardContainer_1uqxy_4",te="_optionCard_1uqxy_9",ne="_optionCardSelected_1uqxy_14",re="_cardContent_1uqxy_40",ie="_icon_1uqxy_45",ae="_iconSelected_1uqxy_49",se="_footer_1uqxy_54",oe="_footerButton_1uqxy_58",le="_container_1uqxy_63",de="_formContainer_1uqxy_68";function ce(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!E(e)}const pe=s({name:"DeployNodeDrawer",props:{node:{type:Object,default:()=>({id:"",inputs:[{fromNodeId:"",name:""}],config:{provider:"",provider_id:""}})}},setup(e){const{updateNode:t,updateNodeConfig:n,findApplyUploadNodesUp:r,isRefreshNode:i}=H(),{useFormInput:a,useFormTextarea:s,useFormSelect:o}=F(),l=w(["primaryColor","borderColor"]),{handleError:d}=V(),c=I(),p=N(),u=R(),v=[{label:P("t_5_1744958839222"),value:"ssh"},{label:P("t_10_1745735765165"),value:"btpanel"},{label:P("t_11_1745735766456"),value:"btpanel-site"},{label:P("t_12_1745735765571"),value:"1panel"},{label:P("t_13_1745735766084"),value:"1panel-site"},{label:P("t_14_1745735766121"),value:"tencentcloud-cdn"},{label:P("t_15_1745735768976"),value:"tencentcloud-cos"},{label:P("t_16_1745735766712"),value:"aliyun-cdn"},{label:P("阿里云OSS"),value:"aliyun-oss"}],f=q([]),h=q(1),m=q(!0),_=q("process"),b=q(Object.keys(e.node.config).length>0?{...e.node.config,inputs:Array.isArray(e.node.inputs)?e.node.inputs[0]:[]}:{provider:"",provider_id:"",inputs:{fromNodeId:"",name:""}}),x=S((()=>{const e=[];switch(e.push({type:"custom",render:()=>O(W,{type:b.value.provider,path:"provider_id",value:b.value.provider_id,"onUpdate:value":e=>{b.value.provider_id=e.value}},null)},o(P("t_1_1745748290291"),"inputs.fromNodeId",f.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:P("t_30_1746667591892")}),a("私钥文件路径","keyPath",{placeholder:P("t_31_1746667593074")}),s("前置命令","beforeCmd",{placeholder:P("t_21_1745735769154")},{showRequireMark:!1}),s("后置命令","afterCmd",{placeholder:P("t_22_1745735767366")},{showRequireMark:!1}));break;case"btpanel-site":e.push(a("站点名称","siteName",{placeholder:P("t_23_1745735766455")}));break;case"1panel-site":e.push(a("站点ID","site_id",{placeholder:P("t_24_1745735766826")}));break;case"tencentcloud-cdn":case"aliyun-cdn":e.push(a("域名","domain",{placeholder:P("t_0_1744958839535")}));break;case"tencentcloud-cos":case"aliyun-oss":e.push(a("域名","domain",{placeholder:P("t_0_1744958839535")})),e.push(a("区域","region",{placeholder:P("t_25_1745735766651")})),e.push(a("存储桶","bucket",{placeholder:P("t_26_1745735767144")}))}return e})),g=async()=>{var t,n;if(!b.value.provider)return c.error(P("t_19_1745735766810"));f.value=r(e.node.id).map((e=>({label:e.name,value:e.id}))),f.value.length?b.value.inputs&&b.value.inputs.fromNodeId||(b.value.inputs={},b.value.inputs.name=(null==(t=f.value[0])?void 0:t.label)||"",b.value.inputs.fromNodeId=(null==(n=f.value[0])?void 0:n.value)||""):c.warning(P("t_3_1745748298161")),h.value++,m.value=!1},y=()=>{h.value--,m.value=!0,b.value.provider_id="",b.value.provider=""},{component:z,example:C}=T({config:x,defaultValue:b,rules:G}),k=async()=>{var r;try{await(null==(r=C.value)?void 0:r.validate());const a=b.value,s=a.inputs;t(e.node.id,{inputs:[s],config:{}}),delete a.inputs,n(e.node.id,{...a}),i.value=e.node.id,u()}catch(a){d(a)}};return U((()=>{p.value.footer=!1,b.value.provider&&(e.node.inputs&&(b.value.inputs=e.node.inputs),g())})),()=>{let e,t;return O("div",{class:le,style:l.value},[O(Y,{size:"small",current:h.value,status:_.value},{default:()=>[O(Z,{title:P("t_28_1745735766626"),description:P("t_19_1745735766810")},null),O(Z,{title:P("t_29_1745735768933"),description:P("t_2_1745738969878")},null)]}),1===h.value&&O("div",{class:ee},[v.map((e=>O("div",{key:e.value,class:`${te} ${b.value.provider===e.value?ne:""}`,onClick:()=>{b.value.provider=e.value}},[O(A,{contentClass:re,hoverable:!0,bordered:!1},{default:()=>[O(M,{iconName:`resources-${e.value.replace(/-[a-z]+$/,"")}`,size:"2em",class:`${ie} ${b.value.provider===e.value?ae:""}`},null),O(J,{type:b.value.provider===e.value?"primary":"default"},{default:()=>[e.label]})]})])))]),2===h.value&&O(A,{class:de},{default:()=>[O(z,{labelPlacement:"top"},null)]}),O("div",{class:se},[O(D,{class:oe,onClick:u},ce(e=P("t_4_1744870861589"))?e:{default:()=>[e]}),O(B,{trigger:"hover",disabled:!!b.value.provider},{default:()=>[m.value?P("t_4_1745765868807"):null],trigger:()=>O(D,{type:m.value?"primary":"default",class:oe,disabled:!b.value.provider,onClick:m.value?g:y},{default:()=>[m.value?P("t_27_1745735764546"):P("t_0_1745738961258")]})}),!m.value&&O(D,{type:"primary",onClick:k},ce(t=P("t_1_1745738963744"))?t:{default:()=>[t]})])])}}});export{pe as default};