PageSourceSearch

https://1ms.run/_nuxt/DY_twTZX.js

js 1ms.run collected 2026-10-03 23:11:33 UTC 12,064 bytes, 3 lines download raw bytes

1import{d as ae,D as se,j as F,o as oe,b as a,c as s,e as l,f as b,w as y,B as x,k as t,H as re,h as ie,F as N,n as S,t as d,q as ue,l as p,g as j,v as g,I as V,K as L,M as Q,r as v,_ as X}from"./BKPHo9Ix.js";import{V as de}from"./B3-FX908.js";import{u as ve}from"./DlcJgqEi.js";import{_ as pe}from"./Cuz1s3-H.js";const ce={class:"private-registry-page"},me={class:"private-head"},fe={class:"notice"},ye={key:0,class:"namespace-grid"},_e={class:"owner-kind"},ge={class:"metrics"},ke=["onClick"],be=["onClick"],$e=["onClick"],Ce=["onClick"],we=["onClick"],xe={key:1,class:"empty-state"},Ve={key:0,class:"transfer-panel"},Ue=["onClick"],Re=["onClick"],Te=["onClick"],De={key:0,class:"detail-stack"},Ie={class:"command-block"},Ne={key:0,class:"record-list"},Be={key:1,class:"muted"},Ee={key:0},Pe={class:"record-list"},Le={key:0},Ae={class:"detail-actions"},Me={class:"detail-actions"},Se={class:"form-stack"},je={key:0},ze={key:0},We={key:3,class:"confirm-field"},Ke=["placeholder"],Oe=ae({__name:"PrivateRegistry",setup(Z){const{$api:f}=se(),{init:$}=ve(),B=v(!1),z=v([]),W=v([]),c=v(null),o=v(null),U=v(!1),E=v(!1),r=v("rename"),A=v(!1),m=v(""),R=v(""),T=v(""),k=v(null),D=v("reader"),P=v("user"),I=v(null),M=v(null),H={reader:"Reader",writer:"Writer",admin:"Admin"},h={owner:"归属管理员",enterprise_default:"企业默认角色",override:"单独授权"},ee=F(()=>({rename:"修改 Namespace 名称",acl:"设置成员权限",remove_acl:"移除成员权限覆盖",transfer:"申请转移归属",delete:"停用并计划删除",restore:"恢复 Namespace",accept:"接受转移",reject:"拒绝转移",cancel:"撤销转移"})[r.value]),q=F(()=>["delete","reject"].includes(r.value)),G=F(()=>m.value.trim()?r.value==="rename"?!!T.value.trim():r.value==="acl"?!!(k.value&&D.value):r.value==="remove_acl"?!!k.value:r.value==="transfer"?!!I.value:r.value==="delete"?R.value===c.value?.full_name:!0:!1);async function K(){B.value=!0;try{const[i,e]=await Promise.all([f("/api/v1/user/private-registry/namespaces",{params:{limit:100}}),f("/api/v1/user/private-registry/transfers")]);z.value=i.data?.items||[],W.value=e.data||[]}catch{$({message:"私有仓库加载失败",color:"danger"})}B.value=!1}async function le(i){c.value=i,U.value=!0;try{const e=await f(`/api/v1/user/private-registry/namespaces/${i.id}`);o.value=e.data}catch{$({message:"Namespace 详情加载失败",color:"danger"})}}function _(i,e,u){e&&(c.value=e),M.value=u||null,r.value=i,m.value="",R.value="",T.value=e?.name||c.value?.name||"",k.value=null,D.value="reader",P.value="user",I.value=null,E.value=!0}async function ne(){if(!G.value||A.value)return;A.value=!0;const i={"Idempotency-Key":crypto.randomUUID()},e=M.value?M.value.policy_revision:c.value?.policy_revision;try{let u;if(r.value==="rename"?u=await f(`/api/v1/user/private-registry/namespaces/${c.value?.id}/name`,{method:"PATCH",headers:i,body:{name:T.value,expected_revision:e,reason:m.value}}):r.value==="acl"?u=await f(`/api/v1/user/private-registry/namespaces/${c.value?.id}/acl/users/${k.value}`,{method:"PUT",headers:i,body:{role:D.value,expected_revision:e,reason:m.value}}):r.value==="remove_acl"?u=await f(`/api/v1/user/private-registry/namespaces/${c.value?.id}/acl/users/${k.value}`,{method:"DELETE",headers:i,body:{expected_revision:e,reason:m.value}}):r.value==="transfer"?u=await f(`/api/v1/user/private-registry/namespaces/${c.value?.id}/transfer`,{method:"POST",headers:i,body:{target:{kind:P.value,id:I.value},expected_revision:e,reason:m.value}}):r.value==="delete"?u=await f(`/api/v1/user/private-registry/namespaces/${c.value?.id}`,{method:"DELETE",headers:i,body:{expected_revision:e,target_confirmation:R.value,reason:m.value}}):r.value==="restore"?u=await f(`/api/v1/user/private-registry/namespaces/${c.value?.id}/restore`,{method:"POST",headers:i,body:{expected_revision:e,reason:m.value}}):u=await f(`/api/v1/user/private-registry/transfers/${M.value?.id}/${r.value}`,{method:"POST",headers:i,body:{expected_revision:e,reason:m.value}}),u.code!==0)throw new Error(u.msg);$({message:"操作已生效",color:"success"}),E.value=!1,U.value=!1,await K()}catch(u){$({message:u?.data?.msg||u?.message||"操作失败",color:"danger"})}A.value=!1}async function O(i){await navigator.clipboard.writeText(i),$({message:"命令已复制",color:"success"})}function C(i){return{login:"docker login my.1ms.run -u 1ms",push:`docker tag app:latest ${i.full_name}/app:latest
2docker push ${i.full_name}/app:latest`,pull:`docker pull ${i.full_name}/app:latest`}}return oe(K),(i,e)=>{const u=re,Y=ie,te=de,J=pe;return a(),s("div",ce,[l("div",me,[e[17]||(e[17]=l("div",null,[l("span",{class:"eyebrow"},"PRIVATE REGISTRY"),l("h2",null,"my.1ms.run 私有仓库"),l("p",null,"平台管理员预创建 Namespace。你只能看到当前有权访问的个人、企业或共享空间。")],-1)),b(u,{preset:"secondary",icon:"refresh",loading:t(B),onClick:K},{default:y(()=>[...e[16]||(e[16]=[x("刷新",-1)])]),_:1},8,["loading"])]),l("div",fe,[b(Y,{name:"security"}),e[18]||(e[18]=x("所有镜像固定私有;普通企业成员默认 Writer,权限变更会在下一次 Registry 请求实时生效。",-1))]),b(te,{loading:t(B)},{default:y(()=>[t(z).length?(a(),s("div",ye,[(a(!0),s(N,null,S(t(z),n=>(a(),s("article",{key:n.id,class:"namespace-card"},[l("header",null,[l("div",null,[l("span",_e,d(n.owner.kind==="enterprise"?"企业":"个人"),1),l("h3",null,d(n.full_name),1)]),l("span",{class:ue(["state",n.lifecycle_state])},d(n.lifecycle_state==="active"?"可用":"待清理"),3)]),l("div",ge,[l("span",null,[l("b",null,d(H[n.effective_role]),1),l("small",null,d(h[n.access_source]),1
2)]),l("span",null,[l("b",null,d(n.repository_count),1),e[19]||(e[19]=l("small",null,"Repository",-1))]),l("span",null,[l("b",null,"r"+d(n.policy_revision),1),e[20]||(e[20]=l("small",null,"Policy",-1))])]),l("pre",null,d(C(n).push),1),l("footer",null,[l("button",{onClick:w=>O(C(n).login)},"复制登录",8,ke),l("button",{onClick:w=>O(C(n).push)},"复制推送",8,be),l("button",{onClick:w=>le(n)},"查看详情",8,$e),n.can_manage_acl&&n.lifecycle_state==="active"?(a(),s("button",{key:0,onClick:w=>_("acl",n)},"成员权限",8,Ce)):p("",!0),n.can_manage_lifecycle&&n.lifecycle_state==="pending_delete"?(a(),s("button",{key:1,onClick:w=>_("restore",n)},"恢复",8,we)):p("",!0)])]))),128))])):t(B)?p("",!0):(a(),s("div",xe,[b(Y,{name:"inventory_2",size:"36px"}),e[21]||(e[21]=l("h3",null,"暂无可访问的私有 Namespace",-1)),e[22]||(e[22]=l("p",null,"Namespace 仅由平台管理员创建。开通后会自动显示在这里。",-1))]))]),_:1},8,["loading"]),t(W).length?(a(),s("section",Ve,[e[23]||(e[23]=l("h3",null,"待处理转移",-1)),(a(!0),s(N,null,S(t(W),n=>(a(),s("div",{key:n.id,class:"transfer-row"},[l("span",null,[l("b",null,d(n.namespace),1),l("small",null,d(n.direction==="incoming"?"等待你确认接收":"等待目标归属确认"),1)]),l("div",null,[n.direction==="incoming"?(a(),s("button",{key:0,onClick:w=>_("accept",void 0,n)},"接受",8,Ue)):p("",!0),n.direction==="incoming"?(a(),s("button",{key:1,class:"danger",onClick:w=>_("reject",void 0,n)},"拒绝",8,Re)):(a(),s("button",{key:2,onClick:w=>_("cancel",void 0,n)},"撤销",8,Te))])]))),128))])):p("",!0),b(J,{modelValue:t(U),"onUpdate:modelValue":e[6]||(e[6]=n=>g(U)?U.value=n:null),size:"lg",tone:"primary",icon:"inventory_2",title:t(o)?.namespace.full_name||"Namespace 详情","show-cancel":!1,"confirm-text":"关闭",onConfirm:e[7]||(e[7]=n=>U.value=!1)},{description:y(()=>[l("p",null,d(t(o)?.namespace.effective_role?`当前角色:${H[t(o).namespace.effective_role]}`:"加载中"),1)]),default:y(()=>[t(o)?(a(),s("div",De,[l("div",Ie,[e[24]||(e[24]=l("b",null,"登录与推送",-1)),l("pre",null,d(C(t(o).namespace).login)+"\\n"+d(C(t(o).namespace).push),1),l("button",{onClick:e[0]||(e[0]=n=>O(`${C(t(o).namespace).login}
3${C(t(o).namespace).push}`))},"复制全部")]),l("div",null,[e[25]||(e[25]=l("h4",null,"Repository",-1)),t(o).repositories.length?(a(),s("div",Ne,[(a(!0),s(N,null,S(t(o).repositories,n=>(a(),s("span",{key:n.id},d(n.full_name),1))),128))])):(a(),s("p",Be,"空 Namespace,可由有 Writer 权限的用户首次 push 创建 repository。"))]),t(o).namespace.can_manage_acl?(a(),s("div",Ee,[e[28]||(e[28]=l("h4",null,"ACL 覆盖",-1)),l("div",Pe,[(a(!0),s(N,null,S(t(o).acl,n=>(a(),s("span",{key:n.user_id},d(n.username||`UID ${n.user_id}`)+" · "+d(n.role),1))),128)),t(o).acl.length?p("",!0):(a(),s("span",Le,"暂无精确覆盖"))]),l("div",Ae,[b(u,{preset:"secondary",onClick:e[1]||(e[1]=n=>_("acl",t(o).namespace))},{default:y(()=>[...e[26]||(e[26]=[x("设置覆盖",-1)])]),_:1}),b(u,{preset:"secondary",onClick:e[2]||(e[2]=n=>_("remove_acl",t(o).namespace))},{default:y(()=>[...e[27]||(e[27]=[x("移除覆盖",-1)])]),_:1})])])):p("",!0),l("div",Me,[t(o).namespace.can_manage_lifecycle&&t(o).namespace.lifecycle_state==="active"&&t(o).namespace.repository_count===0?(a(),j(u,{key:0,preset:"secondary",onClick:e[3]||(e[3]=n=>_("rename",t(o).namespace))},{default:y(()=>[...e[29]||(e[29]=[x("改名",-1)])]),_:1})):p("",!0),t(o).namespace.can_manage_lifecycle&&t(o).namespace.lifecycle_state==="active"?(a(),j(u,{key:1,preset:"secondary",onClick:e[4]||(e[4]=n=>_("transfer",t(o).namespace))},{default:y(()=>[...e[30]||(e[30]=[x("申请转移",-1)])]),_:1})):p("",!0),t(o).namespace.can_manage_lifecycle&&t(o).namespace.lifecycle_state==="active"?(a(),j(u,{key:2,color:"danger",onClick:e[5]||(e[5]=n=>_("delete",t(o).namespace))},{default:y(()=>[...e[31]||(e[31]=[x("停用并删除",-1)])]),_:1})):p("",!0)])])):p("",!0)]),_:1},8,["modelValue","title"]),b(J,{modelValue:t(E),"onUpdate:modelValue":e[15]||(e[15]=n=>g(E)?E.value=n:null),size:"sm",tone:t(q)?"danger":"primary",icon:t(q)?"warning":"tune",title:t(ee),loading:t(A),"confirm-disabled":!t(G),"confirm-text":"确认操作",onConfirm:ne},{description:y(()=>[...e[32]||(e[32]=[l("p",null,"所有操作都会校验最新 policy revision,并写入持久事件。",-1)])]),default:y(()=>[l("div",Se,[t(r)==="rename"?(a(),s("label",je,[e[33]||(e[33]=l("span",null,"新名称",-1)),V(l("input",{"onUpdate:modelValue":e[8]||(e[8]=n=>
3g(T)?T.value=n:null),maxlength:"63"},null,512),[[L,t(T)]])])):p("",!0),t(r)==="acl"||t(r)==="remove_acl"?(a(),s(N,{key:1},[l("label",null,[e[34]||(e[34]=l("span",null,"用户 UID",-1)),V(l("input",{"onUpdate:modelValue":e[9]||(e[9]=n=>g(k)?k.value=n:null),type:"number",min:"1"},null,512),[[L,t(k),void 0,{number:!0}]])]),t(r)==="acl"?(a(),s("label",ze,[e[36]||(e[36]=l("span",null,"角色覆盖",-1)),V(l("select",{"onUpdate:modelValue":e[10]||(e[10]=n=>g(D)?D.value=n:null)},[...e[35]||(e[35]=[l("option",{value:"deny"},"Deny",-1),l("option",{value:"reader"},"Reader",-1),l("option",{value:"writer"},"Writer",-1),l("option",{value:"admin"},"Admin",-1)])],512),[[Q,t(D)]])])):p("",!0)],64)):p("",!0),t(r)==="transfer"?(a(),s(N,{key:2},[l("label",null,[e[38]||(e[38]=l("span",null,"目标类型",-1)),V(l("select",{"onUpdate:modelValue":e[11]||(e[11]=n=>g(P)?P.value=n:null)},[...e[37]||(e[37]=[l("option",{value:"user"},"个人用户",-1),l("option",{value:"enterprise"},"企业",-1)])],512),[[Q,t(P)]])]),l("label",null,[e[39]||(e[39]=l("span",null,"目标 ID",-1)),V(l("input",{"onUpdate:modelValue":e[12]||(e[12]=n=>g(I)?I.value=n:null),type:"number",min:"1"},null,512),[[L,t(I),void 0,{number:!0}]])])],64)):p("",!0),l("label",null,[e[40]||(e[40]=l("span",null,"操作原因",-1)),V(l("textarea",{"onUpdate:modelValue":e[13]||(e[13]=n=>g(m)?m.value=n:null),rows:"3",placeholder:"说明业务背景或交接原因"},null,512),[[L,t(m)]])]),t(r)==="delete"?(a(),s("label",We,[e[41]||(e[41]=l("span",null,"输入完整路径确认",-1)),l("code",null,d(t(c)?.full_name),1),V(l("input",{"onUpdate:modelValue":e[14]||(e[14]=n=>g(R)?R.value=n:null),placeholder:t(c)?.full_name},null,8,Ke),[[L,t(R)]])])):p("",!0)])]),_:1},8,["modelValue","tone","icon","title","loading","confirm-disabled"])])}}}),Fe=X(Oe,[["__scopeId","data-v-247a2d85"]]),He={};function qe(Z,f){const $=Fe;return a(),j($)}const Xe=X(He,[["render",qe]]);export{Xe as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.