@sync-in/server
Version:
The secure, open-source platform for file storage, sharing, collaboration, and sync
2 lines (1 loc) • 9.45 kB
JavaScript
import{b as nt}from"./chunk-XBKCQCBI.js";import{a as it}from"./chunk-NMF2ZFBE.js";import{a as Z,f as tt,h as et}from"./chunk-XTVNHFKX.js";import{a as K,b as Q}from"./chunk-ZHOE5VEY.js";import{Cb as q,vb as z}from"./chunk-O3YLAEVE.js";import{Bb as f,Cd as B,Eb as m,Ed as G,Gb as p,Jd as U,Kd as $,Ld as j,Oa as e,Qa as v,Sb as I,Tb as l,Ub as A,Vb as w,Xb as E,Yb as C,Zb as b,ab as L,cc as x,fd as k,ja as S,jd as H,kc as F,lb as g,mb as P,mc as R,nb as Y,oa as u,od as M,pa as y,pb as D,qb as N,qg as J,rb as r,sb as i,tb as n,ub as T,ud as O,vd as V,wd as W,xf as X}from"./chunk-D55YR5X7.js";function ot(a,h){if(a&1&&(i(0,"option",13),l(1,"Select a file"),n(),i(2,"option",13),l(3,"Select a folder"),n()),a&2){let c=p();r("value",c.SYNC_PATH_FILTER_TYPE.FILE),e(2),r("value",c.SYNC_PATH_FILTER_TYPE.FOLDER)}}function st(a,h){if(a&1){let c=f();i(0,"button",24),m("click",function(){u(c);let s=p();return y(s.onSelect())}),l(1,"Browse"),n()}}function rt(a,h){if(a&1){let c=f();i(0,"button",24),m("click",function(){u(c);let s=p();return y(s.onSelect(s.ELECTRON_DIALOG.DIRECTORY))}),l(1,"Browse"),n()}}function at(a,h){if(a&1){let c=f();i(0,"div",18)(1,"input",25),b("ngModelChange",function(s){let t=u(c).$index,d=p();return C(d.syncPath.settings.filters[t],s)||(d.syncPath.settings.filters[t]=s),y(s)}),n(),i(2,"button",26),m("click",function(){let s=u(c).$index,t=p();return y(t.onRemoveFilter(s))}),T(3,"fa-icon",2),n()()}if(a&2){let c=h.$index,o=p();e(),E("ngModel",o.syncPath.settings.filters[c]),e(2),r("icon",o.icons.faTimes)}}function lt(a,h){if(a&1){let c=f();i(0,"button",27),m("click",function(){u(c);let s=p();return y(s.onFlush())}),l(1,"Reset"),n()}}var vt=(()=>{let h=class h{constructor(){this.mustRefresh=new v,this.locale=S(G),this.layout=S(q),this.store=S(z),this.ELECTRON_DIALOG=it,this.SYNC_PATH_FILTER_TYPE=Z,this.currentFilterType=this.store.isElectronApp()?this.SYNC_PATH_FILTER_TYPE.FILE:this.SYNC_PATH_FILTER_TYPE.START,this.filterTypePlaceholder={[this.SYNC_PATH_FILTER_TYPE.FILE]:"click on the browse button",[this.SYNC_PATH_FILTER_TYPE.FOLDER]:"click on the browse button",[this.SYNC_PATH_FILTER_TYPE.START]:"with a name or pattern",[this.SYNC_PATH_FILTER_TYPE.IN]:"with a name or pattern",[this.SYNC_PATH_FILTER_TYPE.END]:"with the extension ('.mp3', '.avi', '.mov' ...)",[this.SYNC_PATH_FILTER_TYPE.EXPERT]:"[-+]?[0-9]*\\.?[0-9]*"},this.icons={faTimes:X,faRotate:j},this.confirmDeletion=!1,this.syncService=S(et)}ngOnInit(){this.syncPath=new tt(JSON.parse(JSON.stringify(this.syncPathSelected)))}onSubmit(){if(this.confirmDeletion){this.onRemove();return}this.store.isElectronApp()?this.syncService.updatePath(this.syncPath.export(!0)).then(()=>{this.syncService.refreshPaths().catch(console.error),this.layout.closeDialog()}):this.syncService.updateSyncPath(this.syncClientSelected.id,this.syncPath.id,this.syncPath.export()).subscribe({next:()=>{this.mustRefresh.emit(),this.layout.closeDialog()},error:o=>this.layout.sendNotification("error","Unable to update",this.syncPath.settings.name,o)})}onRemove(){this.store.isElectronApp()?this.syncService.removePath(this.syncPath.id).then(()=>{this.syncService.refreshPaths().catch(console.error),this.layout.closeDialog(),this.layout.sendNotification("success","Sync deleted",this.syncPath.settings.name)}).catch(o=>this.layout.sendNotification("error","Unable to delete",this.syncPath.settings.name,o)):this.syncService.deleteSyncPath(this.syncClientSelected.id,this.syncPath.id).subscribe({next:()=>{this.mustRefresh.emit(),this.layout.closeDialog(),this.layout.sendNotification("success","Sync deleted",this.syncPath.settings.name)},error:o=>this.layout.sendNotification("error","Unable to delete",this.syncPath.settings.name,o)})}onFlush(){this.syncService.flushPath(this.syncPath.id).then(()=>{this.layout.sendNotification("success","Sync was reset",this.syncPath.settings.name),this.layout.closeDialog()}).catch(o=>this.layout.sendNotification("error","Unable to reset",this.syncPath.settings.name,o))}onRemoveFilter(o){this.syncPath.settings.filters.splice(o,1)}onSelect(o=this.ELECTRON_DIALOG.FILE){this.syncService.showOpenDialog({properties:[o],defaultPath:this.syncPath.settings.localPath}).then(s=>{s.canceled||s.filePaths[0].startsWith(this.syncPath.settings.localPath)&&(this.currentFilter=s.filePaths[0].replace(this.syncPath.settings.localPath,"").substring(1))})}addFilter(){this.currentFilterType===this.SYNC_PATH_FILTER_TYPE.FILE||this.currentFilterType===this.SYNC_PATH_FILTER_TYPE.FOLDER||this.currentFilterType===this.SYNC_PATH_FILTER_TYPE.EXPERT?this.syncPath.settings.filters.unshift(this.currentFilter):this.currentFilterType===this.SYNC_PATH_FILTER_TYPE.START?this.syncPath.settings.filters.unshift(`^${this.currentFilter}.*`):this.currentFilterType===this.SYNC_PATH_FILTER_TYPE.IN?this.syncPath.settings.filters.unshift(`.*${this.currentFilter}.*`):this.currentFilterType===this.SYNC_PATH_FILTER_TYPE.END&&this.syncPath.settings.filters.unshift(`.*${this.currentFilter}$`),this.currentFilter=null}onCancel(){this.confirmDeletion?this.confirmDeletion=!1:this.layout.closeDialog()}};h.\u0275fac=function(s){return new(s||h)},h.\u0275cmp=L({type:h,selectors:[["app-sync-path-settings-dialog"]],inputs:{syncPathSelected:"syncPathSelected",syncClientSelected:"syncClientSelected"},outputs:{mustRefresh:"mustRefresh"},decls:43,vars:35,consts:[[1,"modal-header"],[1,"modal-title"],[3,"icon"],[1,"ms-2"],["aria-label","Close","type","button",1,"btn-close","btn-close-white",3,"click"],[1,"modal-body"],["type","pills",3,"justified"],[2,"margin-top","8px","margin-bottom","6px"],["customClass","tab-dialog",3,"heading"],["direction","start","size","large",3,"showPaths","syncPath"],[1,"d-flex","align-items-center","mb-2"],[1,"d-flex","flex-row","col-12","px-0"],[1,"form-select","form-select-sm","me-1",3,"ngModelChange","ngModel"],["l10nTranslate","",3,"value"],["type","text",1,"form-control","form-select-sm","me-1",3,"ngModelChange","ngModel","disabled","placeholder"],["l10nTranslate","","type","button",1,"btn","btn-xs","btn-secondary","me-1",3,"click","disabled"],["l10nTranslate","","type","button",1,"btn","btn-xs","btn-secondary"],[1,"my-1"],[1,"d-flex","mb-1"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-danger","me-2",3,"click","disabled"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-warning"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","submit","l10nTranslate","",3,"click","disabled"],["l10nTranslate","","type","button",1,"btn","btn-xs","btn-secondary",3,"click"],["type","text",1,"form-control","form-control-sm","me-1",3,"ngModelChange","ngModel"],["data-dismiss","modal","type","button",1,"btn","btn-xs","btn-danger",3,"click"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-warning",3,"click"]],template:function(s,t){s&1&&(i(0,"div",0)(1,"h4",1),T(2,"fa-icon",2),i(3,"span",3),l(4),n()(),i(5,"button",4),m("click",function(){return t.layout.closeDialog()}),n()(),i(6,"div",5)(7,"tabset",6),T(8,"hr",7),i(9,"tab",8),F(10,"translate"),T(11,"app-sync-path-settings",9),n(),i(12,"tab",8),F(13,"translate"),i(14,"div",10)(15,"div",11)(16,"select",12),b("ngModelChange",function(_){return C(t.currentFilterType,_)||(t.currentFilterType=_),_}),g(17,ot,4,2),i(18,"option",13),l(19,"The files starting"),n(),i(20,"option",13),l(21,"The files containing"),n(),i(22,"option",13),l(23,"The files ending"),n(),i(24,"option",13),l(25,"Expert (Regexp)"),n()(),i(26,"input",14),F(27,"translate"),b("ngModelChange",function(_){return C(t.currentFilter,_)||(t.currentFilter=_),_}),n(),i(28,"button",15),m("click",function(){return t.addFilter()}),l(29,"Add"),n(),g(30,st,2,0,"button",16),g(31,rt,2,0,"button",16),n()(),T(32,"hr",17),D(33,at,4,2,"div",18,Y),n()()(),i(35,"div",19)(36,"button",20),m("click",function(){return t.confirmDeletion=!0}),l(37," Remove "),n(),g(38,lt,2,0,"button",21),i(39,"button",22),m("click",function(){return t.onCancel()}),l(40,"Cancel"),n(),i(41,"button",23),m("click",function(){return t.onSubmit()}),l(42),n()()),s&2&&(e(2),r("icon",t.icons.faRotate),e(2),A(t.syncPath.settings.name),e(3),r("justified",!0),e(2),r("heading",R(10,26,"Settings",t.locale.language)),e(2),r("showPaths",!0)("syncPath",t.syncPath),e(),r("heading",R(13,29,"Filters",t.locale.language)),e(4),E("ngModel",t.currentFilterType),e(),P(t.store.isElectronApp()?17:-1),e(),r("value",t.SYNC_PATH_FILTER_TYPE.START),e(2),r("value",t.SYNC_PATH_FILTER_TYPE.IN),e(2),r("value",t.SYNC_PATH_FILTER_TYPE.END),e(2),r("value",t.SYNC_PATH_FILTER_TYPE.EXPERT),e(2),E("ngModel",t.currentFilter),r("disabled",t.currentFilterType===t.SYNC_PATH_FILTER_TYPE.FILE||t.currentFilterType===t.SYNC_PATH_FILTER_TYPE.FOLDER)("placeholder",R(27,32,t.filterTypePlaceholder[t.currentFilterType],t.locale.language)),e(2),r("disabled",!t.currentFilter),e(2),P(t.currentFilterType===t.SYNC_PATH_FILTER_TYPE.FILE?30:-1),e(),P(t.currentFilterType===t.SYNC_PATH_FILTER_TYPE.FOLDER?31:-1),e(2),N(t.syncPath.settings.filters),e(3),r("disabled",t.confirmDeletion),e(2),P(t.store.isElectronApp()?38:-1),e(3),I(x("btn btn-sm ",t.confirmDeletion?"btn-danger":"btn-primary")),r("disabled",!t.syncPath.settings.name),e(),w(" ",t.confirmDeletion?"Confirm deletion":"Confirm"," "))},dependencies:[K,Q,nt,B,V,W,k,O,H,M,J,$,U],encapsulation:2});let a=h;return a})();export{vt as a};