From 2dd300305ddea56c6ab4758513efdd57b0521d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Mon, 11 Jul 2022 22:08:17 +0300 Subject: [PATCH] RED-4581: Sort trash --- .../user-listing/user-listing-screen.component.ts | 2 +- .../trash/trash-screen/trash-screen.component.ts | 10 +++++----- .../src/app/services/entity-services/trash.service.ts | 3 +++ libs/common-ui | 2 +- libs/red-domain/src/lib/trash/trash-dossier.model.ts | 2 ++ libs/red-domain/src/lib/trash/trash-file.model.ts | 2 ++ libs/red-domain/src/lib/trash/trash.item.ts | 2 ++ 7 files changed, 16 insertions(+), 7 deletions(-) diff --git a/apps/red-ui/src/app/modules/admin/screens/user-listing/user-listing-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/user-listing/user-listing-screen.component.ts index 52eb056be..ff2789fde 100644 --- a/apps/red-ui/src/app/modules/admin/screens/user-listing/user-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/user-listing/user-listing-screen.component.ts @@ -20,7 +20,7 @@ import { map } from 'rxjs/operators'; import { rolesTranslations } from '@translations/roles-translations'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { userTypeChecker, userTypeFilters } from '../../../../utils'; -import { RouterHistoryService } from '../../../../services/router-history.service'; +import { RouterHistoryService } from '@services/router-history.service'; function configToFilter({ key, label }: DonutChartConfig) { return new NestedFilter({ diff --git a/apps/red-ui/src/app/modules/trash/trash-screen/trash-screen.component.ts b/apps/red-ui/src/app/modules/trash/trash-screen/trash-screen.component.ts index db8594f9d..a5b277f3e 100644 --- a/apps/red-ui/src/app/modules/trash/trash-screen/trash-screen.component.ts +++ b/apps/red-ui/src/app/modules/trash/trash-screen/trash-screen.component.ts @@ -30,11 +30,11 @@ export class TrashScreenComponent extends ListingComponent { readonly canRestoreSelected$ = this._canRestoreSelected$; readonly canHardDeleteSelected$ = this._canHardDeleteSelected$; readonly tableColumnConfigs: TableColumnConfig[] = [ - { label: _('trash.table-col-names.name') }, - { label: _('trash.table-col-names.owner'), class: 'user-column' }, - { label: _('trash.table-col-names.dossier') }, - { label: _('trash.table-col-names.deleted-on') }, - { label: _('trash.table-col-names.time-to-restore') }, + { label: _('trash.table-col-names.name'), sortByKey: 'name' }, + { label: _('trash.table-col-names.owner'), class: 'user-column', sortByKey: 'ownerName' }, + { label: _('trash.table-col-names.dossier'), sortByKey: 'fileDossierName' }, + { label: _('trash.table-col-names.deleted-on'), sortByKey: 'softDeletedTime' }, + { label: _('trash.table-col-names.time-to-restore'), sortByKey: 'restoreDate' }, ]; constructor( diff --git a/apps/red-ui/src/app/services/entity-services/trash.service.ts b/apps/red-ui/src/app/services/entity-services/trash.service.ts index d43d40bf5..12a3095df 100644 --- a/apps/red-ui/src/app/services/entity-services/trash.service.ts +++ b/apps/red-ui/src/app/services/entity-services/trash.service.ts @@ -71,6 +71,7 @@ export class TrashService extends EntitiesService { this._systemPreferencesService.values.softDeleteCleanupTime, this._permissionsService.canRestoreDossier(dossier), this._permissionsService.canHardDeleteDossier(dossier), + this._userService.getNameForId(dossier.ownerId), ), ), switchMap(dossiers => this._dossierStatsService.getFor(dossiers.map(d => d.id)).pipe(map(() => dossiers))), @@ -89,6 +90,8 @@ export class TrashService extends EntitiesService { this._systemPreferencesService.values.softDeleteCleanupTime, this._permissionsService.canRestoreFile(file, dossier), this._permissionsService.canHardDeleteFile(file, dossier), + this._userService.getNameForId(file.assignee), + dossier.dossierName, ); }), ); diff --git a/libs/common-ui b/libs/common-ui index 10de0152c..c39a69df3 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit 10de0152c7d31a5235a3d3e99808faa0687beabc +Subproject commit c39a69df3e04c1cce01587aba182e176951735f9 diff --git a/libs/red-domain/src/lib/trash/trash-dossier.model.ts b/libs/red-domain/src/lib/trash/trash-dossier.model.ts index 2614beec0..2cf8d073c 100644 --- a/libs/red-domain/src/lib/trash/trash-dossier.model.ts +++ b/libs/red-domain/src/lib/trash/trash-dossier.model.ts @@ -7,6 +7,7 @@ export class TrashDossier extends TrashItem implements Partial { readonly icon = 'red:folder'; readonly isSoftDeleted = true; + readonly fileDossierName = '-'; readonly dossierId: string; readonly dossierTemplateId: string; @@ -23,6 +24,7 @@ export class TrashDossier extends TrashItem implements Partial { protected readonly _retentionHours: number, readonly hasRestoreRights: boolean, readonly hasHardDeleteRights: boolean, + readonly ownerName: string, ) { super(_retentionHours, dossier.softDeletedTime, hasRestoreRights, hasHardDeleteRights); this.dossierId = dossier.dossierId; diff --git a/libs/red-domain/src/lib/trash/trash-file.model.ts b/libs/red-domain/src/lib/trash/trash-file.model.ts index 4b1431786..e12ea032f 100644 --- a/libs/red-domain/src/lib/trash/trash-file.model.ts +++ b/libs/red-domain/src/lib/trash/trash-file.model.ts @@ -25,6 +25,8 @@ export class TrashFile extends TrashItem implements Partial { protected readonly _retentionHours: number, readonly hasRestoreRights: boolean, readonly hasHardDeleteRights: boolean, + readonly ownerName: string, + readonly fileDossierName: string, ) { super(_retentionHours, file.softDeletedTime, hasRestoreRights, hasHardDeleteRights); this.fileId = file.fileId; diff --git a/libs/red-domain/src/lib/trash/trash.item.ts b/libs/red-domain/src/lib/trash/trash.item.ts index 688144278..68b4d025d 100644 --- a/libs/red-domain/src/lib/trash/trash.item.ts +++ b/libs/red-domain/src/lib/trash/trash.item.ts @@ -4,7 +4,9 @@ import * as dayjs from 'dayjs'; export abstract class TrashItem { abstract readonly type: 'dossier' | 'file'; abstract readonly ownerId?: string; + abstract readonly ownerName: string; abstract readonly dossierId: string; + abstract readonly fileDossierName: string; abstract readonly icon: string; readonly restoreDate: string; readonly canRestore: boolean;