Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

style(frontend): optimize imports and rearrange code

johaven556c8c37c0d8
diff --git a/frontend/src/app/applications/admin/components/admin-groups.component.ts b/frontend/src/app/applications/admin/components/admin-groups.component.ts
index cc60bcb7..00248967 100644
--- a/frontend/src/app/applications/admin/components/admin-groups.component.ts
+++ b/frontend/src/app/applications/admin/components/admin-groups.component.ts
@@ -78,11 +78,6 @@ import { AdminGroupEditUserDialogComponent } from './dialogs/admin-group-edit-us
templateUrl: 'admin-groups.component.html'
})
export class AdminGroupsComponent {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly router = inject(Router)
- private readonly activatedRoute = inject(ActivatedRoute)
- private readonly layout = inject(LayoutService)
- private readonly adminService = inject(AdminService)
@ViewChild(VirtualScrollComponent) scrollView: {
element: ElementRef
viewPortItems: MemberModel[]
@@ -91,6 +86,7 @@ export class AdminGroupsComponent {
@ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('TargetContextMenu', { static: true }) targetContextMenu: ContextMenuComponent<any>
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected readonly icons = {
GROUPS: USER_ICON.GROUPS,
@@ -142,6 +138,15 @@ export class AdminGroupsComponent {
sortable: true
}
}
+ protected personalGroupsView = false
+ protected loading = false
+ protected currentGroup: GroupBrowseModel['parentGroup']
+ protected selected: MemberModel = null
+ protected members: MemberModel[] = []
+ private readonly router = inject(Router)
+ private readonly activatedRoute = inject(ActivatedRoute)
+ private readonly layout = inject(LayoutService)
+ private readonly adminService = inject(AdminService)
private readonly sortSettings: SortSettings = {
default: [{ prop: 'name', type: 'string' }],
name: [{ prop: 'name', type: 'string' }],
@@ -154,11 +159,6 @@ export class AdminGroupsComponent {
protected sortTable = new SortTable(this.constructor.name, this.sortSettings)
// States
private focusOnSelect: string
- protected personalGroupsView = false
- protected loading = false
- protected currentGroup: GroupBrowseModel['parentGroup']
- protected selected: MemberModel = null
- protected members: MemberModel[] = []
constructor() {
this.activatedRoute.data.subscribe((route: Data) => {
@@ -169,38 +169,6 @@ export class AdminGroupsComponent {
this.layout.setBreadcrumbIcon(ADMIN_ICON.GROUPS)
}
- private setEnv(routes: UrlSegment[]) {
- let currentGroupName: string
- if (!routes.length) {
- this.layout.setBreadcrumbNav({
- url: this.personalGroupsView
- ? `/${ADMIN_PATH.BASE}/${ADMIN_PATH.PGROUPS}/${ADMIN_TITLE.PGROUPS}`
- : `/${ADMIN_PATH.BASE}/${ADMIN_PATH.GROUPS}/${ADMIN_TITLE.GROUPS}`,
- splicing: 2,
- translating: true,
- sameLink: true
- })
- } else {
- currentGroupName = routes[routes.length - 1].path
- this.layout.setBreadcrumbNav({
- url: this.personalGroupsView
- ? `/${ADMIN_PATH.BASE}/${ADMIN_PATH.PGROUPS}${pathFromRoutes(routes)}`
- : `/${ADMIN_PATH.BASE}/${ADMIN_PATH.GROUPS}${pathFromRoutes(routes)}`,
- firstLink: `/${ADMIN_PATH.BASE}/${ADMIN_PATH.GROUPS}`,
- splicing: 1,
- translating: true,
- sameLink: false,
- mutateLevel: {
- 0: {
- setTitle: this.personalGroupsView ? ADMIN_TITLE.PGROUPS : ADMIN_TITLE.GROUPS,
- translateTitle: true
- }
- }
- })
- }
- this.loadGroups(currentGroupName)
- }
-
onPersonalGroupsView(state: boolean) {
this.personalGroupsView = state
this.router.navigate([ADMIN_PATH.BASE, state ? ADMIN_PATH.PGROUPS : ADMIN_PATH.GROUPS]).catch(console.error)
@@ -210,29 +178,6 @@ export class AdminGroupsComponent {
this.loadGroups(this.currentGroup?.name)
}
- private loadGroups(currentGroupName?: string) {
- this.loading = true
- this.onSelect()
- this.adminService.browseGroup(currentGroupName, this.personalGroupsView).subscribe({
- next: (browse: GroupBrowseModel) => {
- this.currentGroup = browse.parentGroup
- this.sortBy(this.sortTable.sortParam.column, false, browse.members)
- if (this.focusOnSelect) {
- this.focusOn(this.focusOnSelect)
- } else {
- this.scrollView.scrollInto(-1)
- }
- this.loading = false
- },
- error: (e: HttpErrorResponse) => {
- this.members = []
- this.layout.sendNotification('error', 'Groups', e.error.message)
- this.onSelect()
- this.loading = false
- }
- })
- }
-
browse(m: MemberModel) {
if (m.isGroup) {
this.router.navigate([m.name], { relativeTo: this.activatedRoute }).catch(console.error)
@@ -379,6 +324,61 @@ export class AdminGroupsComponent {
}
}
+ private setEnv(routes: UrlSegment[]) {
+ let currentGroupName: string
+ if (!routes.length) {
+ this.layout.setBreadcrumbNav({
+ url: this.personalGroupsView
+ ? `/${ADMIN_PATH.BASE}/${ADMIN_PATH.PGROUPS}/${ADMIN_TITLE.PGROUPS}`
+ : `/${ADMIN_PATH.BASE}/${ADMIN_PATH.GROUPS}/${ADMIN_TITLE.GROUPS}`,
+ splicing: 2,
+ translating: true,
+ sameLink: true
+ })
+ } else {
+ currentGroupName = routes[routes.length - 1].path
+ this.layout.setBreadcrumbNav({
+ url: this.personalGroupsView
+ ? `/${ADMIN_PATH.BASE}/${ADMIN_PATH.PGROUPS}${pathFromRoutes(routes)}`
+ : `/${ADMIN_PATH.BASE}/${ADMIN_PATH.GROUPS}${pathFromRoutes(routes)}`,
+ firstLink: `/${ADMIN_PATH.BASE}/${ADMIN_PATH.GROUPS}`,
+ splicing: 1,
+ translating: true,
+ sameLink: false,
+ mutateLevel: {
+ 0: {
+ setTitle: this.personalGroupsView ? ADMIN_TITLE.PGROUPS : ADMIN_TITLE.GROUPS,
+ translateTitle: true
+ }
+ }
+ })
+ }
+ this.loadGroups(currentGroupName)
+ }
+
+ private loadGroups(currentGroupName?: string) {
+ this.loading = true
+ this.onSelect()
+ this.adminService.browseGroup(currentGroupName, this.personalGroupsView).subscribe({
+ next: (browse: GroupBrowseModel) => {
+ this.currentGroup = browse.parentGroup
+ this.sortBy(this.sortTable.sortParam.column, false, browse.members)
+ if (this.focusOnSelect) {
+ this.focusOn(this.focusOnSelect)
+ } else {
+ this.scrollView.scrollInto(-1)
+ }
+ this.loading = false
+ },
+ error: (e: HttpErrorResponse) => {
+ this.members = []
+ this.layout.sendNotification('error', 'Groups', e.error.message)
+ this.onSelect()
+ this.loading = false
+ }
+ })
+ }
+
private focusOn(select: string) {
const s = this.members.find((m) => m.name === select)
if (s) {
diff --git a/frontend/src/app/applications/admin/components/admin-users.component.ts b/frontend/src/app/applications/admin/components/admin-users.component.ts
index ba786e34..2b4b01d8 100644
--- a/frontend/src/app/applications/admin/components/admin-users.component.ts
+++ b/frontend/src/app/applications/admin/components/admin-users.component.ts
@@ -68,11 +68,6 @@ import { AdminUserDialogComponent } from './dialogs/admin-user-dialog.component'
templateUrl: 'admin-users.component.html'
})
export class AdminUsersComponent {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly router = inject(Router)
- private readonly activatedRoute = inject(ActivatedRoute)
- private readonly layout = inject(LayoutService)
- private readonly adminService = inject(AdminService)
@ViewChild(VirtualScrollComponent) scrollView: {
element: ElementRef
viewPortItems: AdminUserModel[]
@@ -81,6 +76,7 @@ export class AdminUsersComponent {
@ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('TargetContextMenu', { static: true }) targetContextMenu: ContextMenuComponent<any>
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected readonly icons = {
faRotate,
@@ -153,6 +149,15 @@ export class AdminUsersComponent {
sortable: true
}
}
+ // States
+ protected guestsView = false
+ protected loading = false
+ protected selected: AdminUserModel = null
+ protected users: AdminUserModel[] = []
+ private readonly router = inject(Router)
+ private readonly activatedRoute = inject(ActivatedRoute)
+ private readonly layout = inject(LayoutService)
+ private readonly adminService = inject(AdminService)
private readonly sortSettings: SortSettings = {
default: [{ prop: 'login', type: 'string' }],
login: [{ prop: 'login', type: 'string' }],
@@ -163,11 +168,6 @@ export class AdminUsersComponent {
isActive: [{ prop: 'isActive', type: 'number' }]
}
protected sortTable = new SortTable(this.constructor.name, this.sortSettings)
- // States
- protected guestsView = false
- protected loading = false
- protected selected: AdminUserModel = null
- protected users: AdminUserModel[] = []
constructor() {
this.layout.setBreadcrumbIcon(ADMIN_ICON.USERS)
@@ -177,20 +177,6 @@ export class AdminUsersComponent {
})
}
- private setEnv() {
- this.tableHeaders.managers.show = this.guestsView
- this.tableHeaders.storage.show = !this.guestsView
- this.loadUsersOrGuests()
- this.layout.setBreadcrumbNav({
- url: this.guestsView
- ? `/${ADMIN_PATH.BASE}/${ADMIN_PATH.GUESTS}/${ADMIN_TITLE.GUESTS}`
- : `/${ADMIN_PATH.BASE}/${ADMIN_PATH.USERS}/${ADMIN_TITLE.USERS}`,
- splicing: 2,
- translating: true,
- sameLink: true
- })
- }
-
loadUsersOrGuests() {
this.loading = true
this.onSelect()
@@ -322,4 +308,18 @@ export class AdminUsersComponent {
initialState: { user: this.selected } as AdminImpersonateUserDialogComponent
})
}
+
+ private setEnv() {
+ this.tableHeaders.managers.show = this.guestsView
+ this.tableHeaders.storage.show = !this.guestsView
+ this.loadUsersOrGuests()
+ this.layout.setBreadcrumbNav({
+ url: this.guestsView
+ ? `/${ADMIN_PATH.BASE}/${ADMIN_PATH.GUESTS}/${ADMIN_TITLE.GUESTS}`
+ : `/${ADMIN_PATH.BASE}/${ADMIN_PATH.USERS}/${ADMIN_TITLE.USERS}`,
+ splicing: 2,
+ translating: true,
+ sameLink: true
+ })
+ }
}
diff --git a/frontend/src/app/applications/admin/components/dialogs/admin-group-add-users-dialog.component.ts b/frontend/src/app/applications/admin/components/dialogs/admin-group-add-users-dialog.component.ts
index cbb01fdf..53955e02 100644
--- a/frontend/src/app/applications/admin/components/dialogs/admin-group-add-users-dialog.component.ts
+++ b/frontend/src/app/applications/admin/components/dialogs/admin-group-add-users-dialog.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, EventEmitter, Input, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, Output } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faUserPlus } from '@fortawesome/free-solid-svg-icons'
import { GROUP_TYPE } from '@sync-in-server/backend/src/applications/users/constants/group'
@@ -25,14 +25,14 @@ import { AdminService } from '../../admin.service'
templateUrl: 'admin-group-add-users-dialog.component.html'
})
export class AdminGroupAddUsersDialogComponent {
- protected readonly layout = inject(LayoutService)
- private readonly adminService = inject(AdminService)
@Input({ required: true }) parentGroup: GroupBrowseModel['parentGroup']
@Input({ required: true }) currentMemberIds: number[] = []
@Output() hasChanges = new EventEmitter<boolean>()
+ protected readonly layout = inject(LayoutService)
protected newMembers: MemberModel[] = []
protected submitted = false
protected readonly icons = { faUserPlus }
+ private readonly adminService = inject(AdminService)
searchMembers(query: string): Observable<MemberModel[]> {
const search: SearchMembersDto = {
diff --git a/frontend/src/app/applications/admin/components/dialogs/admin-group-delete-dialog.component.ts b/frontend/src/app/applications/admin/components/dialogs/admin-group-delete-dialog.component.ts
index c71335cb..7f3ccfc4 100644
--- a/frontend/src/app/applications/admin/components/dialogs/admin-group-delete-dialog.component.ts
+++ b/frontend/src/app/applications/admin/components/dialogs/admin-group-delete-dialog.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, EventEmitter, Input, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, Output } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faMinus, faUserMinus } from '@fortawesome/free-solid-svg-icons'
import { L10nTranslateDirective } from 'angular-l10n'
@@ -22,13 +22,13 @@ import { AdminService } from '../../admin.service'
templateUrl: 'admin-group-delete-dialog.component.html'
})
export class AdminGroupDeleteDialogComponent {
- private readonly layout = inject(LayoutService)
- private readonly adminService = inject(AdminService)
@Input({ required: true }) parentGroup: GroupBrowseModel['parentGroup']
@Input({ required: true }) member: MemberModel
@Output() wasDeleted = new EventEmitter<boolean>()
protected submitted = false
protected readonly icons = { GROUPS: USER_ICON.GROUPS, faMinus, faUserMinus }
+ private readonly layout = inject(LayoutService)
+ private readonly adminService = inject(AdminService)
onSubmit() {
this.submitted = true
diff --git a/frontend/src/app/applications/admin/components/dialogs/admin-group-dialog.component.ts b/frontend/src/app/applications/admin/components/dialogs/admin-group-dialog.component.ts
index aa16c8db..23e75f0e 100644
--- a/frontend/src/app/applications/admin/components/dialogs/admin-group-dialog.component.ts
+++ b/frontend/src/app/applications/admin/components/dialogs/admin-group-dialog.component.ts
@@ -6,7 +6,7 @@
import { KeyValuePipe } from '@angular/common'
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, EventEmitter, Input, OnInit, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, OnInit, Output } from '@angular/core'
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faCog, faPen, faPlus, faShieldHalved } from '@fortawesome/free-solid-svg-icons'
@@ -46,12 +46,11 @@ import { AdminPermissionsComponent } from '../utils/admin-permissions.component'
templateUrl: 'admin-group-dialog.component.html'
})
export class AdminGroupDialogComponent implements OnInit {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- protected readonly layout = inject(LayoutService)
- private readonly adminService = inject(AdminService)
@Input() group: AdminGroupModel = null
@Input() parentGroup: Pick<AdminGroupModel, 'id' | 'name' | 'type'> = null
@Output() groupChange = new EventEmitter<['add' | 'update', AdminGroupModel]>()
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected readonly layout = inject(LayoutService)
protected readonly icons = { GROUPS: USER_ICON.GROUPS, faPen, faPlus, faCog, faShieldHalved }
protected tabView: undefined | 'permissions'
protected submitted = false
@@ -68,6 +67,7 @@ export class AdminGroupDialogComponent implements OnInit {
applications: FormControl<USER_PERMISSION[]>
parent: FormControl<AdminGroupModel['parent']>
}>
+ private readonly adminService = inject(AdminService)
ngOnInit() {
this.groupForm = new FormGroup({
diff --git a/frontend/src/app/applications/admin/components/dialogs/admin-group-edit-user-dialog.component.ts b/frontend/src/app/applications/admin/components/dialogs/admin-group-edit-user-dialog.component.ts
index 0a80e804..02abe957 100644
--- a/frontend/src/app/applications/admin/components/dialogs/admin-group-edit-user-dialog.component.ts
+++ b/frontend/src/app/applications/admin/components/dialogs/admin-group-edit-user-dialog.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, Input, OnInit, inject } from '@angular/core'
+import { Component, inject, Input, OnInit } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faKey, faUserPen } from '@fortawesome/free-solid-svg-icons'
@@ -22,14 +22,14 @@ import { AdminGroupModel } from '../../models/admin-group.model'
templateUrl: 'admin-group-edit-user-dialog.component.html'
})
export class AdminGroupEditUserDialogComponent implements OnInit {
- protected readonly layout = inject(LayoutService)
- private readonly adminService = inject(AdminService)
@Input({ required: true }) parentGroup: Pick<AdminGroupModel, 'id' | 'name' | 'type' | 'description'>
@Input({ required: true }) user: MemberModel
+ protected readonly layout = inject(LayoutService)
protected submitted = false
protected isManager = false
protected readonly USER_GROUP_ROLE = USER_GROUP_ROLE
protected readonly icons = { faUserPen, faKey }
+ private readonly adminService = inject(AdminService)
ngOnInit() {
this.isManager = this.user.isGroupManager
diff --git a/frontend/src/app/applications/admin/components/dialogs/admin-impersonate-user-dialog.component.ts b/frontend/src/app/applications/admin/components/dialogs/admin-impersonate-user-dialog.component.ts
index b886a03d..0799ea76 100644
--- a/frontend/src/app/applications/admin/components/dialogs/admin-impersonate-user-dialog.component.ts
+++ b/frontend/src/app/applications/admin/components/dialogs/admin-impersonate-user-dialog.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, Input, inject } from '@angular/core'
+import { Component, inject, Input } from '@angular/core'
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faUserSecret } from '@fortawesome/free-solid-svg-icons'
@@ -25,16 +25,16 @@ import { AdminUserModel } from '../../models/admin-user.model'
templateUrl: 'admin-impersonate-user-dialog.component.html'
})
export class AdminImpersonateUserDialogComponent {
+ @Input({ required: true }) user: AdminUserModel
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly layout = inject(LayoutService)
- private readonly adminService = inject(AdminService)
- @Input({ required: true }) user: AdminUserModel
protected submitted = false
protected readonly icons = { faUserSecret }
protected readonly passwordMinLength = USER_PASSWORD_MIN_LENGTH
protected impersonateUserForm = new FormGroup<{
password: FormControl<string>
}>({ password: new FormControl('', Validators.required) })
+ private readonly adminService = inject(AdminService)
onSubmit() {
this.submitted = true
diff --git a/frontend/src/app/applications/admin/components/dialogs/admin-user-delete-dialog.component.ts b/frontend/src/app/applications/admin/components/dialogs/admin-user-delete-dialog.component.ts
index 7b790480..7f0bf9ee 100644
--- a/frontend/src/app/applications/admin/components/dialogs/admin-user-delete-dialog.component.ts
+++ b/frontend/src/app/applications/admin/components/dialogs/admin-user-delete-dialog.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, EventEmitter, Input, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, Output } from '@angular/core'
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faUserMinus } from '@fortawesome/free-solid-svg-icons'
@@ -23,17 +23,17 @@ import { AdminUserModel } from '../../models/admin-user.model'
templateUrl: 'admin-user-delete-dialog.component.html'
})
export class AdminUserDeleteDialogComponent {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly layout = inject(LayoutService)
- private readonly adminService = inject(AdminService)
@Input({ required: true }) user: AdminUserModel
@Output() wasDeleted = new EventEmitter<boolean>()
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected submitted = false
protected readonly icons = { faUserMinus }
protected deleteUserForm = new FormGroup<{
adminPassword: FormControl<string>
deleteSpace: FormControl<boolean>
}>({ adminPassword: new FormControl('', Validators.required), deleteSpace: new FormControl(false) })
+ private readonly layout = inject(LayoutService)
+ private readonly adminService = inject(AdminService)
onClose() {
this.wasDeleted.emit(false)
diff --git a/frontend/src/app/applications/admin/components/dialogs/admin-user-dialog.component.ts b/frontend/src/app/applications/admin/components/dialogs/admin-user-dialog.component.ts
index 92adda5c..94103372 100644
--- a/frontend/src/app/applications/admin/components/dialogs/admin-user-dialog.component.ts
+++ b/frontend/src/app/applications/admin/components/dialogs/admin-user-dialog.component.ts
@@ -6,7 +6,7 @@
import { TitleCasePipe } from '@angular/common'
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, EventEmitter, Input, OnInit, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, OnInit, Output } from '@angular/core'
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faAddressCard, faShieldHalved, faSpinner, faUserPen, faUserPlus, faUsers } from '@fortawesome/free-solid-svg-icons'
@@ -66,11 +66,10 @@ import { AdminUserDeleteDialogComponent } from './admin-user-delete-dialog.compo
templateUrl: 'admin-user-dialog.component.html'
})
export class AdminUserDialogComponent implements OnInit {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- protected readonly layout = inject(LayoutService)
- private readonly adminService = inject(AdminService)
@Input() user: AdminUserModel = null
@Output() userChange = new EventEmitter<['add' | 'update' | 'delete', AdminUserModel]>()
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected readonly layout = inject(LayoutService)
protected submitted = false
protected loading = false
protected confirmDeletion = false
@@ -93,6 +92,7 @@ export class AdminUserDialogComponent implements OnInit {
groups: FormControl<MemberModel[]>
applications: FormControl<USER_PERMISSION[]>
}>
+ private readonly adminService = inject(AdminService)
ngOnInit() {
this.userForm = new FormGroup({
diff --git a/frontend/src/app/applications/admin/components/utils/admin-permissions.component.ts b/frontend/src/app/applications/admin/components/utils/admin-permissions.component.ts
index cafe48df..ed795160 100644
--- a/frontend/src/app/applications/admin/components/utils/admin-permissions.component.ts
+++ b/frontend/src/app/applications/admin/components/utils/admin-permissions.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, EventEmitter, Input, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, Output } from '@angular/core'
import { USER_PERMISSION } from '@sync-in-server/backend/src/applications/users/constants/user'
import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } from 'angular-l10n'
import { CapitalizePipe } from '../../../../common/pipes/capitalize.pipe'
@@ -33,9 +33,9 @@ import { CapitalizePipe } from '../../../../common/pipes/capitalize.pipe'
</div>`
})
export class AdminPermissionsComponent {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
@Input() permissions: USER_PERMISSION[] = []
@Output() permissionsChange = new EventEmitter<USER_PERMISSION[]>()
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly allApplications = Object.values(USER_PERMISSION)
updatePermissions(app: USER_PERMISSION, event: any) {
diff --git a/frontend/src/app/applications/comments/components/sidebar/comments-selection.component.ts b/frontend/src/app/applications/comments/components/sidebar/comments-selection.component.ts
index 7a5bb777..21c6226c 100644
--- a/frontend/src/app/applications/comments/components/sidebar/comments-selection.component.ts
+++ b/frontend/src/app/applications/comments/components/sidebar/comments-selection.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, computed, ElementRef, OnDestroy, Signal, ViewChild, inject } from '@angular/core'
+import { Component, computed, ElementRef, inject, OnDestroy, Signal, ViewChild } from '@angular/core'
import { toObservable } from '@angular/core/rxjs-interop'
import { FormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
@@ -39,15 +39,15 @@ import { CommentsService } from '../../services/comments.service'
templateUrl: 'comments-selection.component.html'
})
export class CommentsSelectionComponent implements OnDestroy {
+ @ViewChild('CommentCreate', { static: true }) commentInput: ElementRef<HTMLInputElement>
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected comments: CommentModel[] = []
+ protected readonly icons = { faEdit }
private readonly store = inject(StoreService)
+ protected file: Signal<FileModel> = computed(() => (this.store.filesSelection().length ? this.store.filesSelection()[0] : null))
private readonly layout = inject(LayoutService)
private readonly commentsService = inject(CommentsService)
- @ViewChild('CommentCreate', { static: true }) commentInput: ElementRef<HTMLInputElement>
private subscriptions: Subscription[] = []
- protected file: Signal<FileModel> = computed(() => (this.store.filesSelection().length ? this.store.filesSelection()[0] : null))
- protected comments: CommentModel[] = []
- protected readonly icons = { faEdit }
constructor() {
this.subscriptions.push(toObservable(this.file).subscribe((file: FileModel) => this.loadComments(file)))
diff --git a/frontend/src/app/applications/comments/components/widgets/comments-recents-widget.component.ts b/frontend/src/app/applications/comments/components/widgets/comments-recents-widget.component.ts
index 7decf466..66510009 100644
--- a/frontend/src/app/applications/comments/components/widgets/comments-recents-widget.component.ts
+++ b/frontend/src/app/applications/comments/components/widgets/comments-recents-widget.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, computed, Signal, inject } from '@angular/core'
+import { Component, computed, inject, Signal } from '@angular/core'
import { Router } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faCommentDots } from '@fortawesome/free-regular-svg-icons'
@@ -25,24 +25,20 @@ import { CommentsService } from '../../services/comments.service'
templateUrl: './comments-recents-widget.component.html'
})
export class CommentsRecentsWidgetComponent {
+ protected moreElements = false
+ protected readonly icons = { faCommentDots, faMagnifyingGlassPlus, faMagnifyingGlassMinus, faTrashAlt }
private readonly router = inject(Router)
private readonly layout = inject(LayoutService)
private readonly store = inject(StoreService)
private readonly commentsService = inject(CommentsService)
private nbInitialComments = 10
private nbComments = this.nbInitialComments
- protected moreElements = false
protected comments: Signal<CommentRecentModel[]> = computed(() => this.store.commentsRecents().slice(0, this.nbComments))
- protected readonly icons = { faCommentDots, faMagnifyingGlassPlus, faMagnifyingGlassMinus, faTrashAlt }
constructor() {
this.load()
}
- private load() {
- this.commentsService.loadRecents(this.nbComments)
- }
-
switchMore() {
if (this.moreElements) {
this.moreElements = false
@@ -59,4 +55,8 @@ export class CommentsRecentsWidgetComponent {
.navigate([SPACES_PATH.SPACES, ...c.file.path.split('/')], { queryParams: { select: c.file.name } })
.then(() => this.layout.showRSideBarTab(TAB_MENU.COMMENTS, true))
}
+
+ private load() {
+ this.commentsService.loadRecents(this.nbComments)
+ }
}
diff --git a/frontend/src/app/applications/comments/services/comments.service.ts b/frontend/src/app/applications/comments/services/comments.service.ts
index 109ad72b..7b3bf8b1 100644
--- a/frontend/src/app/applications/comments/services/comments.service.ts
+++ b/frontend/src/app/applications/comments/services/comments.service.ts
@@ -5,7 +5,7 @@
*/
import { HttpClient, HttpErrorResponse, HttpParams } from '@angular/common/http'
-import { Injectable, inject } from '@angular/core'
+import { inject, Injectable } from '@angular/core'
import { API_COMMENTS_FROM_SPACE, API_COMMENTS_RECENTS } from '@sync-in-server/backend/src/applications/comments/constants/routes'
import type { CreateOrUpdateCommentDto, DeleteCommentDto } from '@sync-in-server/backend/src/applications/comments/dto/comment.dto'
import type { CommentRecent } from '@sync-in-server/backend/src/applications/comments/interfaces/comment-recent.interface'
diff --git a/frontend/src/app/applications/files/components/dialogs/files-compression-dialog.component.ts b/frontend/src/app/applications/files/components/dialogs/files-compression-dialog.component.ts
index 02ac8c25..84af29c6 100644
--- a/frontend/src/app/applications/files/components/dialogs/files-compression-dialog.component.ts
+++ b/frontend/src/app/applications/files/components/dialogs/files-compression-dialog.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { ChangeDetectionStrategy, Component, EventEmitter, HostListener, Input, OnInit, Output, inject } from '@angular/core'
+import { ChangeDetectionStrategy, Component, EventEmitter, HostListener, inject, Input, OnInit, Output } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faFileArchive } from '@fortawesome/free-solid-svg-icons'
@@ -22,15 +22,15 @@ import { FilesService } from '../../services/files.service'
changeDetection: ChangeDetectionStrategy.OnPush
})
export class FilesCompressionDialogComponent implements OnInit {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- protected readonly layout = inject(LayoutService)
- private readonly filesService = inject(FilesService)
@Input() archiveProps: CompressFileDto = { name: '', files: [], compressInDirectory: true, extension: tarExtension }
@Output() submitEvent = new EventEmitter()
public disableInDirCompression = false
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected readonly layout = inject(LayoutService)
protected compression = false
protected readonly icons = { faFileArchive }
protected submitted = false
+ private readonly filesService = inject(FilesService)
ngOnInit() {
if (this.disableInDirCompression) {
diff --git a/frontend/src/app/applications/files/components/dialogs/files-new-dialog.component.ts b/frontend/src/app/applications/files/components/dialogs/files-new-dialog.component.ts
index df44422b..5cdbab0b 100644
--- a/frontend/src/app/applications/files/components/dialogs/files-new-dialog.component.ts
+++ b/frontend/src/app/applications/files/components/dialogs/files-new-dialog.component.ts
@@ -5,7 +5,7 @@
*/
import { KeyValuePipe } from '@angular/common'
-import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, ViewChild, inject } from '@angular/core'
+import { Component, ElementRef, EventEmitter, HostListener, inject, Input, OnInit, Output, ViewChild } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faCaretDown, faFileAlt, faFolderClosed, faGlobe } from '@fortawesome/free-solid-svg-icons'
@@ -25,13 +25,12 @@ import { FilesService } from '../../services/files.service'
imports: [FaIconComponent, L10nTranslateDirective, BsDropdownModule, FormsModule, L10nTranslatePipe, AutofocusDirective, KeyValuePipe]
})
export class FilesNewDialogComponent implements OnInit {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- protected layout = inject(LayoutService)
- private filesService = inject(FilesService)
@Input() files: FileModel[]
@Input() inputType: 'file' | 'directory' | 'download'
@Output() refreshFiles = new EventEmitter()
@ViewChild('InputText', { static: true }) inputText: ElementRef
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected layout = inject(LayoutService)
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected readonly icons = { faCaretDown, faGlobe, faFolderClosed, faFileAlt }
protected fileProp = { title: '', name: '', placeholder: '' }
@@ -40,6 +39,7 @@ export class FilesNewDialogComponent implements OnInit {
protected docTypes = DOCUMENT_TYPE
protected submitted = false
protected error: string
+ private filesService = inject(FilesService)
ngOnInit() {
if (this.inputType === 'download') {
@@ -90,6 +90,12 @@ export class FilesNewDialogComponent implements OnInit {
this.layout.closeDialog()
}
+ pasteUrl() {
+ setTimeout(() => {
+ this.fileProp.name = this.downloadProp.url.split('/').slice(-1)[0]
+ }, 200)
+ }
+
private fileNamePosition() {
return this.fileProp.name.lastIndexOf('.')
}
@@ -100,10 +106,4 @@ export class FilesNewDialogComponent implements OnInit {
this.inputText.nativeElement.setSelectionRange(0, this.fileNamePosition())
}, 0)
}
-
- pasteUrl() {
- setTimeout(() => {
- this.fileProp.name = this.downloadProp.url.split('/').slice(-1)[0]
- }, 200)
- }
}
diff --git a/frontend/src/app/applications/files/components/dialogs/files-trash-dialog.component.ts b/frontend/src/app/applications/files/components/dialogs/files-trash-dialog.component.ts
index 02330dc5..c9158ed4 100644
--- a/frontend/src/app/applications/files/components/dialogs/files-trash-dialog.component.ts
+++ b/frontend/src/app/applications/files/components/dialogs/files-trash-dialog.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { ChangeDetectionStrategy, Component, EventEmitter, HostListener, Input, Output, inject } from '@angular/core'
+import { ChangeDetectionStrategy, Component, EventEmitter, HostListener, inject, Input, Output } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faSpinner, faTrashCan } from '@fortawesome/free-solid-svg-icons'
import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } from 'angular-l10n'
@@ -18,11 +18,11 @@ import { FileModel } from '../../models/file.model'
changeDetection: ChangeDetectionStrategy.OnPush
})
export class FilesTrashDialogComponent {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- protected layout = inject(LayoutService)
@Input() files: FileModel[] = []
@Input() permanently = false
@Output() removeFiles = new EventEmitter<void>()
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected layout = inject(LayoutService)
protected readonly icons = { faTrashCan, faSpinner }
protected submitted = false
diff --git a/frontend/src/app/applications/files/components/dialogs/files-trash-empty-dialog.component.ts b/frontend/src/app/applications/files/components/dialogs/files-trash-empty-dialog.component.ts
index 9e098ef7..21ea37c5 100644
--- a/frontend/src/app/applications/files/components/dialogs/files-trash-empty-dialog.component.ts
+++ b/frontend/src/app/applications/files/components/dialogs/files-trash-empty-dialog.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, HostListener, Input, inject } from '@angular/core'
+import { Component, HostListener, inject, Input } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faSpinner, faTrashCan } from '@fortawesome/free-solid-svg-icons'
import { L10nTranslateDirective } from 'angular-l10n'
@@ -18,11 +18,11 @@ import { FilesService } from '../../services/files.service'
templateUrl: 'files-trash-empty-dialog.component.html'
})
export class FilesTrashEmptyDialogComponent {
- protected layout = inject(LayoutService)
- private filesService = inject(FilesService)
@Input() files: FileModel[] = []
+ protected layout = inject(LayoutService)
protected readonly icons = { faTrashCan, faSpinner }
protected submitted = false
+ private filesService = inject(FilesService)
@HostListener('document:keyup.enter')
onEnter() {
diff --git a/frontend/src/app/applications/files/components/dialogs/files-tree-dialog.component.ts b/frontend/src/app/applications/files/components/dialogs/files-tree-dialog.component.ts
index 1e465544..2884580e 100755
--- a/frontend/src/app/applications/files/components/dialogs/files-tree-dialog.component.ts
+++ b/frontend/src/app/applications/files/components/dialogs/files-tree-dialog.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, EventEmitter, Input, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, Output } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faFile, faFolderClosed } from '@fortawesome/free-regular-svg-icons'
import { FileTree } from '@sync-in-server/backend/src/applications/files/interfaces/file-tree.interface'
@@ -29,13 +29,13 @@ export interface FileTreeEvent {
templateUrl: 'files-tree-dialog.component.html'
})
export class FilesTreeDialogComponent {
- protected readonly layout = inject(LayoutService)
@Input() currentRoots: SpaceRootProps[] = []
@Output() submitEvent = new EventEmitter<FileTreeEvent>()
@Input() allowSpaces = false
@Input() toggleNodesAtStartup = true
// sharing case
@Input() mustHaveShareOutsidePermission = false
+ protected readonly layout = inject(LayoutService)
protected readonly icons = { faFile, faFolderClosed }
protected errorSelection = null
protected selection: FileTree = null
diff --git a/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.ts b/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.ts
index cf9e530f..97a7f382 100644
--- a/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.ts
+++ b/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpClient, HttpErrorResponse } from '@angular/common/http'
-import { Component, Input, OnDestroy, OnInit, inject } from '@angular/core'
+import { Component, inject, Input, OnDestroy, OnInit } from '@angular/core'
import { Subscription } from 'rxjs'
import { LayoutService } from '../../../../layout/layout.service'
import { FileModel } from '../../models/file.model'
@@ -21,15 +21,15 @@ import { FilesViewerTextComponent } from '../viewers/files-viewer-text.component
templateUrl: 'files-viewer-dialog.component.html'
})
export class FilesViewerDialogComponent implements OnInit, OnDestroy {
- private readonly http = inject(HttpClient)
- private readonly layout = inject(LayoutService)
@Input() currentFile: FileModel
@Input() mode: 'view' | 'edit' = 'view'
+ protected canAccess = false
+ protected currentHeight: number
+ private readonly http = inject(HttpClient)
+ private readonly layout = inject(LayoutService)
private subscription: Subscription = null
private readonly offsetTop = 42
private hookShortMime = null
- protected canAccess = false
- protected currentHeight: number
ngOnInit() {
this.subscription = this.layout.resizeEvent.subscribe(() => this.onResize())
@@ -63,10 +63,6 @@ export class FilesViewerDialogComponent implements OnInit, OnDestroy {
}
}
- private onResize() {
- this.currentHeight = window.innerHeight - this.offsetTop
- }
-
onClose() {
this.layout.closeDialog(null, this.currentFile.id)
}
@@ -74,4 +70,8 @@ export class FilesViewerDialogComponent implements OnInit, OnDestroy {
onMinimize() {
this.layout.minimizeDialog(this.currentFile.id, { name: this.currentFile.name, mimeUrl: this.currentFile.mimeUrl })
}
+
+ private onResize() {
+ this.currentHeight = window.innerHeight - this.offsetTop
+ }
}
diff --git a/frontend/src/app/applications/files/components/sidebar/files-clipboard.component.ts b/frontend/src/app/applications/files/components/sidebar/files-clipboard.component.ts
index 696c34b7..aef93b61 100644
--- a/frontend/src/app/applications/files/components/sidebar/files-clipboard.component.ts
+++ b/frontend/src/app/applications/files/components/sidebar/files-clipboard.component.ts
@@ -5,7 +5,7 @@
*/
import { KeyValuePipe } from '@angular/common'
-import { Component, OnDestroy, inject } from '@angular/core'
+import { Component, inject, OnDestroy } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faArrowsAlt, faClone, faDownload, faQuestion, faTimes, faTrashCan } from '@fortawesome/free-solid-svg-icons'
@@ -32,10 +32,6 @@ import { FilesCompressionDialogComponent } from '../dialogs/files-compression-di
})
export class FilesClipboardComponent implements OnDestroy {
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly layout = inject(LayoutService)
- private readonly store = inject(StoreService)
- private readonly filesService = inject(FilesService)
- private subscriptions: Subscription[] = []
protected readonly icons = { faTrashCan, faTimes, faDownload, faArrowsAlt, faClone, faQuestion }
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected operations = {
@@ -44,8 +40,12 @@ export class FilesClipboardComponent implements OnDestroy {
download: { text: 'Download', operation: FILE_OPERATION.DOWNLOAD },
compress: { text: 'Compress', operation: FILE_OPERATION.COMPRESS }
}
- protected selectedAction: 'copyPaste' | 'cutPaste' | 'download' | 'compress' = this.filesService.clipboardAction
protected files: FileModel[] = []
+ private readonly layout = inject(LayoutService)
+ private readonly store = inject(StoreService)
+ private readonly filesService = inject(FilesService)
+ protected selectedAction: 'copyPaste' | 'cutPaste' | 'download' | 'compress' = this.filesService.clipboardAction
+ private subscriptions: Subscription[] = []
constructor() {
this.subscriptions.push(this.store.filesClipboard.subscribe((files: FileModel[]) => (this.files = files)))
diff --git a/frontend/src/app/applications/files/components/sidebar/files-selection.component.ts b/frontend/src/app/applications/files/components/sidebar/files-selection.component.ts
index 0cc8efa7..07ead92b 100755
--- a/frontend/src/app/applications/files/components/sidebar/files-selection.component.ts
+++ b/frontend/src/app/applications/files/components/sidebar/files-selection.component.ts
@@ -40,11 +40,8 @@ import { FilesViewerMediaComponent } from '../viewers/files-viewer-media.compone
styles: ['.card {width: 100%; background: transparent; border: none}']
})
export class FilesSelectionComponent {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly router = inject(Router)
- private readonly layout = inject(LayoutService)
- private readonly filesService = inject(FilesService)
files: InputSignal<FileModel[]> = input.required<FileModel[]>()
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected multiple: Signal<boolean> = computed(() => this.files().length > 1)
protected resizeOffset: Signal<number> = computed(() => (this.multiple() ? 120 : 80))
protected readonly cardImageSize = defaultCardImageSize
@@ -56,12 +53,13 @@ export class FilesSelectionComponent {
faClipboardCheck,
faArrowsAlt
}
+ private readonly router = inject(Router)
+ private readonly layout = inject(LayoutService)
+ private readonly filesService = inject(FilesService)
goToShare(share: { type: number; name: string }) {
this.layout.toggleRSideBar(false)
- this.router
- .navigate([share.type === 0 ? SPACES_PATH.SHARED : SPACES_PATH.LINKS], { queryParams: { select: share.name } })
- .catch(console.error)
+ this.router.navigate([share.type === 0 ? SPACES_PATH.SHARED : SPACES_PATH.LINKS], { queryParams: { select: share.name } }).catch(console.error)
}
goToSpace(space: { alias: string; name: string }) {
diff --git a/frontend/src/app/applications/files/components/sidebar/files-tasks.component.ts b/frontend/src/app/applications/files/components/sidebar/files-tasks.component.ts
index 408a32a1..df769143 100644
--- a/frontend/src/app/applications/files/components/sidebar/files-tasks.component.ts
+++ b/frontend/src/app/applications/files/components/sidebar/files-tasks.component.ts
@@ -41,10 +41,6 @@ import { FilesService } from '../../services/files.service'
})
export class FilesTasksComponent implements OnDestroy {
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly router = inject(Router)
- private readonly store = inject(StoreService)
- private readonly filesService = inject(FilesService)
- private readonly filesTasksService = inject(FilesTasksService)
protected readonly icons = { faTrashAlt, faFlag, faClock, faFile, faFolderClosed }
protected readonly iconsStatus: IconDefinition[] = [faSpinner, faCheck, faExclamation]
protected readonly iconsOperation = {
@@ -60,6 +56,10 @@ export class FilesTasksComponent implements OnDestroy {
protected nbEndedTasks = 0
protected nbTotalTasks = 0
protected tasks: FileTask[] = []
+ private readonly router = inject(Router)
+ private readonly store = inject(StoreService)
+ private readonly filesService = inject(FilesService)
+ private readonly filesTasksService = inject(FilesTasksService)
private subscriptions: Subscription[] = []
constructor() {
diff --git a/frontend/src/app/applications/files/components/sidebar/files-tree.component.ts b/frontend/src/app/applications/files/components/sidebar/files-tree.component.ts
index b6ce2ad1..ad5da089 100644
--- a/frontend/src/app/applications/files/components/sidebar/files-tree.component.ts
+++ b/frontend/src/app/applications/files/components/sidebar/files-tree.component.ts
@@ -32,11 +32,6 @@ import { FilesService } from '../../services/files.service'
templateUrl: 'files-tree.component.html'
})
export class FilesTreeComponent implements OnInit, OnDestroy {
- private readonly layout = inject(LayoutService)
- private readonly router = inject(Router)
- private readonly user = inject(UserService)
- private readonly filesService = inject(FilesService)
- protected readonly store = inject(StoreService)
@ViewChild('tree', { static: true }) tree: any
@Output() selected = new EventEmitter()
@Input() showFiles = false
@@ -47,6 +42,7 @@ export class FilesTreeComponent implements OnInit, OnDestroy {
@Input() sideBarHeader = true
@Input() resizeOffset = defaultResizeOffset
@Input() toggleNodesAtStartup = false
+ protected readonly store = inject(StoreService)
protected readonly icons = {
faArrowRotateRight,
faArrowsAlt,
@@ -79,8 +75,11 @@ export class FilesTreeComponent implements OnInit, OnDestroy {
protected srcAllowed = true
protected dstAllowed = true
protected errorMsg = null
+ private readonly layout = inject(LayoutService)
+ private readonly router = inject(Router)
+ private readonly user = inject(UserService)
+ private readonly filesService = inject(FilesService)
private copyMoveOnHeight = 80
- private _copyMoveOn = false
private subscriptions: Subscription[] = []
private preventDblClick = false
private preventTimer: any
@@ -91,20 +90,7 @@ export class FilesTreeComponent implements OnInit, OnDestroy {
}
}
- get selection() {
- return this.filesService.treeNodeSelected
- }
-
- set selection(node: TreeNode) {
- this.filesService.treeNodeSelected = node
- if (node) {
- if ([0, -1, -2].indexOf(node.data.id) === -1) {
- this.selected.emit(node.data)
- } else {
- this.selected.emit(null)
- }
- }
- }
+ private _copyMoveOn = false
get copyMoveOn() {
return this._copyMoveOn
@@ -123,6 +109,21 @@ export class FilesTreeComponent implements OnInit, OnDestroy {
}
}
+ get selection() {
+ return this.filesService.treeNodeSelected
+ }
+
+ set selection(node: TreeNode) {
+ this.filesService.treeNodeSelected = node
+ if (node) {
+ if ([0, -1, -2].indexOf(node.data.id) === -1) {
+ this.selected.emit(node.data)
+ } else {
+ this.selected.emit(null)
+ }
+ }
+ }
+
ngOnInit() {
if (this.enableCopyMove) {
this.subscriptions.push(this.filesService.treeCopyMoveOn.subscribe(() => this.onCopyMove()))
diff --git a/frontend/src/app/applications/files/components/utils/file-permissions.component.ts b/frontend/src/app/applications/files/components/utils/file-permissions.component.ts
index c994d7df..5a863fb4 100644
--- a/frontend/src/app/applications/files/components/utils/file-permissions.component.ts
+++ b/frontend/src/app/applications/files/components/utils/file-permissions.component.ts
@@ -5,7 +5,7 @@
*/
import { KeyValuePipe } from '@angular/common'
-import { Component, Input, OnChanges, inject } from '@angular/core'
+import { Component, inject, Input, OnChanges } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } from 'angular-l10n'
import { AvailableBSPositions } from 'ngx-bootstrap/positioning'
@@ -32,10 +32,10 @@ import { SPACES_PERMISSIONS_TEXT } from '../../../spaces/spaces.constants'
`
})
export class FilePermissionsComponent implements OnChanges {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
@Input({ required: true }) permissions: Partial<typeof SPACES_PERMISSIONS_TEXT> = {}
@Input() tooltipPlacement: AvailableBSPositions = 'top'
@Input() replaceEmptyPermissions = false
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected hasPermissions = false
protected readonly originalOrderKeyValue = originalOrderKeyValue
diff --git a/frontend/src/app/applications/files/components/viewers/files-viewer-document.component.ts b/frontend/src/app/applications/files/components/viewers/files-viewer-document.component.ts
index 4c2d9c33..306be1ae 100644
--- a/frontend/src/app/applications/files/components/viewers/files-viewer-document.component.ts
+++ b/frontend/src/app/applications/files/components/viewers/files-viewer-document.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpClient, HttpParams } from '@angular/common/http'
-import { Component, Input, OnInit, inject } from '@angular/core'
+import { Component, inject, Input, OnInit } from '@angular/core'
import { API_FILES_ONLY_OFFICE_SETTINGS } from '@sync-in-server/backend/src/applications/files/constants/routes'
import { OnlyOfficeReqConfig } from '@sync-in-server/backend/src/applications/files/interfaces/only-office-config.interface'
import { LayoutService } from '../../../../layout/layout.service'
@@ -29,13 +29,13 @@ import { OnlyOfficeComponent } from '../utils/only-office.component'
`
})
export class FilesViewerDocumentComponent implements OnInit {
- private readonly http = inject(HttpClient)
- private readonly layout = inject(LayoutService)
@Input() file: FileModel
@Input() currentHeight: number
@Input() mode: 'view' | 'edit'
protected docId: string
protected documentConfig: OnlyOfficeReqConfig = null
+ private readonly http = inject(HttpClient)
+ private readonly layout = inject(LayoutService)
ngOnInit() {
this.docId = `viewer-doc-${this.file.id}`
diff --git a/frontend/src/app/applications/files/components/viewers/files-viewer-html.component.ts b/frontend/src/app/applications/files/components/viewers/files-viewer-html.component.ts
index 50cf937c..8f7d35cb 100755
--- a/frontend/src/app/applications/files/components/viewers/files-viewer-html.component.ts
+++ b/frontend/src/app/applications/files/components/viewers/files-viewer-html.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpClient } from '@angular/common/http'
-import { Component, Input, OnInit, inject } from '@angular/core'
+import { Component, inject, Input, OnInit } from '@angular/core'
import { DomSanitizer } from '@angular/platform-browser'
import { LayoutService } from '../../../../layout/layout.service'
@@ -16,12 +16,12 @@ import { LayoutService } from '../../../../layout/layout.service'
}`
})
export class FilesViewerHtmlComponent implements OnInit {
- private readonly http = inject(HttpClient)
- private readonly sanitizer = inject(DomSanitizer)
- private readonly layout = inject(LayoutService)
@Input() currentHeight: number
@Input() fileUrl: string
protected content: any = null
+ private readonly http = inject(HttpClient)
+ private readonly sanitizer = inject(DomSanitizer)
+ private readonly layout = inject(LayoutService)
ngOnInit() {
this.http.get(this.fileUrl, { responseType: 'text' }).subscribe({
diff --git a/frontend/src/app/applications/files/components/viewers/files-viewer-pdf.component.ts b/frontend/src/app/applications/files/components/viewers/files-viewer-pdf.component.ts
index 96d3f94c..5883289b 100644
--- a/frontend/src/app/applications/files/components/viewers/files-viewer-pdf.component.ts
+++ b/frontend/src/app/applications/files/components/viewers/files-viewer-pdf.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { ChangeDetectionStrategy, Component, Input, OnInit, inject } from '@angular/core'
+import { ChangeDetectionStrategy, Component, inject, Input, OnInit } from '@angular/core'
import { DomSanitizer } from '@angular/platform-browser'
import { assetsUrl } from '../../files.constants'
@@ -14,10 +14,10 @@ import { assetsUrl } from '../../files.constants'
template: ` <iframe [src]="url" class="app-viewer-iframe" [style.height.px]="currentHeight"></iframe> `
})
export class FilesViewerPdfComponent implements OnInit {
- private readonly sanitizer = inject(DomSanitizer)
@Input() fileUrl: string
@Input() currentHeight: number
protected url: any
+ private readonly sanitizer = inject(DomSanitizer)
private readonly pdfjsUrl = `${assetsUrl}/pdfjs/web/viewer.html?file=`
ngOnInit() {
diff --git a/frontend/src/app/applications/files/components/viewers/files-viewer-text.component.ts b/frontend/src/app/applications/files/components/viewers/files-viewer-text.component.ts
index b3271854..c12525be 100644
--- a/frontend/src/app/applications/files/components/viewers/files-viewer-text.component.ts
+++ b/frontend/src/app/applications/files/components/viewers/files-viewer-text.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpClient } from '@angular/common/http'
-import { AfterViewInit, Component, Input, OnInit, ViewChild, ViewEncapsulation, inject } from '@angular/core'
+import { AfterViewInit, Component, inject, Input, OnInit, ViewChild, ViewEncapsulation } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { CodeMirrorComponent } from '../../../../common/components/code-mirror.component'
import { themeDark } from '../../../../layout/layout.interfaces'
@@ -30,13 +30,13 @@ import { FileModel } from '../../models/file.model'
</div>`
})
export class FilesViewerTextComponent implements OnInit, AfterViewInit {
- private readonly http = inject(HttpClient)
- private readonly layout = inject(LayoutService)
@ViewChild('CodeMirror', { static: true }) ref: any
@Input() currentHeight: number
@Input() file: FileModel
protected ready = false
protected content: string
+ private readonly http = inject(HttpClient)
+ private readonly layout = inject(LayoutService)
protected options = {
lineNumbers: false,
readOnly: true,
diff --git a/frontend/src/app/applications/files/components/widgets/files-recents-widget.component.ts b/frontend/src/app/applications/files/components/widgets/files-recents-widget.component.ts
index 18958299..82db19e2 100644
--- a/frontend/src/app/applications/files/components/widgets/files-recents-widget.component.ts
+++ b/frontend/src/app/applications/files/components/widgets/files-recents-widget.component.ts
@@ -22,23 +22,19 @@ import { FilesService } from '../../services/files.service'
templateUrl: './files-recents-widget.component.html'
})
export class FilesRecentsWidgetComponent {
+ protected moreElements = false
+ protected readonly icons = { faFileLines, faMagnifyingGlassPlus, faMagnifyingGlassMinus, faTrashAlt }
private readonly router = inject(Router)
private readonly store = inject(StoreService)
private readonly filesService = inject(FilesService)
private nbInitialFiles = 10
private nbFiles = this.nbInitialFiles
- protected moreElements = false
protected files: Signal<FileRecentModel[]> = computed(() => this.store.filesRecents().slice(0, this.nbFiles))
- protected readonly icons = { faFileLines, faMagnifyingGlassPlus, faMagnifyingGlassMinus, faTrashAlt }
constructor() {
this.load()
}
- private load() {
- this.filesService.loadRecents(this.nbFiles)
- }
-
switchMore() {
if (this.moreElements) {
this.moreElements = false
@@ -53,4 +49,8 @@ export class FilesRecentsWidgetComponent {
goToFile(f: FileRecentModel) {
this.router.navigate([SPACES_PATH.SPACES, ...f.path.split('/')], { queryParams: { select: f.name } }).catch(console.error)
}
+
+ private load() {
+ this.filesService.loadRecents(this.nbFiles)
+ }
}
diff --git a/frontend/src/app/applications/files/models/file-content.model.ts b/frontend/src/app/applications/files/models/file-content.model.ts
index 3180767b..77b7a620 100644
--- a/frontend/src/app/applications/files/models/file-content.model.ts
+++ b/frontend/src/app/applications/files/models/file-content.model.ts
@@ -31,6 +31,10 @@ export class FileContentModel implements FileContent {
this.setInfos()
}
+ fallBackMimeUrl() {
+ this.mimeUrl = defaultMimeUrl
+ }
+
private setInfos() {
const repository = this.path.split('/')[0]
const isPersonal = this.path.split('/')[1] === SPACE_ALIAS.PERSONAL
@@ -41,8 +45,4 @@ export class FileContentModel implements FileContent {
this.iconClass = repository === SPACE_REPOSITORY.SHARES ? 'purple' : 'primary'
this.icon = repository === SPACE_REPOSITORY.SHARES ? SPACES_ICON.SHARES : isPersonal ? SPACES_ICON.PERSONAL : SPACES_ICON.SPACES
}
-
- fallBackMimeUrl() {
- this.mimeUrl = defaultMimeUrl
- }
}
diff --git a/frontend/src/app/applications/files/services/files-tasks.service.ts b/frontend/src/app/applications/files/services/files-tasks.service.ts
index 55759186..a0a49048 100644
--- a/frontend/src/app/applications/files/services/files-tasks.service.ts
+++ b/frontend/src/app/applications/files/services/files-tasks.service.ts
@@ -5,7 +5,7 @@
*/
import { HttpClient, HttpErrorResponse } from '@angular/common/http'
-import { Injectable, inject } from '@angular/core'
+import { inject, Injectable } from '@angular/core'
import { FILE_OPERATION } from '@sync-in-server/backend/src/applications/files/constants/operations'
import { API_FILES_TASKS } from '@sync-in-server/backend/src/applications/files/constants/routes'
import { FileTask, FileTaskStatus } from '@sync-in-server/backend/src/applications/files/models/file-task'
@@ -74,6 +74,17 @@ export class FilesTasksService {
})
}
+ updateTask(task: FileTask) {
+ if (task.status === FileTaskStatus.PENDING) {
+ const currentTask = this.findTask(task.id, true)
+ Object.assign(currentTask, task)
+ } else {
+ this.deleteTask(task.id, true)
+ this.addTask(task)
+ this.taskDone(task)
+ }
+ }
+
private loadAll() {
this.http.get<FileTask[]>(API_FILES_TASKS).subscribe({
next: (fileTasks: FileTask[]) => fileTasks.forEach((task: FileTask) => this.addTask(task)),
@@ -119,17 +130,6 @@ export class FilesTasksService {
}
}
- updateTask(task: FileTask) {
- if (task.status === FileTaskStatus.PENDING) {
- const currentTask = this.findTask(task.id, true)
- Object.assign(currentTask, task)
- } else {
- this.deleteTask(task.id, true)
- this.addTask(task)
- this.taskDone(task)
- }
- }
-
private findTask(taskId: string, active: boolean): FileTask {
if (active) {
return this.store.filesActiveTasks.getValue().find((task: FileTask) => task.id === taskId)
diff --git a/frontend/src/app/applications/files/services/files-upload.service.ts b/frontend/src/app/applications/files/services/files-upload.service.ts
index d5045a06..01758ef6 100644
--- a/frontend/src/app/applications/files/services/files-upload.service.ts
+++ b/frontend/src/app/applications/files/services/files-upload.service.ts
@@ -17,10 +17,10 @@ import { FilesService } from './files.service'
@Injectable({ providedIn: 'root' })
export class FilesUploadService {
+ public supportUploadDirectory = supportUploadDirectory()
private readonly http = inject(HttpClient)
private readonly filesService = inject(FilesService)
private readonly filesTasksService = inject(FilesTasksService)
- public supportUploadDirectory = supportUploadDirectory()
async addFiles(files: FileUpload[]) {
const apiRoute = `${API_FILES_OPERATION_UPLOAD}/${this.filesService.currentRoute}`
diff --git a/frontend/src/app/applications/files/services/files.service.ts b/frontend/src/app/applications/files/services/files.service.ts
index f054ff98..eec54c19 100644
--- a/frontend/src/app/applications/files/services/files.service.ts
+++ b/frontend/src/app/applications/files/services/files.service.ts
@@ -6,7 +6,7 @@
import type { TreeNode } from '@ali-hm/angular-tree-component'
import { HttpClient, HttpErrorResponse, HttpParams } from '@angular/common/http'
-import { Injectable, inject } from '@angular/core'
+import { inject, Injectable } from '@angular/core'
import { DomSanitizer } from '@angular/platform-browser'
import { FILE_OPERATION } from '@sync-in-server/backend/src/applications/files/constants/operations'
import {
@@ -43,11 +43,6 @@ import { FilesTasksService } from './files-tasks.service'
@Injectable({ providedIn: 'root' })
export class FilesService {
- private readonly http = inject(HttpClient)
- private readonly layout = inject(LayoutService)
- private readonly store = inject(StoreService)
- private readonly sanitizer = inject(DomSanitizer)
- private readonly filesTasksService = inject(FilesTasksService)
// Tree section
public treeNodeSelected: TreeNode = null
public treeCopyMoveOn = new Subject<void>()
@@ -55,6 +50,11 @@ export class FilesService {
public clipboardAction: 'copyPaste' | 'cutPaste' = 'copyPaste'
// Files
public currentRoute: string
+ private readonly http = inject(HttpClient)
+ private readonly layout = inject(LayoutService)
+ private readonly store = inject(StoreService)
+ private readonly sanitizer = inject(DomSanitizer)
+ private readonly filesTasksService = inject(FilesTasksService)
getTreeNode(nodePath: string, showFiles = false): Promise<FileTree[]> {
return firstValueFrom(
diff --git a/frontend/src/app/applications/links/components/dialogs/link-dialog.component.ts b/frontend/src/app/applications/links/components/dialogs/link-dialog.component.ts
index 3acc1152..af77f690 100644
--- a/frontend/src/app/applications/links/components/dialogs/link-dialog.component.ts
+++ b/frontend/src/app/applications/links/components/dialogs/link-dialog.component.ts
@@ -6,7 +6,7 @@
import { KeyValuePipe } from '@angular/common'
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, EventEmitter, Input, OnInit, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, OnInit, Output } from '@angular/core'
import { FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faClipboard, faClipboardCheck, faEye, faEyeSlash, faLock, faLockOpen } from '@fortawesome/free-solid-svg-icons'
@@ -60,12 +60,7 @@ import { LinksService } from '../../services/links.service'
templateUrl: 'link-dialog.component.html'
})
export class LinkDialogComponent implements OnInit {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
readonly layout = inject(LayoutService)
- private readonly userService = inject(UserService)
- private readonly sharesService = inject(SharesService)
- private readonly linksService = inject(LinksService)
- private readonly spacesService = inject(SpacesService)
// from links component or children dialog component
@Input() share: ShareLinkModel | (Partial<ShareModel> & { link: LinkGuest })
@Input() parentSpaceId: number = null
@@ -78,6 +73,7 @@ export class LinkDialogComponent implements OnInit {
// submit event
@Output() submitEvent = new EventEmitter<CreateOrUpdateLinkDto>()
@Output() shareChange = new EventEmitter<['update' | 'delete', ShareLinkModel] | ['add', ShareModel]>()
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected confirmDeletion = false
protected submitted = false
protected readonly SPACES_PERMISSIONS_TEXT = SPACES_PERMISSIONS_TEXT
@@ -104,6 +100,10 @@ export class LinkDialogComponent implements OnInit {
permissions: FormControl<string | null>
isActive: FormControl<boolean>
}>
+ private readonly userService = inject(UserService)
+ private readonly sharesService = inject(SharesService)
+ private readonly linksService = inject(LinksService)
+ private readonly spacesService = inject(SpacesService)
constructor() {
// set picker expiration to current date + 1 day
@@ -131,76 +131,6 @@ export class LinkDialogComponent implements OnInit {
this.linkForm.controls.expiresAt.valueChanges.subscribe((date: Date) => this.isLinkIsExpired(date))
}
- private initFile() {
- const fileShare: ShareModel = this.sharesService.initShareFromFile(this.userService.user, this.file, this.isSharesRepo, this.inSharesList)[0]
- this.share = {
- ...fileShare,
- link: {
- id: -1,
- userId: -1,
- uuid: '',
- isActive: true,
- requireAuth: false,
- permissions: '',
- nbAccess: 0,
- limitAccess: 0
- } as LinkGuest
- }
- this.linksService.genUUID().subscribe((uuid: string) => (this.share.link.uuid = uuid))
- this.initShareLink()
- // update permissions (text)
- this.onPermissionChange()
- }
-
- private initShareLink() {
- this.linkForm = new FormGroup({
- shareName: new FormControl<string>(this.share.name, Validators.required),
- shareDescription: new FormControl<string>(this.share.description || ''),
- name: new FormControl<string>(this.share.link?.name || ''),
- email: new FormControl<string>(this.share.link?.email || '', Validators.email),
- language: new FormControl<string>(this.share.link.language || null),
- limitAccess: new FormControl<number>(this.share.link.limitAccess || null),
- expiresAt: new FormControl<Date | null>(this.share.link.expiresAt || null),
- requireAuth: new FormControl<boolean>(this.share.link.requireAuth || false),
- permissions: new FormControl<string>(this.share.link.permissions),
- isActive: new FormControl<boolean>(this.share.link.isActive)
- })
- this.permissions = setAllowedBooleanPermissions(this.share.file.permissions, this.share.link.permissions, [
- SPACE_OPERATION.SHARE_INSIDE,
- SPACE_OPERATION.SHARE_OUTSIDE,
- ...(this.share.file.isDir ? [] : [SPACE_OPERATION.DELETE, SPACE_OPERATION.ADD])
- ])
- }
-
- private initLink() {
- this.linkForm = new FormGroup({
- shareName: new FormControl<string>(''),
- shareDescription: new FormControl<string>(''),
- name: new FormControl<string>(this.link.name || ''),
- email: new FormControl<string>(this.link.email || '', Validators.email),
- language: new FormControl<string>(this.link.language || null),
- limitAccess: new FormControl<number>(this.link.limitAccess || null),
- expiresAt: new FormControl<Date | null>(this.link.expiresAt || null),
- requireAuth: new FormControl<boolean>(this.link.requireAuth || false),
- permissions: new FormControl<string>(this.link.permissions),
- isActive: new FormControl<boolean>(this.link.isActive)
- })
- if (!this.link.id) {
- this.linkForm.controls.name.markAsDirty()
- this.linkForm.controls.isActive.markAsDirty()
- }
- }
-
- private isLinkIsExpired(date: Date) {
- if (date === undefined || date === null) {
- this.linkIsExpired = false
- if (date === null) return
- // change value from undefined to null
- this.linkForm.controls.expiresAt.setValue(null)
- }
- this.linkIsExpired = currentDate() >= date
- }
-
onPermissionChange() {
const perms: string = setStringPermission(this.permissions)
this.linkForm.controls.permissions.setValue(perms)
@@ -317,6 +247,76 @@ export class LinkDialogComponent implements OnInit {
this.submitEvent.emit(update)
}
+ private initFile() {
+ const fileShare: ShareModel = this.sharesService.initShareFromFile(this.userService.user, this.file, this.isSharesRepo, this.inSharesList)[0]
+ this.share = {
+ ...fileShare,
+ link: {
+ id: -1,
+ userId: -1,
+ uuid: '',
+ isActive: true,
+ requireAuth: false,
+ permissions: '',
+ nbAccess: 0,
+ limitAccess: 0
+ } as LinkGuest
+ }
+ this.linksService.genUUID().subscribe((uuid: string) => (this.share.link.uuid = uuid))
+ this.initShareLink()
+ // update permissions (text)
+ this.onPermissionChange()
+ }
+
+ private initShareLink() {
+ this.linkForm = new FormGroup({
+ shareName: new FormControl<string>(this.share.name, Validators.required),
+ shareDescription: new FormControl<string>(this.share.description || ''),
+ name: new FormControl<string>(this.share.link?.name || ''),
+ email: new FormControl<string>(this.share.link?.email || '', Validators.email),
+ language: new FormControl<string>(this.share.link.language || null),
+ limitAccess: new FormControl<number>(this.share.link.limitAccess || null),
+ expiresAt: new FormControl<Date | null>(this.share.link.expiresAt || null),
+ requireAuth: new FormControl<boolean>(this.share.link.requireAuth || false),
+ permissions: new FormControl<string>(this.share.link.permissions),
+ isActive: new FormControl<boolean>(this.share.link.isActive)
+ })
+ this.permissions = setAllowedBooleanPermissions(this.share.file.permissions, this.share.link.permissions, [
+ SPACE_OPERATION.SHARE_INSIDE,
+ SPACE_OPERATION.SHARE_OUTSIDE,
+ ...(this.share.file.isDir ? [] : [SPACE_OPERATION.DELETE, SPACE_OPERATION.ADD])
+ ])
+ }
+
+ private initLink() {
+ this.linkForm = new FormGroup({
+ shareName: new FormControl<string>(''),
+ shareDescription: new FormControl<string>(''),
+ name: new FormControl<string>(this.link.name || ''),
+ email: new FormControl<string>(this.link.email || '', Validators.email),
+ language: new FormControl<string>(this.link.language || null),
+ limitAccess: new FormControl<number>(this.link.limitAccess || null),
+ expiresAt: new FormControl<Date | null>(this.link.expiresAt || null),
+ requireAuth: new FormControl<boolean>(this.link.requireAuth || false),
+ permissions: new FormControl<string>(this.link.permissions),
+ isActive: new FormControl<boolean>(this.link.isActive)
+ })
+ if (!this.link.id) {
+ this.linkForm.controls.name.markAsDirty()
+ this.linkForm.controls.isActive.markAsDirty()
+ }
+ }
+
+ private isLinkIsExpired(date: Date) {
+ if (date === undefined || date === null) {
+ this.linkIsExpired = false
+ if (date === null) return
+ // change value from undefined to null
+ this.linkForm.controls.expiresAt.setValue(null)
+ }
+ this.linkIsExpired = currentDate() >= date
+ }
+
private mustIncludePassword(): boolean {
return !!this.password.length && this.password !== this.defaultPassword
}
diff --git a/frontend/src/app/applications/links/components/links.component.ts b/frontend/src/app/applications/links/components/links.component.ts
index 1d64e4c1..559781e1 100644
--- a/frontend/src/app/applications/links/components/links.component.ts
+++ b/frontend/src/app/applications/links/components/links.component.ts
@@ -6,7 +6,7 @@
import { KeyValuePipe } from '@angular/common'
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, ElementRef, OnInit, ViewChild, inject } from '@angular/core'
+import { Component, ElementRef, inject, OnInit, ViewChild } from '@angular/core'
import { ActivatedRoute } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import {
@@ -66,12 +66,6 @@ import { LinkDialogComponent } from './dialogs/link-dialog.component'
templateUrl: 'links.component.html'
})
export class LinksComponent implements OnInit {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly activatedRoute = inject(ActivatedRoute)
- private readonly store = inject(StoreService)
- protected readonly layout = inject(LayoutService)
- private readonly linksService = inject(LinksService)
- private readonly sharesService = inject(SharesService)
@ViewChild(VirtualScrollComponent) scrollView: {
element: ElementRef
viewPortItems: ShareLinkModel[]
@@ -81,6 +75,8 @@ export class LinksComponent implements OnInit {
@ViewChild(NavigationViewComponent, { static: true }) btnNavigationView: NavigationViewComponent
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('TargetContextMenu', { static: true }) targetContextMenu: ContextMenuComponent<any>
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected readonly layout = inject(LayoutService)
protected readonly icons = {
faLink,
faArrowRotateRight,
@@ -100,7 +96,6 @@ export class LinksComponent implements OnInit {
protected loading = false
protected linkWasCopied = false
protected galleryMode: ViewMode
- private focusOnSelect: string
protected shares: ShareLinkModel[] = []
protected selected: ShareLinkModel = null
// Sort
@@ -147,6 +142,12 @@ export class LinksComponent implements OnInit {
sortable: true
}
}
+ protected btnSortFields = { name: 'Name', link: 'Link', accessed: 'Accessed' }
+ private readonly activatedRoute = inject(ActivatedRoute)
+ private readonly store = inject(StoreService)
+ private readonly linksService = inject(LinksService)
+ private readonly sharesService = inject(SharesService)
+ private focusOnSelect: string
private readonly sortSettings: SortSettings = {
default: [{ prop: 'name', type: 'string' }],
link: [{ prop: 'link.name', type: 'string' }],
@@ -156,7 +157,6 @@ export class LinksComponent implements OnInit {
accessed: [{ prop: 'link.currentAccess', type: 'date' }]
}
protected sortTable = new SortTable(this.constructor.name, this.sortSettings)
- protected btnSortFields = { name: 'Name', link: 'Link', accessed: 'Accessed' }
constructor() {
this.loadShareLinks()
@@ -235,14 +235,6 @@ export class LinksComponent implements OnInit {
this.layout.openContextMenu(ev, this.targetContextMenu)
}
- private focusOn(select: string) {
- const s = this.shares.find((share) => share.name === select)
- if (s) {
- setTimeout(() => this.scrollView.scrollInto(s), 100)
- this.onSelect(s)
- }
- }
-
copyToClipboard() {
if (this.selected) {
this.linksService.copyLinkToClipboard(this.selected.link.uuid)
@@ -256,4 +248,12 @@ export class LinksComponent implements OnInit {
share = share || this.selected
this.sharesService.goTo(share).catch(console.error)
}
+
+ private focusOn(select: string) {
+ const s = this.shares.find((share) => share.name === select)
+ if (s) {
+ setTimeout(() => this.scrollView.scrollInto(s), 100)
+ this.onSelect(s)
+ }
+ }
}
diff --git a/frontend/src/app/applications/links/components/public/public-link-auth.component.ts b/frontend/src/app/applications/links/components/public/public-link-auth.component.ts
index 224aeb54..813a50b6 100644
--- a/frontend/src/app/applications/links/components/public/public-link-auth.component.ts
+++ b/frontend/src/app/applications/links/components/public/public-link-auth.component.ts
@@ -20,13 +20,13 @@ import { LinksService } from '../../services/links.service'
})
export class PublicLinkAuthComponent {
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly activatedRoute = inject(ActivatedRoute)
- private readonly linksService = inject(LinksService)
protected readonly logoUrl = logoUrl
protected readonly linkProtected = linkProtected
protected readonly icons = { faKey, faSignInAlt }
- private uuid: string
protected password = ''
+ private readonly activatedRoute = inject(ActivatedRoute)
+ private readonly linksService = inject(LinksService)
+ private uuid: string
constructor() {
this.activatedRoute.params.subscribe((p: Params) => (this.uuid = p.uuid))
diff --git a/frontend/src/app/applications/links/components/public/public-link-error.component.ts b/frontend/src/app/applications/links/components/public/public-link-error.component.ts
index 5e7be332..f0b76ff1 100644
--- a/frontend/src/app/applications/links/components/public/public-link-error.component.ts
+++ b/frontend/src/app/applications/links/components/public/public-link-error.component.ts
@@ -18,10 +18,10 @@ import { LINK_ERROR_TRANSLATION } from '../../links.constants'
templateUrl: 'public-link-error.component.html'
})
export class PublicLinkErrorComponent {
- private readonly activatedRoute = inject(ActivatedRoute)
protected readonly logoUrl = logoUrl
protected readonly icons = { faExclamationCircle }
protected error: string
+ private readonly activatedRoute = inject(ActivatedRoute)
constructor() {
this.activatedRoute.params.subscribe((params: Params) => (this.error = LINK_ERROR_TRANSLATION[params.error]))
diff --git a/frontend/src/app/applications/links/components/public/public-link.component.ts b/frontend/src/app/applications/links/components/public/public-link.component.ts
index e64485a9..9e59e016 100644
--- a/frontend/src/app/applications/links/components/public/public-link.component.ts
+++ b/frontend/src/app/applications/links/components/public/public-link.component.ts
@@ -20,13 +20,13 @@ import { LinksService } from '../../services/links.service'
})
export class PublicLinkComponent {
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly activatedRoute = inject(ActivatedRoute)
- private readonly linksService = inject(LinksService)
protected readonly icons = { SPACES: SPACES_ICON.SPACES }
protected readonly logoUrl = logoUrl
- private linkUUID: string
protected mimeUrl: string = null
protected link: SpaceLink
+ private readonly activatedRoute = inject(ActivatedRoute)
+ private readonly linksService = inject(LinksService)
+ private linkUUID: string
constructor() {
this.activatedRoute.params.subscribe((params: Params) => (this.linkUUID = params.uuid))
diff --git a/frontend/src/app/applications/links/components/sidebar/link-selection.component.ts b/frontend/src/app/applications/links/components/sidebar/link-selection.component.ts
index fecd3357..f7e9ed70 100644
--- a/frontend/src/app/applications/links/components/sidebar/link-selection.component.ts
+++ b/frontend/src/app/applications/links/components/sidebar/link-selection.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { ChangeDetectionStrategy, Component, input, InputSignal, inject } from '@angular/core'
+import { ChangeDetectionStrategy, Component, inject, input, InputSignal } from '@angular/core'
import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } from 'angular-l10n'
import { AutoResizeDirective } from '../../../../common/directives/auto-resize.directive'
import { TimeDateFormatPipe } from '../../../../common/pipes/time-date-format.pipe'
@@ -21,8 +21,8 @@ import { ShareLinkModel } from '../../models/share-link.model'
styles: ['.card {width: 100%; background: transparent; border: none}']
})
export class LinkSelectionComponent {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
link: InputSignal<ShareLinkModel> = input.required<ShareLinkModel>()
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly cardImageSize = defaultCardImageSize
protected readonly resizeOffset = defaultResizeOffset
protected accessHover = false
diff --git a/frontend/src/app/applications/notifications/components/sidebar/notifications.component.ts b/frontend/src/app/applications/notifications/components/sidebar/notifications.component.ts
index 7c737159..b2b0cd93 100644
--- a/frontend/src/app/applications/notifications/components/sidebar/notifications.component.ts
+++ b/frontend/src/app/applications/notifications/components/sidebar/notifications.component.ts
@@ -26,13 +26,13 @@ import { NotificationsService } from '../../notifications.service'
templateUrl: 'notifications.component.html'
})
export class NotificationsComponent implements AfterViewInit {
- private readonly router = inject(Router)
+ @ViewChildren('notificationsHtml') notificationsHtml!: QueryList<ElementRef>
protected readonly store = inject(StoreService)
+ protected readonly icons = { faCheck, faTimes, faMagnifyingGlass, faTrashAlt, faCircleInfo }
+ private readonly router = inject(Router)
private readonly layout = inject(LayoutService)
private readonly notificationsService = inject(NotificationsService)
- @ViewChildren('notificationsHtml') notificationsHtml!: QueryList<ElementRef>
private observer!: IntersectionObserver
- protected readonly icons = { faCheck, faTimes, faMagnifyingGlass, faTrashAlt, faCircleInfo }
constructor() {
// Re-observe the elements if notifications array has changes
@@ -67,6 +67,28 @@ export class NotificationsComponent implements AfterViewInit {
)
}
+ removeAll() {
+ this.notificationsService.deleteNotification().subscribe({
+ next: () => this.store.notifications.set([]),
+ error: (e: HttpErrorResponse) => this.layout.sendNotification('error', 'Notifications', 'Unable to delete', e)
+ })
+ }
+
+ remove(notification: NotificationModel) {
+ this.notificationsService.deleteNotification(notification.id).subscribe({
+ next: () =>
+ this.store.notifications.update((notifications: NotificationModel[]) => {
+ return notifications.filter((n) => notification.id !== n.id)
+ }),
+ error: (e: HttpErrorResponse) => this.layout.sendNotification('error', 'Notifications', 'Unable to delete', e)
+ })
+ }
+
+ goto(n: NotificationModel) {
+ const element = n.content.app === NOTIFICATION_APP.SYNC ? n.content.element.split('/').at(-1) : n.content.element
+ this.router.navigate([SPACES_PATH.SPACES, ...n.content.url.split('/')], { queryParams: { select: element } }).catch(console.error)
+ }
+
private observeUnreadNotifications() {
// Only watch the unread notifications
if (!this.notificationsHtml) return
@@ -94,28 +116,4 @@ export class NotificationsComponent implements AfterViewInit {
error: (e: HttpErrorResponse) => this.layout.sendNotification('error', 'Notifications', 'Unable to mark as read', e)
})
}
-
- removeAll() {
- this.notificationsService.deleteNotification().subscribe({
- next: () => this.store.notifications.set([]),
- error: (e: HttpErrorResponse) => this.layout.sendNotification('error', 'Notifications', 'Unable to delete', e)
- })
- }
-
- remove(notification: NotificationModel) {
- this.notificationsService.deleteNotification(notification.id).subscribe({
- next: () =>
- this.store.notifications.update((notifications: NotificationModel[]) => {
- return notifications.filter((n) => notification.id !== n.id)
- }),
- error: (e: HttpErrorResponse) => this.layout.sendNotification('error', 'Notifications', 'Unable to delete', e)
- })
- }
-
- goto(n: NotificationModel) {
- const element = n.content.app === NOTIFICATION_APP.SYNC ? n.content.element.split('/').at(-1) : n.content.element
- this.router
- .navigate([SPACES_PATH.SPACES, ...n.content.url.split('/')], { queryParams: { select: element } })
- .catch(console.error)
- }
}
diff --git a/frontend/src/app/applications/notifications/notifications.service.ts b/frontend/src/app/applications/notifications/notifications.service.ts
index 1e49654f..1bb42bad 100644
--- a/frontend/src/app/applications/notifications/notifications.service.ts
+++ b/frontend/src/app/applications/notifications/notifications.service.ts
@@ -5,7 +5,7 @@
*/
import { HttpClient } from '@angular/common/http'
-import { Injectable, inject } from '@angular/core'
+import { inject, Injectable } from '@angular/core'
import { API_NOTIFICATIONS, NOTIFICATIONS_ROUTE } from '@sync-in-server/backend/src/applications/notifications/constants/routes'
import type { NotificationFromUser } from '@sync-in-server/backend/src/applications/notifications/interfaces/notification-properties.interface'
import { ActiveToast } from 'ngx-toastr'
diff --git a/frontend/src/app/applications/search/components/search.component.ts b/frontend/src/app/applications/search/components/search.component.ts
index d6f88818..305d4fd0 100644
--- a/frontend/src/app/applications/search/components/search.component.ts
+++ b/frontend/src/app/applications/search/components/search.component.ts
@@ -42,19 +42,18 @@ import { SEARCH_ICON, SEARCH_PATH } from '../search.constants'
templateUrl: './search.component.html'
})
export class SearchComponent {
+ @ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly router = inject(Router)
- private readonly layout = inject(LayoutService)
protected readonly store = inject(StoreService)
- private readonly filesService = inject(FilesService)
-
- @ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
+ public searchContent: Signal<string> = computed(() => this.store.currentSearch().content)
protected readonly icons = { SEARCH_ICON, faSpinner, faTrashCan, faTimes, faFont }
protected minCharsToSearch = minCharsToSearch
protected loading = false
protected errorMessage: string = null
protected selectedId: number = null
- public searchContent: Signal<string> = computed(() => this.store.currentSearch().content)
+ private readonly router = inject(Router)
+ private readonly layout = inject(LayoutService)
+ private readonly filesService = inject(FilesService)
constructor() {
this.layout.setBreadcrumbIcon(SEARCH_ICON)
diff --git a/frontend/src/app/applications/shares/components/dialogs/share-dialog.component.ts b/frontend/src/app/applications/shares/components/dialogs/share-dialog.component.ts
index fab6c042..6c2696d1 100644
--- a/frontend/src/app/applications/shares/components/dialogs/share-dialog.component.ts
+++ b/frontend/src/app/applications/shares/components/dialogs/share-dialog.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, EventEmitter, Input, OnInit, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, OnInit, Output } from '@angular/core'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faCog, faPlus, faSpinner, faUsers, faUserShield } from '@fortawesome/free-solid-svg-icons'
@@ -56,12 +56,6 @@ import { ShareRepositoryComponent } from '../utils/share-repository.component'
templateUrl: 'share-dialog.component.html'
})
export class ShareDialogComponent implements OnInit {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- protected readonly layout = inject(LayoutService)
- private readonly userService = inject(UserService)
- private readonly sharesService = inject(SharesService)
- private readonly linksService = inject(LinksService)
- private readonly spacesService = inject(SpacesService)
@Input() share: ShareModel
@Input() file: FileSpace & Pick<FileModel, 'root'>
@Input() parentShareId: number = null
@@ -70,6 +64,8 @@ export class ShareDialogComponent implements OnInit {
@Input() inSharesList = false
@Input() allowFilesOptions = true
@Output() shareChange = new EventEmitter<['add' | 'update' | 'delete', ShareModel]>()
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected readonly layout = inject(LayoutService)
protected readonly icons = {
SHARED: SPACES_ICON.SHARED_WITH_OTHERS,
SHARES: SPACES_ICON.SHARES,
@@ -80,12 +76,16 @@ export class ShareDialogComponent implements OnInit {
faUsers,
faCog
}
- protected readonly user = this.userService.user
protected tabView: undefined | 'members' | 'links'
protected allowedPermissions: Partial<`${SPACE_OPERATION}`>[] = []
protected confirmDeletion = false
protected loading = false
protected submitted = false
+ private readonly userService = inject(UserService)
+ protected readonly user = this.userService.user
+ private readonly sharesService = inject(SharesService)
+ private readonly linksService = inject(LinksService)
+ private readonly spacesService = inject(SpacesService)
ngOnInit() {
if (!this.share) {
diff --git a/frontend/src/app/applications/shares/components/dialogs/shared-children-dialog.component.ts b/frontend/src/app/applications/shares/components/dialogs/shared-children-dialog.component.ts
index ce58bff5..cd56ed90 100644
--- a/frontend/src/app/applications/shares/components/dialogs/shared-children-dialog.component.ts
+++ b/frontend/src/app/applications/shares/components/dialogs/shared-children-dialog.component.ts
@@ -6,7 +6,7 @@
import { NgTemplateOutlet } from '@angular/common'
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, EventEmitter, Input, OnInit, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, OnInit, Output } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import type { ShareChild } from '@sync-in-server/backend/src/applications/shares/models/share-child.model'
import { L10nTranslateDirective } from 'angular-l10n'
@@ -35,19 +35,19 @@ import { ShareDialogComponent } from './share-dialog.component'
styleUrls: ['shared-children-dialog.component.scss']
})
export class SharedChildrenDialogComponent implements OnInit {
- protected readonly layout = inject(LayoutService)
- private readonly sharesService = inject(SharesService)
- private readonly linksService = inject(LinksService)
- private readonly spacesService = inject(SpacesService)
@Input() fromAdmin = false
@Input() share: ShareFileModel
@Input() space: SpaceModel
@Output() sharesCountEvent = new EventEmitter<number>()
+ protected readonly layout = inject(LayoutService)
protected readonly icons = { SHARED: SPACES_ICON.SHARED_WITH_OTHERS, LINKS: SPACES_ICON.LINKS }
protected loading = false
protected childSharesLength = 0
protected childShares: ShareChildModel[]
protected selected: ShareChildModel
+ private readonly sharesService = inject(SharesService)
+ private readonly linksService = inject(LinksService)
+ private readonly spacesService = inject(SpacesService)
ngOnInit() {
this.loadChildShares()
diff --git a/frontend/src/app/applications/shares/components/sidebar/share-selection.component.ts b/frontend/src/app/applications/shares/components/sidebar/share-selection.component.ts
index 06763f7a..18b4344b 100755
--- a/frontend/src/app/applications/shares/components/sidebar/share-selection.component.ts
+++ b/frontend/src/app/applications/shares/components/sidebar/share-selection.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { ChangeDetectionStrategy, Component, input, InputSignal, inject } from '@angular/core'
+import { ChangeDetectionStrategy, Component, inject, input, InputSignal } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } from 'angular-l10n'
import { AutoResizeDirective } from '../../../../common/directives/auto-resize.directive'
@@ -35,13 +35,13 @@ import { ShareRepositoryComponent } from '../utils/share-repository.component'
styles: ['.card {width: 100%; background: transparent; border: none}']
})
export class ShareSelectionComponent {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly layout = inject(LayoutService)
- private readonly sharesService = inject(SharesService)
share: InputSignal<ShareFileModel> = input.required<ShareFileModel>()
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly iconShared = SPACES_ICON.SHARED_WITH_OTHERS
protected readonly cardImageSize = defaultCardImageSize
protected readonly resizeOffset = defaultResizeOffset
+ private readonly layout = inject(LayoutService)
+ private readonly sharesService = inject(SharesService)
childShareDialog(share: ShareFileModel) {
if (!share.counts.shares) return
diff --git a/frontend/src/app/applications/shares/components/utils/share-file-name.component.ts b/frontend/src/app/applications/shares/components/utils/share-file-name.component.ts
index 82aac552..f181530f 100644
--- a/frontend/src/app/applications/shares/components/utils/share-file-name.component.ts
+++ b/frontend/src/app/applications/shares/components/utils/share-file-name.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, Input, OnChanges, OnInit, inject } from '@angular/core'
+import { Component, inject, Input, OnChanges, OnInit } from '@angular/core'
import { L10N_LOCALE, L10nLocale } from 'angular-l10n'
import { pathSlice } from '../../../../common/utils/functions'
import { ShareLinkModel } from '../../../links/models/share-link.model'
@@ -23,8 +23,8 @@ import { ShareModel } from '../../models/share.model'
</div>`
})
export class ShareFileNameComponent implements OnInit, OnChanges {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
@Input({ required: true }) share: ShareModel | ShareLinkModel
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected fileName: string
ngOnInit() {
diff --git a/frontend/src/app/applications/shares/components/utils/share-repository.component.ts b/frontend/src/app/applications/shares/components/utils/share-repository.component.ts
index d168c3a7..31980d9c 100644
--- a/frontend/src/app/applications/shares/components/utils/share-repository.component.ts
+++ b/frontend/src/app/applications/shares/components/utils/share-repository.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, Input, OnChanges, OnInit, inject } from '@angular/core'
+import { Component, inject, Input, OnChanges, OnInit } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { IconDefinition } from '@fortawesome/fontawesome-svg-core'
import { faQuestion } from '@fortawesome/free-solid-svg-icons'
@@ -52,13 +52,13 @@ interface ShareRepository {
`
})
export class ShareRepositoryComponent implements OnInit, OnChanges {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly layout = inject(LayoutService)
@Input({ required: true }) share: Partial<ShareModel> | ShareFileModel | ShareLinkModel
@Input() galleryMode: ViewMode
@Input() showIcon = true
@Input() showFullPath = false
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected repository: ShareRepository
+ private readonly layout = inject(LayoutService)
private unknownRepository: ShareRepository = {
icon: faQuestion,
label: '',
diff --git a/frontend/src/app/applications/shares/services/shares.service.ts b/frontend/src/app/applications/shares/services/shares.service.ts
index 2998baf2..27ede6c2 100644
--- a/frontend/src/app/applications/shares/services/shares.service.ts
+++ b/frontend/src/app/applications/shares/services/shares.service.ts
@@ -5,7 +5,7 @@
*/
import { HttpClient } from '@angular/common/http'
-import { Injectable, inject } from '@angular/core'
+import { inject, Injectable } from '@angular/core'
import { Router } from '@angular/router'
import type { FileSpace } from '@sync-in-server/backend/src/applications/files/interfaces/file-space.interface'
import { API_SHARES_LIST, SHARES_ROUTE } from '@sync-in-server/backend/src/applications/shares/constants/routes'
diff --git a/frontend/src/app/applications/spaces/components/dialogs/space-anchor-file-dialog.component.ts b/frontend/src/app/applications/spaces/components/dialogs/space-anchor-file-dialog.component.ts
index 26110761..c58ff3aa 100644
--- a/frontend/src/app/applications/spaces/components/dialogs/space-anchor-file-dialog.component.ts
+++ b/frontend/src/app/applications/spaces/components/dialogs/space-anchor-file-dialog.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, EventEmitter, Input, OnInit, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, OnInit } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faAnchor, faPlus, faSpinner } from '@fortawesome/free-solid-svg-icons'
import { SPACE_OPERATION } from '@sync-in-server/backend/src/applications/spaces/constants/spaces'
@@ -30,20 +30,20 @@ import { SpaceManageRootsComponent } from '../utils/space-manage-roots.component
templateUrl: 'space-anchor-file-dialog.component.html'
})
export class SpaceAnchorFileDialogComponent implements OnInit {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- protected readonly layout = inject(LayoutService)
- private readonly userService = inject(UserService)
- private spacesService = inject(SpacesService)
@Input({ required: true }) files: FileModel[]
public addAnchoredFiles = new EventEmitter<{ space: SpaceModel; fileNames: string[] }>()
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected readonly layout = inject(LayoutService)
protected readonly icons = { faAnchor, faPlus, faSpinner, SPACES: SPACES_ICON.SPACES }
protected selectedSpace: SpaceModel
// data
protected space: Partial<SpaceModel> = { roots: [] }
- protected readonly user: UserType = this.userService.user
// states
protected submitted = false
protected loading = false
+ private readonly userService = inject(UserService)
+ protected readonly user: UserType = this.userService.user
+ private spacesService = inject(SpacesService)
ngOnInit() {
for (const f of this.files) {
diff --git a/frontend/src/app/applications/spaces/components/dialogs/space-dialog.component.ts b/frontend/src/app/applications/spaces/components/dialogs/space-dialog.component.ts
index 01ef3408..958a632e 100644
--- a/frontend/src/app/applications/spaces/components/dialogs/space-dialog.component.ts
+++ b/frontend/src/app/applications/spaces/components/dialogs/space-dialog.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, EventEmitter, Input, OnInit, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, OnInit, Output } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faAnchor, faCog, faPen, faPlus, faSpinner, faUsers, faUserShield } from '@fortawesome/free-solid-svg-icons'
@@ -59,11 +59,6 @@ import { ExternalFilePathEvent, SpaceRootPathDialogComponent } from './space-roo
templateUrl: 'space-dialog.component.html'
})
export class SpaceDialogComponent implements OnInit {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- protected readonly layout = inject(LayoutService)
- private readonly userService = inject(UserService)
- private readonly spacesService = inject(SpacesService)
- private readonly linksService = inject(LinksService)
@Input({ required: true }) space: SpaceModel = new SpaceModel({
id: 0,
name: '',
@@ -73,6 +68,8 @@ export class SpaceDialogComponent implements OnInit {
storageQuota: null
} as SpaceProps)
@Output() spaceChange = new EventEmitter<['add' | 'update' | 'delete', SpaceModel]>()
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected readonly layout = inject(LayoutService)
protected readonly icons = {
SPACES: SPACES_ICON.SPACES,
LINKS: SPACES_ICON.LINKS,
@@ -84,7 +81,6 @@ export class SpaceDialogComponent implements OnInit {
faCog,
faUsers
}
- protected readonly user: UserType = this.userService.user
protected readonly SPACE_MAX_DISABLED_DAYS = SPACE_MAX_DISABLED_DAYS
// states
protected addRootFileEvent = new Subject<FileTreeEvent | ExternalFilePathEvent>()
@@ -94,6 +90,10 @@ export class SpaceDialogComponent implements OnInit {
protected confirmDeletion = false
protected loading = false
protected submitted = false
+ private readonly userService = inject(UserService)
+ protected readonly user: UserType = this.userService.user
+ private readonly spacesService = inject(SpacesService)
+ private readonly linksService = inject(LinksService)
ngOnInit() {
if (!this.space.id) {
diff --git a/frontend/src/app/applications/spaces/components/dialogs/space-root-path-dialog.component.ts b/frontend/src/app/applications/spaces/components/dialogs/space-root-path-dialog.component.ts
index 4312c094..8f360f76 100644
--- a/frontend/src/app/applications/spaces/components/dialogs/space-root-path-dialog.component.ts
+++ b/frontend/src/app/applications/spaces/components/dialogs/space-root-path-dialog.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, EventEmitter, HostListener, Input, OnInit, Output, inject } from '@angular/core'
+import { Component, EventEmitter, HostListener, inject, Input, OnInit, Output } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faFolderClosed } from '@fortawesome/free-solid-svg-icons'
@@ -25,13 +25,11 @@ export interface ExternalFilePathEvent {
templateUrl: 'space-root-path-dialog.component.html'
})
export class SpaceRootPathDialogComponent implements OnInit {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- protected readonly layout = inject(LayoutService)
- private readonly spacesService = inject(SpacesService)
@Input() currentRoots: SpaceRootModel[] = []
@Output() submitEvent = new EventEmitter<ExternalFilePathEvent>()
@Input() withRootName = true
-
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected readonly layout = inject(LayoutService)
protected readonly icons = { faFolderClosed }
protected newSpaceRoot: { name: string; externalPath: string } = { name: '', externalPath: '' }
// states
@@ -39,6 +37,7 @@ export class SpaceRootPathDialogComponent implements OnInit {
protected rootNameIsValid = false
protected rootPathIsValid = false
protected rootIsValid = false
+ private readonly spacesService = inject(SpacesService)
ngOnInit() {
if (!this.withRootName) {
diff --git a/frontend/src/app/applications/spaces/components/dialogs/space-user-anchors-dialog.component.ts b/frontend/src/app/applications/spaces/components/dialogs/space-user-anchors-dialog.component.ts
index 22a6cee4..8e1d5134 100644
--- a/frontend/src/app/applications/spaces/components/dialogs/space-user-anchors-dialog.component.ts
+++ b/frontend/src/app/applications/spaces/components/dialogs/space-user-anchors-dialog.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, Input, OnInit, inject } from '@angular/core'
+import { Component, inject, Input, OnInit } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faAnchor, faPlus, faSpinner } from '@fortawesome/free-solid-svg-icons'
import type { SpaceRootProps } from '@sync-in-server/backend/src/applications/spaces/models/space-root-props.model'
@@ -28,15 +28,15 @@ import { ExternalFilePathEvent } from './space-root-path-dialog.component'
templateUrl: 'space-user-anchors-dialog.component.html'
})
export class SpaceUserAnchorsDialogComponent implements OnInit {
- protected readonly layout = inject(LayoutService)
- private readonly spacesService = inject(SpacesService)
@Input({ required: true }) space: SpaceModel
@Input({ required: true }) user: UserType
+ protected readonly layout = inject(LayoutService)
protected addRootFileEvent = new Subject<FileTreeEvent | ExternalFilePathEvent>()
protected readonly icons = { faAnchor, faPlus, faSpinner, SPACES: SPACES_ICON.SPACES }
// states
protected submitted = false
protected loading = false
+ private readonly spacesService = inject(SpacesService)
ngOnInit() {
if (this.space?.roots.length) {
diff --git a/frontend/src/app/applications/spaces/components/sidebar/space-selection.component.ts b/frontend/src/app/applications/spaces/components/sidebar/space-selection.component.ts
index 2568ee1d..7f585e83 100755
--- a/frontend/src/app/applications/spaces/components/sidebar/space-selection.component.ts
+++ b/frontend/src/app/applications/spaces/components/sidebar/space-selection.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { ChangeDetectionStrategy, Component, input, InputSignal, inject } from '@angular/core'
+import { ChangeDetectionStrategy, Component, inject, input, InputSignal } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { SPACE_ROLE } from '@sync-in-server/backend/src/applications/spaces/constants/spaces'
import { L10N_LOCALE, L10nLocale, L10nTranslateDirective } from 'angular-l10n'
@@ -37,14 +37,14 @@ import { SpaceUserAnchorsDialogComponent } from '../dialogs/space-user-anchors-d
styles: ['.card {width: 100%; background: transparent; border: none}']
})
export class SpaceSelectionComponent {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly userService = inject(UserService)
- private readonly layout = inject(LayoutService)
space: InputSignal<SpaceModel> = input.required<SpaceModel>()
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly SPACE_ROLE = SPACE_ROLE
protected readonly icons = { SPACES: SPACES_ICON.SPACES, ANCHORED: SPACES_ICON.ANCHORED, SHARED: SPACES_ICON.SHARED_WITH_OTHERS }
protected readonly cardImageSize = defaultCardImageSize
protected resizeOffset = defaultResizeOffset
+ private readonly userService = inject(UserService)
+ private readonly layout = inject(LayoutService)
openSpaceRootsDialog() {
this.layout.openDialog(SpaceUserAnchorsDialogComponent, 'md', {
diff --git a/frontend/src/app/applications/spaces/components/sidebar/trash-selection.component.ts b/frontend/src/app/applications/spaces/components/sidebar/trash-selection.component.ts
index b9324271..c5dc6996 100755
--- a/frontend/src/app/applications/spaces/components/sidebar/trash-selection.component.ts
+++ b/frontend/src/app/applications/spaces/components/sidebar/trash-selection.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { ChangeDetectionStrategy, Component, input, InputSignal, inject } from '@angular/core'
+import { ChangeDetectionStrategy, Component, inject, input, InputSignal } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } from 'angular-l10n'
import { AutoResizeDirective } from '../../../../common/directives/auto-resize.directive'
@@ -21,8 +21,8 @@ import { SPACES_ICON } from '../../spaces.constants'
styles: ['.card {width: 100%; background: transparent; border: none}']
})
export class TrashSelectionComponent {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
trash: InputSignal<TrashModel> = input.required<TrashModel>()
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly iconTrash = SPACES_ICON.TRASH
protected readonly cardImageSize = defaultCardImageSize
protected readonly resizeOffset = defaultResizeOffset
diff --git a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts b/frontend/src/app/applications/spaces/components/spaces-browser.component.ts
index b58aadae..de1aa00d 100644
--- a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts
+++ b/frontend/src/app/applications/spaces/components/spaces-browser.component.ts
@@ -109,22 +109,14 @@ import { SpaceAnchorFileDialogComponent } from './dialogs/space-anchor-file-dial
templateUrl: 'spaces-browser.component.html'
})
export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly router = inject(Router)
- private readonly activatedRoute = inject(ActivatedRoute)
- private readonly zone = inject(NgZone)
- private readonly renderer = inject(Renderer2)
- protected readonly layout = inject(LayoutService)
- private readonly store = inject(StoreService)
- private readonly spacesBrowser = inject(SpacesBrowserService)
- private readonly filesService = inject(FilesService)
- private readonly filesUpload = inject(FilesUploadService)
@ViewChild(VirtualScrollComponent) scrollView: { element: ElementRef; viewPortItems: FileModel[]; scrollInto: (arg: FileModel | number) => void }
@ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild(NavigationViewComponent, { static: true }) btnNavigationView: any
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('MainReadOnlyContextMenu', { static: true }) mainReadOnlyContextMenu: ContextMenuComponent<any>
@ViewChild('FileContextMenu', { static: true }) fileContextMenu: ContextMenuComponent<any>
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected readonly layout = inject(LayoutService)
// Static
protected readonly icons = {
SPACES: SPACES_ICON.SPACES,
@@ -162,10 +154,6 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
protected locationNotFound = false
protected forbiddenResource = false
protected serverError = false
- // Space
- private baseRepoUrl: string
- private currentRoute: string
- private isPersonalSpace: boolean
protected isFilesRepo: boolean
protected isSharesRepo: boolean
protected isTrashRepo: boolean
@@ -180,16 +168,11 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
protected hasDisabledItemsInSelection = false
protected canCompress = true
protected renamingInProgress = false
- protected isElectronApp = this.store.isElectronApp()
// Upload
protected supportUploadFolder = false
- private uploadButtonsShowed = false
- // Others
- private subscriptions: Subscription[] = []
// Settings
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected readonly TAB_MENU = TAB_MENU
- private focusOnSelect: string
protected tableHeaders: Record<'name' | 'anchored' | 'infos' | 'permissions' | 'size' | 'mtime', TableHeaderConfig> = {
name: {
label: 'Name',
@@ -233,6 +216,29 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
sortable: true
}
}
+ protected btnSortFields = { name: 'Name', isDir: 'Type', size: 'Size', mtime: 'Modified' }
+ protected galleryMode: ViewMode
+ // Data
+ protected files: FileModel[] = []
+ protected selection: FileModel[] = []
+ protected stats = { dirs: 0, files: 0, size: 0, elements: 0 }
+ private readonly router = inject(Router)
+ private readonly activatedRoute = inject(ActivatedRoute)
+ private readonly zone = inject(NgZone)
+ private readonly renderer = inject(Renderer2)
+ private readonly store = inject(StoreService)
+ protected isElectronApp = this.store.isElectronApp()
+ private readonly spacesBrowser = inject(SpacesBrowserService)
+ private readonly filesService = inject(FilesService)
+ private readonly filesUpload = inject(FilesUploadService)
+ // Space
+ private baseRepoUrl: string
+ private currentRoute: string
+ private isPersonalSpace: boolean
+ private uploadButtonsShowed = false
+ // Others
+ private subscriptions: Subscription[] = []
+ private focusOnSelect: string
// Sort
private readonly sortSettings: SortSettings = {
default: [
@@ -249,8 +255,6 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
mtime: [{ prop: 'mtime', type: 'number' }]
}
protected sortTable = new SortTable(this.constructor.name, this.sortSettings)
- protected btnSortFields = { name: 'Name', isDir: 'Type', size: 'Size', mtime: 'Modified' }
- protected galleryMode: ViewMode
// DnD part
private eventDragOverHandler: () => void | undefined
private eventDragEnterHandler: () => void | undefined
@@ -260,10 +264,6 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
private eventDropHandler: () => void | undefined
private eventKeysHandler: () => void | undefined
private moveFromDrag = false
- // Data
- protected files: FileModel[] = []
- protected selection: FileModel[] = []
- protected stats = { dirs: 0, files: 0, size: 0, elements: 0 }
ngOnInit() {
this.galleryMode = this.btnNavigationView.currentView()
@@ -317,47 +317,6 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
}
}
- private setSpace(route: { repository: SPACE_REPOSITORY; routes: UrlSegment[] }) {
- this.currentRoute = this.filesService.currentRoute = `${route.repository}${pathFromRoutes(route.routes)}`
- this.baseRepoUrl = `${route.repository}${route.routes.length ? `/${route.routes[0].path}` : ''}`
- this.isFilesRepo = route.repository === SPACES_PATH.FILES
- this.isSharesRepo = route.repository === SPACES_PATH.SHARES
- this.isTrashRepo = route.repository === SPACES_PATH.TRASH
- this.inRootSpace = this.isSharesRepo ? route.routes.length === 0 : route.routes.length === 1
- this.inSharesList = this.isSharesRepo && this.inRootSpace
- this.spacesBrowser.setEnvironment(route.repository, route.routes)
- this.isPersonalSpace = this.spacesBrowser.inPersonalSpace
- this.loadFiles()
- }
-
- private onFileEvent(ev: FileEvent) {
- if (ev.archiveId) {
- this.filesService.downloadTaskArchive(ev.archiveId)
- return
- }
- const matchDstPath = ev?.fileDstPath === this.currentRoute
- if (ev.filePath === this.currentRoute || matchDstPath) {
- // special case on move task, the src is removed, the dst is added
- const mustReloadFocus = matchDstPath && ev.reloadFocusOnDst
- if (ev.fileName) {
- if (ev.focus || mustReloadFocus) this.focusOnSelect = ev.fileName
- if (ev.delete && !mustReloadFocus) {
- if (ev.status === FileTaskStatus.SUCCESS) {
- this.files = this.files.filter((file: FileModel) => file.name !== ev.fileName)
- this.updateFilesStats(this.files)
- this.resetFilesSelection()
- } else {
- const file = this.files.find((file: FileModel) => file.name === ev.fileName)
- if (file) {
- file.isBeingDeleted = false
- }
- }
- }
- }
- if (ev.reload || mustReloadFocus) this.loadFiles()
- }
- }
-
loadFiles() {
this.loading = true
this.forbiddenResource = false
@@ -462,17 +421,6 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
}
}
- private removeFiles() {
- const selection = this.selection.filter((f: FileModel) => !f.root?.alias)
- if (this.selection.length !== selection.length) {
- this.layout.sendNotification('warning', 'Remove', 'You can not remove an anchored file')
- }
- // process other files
- if (selection.length) {
- this.filesService.delete(selection)
- }
- }
-
copyMoveFiles() {
this.layout.showRSideBarTab(TAB_MENU.TREE, true)
setTimeout(() => this.filesService.treeCopyMoveOn.next(), 100)
@@ -540,40 +488,13 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
}
addToSync() {
- this.router
- .navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, SYNC_PATH.WIZARD_CLIENT], { state: { file: this.selection[0] } })
- .catch(console.error)
+ this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, SYNC_PATH.WIZARD_CLIENT], { state: { file: this.selection[0] } }).catch(console.error)
}
addToClipboard() {
this.filesService.addToClipboard(this.selection)
}
- private setFilePermissionsAndSpace(): Partial<FileSpace> {
- if (this.selection[0]?.root && this.selection[0].root.permissions.indexOf(SPACE_OPERATION.SHARE_OUTSIDE) === -1) {
- // space case, if file is a space root without the share permissions
- this.layout.sendNotification('warning', this.selection[0].name, 'You do not have share permission')
- return null
- }
- const f: Partial<FileSpace> = { ...this.selection[0] }
- if (this.isPersonalSpace) {
- f.permissions = this.spacePermissions
- } else if (this.selection[0]?.root) {
- f.permissions = this.selection[0].root.permissions
- if (this.inSharesList) {
- f.space = { alias: this.selection[0].root.alias, name: this.selection[0].root.alias, root: undefined }
- } else {
- const spaceAlias = this.currentRoute.split('/')[1]
- f.space = { alias: spaceAlias, name: spaceAlias, root: { alias: this.selection[0].root.alias, name: this.selection[0].name } }
- }
- } else {
- f.permissions = this.spacePermissions
- const [spaceAlias, rootAlias] = this.currentRoute.split('/').slice(1, 3)
- f.space = { alias: spaceAlias, name: spaceAlias, root: { alias: rootAlias, name: rootAlias } }
- }
- return f
- }
-
openShareDialog() {
const f: Partial<FileSpace> = this.setFilePermissionsAndSpace()
if (f === null) return
@@ -678,13 +599,6 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
this.layout.openDialog(FilesNewDialogComponent, null, { initialState: { files: this.files, inputType: type } as FilesNewDialogComponent })
}
- private openViewerDialog(mode: 'view' | 'edit') {
- this.layout.openDialog(FilesViewerDialogComponent, 'full', {
- id: this.selection[0].id,
- initialState: { currentFile: this.selection[0], mode: mode } as FilesViewerDialogComponent
- })
- }
-
openEmptyTrashDialog() {
if (this.isTrashRepo && this.inRootSpace) {
this.layout.openDialog(FilesTrashEmptyDialogComponent, null, { initialState: { files: this.files } as FilesTrashEmptyDialogComponent })
@@ -702,6 +616,90 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
modalRef.content.removeFiles.pipe(take(1)).subscribe(() => this.removeFiles())
}
+ private setSpace(route: { repository: SPACE_REPOSITORY; routes: UrlSegment[] }) {
+ this.currentRoute = this.filesService.currentRoute = `${route.repository}${pathFromRoutes(route.routes)}`
+ this.baseRepoUrl = `${route.repository}${route.routes.length ? `/${route.routes[0].path}` : ''}`
+ this.isFilesRepo = route.repository === SPACES_PATH.FILES
+ this.isSharesRepo = route.repository === SPACES_PATH.SHARES
+ this.isTrashRepo = route.repository === SPACES_PATH.TRASH
+ this.inRootSpace = this.isSharesRepo ? route.routes.length === 0 : route.routes.length === 1
+ this.inSharesList = this.isSharesRepo && this.inRootSpace
+ this.spacesBrowser.setEnvironment(route.repository, route.routes)
+ this.isPersonalSpace = this.spacesBrowser.inPersonalSpace
+ this.loadFiles()
+ }
+
+ private onFileEvent(ev: FileEvent) {
+ if (ev.archiveId) {
+ this.filesService.downloadTaskArchive(ev.archiveId)
+ return
+ }
+ const matchDstPath = ev?.fileDstPath === this.currentRoute
+ if (ev.filePath === this.currentRoute || matchDstPath) {
+ // special case on move task, the src is removed, the dst is added
+ const mustReloadFocus = matchDstPath && ev.reloadFocusOnDst
+ if (ev.fileName) {
+ if (ev.focus || mustReloadFocus) this.focusOnSelect = ev.fileName
+ if (ev.delete && !mustReloadFocus) {
+ if (ev.status === FileTaskStatus.SUCCESS) {
+ this.files = this.files.filter((file: FileModel) => file.name !== ev.fileName)
+ this.updateFilesStats(this.files)
+ this.resetFilesSelection()
+ } else {
+ const file = this.files.find((file: FileModel) => file.name === ev.fileName)
+ if (file) {
+ file.isBeingDeleted = false
+ }
+ }
+ }
+ }
+ if (ev.reload || mustReloadFocus) this.loadFiles()
+ }
+ }
+
+ private removeFiles() {
+ const selection = this.selection.filter((f: FileModel) => !f.root?.alias)
+ if (this.selection.length !== selection.length) {
+ this.layout.sendNotification('warning', 'Remove', 'You can not remove an anchored file')
+ }
+ // process other files
+ if (selection.length) {
+ this.filesService.delete(selection)
+ }
+ }
+
+ private setFilePermissionsAndSpace(): Partial<FileSpace> {
+ if (this.selection[0]?.root && this.selection[0].root.permissions.indexOf(SPACE_OPERATION.SHARE_OUTSIDE) === -1) {
+ // space case, if file is a space root without the share permissions
+ this.layout.sendNotification('warning', this.selection[0].name, 'You do not have share permission')
+ return null
+ }
+ const f: Partial<FileSpace> = { ...this.selection[0] }
+ if (this.isPersonalSpace) {
+ f.permissions = this.spacePermissions
+ } else if (this.selection[0]?.root) {
+ f.permissions = this.selection[0].root.permissions
+ if (this.inSharesList) {
+ f.space = { alias: this.selection[0].root.alias, name: this.selection[0].root.alias, root: undefined }
+ } else {
+ const spaceAlias = this.currentRoute.split('/')[1]
+ f.space = { alias: spaceAlias, name: spaceAlias, root: { alias: this.selection[0].root.alias, name: this.selection[0].name } }
+ }
+ } else {
+ f.permissions = this.spacePermissions
+ const [spaceAlias, rootAlias] = this.currentRoute.split('/').slice(1, 3)
+ f.space = { alias: spaceAlias, name: spaceAlias, root: { alias: rootAlias, name: rootAlias } }
+ }
+ return f
+ }
+
+ private openViewerDialog(mode: 'view' | 'edit') {
+ this.layout.openDialog(FilesViewerDialogComponent, 'full', {
+ id: this.selection[0].id,
+ initialState: { currentFile: this.selection[0], mode: mode } as FilesViewerDialogComponent
+ })
+ }
+
private focusOn(select: string) {
if (select) {
if (this.files.length) {
diff --git a/frontend/src/app/applications/spaces/components/spaces-nav.component.ts b/frontend/src/app/applications/spaces/components/spaces-nav.component.ts
index ecfd99bf..dbb1164a 100644
--- a/frontend/src/app/applications/spaces/components/spaces-nav.component.ts
+++ b/frontend/src/app/applications/spaces/components/spaces-nav.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, OnDestroy, inject } from '@angular/core'
+import { Component, inject, OnDestroy } from '@angular/core'
import { RouterOutlet } from '@angular/router'
import { faCommentDots } from '@fortawesome/free-regular-svg-icons'
import { faClipboardList, faFolderTree, faInfo } from '@fortawesome/free-solid-svg-icons'
diff --git a/frontend/src/app/applications/spaces/components/spaces.component.ts b/frontend/src/app/applications/spaces/components/spaces.component.ts
index 3a81e7ef..8cfb6959 100644
--- a/frontend/src/app/applications/spaces/components/spaces.component.ts
+++ b/frontend/src/app/applications/spaces/components/spaces.component.ts
@@ -69,18 +69,13 @@ import { SpaceUserAnchorsDialogComponent } from './dialogs/space-user-anchors-di
templateUrl: 'spaces.component.html'
})
export class SpacesComponent implements OnInit {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- protected readonly layout = inject(LayoutService)
- private readonly router = inject(Router)
- private readonly activatedRoute = inject(ActivatedRoute)
- private readonly spacesService = inject(SpacesService)
- private readonly store = inject(StoreService)
- private readonly userService = inject(UserService)
@ViewChild(VirtualScrollComponent) scrollView: { element: ElementRef; viewPortItems: SpaceModel[]; scrollInto: (arg: SpaceModel | number) => void }
@ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild(NavigationViewComponent, { static: true }) btnNavigationView: NavigationViewComponent
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('TargetContextMenu', { static: true }) targetContextMenu: ContextMenuComponent<any>
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected readonly layout = inject(LayoutService)
protected readonly SPACE_ROLE = SPACE_ROLE
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected galleryMode: ViewMode
@@ -142,6 +137,18 @@ export class SpacesComponent implements OnInit {
sortable: true
}
}
+ protected btnSortFields = { name: 'Name', managers: 'Managers', permissions: 'Permissions', modified: 'Modified' }
+ protected loading = false
+ protected spaces: SpaceModel[] = []
+ protected selected: SpaceModel = null
+ protected canCreateSpace = false
+ protected canEditSpace = false
+ protected canManageRoots = false
+ private readonly router = inject(Router)
+ private readonly activatedRoute = inject(ActivatedRoute)
+ private readonly spacesService = inject(SpacesService)
+ private readonly store = inject(StoreService)
+ private readonly userService = inject(UserService)
private readonly sortSettings: SortSettings = {
default: [{ prop: 'name', type: 'string' }],
name: [{ prop: 'name', type: 'string' }],
@@ -150,15 +157,8 @@ export class SpacesComponent implements OnInit {
modified: [{ prop: 'modified', type: 'date' }]
}
protected sortTable = new SortTable(this.constructor.name, this.sortSettings)
- protected btnSortFields = { name: 'Name', managers: 'Managers', permissions: 'Permissions', modified: 'Modified' }
// States
private focusOnSelect: string
- protected loading = false
- protected spaces: SpaceModel[] = []
- protected selected: SpaceModel = null
- protected canCreateSpace = false
- protected canEditSpace = false
- protected canManageRoots = false
constructor() {
this.loadSpaces()
@@ -214,14 +214,6 @@ export class SpacesComponent implements OnInit {
this.store.spaceSelection.set(this.selected)
}
- private focusOn(select: string) {
- const s = this.spaces.find((space) => space.name === select)
- if (s) {
- setTimeout(() => this.scrollView.scrollInto(s), 100)
- this.onSelect(s)
- }
- }
-
sortBy(column: string, toUpdate = true, collection?: SpaceModel[]) {
this.spaces = this.sortTable.sortBy(column, toUpdate, collection || this.spaces)
}
@@ -304,4 +296,12 @@ export class SpacesComponent implements OnInit {
})
modalRef.content.sharesCountEvent.subscribe((sharesCount: number) => (this.selected.counts.shares = sharesCount))
}
+
+ private focusOn(select: string) {
+ const s = this.spaces.find((space) => space.name === select)
+ if (s) {
+ setTimeout(() => this.scrollView.scrollInto(s), 100)
+ this.onSelect(s)
+ }
+ }
}
diff --git a/frontend/src/app/applications/spaces/components/trash.component.ts b/frontend/src/app/applications/spaces/components/trash.component.ts
index a557313f..2a674235 100644
--- a/frontend/src/app/applications/spaces/components/trash.component.ts
+++ b/frontend/src/app/applications/spaces/components/trash.component.ts
@@ -44,16 +44,13 @@ import { SPACES_ICON, SPACES_PATH, SPACES_TITLE } from '../spaces.constants'
templateUrl: 'trash.component.html'
})
export class TrashComponent implements OnInit {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- protected readonly layout = inject(LayoutService)
- private readonly router = inject(Router)
- private readonly store = inject(StoreService)
- private readonly spacesService = inject(SpacesService)
@ViewChild(VirtualScrollComponent) scrollView: { element: ElementRef; viewPortItems: TrashModel[]; scrollInto: (arg: TrashModel | number) => void }
@ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild(NavigationViewComponent, { static: true }) btnNavigationView: NavigationViewComponent
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('TargetContextMenu', { static: true }) targetContextMenu: ContextMenuComponent<any>
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected readonly layout = inject(LayoutService)
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected readonly icons = { SPACES: SPACES_ICON.SPACES, PERSONAL: SPACES_ICON.PERSONAL, faArrowDown, faArrowUp, faArrowRotateRight, faCircleInfo }
protected readonly TAB_MENU = TAB_MENU
@@ -89,6 +86,10 @@ export class TrashComponent implements OnInit {
sortable: true
}
}
+ protected btnSortFields = { name: 'Name', nb: 'Elements', mtime: 'Modified' }
+ private readonly router = inject(Router)
+ private readonly store = inject(StoreService)
+ private readonly spacesService = inject(SpacesService)
private readonly sortSettings: SortSettings = {
default: [
{ prop: 'isPersonal', type: 'number' },
@@ -99,7 +100,6 @@ export class TrashComponent implements OnInit {
modified: [{ prop: 'mtime', type: 'date' }]
}
protected sortTable = new SortTable(this.constructor.name, this.sortSettings)
- protected btnSortFields = { name: 'Name', nb: 'Elements', mtime: 'Modified' }
constructor() {
this.loadTrashBins()
diff --git a/frontend/src/app/applications/spaces/components/utils/space-manage-roots.component.ts b/frontend/src/app/applications/spaces/components/utils/space-manage-roots.component.ts
index f954497b..0977cf28 100644
--- a/frontend/src/app/applications/spaces/components/utils/space-manage-roots.component.ts
+++ b/frontend/src/app/applications/spaces/components/utils/space-manage-roots.component.ts
@@ -5,7 +5,7 @@
*/
import { KeyValuePipe } from '@angular/common'
-import { Component, ElementRef, Input, OnDestroy, OnInit, ViewChild, inject } from '@angular/core'
+import { Component, ElementRef, inject, Input, OnDestroy, OnInit, ViewChild } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faPen, faTimes } from '@fortawesome/free-solid-svg-icons'
@@ -44,16 +44,16 @@ import { ExternalFilePathEvent } from '../dialogs/space-root-path-dialog.compone
templateUrl: 'space-manage-roots.component.html'
})
export class SpaceManageRootsComponent implements OnInit, OnDestroy {
- protected locale = inject<L10nLocale>(L10N_LOCALE)
@ViewChild('InputRename') inputRename: ElementRef
@Input({ required: true }) space: Partial<SpaceModel>
@Input({ required: true }) user: UserType
@Input() showUsers = true
@Input() addRootFile: Subject<FileTreeEvent | ExternalFilePathEvent> = null
- private subscription: Subscription = null
+ protected locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly icons = { faTimes, faPen }
protected readonly SPACES_PERMISSIONS_TEXT = SPACES_PERMISSIONS_TEXT
protected readonly originalOrderKeyValue = originalOrderKeyValue
+ private subscription: Subscription = null
ngOnInit() {
if (this.addRootFile) {
diff --git a/frontend/src/app/applications/spaces/services/spaces-browser.service.ts b/frontend/src/app/applications/spaces/services/spaces-browser.service.ts
index 4fd97894..8defa034 100644
--- a/frontend/src/app/applications/spaces/services/spaces-browser.service.ts
+++ b/frontend/src/app/applications/spaces/services/spaces-browser.service.ts
@@ -5,7 +5,7 @@
*/
import { HttpClient, HttpErrorResponse } from '@angular/common/http'
-import { Injectable, inject } from '@angular/core'
+import { inject, Injectable } from '@angular/core'
import { UrlSegment } from '@angular/router'
import { IconDefinition } from '@fortawesome/fontawesome-svg-core'
import { API_SPACES_BROWSE } from '@sync-in-server/backend/src/applications/spaces/constants/routes'
@@ -20,6 +20,7 @@ import { SPACES_ICON, SPACES_PATH, SPACES_TITLE } from '../spaces.constants'
@Injectable({ providedIn: 'root' })
export class SpacesBrowserService {
+ public inPersonalSpace = false
private readonly http = inject(HttpClient)
private readonly layout = inject(LayoutService)
private browseApi: string
@@ -28,7 +29,6 @@ export class SpacesBrowserService {
private breadCrumbFilesRepo = false
private inShareRepo = false
private inRootSpace = false
- public inPersonalSpace = false
setEnvironment(repository: SPACE_REPOSITORY, routes: UrlSegment[]) {
this.breadCrumbFilesRepo = SPACES_PATH.FILES === repository
diff --git a/frontend/src/app/applications/spaces/services/spaces.service.ts b/frontend/src/app/applications/spaces/services/spaces.service.ts
index 59289d5e..9202b04b 100644
--- a/frontend/src/app/applications/spaces/services/spaces.service.ts
+++ b/frontend/src/app/applications/spaces/services/spaces.service.ts
@@ -5,7 +5,7 @@
*/
import { HttpClient } from '@angular/common/http'
-import { Injectable, inject } from '@angular/core'
+import { inject, Injectable } from '@angular/core'
import type { CreateOrUpdateShareDto } from '@sync-in-server/backend/src/applications/shares/dto/create-or-update-share.dto'
import type { ShareProps } from '@sync-in-server/backend/src/applications/shares/interfaces/share-props.interface'
import type { ShareChild } from '@sync-in-server/backend/src/applications/shares/models/share-child.model'
diff --git a/frontend/src/app/applications/sync/components/dialogs/sync-client-delete.dialog.component.ts b/frontend/src/app/applications/sync/components/dialogs/sync-client-delete.dialog.component.ts
index 9645e625..f0c1cb96 100755
--- a/frontend/src/app/applications/sync/components/dialogs/sync-client-delete.dialog.component.ts
+++ b/frontend/src/app/applications/sync/components/dialogs/sync-client-delete.dialog.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { ChangeDetectionStrategy, Component, EventEmitter, HostListener, Input, Output, inject } from '@angular/core'
+import { ChangeDetectionStrategy, Component, EventEmitter, HostListener, inject, Input, Output } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faSpinner, faTrashCan } from '@fortawesome/free-solid-svg-icons'
import { L10nTranslateDirective } from 'angular-l10n'
@@ -19,12 +19,12 @@ import { SyncService } from '../../services/sync.service'
templateUrl: './sync-client-delete.dialog.component.html'
})
export class SyncClientDeleteDialogComponent {
- protected readonly layout = inject(LayoutService)
- private readonly syncService = inject(SyncService)
@Input() client: SyncClientModel
@Output() wasDeleted = new EventEmitter()
+ protected readonly layout = inject(LayoutService)
protected readonly icons = { faSpinner, faTrashCan }
protected submitted = false
+ private readonly syncService = inject(SyncService)
@HostListener('document:keyup.enter')
onEnter() {
diff --git a/frontend/src/app/applications/sync/components/dialogs/sync-path-report.dialog.component.ts b/frontend/src/app/applications/sync/components/dialogs/sync-path-report.dialog.component.ts
index 92da716b..381a8ddb 100644
--- a/frontend/src/app/applications/sync/components/dialogs/sync-path-report.dialog.component.ts
+++ b/frontend/src/app/applications/sync/components/dialogs/sync-path-report.dialog.component.ts
@@ -5,7 +5,7 @@
*/
import { KeyValuePipe } from '@angular/common'
-import { Component, Input, OnDestroy, OnInit, signal, ViewChild, WritableSignal, inject } from '@angular/core'
+import { Component, inject, Input, OnDestroy, OnInit, signal, ViewChild, WritableSignal } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faArrowDown, faArrowUp, faFilter, faFlask, faMapMarkerAlt, faRotate, faSpinner, faStop } from '@fortawesome/free-solid-svg-icons'
@@ -56,10 +56,6 @@ import { SYNC_ICON } from '../../sync.constants'
})
export class SyncPathReportDialogComponent implements OnInit, OnDestroy {
locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly layout = inject(LayoutService)
- private readonly electron = inject(Electron)
- private readonly store = inject(StoreService)
- private readonly syncService = inject(SyncService)
@ViewChild(AutoResizeDirective, { static: true }) autoResizeDirective: AutoResizeDirective
@ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@Input() syncPath: SyncPathModel
@@ -96,12 +92,6 @@ export class SyncPathReportDialogComponent implements OnInit, OnDestroy {
sortable: true
}
}
- private readonly sortSettings: SortSettings = {
- default: [{ prop: 'nbTasks', type: 'number' }],
- action: [{ prop: 'actionText', type: 'string' }],
- file: [{ prop: 'file', type: 'string' }]
- }
- protected sortTable = new SortTable(this.constructor.name, this.sortSettings)
protected readonly itemsPerPage = 500
protected currentPage = 1
protected running = false
@@ -110,6 +100,16 @@ export class SyncPathReportDialogComponent implements OnInit, OnDestroy {
protected showFiltered = false
protected count = { actions: 0, filtered: 0 }
protected transfers: WritableSignal<SyncTransferModel[]> = signal([])
+ private readonly layout = inject(LayoutService)
+ private readonly electron = inject(Electron)
+ private readonly store = inject(StoreService)
+ private readonly syncService = inject(SyncService)
+ private readonly sortSettings: SortSettings = {
+ default: [{ prop: 'nbTasks', type: 'number' }],
+ action: [{ prop: 'actionText', type: 'string' }],
+ file: [{ prop: 'file', type: 'string' }]
+ }
+ protected sortTable = new SortTable(this.constructor.name, this.sortSettings)
private subscriptions: Subscription[] = []
ngOnInit() {
diff --git a/frontend/src/app/applications/sync/components/dialogs/sync-path-settings.dialog.component.ts b/frontend/src/app/applications/sync/components/dialogs/sync-path-settings.dialog.component.ts
index a6990db2..29de0950 100755
--- a/frontend/src/app/applications/sync/components/dialogs/sync-path-settings.dialog.component.ts
+++ b/frontend/src/app/applications/sync/components/dialogs/sync-path-settings.dialog.component.ts
@@ -25,13 +25,12 @@ import { SyncPathSettingsComponent } from '../shared/sync-path-settings.componen
templateUrl: 'sync-path-settings.dialog.component.html'
})
export class SyncPathSettingsDialogComponent implements OnInit {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- protected readonly layout = inject(LayoutService)
- protected readonly store = inject(StoreService)
- private readonly syncService = inject(SyncService)
@Input({ required: true }) syncPathSelected: SyncPathModel
@Input() syncClientSelected: SyncClientModel // not needed from client, only for web
@Output() mustRefresh = new EventEmitter<void>()
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
+ protected readonly layout = inject(LayoutService)
+ protected readonly store = inject(StoreService)
protected readonly ELECTRON_DIALOG = ELECTRON_DIALOG
protected readonly SYNC_PATH_FILTER_TYPE = SYNC_PATH_FILTER_TYPE
protected syncPath: SyncPathModel
@@ -47,6 +46,7 @@ export class SyncPathSettingsDialogComponent implements OnInit {
}
protected readonly icons = { faTimes, faRotate }
protected confirmDeletion = false
+ private readonly syncService = inject(SyncService)
ngOnInit() {
this.syncPath = new SyncPathModel(JSON.parse(JSON.stringify(this.syncPathSelected)))
diff --git a/frontend/src/app/applications/sync/components/dialogs/sync-transfers-delete.dialog.component.ts b/frontend/src/app/applications/sync/components/dialogs/sync-transfers-delete.dialog.component.ts
index 8fbe684b..08084bee 100644
--- a/frontend/src/app/applications/sync/components/dialogs/sync-transfers-delete.dialog.component.ts
+++ b/frontend/src/app/applications/sync/components/dialogs/sync-transfers-delete.dialog.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, EventEmitter, Input, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, Output } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faTrashCan } from '@fortawesome/free-solid-svg-icons'
import { L10nTranslateDirective } from 'angular-l10n'
@@ -18,11 +18,11 @@ import { SyncService } from '../../services/sync.service'
templateUrl: './sync-transfers-delete.dialog.component.html'
})
export class SyncTransfersDeleteDialogComponent {
- protected readonly layout = inject(LayoutService)
- private readonly syncService = inject(SyncService)
@Input() syncPath: SyncPathModel = null
@Output() wasDeleted = new EventEmitter<void>()
+ protected readonly layout = inject(LayoutService)
protected readonly icons = { faTrashCan }
+ private readonly syncService = inject(SyncService)
doClear() {
this.syncService.deleteTransfers(this.syncPath?.id).then(() => {
diff --git a/frontend/src/app/applications/sync/components/shared/sync-path-settings.component.ts b/frontend/src/app/applications/sync/components/shared/sync-path-settings.component.ts
index 14582b08..8d478d22 100755
--- a/frontend/src/app/applications/sync/components/shared/sync-path-settings.component.ts
+++ b/frontend/src/app/applications/sync/components/shared/sync-path-settings.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, Input, inject } from '@angular/core'
+import { Component, inject, Input } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import {
@@ -35,11 +35,11 @@ import { SyncPathDirectionIconComponent } from '../utils/sync-path-direction-ico
templateUrl: './sync-path-settings.component.html'
})
export class SyncPathSettingsComponent {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
@Input() syncPath: SyncPathModel
@Input() direction = 'center'
@Input() showPaths = false
@Input() size: 'small' | 'large' = 'small'
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected icons = {
CLIENT: SYNC_ICON.CLIENT,
SERVER: SYNC_ICON.SERVER,
diff --git a/frontend/src/app/applications/sync/components/sync-clients.component.ts b/frontend/src/app/applications/sync/components/sync-clients.component.ts
index e229bd38..b43729ac 100644
--- a/frontend/src/app/applications/sync/components/sync-clients.component.ts
+++ b/frontend/src/app/applications/sync/components/sync-clients.component.ts
@@ -47,9 +47,6 @@ import { SyncPathSettingsDialogComponent } from './dialogs/sync-path-settings.di
})
export class SyncClientsComponent {
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly router = inject(Router)
- private readonly layout = inject(LayoutService)
- private readonly syncService = inject(SyncService)
protected readonly icons = {
faArrowRotateRight,
faTrashCan,
@@ -65,12 +62,15 @@ export class SyncClientsComponent {
faPen,
faKey
}
- private focusOnSelectId: string
- private focusOnSelectPathId: number
protected loading = false
protected selected: SyncClientModel
protected selectedPath: SyncPathModel
protected clients: SyncClientModel[] = []
+ private readonly router = inject(Router)
+ private readonly layout = inject(LayoutService)
+ private readonly syncService = inject(SyncService)
+ private focusOnSelectId: string
+ private focusOnSelectPathId: number
constructor() {
this.layout.setBreadcrumbIcon(USER_ICON.CLIENTS)
diff --git a/frontend/src/app/applications/sync/components/sync-paths.component.ts b/frontend/src/app/applications/sync/components/sync-paths.component.ts
index 64937cb3..3da1e345 100644
--- a/frontend/src/app/applications/sync/components/sync-paths.component.ts
+++ b/frontend/src/app/applications/sync/components/sync-paths.component.ts
@@ -75,14 +75,15 @@ import { SyncPathSchedulerComponent } from './utils/sync-path-scheduler.componen
})
export class SyncPathsComponent implements OnInit, OnDestroy {
locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly router = inject(Router)
- protected readonly store = inject(StoreService)
- private readonly layout = inject(LayoutService)
- private readonly syncService = inject(SyncService)
@ViewChild(AutoResizeDirective, { static: true }) autoResize: AutoResizeDirective
@ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild('SyncPathContextMenu', { static: true }) syncPathContextMenu: ContextMenuComponent<any>
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
+ // data
+ public syncsInProgress: SyncStatus[] = []
+ public syncPathSelected: SyncPathModel = null
+ public allSyncsRunning = false
+ protected readonly store = inject(StoreService)
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected readonly icons = {
faCalendarXmark,
@@ -163,6 +164,13 @@ export class SyncPathsComponent implements OnInit, OnDestroy {
sortable: true
}
}
+ // constants
+ protected readonly SYNC_PATH_MODE = SYNC_PATH_MODE
+ protected readonly CLIENT_SCHEDULER_STATE = CLIENT_SCHEDULER_STATE
+ protected readonly SYNC_PATH_CONFLICT_MODE = SYNC_PATH_CONFLICT_MODE
+ private readonly router = inject(Router)
+ private readonly layout = inject(LayoutService)
+ private readonly syncService = inject(SyncService)
private readonly sortSettings: SortSettings = {
default: [{ prop: 'settings.name', type: 'string' }],
name: [{ prop: 'settings.name', type: 'string' }],
@@ -173,14 +181,6 @@ export class SyncPathsComponent implements OnInit, OnDestroy {
lastSync: [{ prop: 'lastSync', type: 'date' }]
}
protected sortTable = new SortTable(this.constructor.name, this.sortSettings)
- // constants
- protected readonly SYNC_PATH_MODE = SYNC_PATH_MODE
- protected readonly CLIENT_SCHEDULER_STATE = CLIENT_SCHEDULER_STATE
- protected readonly SYNC_PATH_CONFLICT_MODE = SYNC_PATH_CONFLICT_MODE
- // data
- public syncsInProgress: SyncStatus[] = []
- public syncPathSelected: SyncPathModel = null
- public allSyncsRunning = false
private subscriptions: Subscription[] = []
private focusOnPathId: number = null
private focusOnPathSettings = false
diff --git a/frontend/src/app/applications/sync/components/sync-transfers.component.ts b/frontend/src/app/applications/sync/components/sync-transfers.component.ts
index 5c181863..c828ecea 100644
--- a/frontend/src/app/applications/sync/components/sync-transfers.component.ts
+++ b/frontend/src/app/applications/sync/components/sync-transfers.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
import { KeyValuePipe } from '@angular/common'
-import { Component, effect, ElementRef, ViewChild, inject } from '@angular/core'
+import { Component, effect, ElementRef, inject, ViewChild } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { Router } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
@@ -43,16 +43,16 @@ import { SyncTransfersDeleteDialogComponent } from './dialogs/sync-transfers-del
})
export class SyncTransfersComponent {
locale = inject<L10nLocale>(L10N_LOCALE)
- protected readonly store = inject(StoreService)
- private readonly router = inject(Router)
- private readonly layout = inject(LayoutService)
- private readonly syncService = inject(SyncService)
@ViewChild(VirtualScrollComponent) scrollView: {
element: ElementRef
viewPortItems: SyncTransferModel[]
scrollInto: (arg: SyncTransferModel | number) => void
}
@ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
+ public action: string = null
+ public syncPathSelected: SyncPathModel = null
+ public transfers: SyncTransferModel[] = []
+ protected readonly store = inject(StoreService)
// Sort
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected tableHeaders: Record<'action' | 'sync' | 'file' | 'date', TableHeaderConfig> = {
@@ -90,6 +90,10 @@ export class SyncTransfersComponent {
sortable: true
}
}
+ protected readonly icons = { faRedo, faTrashCan, faArrowDown, faArrowUp }
+ private readonly router = inject(Router)
+ private readonly layout = inject(LayoutService)
+ private readonly syncService = inject(SyncService)
private readonly sortSettings: SortSettings = {
default: [{ prop: 'timestamp', type: 'date' }],
action: [{ prop: 'actionText', type: 'string' }],
@@ -98,10 +102,6 @@ export class SyncTransfersComponent {
date: [{ prop: 'timestamp', type: 'date' }]
}
protected sortTable = new SortTable(this.constructor.name, this.sortSettings)
- protected readonly icons = { faRedo, faTrashCan, faArrowDown, faArrowUp }
- public action: string = null
- public syncPathSelected: SyncPathModel = null
- public transfers: SyncTransferModel[] = []
private focusOnSyncPathErrorsId: number = null
private search: string = null
private query: string = null
diff --git a/frontend/src/app/applications/sync/components/utils/sync-path-scheduler.component.ts b/frontend/src/app/applications/sync/components/utils/sync-path-scheduler.component.ts
index 9a7799cb..1a08ab02 100644
--- a/frontend/src/app/applications/sync/components/utils/sync-path-scheduler.component.ts
+++ b/frontend/src/app/applications/sync/components/utils/sync-path-scheduler.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, Input, inject } from '@angular/core'
+import { Component, inject, Input } from '@angular/core'
import { SYNC_PATH_SCHEDULER_UNIT } from '@sync-in-server/backend/src/applications/sync/constants/sync'
import { L10nTranslateDirective } from 'angular-l10n'
import { StoreService } from '../../../../store/store.service'
@@ -34,8 +34,8 @@ import { SyncPathModel } from '../../models/sync-path.model'
</span>`
})
export class SyncPathSchedulerComponent {
- protected readonly store = inject(StoreService)
@Input({ required: true }) s: SyncPathModel
+ protected readonly store = inject(StoreService)
protected readonly SYNC_PATH_SCHEDULER_UNIT = SYNC_PATH_SCHEDULER_UNIT
protected readonly CLIENT_SCHEDULER_STATE = CLIENT_SCHEDULER_STATE
}
diff --git a/frontend/src/app/applications/sync/components/wizard/sync-wizard-client.component.ts b/frontend/src/app/applications/sync/components/wizard/sync-wizard-client.component.ts
index eed64db5..7be4534e 100644
--- a/frontend/src/app/applications/sync/components/wizard/sync-wizard-client.component.ts
+++ b/frontend/src/app/applications/sync/components/wizard/sync-wizard-client.component.ts
@@ -23,14 +23,14 @@ import { SYNC_ICON, SYNC_PATH, SYNC_TITLE } from '../../sync.constants'
templateUrl: 'sync-wizard-client.component.html'
})
export class SyncWizardClientComponent {
+ public pathIsValid = false
+ public infoMsg: string = null
+ protected readonly syncService = inject(SyncService)
+ protected readonly icons = { faTimesCircle, faArrowCircleRight }
private readonly router = inject(Router)
private readonly renderer = inject(Renderer2)
private readonly store = inject(StoreService)
private readonly layout = inject(LayoutService)
- protected readonly syncService = inject(SyncService)
- protected readonly icons = { faTimesCircle, faArrowCircleRight }
- public pathIsValid = false
- public infoMsg: string = null
constructor() {
this.layout.setBreadcrumbIcon(SYNC_ICON.WIZARD)
diff --git a/frontend/src/app/applications/sync/components/wizard/sync-wizard-server.component.ts b/frontend/src/app/applications/sync/components/wizard/sync-wizard-server.component.ts
index 88b56b75..a6787455 100644
--- a/frontend/src/app/applications/sync/components/wizard/sync-wizard-server.component.ts
+++ b/frontend/src/app/applications/sync/components/wizard/sync-wizard-server.component.ts
@@ -31,14 +31,20 @@ import { isSynchronizable } from '../../sync.utils'
})
export class SyncWizardServerComponent {
locale = inject<L10nLocale>(L10N_LOCALE)
+ @ViewChild(AutoResizeDirective, { static: true }) autoResize: AutoResizeDirective
+ protected readonly icons = { faArrowCircleLeft, faArrowCircleRight, faFolderPlus }
+ protected infoMsg: string = null
+ protected newDirectoryName: string
+ protected selectedPath: SyncWizardPath
+ protected currentPath: string
+ protected currentShowedPath: string
+ protected canCreateDir = false
private readonly router = inject(Router)
private readonly store = inject(StoreService)
private readonly userService = inject(UserService)
private readonly filesService = inject(FilesService)
private readonly syncService = inject(SyncService)
private readonly layout = inject(LayoutService)
- @ViewChild(AutoResizeDirective, { static: true }) autoResize: AutoResizeDirective
- protected readonly icons = { faArrowCircleLeft, faArrowCircleRight, faFolderPlus }
private readonly rootPaths: SyncWizardPath[] = [
this.userService.userHavePermission(USER_PERMISSION.PERSONAL_SPACE)
? new SyncWizardPath({
@@ -74,13 +80,7 @@ export class SyncWizardServerComponent {
})
: null
].filter(Boolean)
- protected infoMsg: string = null
- protected newDirectoryName: string
- protected selectedPath: SyncWizardPath
- protected currentPath: string
protected currentPaths: WritableSignal<SyncWizardPath[]> = signal([...this.rootPaths])
- protected currentShowedPath: string
- protected canCreateDir = false
constructor() {
if (this.syncService.wizard.remotePath) {
@@ -168,6 +168,18 @@ export class SyncWizardServerComponent {
}
}
+ onNext() {
+ this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, SYNC_PATH.WIZARD_SETTINGS]).catch(console.error)
+ }
+
+ onPrevious() {
+ this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, SYNC_PATH.WIZARD_CLIENT]).catch(console.error)
+ }
+
+ setServerPath(serverPath: SyncWizardPath) {
+ this.syncService.wizard.remotePath = serverPath
+ }
+
private setCurrentPaths(paths?: SyncWizardPath[]) {
for (const syncPath of this.store.clientSyncPaths()) {
const searchRegexp = new RegExp(`^${syncPath.settings.remotePath}((\\/.*)+|\\/?)$`)
@@ -199,16 +211,4 @@ export class SyncWizardServerComponent {
setTimeout(() => (this.infoMsg = null), 6000)
}
}
-
- onNext() {
- this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, SYNC_PATH.WIZARD_SETTINGS]).catch(console.error)
- }
-
- onPrevious() {
- this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, SYNC_PATH.WIZARD_CLIENT]).catch(console.error)
- }
-
- setServerPath(serverPath: SyncWizardPath) {
- this.syncService.wizard.remotePath = serverPath
- }
}
diff --git a/frontend/src/app/applications/sync/components/wizard/sync-wizard-settings.component.ts b/frontend/src/app/applications/sync/components/wizard/sync-wizard-settings.component.ts
index e1ef0f22..f2a536e3 100644
--- a/frontend/src/app/applications/sync/components/wizard/sync-wizard-settings.component.ts
+++ b/frontend/src/app/applications/sync/components/wizard/sync-wizard-settings.component.ts
@@ -23,8 +23,6 @@ import { SyncPathDirectionIconComponent } from '../utils/sync-path-direction-ico
templateUrl: './sync-wizard-settings.component.html'
})
export class SyncWizardSettingsComponent {
- private readonly router = inject(Router)
- private readonly layout = inject(LayoutService)
protected readonly syncService = inject(SyncService)
protected readonly SYNC_PATH_CONFLICT_MODE = SYNC_PATH_CONFLICT_MODE
protected readonly SYNC_PATH_MODE = SYNC_PATH_MODE
@@ -32,6 +30,8 @@ export class SyncWizardSettingsComponent {
protected readonly translatedRemotePath = this.syncService.translateServerPath(this.syncService.wizard.remotePath.serverPath)
protected syncPath: SyncPathModel
protected error: string = null
+ private readonly router = inject(Router)
+ private readonly layout = inject(LayoutService)
constructor() {
this.syncPath = new SyncPathModel({
diff --git a/frontend/src/app/applications/sync/models/sync-client.model.ts b/frontend/src/app/applications/sync/models/sync-client.model.ts
index d0b18291..74c588c9 100644
--- a/frontend/src/app/applications/sync/models/sync-client.model.ts
+++ b/frontend/src/app/applications/sync/models/sync-client.model.ts
@@ -36,6 +36,15 @@ export class SyncClientModel implements Omit<SyncClientPaths, 'paths'> {
this.setIcon()
}
+ setExpiration() {
+ const expired = currentTimeStamp() >= this.tokenExpiration
+ this.expiration = {
+ value: this.tokenExpiration * 1000,
+ reached: expired,
+ approaching: expired ? false : currentTimeStamp() + 90 * 86400 >= this.tokenExpiration
+ }
+ }
+
private setIcon() {
if (this.info.os === 'darwin') {
this.icon = faApple
@@ -48,13 +57,4 @@ export class SyncClientModel implements Omit<SyncClientPaths, 'paths'> {
this.osName = 'Linux'
}
}
-
- setExpiration() {
- const expired = currentTimeStamp() >= this.tokenExpiration
- this.expiration = {
- value: this.tokenExpiration * 1000,
- reached: expired,
- approaching: expired ? false : currentTimeStamp() + 90 * 86400 >= this.tokenExpiration
- }
- }
}
diff --git a/frontend/src/app/applications/sync/models/sync-path.model.ts b/frontend/src/app/applications/sync/models/sync-path.model.ts
index 65416dd6..07bbcc24 100644
--- a/frontend/src/app/applications/sync/models/sync-path.model.ts
+++ b/frontend/src/app/applications/sync/models/sync-path.model.ts
@@ -59,28 +59,6 @@ export class SyncPathModel implements Partial<SyncPath> {
this.setStatus(false)
}
- private setInfos() {
- this.isWriteable = hasWritePermission(this.settings?.permissions)
- this.newly = getNewly(this.settings.lastSync || 0, true)
- const repository = this.settings.remotePath.split('/')[0]
- this.showedPath = this.settings.remotePath.split('/').slice(1).join('/')
- this.iconClass = repository === SPACE_REPOSITORY.SHARES ? 'purple' : 'primary'
- switch (repository) {
- case SPACES_PATH.PERSONAL:
- this.icon = SPACES_ICON.PERSONAL
- this.mime = mimeDirectory
- break
- case SPACES_PATH.SPACES:
- this.icon = SPACES_ICON.SPACES
- this.mime = mimeDirectory
- break
- case SPACES_PATH.SHARES:
- this.icon = SPACES_ICON.SHARES
- this.mime = mimeDirectoryShare
- break
- }
- }
-
setStatus(inSync: boolean) {
if (inSync) {
this.mimeUrl = getAssetsMimeUrl(mimeDirectorySync)
@@ -113,4 +91,26 @@ export class SyncPathModel implements Partial<SyncPath> {
scheduler: this.settings.scheduler
}
}
+
+ private setInfos() {
+ this.isWriteable = hasWritePermission(this.settings?.permissions)
+ this.newly = getNewly(this.settings.lastSync || 0, true)
+ const repository = this.settings.remotePath.split('/')[0]
+ this.showedPath = this.settings.remotePath.split('/').slice(1).join('/')
+ this.iconClass = repository === SPACE_REPOSITORY.SHARES ? 'purple' : 'primary'
+ switch (repository) {
+ case SPACES_PATH.PERSONAL:
+ this.icon = SPACES_ICON.PERSONAL
+ this.mime = mimeDirectory
+ break
+ case SPACES_PATH.SPACES:
+ this.icon = SPACES_ICON.SPACES
+ this.mime = mimeDirectory
+ break
+ case SPACES_PATH.SHARES:
+ this.icon = SPACES_ICON.SHARES
+ this.mime = mimeDirectoryShare
+ break
+ }
+ }
}
diff --git a/frontend/src/app/applications/sync/services/sync.service.ts b/frontend/src/app/applications/sync/services/sync.service.ts
index 71a82c30..28ab523c 100644
--- a/frontend/src/app/applications/sync/services/sync.service.ts
+++ b/frontend/src/app/applications/sync/services/sync.service.ts
@@ -36,11 +36,6 @@ import { getServerPath } from '../sync.utils'
providedIn: 'root'
})
export class SyncService {
- private readonly router = inject(Router)
- private readonly http = inject(HttpClient)
- private readonly layout = inject(LayoutService)
- private readonly store = inject(StoreService)
- private readonly electron = inject(Electron)
// wizard
public wizard: {
localPath: {
@@ -59,6 +54,11 @@ export class SyncService {
scheduler: { unit: string; value: number }
}
}
+ private readonly router = inject(Router)
+ private readonly http = inject(HttpClient)
+ private readonly layout = inject(LayoutService)
+ private readonly store = inject(StoreService)
+ private readonly electron = inject(Electron)
constructor() {
this.resetWizard()
diff --git a/frontend/src/app/applications/sync/sync.guards.ts b/frontend/src/app/applications/sync/sync.guards.ts
index e01c41e0..e78743f1 100644
--- a/frontend/src/app/applications/sync/sync.guards.ts
+++ b/frontend/src/app/applications/sync/sync.guards.ts
@@ -35,9 +35,7 @@ export const syncWizardServerActivate: CanActivateFn = (): boolean => {
const syncService = inject(SyncService)
const canActivate = Boolean(syncService.wizard.localPath)
if (!canActivate) {
- inject(Router)
- .navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, SYNC_PATH.WIZARD_CLIENT])
- .catch(console.error)
+ inject(Router).navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, SYNC_PATH.WIZARD_CLIENT]).catch(console.error)
}
return canActivate
}
diff --git a/frontend/src/app/applications/users/components/dialogs/user-group-add-users-dialog.component.ts b/frontend/src/app/applications/users/components/dialogs/user-group-add-users-dialog.component.ts
index fbd5fc48..c2de429c 100644
--- a/frontend/src/app/applications/users/components/dialogs/user-group-add-users-dialog.component.ts
+++ b/frontend/src/app/applications/users/components/dialogs/user-group-add-users-dialog.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, EventEmitter, Input, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, Output } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faUserPlus } from '@fortawesome/free-solid-svg-icons'
import { GROUP_TYPE } from '@sync-in-server/backend/src/applications/users/constants/group'
@@ -25,14 +25,14 @@ import { UserSearchComponent } from '../utils/user-search.component'
templateUrl: 'user-group-add-users-dialog.component.html'
})
export class UserGroupAddUsersDialogComponent {
- protected readonly layout = inject(LayoutService)
- private readonly userService = inject(UserService)
@Input({ required: true }) parentGroup: GroupBrowseModel['parentGroup']
@Input({ required: true }) currentMemberIds: number[] = []
@Output() hasChanges = new EventEmitter<boolean>()
+ protected readonly layout = inject(LayoutService)
protected newMembers: MemberModel[] = []
protected submitted = false
protected readonly icons = { faUserPlus }
+ private readonly userService = inject(UserService)
searchMembers(query: string): Observable<MemberModel[]> {
const search: SearchMembersDto = {
diff --git a/frontend/src/app/applications/users/components/dialogs/user-group-delete-dialog.component.ts b/frontend/src/app/applications/users/components/dialogs/user-group-delete-dialog.component.ts
index d607ac5a..5859add5 100644
--- a/frontend/src/app/applications/users/components/dialogs/user-group-delete-dialog.component.ts
+++ b/frontend/src/app/applications/users/components/dialogs/user-group-delete-dialog.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, EventEmitter, Input, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, Output } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faMinus, faUserMinus } from '@fortawesome/free-solid-svg-icons'
import { L10nTranslateDirective } from 'angular-l10n'
@@ -22,13 +22,13 @@ import { UserService } from '../../user.service'
templateUrl: 'user-group-delete-dialog.component.html'
})
export class UserGroupDeleteDialogComponent {
- private readonly layout = inject(LayoutService)
- private readonly userService = inject(UserService)
@Input({ required: true }) parentGroup: GroupBrowseModel['parentGroup']
@Input({ required: true }) member: MemberModel
@Output() wasDeleted = new EventEmitter<boolean>()
protected submitted = false
protected readonly icons = { GROUPS: USER_ICON.GROUPS, faMinus, faUserMinus }
+ private readonly layout = inject(LayoutService)
+ private readonly userService = inject(UserService)
onSubmit() {
this.submitted = true
diff --git a/frontend/src/app/applications/users/components/dialogs/user-group-dialog.component.ts b/frontend/src/app/applications/users/components/dialogs/user-group-dialog.component.ts
index 6edc716a..6d870323 100644
--- a/frontend/src/app/applications/users/components/dialogs/user-group-dialog.component.ts
+++ b/frontend/src/app/applications/users/components/dialogs/user-group-dialog.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, EventEmitter, Input, OnInit, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, OnInit, Output } from '@angular/core'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faCog, faPen, faSpinner, faUsers } from '@fortawesome/free-solid-svg-icons'
@@ -25,17 +25,17 @@ import { UserService } from '../../user.service'
templateUrl: 'user-group-dialog.component.html'
})
export class UserGroupDialogComponent implements OnInit {
- protected readonly layout = inject(LayoutService)
- private readonly userService = inject(UserService)
@Input() originalGroup: MemberModel
@Output() groupChange = new EventEmitter<['add' | 'update', MemberModel]>()
+ protected readonly layout = inject(LayoutService)
protected group: MemberModel
- protected readonly user: UserType = this.userService.user
protected readonly icons = { GROUPS: USER_ICON.GROUPS, faSpinner, faCog, faUsers, faPen }
// states
protected isPersonalGroup = true
protected submitted = false
protected loading = false
+ private readonly userService = inject(UserService)
+ protected readonly user: UserType = this.userService.user
ngOnInit() {
if (!this.originalGroup?.id) {
diff --git a/frontend/src/app/applications/users/components/dialogs/user-guest-dialog.component.ts b/frontend/src/app/applications/users/components/dialogs/user-guest-dialog.component.ts
index abff79bc..ac46b0e2 100644
--- a/frontend/src/app/applications/users/components/dialogs/user-guest-dialog.component.ts
+++ b/frontend/src/app/applications/users/components/dialogs/user-guest-dialog.component.ts
@@ -6,7 +6,7 @@
import { TitleCasePipe } from '@angular/common'
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, EventEmitter, Input, OnInit, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, OnInit, Output } from '@angular/core'
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faAddressCard, faPen, faPlus, faShieldHalved, faSpinner, faUsers, faUsersGear } from '@fortawesome/free-solid-svg-icons'
@@ -52,11 +52,11 @@ import { UserSearchComponent } from '../utils/user-search.component'
templateUrl: 'user-guest-dialog.component.html'
})
export class UserGuestDialogComponent implements OnInit {
+ @Input() guest: GuestUserModel = null
+ @Output() guestChange = new EventEmitter<['add' | 'update' | 'delete', GuestUserModel]>()
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly layout = inject(LayoutService)
protected readonly userService = inject(UserService)
- @Input() guest: GuestUserModel = null
- @Output() guestChange = new EventEmitter<['add' | 'update' | 'delete', GuestUserModel]>()
protected readonly user: UserType = this.userService.user
protected readonly icons = { GROUPS: USER_ICON.GROUPS, faPlus, faPen, faUsersGear, faSpinner, faAddressCard, faUsers, faShieldHalved }
protected readonly allNotifications = Object.values(USER_NOTIFICATION_TEXT)
diff --git a/frontend/src/app/applications/users/components/dialogs/user-personal-group-edit-user-dialog.component.ts b/frontend/src/app/applications/users/components/dialogs/user-personal-group-edit-user-dialog.component.ts
index 25be937d..457bf02e 100644
--- a/frontend/src/app/applications/users/components/dialogs/user-personal-group-edit-user-dialog.component.ts
+++ b/frontend/src/app/applications/users/components/dialogs/user-personal-group-edit-user-dialog.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, Input, OnInit, inject } from '@angular/core'
+import { Component, inject, Input, OnInit } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faKey, faUserPen } from '@fortawesome/free-solid-svg-icons'
@@ -22,14 +22,14 @@ import { UserService } from '../../user.service'
templateUrl: 'user-personal-group-edit-user-dialog.component.html'
})
export class UserPersonalGroupEditUserDialogComponent implements OnInit {
- protected readonly layout = inject(LayoutService)
- private readonly userService = inject(UserService)
@Input({ required: true }) parentGroup: GroupBrowseModel['parentGroup']
@Input({ required: true }) user: MemberModel
+ protected readonly layout = inject(LayoutService)
protected submitted = false
protected isManager = false
protected readonly USER_GROUP_ROLE = USER_GROUP_ROLE
protected readonly icons = { faUserPen, faKey }
+ private readonly userService = inject(UserService)
ngOnInit() {
this.isManager = this.user.isGroupManager
diff --git a/frontend/src/app/applications/users/components/dialogs/user-personal-group-leave-dialog.component.ts b/frontend/src/app/applications/users/components/dialogs/user-personal-group-leave-dialog.component.ts
index 6e09a9b8..bc784731 100644
--- a/frontend/src/app/applications/users/components/dialogs/user-personal-group-leave-dialog.component.ts
+++ b/frontend/src/app/applications/users/components/dialogs/user-personal-group-leave-dialog.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, EventEmitter, Input, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, Output } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faRightFromBracket } from '@fortawesome/free-solid-svg-icons'
import { L10nTranslateDirective } from 'angular-l10n'
@@ -21,12 +21,12 @@ import { UserService } from '../../user.service'
templateUrl: 'user-personal-group-leave-dialog.component.html'
})
export class UserPersonalGroupLeaveDialogComponent {
- private readonly layout = inject(LayoutService)
- private readonly userService = inject(UserService)
@Input({ required: true }) member: MemberModel
@Output() wasLeft = new EventEmitter<boolean>()
protected submitted = false
protected readonly icons = { GROUPS: USER_ICON.GROUPS, faRightFromBracket }
+ private readonly layout = inject(LayoutService)
+ private readonly userService = inject(UserService)
onClose() {
this.wasLeft.emit(false)
diff --git a/frontend/src/app/applications/users/components/sidebar/user-onlines.component.ts b/frontend/src/app/applications/users/components/sidebar/user-onlines.component.ts
index a6111a9f..c50a928b 100644
--- a/frontend/src/app/applications/users/components/sidebar/user-onlines.component.ts
+++ b/frontend/src/app/applications/users/components/sidebar/user-onlines.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, computed, Signal, inject } from '@angular/core'
+import { Component, computed, inject, Signal } from '@angular/core'
import { USER_ONLINE_STATUS, USER_ONLINE_STATUS_LIST } from '@sync-in-server/backend/src/applications/users/constants/user'
import { L10nTranslateDirective } from 'angular-l10n'
import { AutoResizeDirective } from '../../../../common/directives/auto-resize.directive'
@@ -17,8 +17,8 @@ import { UserOnlineModel } from '../../models/user-online.model'
templateUrl: 'user-onlines.component.html'
})
export class UserOnlinesComponent {
- private readonly store = inject(StoreService)
protected readonly allOnlineStatus = USER_ONLINE_STATUS_LIST
+ private readonly store = inject(StoreService)
public onlineUsers: Signal<UserOnlineModel[]> = computed(() =>
this.store.onlineUsers().filter((u) => u.onlineStatus !== USER_ONLINE_STATUS.OFFLINE)
)
diff --git a/frontend/src/app/applications/users/components/sidebar/user-profile.component.ts b/frontend/src/app/applications/users/components/sidebar/user-profile.component.ts
index 146bf78a..b7b2997e 100644
--- a/frontend/src/app/applications/users/components/sidebar/user-profile.component.ts
+++ b/frontend/src/app/applications/users/components/sidebar/user-profile.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, OnDestroy, inject } from '@angular/core'
+import { Component, inject, OnDestroy } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { RouterLink } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
@@ -26,15 +26,15 @@ import { UserService } from '../../user.service'
imports: [FormsModule, RouterLink, CapitalizePipe, FaIconComponent, L10nTranslateDirective]
})
export class UserProfileComponent implements OnDestroy {
- private readonly layout = inject(LayoutService)
- private readonly authService = inject(AuthService)
- private readonly userService = inject(UserService)
protected readonly store = inject(StoreService)
protected readonly USER_PATH = USER_PATH
protected readonly allOnlineStatus = USER_ONLINE_STATUS_LIST
protected readonly icons = { faUserAlt, faCircleHalfStroke, faCog, faPowerOff, faUserSecret }
protected user: UserType
protected userAvatar: string = null
+ private readonly layout = inject(LayoutService)
+ private readonly authService = inject(AuthService)
+ private readonly userService = inject(UserService)
private subscriptions: Subscription[] = []
constructor() {
diff --git a/frontend/src/app/applications/users/components/user-account.component.ts b/frontend/src/app/applications/users/components/user-account.component.ts
index b5091d98..3d4078fc 100644
--- a/frontend/src/app/applications/users/components/user-account.component.ts
+++ b/frontend/src/app/applications/users/components/user-account.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, OnDestroy, inject } from '@angular/core'
+import { Component, inject, OnDestroy } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faCopy, faKey } from '@fortawesome/free-solid-svg-icons'
@@ -51,11 +51,6 @@ import { UserService } from '../user.service'
})
export class UserAccountComponent implements OnDestroy {
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly store = inject(StoreService)
- private readonly layout = inject(LayoutService)
- private readonly userService = inject(UserService)
- private readonly clipBoardService = inject(ClipboardService)
- private subscriptions: Subscription[] = []
protected readonly allNotifications = Object.values(USER_NOTIFICATION_TEXT)
protected readonly allOnlineStatus = USER_ONLINE_STATUS_LIST
protected readonly passwordMinLength = USER_PASSWORD_MIN_LENGTH
@@ -63,10 +58,15 @@ export class UserAccountComponent implements OnDestroy {
protected user: UserType
protected userAvatar: string = null
protected webdavUrl = `${window.location.origin}/${WEBDAV_BASE_PATH}`
- protected languages = this.layout.getLanguages(true)
// password
protected oldPassword: string
protected newPassword: string
+ private readonly store = inject(StoreService)
+ private readonly layout = inject(LayoutService)
+ protected languages = this.layout.getLanguages(true)
+ private readonly userService = inject(UserService)
+ private readonly clipBoardService = inject(ClipboardService)
+ private subscriptions: Subscription[] = []
constructor() {
this.subscriptions.push(this.store.user.subscribe((user: UserType) => (this.user = user)))
@@ -137,6 +137,11 @@ export class UserAccountComponent implements OnDestroy {
})
}
+ clipBoardLink() {
+ this.clipBoardService.copyFromContent(this.webdavUrl)
+ this.layout.sendNotification('info', 'Link copied', this.webdavUrl)
+ }
+
private updateLanguage(language: string) {
this.user.language = language
this.layout.setLanguage(language)
@@ -153,9 +158,4 @@ export class UserAccountComponent implements OnDestroy {
this.newPassword = ''
this.layout.sendNotification('info', 'Configuration', 'Password has been updated')
}
-
- clipBoardLink() {
- this.clipBoardService.copyFromContent(this.webdavUrl)
- this.layout.sendNotification('info', 'Link copied', this.webdavUrl)
- }
}
diff --git a/frontend/src/app/applications/users/components/user-applications.component.ts b/frontend/src/app/applications/users/components/user-applications.component.ts
index cd852e7b..f0aec88d 100644
--- a/frontend/src/app/applications/users/components/user-applications.component.ts
+++ b/frontend/src/app/applications/users/components/user-applications.component.ts
@@ -25,11 +25,11 @@ import { UserService } from '../user.service'
})
export class UserApplicationsComponent {
protected readonly store = inject(StoreService)
- private readonly layout = inject(LayoutService)
- private readonly userService = inject(UserService)
protected readonly icons = { faWindows, faApple, faLinux, faDownload, faTerminal }
protected readonly APP_STORE_OS = APP_STORE_PLATFORM
protected readonly APP_STORE_PLATFORM_LIST = Object.values(APP_STORE_PLATFORM)
+ private readonly layout = inject(LayoutService)
+ private readonly userService = inject(UserService)
constructor() {
this.userService.checkAppStoreAvailability()
diff --git a/frontend/src/app/applications/users/components/user-groups.component.ts b/frontend/src/app/applications/users/components/user-groups.component.ts
index 80750bd1..fa261ceb 100644
--- a/frontend/src/app/applications/users/components/user-groups.component.ts
+++ b/frontend/src/app/applications/users/components/user-groups.component.ts
@@ -70,11 +70,6 @@ import { UserPersonalGroupLeaveDialogComponent } from './dialogs/user-personal-g
templateUrl: 'user-groups.component.html'
})
export class UserGroupsComponent {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly router = inject(Router)
- private readonly activatedRoute = inject(ActivatedRoute)
- private readonly layout = inject(LayoutService)
- private readonly userService = inject(UserService)
@ViewChild(VirtualScrollComponent) scrollView: {
element: ElementRef
viewPortItems: MemberModel[]
@@ -83,6 +78,7 @@ export class UserGroupsComponent {
@ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('TargetContextMenu', { static: true }) targetContextMenu: ContextMenuComponent<any>
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected readonly icons = {
GROUPS: USER_ICON.GROUPS,
@@ -157,18 +153,8 @@ export class UserGroupsComponent {
sortable: true
}
}
- private readonly sortSettings: SortSettings = {
- default: [{ prop: 'name', type: 'string' }],
- name: [{ prop: 'name', type: 'string' }],
- type: [{ prop: 'type', type: 'string' }],
- role: [{ prop: 'isGroupManager', type: 'number' }],
- createdAt: [{ prop: 'createdAt', type: 'date' }],
- modifiedAt: [{ prop: 'modifiedAt', type: 'date' }]
- }
- protected sortTable = new SortTable(this.constructor.name, this.sortSettings)
// States
protected currentGroup: GroupBrowseModel['parentGroup']
- protected canCreatePersonalGroup = this.userService.userHavePermission(USER_PERMISSION.PERSONAL_GROUPS_ADMIN)
protected isCurrentGroupManager = false
protected allowedAction = {
addGroup: false,
@@ -179,10 +165,24 @@ export class UserGroupsComponent {
editGroup: false,
leaveGroup: false
}
- private focusOnSelect: string
protected loading = false
protected selected: MemberModel = null
protected members: MemberModel[] = []
+ private readonly router = inject(Router)
+ private readonly activatedRoute = inject(ActivatedRoute)
+ private readonly layout = inject(LayoutService)
+ private readonly userService = inject(UserService)
+ protected canCreatePersonalGroup = this.userService.userHavePermission(USER_PERMISSION.PERSONAL_GROUPS_ADMIN)
+ private readonly sortSettings: SortSettings = {
+ default: [{ prop: 'name', type: 'string' }],
+ name: [{ prop: 'name', type: 'string' }],
+ type: [{ prop: 'type', type: 'string' }],
+ role: [{ prop: 'isGroupManager', type: 'number' }],
+ createdAt: [{ prop: 'createdAt', type: 'date' }],
+ modifiedAt: [{ prop: 'modifiedAt', type: 'date' }]
+ }
+ protected sortTable = new SortTable(this.constructor.name, this.sortSettings)
+ private focusOnSelect: string
constructor() {
this.activatedRoute.data.subscribe((route: Data) => this.setEnv(route.routes as UrlSegment[]))
diff --git a/frontend/src/app/applications/users/components/user-guests.component.ts b/frontend/src/app/applications/users/components/user-guests.component.ts
index c7a11fef..c3e2799d 100644
--- a/frontend/src/app/applications/users/components/user-guests.component.ts
+++ b/frontend/src/app/applications/users/components/user-guests.component.ts
@@ -6,7 +6,7 @@
import { KeyValuePipe } from '@angular/common'
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, ElementRef, ViewChild, inject } from '@angular/core'
+import { Component, ElementRef, inject, ViewChild } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faArrowDown, faArrowRotateRight, faArrowUp, faKey, faPen, faPlus, faRotate } from '@fortawesome/free-solid-svg-icons'
import { ContextMenuComponent, ContextMenuModule } from '@perfectmemory/ngx-contextmenu'
@@ -47,9 +47,6 @@ import { UserAvatarComponent } from './utils/user-avatar.component'
templateUrl: 'user-guests.component.html'
})
export class UserGuestsComponent {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly layout = inject(LayoutService)
- private readonly userService = inject(UserService)
@ViewChild(VirtualScrollComponent) scrollView: {
element: ElementRef
viewPortItems: GuestUserModel[]
@@ -58,6 +55,7 @@ export class UserGuestsComponent {
@ViewChild(FilterComponent, { static: true }) inputFilter: FilterComponent
@ViewChild('MainContextMenu', { static: true }) mainContextMenu: ContextMenuComponent<any>
@ViewChild('TargetContextMenu', { static: true }) targetContextMenu: ContextMenuComponent<any>
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected readonly icons = { faRotate, faPlus, faPen, faArrowDown, faArrowUp, faKey, faArrowRotateRight }
// Sort
@@ -112,6 +110,13 @@ export class UserGuestsComponent {
sortable: true
}
}
+ protected loading = false
+ protected selected: GuestUserModel = null
+ protected guests: GuestUserModel[] = []
+ private readonly layout = inject(LayoutService)
+ private readonly userService = inject(UserService)
+ // States
+ protected canCreateGuest = this.userService.userHavePermission(USER_PERMISSION.GUESTS_ADMIN)
private readonly sortSettings: SortSettings = {
default: [{ prop: 'login', type: 'string' }],
login: [{ prop: 'login', type: 'string' }],
@@ -123,11 +128,6 @@ export class UserGuestsComponent {
isActive: [{ prop: 'isActive', type: 'number' }]
}
protected sortTable = new SortTable(this.constructor.name, this.sortSettings)
- // States
- protected canCreateGuest = this.userService.userHavePermission(USER_PERMISSION.GUESTS_ADMIN)
- protected loading = false
- protected selected: GuestUserModel = null
- protected guests: GuestUserModel[] = []
constructor() {
this.loadGuests()
diff --git a/frontend/src/app/applications/users/components/utils/user-avatar.component.ts b/frontend/src/app/applications/users/components/utils/user-avatar.component.ts
index bd51a37f..a5a0f1ee 100644
--- a/frontend/src/app/applications/users/components/utils/user-avatar.component.ts
+++ b/frontend/src/app/applications/users/components/utils/user-avatar.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { ChangeDetectionStrategy, Component, Input, OnInit, inject } from '@angular/core'
+import { ChangeDetectionStrategy, Component, inject, Input, OnInit } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faLightbulb, faUsers, faUserShield } from '@fortawesome/free-solid-svg-icons'
import { L10N_LOCALE, L10nLocale, L10nTranslatePipe } from 'angular-l10n'
@@ -72,7 +72,6 @@ import { MemberModel } from '../../models/member.model'
`
})
export class UserAvatarComponent implements OnInit {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
@Input() user: OwnerType | MemberModel | any
@Input() isMember = false
@Input() unknownUserAsInfo = false
@@ -81,6 +80,7 @@ export class UserAvatarComponent implements OnInit {
@Input() fontSize = 16
@Input() tooltipPlacement: AvailableBSPositions = 'auto'
@Input() container: string = null
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly icons = { faUsers, faUserShield, faLightbulb }
ngOnInit(): void {
diff --git a/frontend/src/app/applications/users/components/utils/user-search.component.ts b/frontend/src/app/applications/users/components/utils/user-search.component.ts
index 1fda7083..19df32cb 100644
--- a/frontend/src/app/applications/users/components/utils/user-search.component.ts
+++ b/frontend/src/app/applications/users/components/utils/user-search.component.ts
@@ -5,7 +5,7 @@
*/
import { KeyValuePipe } from '@angular/common'
-import { Component, ElementRef, EventEmitter, Input, NgZone, OnInit, Output, ViewChild, inject } from '@angular/core'
+import { Component, ElementRef, EventEmitter, inject, Input, NgZone, OnInit, Output, ViewChild } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faPen, faTimes } from '@fortawesome/free-solid-svg-icons'
@@ -42,8 +42,6 @@ import { USER_ICON } from '../../user.constants'
templateUrl: 'users-search.component.html'
})
export class UserSearchComponent implements OnInit {
- protected locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly ngZone = inject(NgZone)
@ViewChild('InputTypeHead') inputTypeHead: ElementRef
@Input() members: MemberModel[] = []
@Output() membersChange = new EventEmitter<MemberModel[]>()
@@ -55,14 +53,16 @@ export class UserSearchComponent implements OnInit {
@Input() searchFunction: (search: string) => any
@Input() editFunction: (member: MemberModel) => void = null
@Input() customPlaceholder: string
+ protected locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly MEMBER_TYPE = MEMBER_TYPE
protected readonly originalOrderKeyValue = originalOrderKeyValue
protected readonly SPACES_PERMISSIONS_TEXT = SPACES_PERMISSIONS_TEXT
protected readonly icons = { GROUPS: USER_ICON.GROUPS, LINKS: SPACES_ICON.LINKS, faTimes, faPen }
+ protected selection = ''
+ private readonly ngZone = inject(NgZone)
private defaultPlaceholder = 'Type to search for users or groups to add'
- private lastResults: MemberModel[] = []
protected placeHolder = this.defaultPlaceholder
- protected selection = ''
+ private lastResults: MemberModel[] = []
protected asyncSearchUsersOrGroups: Observable<any> = new Observable((observer: any) => observer.next(this.selection)).pipe(
mergeMap((search: any) => this.searchFunction(search || '').pipe(tap((results: MemberModel[]) => (this.lastResults = results))))
)
@@ -71,10 +71,6 @@ export class UserSearchComponent implements OnInit {
this.setDefaultPlaceHolder()
}
- private setDefaultPlaceHolder() {
- this.placeHolder = this.customPlaceholder || this.defaultPlaceholder
- }
-
onSelect(selection: { item: MemberModel }) {
// remove selection from input
this.ngZone.run(() => {
@@ -109,4 +105,8 @@ export class UserSearchComponent implements OnInit {
onPreview() {
this.setDefaultPlaceHolder()
}
+
+ private setDefaultPlaceHolder() {
+ this.placeHolder = this.customPlaceholder || this.defaultPlaceholder
+ }
}
diff --git a/frontend/src/app/applications/users/user.service.ts b/frontend/src/app/applications/users/user.service.ts
index 6af503cb..772a0335 100644
--- a/frontend/src/app/applications/users/user.service.ts
+++ b/frontend/src/app/applications/users/user.service.ts
@@ -5,7 +5,7 @@
*/
import { HttpClient, HttpErrorResponse } from '@angular/common/http'
-import { Injectable, inject } from '@angular/core'
+import { inject, Injectable } from '@angular/core'
import { NOTIFICATIONS_WS } from '@sync-in-server/backend/src/applications/notifications/constants/websocket'
import { SPACE_OPERATION } from '@sync-in-server/backend/src/applications/spaces/constants/spaces'
import { SYNC_ROUTE } from '@sync-in-server/backend/src/applications/sync/constants/routes'
diff --git a/frontend/src/app/auth/auth.component.ts b/frontend/src/app/auth/auth.component.ts
index 7022d154..fad10939 100644
--- a/frontend/src/app/auth/auth.component.ts
+++ b/frontend/src/app/auth/auth.component.ts
@@ -24,14 +24,14 @@ import { AuthService } from './auth.service'
})
export class AuthComponent {
protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly fb = inject(UntypedFormBuilder)
- private readonly router = inject(Router)
- private readonly auth = inject(AuthService)
protected readonly icons = { faLock, faUserAlt }
protected logoUrl = logoDarkUrl
protected loginForm: FormGroup
protected hasError: any = null
protected submitted = false
+ private readonly fb = inject(UntypedFormBuilder)
+ private readonly router = inject(Router)
+ private readonly auth = inject(AuthService)
constructor() {
const fb = this.fb
diff --git a/frontend/src/app/auth/auth.interceptor.ts b/frontend/src/app/auth/auth.interceptor.ts
index f2364e5b..fb0a29be 100644
--- a/frontend/src/app/auth/auth.interceptor.ts
+++ b/frontend/src/app/auth/auth.interceptor.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http'
-import { Injectable, Injector, inject } from '@angular/core'
+import { inject, Injectable, Injector } from '@angular/core'
import { API_AUTH_LOGIN, API_AUTH_LOGOUT, API_AUTH_REFRESH } from '@sync-in-server/backend/src/authentication/constants/routes'
import { BehaviorSubject, concatMap, delay, Observable, of, retryWhen, throwError } from 'rxjs'
import { catchError, filter, finalize, switchMap, take } from 'rxjs/operators'
diff --git a/frontend/src/app/auth/auth.service.ts b/frontend/src/app/auth/auth.service.ts
index cc242051..2857b2b4 100644
--- a/frontend/src/app/auth/auth.service.ts
+++ b/frontend/src/app/auth/auth.service.ts
@@ -32,15 +32,15 @@ import { AUTH_PATHS } from './auth.constants'
providedIn: 'root'
})
export class AuthService {
+ public returnUrl: string
private readonly http = inject(HttpClient)
private readonly router = inject(Router)
private readonly store = inject(StoreService)
private readonly userService = inject(UserService)
private readonly layout = inject(LayoutService)
private readonly electron = inject(Electron)
+
private _refreshExpiration = parseInt(localStorage.getItem('refresh_expiration') || '0', 10) || 0
- private _accessExpiration = parseInt(localStorage.getItem('access_expiration') || '0', 10) || 0
- public returnUrl: string
get refreshExpiration(): number {
return this._refreshExpiration
@@ -52,6 +52,8 @@ export class AuthService {
localStorage.setItem('refresh_expiration', value.toString())
}
+ private _accessExpiration = parseInt(localStorage.getItem('access_expiration') || '0', 10) || 0
+
get accessExpiration(): number {
return this._accessExpiration
}
diff --git a/frontend/src/app/common/components/filter.component.ts b/frontend/src/app/common/components/filter.component.ts
index 9096c172..987b65f6 100644
--- a/frontend/src/app/common/components/filter.component.ts
+++ b/frontend/src/app/common/components/filter.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, ElementRef, HostListener, OnDestroy, signal, ViewChild, inject } from '@angular/core'
+import { Component, ElementRef, HostListener, inject, OnDestroy, signal, ViewChild } from '@angular/core'
import { FormBuilder, FormControl, ReactiveFormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faTimes } from '@fortawesome/free-solid-svg-icons'
@@ -35,12 +35,12 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators'
`
})
export class FilterComponent implements OnDestroy {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
- private readonly fb = inject(FormBuilder)
@ViewChild('iFilter', { static: true }) iFilter: ElementRef
public search = signal('')
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly searchControl: FormControl
protected readonly faTimes = faTimes
+ private readonly fb = inject(FormBuilder)
private readonly subscription: Subscription
constructor() {
diff --git a/frontend/src/app/common/components/input-password.component.ts b/frontend/src/app/common/components/input-password.component.ts
index 99fbdd2e..1f0ce71a 100644
--- a/frontend/src/app/common/components/input-password.component.ts
+++ b/frontend/src/app/common/components/input-password.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild, inject } from '@angular/core'
+import { Component, ElementRef, EventEmitter, inject, Input, OnInit, Output, ViewChild } from '@angular/core'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faDice, faEye, faEyeSlash } from '@fortawesome/free-solid-svg-icons'
@@ -46,7 +46,6 @@ import { genPassword, togglePasswordType } from '../utils/functions'
</div> `
})
export class InputPasswordComponent implements OnInit {
- protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
@ViewChild('Password', { static: true }) passwordElement: ElementRef
@Input() password: string
@Output() passwordChange = new EventEmitter<string>()
@@ -57,6 +56,7 @@ export class InputPasswordComponent implements OnInit {
@Input() disabled = false
@Input() isRequired = false
@Input() focus = false
+ protected readonly locale = inject<L10nLocale>(L10N_LOCALE)
protected readonly toggleVisiblePassword = togglePasswordType
protected readonly icons = { faEye, faEyeSlash, faDice }
diff --git a/frontend/src/app/common/components/navigation-view/navigation-view.component.ts b/frontend/src/app/common/components/navigation-view/navigation-view.component.ts
index 42da7daa..aac72dac 100644
--- a/frontend/src/app/common/components/navigation-view/navigation-view.component.ts
+++ b/frontend/src/app/common/components/navigation-view/navigation-view.component.ts
@@ -5,7 +5,7 @@
*/
import { KeyValuePipe } from '@angular/common'
-import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, inject } from '@angular/core'
+import { ChangeDetectionStrategy, Component, EventEmitter, inject, Input, Output } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { IconDefinition } from '@fortawesome/fontawesome-svg-core'
import { faArrowDown, faArrowUp, faCog, faTh, faThLarge, faThList } from '@fortawesome/free-solid-svg-icons'
@@ -33,7 +33,6 @@ export interface ViewMode {
changeDetection: ChangeDetectionStrategy.OnPush
})
export class NavigationViewComponent {
- private readonly layout = inject(LayoutService)
@Input() sortParams: { column: string; asc: boolean }
@Input() sortFields: Record<string, string>
@Output() switchView = new EventEmitter<ViewMode>()
@@ -48,6 +47,7 @@ export class NavigationViewComponent {
thXl: { enabled: true, text: 'XL', icon: faTh, dimensions: 192, image: 152, imageRes: 512, faSize: 65, textSize: 13, margins: 18 },
thXxl: { enabled: true, text: 'XXL', icon: faThLarge, dimensions: 232, image: 192, imageRes: 1024, faSize: 80, textSize: 13, margins: 18 }
}
+ private readonly layout = inject(LayoutService)
constructor() {
this.viewsMode.tl.text = this.layout.translateString(this.viewsMode.tl.text)
diff --git a/frontend/src/app/common/components/select/select.component.ts b/frontend/src/app/common/components/select/select.component.ts
index 5326ccf0..03c1df53 100644
--- a/frontend/src/app/common/components/select/select.component.ts
+++ b/frontend/src/app/common/components/select/select.component.ts
@@ -5,7 +5,7 @@
*/
import { NgTemplateOutlet } from '@angular/common'
-import { Component, ElementRef, EventEmitter, forwardRef, Input, OnDestroy, OnInit, Output, TemplateRef, inject } from '@angular/core'
+import { Component, ElementRef, EventEmitter, forwardRef, inject, Input, OnDestroy, OnInit, Output, TemplateRef } from '@angular/core'
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
@@ -31,7 +31,6 @@ import { SelectItem } from './select.model'
]
})
export class SelectComponent implements OnInit, OnDestroy, ControlValueAccessor {
- private readonly sanitizer = inject(DomSanitizer)
public element: ElementRef = inject(ElementRef)
@Input({ required: true }) searchFunction: (search: string) => any
@Input() customTemplateOptions: TemplateRef<any>
@@ -47,11 +46,6 @@ export class SelectComponent implements OnInit, OnDestroy, ControlValueAccessor
@Output() removed = new EventEmitter<any>()
@Output() typed = new EventEmitter<any>()
@Output() opened = new EventEmitter<any>()
- private subscription: Subscription
- private _items: any[] = []
- private _optionsOpened = false
- private _disabled = false
- private _active: SelectItem | any = null
public options: SelectItem[] = []
public itemObjects: SelectItem[] = []
public activeOption: SelectItem
@@ -59,20 +53,15 @@ export class SelectComponent implements OnInit, OnDestroy, ControlValueAccessor
public inputValue = ''
protected onChange: any = Function.prototype
protected onTouched: any = Function.prototype
+ private readonly sanitizer = inject(DomSanitizer)
+ private subscription: Subscription
private behavior: GenericBehavior
public constructor() {
this.clickedOutside = this.clickedOutside.bind(this)
}
- get optionsOpened(): boolean {
- return this._optionsOpened
- }
-
- set optionsOpened(value: boolean) {
- this._optionsOpened = value
- this.opened.emit(value)
- }
+ private _items: any[] = []
public set items(value: any[]) {
if (!value.length) {
@@ -97,6 +86,19 @@ export class SelectComponent implements OnInit, OnDestroy, ControlValueAccessor
)
}
+ private _optionsOpened = false
+
+ get optionsOpened(): boolean {
+ return this._optionsOpened
+ }
+
+ set optionsOpened(value: boolean) {
+ this._optionsOpened = value
+ this.opened.emit(value)
+ }
+
+ private _disabled = false
+
public get disabled(): boolean {
return this._disabled
}
@@ -109,6 +111,8 @@ export class SelectComponent implements OnInit, OnDestroy, ControlValueAccessor
}
}
+ private _active: SelectItem | any = null
+
public get active(): SelectItem | any {
return this._active
}
@@ -221,19 +225,6 @@ export class SelectComponent implements OnInit, OnDestroy, ControlValueAccessor
this.subscription.unsubscribe()
}
- private doSearch(search: string) {
- this.searchFunction(search).subscribe({
- next: (items: any[]) => {
- this.items = items
- },
- error: (e: any) => {
- console.error(e)
- this.items = []
- },
- complete: () => this.behavior.filter()
- })
- }
-
remove(item: SelectItem) {
if (this._disabled === true) {
return
@@ -350,6 +341,19 @@ export class SelectComponent implements OnInit, OnDestroy, ControlValueAccessor
this.element.nativeElement.querySelector('.ui-select-container').focus()
}
+ private doSearch(search: string) {
+ this.searchFunction(search).subscribe({
+ next: (items: any[]) => {
+ this.items = items
+ },
+ error: (e: any) => {
+ console.error(e)
+ this.items = []
+ },
+ complete: () => this.behavior.filter()
+ })
+ }
+
private open() {
this.options = this.itemObjects
if (this.options.length > 0) {
diff --git a/frontend/src/app/common/components/storage-quota.component.ts b/frontend/src/app/common/components/storage-quota.component.ts
index 376b9410..0279eea9 100644
--- a/frontend/src/app/common/components/storage-quota.component.ts
+++ b/frontend/src/app/common/components/storage-quota.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, EventEmitter, Input, OnInit, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, OnInit, Output } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } from 'angular-l10n'
import { TooltipModule } from 'ngx-bootstrap/tooltip'
@@ -33,11 +33,11 @@ import { quotaRegexp } from '../utils/regexp'
</div>`
})
export class StorageQuotaComponent implements OnInit {
- protected locale = inject<L10nLocale>(L10N_LOCALE)
@Input() quota: number
@Output() quotaChange = new EventEmitter<number>()
@Input() maxWidthPercent = 75
@Input() fullWidth = false
+ protected locale = inject<L10nLocale>(L10N_LOCALE)
protected quotaText: string
protected invalid = false
diff --git a/frontend/src/app/common/directives/auto-focus.directive.ts b/frontend/src/app/common/directives/auto-focus.directive.ts
index 3b08d315..51ce87e2 100644
--- a/frontend/src/app/common/directives/auto-focus.directive.ts
+++ b/frontend/src/app/common/directives/auto-focus.directive.ts
@@ -4,14 +4,13 @@
* See the LICENSE file for licensing details
*/
-import { Directive, ElementRef, Input, OnInit, inject } from '@angular/core'
+import { Directive, ElementRef, inject, Input, OnInit } from '@angular/core'
@Directive({ selector: '[appAutofocus]' })
export class AutofocusDirective implements OnInit {
- private readonly elementRef = inject(ElementRef)
-
@Input() autoFocus = true
@Input() autoSelect = true
+ private readonly elementRef = inject(ElementRef)
ngOnInit() {
setTimeout(() => {
diff --git a/frontend/src/app/common/directives/auto-resize.directive.ts b/frontend/src/app/common/directives/auto-resize.directive.ts
index 6c46d1b0..08b93c91 100644
--- a/frontend/src/app/common/directives/auto-resize.directive.ts
+++ b/frontend/src/app/common/directives/auto-resize.directive.ts
@@ -4,19 +4,19 @@
* See the LICENSE file for licensing details
*/
-import { AfterViewInit, Directive, ElementRef, Input, OnDestroy, Renderer2, inject } from '@angular/core'
+import { AfterViewInit, Directive, ElementRef, inject, Input, OnDestroy, Renderer2 } from '@angular/core'
import { skip, Subscription } from 'rxjs'
import { defaultResizeOffset } from '../../layout/layout.constants'
import { LayoutService } from '../../layout/layout.service'
@Directive({ selector: '[appAutoResize]' })
export class AutoResizeDirective implements AfterViewInit, OnDestroy {
- private readonly elementRef = inject(ElementRef)
- private readonly renderer = inject(Renderer2)
- private readonly layout = inject(LayoutService)
@Input() overFlowX = 'hidden'
@Input() resizeOffset: number = defaultResizeOffset
@Input() useMaxHeight = true
+ private readonly elementRef = inject(ElementRef)
+ private readonly renderer = inject(Renderer2)
+ private readonly layout = inject(LayoutService)
private readonly resizeSubscription: Subscription
constructor() {
diff --git a/frontend/src/app/common/directives/input-edit.directive.ts b/frontend/src/app/common/directives/input-edit.directive.ts
index 1c8d088a..d82d6a99 100644
--- a/frontend/src/app/common/directives/input-edit.directive.ts
+++ b/frontend/src/app/common/directives/input-edit.directive.ts
@@ -4,14 +4,12 @@
* See the LICENSE file for licensing details
*/
-import { Directive, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, Renderer2, inject } from '@angular/core'
+import { Directive, ElementRef, EventEmitter, HostListener, inject, Input, OnInit, Output, Renderer2 } from '@angular/core'
@Directive({
selector: '[appInputEdit]'
})
export class InputEditDirective implements OnInit {
- private readonly elementRef = inject(ElementRef)
- private readonly renderer = inject(Renderer2)
@Input() inputObject: { isRenamed: boolean } & any
@Input() inputField = 'name'
@Input() fullWidth = false
@@ -21,6 +19,8 @@ export class InputEditDirective implements OnInit {
@Input() disableKeyboard = false
@Output() updateObject = new EventEmitter<{ object: any; name: string }>(true)
@Output() renamingInProgress = new EventEmitter<boolean>(true)
+ private readonly elementRef = inject(ElementRef)
+ private readonly renderer = inject(Renderer2)
private dangerColor = '#dd4b39'
private primaryColor = '#3c8dbc'
diff --git a/frontend/src/app/common/directives/upload-files.directive.ts b/frontend/src/app/common/directives/upload-files.directive.ts
index 401ee71f..aaf48b64 100644
--- a/frontend/src/app/common/directives/upload-files.directive.ts
+++ b/frontend/src/app/common/directives/upload-files.directive.ts
@@ -4,14 +4,14 @@
* See the LICENSE file for licensing details
*/
-import { Directive, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output, Renderer2, inject } from '@angular/core'
+import { Directive, ElementRef, EventEmitter, inject, Input, OnDestroy, OnInit, Output, Renderer2 } from '@angular/core'
@Directive({ selector: '[appUploadFiles]' })
export class UploadFilesDirective implements OnInit, OnDestroy {
- private elementRef = inject(ElementRef)
- private readonly renderer = inject(Renderer2)
@Input() options: { isMultiple?: boolean; isDirectory?: boolean }
@Output() uploadFiles = new EventEmitter<{ files: File[]; isDirectory: boolean }>()
+ private elementRef = inject(ElementRef)
+ private readonly renderer = inject(Renderer2)
private eventElement: () => void | undefined
private eventInput: () => void | undefined
diff --git a/frontend/src/app/common/pipes/join-counts.pipe.ts b/frontend/src/app/common/pipes/join-counts.pipe.ts
index faea4c8f..13388e10 100644
--- a/frontend/src/app/common/pipes/join-counts.pipe.ts
+++ b/frontend/src/app/common/pipes/join-counts.pipe.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Pipe, PipeTransform, inject } from '@angular/core'
+import { inject, Pipe, PipeTransform } from '@angular/core'
import { L10nTranslationService } from 'angular-l10n'
@Pipe({ name: 'joinCounts' })
diff --git a/frontend/src/app/common/pipes/join.pipe.ts b/frontend/src/app/common/pipes/join.pipe.ts
index 004acbaa..12223bb7 100644
--- a/frontend/src/app/common/pipes/join.pipe.ts
+++ b/frontend/src/app/common/pipes/join.pipe.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Pipe, PipeTransform, inject } from '@angular/core'
+import { inject, Pipe, PipeTransform } from '@angular/core'
import { L10nTranslationService } from 'angular-l10n'
import { CapitalizePipe } from './capitalize.pipe'
diff --git a/frontend/src/app/common/pipes/time-ago.pipe.ts b/frontend/src/app/common/pipes/time-ago.pipe.ts
index 45464340..6cb0a0d8 100644
--- a/frontend/src/app/common/pipes/time-ago.pipe.ts
+++ b/frontend/src/app/common/pipes/time-ago.pipe.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { ChangeDetectorRef, NgZone, OnDestroy, Pipe, PipeTransform, inject } from '@angular/core'
+import { ChangeDetectorRef, inject, NgZone, OnDestroy, Pipe, PipeTransform } from '@angular/core'
import { Dayjs } from 'dayjs'
import { dJs } from '../utils/time'
diff --git a/frontend/src/app/common/utils/sort-table.ts b/frontend/src/app/common/utils/sort-table.ts
index 080bb9ec..98911613 100644
--- a/frontend/src/app/common/utils/sort-table.ts
+++ b/frontend/src/app/common/utils/sort-table.ts
@@ -15,10 +15,9 @@ type SortProps = { prop: string; type: sortType }[]
export type SortSettings = Record<string, SortProps>
export class SortTable {
- private _sortParam: SortParam
- private defaultId = 'default'
protected keyStore: string
protected sortSettings: SortSettings
+ private defaultId = 'default'
constructor(keyStore: string, sortSettings: SortSettings) {
this.keyStore = `sortBy${keyStore}`
@@ -26,6 +25,8 @@ export class SortTable {
this._sortParam = this.sort
}
+ private _sortParam: SortParam
+
get sortParam(): SortParam {
return this._sortParam || this.sort
}
diff --git a/frontend/src/app/electron/electron.service.ts b/frontend/src/app/electron/electron.service.ts
index ffbde11d..ce6819f9 100644
--- a/frontend/src/app/electron/electron.service.ts
+++ b/frontend/src/app/electron/electron.service.ts
@@ -29,10 +29,10 @@ declare global {
providedIn: 'root'
})
export class Electron {
- private readonly ngZone = inject(NgZone)
- private readonly store = inject(StoreService)
public readonly enabled = checkIfElectronApp()
public readonly ipcRenderer = this.enabled ? window.ipcRenderer : null
+ private readonly ngZone = inject(NgZone)
+ private readonly store = inject(StoreService)
private syncTasksCount: Record<number, number> = {}
constructor() {
diff --git a/frontend/src/app/electron/interface.ts b/frontend/src/app/electron/interface.ts
index 4c9e89fd..bc9fd651 100644
--- a/frontend/src/app/electron/interface.ts
+++ b/frontend/src/app/electron/interface.ts
@@ -8,6 +8,7 @@ export interface ElectronIpcRenderer {
on: (channel: string, listener: (event: any, ...args: any[]) => void) => this
invoke: (channel: string, ...args: any[]) => Promise<any>
send: (channel: string, ...args: any[]) => void
- removeAllListeners(channel?: string): this
showFilePath: (file: File) => string
+
+ removeAllListeners(channel?: string): this
}
diff --git a/frontend/src/app/layout/breadcrumb/breadcrumb.component.ts b/frontend/src/app/layout/breadcrumb/breadcrumb.component.ts
index 0ceb6abc..9add9251 100644
--- a/frontend/src/app/layout/breadcrumb/breadcrumb.component.ts
+++ b/frontend/src/app/layout/breadcrumb/breadcrumb.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, OnDestroy, inject } from '@angular/core'
+import { Component, inject, OnDestroy } from '@angular/core'
import { RouterLink, RouterLinkActive } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { IconDefinition } from '@fortawesome/fontawesome-svg-core'
@@ -19,10 +19,10 @@ import { BreadCrumbUrl } from './breadcrumb.interfaces'
imports: [RouterLink, RouterLinkActive, FaIconComponent]
})
export class BreadcrumbComponent implements OnDestroy {
- private readonly layout = inject(LayoutService)
protected readonly icons = { faChevronRight }
protected breadcrumbIcon: IconDefinition = faHome
protected levels: { link: string[] | string; title: string }[] = []
+ private readonly layout = inject(LayoutService)
private subscriptions: Subscription[] = []
constructor() {
diff --git a/frontend/src/app/layout/layout.component.ts b/frontend/src/app/layout/layout.component.ts
index 158715f8..4e48aa88 100644
--- a/frontend/src/app/layout/layout.component.ts
+++ b/frontend/src/app/layout/layout.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, HostListener, OnDestroy, Renderer2, DOCUMENT, inject } from '@angular/core'
+import { Component, DOCUMENT, HostListener, inject, OnDestroy, Renderer2 } from '@angular/core'
import { RouterOutlet } from '@angular/router'
import { Subscription } from 'rxjs'
import { themeLight } from './layout.interfaces'
@@ -19,10 +19,10 @@ import { SideBarRightComponent } from './sidebar/sidebar.right.component'
imports: [RouterOutlet, NavBarComponent, SideBarLeftComponent, SideBarRightComponent]
})
export class LayoutComponent implements OnDestroy {
+ protected themeMode = themeLight
private readonly document = inject<Document>(DOCUMENT)
private readonly layout = inject(LayoutService)
private readonly renderer = inject(Renderer2)
- protected themeMode = themeLight
private rightSideBarClass = 'control-sidebar-open'
private leftSideBarCollapsedClass = 'sidebar-collapse'
private leftSideBarOpenedClass = 'sidebar-open'
@@ -67,6 +67,14 @@ export class LayoutComponent implements OnDestroy {
}
}
+ toggleRightSideBar(show: boolean) {
+ if (show) {
+ this.renderer.addClass(this.document.body, this.rightSideBarClass)
+ } else {
+ this.renderer.removeClass(this.document.body, this.rightSideBarClass)
+ }
+ }
+
private openLeftSideBar() {
this.renderer.removeClass(this.document.body, this.leftSideBarCollapsedClass)
this.renderer.addClass(this.document.body, this.leftSideBarOpenedClass)
@@ -77,14 +85,6 @@ export class LayoutComponent implements OnDestroy {
this.renderer.addClass(this.document.body, this.leftSideBarCollapsedClass)
}
- toggleRightSideBar(show: boolean) {
- if (show) {
- this.renderer.addClass(this.document.body, this.rightSideBarClass)
- } else {
- this.renderer.removeClass(this.document.body, this.rightSideBarClass)
- }
- }
-
private checkLeftSideBarCollapse() {
if (this.isSmallerThanMediumScreen) {
this.toggleLeftSideBar(2)
diff --git a/frontend/src/app/layout/layout.service.ts b/frontend/src/app/layout/layout.service.ts
index c9f5020d..d39a0340 100644
--- a/frontend/src/app/layout/layout.service.ts
+++ b/frontend/src/app/layout/layout.service.ts
@@ -5,14 +5,13 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Injectable, NgZone, inject } from '@angular/core'
+import { inject, Injectable, NgZone } from '@angular/core'
import { Title } from '@angular/platform-browser'
import { IconDefinition } from '@fortawesome/fontawesome-svg-core'
import { ContextMenuComponent, ContextMenuService } from '@perfectmemory/ngx-contextmenu'
import { getBrowserLanguage, L10nTranslationService } from 'angular-l10n'
import { BsLocaleService } from 'ngx-bootstrap/datepicker'
-import { BsModalService } from 'ngx-bootstrap/modal'
-import { BsModalRef } from 'ngx-bootstrap/modal'
+import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal'
import { ActiveToast, ToastrService } from 'ngx-toastr'
import { BehaviorSubject, fromEvent, mergeWith, Observable, Subject } from 'rxjs'
import { map } from 'rxjs/operators'
@@ -30,14 +29,6 @@ declare const window: any
@Injectable({ providedIn: 'root' })
export class LayoutService {
- private readonly title = inject(Title)
- private readonly ngZone = inject(NgZone)
- private readonly translation = inject(L10nTranslationService)
- private readonly bsLocale = inject(BsLocaleService)
- private readonly bsModal = inject(BsModalService)
- private readonly toastr = inject(ToastrService)
- private readonly contextMenu = inject<ContextMenuService<any>>(ContextMenuService)
- private readonly electron = inject(Electron)
public currentRightSideBarTab: string | null = null
// Resize event
public resizeEvent = new BehaviorSubject<void | null>(null)
@@ -62,6 +53,14 @@ export class LayoutService {
// Navigation breadcrumb icon
public breadcrumbIcon = new BehaviorSubject<IconDefinition>(null)
public minimizedWindows = new BehaviorSubject<AppWindow[]>([])
+ private readonly title = inject(Title)
+ private readonly ngZone = inject(NgZone)
+ private readonly translation = inject(L10nTranslationService)
+ private readonly bsLocale = inject(BsLocaleService)
+ private readonly bsModal = inject(BsModalService)
+ private readonly toastr = inject(ToastrService)
+ private readonly contextMenu = inject<ContextMenuService<any>>(ContextMenuService)
+ private readonly electron = inject(Electron)
// States
private readonly screenMediumSize = 767 // px
private readonly screenSmallSize = 576 // px
diff --git a/frontend/src/app/layout/navbar/navbar.component.ts b/frontend/src/app/layout/navbar/navbar.component.ts
index bf205131..83d555fc 100644
--- a/frontend/src/app/layout/navbar/navbar.component.ts
+++ b/frontend/src/app/layout/navbar/navbar.component.ts
@@ -5,7 +5,7 @@
*/
import { Location } from '@angular/common'
-import { Component, OnDestroy, inject } from '@angular/core'
+import { Component, inject, OnDestroy } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faAngleLeft, faAngleRight } from '@fortawesome/free-solid-svg-icons'
import { USER_ONLINE_STATUS_LIST } from '@sync-in-server/backend/src/applications/users/constants/user'
@@ -22,14 +22,14 @@ import { LayoutService } from '../layout.service'
imports: [BreadcrumbComponent, FaIconComponent]
})
export class NavBarComponent implements OnDestroy {
- private readonly location = inject(Location)
- private readonly layout = inject(LayoutService)
- private readonly store = inject(StoreService)
- private subscriptions: Subscription[] = []
protected readonly allOnlineStatus = USER_ONLINE_STATUS_LIST
protected readonly icons = { faAngleLeft, faAngleRight }
protected user: UserType
protected userAvatar: string = null
+ private readonly location = inject(Location)
+ private readonly layout = inject(LayoutService)
+ private readonly store = inject(StoreService)
+ private subscriptions: Subscription[] = []
constructor() {
this.subscriptions.push(this.store.user.subscribe((user: UserType) => (this.user = user)))
diff --git a/frontend/src/app/layout/sidebar/components/selection.component.ts b/frontend/src/app/layout/sidebar/components/selection.component.ts
index 481b0a42..28d9e88a 100644
--- a/frontend/src/app/layout/sidebar/components/selection.component.ts
+++ b/frontend/src/app/layout/sidebar/components/selection.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { ChangeDetectionStrategy, Component, computed, Signal, inject } from '@angular/core'
+import { ChangeDetectionStrategy, Component, computed, inject, Signal } from '@angular/core'
import { FilesSelectionComponent } from '../../../applications/files/components/sidebar/files-selection.component'
import { LinkSelectionComponent } from '../../../applications/links/components/sidebar/link-selection.component'
import { ShareSelectionComponent } from '../../../applications/shares/components/sidebar/share-selection.component'
diff --git a/frontend/src/app/layout/sidebar/components/windows.component.ts b/frontend/src/app/layout/sidebar/components/windows.component.ts
index 862f0d2e..94ee80d0 100755
--- a/frontend/src/app/layout/sidebar/components/windows.component.ts
+++ b/frontend/src/app/layout/sidebar/components/windows.component.ts
@@ -5,7 +5,7 @@
*/
import { NgOptimizedImage } from '@angular/common'
-import { Component, OnDestroy, inject } from '@angular/core'
+import { Component, inject, OnDestroy } from '@angular/core'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faTimes, faXmark } from '@fortawesome/free-solid-svg-icons'
import { L10nTranslateDirective } from 'angular-l10n'
@@ -20,9 +20,9 @@ import { LayoutService } from '../../layout.service'
templateUrl: 'windows.component.html'
})
export class WindowsComponent implements OnDestroy {
- private readonly layout = inject(LayoutService)
protected readonly icons = { faXmark, faTimes }
protected windows: AppWindow[] = []
+ private readonly layout = inject(LayoutService)
private readonly subscription: Subscription = null
constructor() {
diff --git a/frontend/src/app/layout/sidebar/sidebar.left.component.ts b/frontend/src/app/layout/sidebar/sidebar.left.component.ts
index 4f5ce639..12e2cb61 100644
--- a/frontend/src/app/layout/sidebar/sidebar.left.component.ts
+++ b/frontend/src/app/layout/sidebar/sidebar.left.component.ts
@@ -33,28 +33,28 @@ import { LayoutService } from '../layout.service'
imports: [RouterLink, FaIconComponent, AutoResizeDirective, L10nTranslateDirective, NgComponentOutlet, AsyncPipe, NgTemplateOutlet]
})
export class SideBarLeftComponent implements OnDestroy {
+ @ViewChild('sidebar', { static: true }) sidebar: ElementRef
protected readonly store = inject(StoreService)
+ protected readonly icons = { faAngleLeft, faAngleRight, faUserSecret }
+ protected logoIconUrl = logoIconUrl
+ protected appName: string
+ protected appVersion: string
+ protected leftSideBarIsOpen = false
+ protected dynamicTitle: string
+ protected currentUrl: string
+ protected currentMenu: AppMenu
+ protected appsMenu: AppMenu = APP_MENU
private readonly router = inject(Router)
private readonly renderer = inject(Renderer2)
private readonly location = inject(Location)
private readonly authService = inject(AuthService)
private readonly layout = inject(LayoutService)
private readonly userService = inject(UserService)
- @ViewChild('sidebar', { static: true }) sidebar: ElementRef
private subscriptions: Subscription[] = []
private menuAppsHovered = false
private menuIconsHovered = false
private menuAppsHoveredTimeout: ReturnType<typeof setTimeout> = null
private menuIconsStopPropagation = false
- protected readonly icons = { faAngleLeft, faAngleRight, faUserSecret }
- protected logoIconUrl = logoIconUrl
- protected appName: string
- protected appVersion: string
- protected leftSideBarIsOpen = false
- protected dynamicTitle: string
- protected currentUrl: string
- protected currentMenu: AppMenu
- protected appsMenu: AppMenu = APP_MENU
constructor() {
this.appName = APP_NAME
diff --git a/frontend/src/app/layout/sidebar/sidebar.right.component.ts b/frontend/src/app/layout/sidebar/sidebar.right.component.ts
index afe52673..eb24b826 100644
--- a/frontend/src/app/layout/sidebar/sidebar.right.component.ts
+++ b/frontend/src/app/layout/sidebar/sidebar.right.component.ts
@@ -5,7 +5,7 @@
*/
import { AsyncPipe, NgComponentOutlet } from '@angular/common'
-import { Component, computed, OnDestroy, inject } from '@angular/core'
+import { Component, computed, inject, OnDestroy } from '@angular/core'
import { toObservable } from '@angular/core/rxjs-interop'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faBell, faFlag, faUser, faWindowRestore } from '@fortawesome/free-regular-svg-icons'
@@ -30,14 +30,14 @@ import { WindowsComponent } from './components/windows.component'
templateUrl: 'sidebar.right.component.html'
})
export class SideBarRightComponent implements OnDestroy {
- private readonly layout = inject(LayoutService)
- private readonly store = inject(StoreService)
protected visible = false
protected showComponents = false
protected tabs: TabMenu[] = []
protected theme = themeLight
protected networkIsOnline = true
protected readonly icons = { faWifi }
+ private readonly layout = inject(LayoutService)
+ private readonly store = inject(StoreService)
private subscriptions: Subscription[] = []
private showDelay: any = null
// tabs
@@ -108,6 +108,17 @@ export class SideBarRightComponent implements OnDestroy {
this.subscriptions.forEach((s) => s.unsubscribe())
}
+ setTabVisible(tabName: string) {
+ if (!this.visible) {
+ this.selectTab(tabName)
+ this.layout.toggleRSideBar(true)
+ } else if (tabName && tabName !== this.layout.currentRightSideBarTab) {
+ this.selectTab(tabName)
+ } else {
+ this.layout.toggleRSideBar(false)
+ }
+ }
+
private setVisible(state: boolean) {
if (state) {
clearTimeout(this.showDelay)
@@ -144,15 +155,4 @@ export class SideBarRightComponent implements OnDestroy {
}
}
}
-
- setTabVisible(tabName: string) {
- if (!this.visible) {
- this.selectTab(tabName)
- this.layout.toggleRSideBar(true)
- } else if (tabName && tabName !== this.layout.currentRightSideBarTab) {
- this.selectTab(tabName)
- } else {
- this.layout.toggleRSideBar(false)
- }
- }
}