@sync-in/server
Version:
The secure, open-source platform for file storage, sharing, collaboration, and sync
2 lines (1 loc) • 11.5 kB
JavaScript
import{a as fe}from"./chunk-4TPFERL6.js";import"./chunk-L3BIP4AA.js";import{h as V}from"./chunk-XTVNHFKX.js";import"./chunk-RTNEBRKJ.js";import{a as z}from"./chunk-3RPUQ22U.js";import{a as Q,b as _e}from"./chunk-GQHXYX6Z.js";import"./chunk-27Z3SYRL.js";import{Cb as M,gb as ce,pb as pe,qb as me,rb as q,s as re,vb as de}from"./chunk-O3YLAEVE.js";import{d as G}from"./chunk-QHJT5H4M.js";import{Bb as b,Cd as ne,Eb as d,Ed as ie,Gb as p,Ia as H,Jd as oe,Kb as $,Kd as P,L as K,Lb as A,Mb as O,Oa as a,Pc as W,Qa as U,Qb as N,Rb as T,Sb as S,Tb as c,Ub as f,Vb as B,Wf as le,ab as k,cc as L,dc as Y,ef as ae,fg as se,gf as D,ja as u,jd as J,kc as E,lb as h,mb as y,mc as F,oa as x,od as X,pa as v,pb as g,qb as w,qg as R,rb as m,sb as n,tb as o,tc as j,ub as C,ud as Z,vd as ee,wd as te}from"./chunk-D55YR5X7.js";import"./chunk-DM4NXKEP.js";import"./chunk-ZIJQRARU.js";import"./chunk-KAVP6UXH.js";function Se(t,r){if(t&1&&(n(0,"span",6),c(1,"Events from"),o(),c(2,"\xA0"),n(3,"b"),c(4),o()),t&2){let e=p();a(4),f(e.syncPath.settings.name)}}function xe(t,r){t&1&&(n(0,"span",6),c(1,"All events"),o())}var ue=(()=>{let r=class r{constructor(){this.syncPath=null,this.wasDeleted=new U,this.layout=u(M),this.icons={faTrashCan:D},this.syncService=u(V)}doClear(){this.syncService.deleteTransfers(this.syncPath?.id).then(()=>{this.wasDeleted.emit(),this.layout.closeDialog()})}};r.\u0275fac=function(s){return new(s||r)},r.\u0275cmp=k({type:r,selectors:[["app-sync-transfers-delete-dialog"]],inputs:{syncPath:"syncPath"},outputs:{wasDeleted:"wasDeleted"},decls:18,vars:2,consts:[[1,"modal-header"],["translate","",1,"modal-title"],[3,"icon"],["l10nTranslate","",1,"ms-2"],["aria-label","Close","type","button",1,"btn-close","btn-close-white",3,"click"],[1,"modal-body"],["l10nTranslate",""],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary",3,"click"],["type","submit","l10nTranslate","",1,"btn","btn-sm","btn-danger",3,"click"]],template:function(s,l){s&1&&(n(0,"div",0)(1,"h4",1),C(2,"fa-icon",2),n(3,"span",3),c(4,"Clear events"),o()(),n(5,"button",4),d("click",function(){return l.layout.closeDialog()}),o()(),n(6,"div",5),h(7,Se,5,1)(8,xe,2,0,"span",6),n(9,"span"),c(10,"\xA0"),o(),n(11,"span",6),c(12,"will be cleared"),o()(),n(13,"div",7)(14,"button",8),d("click",function(){return l.layout.closeDialog()}),c(15,"Cancel"),o(),n(16,"button",9),d("click",function(){return l.doClear()}),c(17,"Confirm"),o()()),s&2&&(a(2),m("icon",l.icons.faTrashCan),a(5),y(l.syncPath?7:8))},dependencies:[P,R],encapsulation:2});let t=r;return t})();var he=(t,r)=>r.id,ye=(t,r)=>r.key;function ve(t,r){if(t&1&&(n(0,"option",4),c(1),o()),t&2){let e=r.$implicit;m("ngValue",e),a(),f(e.settings.name)}}function Te(t,r){if(t&1&&C(0,"fa-icon",14),t&2){let e=p(3);m("icon",e.sortTable.sortParam.asc?e.icons.faArrowDown:e.icons.faArrowUp)}}function ge(t,r){if(t&1){let e=b();n(0,"th",23),d("click",function(){x(e);let s=p().$implicit,l=p();return v(l.sortBy(s.key))}),c(1),h(2,Te,1,1,"fa-icon",14),o()}if(t&2){let e=p().$implicit,i=p();S(e.value.class),N("width",e.value.width,"%"),T("text-align-center",e.value.textCenter)("cursor-pointer",e.value.sortable),a(),B(" ",e.value.label," "),a(),y(i.sortTable.sortParam.column===e.key?2:-1)}}function we(t,r){if(t&1&&h(0,ge,3,10,"th",22),t&2){let e=r.$implicit;y(e.value.show?0:-1)}}function be(t,r){if(t&1&&(n(0,"span",26),C(1,"fa-icon",14)(2,"fa-icon",27),n(3,"span",28),c(4),o()()),t&2){let e=p(3).$implicit;a(),S(e.ok?e.sideIconClass:"circle-error-icon-sm"),m("icon",e.sideIcon),a(),T("text-danger",!e.ok),m("icon",e.actionIcon),a(),T("text-danger",!e.ok),a(),f(e.actionText)}}function Ee(t,r){if(t&1&&(n(0,"span",26)(1,"span",29),c(2),o()()),t&2){let e=p(3).$implicit;a(2),f(e.syncPathName)}}function Fe(t,r){if(t&1&&(n(0,"span"),c(1),o(),n(2,"span")(3,"b",33),c(4,"Source"),o(),c(5),o()),t&2){let e=p(4).$implicit;S(e.selected?"overflow-wrap-and-whitespace":"truncate"),a(),f(e.fileDst),a(),S(L("",e.selected?"overflow-wrap-and-whitespace":"truncate"," fs-xxxs")),a(3),B(":\xA0",e.file)}}function ke(t,r){if(t&1&&(n(0,"span"),c(1),o()),t&2){let e=p(4).$implicit;S(e.selected?"overflow-wrap-and-whitespace":"truncate"),a(),f(e.file)}}function Pe(t,r){if(t&1&&(n(0,"span"),c(1),o()),t&2){let e=p(4).$implicit;S(L("",e.selected?"overflow-wrap-and-whitespace":"truncate"," text-danger fs-xxxs")),a(),f(e.error)}}function De(t,r){if(t&1){let e=b();n(0,"div",26)(1,"img",30),d("error",function(){x(e);let s=p(3).$implicit;return v(s.fallBackMimeUrl())}),o(),n(2,"span",31),h(3,Fe,6,7)(4,ke,2,3,"span",32),h(5,Pe,2,4,"span",32),o()()}if(t&2){let e=p(3).$implicit;a(),m("src",e.mimeUrl,H),a(2),y(e.fileDst?3:4),a(2),y(e.ok?-1:5)}}function Re(t,r){if(t&1){let e=b();n(0,"div",34),d("mouseenter",function(){x(e);let s=p(3).$implicit;return v(s.hovered=!0)})("mouseleave",function(){x(e);let s=p(3).$implicit;return v(s.hovered=!1)}),n(1,"span"),c(2),o()()}if(t&2){let e=p(3).$implicit;a(2),f(e.hovered?e.timestamp:e.hTimeAgo)}}function Me(t,r){if(t&1&&(n(0,"td"),h(1,be,5,9,"span",26)(2,Ee,3,1,"span",26)(3,De,6,3,"div",26)(4,Re,3,1,"div"),o()),t&2){let e,i=p().$implicit,s=p().$implicit;S(Y("",i.value.class," ",i.value.newly?"prop-newly-"+s[i.value.newly]:"")),N("width",i.value.width,"%"),T("text-align-center",i.value.textCenter),a(),y((e=i.key)==="action"?1:e==="sync"?2:e==="file"?3:e==="date"?4:-1)}}function Ve(t,r){if(t&1&&h(0,Me,5,9,"td",25),t&2){let e=r.$implicit;y(e.value.show?0:-1)}}function Ie(t,r){if(t&1){let e=b();n(0,"tr",24),d("click",function(){let s=x(e).$implicit,l=p();return v(l.onSelect(s))}),g(1,Ve,1,1,null,null,ye),E(3,"keyvalue"),o()}if(t&2){let e=r.$implicit,i=p();T("selected",e.selected),a(),w(F(3,2,i.tableHeaders,i.originalOrderKeyValue))}}var _t=(()=>{let r=class r{constructor(){if(this.locale=u(ie),this.action=null,this.syncPathSelected=null,this.transfers=[],this.store=u(de),this.originalOrderKeyValue=ce,this.tableHeaders={action:{label:"Action",width:15,textCenter:!1,class:"",show:!0,sortable:!0},sync:{label:"Synchronization",width:15,textCenter:!1,class:"",show:!0,sortable:!0},file:{label:"File",width:55,textCenter:!1,class:"",show:!0,sortable:!0},date:{label:"Date",width:15,textCenter:!0,class:"",newly:"newly",show:!0,sortable:!0}},this.icons={faRedo:le,faTrashCan:D,faArrowDown:se,faArrowUp:ae},this.router=u(G),this.layout=u(M),this.syncService=u(V),this.sortSettings={default:[{prop:"timestamp",type:"date"}],action:[{prop:"actionText",type:"string"}],sync:[{prop:"syncPathName",type:"string"}],file:[{prop:"file",type:"string"}],date:[{prop:"timestamp",type:"date"}]},this.sortTable=new _e(this.constructor.name,this.sortSettings),this.focusOnSyncPathErrorsId=null,this.search=null,this.query=null,this.layout.setBreadcrumbIcon(me.TRANSFERS),this.layout.setBreadcrumbNav({url:`/${q.BASE}/${q.TRANSFERS}/${pe.TRANSFERS}`,splicing:2,translating:!0,sameLink:!0}),j(()=>{this.doSearch(this.inputFilter.search())}),this.checkRouteState(),this.focusOnSyncPathErrorsId){let i=this.store.clientSyncPaths().find(s=>s.id===this.focusOnSyncPathErrorsId);i?(this.syncPathSelected=i,this.onSelectAction("ERROR")):this.refresh()}else this.refresh()}doSearch(i){this.search=i,this.doQueryRefresh()}refresh(){this.onSelect(),this.syncService.getTransfers(this.syncPathSelected?.id,this.query).then(i=>{this.transfers=i.map(s=>new fe(s)),this.scrollView?.scrollInto(-1)})}onSelectPath(i){this.syncPathSelected=i,this.tableHeaders.sync.show=!this.syncPathSelected,this.refresh()}onSelectAction(i){this.action=i,this.doQueryRefresh()}onSelect(i){for(let s of this.transfers.filter(l=>l.selected))s.selected=!1;i&&(i.selected=!0)}openClearDialog(){this.layout.openDialog(ue,"md",{initialState:{syncPath:this.syncPathSelected||null}}).content.wasDeleted.pipe(K(1)).subscribe(()=>this.refresh())}sortBy(i,s=!0,l){this.transfers=this.sortTable.sortBy(i,s,l||this.transfers)}doQueryRefresh(){this.search&&this.action?this.action==="ERROR"?this.query=`(?=.*${this.search})(?=.*"ok":"false")`:this.query=`(?=.*${this.search})(?=.*"action":"${this.action}")`:this.action?this.query=this.action==="ERROR"?'"ok":false':`"action":"${this.action}"`:this.search?this.query=this.search:this.query=null,this.refresh()}checkRouteState(){let i=this.router.currentNavigation()?.extras.state;i?.id&&(this.focusOnSyncPathErrorsId=i.id)}};r.\u0275fac=function(s){return new(s||r)},r.\u0275cmp=k({type:r,selectors:[["app-sync-transfers"]],viewQuery:function(s,l){if(s&1&&($(z,5),$(Q,7)),s&2){let _;A(_=O())&&(l.scrollView=_.first),A(_=O())&&(l.inputFilter=_.first)}},decls:41,vars:20,consts:[[1,"app-top-menu"],[1,"btn-group","btn-group-sm"],[1,"form-select","form-select-sm","font-size-xs",2,"min-width","210px",3,"ngModelChange","ngModel"],["l10nTranslate","",3,"ngValue"],[3,"ngValue"],[1,"form-select","form-select-sm","font-size-xs","ms-1",2,"min-width","170px",3,"ngModelChange","ngModel"],["l10nTranslate","","value","NEW|MKFILE|MKDIR"],["l10nTranslate","","value","DIFF"],["l10nTranslate","","value","MOVE"],["l10nTranslate","","value","COPY"],["l10nTranslate","","value","RM|RMDIR"],["l10nTranslate","","value","ERROR"],[1,"d-flex","ms-auto"],["container","body","type","button",1,"btn","btn-sm","btn-secondary","me-1",3,"click","tooltip"],[3,"icon"],["placement","bottom","type","button",1,"btn","btn-sm","btn-secondary","me-1",3,"click","tooltip"],[1,"d-none","d-sm-block"],[1,"app-table"],[3,"bufferAmount","items","resizeOffset"],[1,"app-table","mb-3"],["tabindex","-1"],[3,"selected"],["l10nTranslate","",3,"width","text-align-center","cursor-pointer","class"],["l10nTranslate","",3,"click"],[3,"click"],[3,"width","text-align-center","class"],[1,"d-flex","align-items-center"],["size","sm",1,"circle-gray-icon-sm",3,"icon"],["l10nTranslate","",1,"fs-xxxs"],[1,"fs-xxs","ms-1"],["alt","","width","24",1,"me-2",3,"error","src"],[1,"d-flex","flex-column","fs-xxs"],[3,"class"],["l10nTranslate",""],[3,"mouseenter","mouseleave"]],template:function(s,l){s&1&&(n(0,"div",0)(1,"div",1)(2,"select",2),d("ngModelChange",function(I){return l.onSelectPath(I)}),n(3,"option",3),c(4,"All syncs"),o(),g(5,ve,2,2,"option",4,he),o(),n(7,"select",5),d("ngModelChange",function(I){return l.onSelectAction(I)}),n(8,"option",3),c(9,"All events"),o(),n(10,"option",6),c(11,"Added"),o(),n(12,"option",7),c(13,"Modified"),o(),n(14,"option",8),c(15,"Moved"),o(),n(16,"option",9),c(17,"Copied"),o(),n(18,"option",10),c(19,"Removed"),o(),n(20,"option",11),c(21,"Error"),o()()(),n(22,"div",12)(23,"button",13),E(24,"translate"),d("click",function(){return l.refresh()}),C(25,"fa-icon",14),o(),n(26,"button",15),E(27,"translate"),d("click",function(){return l.openClearDialog()}),C(28,"fa-icon",14),o(),C(29,"app-input-filter",16),o()(),n(30,"table",17)(31,"thead")(32,"tr"),g(33,we,1,1,null,null,ye),E(35,"keyvalue"),o()()(),n(36,"app-virtual-scroll",18)(37,"table",19)(38,"tbody",20),g(39,Ie,4,5,"tr",21,he),o()()()),s&2&&(a(2),m("ngModel",l.syncPathSelected),a(),m("ngValue",null),a(2),w(l.store.clientSyncPaths()),a(2),m("ngModel",l.action),a(),m("ngValue",null),a(15),m("tooltip",F(24,11,"Refresh",l.locale.language)),a(2),m("icon",l.icons.faRedo),a(),m("tooltip",F(27,14,"Clear events",l.locale.language)),a(2),m("icon",l.icons.faTrashCan),a(5),w(F(35,17,l.tableHeaders,l.originalOrderKeyValue)),a(3),m("bufferAmount",5)("items",l.transfers)("resizeOffset",105),a(3),w(l.scrollView==null?null:l.scrollView.viewPortItems))},dependencies:[ne,ee,te,Z,J,X,P,re,z,R,Q,oe,W],encapsulation:2});let t=r;return t})();export{_t as SyncTransfersComponent};