Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
feat(frontend:admin): show cumulative storage usage for users and spaces
johaven5af4996db40a
diff --git a/frontend/src/app/applications/admin/components/admin-spaces.component.html b/frontend/src/app/applications/admin/components/admin-spaces.component.htmlindex 99c9c9e4..091b9050 100644--- a/frontend/src/app/applications/admin/components/admin-spaces.component.html+++ b/frontend/src/app/applications/admin/components/admin-spaces.component.html@@ -122,7 +122,8 @@<!--End Table Files Content--><!--Start Foot Content--><div class="app-foot-menu">- <span class="mx-auto">{{ spaces.length }} {{ 'spaces' | translate:locale.language }}</span>+ <span>{{ spaces.length }} {{ 'spaces' | translate:locale.language }}</span>+ <div class="ms-auto"><span l10nTranslate>Total</span> {{ storageUsage | toBytes }}</div></div><!--End Foot Content--><!--Start Context Menu -->diff --git a/frontend/src/app/applications/admin/components/admin-spaces.component.ts b/frontend/src/app/applications/admin/components/admin-spaces.component.tsindex 34a2e0f0..8042e80b 100644--- a/frontend/src/app/applications/admin/components/admin-spaces.component.ts+++ b/frontend/src/app/applications/admin/components/admin-spaces.component.ts@@ -28,6 +28,7 @@ import { SPACES_ICON } from '../../spaces/spaces.constants'import { UserAvatarComponent } from '../../users/components/utils/user-avatar.component'import { ADMIN_ICON, ADMIN_PATH, ADMIN_TITLE } from '../admin.constants'import { AdminService } from '../admin.service'+import { ToBytesPipe } from '../../../common/pipes/to-bytes.pipe'@Component({selector: 'app-admin-spaces',@@ -44,7 +45,8 @@ import { AdminService } from '../admin.service'SearchFilterPipe,TapDirective,BadgeMembersComponent,- StorageUsageComponent+ StorageUsageComponent,+ ToBytesPipe],templateUrl: 'admin-spaces.component.html'})@@ -116,6 +118,7 @@ export class AdminSpacesComponent {protected loading = falseprotected spaces: SpaceModel[] = []protected selected: SpaceModel = null+ protected storageUsage = 0private readonly activatedRoute = inject(ActivatedRoute)private readonly spacesService = inject(SpacesService)private readonly adminService = inject(AdminService)@@ -147,6 +150,7 @@ export class AdminSpacesComponent {this.onSelect()this.adminService.listSpaces().subscribe({next: (spaces: SpaceModel[]) => {+ void this.calcUsageStorage(spaces)this.sortBy(this.sortTable.sortParam.column, false, spaces)this.loading = falseif (this.focusOnSelect) {@@ -245,4 +249,8 @@ export class AdminSpacesComponent {this.onSelect(s)}}++ private async calcUsageStorage(spaces: SpaceModel[]) {+ this.storageUsage = spaces.reduce((sum, space) => sum + (space.storageUsage ?? 0), 0)+ }}diff --git a/frontend/src/app/applications/admin/components/admin-users.component.html b/frontend/src/app/applications/admin/components/admin-users.component.htmlindex 4bd67d99..fd87b49e 100644--- a/frontend/src/app/applications/admin/components/admin-users.component.html+++ b/frontend/src/app/applications/admin/components/admin-users.component.html@@ -164,7 +164,8 @@<!--End Table Files Content--><!--Start Foot Content--><div class="app-foot-menu">- <span class="mx-auto">{{ users.length }} {{ (guestsView ? 'guests' : 'users') | translate:locale.language }}</span>+ <div>{{ users.length }} {{ (guestsView ? 'guests' : 'users') | translate:locale.language }}</div>+ <div class="ms-auto"><span l10nTranslate>Total</span> {{ storageUsage | toBytes }}</div></div><!--End Foot Content--><!--Start Context Menu -->diff --git a/frontend/src/app/applications/admin/components/admin-users.component.ts b/frontend/src/app/applications/admin/components/admin-users.component.tsindex 77961831..17c457d0 100644--- a/frontend/src/app/applications/admin/components/admin-users.component.ts+++ b/frontend/src/app/applications/admin/components/admin-users.component.ts@@ -42,6 +42,7 @@ import { AdminService } from '../admin.service'import { AdminUserModel } from '../models/admin-user.model'import { AdminGuestDialogComponent } from './dialogs/admin-guest-dialog.component'import { AdminUserDialogComponent } from './dialogs/admin-user-dialog.component'+import { ToBytesPipe } from '../../../common/pipes/to-bytes.pipe'@Component({selector: 'app-admin-users',@@ -60,7 +61,8 @@ import { AdminUserDialogComponent } from './dialogs/admin-user-dialog.component'ButtonCheckboxDirective,FormsModule,UserAvatarComponent,- TapDirective+ TapDirective,+ ToBytesPipe],templateUrl: 'admin-users.component.html'})@@ -151,6 +153,7 @@ export class AdminUsersComponent {protected loading = falseprotected selected: AdminUserModel = nullprotected users: AdminUserModel[] = []+ protected storageUsage = 0private readonly router = inject(Router)private readonly activatedRoute = inject(ActivatedRoute)private readonly layout = inject(LayoutService)@@ -180,6 +183,7 @@ export class AdminUsersComponent {this.onSelect()this.adminService.listUsers(this.guestsView).subscribe({next: (users: AdminUserModel[]) => {+ void this.calcUsageStorage(users)this.sortBy(this.sortTable.sortParam.column, false, users)this.scrollView.scrollInto(-1)this.loading = false@@ -312,6 +316,10 @@ export class AdminUsersComponent {})}+ private async calcUsageStorage(users: AdminUserModel[]) {+ this.storageUsage = users.reduce((sum, user) => sum + (user.storageUsage ?? 0), 0)+ }+private setEnv() {this.tableHeaders.managers.show = this.guestsViewthis.tableHeaders.storage.show = !this.guestsView