RED-4581: Sort trash
This commit is contained in:
parent
6ef342af1a
commit
2dd300305d
@ -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({
|
||||
|
||||
@ -30,11 +30,11 @@ export class TrashScreenComponent extends ListingComponent<TrashItem> {
|
||||
readonly canRestoreSelected$ = this._canRestoreSelected$;
|
||||
readonly canHardDeleteSelected$ = this._canHardDeleteSelected$;
|
||||
readonly tableColumnConfigs: TableColumnConfig<TrashItem>[] = [
|
||||
{ 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(
|
||||
|
||||
@ -71,6 +71,7 @@ export class TrashService extends EntitiesService<TrashItem> {
|
||||
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<TrashItem> {
|
||||
this._systemPreferencesService.values.softDeleteCleanupTime,
|
||||
this._permissionsService.canRestoreFile(file, dossier),
|
||||
this._permissionsService.canHardDeleteFile(file, dossier),
|
||||
this._userService.getNameForId(file.assignee),
|
||||
dossier.dossierName,
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 10de0152c7d31a5235a3d3e99808faa0687beabc
|
||||
Subproject commit c39a69df3e04c1cce01587aba182e176951735f9
|
||||
@ -7,6 +7,7 @@ export class TrashDossier extends TrashItem implements Partial<IDossier> {
|
||||
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<IDossier> {
|
||||
protected readonly _retentionHours: number,
|
||||
readonly hasRestoreRights: boolean,
|
||||
readonly hasHardDeleteRights: boolean,
|
||||
readonly ownerName: string,
|
||||
) {
|
||||
super(_retentionHours, dossier.softDeletedTime, hasRestoreRights, hasHardDeleteRights);
|
||||
this.dossierId = dossier.dossierId;
|
||||
|
||||
@ -25,6 +25,8 @@ export class TrashFile extends TrashItem implements Partial<IFile> {
|
||||
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;
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user