Files
archie/ui/dist/assets/AuthenticationPage.js
T
sam cc2f3a46b9 feat(ui): settings pages edit through TanStack Form with shadcn-vue Field
Each control-plane kind has one store-owned TanStack form, so edits survive
navigation and the save bar submits every dirty section. Shared editors emit
new values, map entries are written whole, unset resources stay null, and the
container runtime page warns when max uptime is under the task limit.
2026-10-26 19:17:03 +11:00

1 line
3.1 KiB
JavaScript

import{A as e,C as t,M as n,S as r,Xt as i,_t as a,b as o,dt as s,ir as c,jn as l,k as u,t as d,x as f,xn as p,y as m}from"./PageHeader.js";import{A as h,r as g,rt as _}from"./createLucideIcon.js";import{t as v}from"./input.js";import{t as y}from"./check.js";import{V as b,a as x,w as S}from"./index.js";var C={key:0,class:`mb-4 text-sm text-danger`,role:`alert`},w={class:`flex items-center gap-2`},T={class:`min-w-0 flex-1 select-all break-all rounded-md border border-border bg-muted px-2 py-1.5 font-mono text-xs`},E={class:`flex items-center justify-end gap-2 border-t border-border pt-3`},D=n({__name:`AuthenticationPage`,setup(n){let D=p({public_url:``,oidc_issuer:``,oidc_audience:``,oidc_client_id:``}),O=p(!1),k=p(``),A=p(!1),j=p(!1);s(async()=>{try{D.value=await g.authentication(),O.value=!0}catch(e){k.value=String(e.message||e)}});let M=m(()=>`${D.value.public_url.replace(/\/$/,``)}/oauth2/callback`),N=p(!1);async function P(){await navigator.clipboard.writeText(M.value),N.value=!0,setTimeout(()=>N.value=!1,1500)}async function F(){A.value=!0,k.value=``,j.value=!1;try{await g.saveAuthentication(D.value),j.value=!0}catch(e){k.value=String(e.message||e)}finally{A.value=!1}}return(n,s)=>(a(),t(`div`,null,[e(d,{title:`Authentication`}),k.value?(a(),t(`p`,C,[u(c(k.value)+` `,1),s[4]||=o(`a`,{class:`underline`,href:`/?reauth=1`},`Sign in again`,-1)])):r(``,!0),O.value?(a(),t(`form`,{key:1,onSubmit:_(F,[`prevent`])},[e(l(S),{title:`Instance URL`},{default:i(()=>[e(l(x),{label:`Public address`,for:`instance-url`,hint:`Passkeys require HTTPS and a domain name, or localhost. Once passkeys are enrolled, their domain is fixed.`},{default:i(()=>[e(l(v),{id:`instance-url`,modelValue:D.value.public_url,"onUpdate:modelValue":s[0]||=e=>D.value.public_url=e,type:`url`,required:``},null,8,[`modelValue`])]),_:1})]),_:1}),e(l(S),{title:`OpenID Connect`},{default:i(()=>[e(l(x),{label:`Issuer URL`,for:`oidc-issuer`},{default:i(()=>[e(l(v),{id:`oidc-issuer`,modelValue:D.value.oidc_issuer,"onUpdate:modelValue":s[1]||=e=>D.value.oidc_issuer=e,type:`url`,placeholder:`https://identity.example.com`},null,8,[`modelValue`])]),_:1}),e(l(x),{label:`Client ID`,for:`oidc-client`},{default:i(()=>[e(l(v),{id:`oidc-client`,modelValue:D.value.oidc_client_id,"onUpdate:modelValue":s[2]||=e=>D.value.oidc_client_id=e},null,8,[`modelValue`])]),_:1}),e(l(x),{label:`Access token audience`,for:`oidc-audience`},{default:i(()=>[e(l(v),{id:`oidc-audience`,modelValue:D.value.oidc_audience,"onUpdate:modelValue":s[3]||=e=>D.value.oidc_audience=e},null,8,[`modelValue`])]),_:1}),e(l(x),{label:`Redirect URI`,hint:`Add permitted people in Organisation → Members.`},{default:i(()=>[o(`div`,w,[o(`code`,T,c(M.value),1),e(l(h),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Copy redirect URI`,title:`Copy redirect URI`,onClick:P},{default:i(()=>[N.value?(a(),f(l(y),{key:0})):(a(),f(l(b),{key:1}))]),_:1})])]),_:1}),o(`div`,E,[j.value?(a(),f(l(y),{key:0,role:`status`,"aria-label":`Saved`,class:`size-4 text-fg-muted`})):r(``,!0),e(l(h),{type:`submit`,disabled:A.value},{default:i(()=>[...s[5]||=[u(`Save`,-1)]]),_:1},8,[`disabled`])])]),_:1})],32)):r(``,!0)]))}});export{D as default};