remove _primaryKey & fix filters
This commit is contained in:
parent
3ae7679090
commit
0222d01e5d
@ -37,7 +37,6 @@ export class ActiveFieldsListingComponent extends ListingComponent<Field> implem
|
||||
@Output() readonly entitiesChange = new EventEmitter<Field[]>();
|
||||
@Output() readonly setHoveredColumn = new EventEmitter<string>();
|
||||
@Output() readonly toggleFieldActive = new EventEmitter<Field>();
|
||||
protected readonly _primaryKey = 'csvColumn';
|
||||
|
||||
constructor(protected readonly _injector: Injector) {
|
||||
super(_injector);
|
||||
|
||||
@ -41,7 +41,6 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<Fie
|
||||
columnSample = [];
|
||||
initialParseConfig: { delimiter?: string; encoding?: string } = {};
|
||||
readonly tableHeaderLabel = '';
|
||||
protected readonly _primaryKey = 'csvColumn';
|
||||
|
||||
constructor(
|
||||
private readonly _toaster: Toaster,
|
||||
@ -154,7 +153,7 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<Fie
|
||||
|
||||
toggleFieldActive(field: Field) {
|
||||
if (!this.isActive(field)) {
|
||||
this.activeFields = [...this.activeFields, field];
|
||||
this.activeFields = [...this.activeFields, { ...field, searchKey: field.csvColumn }];
|
||||
} else {
|
||||
this.activeFields.splice(this.activeFields.indexOf(field), 1);
|
||||
this.activeFields = [...this.activeFields];
|
||||
@ -162,7 +161,7 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<Fie
|
||||
}
|
||||
|
||||
activateAll() {
|
||||
this.activeFields = [...this.allEntities];
|
||||
this.activeFields = [...this.allEntities.map(item => ({ ...item, searchKey: item.csvColumn }))];
|
||||
}
|
||||
|
||||
deactivateAll() {
|
||||
@ -232,6 +231,7 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<Fie
|
||||
id: btoa(csvColumn),
|
||||
csvColumn,
|
||||
name: csvColumn,
|
||||
searchKey: csvColumn,
|
||||
type: isNumber ? FileAttributeConfigTypes.NUMBER : FileAttributeConfigTypes.TEXT,
|
||||
readonly: false,
|
||||
primaryAttribute: false
|
||||
|
||||
@ -147,6 +147,7 @@ export class TrashScreenComponent extends ListingComponent<DossierListItem> impl
|
||||
return {
|
||||
id: dossier.dossierId,
|
||||
...dossier,
|
||||
searchKey: dossier.dossierName,
|
||||
restoreDate,
|
||||
canRestore: this._canRestoreDossier(restoreDate),
|
||||
// Because of migrations, for some this is not set
|
||||
|
||||
@ -16,15 +16,7 @@ import { DossiersDialogService } from '../../services/dossiers-dialog.service';
|
||||
import { OnAttach, OnDetach } from '@utils/custom-route-reuse.strategy';
|
||||
import { UserPreferenceService } from '@services/user-preference.service';
|
||||
import { ButtonConfig } from '@shared/components/page-header/models/button-config.model';
|
||||
import {
|
||||
DefaultListingServices,
|
||||
INestedFilter,
|
||||
keyChecker,
|
||||
ListingComponent,
|
||||
NestedFilter,
|
||||
TableColumnConfig,
|
||||
TableComponent
|
||||
} from '@iqser/common-ui';
|
||||
import { DefaultListingServices, keyChecker, ListingComponent, NestedFilter, TableColumnConfig, TableComponent } from '@iqser/common-ui';
|
||||
import { workloadTranslations } from '../../translations/workload-translations';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { fileStatusTranslations } from '../../translations/file-status-translations';
|
||||
@ -225,7 +217,7 @@ export class DossierListingScreenComponent
|
||||
allDistinctDossierTemplates.add(entry.dossierTemplateId);
|
||||
});
|
||||
|
||||
const statusFilters = [...allDistinctFileStatus].map<INestedFilter>(
|
||||
const statusFilters = [...allDistinctFileStatus].map(
|
||||
status =>
|
||||
new NestedFilter({
|
||||
id: status,
|
||||
@ -241,7 +233,7 @@ export class DossierListingScreenComponent
|
||||
checker: dossierStatusChecker
|
||||
});
|
||||
|
||||
const peopleFilters = [...allDistinctPeople].map<INestedFilter>(
|
||||
const peopleFilters = [...allDistinctPeople].map(
|
||||
userId =>
|
||||
new NestedFilter({
|
||||
id: userId,
|
||||
@ -257,7 +249,7 @@ export class DossierListingScreenComponent
|
||||
checker: dossierMemberChecker
|
||||
});
|
||||
|
||||
const needsWorkFilters = [...allDistinctNeedsWork].map<INestedFilter>(
|
||||
const needsWorkFilters = [...allDistinctNeedsWork].map(
|
||||
type =>
|
||||
new NestedFilter({
|
||||
id: type,
|
||||
@ -275,7 +267,7 @@ export class DossierListingScreenComponent
|
||||
matchAll: true
|
||||
});
|
||||
|
||||
const dossierTemplateFilters = [...allDistinctDossierTemplates].map<INestedFilter>(
|
||||
const dossierTemplateFilters = [...allDistinctDossierTemplates].map(
|
||||
id =>
|
||||
new NestedFilter({
|
||||
id: id,
|
||||
@ -299,7 +291,7 @@ export class DossierListingScreenComponent
|
||||
checker: (dw: Dossier) => quickFilters.reduce((acc, f) => acc || (f.checked && f.checker(dw)), false)
|
||||
});
|
||||
|
||||
const dossierFilters = this.entitiesService.all.map<INestedFilter>(
|
||||
const dossierFilters = this.entitiesService.all.map(
|
||||
dossier =>
|
||||
new NestedFilter({
|
||||
id: dossier.dossierName,
|
||||
@ -316,9 +308,9 @@ export class DossierListingScreenComponent
|
||||
});
|
||||
}
|
||||
|
||||
private _createQuickFilters(): INestedFilter[] {
|
||||
private _createQuickFilters(): NestedFilter[] {
|
||||
const myDossiersLabel = this._translateService.instant('dossier-listing.quick-filters.my-dossiers');
|
||||
const filters: INestedFilter[] = [
|
||||
const filters: NestedFilter[] = [
|
||||
{
|
||||
id: 'my-dossiers',
|
||||
label: myDossiersLabel,
|
||||
|
||||
@ -459,7 +459,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<FileStatusW
|
||||
});
|
||||
});
|
||||
|
||||
const statusFilters = [...allDistinctFileStatusWrapper].map<INestedFilter>(
|
||||
const statusFilters = [...allDistinctFileStatusWrapper].map(
|
||||
item =>
|
||||
new NestedFilter({
|
||||
id: item,
|
||||
@ -475,7 +475,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<FileStatusW
|
||||
checker: keyChecker('status')
|
||||
});
|
||||
|
||||
const peopleFilters: INestedFilter[] = [];
|
||||
const peopleFilters: NestedFilter[] = [];
|
||||
if (allDistinctPeople.has(undefined) || allDistinctPeople.has(null)) {
|
||||
allDistinctPeople.delete(undefined);
|
||||
allDistinctPeople.delete(null);
|
||||
@ -502,7 +502,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<FileStatusW
|
||||
checker: keyChecker('currentReviewer')
|
||||
});
|
||||
|
||||
const needsWorkFilters = [...allDistinctNeedsWork].map<INestedFilter>(
|
||||
const needsWorkFilters = [...allDistinctNeedsWork].map(
|
||||
item =>
|
||||
new NestedFilter({
|
||||
id: item,
|
||||
@ -527,7 +527,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<FileStatusW
|
||||
slug: key,
|
||||
label: key,
|
||||
icon: 'red:template',
|
||||
filters: [...filterValue].map<INestedFilter>(
|
||||
filters: [...filterValue].map(
|
||||
(value: string) =>
|
||||
new NestedFilter({
|
||||
id: value,
|
||||
@ -547,7 +547,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<FileStatusW
|
||||
this.checkedNotRequiredFilters.reduce((acc, f) => acc || f.checker(file), false))
|
||||
});
|
||||
|
||||
const filesNamesFilters = this.entitiesService.all.map<INestedFilter>(
|
||||
const filesNamesFilters = this.entitiesService.all.map(
|
||||
file =>
|
||||
new NestedFilter({
|
||||
id: file.filename,
|
||||
@ -565,7 +565,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<FileStatusW
|
||||
});
|
||||
}
|
||||
|
||||
private _createQuickFilters(): INestedFilter[] {
|
||||
private _createQuickFilters(): NestedFilter[] {
|
||||
let quickFilters: INestedFilter[] = [];
|
||||
if (this.entitiesService.all.filter(this.recentlyModifiedChecker).length > 0) {
|
||||
const recentPeriod = this._configService.values.RECENT_PERIOD_IN_HOURS;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { SuperTypeSorter } from '@utils/sorters/super-type-sorter';
|
||||
import { handleCheckedValue, IFilter, INestedFilter, NestedFilter } from '@iqser/common-ui';
|
||||
import { Filter, handleCheckedValue, IFilter, INestedFilter, NestedFilter } from '@iqser/common-ui';
|
||||
import { annotationTypesTranslations } from '../../../translations/annotation-types-translations';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
|
||||
@ -50,12 +50,11 @@ export class AnnotationProcessingService {
|
||||
const childFilter: IFilter = {
|
||||
id: a.type,
|
||||
label: a.type,
|
||||
searchKey: a.type,
|
||||
checked: false,
|
||||
matches: 1
|
||||
};
|
||||
filterMap.set(key, childFilter);
|
||||
parentFilter.children.push(childFilter);
|
||||
parentFilter.children.push(new Filter(childFilter));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user