UNPKG

@sync-in/server

Version:

The secure, open-source platform for file storage, sharing, collaboration, and sync

8 lines (2 loc) 11.7 kB
import{a as fe}from"./chunk-GXWGB7WO.js";import"./chunk-XBKCQCBI.js";import"./chunk-L3BIP4AA.js";import"./chunk-NMF2ZFBE.js";import{c as me}from"./chunk-3WZ6F3LC.js";import{h as M}from"./chunk-XTVNHFKX.js";import"./chunk-RTNEBRKJ.js";import{a as se}from"./chunk-3JYMJQYT.js";import{e as pe}from"./chunk-ZHOE5VEY.js";import{c as de}from"./chunk-27Z3SYRL.js";import{Cb as O,F as N,G as ae,J as ce,qb as re,rb as H,s as Y}from"./chunk-O3YLAEVE.js";import{d as j}from"./chunk-QHJT5H4M.js";import{$e as te,Bb as R,Bf as ne,Eb as m,Ed as K,Gb as u,Ia as $,Jd as W,Kd as k,L as A,Ld as G,Ma as z,Oa as e,Qa as U,Rb as L,Sb as T,Sd as q,Tb as s,Ub as C,Ue as Z,Vb as S,Vf as oe,Wb as E,We as ee,ab as P,cc as I,ce as J,gf as D,gg as le,he as Q,ja as _,kc as f,lb as y,lc as V,mb as g,mc as h,nf as ie,oa as b,pa as x,pb as B,qb as F,qg as w,rb as c,sb as n,se as X,tb as l,ub as p}from"./chunk-D55YR5X7.js";import"./chunk-DM4NXKEP.js";import"./chunk-ZIJQRARU.js";import"./chunk-KAVP6UXH.js";function _e(a,r){if(a&1&&p(0,"fa-icon",4),a&2){let t=u();c("icon",t.icons.faSpinner)}}var ue=(()=>{let r=class r{constructor(){this.wasDeleted=new U,this.layout=_(O),this.icons={faSpinner:ie,faTrashCan:D},this.submitted=!1,this.syncService=_(M)}onEnter(){this.onSubmit()}onSubmit(){this.submitted||(this.submitted=!0,this.syncService.deleteClient(this.client.id).subscribe({next:()=>{this.layout.sendNotification("info","Client deleted",this.client.info.node),this.wasDeleted.emit(),this.layout.closeDialog()},error:i=>{this.layout.sendNotification("error","Unable to delete client",i.error.message),this.submitted=!1}}))}};r.\u0275fac=function(d){return new(d||r)},r.\u0275cmp=P({type:r,selectors:[["app-sync-client-delete-dialog"]],hostBindings:function(d,o){d&1&&m("keyup.enter",function(){return o.onEnter()},z)},inputs:{client:"client"},outputs:{wasDeleted:"wasDeleted"},decls:21,vars:6,consts:[[1,"modal-header"],["translate","",1,"modal-title"],[3,"icon"],["l10nTranslate","",1,"ms-2"],["animation","spin",1,"ms-2",3,"icon"],["aria-label","Close","type","button",1,"btn-close","btn-close-white",3,"click"],[1,"modal-body"],["size","lg",1,"me-2",3,"icon","fixedWidth"],["l10nTranslate","",1,"ms-1"],["translate",""],[1,"modal-footer"],["data-dismiss","modal","l10nTranslate","","type","button",1,"btn","btn-sm","btn-secondary",3,"click"],["l10nTranslate","","type","button",1,"btn","btn-sm","btn-danger",3,"click","disabled"]],template:function(d,o){d&1&&(n(0,"div",0)(1,"h4",1),p(2,"fa-icon",2),n(3,"span",3),s(4,"Client"),l(),y(5,_e,1,1,"fa-icon",4),l(),n(6,"button",5),m("click",function(){return o.layout.closeDialog()}),l()(),n(7,"div",6)(8,"div")(9,"b"),p(10,"fa-icon",7),s(11),l(),n(12,"span",8),s(13,"will be removed"),l()(),n(14,"small",9),s(15,"The client will no longer have permission to access your account and will no longer be able to synchronize."),l()(),n(16,"div",10)(17,"button",11),m("click",function(){return o.layout.closeDialog()}),s(18,"Cancel"),l(),n(19,"button",12),m("click",function(){return o.onSubmit()}),s(20,"Confirm"),l()()),d&2&&(e(2),c("icon",o.icons.faTrashCan),e(3),g(o.submitted?5:-1),e(5),c("icon",o.client.icon)("fixedWidth",!1),e(),C(o.client.info.node),e(8),c("disabled",o.submitted))},dependencies:[w,k],encapsulation:2,changeDetection:0});let a=r;return a})();var he=(a,r)=>r.id;function ve(a,r){if(a&1&&(p(0,"fa-icon",13),f(1,"translate")),a&2){let t=u(2);c("icon",t.icons.faCircle)("tooltip",h(1,2,"This client",t.locale.language))}}function ye(a,r){if(a&1&&(s(0),f(1,"amTimeAgo")),a&2){let t=u().$implicit;S(" ",h(1,1,t.settings.lastSync,!0)," ")}}function ge(a,r){if(a&1&&(s(0),f(1,"translate")),a&2){let t=u(3);S(" ",h(1,1,"never",t.locale.language)," ")}}function Se(a,r){if(a&1){let t=R();n(0,"div",20),m("click",function(){let d=b(t).$implicit,o=u(2);return x(o.onSelectPath(d))})("dblclick",function(){b(t);let d=u(2);return x(d.onEditPath())}),n(1,"div",21),p(2,"img",22),n(3,"div",23)(4,"span",24),s(5),l(),n(6,"div"),p(7,"fa-icon",25),n(8,"span",26)(9,"span"),s(10),l()()()()(),n(11,"div",27),p(12,"fa-icon",2),s(13),f(14,"amTimeAgo"),l(),n(15,"div"),p(16,"fa-icon",2),y(17,ye,2,4)(18,ge,2,4),l()()}if(a&2){let t=r.$implicit,i=u(2);L("selected",i.selectedPath&&i.selectedPath.id===t.id),e(2),c("src",t.mimeUrl,$),e(3),C(t.settings.name),e(),T(I("d-flex align-items-center text-",t.iconClass)),e(),c("icon",t.icon),e(3),C(t.showedPath),e(2),c("icon",i.icons.faPlusCircle),e(),S(" ",h(14,16,t.createdAt,!0)," "),e(2),T(I("badge rounded-pill sync-newly-",t.newly)),e(),c("icon",i.icons.faRotate),e(),g(t.newly?17:18)}}function be(a,r){if(a&1){let t=R();n(0,"div",8),m("click",function(){let d=b(t).$implicit,o=u();return x(o.onSelectClient(d))}),n(1,"div",9)(2,"div",10)(3,"div",11),p(4,"fa-icon",2),n(5,"div",12),s(6),l(),y(7,ve,2,5,"fa-icon",13),l(),n(8,"div"),p(9,"fa-icon",2),n(10,"div")(11,"span",14),s(12),l(),s(13),f(14,"amTimeAgo"),l()(),n(15,"div",11),p(16,"fa-icon",15),n(17,"div"),s(18),l()(),n(19,"div",11),p(20,"fa-icon",2),n(21,"div"),s(22),l()(),n(23,"div",11),p(24,"fa-icon",2),n(25,"div",16),s(26),l(),n(27,"div",17),s(28),l()(),n(29,"div",11),p(30,"fa-icon",2),n(31,"div"),s(32),l()(),n(33,"div",11),p(34,"fa-icon",2),n(35,"div"),s(36),f(37,"amDateFormat"),f(38,"amDateFormat"),l()()()(),n(39,"div",18),B(40,Se,19,19,"div",19,he),l()()}if(a&2){let t=r.$implicit,i=u();e(),L("selected",i.selected&&i.selected.id===t.id),e(3),c("icon",i.icons.CLIENT),e(2),C(t.info.node),e(),g(t.isCurrentClient?7:-1),e(),T(I("d-flex align-items-center ",t.expiration.reached?"fw-bold text-danger":t.expiration.approaching?"fw-bold text-warning":"")),e(),c("icon",i.icons.faKey),e(3),C(t.expiration.reached?"The access has expired":"The access expires"),e(),S("\xA0",V(14,25,t.expiration.value)," "),e(3),c("icon",t.icon),e(2),E("",t.osName," ",t.info.osRelease),e(2),c("icon",i.icons.faCircleUser),e(2),C(t.info.user),e(2),c("icon",i.icons.faCodeBranch),e(2),C(t.info.type),e(2),C(t.info.version),e(2),c("icon",i.icons.faAt),e(2),E("",t.currentIp,"\xA0-\xA0",t.lastIp),e(2),c("icon",i.icons.faClock),e(2),E("",h(37,27,t.currentAccess,"L HH:mm:ss"),"\xA0-\xA0",h(38,30,t.lastAccess,"L HH:mm:ss")),e(4),F(t.paths)}}var Ze=(()=>{let r=class r{constructor(){this.locale=_(K),this.icons={faArrowRotateRight:oe,faTrashCan:D,CLIENT:re.CLIENT,faCircle:ee,faCircleUser:te,faCodeBranch:J,faAt:q,faClock:X,faRotate:G,faPlusCircle:Z,faMapMarkerAlt:le,faPen:ne,faKey:Q},this.loading=!1,this.clients=[],this.router=_(j),this.layout=_(O),this.syncService=_(M),this.layout.setBreadcrumbIcon(ce.CLIENTS),this.layout.setBreadcrumbNav({url:`/${N.BASE}/${N.CLIENTS}/${ae.CLIENTS}`,splicing:2,translating:!0,sameLink:!0});let i=this.router.currentNavigation()?.extras.state;i?.clientId&&(this.focusOnSelectId=i.clientId,this.focusOnSelectPathId=i.pathId),this.loadClients()}loadClients(){this.loading=!0,this.onSelectClient(),this.onSelectPath(),this.syncService.getClients().subscribe({next:i=>{de(i,"id",!1),this.clients=i,this.focusOnSelectId&&this.onSelectClient(this.clients.find(d=>d.id===this.focusOnSelectId)),this.focusOnSelectPathId&&this.selected&&(this.onSelectPath(this.selected.paths.find(d=>d.id===this.focusOnSelectPathId)),this.focusOnSelectPathId=null)},error:i=>{console.error(i),this.loading=!1,this.layout.sendNotification("error","Clients",i.error.message)}})}onSelectClient(i){this.selected=i||null}onSelectPath(i){this.selectedPath=i||null}onDeleteClient(){this.layout.openDialog(ue,"md",{initialState:{client:this.selected}}).content.wasDeleted.pipe(A(1)).subscribe(()=>this.loadClients())}gotoPath(i){this.syncService.goToPath(i,!1)}onEditPath(){this.selected.isCurrentClient?this.router.navigate([H.BASE,H.PATHS],{state:{id:this.selectedPath.id,withSettings:!0}}).catch(console.error):this.layout.openDialog(fe,"md",{initialState:{syncPathSelected:this.selectedPath,syncClientSelected:this.selected}}).content.mustRefresh.pipe(A(1)).subscribe(()=>{this.focusOnSelectId=this.selected.id,this.focusOnSelectPathId=this.selectedPath.id,this.loadClients()})}};r.\u0275fac=function(d){return new(d||r)},r.\u0275cmp=P({type:r,selectors:[["app-sync-clients"]],decls:16,vars:23,consts:[[1,"app-top-menu"],["container","body","type","button",1,"d-none","d-sm-block","btn","btn-sm","btn-secondary","me-1",3,"click","tooltip"],[3,"icon"],["container","body","type","button",1,"btn","btn-sm","btn-secondary","me-1",3,"click","disabled","tooltip"],["placement","auto","type","button",1,"btn","btn-sm","btn-secondary","ms-auto","me-1",3,"click","disabled","tooltip"],["placement","auto","type","button",1,"btn","btn-sm","btn-secondary",3,"click","disabled","tooltip"],["appAutoResize","",1,"app-sync-clients"],[1,"d-flex"],[1,"d-flex",3,"click"],[1,"left-panel","app-div-hovered","col-md-5","col-lg-4","col-sm-12"],[1,"left-panel-content","p-2"],[1,"d-flex","align-items-center"],[1,"me-auto","fw-semibold"],[1,"text-light-green","cursor-pointer",3,"icon","tooltip"],["l10nTranslate",""],[1,"osIcon",3,"icon"],[1,"me-2"],[1,"badge","rounded-pill","bg-primary"],[1,"right-panel","d-none","d-md-flex","d-lg-flex","col-md-7","col-lg-8","p-0"],[1,"d-flex","align-items-center","cursor-pointer","app-div-hovered","py-1","ps-2","pe-4",3,"selected"],[1,"d-flex","align-items-center","cursor-pointer","app-div-hovered","py-1","ps-2","pe-4",3,"click","dblclick"],[1,"d-flex","align-items-center","text-truncate","px-2","py-1","me-auto"],["alt","","draggable","false","height","30",3,"src"],[1,"d-flex","flex-column","text-truncate","ms-2",2,"height","34px"],[1,"fs-xxs","text-truncate","user-select-none"],[1,"me-1",3,"icon"],[1,"fs-xxxs","text-truncate","user-select-none"],[1,"badge","rounded-pill","bg-dark","me-1"]],template:function(d,o){d&1&&(n(0,"div",0)(1,"button",1),f(2,"translate"),m("click",function(){return o.loadClients()}),p(3,"fa-icon",2),l(),n(4,"button",3),f(5,"translate"),m("click",function(){return o.onDeleteClient()}),p(6,"fa-icon",2),l(),n(7,"button",4),f(8,"translate"),m("click",function(){return o.gotoPath(o.selectedPath)}),p(9,"fa-icon",2),l(),n(10,"button",5),f(11,"translate"),m("click",function(){return o.onEditPath()}),p(12,"fa-icon",2),l()(),n(13,"div",6),B(14,be,42,33,"div",7,he),l()),d&2&&(e(),c("tooltip",h(2,11,"Refresh",o.locale.language)),e(2),c("icon",o.icons.faArrowRotateRight),e(),c("disabled",!o.selected)("tooltip",h(5,14,"Remove",o.locale.language)),e(2),c("icon",o.icons.faTrashCan),e(),c("disabled",!o.selectedPath)("tooltip",h(8,17,"Go to",o.locale.language)),e(2),c("icon",o.icons.faMapMarkerAlt),e(),c("disabled",!o.selectedPath)("tooltip",h(11,20,"Edit",o.locale.language)),e(2),c("icon",o.icons.faPen),e(2),F(o.clients))},dependencies:[Y,w,me,k,W,se,pe],styles:[`.app-sync-clients[_ngcontent-%COMP%]{font-size:.7rem;display:flex;flex-direction:column;flex:1 1 auto!important}.app-sync-clients[_ngcontent-%COMP%] .left-panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;cursor:pointer;border-right:solid 1px;border-bottom:solid 1px}.app-sync-clients[_ngcontent-%COMP%] .left-panel[_ngcontent-%COMP%] .left-panel-content[_ngcontent-%COMP%] .osIcon[_ngcontent-%COMP%]{font-size:1.2rem;margin-right:.4rem;margin-left:-2px}.app-sync-clients[_ngcontent-%COMP%] .left-panel[_ngcontent-%COMP%] .left-panel-content[_ngcontent-%COMP%] fa-icon[_ngcontent-%COMP%]:first-child:not(.osIcon){font-size:1rem;margin-right:.4rem}.app-sync-clients[_ngcontent-%COMP%] .left-panel[_ngcontent-%COMP%] .left-panel-content[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{height:26px}.app-sync-clients[_ngcontent-%COMP%] .right-panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;border-bottom:solid 1px} `]});let a=r;return a})();export{Ze as SyncClientsComponent};