RED-1549: Dossier overview quick filters
This commit is contained in:
parent
fa55c645ed
commit
da5360bacf
@ -17,6 +17,7 @@ export enum AppConfigKey {
|
||||
ADMIN_CONTACT_URL = 'ADMIN_CONTACT_URL',
|
||||
AUTO_READ_TIME = 'AUTO_READ_TIME',
|
||||
MAX_FILE_SIZE_MB = 'MAX_FILE_SIZE_MB',
|
||||
RECENT_PERIOD_IN_HOURS = 'RECENT_PERIOD_IN_HOURS',
|
||||
DELETE_RETENTION_HOURS = 'DELETE_RETENTION_HOURS',
|
||||
APP_NAME = 'APP_NAME',
|
||||
|
||||
|
||||
@ -4,10 +4,6 @@
|
||||
.content-container {
|
||||
position: relative;
|
||||
|
||||
.header-item {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
cdk-virtual-scroll-viewport {
|
||||
::ng-deep.cdk-virtual-scroll-content-wrapper {
|
||||
grid-template-columns: 2fr 1fr 1fr auto 11px;
|
||||
|
||||
@ -24,8 +24,7 @@ import {
|
||||
dossierMemberChecker,
|
||||
dossierStatusChecker,
|
||||
dossierTemplateChecker,
|
||||
processFilters,
|
||||
quickFiltersChecker
|
||||
processFilters
|
||||
} from '@shared/components/filters/popup-filter/utils/filter-utils';
|
||||
import { QuickFiltersComponent } from '../../../shared/components/filters/quick-filters/quick-filters.component';
|
||||
|
||||
@ -124,7 +123,8 @@ export class DossierListingScreenComponent
|
||||
{ values: this.dossierTemplateFilters, checker: dossierTemplateChecker },
|
||||
{
|
||||
values: this.quickFilters,
|
||||
checker: quickFiltersChecker(this.quickFilters)
|
||||
checker: (dw: DossierWrapper) =>
|
||||
this.quickFilters.reduce((acc, f) => acc || (f.checked && f.checker(dw)), false)
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
@ -106,6 +106,11 @@
|
||||
(reload)="bulkActionPerformed()"
|
||||
[selectedFileIds]="selectedEntitiesIds"
|
||||
></redaction-dossier-overview-bulk-actions>
|
||||
|
||||
<redaction-quick-filters
|
||||
(filtersChanged)="filtersChanged()"
|
||||
[filters]="quickFilters"
|
||||
></redaction-quick-filters>
|
||||
</div>
|
||||
|
||||
<div
|
||||
|
||||
@ -39,6 +39,7 @@ import {
|
||||
import { FilterModel } from '@shared/components/filters/popup-filter/model/filter.model';
|
||||
import { PopupFilterComponent } from '@shared/components/filters/popup-filter/popup-filter.component';
|
||||
import { QuickFiltersComponent } from '../../../shared/components/filters/quick-filters/quick-filters.component';
|
||||
import { AppConfigService } from '../../../app-config/app-config.service';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-dossier-overview-screen',
|
||||
@ -58,7 +59,9 @@ export class DossierOverviewScreenComponent
|
||||
statusFilters: FilterModel[];
|
||||
} = { needsWorkFilters: [], statusFilters: [] };
|
||||
readonly itemSize = 80;
|
||||
quickFilters: FilterModel[];
|
||||
@ViewChild(CdkVirtualScrollViewport) scrollBar: CdkVirtualScrollViewport;
|
||||
@ViewChild(QuickFiltersComponent) protected _quickFiltersComponent: QuickFiltersComponent;
|
||||
protected readonly _searchKey = 'searchField';
|
||||
protected readonly _selectionKey = 'fileId';
|
||||
protected readonly _sortKey = 'dossier-overview';
|
||||
@ -86,6 +89,7 @@ export class DossierOverviewScreenComponent
|
||||
private readonly _fileDropOverlayService: FileDropOverlayService,
|
||||
private readonly _appStateService: AppStateService,
|
||||
private readonly _userPreferenceControllerService: UserPreferenceControllerService,
|
||||
private readonly _appConfigService: AppConfigService,
|
||||
protected readonly _injector: Injector
|
||||
) {
|
||||
super(_injector);
|
||||
@ -96,11 +100,24 @@ export class DossierOverviewScreenComponent
|
||||
return this._appStateService.activeDossier;
|
||||
}
|
||||
|
||||
get user() {
|
||||
return this._userService.user;
|
||||
}
|
||||
|
||||
get checkedRequiredFilters() {
|
||||
return this.quickFilters.filter(f => f.required && f.checked);
|
||||
}
|
||||
|
||||
get checkedNotRequiredFilters() {
|
||||
return this.quickFilters.filter(f => !f.required && f.checked);
|
||||
}
|
||||
|
||||
protected get _filterComponents(): (PopupFilterComponent | QuickFiltersComponent)[] {
|
||||
return [
|
||||
this._statusFilterComponent,
|
||||
this._peopleFilterComponent,
|
||||
this._needsWorkFilterComponent
|
||||
this._needsWorkFilterComponent,
|
||||
this._quickFiltersComponent
|
||||
];
|
||||
}
|
||||
|
||||
@ -118,6 +135,16 @@ export class DossierOverviewScreenComponent
|
||||
checker: annotationFilterChecker,
|
||||
matchAll: true,
|
||||
checkerArgs: this.permissionsService
|
||||
},
|
||||
{
|
||||
values: this.quickFilters,
|
||||
checker: (file: FileStatusWrapper) =>
|
||||
this.checkedRequiredFilters.reduce((acc, f) => acc && f.checker(file), true) &&
|
||||
(this.checkedNotRequiredFilters.length === 0 ||
|
||||
this.checkedNotRequiredFilters.reduce(
|
||||
(acc, f) => acc || f.checker(file),
|
||||
false
|
||||
))
|
||||
}
|
||||
];
|
||||
}
|
||||
@ -287,6 +314,11 @@ export class DossierOverviewScreenComponent
|
||||
this.collapsedDetails = !this.collapsedDetails;
|
||||
}
|
||||
|
||||
recentlyModifiedChecker = (file: FileStatusWrapper) =>
|
||||
moment(file.lastUpdated)
|
||||
.add(this._appConfigService.getConfig('RECENT_PERIOD_IN_HOURS'), 'hours')
|
||||
.isAfter(moment());
|
||||
|
||||
protected _preFilter() {
|
||||
this.detailsContainerFilters = {
|
||||
needsWorkFilters: this.needsWorkFilters.map(f => ({ ...f })),
|
||||
@ -378,5 +410,41 @@ export class DossierOverviewScreenComponent
|
||||
(a, b) => RedactionFilterSorter[a.key] - RedactionFilterSorter[b.key]
|
||||
);
|
||||
this.needsWorkFilters = processFilters(this.needsWorkFilters, needsWorkFilters);
|
||||
|
||||
this._computeQuickFilters();
|
||||
}
|
||||
|
||||
private _computeQuickFilters() {
|
||||
if (this.allEntities.filter(this.recentlyModifiedChecker).length > 0) {
|
||||
this.quickFilters = [
|
||||
{
|
||||
key: this.user.id,
|
||||
label: 'dossier-overview.quick-filters.recent',
|
||||
required: true,
|
||||
checker: this.recentlyModifiedChecker
|
||||
}
|
||||
];
|
||||
} else {
|
||||
this.quickFilters = [];
|
||||
}
|
||||
|
||||
this.quickFilters = [
|
||||
...this.quickFilters,
|
||||
{
|
||||
key: this.user.id,
|
||||
label: 'dossier-overview.quick-filters.assigned-to-me',
|
||||
checker: (file: FileStatusWrapper) => file.currentReviewer === this.user.id
|
||||
},
|
||||
{
|
||||
key: this.user.id,
|
||||
label: 'dossier-overview.quick-filters.unassigned',
|
||||
checker: (file: FileStatusWrapper) => !file.currentReviewer
|
||||
},
|
||||
{
|
||||
key: this.user.id,
|
||||
label: 'dossier-overview.quick-filters.assigned-to-others',
|
||||
checker: (file: FileStatusWrapper) => file.currentReviewer !== this.user.id
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,4 +9,5 @@ export interface FilterModel {
|
||||
matches?: number;
|
||||
filters?: FilterModel[];
|
||||
checker?: (obj?) => boolean;
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
@ -175,9 +175,6 @@ export const addedDateChecker = (dw: DossierWrapper, filter: FilterModel) =>
|
||||
export const dossierApproverChecker = (dw: DossierWrapper, filter: FilterModel) =>
|
||||
dw.approverIds.includes(filter.key);
|
||||
|
||||
export const quickFiltersChecker = (quickFilters: FilterModel[]) => (dw: DossierWrapper) =>
|
||||
quickFilters.reduce((acc, filter) => acc || (filter.checked && filter.checker(dw)), false);
|
||||
|
||||
export function getFilteredEntities(
|
||||
entities: any[],
|
||||
filters: { values: FilterModel[]; checker: Function; matchAll?: boolean; checkerArgs?: any }[]
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
|
||||
:host {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.quick-filter {
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
"LICENSE_START": "01-01-2021",
|
||||
"LICENSE_END": "31-12-2021",
|
||||
"LICENSE_PAGE_COUNT": 1000000,
|
||||
"RECENT_PERIOD_IN_HOURS": 24,
|
||||
"MAX_FILE_SIZE_MB": 100,
|
||||
"DELETE_RETENTION_HOURS": 96
|
||||
}
|
||||
|
||||
@ -333,6 +333,12 @@
|
||||
"reanalyse-dossier": {
|
||||
"success": "Files scheduled for reanalysis.",
|
||||
"error": "Failed to schedule files for reanalysis. Please try again."
|
||||
},
|
||||
"quick-filters": {
|
||||
"recent": "Recent",
|
||||
"assigned-to-me": "Assigned to me",
|
||||
"unassigned": "Unassigned",
|
||||
"assigned-to-others": "Assigned to others"
|
||||
}
|
||||
},
|
||||
"file-preview": {
|
||||
|
||||
@ -10,6 +10,7 @@ ADMIN_CONTACT_URL="${ADMIN_CONTACT_URL:-}"
|
||||
AUTO_READ_TIME="${AUTO_READ_TIME:-1.5}"
|
||||
MAX_FILE_SIZE_MB="${MAX_FILE_SIZE_MB:-50}"
|
||||
DELETE_RETENTION_HOURS="${DELETE_RETENTION_HOURS:-96}"
|
||||
RECENT_PERIOD_IN_HOURS="${RECENT_PERIOD_IN_HOURS:-24}"
|
||||
|
||||
BACKEND_APP_VERSION="${BACKEND_APP_VERSION:-4.7.0}"
|
||||
|
||||
@ -35,6 +36,7 @@ echo '{
|
||||
"APP_NAME":"'"$APP_NAME"'",
|
||||
"AUTO_READ_TIME":'"$AUTO_READ_TIME"',
|
||||
"MAX_FILE_SIZE_MB":"'"$MAX_FILE_SIZE_MB"'",
|
||||
"RECENT_PERIOD_IN_HOURS":"'"RECENT_PERIOD_IN_HOURS"'",
|
||||
"DELETE_RETENTION_HOURS":"'"$DELETE_RETENTION_HOURS"'",
|
||||
"API_URL":"'"$API_URL"'"
|
||||
}' > /usr/share/nginx/html/ui/assets/config/config.json
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user