Skip to content

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

fix(frontend:spaces):show disabled space state

johaven7a8b7f300fed
diff --git a/backend/src/applications/spaces/interfaces/space-trash.interface.ts b/backend/src/applications/spaces/interfaces/space-trash.interface.ts
index a220978d..628ce8ee 100644
--- a/backend/src/applications/spaces/interfaces/space-trash.interface.ts
+++ b/backend/src/applications/spaces/interfaces/space-trash.interface.ts
@@ -2,6 +2,7 @@ export interface SpaceTrash {
id: number
name: string
alias: string
+ enabled: boolean
mtime: number
ctime: number
nb: number
diff --git a/backend/src/applications/spaces/services/spaces-manager.service.ts b/backend/src/applications/spaces/services/spaces-manager.service.ts
index 8c776b41..111f1c7e 100644
--- a/backend/src/applications/spaces/services/spaces-manager.service.ts
+++ b/backend/src/applications/spaces/services/spaces-manager.service.ts
@@ -174,7 +174,7 @@ export class SpacesManager {
async listTrashes(user: UserModel): Promise<SpaceTrash[]> {
const trashes: SpaceTrash[] = []
// todo: store 'Personal files' as const somewhere (used in frontend too)
- const personalTrash: SpaceTrash = { id: 0, name: 'Personal files', alias: SPACE_ALIAS.PERSONAL, nb: 0, mtime: 0, ctime: 0 }
+ const personalTrash: SpaceTrash = { id: 0, name: 'Personal files', alias: SPACE_ALIAS.PERSONAL, nb: 0, mtime: 0, ctime: 0, enabled: true }
for (const space of [...(await this.listSpaces(user.id)), personalTrash] as SpaceTrash[]) {
const rPath = space.alias === SPACE_ALIAS.PERSONAL ? user.trashPath : SpaceModel.getTrashPath(space.alias)
try {
diff --git a/frontend/src/app/applications/spaces/components/trash.component.html b/frontend/src/app/applications/spaces/components/trash.component.html
index 6d900169..4cd55453 100644
--- a/frontend/src/app/applications/spaces/components/trash.component.html
+++ b/frontend/src/app/applications/spaces/components/trash.component.html
@@ -36,6 +36,7 @@
<div (click)="onSelect(t)"
(contextmenu)="onTargetContextMenu($event, t)"
(appTap)="browse(t)"
+ [class.disabled]="!t.enabled"
[class.selected]="t.id === selected?.id"
[style.height.px]="galleryMode.dimensions"
[style.width.px]="galleryMode.dimensions"
@@ -103,6 +104,7 @@
<tr (click)="onSelect(t)"
(contextmenu)="onTargetContextMenu($event, t)"
(appTap)="browse(t)"
+ [class.disabled]="!t.enabled"
[class.selected]="t.id === selected?.id">
@for (th of tableHeaders | keyvalue: originalOrderKeyValue; track th.key) {
@if (th.value.show) {
diff --git a/frontend/src/app/applications/spaces/components/trash.component.ts b/frontend/src/app/applications/spaces/components/trash.component.ts
index fcec0fde..ff74934a 100644
--- a/frontend/src/app/applications/spaces/components/trash.component.ts
+++ b/frontend/src/app/applications/spaces/components/trash.component.ts
@@ -147,6 +147,10 @@ export class TrashComponent implements OnInit {
}
browse(trash: TrashModel) {
- this.router.navigate([SPACES_PATH.SPACES_TRASH, trash.alias]).catch(console.error)
+ if (!trash.enabled) {
+ this.layout.sendNotification('warning', trash.name, 'Space is disabled')
+ } else {
+ this.router.navigate([SPACES_PATH.SPACES_TRASH, trash.alias]).catch(console.error)
+ }
}
}
diff --git a/frontend/src/app/applications/spaces/models/trash.model.ts b/frontend/src/app/applications/spaces/models/trash.model.ts
index a7cc45f1..7a9c4c7b 100644
--- a/frontend/src/app/applications/spaces/models/trash.model.ts
+++ b/frontend/src/app/applications/spaces/models/trash.model.ts
@@ -7,6 +7,7 @@ import { dJs } from '../../../common/utils/time'
export class TrashModel implements SpaceTrash {
alias: string
id: number
+ enabled: boolean
mtime: number
ctime: number
name: string