@sync-in/server
Version:
The secure, open-source platform for file storage, sharing, collaboration, and sync
2 lines (1 loc) • 11.3 kB
JavaScript
import{a as Q}from"./chunk-5O66CLTD.js";import{a as ge}from"./chunk-S3TTWPQA.js";import"./chunk-HGODIZTV.js";import{a as de}from"./chunk-XEWLBWFF.js";import{a as Ce}from"./chunk-3JYMJQYT.js";import{w as me}from"./chunk-B6HQYQYG.js";import{a as fe}from"./chunk-DGCVA6BM.js";import"./chunk-ZHOE5VEY.js";import"./chunk-GWRAGN3M.js";import{a as N}from"./chunk-3RPUQ22U.js";import{a as B,b as xe}from"./chunk-GQHXYX6Z.js";import"./chunk-27Z3SYRL.js";import{Cb as _e,D as oe,F as R,G as re,J as se,gb as pe,s as J,va as le,wa as ce,xa as ue}from"./chunk-O3YLAEVE.js";import{Bb as G,Bf as ee,Eb as x,Ed as q,Gb as s,Ia as H,Jd as W,Kb as S,Kd as z,L as D,Lb as F,Ld as X,Mb as U,Oa as a,Pc as j,Qb as I,Rb as $,Sb as k,Tb as p,Tf as te,Ub as V,Vb as w,Vf as ie,Wb as O,ab as L,dc as K,ef as Z,fb as M,fg as ne,he as Y,ja as E,kc as g,lb as v,lc as P,mb as h,mc as y,oa as _,pa as m,pb as b,qb as T,qg as ae,rb as d,sb as l,tb as c,ub as C}from"./chunk-D55YR5X7.js";import"./chunk-DM4NXKEP.js";import"./chunk-ZIJQRARU.js";import"./chunk-KAVP6UXH.js";var ye=["MainContextMenu"],we=["TargetContextMenu"],ve=(e,o)=>o.key,be=(e,o)=>o.id,Te=(e,o)=>o.mid;function Ge(e,o){if(e&1&&C(0,"fa-icon",18),e&2){let t=s(3);d("icon",t.sortTable.sortParam.asc?t.icons.faArrowDown:t.icons.faArrowUp)("fixedWidth",!1)}}function Se(e,o){if(e&1){let t=G();l(0,"th",17),x("click",function(){_(t);let r=s().$implicit,n=s();return m(n.sortBy(r.key))}),p(1),v(2,Ge,1,2,"fa-icon",18),c()}if(e&2){let t=s().$implicit,i=s();k(t.value.class),I("width",t.value.width,"%"),$("text-align-center",t.value.textCenter)("cursor-pointer",t.value.sortable),a(),w(" ",t.value.label," "),a(),h(i.sortTable.sortParam.column===t.key?2:-1)}}function Fe(e,o){if(e&1&&v(0,Se,3,10,"th",16),e&2){let t=o.$implicit;h(t.value.show?0:-1)}}function Ue(e,o){if(e&1&&(l(0,"div",21),C(1,"img",24),l(2,"div",22)(3,"span",25),p(4),c(),l(5,"span",26),p(6),c()()()),e&2){let t=s(3).$implicit;a(),d("src",t.avatarUrl,H),a(3),w(" ",t.login," "),a(2),V(t.email)}}function Ve(e,o){if(e&1&&(l(0,"div",22)(1,"span",25),p(2),c()()),e&2){let t=s(3).$implicit;a(2),V(t.fullName)}}function Ae(e,o){if(e&1&&C(0,"app-user-avatar",27),e&2){let t=o.$implicit;d("user",t)("isMember",!0)}}function Ee(e,o){if(e&1&&b(0,Ae,1,2,"app-user-avatar",27,Te),e&2){let t=s(3).$implicit;T(t.managers)}}function Me(e,o){e&1&&p(0," too many login attempts ")}function $e(e,o){if(e&1&&p(0),e&2){let t=s(4).$implicit;w(" ",t.userIsActiveText," ")}}function ke(e,o){if(e&1&&(l(0,"span",28),v(1,Me,1,0)(2,$e,1,1),c()),e&2){let t=s(3).$implicit;k(t.isActive?"text-success":"text-danger"),a(),h(!t.isActive&&t.passwordAttempts?1:2)}}function Pe(e,o){if(e&1&&(p(0),g(1,"amDateFormat")),e&2){let t=s(3).$implicit;w(" ",P(1,1,t.createdAt)," ")}}function De(e,o){if(e&1&&(l(0,"div",22)(1,"div"),p(2),g(3,"amDateFormat"),c(),l(4,"div"),p(5),g(6,"amDateFormat"),c()()),e&2){let t=s(5).$implicit;a(2),V(P(3,2,t.currentAccess)),a(3),V(P(6,4,t.lastAccess))}}function Ie(e,o){if(e&1&&p(0),e&2){let t=s(5).$implicit;w(" ",t.hTimeAgo," ")}}function Re(e,o){if(e&1){let t=G();l(0,"div",30),x("mouseover",function(){_(t);let r=s(4).$implicit;return m(r.currentAccessHover=!0)})("focus",function(){_(t);let r=s(4).$implicit;return m(r.currentAccessHover=!0)})("mouseleave",function(){_(t);let r=s(4).$implicit;return m(r.currentAccessHover=!1)}),v(1,De,7,6,"div",22)(2,Ie,1,1),c()}if(e&2){let t=s(4).$implicit;a(),h(t.currentAccessHover?1:2)}}function Be(e,o){e&1&&(l(0,"span",28),p(1,"never"),c())}function Ne(e,o){if(e&1&&v(0,Re,3,1,"div",29)(1,Be,2,0,"span",28),e&2){let t=s(3).$implicit;h(t.currentAccess?0:1)}}function Qe(e,o){if(e&1&&(l(0,"td"),v(1,Ue,7,3,"div",21)(2,Ve,3,1,"div",22)(3,Ee,2,0)(4,ke,3,3,"span",23)(5,Pe,2,3)(6,Ne,2,1),c()),e&2){let t,i=s().$implicit,r=s().$implicit;k(K("",i.value.class," ",i.value.newly?"prop-newly-"+r[i.value.newly]:"")),I("width",i.value.width,"%"),$("text-align-center",i.value.textCenter),a(),h((t=i.key)==="login"?1:t==="fullName"?2:t==="managers"?3:t==="isActive"?4:t==="createdAt"?5:t==="currentAccess"?6:-1)}}function He(e,o){if(e&1&&v(0,Qe,7,9,"td",20),e&2){let t=o.$implicit;h(t.value.show?0:-1)}}function Le(e,o){if(e&1){let t=G();l(0,"tr",19),x("click",function(){let r=_(t).$implicit,n=s();return m(n.onSelect(r))})("contextmenu",function(r){let n=_(t).$implicit,u=s();return m(u.onTargetContextMenu(r,n))})("appTap",function(){_(t);let r=s();return m(r.openGuestDialog())}),b(1,He,1,1,null,null,ve),g(3,"keyvalue"),c()}if(e&2){let t=o.$implicit,i=s();$("disabled",!t.isActive)("selected",t.id===(i.selected==null?null:i.selected.id)),a(),T(y(3,4,i.tableHeaders,i.originalOrderKeyValue))}}function Oe(e,o){if(e&1&&(l(0,"span",28),C(1,"fa-icon",6),p(2,"New guest"),c()),e&2){let t=s();a(),d("icon",t.icons.faPlus)}}function Ke(e,o){}function je(e,o){if(e&1&&(l(0,"span",28),C(1,"fa-icon",6),p(2,"Refresh"),c()),e&2){let t=s();a(),d("icon",t.icons.faArrowRotateRight)}}function qe(e,o){if(e&1&&(l(0,"span",28),C(1,"fa-icon",6),p(2,"Edit guest"),c()),e&2){let t=s();a(),d("icon",t.icons.faPen)}}var vt=(()=>{let o=class o{constructor(){this.locale=E(q),this.originalOrderKeyValue=pe,this.icons={faRotate:X,faPlus:te,faPen:ee,faArrowDown:ne,faArrowUp:Z,faKey:Y,faArrowRotateRight:ie},this.tableHeaders={login:{label:"Login",width:30,textCenter:!1,class:"",show:!0,sortable:!0},fullName:{label:"Full name",width:15,class:"",textCenter:!1,show:!0,sortable:!0},managers:{label:"Managers",width:15,class:"d-none d-md-table-cell",textCenter:!0,show:!0,sortable:!0},isActive:{label:"Status",width:10,textCenter:!0,class:"d-none d-lg-table-cell",show:!0,sortable:!0},createdAt:{label:"Created",width:12,textCenter:!0,class:"d-none d-lg-table-cell",show:!0,sortable:!0},currentAccess:{label:"Seen",width:12,textCenter:!0,class:"d-none d-lg-table-cell",newly:"newly",show:!0,sortable:!0}},this.loading=!1,this.selected=null,this.guests=[],this.layout=E(_e),this.userService=E(me),this.canCreateGuest=this.userService.userHavePermission(oe.GUESTS_ADMIN),this.sortSettings={default:[{prop:"login",type:"string"}],login:[{prop:"login",type:"string"}],fullName:[{prop:"fullName",type:"string"}],managers:[{prop:"managers",type:"length"}],storage:[{prop:"storageUsage",type:"number"}],currentAccess:[{prop:"currentAccess",type:"date"}],createdAt:[{prop:"createdAt",type:"date"}],isActive:[{prop:"isActive",type:"number"}]},this.sortTable=new xe(this.constructor.name,this.sortSettings),this.loadGuests(),this.layout.setBreadcrumbIcon(se.GUESTS),this.layout.setBreadcrumbNav({url:`/${R.BASE}/${R.GUESTS}/${re.GUESTS}`,splicing:2,translating:!0,sameLink:!0})}loadGuests(){this.loading=!0,this.onSelect(),this.userService.listGuests().subscribe({next:i=>{this.sortBy(this.sortTable.sortParam.column,!1,i),this.scrollView.scrollInto(-1),this.loading=!1},error:i=>{this.guests=[],this.layout.sendNotification("error","Guests",i.error.message),this.loading=!1}})}onSelect(i=null){this.selected=i}onContextMenu(i){i.preventDefault(),i.stopPropagation(),this.layout.openContextMenu(i,this.mainContextMenu)}onTargetContextMenu(i,r){i.preventDefault(),i.type==="contextmenu"&&i.stopPropagation(),this.onSelect(r),this.layout.openContextMenu(i,this.targetContextMenu)}sortBy(i,r=!0,n){this.guests=this.sortTable.sortBy(i,r,n||this.guests)}openGuestDialog(i=!1){i?this.layout.openDialog(Q,"md").content.guestChange.pipe(D(1)).subscribe(n=>{let[u,f]=n;u==="add"&&(this.sortBy(this.sortTable.sortParam.column,!1,[...this.guests,f]),this.onSelect(f))}):this.userService.getGuest(this.selected.id).subscribe({next:r=>{this.layout.openDialog(Q,"md",{initialState:{guest:r}}).content.guestChange.pipe(D(1)).subscribe(u=>{let[f,A]=u;f==="update"?this.selected=Object.assign(this.selected,A):f==="delete"&&(this.onSelect(),this.sortBy(this.sortTable.sortParam.column,!1,this.guests.filter(he=>he.id!==A.id)))})},error:r=>this.layout.sendNotification("error","Guest error",this.selected.fullName,r)})}};o.\u0275fac=function(r){return new(r||o)},o.\u0275cmp=L({type:o,selectors:[["app-user-guests"]],viewQuery:function(r,n){if(r&1&&(S(N,5),S(B,7),S(ye,7),S(we,7)),r&2){let u;F(u=U())&&(n.scrollView=u.first),F(u=U())&&(n.inputFilter=u.first),F(u=U())&&(n.mainContextMenu=u.first),F(u=U())&&(n.targetContextMenu=u.first)}},decls:35,vars:32,consts:[["MainContextMenu",""],["TargetContextMenu",""],[1,"app-top-menu"],["container","body","type","button",1,"btn","btn-sm","btn-secondary","me-1",3,"click","tooltip"],[3,"icon","animation"],["container","body","type","button",1,"btn","btn-sm","btn-secondary","me-1",3,"click","disabled","tooltip"],[3,"icon"],[1,"d-none","d-sm-block","ms-auto"],[1,"app-table"],[3,"contextmenu","bufferAmount","items"],["tabindex","-1"],[3,"disabled","selected"],[1,"app-foot-menu"],[1,"mx-auto"],["contextMenuItem","",3,"execute"],["contextMenuItem","",3,"divider"],["l10nTranslate","",3,"width","text-align-center","cursor-pointer","class"],["l10nTranslate","",3,"click"],[3,"icon","fixedWidth"],[3,"click","contextmenu","appTap"],[3,"width","text-align-center","class"],[1,"d-flex","align-items-center","avatar"],[1,"d-flex","flex-column"],["l10nTranslate","",3,"class"],["alt","",1,"avatar-img",3,"src"],["draggable","false",1,"no-pointer-events"],["draggable","false",1,"no-pointer-events","text-muted","fs-xxxs"],[3,"user","isMember"],["l10nTranslate",""],[1,"d-flex","justify-content-center"],[1,"d-flex","justify-content-center",3,"mouseover","focus","mouseleave"]],template:function(r,n){if(r&1){let u=G();l(0,"div",2)(1,"button",3),g(2,"translate"),x("click",function(){return _(u),m(n.loadGuests())}),C(3,"fa-icon",4),c(),l(4,"button",5),g(5,"translate"),x("click",function(){return _(u),m(n.openGuestDialog(!0))}),C(6,"fa-icon",6),c(),l(7,"button",5),g(8,"translate"),x("click",function(){return _(u),m(n.openGuestDialog())}),C(9,"fa-icon",6),c(),C(10,"app-input-filter",7),c(),l(11,"table",8)(12,"thead")(13,"tr"),b(14,Fe,1,1,null,null,ve),g(16,"keyvalue"),c()()(),l(17,"app-virtual-scroll",9),g(18,"searchFilter"),x("contextmenu",function(A){return _(u),m(n.onContextMenu(A))}),l(19,"table",8)(20,"tbody",10),b(21,Le,4,7,"tr",11,be),c()()(),l(23,"div",12)(24,"span",13),p(25),g(26,"translate"),c()(),l(27,"context-menu",null,0),M(29,Oe,3,1,"ng-template",14),x("execute",function(){return _(u),m(n.openGuestDialog(!0))}),M(30,Ke,0,0,"ng-template",15)(31,je,3,1,"ng-template",14),x("execute",function(){return _(u),m(n.loadGuests())}),c(),l(32,"context-menu",null,1),M(34,qe,3,1,"ng-template",14),x("execute",function(){return _(u),m(n.openGuestDialog())}),c()}r&2&&(a(),d("tooltip",y(2,14,"Refresh",n.locale.language)),a(2),d("icon",n.icons.faRotate)("animation",n.loading?"spin":null),a(),d("disabled",!n.canCreateGuest)("tooltip",y(5,17,"New guest",n.locale.language)),a(2),d("icon",n.icons.faPlus),a(),d("disabled",!n.selected)("tooltip",y(8,20,"Edit guest",n.locale.language)),a(2),d("icon",n.icons.faPen),a(5),T(y(16,23,n.tableHeaders,n.originalOrderKeyValue)),a(3),d("bufferAmount",5)("items",y(18,26,n.guests,n.inputFilter.search())),a(4),T(n.scrollView==null?null:n.scrollView.viewPortItems),a(4),O("",n.guests.length," ",y(26,29,"guests",n.locale.language)),a(5),d("divider",!0))},dependencies:[ae,B,J,z,N,ue,ce,le,ge,de,W,j,fe,Ce],encapsulation:2});let e=o;return e})();export{vt as UserGuestsComponent};