import{d as q,a2 as B,K as F,ah as M,c as u,a as s,u as i,n as R,t as l,F as W,b as v,E as z,f as S,e as A,v as _,g as C,h as f,$ as E,i as d,q as I,p as P,o as p}from"./index-CXwCk-SR.js";import{l as N}from"./logo-sw-DrJepD5Q.js";import{_ as $}from"./_plugin-vue_export-helper-DlAUqK2U.js";const j="/assets/login-bg-BVe1-d5v.jpg",K={class:"top"},Y={class:"brand"},G=["innerHTML"],J={class:"status-host"},O={class:"center"},Q={key:0,class:"setup-banner",role:"alert"},X={class:"setup-banner-body"},Z={class:"field"},ee=["disabled"],se={class:"field"},ae=["disabled"],te={key:1,class:"error"},ne=["disabled"],le={class:"foot"},oe={class:"foot-legal"},re=q({__name:"LoginView",setup(ue){const c=B(),L=I(),h=P(),g=f(""),b=f(""),o=f(!1),a=f(null);let m=null;async function k(){try{a.value=await E.adminAuth.health()}catch{}}F(()=>{k(),m=setInterval(()=>void k(),5e3)}),M(()=>{m&&clearInterval(m)});const y=d(()=>{var t;return a.value?a.value.configured?a.value.backend==="local"?"ok":a.value.backend==="ldap"?(t=a.value.ldap)!=null&&t.reachable?"ok":"err":"info":"warn":null}),x=d(()=>{var t;return a.value?a.value.configured?a.value.backend==="local"?"Local users":a.value.backend==="ldap"?(t=a.value.ldap)!=null&&t.reachable?"LDAP reachable":"LDAP unreachable":"Unknown backend":"Auth not configured":"Checking auth backend…"}),w=d(()=>{var t,e;return((e=(t=a.value)==null?void 0:t.ldap)==null?void 0:e.host)??null}),r=d(()=>a.value!==null&&!a.value.configured),V=d(()=>{var t;return((t=a.value)==null?void 0:t.setupHint)??""}),H=new Date().getFullYear();async function D(){var t;if(!o.value){o.value=!0;try{if(await c.login(g.value,b.value)){const n=typeof h.query.redirect=="string"?h.query.redirect:"",T=((t=c.user)==null?void 0:t.landingRoute)??"/",U=n&&n!=="/login"?n:T;await L.push(U)}}finally{o.value=!1}}}return(t,e)=>(p(),u("div",{class:"stage",style:C({backgroundImage:`url(${i(j)})`})},[e[12]||(e[12]=s("div",{class:"dim"},null,-1)),e[13]||(e[13]=s("div",{class:"wash"},null,-1)),e[14]||(e[14]=s("div",{class:"grid"},null,-1)),s("header",K,[s("span",Y,[s("span",{class:"brand-logo",innerHTML:i(N)},null,8,G),e[2]||(e[2]=s("span",{class:"brand-sep","aria-hidden":"true"},null,-1)),e[3]||(e[3]=s("span",{class:"brand-name"},"Horizon",-1))]),y.value?(p(),u("span",{key:0,class:R(["status-pill",`pill-${y.value}`])},[e[5]||(e[5]=s("span",{class:"status-dot"},null,-1)),s("b",null,l(x.value),1),w.value?(p(),u(W,{key:0},[e[4]||(e[4]=s("span",{class:"status-sep"},"·",-1)),s("code",J,l(w.value),1)],64)):v("",!0)],2)):v("",!0)]),s("main",O,[s("form",{class:"card",onSubmit:z(D,["prevent"])},[e[10]||(e[10]=s("div",{class:"card-head"},[s("h1",null,"Welcome to SkyWalking")],-1)),r.value?(p(),u("div",Q,[e[6]||(e[6]=s("div",{class:"setup-banner-head"},[s("span",{class:"setup-banner-icon","aria-hidden":"true"},"⚙︎"),s("b",null,"Auth not configured")],-1)),s("p",X,l(V.value),1),e[7]||(e[7]=s("p",{class:"setup-banner-foot"},[S(" See "),s("a",{href:"https://skywalking.apache.org/docs/skywalking-horizon-ui/next/en/setup/auth/",target:"_blank",rel:"noreferrer noopener"},"Setup → Auth"),S(" for backend selection, user / role schema, and an LDAP example. ")],-1))])):v("",!0),s("label",Z,[e[8]||(e[8]=s("span",null,"Username",-1)),A(s("input",{"onUpdate:modelValue":e[0]||(e[0]=n=>g.value=n),type:"text",name:"username",autocomplete:"username",autofocus:"",disabled:r.value,required:""},null,8,ee),[[_,g.value]])]),s("label",se,[e[9]||(e[9]=s("span",null,"Password",-1)),A(s("input",{"onUpdate:modelValue":e[1]||(e[1]=n=>b.value=n),type:"password",name:"password",autocomplete:"current-password",disabled:r.value,required:""},null,8,ae),[[_,b.value]])]),i(c).loginError?(p(),u("div",te,l(i(c).loginError),1)):v("",!0),s("button",{class:"sign-in",type:"submit",disabled:o.value||r.value},l(r.value?"Sign in disabled":o.value?"Signing in…":"Sign in"),9,ne)],32)]),s("footer",le,[s("div",oe,[s("div",null,"© 2017 – "+l(i(H))+" The Apache Software Foundation. All Rights Reserved.",1),e[11]||(e[11]=s("div",{class:"foot-tm"}," Apache SkyWalking, SkyWalking, Apache, the Apache feather logo, and the Apache SkyWalking project logo are either registered trademarks or trademarks of the Apache Software Foundation. ",-1))])])],4))}}),ce=$(re,[["__scopeId","data-v-f40b2c95"]]);export{ce as default};
