2FAuth/public/build/assets/Users-Cjm1JjIX.js
2024-11-27 12:03:02 +01:00

3 lines
4.4 KiB
JavaScript
Vendored

import{_ as V}from"./AdminTabs-Dso2jpCe.js";import{a as j,a2 as I,r as k,x as $,o as N,I as S,a1 as T,d as c,j as n,e as t,k as p,L as R,l as _,m as u,t as i,g as B,f as m,C as E,F as O,D as W,U as D,n as y,i as F}from"./app-CzxRjCVM.js";import{S as M}from"./Spinner-C-V0HKYn.js";import{_ as Z}from"./SearchBox-CH3IEr_n.js";/*! 2FAuth version 5.4.3 - Copyright (c) 2024 Bubka - https://github.com/Bubka/2FAuth */const q={class:"options-tabs"},G={class:"title is-4 has-text-grey-light"},H={class:"is-size-7-mobile"},J={class:"mb-6 mt-3"},K={class:"columns"},P={class:"column pb-0"},Q={class:"level is-mobile mb-0"},X={class:"level-item has-text-centered is-justify-content-end"},Y={class:"subtitle is-7"},ee={class:"level-item has-text-centered is-justify-content-start"},se={class:"buttons"},te={key:0},ae={class:"has-ellipsis"},oe={class:"is-block has-ellipsis is-family-primary is-size-6 is-size-7-mobile has-text-grey"},ne={class:"tags mt-2"},ie={class:"ml-3"},le={key:1,class:"mt-4 pl-3"},he={__name:"Users",setup(re){const x=R("2fauth"),w=j(),A=I(x.prefix+"returnTo","accounts"),v=k([]),a=k(""),f=k(!1),C=$(()=>v.value.filter(e=>{let s=e.name.toLowerCase().includes(r.value.keywords)||e.email.toLowerCase().includes(r.value.keywords);return r.value.admin!=null&&(s=s&&e.is_admin==r.value.admin),r.value.oauth!=null&&(s=s&&e.oauth_provider==r.value.oauth),s})),r=$(()=>{const e={admin:void 0,oauth:void 0,keywords:a.value.toLowerCase()},s=a.value.toLowerCase().split(" "),d=/admin:([01])/,h=/oauth:([a-zA-Z0-9])/;return s.forEach(l=>{l.match(d)&&(e.admin=parseInt(l.replace(d,"$1")),e.keywords=e.keywords.replace(l,"").trim()),l.match(h)&&(e.oauth=l.replace(h,"$1"),e.keywords=e.keywords.replace(l,"").trim())}),e});N(()=>{L()});function b(e){const s=/admin:([01])/,d=/oauth:([a-zA-Z0-9]*)/;a.value.match(s)&&e.match(s)?a.value=a.value.replace(s,e):r.value.oauth!=null&&e.match(d)?a.value=a.value.replace(d,e):a.value=a.value?a.value+" "+e:e}function L(){f.value=!0,S.getAll({returnError:!0}).then(e=>{v.value=e.data}).catch(e=>{w.error(e)}).finally(()=>{f.value=!1})}return T(e=>{e.name.startsWith("admin.")||w.clear()}),(e,s)=>{const d=_("FontAwesomeIcon"),h=_("RouterLink"),l=_("ButtonBackCloseCancel"),z=_("VueFooter"),U=_("FormWrapper");return u(),c("div",null,[n(V,{activeTab:"admin.users"}),t("div",q,[n(U,null,{default:p(()=>[t("h4",G,i(e.$t("admin.users")),1),t("div",H,i(e.$t("admin.users_legend")),1),t("div",J,[n(h,{class:"is-link mt-5",to:{name:"admin.createUser"}},{default:p(()=>[n(d,{icon:["fas","plus-circle"]}),B(" "+i(e.$t("admin.create_new_user")),1)]),_:1})]),t("div",K,[t("div",P,[n(Z,{keyword:m(a),"onUpdate:keyword":s[0]||(s[0]=o=>E(a)?a.value=o:null),hasNoBackground:!0,placeholder:e.$t("admin.search_user_placeholder")},null,8,["keyword","placeholder"])])]),t("div",Q,[t("div",X,[t("p",Y,i(e.$t("admin.quick_filters_colons")),1)]),t("div",ee,[t("div",se,[t("button",{type:"button",class:"button is-small is-ghost p-0",onClick:s[1]||(s[1]=o=>b("admin:1"))},"admin"),t("button",{type:"button",class:"button is-small is-ghost p-0",onClick:s[2]||(s[2]=o=>b("oauth:github"))},"github"),t("button",{type:"button",class:"button is-small is-ghost p-0",onClick:s[3]||(s[3]=o=>b("oauth:openid"))},"openId")])])]),m(C).length>0?(u(),c("div",te,[(u(!0),c(O,null,W(m(C),o=>(u(),c("div",{key:o.id,class:"list-item is-size-5 is-size-6-mobile is-flex is-justify-content-space-between"},[n(m(D),null,{default:p(({mode:g})=>[t("div",ae,[t("span",null,i(o.name),1),t("span",oe,i(o.email),1),t("div",ne,[o.is_admin?(u(),c("span",{key:0,class:y(["tag is-rounded has-text-warning-dark",g=="dark"?"has-background-black-bis":"has-background-grey-lighter"])},"admin",2)):F("",!0),o.oauth_provider?(u(),c("span",{key:1,class:y(["tag is-rounded has-text-grey",g=="dark"?"has-background-black-bis":"has-background-grey-lighter"])},"oauth: "+i(o.oauth_provider),3)):F("",!0)])]),t("div",ie,[n(h,{to:{name:"admin.manageUser",params:{userId:o.id}},class:y(["button is-small has-normal-radius",{"is-dark":g=="dark"}]),title:e.$t("commons.manage")},{default:p(()=>[B(i(e.$t("commons.manage")),1)]),_:2},1032,["to","class","title"])])]),_:2},1024)]))),128))])):(u(),c("div",le,i(e.$t("commons.no_result")),1)),n(M,{isVisible:m(f)&&m(v).length===0},null,8,["isVisible"]),n(z,{showButtons:!0},{default:p(()=>[n(l,{returnTo:{name:m(A)},action:"close"},null,8,["returnTo"])]),_:1})]),_:1})])])}}};export{he as default};
//# sourceMappingURL=Users-Cjm1JjIX.js.map