Skip to content

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

feat(frontend/backend:files): simplify file opening flow and improve readonly handling

johaven6563f445441c
diff --git a/backend/src/applications/files/modules/collabora-online/collabora-online-manager.service.ts b/backend/src/applications/files/modules/collabora-online/collabora-online-manager.service.ts
index 47d57247..54db5c2e 100644
--- a/backend/src/applications/files/modules/collabora-online/collabora-online-manager.service.ts
+++ b/backend/src/applications/files/modules/collabora-online/collabora-online-manager.service.ts
@@ -60,15 +60,13 @@ export class CollaboraOnlineManager {
private readonly filesLockManager: FilesLockManager
) {}
- async getSettings(user: UserModel, space: SpaceEnv, mode: FILE_MODE): Promise<CollaboraOnlineReqDto> {
+ async getSettings(user: UserModel, space: SpaceEnv): Promise<CollaboraOnlineReqDto> {
await this.checkSpace(space)
const fileExtension = path.extname(space.realPath).slice(1)
if (!COLLABORA_ONLINE_SUPPORTED_EXTENSIONS.has(fileExtension)) {
throw new HttpException('Document not supported', HttpStatus.BAD_REQUEST)
}
- if (mode === FILE_MODE.EDIT && !haveSpaceEnvPermissions(space, SPACE_OPERATION.MODIFY)) {
- mode = FILE_MODE.VIEW
- }
+ const mode: FILE_MODE = haveSpaceEnvPermissions(space, SPACE_OPERATION.MODIFY) ? FILE_MODE.EDIT : FILE_MODE.VIEW
if (mode === FILE_MODE.EDIT) {
// check lock conflicts
try {
diff --git a/backend/src/applications/files/modules/collabora-online/collabora-online.controller.ts b/backend/src/applications/files/modules/collabora-online/collabora-online.controller.ts
index 169228ad..0dfa1af4 100644
--- a/backend/src/applications/files/modules/collabora-online/collabora-online.controller.ts
+++ b/backend/src/applications/files/modules/collabora-online/collabora-online.controller.ts
@@ -4,13 +4,12 @@
* See the LICENSE file for licensing details
*/
-import { Controller, Get, HttpCode, HttpStatus, Post, Query, Request, Res, StreamableFile, UseInterceptors } from '@nestjs/common'
+import { Controller, Get, HttpCode, HttpStatus, Post, Request, Res, StreamableFile, UseInterceptors } from '@nestjs/common'
import { FastifyReply } from 'fastify'
import { ContextInterceptor } from '../../../../infrastructure/context/interceptors/context.interceptor'
import { SPACE_OPERATION } from '../../../spaces/constants/spaces'
import { OverrideSpacePermission } from '../../../spaces/decorators/space-override-permission.decorator'
import { FastifySpaceRequest } from '../../../spaces/interfaces/space-request.interface'
-import { FILE_MODE } from '../../constants/operations'
import { FilesMethods } from '../../services/files-methods.service'
import { CollaboraOnlineEnvironment } from './collabora-online-environment.decorator'
import { CollaboraOnlineManager } from './collabora-online-manager.service'
@@ -28,8 +27,8 @@ export class CollaboraOnlineController {
@Get(`${COLLABORA_ONLINE_ROUTE.SETTINGS}/*`)
@UseInterceptors(ContextInterceptor)
- collaboraOnlineSettings(@Request() req: FastifySpaceRequest, @Query('mode') mode: FILE_MODE = FILE_MODE.VIEW): Promise<CollaboraOnlineReqDto> {
- return this.filesCollaboraOnlineService.getSettings(req.user, req.space, mode)
+ collaboraOnlineSettings(@Request() req: FastifySpaceRequest): Promise<CollaboraOnlineReqDto> {
+ return this.filesCollaboraOnlineService.getSettings(req.user, req.space)
}
@Get(`${COLLABORA_ONLINE_ROUTE.FILES}/:dbFileHash/${COLLABORA_ONLINE_ROUTE.CONTENTS}`)
diff --git a/backend/src/applications/files/modules/only-office/only-office-manager.service.ts b/backend/src/applications/files/modules/only-office/only-office-manager.service.ts
index 8488392f..32bfb16f 100644
--- a/backend/src/applications/files/modules/only-office/only-office-manager.service.ts
+++ b/backend/src/applications/files/modules/only-office/only-office-manager.service.ts
@@ -70,13 +70,9 @@ export class OnlyOfficeManager {
private readonly filesLockManager: FilesLockManager
) {}
- getStatus(): { enabled: boolean } {
- return { enabled: configuration.applications.files.onlyoffice.enabled }
- }
-
- async getSettings(user: UserModel, space: SpaceEnv, mode: FILE_MODE, req: FastifySpaceRequest): Promise<OnlyOfficeReqDto> {
+ async getSettings(user: UserModel, space: SpaceEnv, req: FastifySpaceRequest): Promise<OnlyOfficeReqDto> {
if (!(await isPathExists(space.realPath))) {
- throw new HttpException('Document not found', HttpStatus.NOT_FOUND)
+ throw new HttpException('Document not found', HttpStatus.BAD_REQUEST)
}
if (await isPathIsDir(space.realPath)) {
throw new HttpException('Document must be a file', HttpStatus.BAD_REQUEST)
@@ -85,9 +81,8 @@ export class OnlyOfficeManager {
if (!ONLY_OFFICE_EXTENSIONS.VIEWABLE.has(fileExtension) && !ONLY_OFFICE_EXTENSIONS.EDITABLE.has(fileExtension)) {
throw new HttpException('Document not supported', HttpStatus.BAD_REQUEST)
}
- if (mode === FILE_MODE.EDIT && (!ONLY_OFFICE_EXTENSIONS.EDITABLE.has(fileExtension) || !haveSpaceEnvPermissions(space, SPACE_OPERATION.MODIFY))) {
- mode = FILE_MODE.VIEW
- }
+ const mode: FILE_MODE =
+ ONLY_OFFICE_EXTENSIONS.EDITABLE.has(fileExtension) && haveSpaceEnvPermissions(space, SPACE_OPERATION.MODIFY) ? FILE_MODE.EDIT : FILE_MODE.VIEW
if (mode === FILE_MODE.EDIT) {
// check lock conflicts
try {
diff --git a/backend/src/applications/files/modules/only-office/only-office.controller.ts b/backend/src/applications/files/modules/only-office/only-office.controller.ts
index f8c36399..b2260b5a 100644
--- a/backend/src/applications/files/modules/only-office/only-office.controller.ts
+++ b/backend/src/applications/files/modules/only-office/only-office.controller.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Body, Controller, Get, HttpCode, HttpStatus, Post, Query, Request, Res, StreamableFile, UseInterceptors } from '@nestjs/common'
+import { Body, Controller, Get, HttpCode, HttpStatus, Post, Request, Res, StreamableFile, UseInterceptors } from '@nestjs/common'
import { FastifyReply } from 'fastify'
import { ContextInterceptor } from '../../../../infrastructure/context/interceptors/context.interceptor'
import { SPACE_OPERATION } from '../../../spaces/constants/spaces'
@@ -14,7 +14,6 @@ import { FastifySpaceRequest } from '../../../spaces/interfaces/space-request.in
import { SpaceEnv } from '../../../spaces/models/space-env.model'
import { GetUser } from '../../../users/decorators/user.decorator'
import { UserModel } from '../../../users/models/user.model'
-import { FILE_MODE } from '../../constants/operations'
import { FilesMethods } from '../../services/files-methods.service'
import { OnlyOfficeEnvironment } from './only-office-environment.decorator'
import { OnlyOfficeManager } from './only-office-manager.service'
@@ -31,8 +30,8 @@ export class OnlyOfficeController {
@Get(`${ONLY_OFFICE_ROUTE.SETTINGS}/*`)
@UseInterceptors(ContextInterceptor)
- onlyOfficeSettings(@Query('mode') mode: FILE_MODE = FILE_MODE.VIEW, @Request() req: FastifySpaceRequest): Promise<OnlyOfficeReqDto> {
- return this.filesOnlyOfficeManager.getSettings(req.user, req.space, mode, req)
+ onlyOfficeSettings(@Request() req: FastifySpaceRequest): Promise<OnlyOfficeReqDto> {
+ return this.filesOnlyOfficeManager.getSettings(req.user, req.space, req)
}
@Get(`${ONLY_OFFICE_ROUTE.DOCUMENT}/*`)
diff --git a/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.html b/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.html
index 23936add..04895582 100644
--- a/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.html
+++ b/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.html
@@ -26,9 +26,9 @@
}
@case (SHORT_MIME.DOCUMENT) {
@if (store.fileSettings().editor.collaboraOnline) {
- <app-files-viewer-collabora-online [currentHeight]="currentHeight" [file]="currentFile" [mode]="mode"></app-files-viewer-collabora-online>
+ <app-files-viewer-collabora-online [currentHeight]="currentHeight" [file]="currentFile" [(isReadonly)]="isReadonly"></app-files-viewer-collabora-online>
} @else if (store.fileSettings().editor.onlyOffice) {
- <app-files-viewer-only-office [currentHeight]="currentHeight" [file]="currentFile" [mode]="mode"></app-files-viewer-only-office>
+ <app-files-viewer-only-office [currentHeight]="currentHeight" [file]="currentFile" [(isReadonly)]="isReadonly"></app-files-viewer-only-office>
} @else {
<!--This case should never happen-->
<div [style.height.px]="currentHeight" class="d-flex p-4" l10nTranslate>No editor found</div>
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 1ef80b46..db9988a6 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
@@ -54,7 +54,7 @@ export class FilesViewerDialogComponent implements OnInit, OnDestroy {
private readonly offsetTop = 42
ngOnInit() {
- this.isReadonly.set(this.mode === FILE_MODE.VIEW || this.hookedShortMime === SHORT_MIME.PDF)
+ this.isReadonly.set(this.mode === FILE_MODE.VIEW)
this.openedFile = { id: this.currentFile.id, name: this.currentFile.name, mimeUrl: this.currentFile.mimeUrl }
this.onResize()
}
diff --git a/frontend/src/app/applications/files/components/viewers/files-viewer-collabora-online.component.ts b/frontend/src/app/applications/files/components/viewers/files-viewer-collabora-online.component.ts
index 9b430f3c..a279192d 100644
--- a/frontend/src/app/applications/files/components/viewers/files-viewer-collabora-online.component.ts
+++ b/frontend/src/app/applications/files/components/viewers/files-viewer-collabora-online.component.ts
@@ -4,8 +4,8 @@
* See the LICENSE file for licensing details
*/
-import { HttpClient, HttpErrorResponse, HttpParams } from '@angular/common/http'
-import { Component, inject, input, Input, OnDestroy, OnInit } from '@angular/core'
+import { HttpClient, HttpErrorResponse } from '@angular/common/http'
+import { Component, inject, input, model, OnDestroy, OnInit } from '@angular/core'
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'
import { FILE_MODE } from '@sync-in-server/backend/src/applications/files/constants/operations'
import { COLLABORA_OWNER_LOCK } from '@sync-in-server/backend/src/applications/files/modules/collabora-online/collabora-online.constants'
@@ -29,8 +29,8 @@ import { FileModel } from '../../models/file.model'
`
})
export class FilesViewerCollaboraOnlineComponent implements OnInit, OnDestroy {
- @Input({ required: true }) file: FileModel
- @Input({ required: true }) mode: FILE_MODE
+ file = input.required<FileModel>()
+ isReadonly = model.required<boolean>()
currentHeight = input<number>()
protected documentServerUrl: SafeResourceUrl = null
private readonly http = inject(HttpClient)
@@ -39,34 +39,33 @@ export class FilesViewerCollaboraOnlineComponent implements OnInit, OnDestroy {
private readonly sanitizer = inject(DomSanitizer)
ngOnInit() {
- this.http
- .get<CollaboraOnlineReqDto>(`${API_COLLABORA_ONLINE_SETTINGS}/${this.file.path}`, { params: new HttpParams().set('mode', this.mode) })
- .subscribe({
- next: (data) => {
- if (!data) {
- this.layout.closeDialog()
- this.layout.sendNotification('error', 'Unable to open document', 'Settings are missing')
- return
- }
- if (data.mode === FILE_MODE.EDIT) {
- // Set lock on file
- this.file.createLock({
- owner: `${COLLABORA_OWNER_LOCK} - ${this.store.user.getValue().fullName} (${this.store.user.getValue().email})`,
- ownerLogin: this.store.user.getValue().login,
- isExclusive: false
- })
- }
- this.documentServerUrl = this.sanitizer.bypassSecurityTrustResourceUrl(`${data.documentServerUrl}&lang=${this.layout.getCurrentLanguage()}`)
- },
- error: (e: HttpErrorResponse) => {
+ this.http.get<CollaboraOnlineReqDto>(`${API_COLLABORA_ONLINE_SETTINGS}/${this.file().path}`).subscribe({
+ next: (data) => {
+ if (!data) {
this.layout.closeDialog()
- this.layout.sendNotification('error', 'Unable to open document', e.error.message)
+ this.layout.sendNotification('error', 'Unable to open document', 'Settings are missing')
+ return
}
- })
+ this.isReadonly.set(data.mode === FILE_MODE.VIEW)
+ if (!this.isReadonly()) {
+ // Set lock on file
+ this.file().createLock({
+ owner: `${COLLABORA_OWNER_LOCK} - ${this.store.user.getValue().fullName} (${this.store.user.getValue().email})`,
+ ownerLogin: this.store.user.getValue().login,
+ isExclusive: false
+ })
+ }
+ this.documentServerUrl = this.sanitizer.bypassSecurityTrustResourceUrl(`${data.documentServerUrl}&lang=${this.layout.getCurrentLanguage()}`)
+ },
+ error: (e: HttpErrorResponse) => {
+ this.layout.closeDialog()
+ this.layout.sendNotification('error', 'Unable to open document', e.error.message)
+ }
+ })
}
ngOnDestroy() {
// Remove lock
- this.file.removeLock()
+ this.file().removeLock()
}
}
diff --git a/frontend/src/app/applications/files/components/viewers/files-viewer-image.component.ts b/frontend/src/app/applications/files/components/viewers/files-viewer-image.component.ts
index 98f2da70..993ab815 100755
--- a/frontend/src/app/applications/files/components/viewers/files-viewer-image.component.ts
+++ b/frontend/src/app/applications/files/components/viewers/files-viewer-image.component.ts
@@ -22,9 +22,9 @@ import { FileModel } from '../../models/file.model'
changeDetection: ChangeDetectionStrategy.OnPush
})
export class FilesViewerImageComponent {
- file = model<FileModel>()
- directoryImages = input<FileModel[]>()
- currentHeight = input<number>()
+ file = model.required<FileModel>()
+ directoryImages = input.required<FileModel[]>()
+ currentHeight = input.required<number>()
currentHeightWithOffset = computed(() => this.currentHeight() - 40)
protected isInfoboxOpen = signal(false)
protected isSlideshowActive = signal(false)
diff --git a/frontend/src/app/applications/files/components/viewers/files-viewer-only-office.component.ts b/frontend/src/app/applications/files/components/viewers/files-viewer-only-office.component.ts
index bfca1b5f..069b1bb0 100644
--- a/frontend/src/app/applications/files/components/viewers/files-viewer-only-office.component.ts
+++ b/frontend/src/app/applications/files/components/viewers/files-viewer-only-office.component.ts
@@ -4,8 +4,8 @@
* See the LICENSE file for licensing details
*/
-import { HttpClient, HttpErrorResponse, HttpParams } from '@angular/common/http'
-import { Component, inject, input, Input, OnDestroy, OnInit } from '@angular/core'
+import { HttpClient, HttpErrorResponse } from '@angular/common/http'
+import { Component, inject, input, model, OnDestroy, OnInit } from '@angular/core'
import { FILE_MODE } from '@sync-in-server/backend/src/applications/files/constants/operations'
import { ONLY_OFFICE_OWNER_LOCK } from '@sync-in-server/backend/src/applications/files/modules/only-office/only-office.constants'
import type { OnlyOfficeReqDto } from '@sync-in-server/backend/src/applications/files/modules/only-office/only-office.dtos'
@@ -41,9 +41,9 @@ import { OnlyOfficeComponent } from '../utils/only-office.component'
`
})
export class FilesViewerOnlyOfficeComponent implements OnInit, OnDestroy {
- @Input({ required: true }) file: FileModel
- @Input({ required: true }) mode: FILE_MODE
- currentHeight = input<number>()
+ file = input.required<FileModel>()
+ isReadonly = model.required<boolean>()
+ currentHeight = input.required<number>()
protected docId: string
protected documentConfig: OnlyOfficeReqDto = null
private readonly http = inject(HttpClient)
@@ -51,17 +51,18 @@ export class FilesViewerOnlyOfficeComponent implements OnInit, OnDestroy {
private readonly store = inject(StoreService)
ngOnInit() {
- this.docId = `viewer-doc-${this.file.id}`
- this.http.get<OnlyOfficeReqDto>(`${API_ONLY_OFFICE_SETTINGS}/${this.file.path}`, { params: new HttpParams().set('mode', this.mode) }).subscribe({
+ this.docId = `viewer-doc-${this.file().id}`
+ this.http.get<OnlyOfficeReqDto>(`${API_ONLY_OFFICE_SETTINGS}/${this.file().path}`).subscribe({
next: (data) => {
if (!data) {
this.layout.closeDialog()
this.layout.sendNotification('error', 'Unable to open document', 'Settings are missing')
return
}
- if (data.config.editorConfig.mode === FILE_MODE.EDIT) {
+ this.isReadonly.set(data.config.editorConfig.mode === FILE_MODE.VIEW)
+ if (!this.isReadonly()) {
// Set lock on file
- this.file.createLock({
+ this.file().createLock({
owner: `${ONLY_OFFICE_OWNER_LOCK} - ${this.store.user.getValue().fullName} (${this.store.user.getValue().email})`,
ownerLogin: this.store.user.getValue().login,
isExclusive: false
@@ -73,14 +74,14 @@ export class FilesViewerOnlyOfficeComponent implements OnInit, OnDestroy {
},
error: (e: HttpErrorResponse) => {
this.layout.closeDialog()
- this.layout.sendNotification('error', 'Unable to open document', e.error.message)
+ this.layout.sendNotification('error', 'Unable to open document', e.status === 404 ? 'Unable to load OnlyOffice editor' : e.error.message)
}
})
}
ngOnDestroy() {
// Remove lock
- this.file.removeLock()
+ this.file().removeLock()
}
loadError(e: { title: string; message: string }): void {
@@ -89,6 +90,6 @@ export class FilesViewerOnlyOfficeComponent implements OnInit, OnDestroy {
}
onSave() {
- this.file.updateHTimeAgo()
+ this.file().updateHTimeAgo()
}
}
diff --git a/frontend/src/app/applications/files/services/files.service.ts b/frontend/src/app/applications/files/services/files.service.ts
index 4df2fab9..00199e47 100644
--- a/frontend/src/app/applications/files/services/files.service.ts
+++ b/frontend/src/app/applications/files/services/files.service.ts
@@ -258,25 +258,26 @@ export class FilesService {
})
}
- async openViewerDialog(mode: FILE_MODE, file: FileModel, directoryFiles: FileModel[], permissions: string) {
+ async openViewerDialog(file: FileModel, directoryFiles: FileModel[], permissions: string) {
this.http.head(file.dataUrl).subscribe({
next: async () => {
+ // This check is only used for the text viewer; other viewers are read-only or enforce permissions on the backend.
+ const isLockedByOther = file?.lock?.isExclusive && file.lock?.ownerLogin !== this.store.user.getValue().login
+ const isWriteable = !isLockedByOther && permissions.indexOf(SPACE_OPERATION.MODIFY) > -1
+ const mode: FILE_MODE = isWriteable ? FILE_MODE.EDIT : FILE_MODE.VIEW
+
let hookedShortMime: string
try {
hookedShortMime = await this.viewerHook(mode, file)
+ if (isLockedByOther) {
+ this.layout.sendNotification('info', 'The file is locked', file.lock.owner)
+ }
} catch {
// No office editors are enabled, falling back to download
this.download(file)
return
}
- const isLockedByOther = file?.lock?.isExclusive && file.lock?.ownerLogin !== this.store.user.getValue().login
- if (isLockedByOther) {
- this.layout.sendNotification('info', 'The file is locked', file.lock.owner)
- }
- const isWriteable = !isLockedByOther && permissions.indexOf(SPACE_OPERATION.MODIFY) > -1
- if (mode === FILE_MODE.EDIT && !isWriteable) {
- mode = FILE_MODE.VIEW
- }
+
this.layout.openDialog(FilesViewerDialogComponent, 'full', {
id: file.id, // only used to manage the modal
initialState: {
@@ -296,7 +297,9 @@ export class FilesService {
private async viewerHook(mode: FILE_MODE, file: FileModel): Promise<string> {
const fileSettings = await this.getFileSettings()
- const hasEnabledOfficeEditor = fileSettings ? fileSettings.editor.onlyOffice || fileSettings.editor.collaboraOnline : false
+ const onlyOfficeAvailable = fileSettings ? fileSettings.editor.onlyOffice : false
+ const collaboraAvailable = fileSettings ? fileSettings.editor.collaboraOnline : false
+ const hasEnabledOfficeEditor = onlyOfficeAvailable || collaboraAvailable || false
if (file.shortMime === SHORT_MIME.DOCUMENT && !hasEnabledOfficeEditor) {
if (file.mime.startsWith('text-')) {
return SHORT_MIME.TEXT
@@ -304,7 +307,7 @@ export class FilesService {
throw new Error('No editor found')
}
if (file.shortMime === SHORT_MIME.PDF) {
- if (mode === FILE_MODE.EDIT && hasEnabledOfficeEditor) {
+ if (mode === FILE_MODE.EDIT && onlyOfficeAvailable) {
return SHORT_MIME.DOCUMENT
}
}
diff --git a/frontend/src/app/applications/spaces/components/spaces-browser.component.html b/frontend/src/app/applications/spaces/components/spaces-browser.component.html
index 40ff43e5..df6dc509 100644
--- a/frontend/src/app/applications/spaces/components/spaces-browser.component.html
+++ b/frontend/src/app/applications/spaces/components/spaces-browser.component.html
@@ -120,17 +120,10 @@
</button>
<ul *dropdownMenu class="dropdown-menu" role="menu">
@if (selection.length === 1) {
- @if (selection[0].isViewable) {
+ @if (selection[0]) {
<li role="menuitem">
- <a (click)="shortcutView()" class="dropdown-item">
- <span l10nTranslate><fa-icon [icon]="icons.faEye"></fa-icon>View</span>
- </a>
- </li>
- }
- @if (selection[0].isEditable) {
- <li role="menuitem">
- <a (click)="shortcutEdit()" class="dropdown-item">
- <span l10nTranslate><fa-icon [icon]="icons.faPen"></fa-icon>Edit</span>
+ <a (click)="shortcutOpen()" class="dropdown-item">
+ <span l10nTranslate><fa-icon [icon]="selection[0].isDir ? icons.faFolderOpen : icons.faEye"></fa-icon>Open</span>
</a>
</li>
}
@@ -493,14 +486,9 @@
<!--Start Context Menu -->
<context-menu #FileContextMenu>
@if (selection.length === 1) {
- @if (selection[0].isViewable) {
- <ng-template (execute)="shortcutView()" contextMenuItem>
- <span l10nTranslate><fa-icon [icon]="icons.faEye"></fa-icon>View</span>
- </ng-template>
- }
- @if (selection[0].isEditable) {
- <ng-template (execute)="shortcutEdit()" contextMenuItem>
- <span l10nTranslate><fa-icon [icon]="icons.faPen"></fa-icon>Edit</span>
+ @if (selection[0]) {
+ <ng-template (execute)="shortcutOpen()" contextMenuItem>
+ <span l10nTranslate><fa-icon [icon]="selection[0].isDir ? icons.faFolderOpen : icons.faEye"></fa-icon>Open</span>
</ng-template>
}
@if (!inSharesList) {
@@ -517,6 +505,11 @@
</ng-template>
}
}
+ @if (!hasDisabledItemsInSelection) {
+ <ng-template (execute)="downloadFiles()" contextMenuItem>
+ <span l10nTranslate><fa-icon [icon]="icons.faDownload"></fa-icon>Download</span>
+ </ng-template>
+ }
@if (canCompress) {
<ng-template (execute)="openCompressionDialog()" contextMenuItem>
<span l10nTranslate><fa-icon [icon]="icons.faFileArchive"></fa-icon>Compress</span>
@@ -540,11 +533,6 @@
<ng-template (execute)="addToClipboard()" contextMenuItem>
<span l10nTranslate><fa-icon [icon]="icons.faClipboardList"></fa-icon>Clipboard</span>
</ng-template>
- @if (!hasDisabledItemsInSelection) {
- <ng-template (execute)="downloadFiles()" contextMenuItem>
- <span l10nTranslate><fa-icon [icon]="icons.faDownload"></fa-icon>Download</span>
- </ng-template>
- }
<ng-template (execute)="layout.showRSideBarTab(TAB_MENU.SELECTION)" contextMenuItem>
<span l10nTranslate><fa-icon [icon]="icons.faCircleInfo"></fa-icon>Info</span>
</ng-template>
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 b442f6a3..d49498bf 100644
--- a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts
+++ b/frontend/src/app/applications/spaces/components/spaces-browser.component.ts
@@ -24,6 +24,7 @@ import {
faEye,
faFileAlt,
faFileArchive,
+ faFolderOpen,
faGlobe,
faLink,
faLock,
@@ -36,7 +37,7 @@ import {
} from '@fortawesome/free-solid-svg-icons'
import { ContextMenuComponent, ContextMenuModule } from '@perfectmemory/ngx-contextmenu'
import { tarExtension } from '@sync-in-server/backend/src/applications/files/constants/compress'
-import { FILE_MODE, FILE_OPERATION } from '@sync-in-server/backend/src/applications/files/constants/operations'
+import { FILE_OPERATION } from '@sync-in-server/backend/src/applications/files/constants/operations'
import type { CompressFileDto } from '@sync-in-server/backend/src/applications/files/dto/file-operations.dto'
import type { FileProps } from '@sync-in-server/backend/src/applications/files/interfaces/file-props.interface'
import type { FileSpace } from '@sync-in-server/backend/src/applications/files/interfaces/file-space.interface'
@@ -138,6 +139,7 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
faEllipsis,
faPen,
faEye,
+ faFolderOpen,
faRotate,
faCommentDots,
faFileArchive,
@@ -418,7 +420,7 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
if (file.isDir) {
this.router.navigate([file.root?.alias || file.name], { relativeTo: this.activatedRoute }).catch(console.error)
} else {
- this.shortcutView(true)
+ this.shortcutOpen()
}
}
}
@@ -436,22 +438,16 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
}
}
- shortcutView(editMode = false) {
+ shortcutOpen() {
if (this.selection[0].isDir) {
this.browse(this.selection[0])
- } else if (editMode && this.selection[0].isEditable) {
- this.shortcutEdit()
- } else if (this.selection[0].isViewable) {
- this.openViewerDialog(FILE_MODE.VIEW)
+ } else if (this.selection[0].isViewable || this.selection[0].isEditable) {
+ this.openViewerDialog()
} else {
this.downloadFiles()
}
}
- shortcutEdit() {
- this.openViewerDialog(FILE_MODE.EDIT)
- }
-
shortcutUploadFiles() {
if (!this.uploadButtonsShowed) {
const newButton = document.getElementById('newButton')
@@ -722,7 +718,7 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
return f
}
- private openViewerDialog(mode: FILE_MODE) {
+ private openViewerDialog() {
const f = this.selection[0]
let permissions: string
if (this.inSharesList) {
@@ -730,7 +726,7 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
} else {
permissions = f?.root ? intersectPermissions(this.spacePermissions, f?.root.permissions) : this.spacePermissions
}
- this.filesService.openViewerDialog(mode, f, this.files, permissions).catch(console.error)
+ this.filesService.openViewerDialog(f, this.files, permissions).catch(console.error)
}
private focusOn(selectName: string) {
diff --git a/frontend/src/i18n/de.json b/frontend/src/i18n/de.json
index 84a70188..a30c990d 100644
--- a/frontend/src/i18n/de.json
+++ b/frontend/src/i18n/de.json
@@ -17,6 +17,7 @@
"Confirm": "Bestätigen",
"Cancel": "Abbrechen",
"Close": "Schließen",
+ "Open": "Öffnen",
"Server connection error": "Fehler bei der Serververbindung",
"Filter": "Filtern",
"Filters": "Filter",
@@ -466,7 +467,6 @@
"busy": "beschäftigt",
"absent": "abwesend",
"offline": "offline",
- "View": "Ansehen",
"Session has expired": "Sitzung ist abgelaufen",
"Please sign in": "Bitte melden Sie sich an",
"logout": "abmelden",
diff --git a/frontend/src/i18n/es.json b/frontend/src/i18n/es.json
index 39236d7a..fc665523 100644
--- a/frontend/src/i18n/es.json
+++ b/frontend/src/i18n/es.json
@@ -17,6 +17,7 @@
"Confirm": "Confirmar",
"Cancel": "Cancelar",
"Close": "Cerrar",
+ "Open": "Abrir",
"Server connection error": "Error de conexión con el servidor",
"Filter": "Filtrar",
"Filters": "Filtros",
@@ -466,7 +467,6 @@
"busy": "ocupado",
"absent": "ausente",
"offline": "desconectado",
- "View": "Ver",
"Session has expired": "La sesión ha expirado",
"Please sign in": "Por favor, inicie sesión",
"logout": "cerrar sesión",
diff --git a/frontend/src/i18n/fr.json b/frontend/src/i18n/fr.json
index 3976bb0e..721d520e 100644
--- a/frontend/src/i18n/fr.json
+++ b/frontend/src/i18n/fr.json
@@ -17,6 +17,7 @@
"Confirm": "Confirmer",
"Cancel": "Annuler",
"Close": "Fermer",
+ "Open": "Ouvrir",
"Server connection error": "Erreur de connexion au serveur",
"Filter": "Filtrer",
"Filters": "Filtres",
@@ -466,7 +467,6 @@
"busy": "occupé",
"absent": "absent",
"offline": "hors ligne",
- "View": "Voir",
"Session has expired": "La session a expiré",
"Please sign in": "Veuillez vous reconnecter",
"logout": "déconnexion",
diff --git a/frontend/src/i18n/hi.json b/frontend/src/i18n/hi.json
index 3cecc69a..1cc2396c 100644
--- a/frontend/src/i18n/hi.json
+++ b/frontend/src/i18n/hi.json
@@ -17,6 +17,7 @@
"Confirm": "पुष्टि करें",
"Cancel": "रद्द करें",
"Close": "बंद करें",
+ "Open": "खोलें",
"Server connection error": "सर्वर कनेक्शन त्रुटि",
"Filter": "फ़िल्टर",
"Filters": "फ़िल्टर",
@@ -466,7 +467,6 @@
"busy": "व्यस्त",
"absent": "अनुपस्थित",
"offline": "ऑफ़लाइन",
- "View": "देखें",
"Session has expired": "सत्र समाप्त हो गया है",
"Please sign in": "कृपया साइन इन करें",
"logout": "साइन आउट",
diff --git a/frontend/src/i18n/it.json b/frontend/src/i18n/it.json
index 8d091c7a..3bec73c7 100644
--- a/frontend/src/i18n/it.json
+++ b/frontend/src/i18n/it.json
@@ -17,6 +17,7 @@
"Confirm": "Conferma",
"Cancel": "Annulla",
"Close": "Chiudi",
+ "Open": "Apri",
"Server connection error": "Errore di connessione al server",
"Filter": "Filtra",
"Filters": "Filtri",
@@ -466,7 +467,6 @@
"busy": "occupato",
"absent": "assente",
"offline": "offline",
- "View": "Vedi",
"Session has expired": "La sessione è scaduta",
"Please sign in": "Per favore, accedi",
"logout": "esci",
diff --git a/frontend/src/i18n/ja.json b/frontend/src/i18n/ja.json
index daf74272..71ec8b95 100644
--- a/frontend/src/i18n/ja.json
+++ b/frontend/src/i18n/ja.json
@@ -17,6 +17,7 @@
"Confirm": "確認",
"Cancel": "キャンセル",
"Close": "閉じる",
+ "Open": "開く",
"Server connection error": "サーバー接続エラー",
"Filter": "フィルター",
"Filters": "フィルター",
@@ -466,7 +467,6 @@
"busy": "使用中",
"absent": "不在",
"offline": "オフライン",
- "View": "表示",
"Session has expired": "セッションの有効期限が切れました",
"Please sign in": "再度サインインしてください",
"logout": "ログアウト",
diff --git a/frontend/src/i18n/ko.json b/frontend/src/i18n/ko.json
index f931fa35..ff07fcf0 100644
--- a/frontend/src/i18n/ko.json
+++ b/frontend/src/i18n/ko.json
@@ -17,6 +17,7 @@
"Confirm": "확인",
"Cancel": "취소",
"Close": "닫기",
+ "Open": "열기",
"Server connection error": "서버 연결 오류",
"Filter": "필터",
"Filters": "필터",
@@ -466,7 +467,6 @@
"busy": "바쁨",
"absent": "부재",
"offline": "오프라인",
- "View": "보기",
"Session has expired": "세션이 만료되었습니다",
"Please sign in": "다시 로그인해 주세요",
"logout": "로그아웃",
diff --git a/frontend/src/i18n/pl.json b/frontend/src/i18n/pl.json
index b8afee5b..57e3edda 100644
--- a/frontend/src/i18n/pl.json
+++ b/frontend/src/i18n/pl.json
@@ -17,6 +17,7 @@
"Confirm": "Potwierdź",
"Cancel": "Anuluj",
"Close": "Zamknij",
+ "Open": "Otwórz",
"Server connection error": "Błąd połączenia z serwerem",
"Filter": "Filtr",
"Filters": "Filtry",
@@ -466,7 +467,6 @@
"busy": "zajęty",
"absent": "nieobecny",
"offline": "offline",
- "View": "Zobacz",
"Session has expired": "Sesja wygasła",
"Please sign in": "Zaloguj się ponownie",
"logout": "wyloguj",
diff --git a/frontend/src/i18n/pt-BR.json b/frontend/src/i18n/pt-BR.json
index 01307b73..93f2729a 100644
--- a/frontend/src/i18n/pt-BR.json
+++ b/frontend/src/i18n/pt-BR.json
@@ -17,6 +17,7 @@
"Confirm": "Confirmar",
"Cancel": "Cancelar",
"Close": "Fechar",
+ "Open": "Abrir",
"Server connection error": "Erro de conexão com o servidor",
"Filter": "Filtrar",
"Filters": "Filtros",
@@ -466,7 +467,6 @@
"busy": "ocupado",
"absent": "ausente",
"offline": "offline",
- "View": "Ver",
"Session has expired": "A sessão expirou",
"Please sign in": "Faça login novamente",
"logout": "sair",
diff --git a/frontend/src/i18n/pt.json b/frontend/src/i18n/pt.json
index 408a55fd..8a21e900 100644
--- a/frontend/src/i18n/pt.json
+++ b/frontend/src/i18n/pt.json
@@ -17,6 +17,7 @@
"Confirm": "Confirmar",
"Cancel": "Cancelar",
"Close": "Fechar",
+ "Open": "Abrir",
"Server connection error": "Erro de conexão com o servidor",
"Filter": "Filtrar",
"Filters": "Filtros",
@@ -466,7 +467,6 @@
"busy": "ocupado",
"absent": "ausente",
"offline": "desconectado",
- "View": "Ver",
"Session has expired": "A sessão expirou",
"Please sign in": "Por favor, faça login",
"logout": "sair",
diff --git a/frontend/src/i18n/ru.json b/frontend/src/i18n/ru.json
index b155eb45..ea5ca2e4 100644
--- a/frontend/src/i18n/ru.json
+++ b/frontend/src/i18n/ru.json
@@ -17,6 +17,7 @@
"Confirm": "Подтвердить",
"Cancel": "Отмена",
"Close": "Закрыть",
+ "Open": "Открыть",
"Server connection error": "Ошибка подключения к серверу",
"Filter": "Фильтровать",
"Filters": "Фильтры",
@@ -466,7 +467,6 @@
"busy": "занят",
"absent": "отсутствует",
"offline": "не в сети",
- "View": "Просмотр",
"Session has expired": "Сессия истекла",
"Please sign in": "Пожалуйста, войдите",
"logout": "выйти",
diff --git a/frontend/src/i18n/tr.json b/frontend/src/i18n/tr.json
index 53496eaf..56107f71 100644
--- a/frontend/src/i18n/tr.json
+++ b/frontend/src/i18n/tr.json
@@ -17,6 +17,7 @@
"Confirm": "Onayla",
"Cancel": "İptal",
"Close": "Kapat",
+ "Open": "Aç",
"Server connection error": "Sunucu bağlantı hatası",
"Filter": "Filtre",
"Filters": "Filtreler",
@@ -466,7 +467,6 @@
"busy": "meşgul",
"absent": "yok",
"offline": "çevrimdışı",
- "View": "Görüntüle",
"Session has expired": "Oturumun süresi doldu",
"Please sign in": "Lütfen yeniden giriş yapın",
"logout": "çıkış",
diff --git a/frontend/src/i18n/zh.json b/frontend/src/i18n/zh.json
index 17a4c3f0..882e8586 100644
--- a/frontend/src/i18n/zh.json
+++ b/frontend/src/i18n/zh.json
@@ -17,6 +17,7 @@
"Confirm": "确认",
"Cancel": "取消",
"Close": "关闭",
+ "Open": "打开",
"Server connection error": "服务器连接错误",
"Filter": "筛选",
"Filters": "筛选器",
@@ -466,7 +467,6 @@
"busy": "忙碌",
"absent": "离开",
"offline": "离线",
- "View": "查看",
"Session has expired": "会话已过期",
"Please sign in": "请登录",
"logout": "退出登录",