From 8fd0ca1bd58272df4ddbb6d032d6a854efca9e19 Mon Sep 17 00:00:00 2001 From: "Ruben Hartenstein (PEA4-Fe)" Date: Fri, 8 Jan 2021 09:11:27 +0100 Subject: [PATCH] Performance updates --- src/app/samples/samples.component.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/app/samples/samples.component.ts b/src/app/samples/samples.component.ts index c19a9a7..40b45e6 100644 --- a/src/app/samples/samples.component.ts +++ b/src/app/samples/samples.component.ts @@ -91,6 +91,7 @@ export class SamplesComponent implements OnInit { { id: 'added', label: 'Added', active: true, sortable: true } ]; + // combines the 3 different categories categories = { material: this.materialKeys, condition: this.conditionKeys, @@ -103,9 +104,10 @@ export class SamplesComponent implements OnInit { sampleSelect = 0; // modes: 0 - no selection, 1 - sample edit selection, 2 - validation selection loading = 0; // number of loading instances + // change the way values are displayed valueConverters = { - added: (v: string, _sample) => new Date(v).toLocaleDateString(), - notes: v => v.sample_references.length > 0 ? Object.keys(v.sample_references).map(r => v.sample_references[r].relation).join(", ") : "", + 'added': (v: string, _sample) => new Date(v).toLocaleDateString(), + 'notes': (v: any, _sample: any) => v.sample_references.length > 0 ? Object.keys(v.sample_references).map(r => v.sample_references[r].relation).join(", ") : "", 'notes.comment': (v: any, sample: any) => sample['notes']['comment'] } @@ -118,9 +120,7 @@ export class SamplesComponent implements OnInit { private storage: LocalStorageService, private window: Window, private router: Router - ) { - //this.valueConverters['notes.comment'] = v => console.log(v['comment']); - } + ) {} ngOnInit(): void { this.loading = 8; @@ -195,7 +195,6 @@ export class SamplesComponent implements OnInit { key.active = event[key.id]; } }); - //this.refreshMultiSelect(); const sortId = this.filters.sort.replace(/(-asc|-desc)/, ''); if (event.hasOwnProperty(sortId) && !event[sortId]) { // reset sort if sort field was unselected this.setSort('_id-asc'); @@ -352,7 +351,7 @@ export class SamplesComponent implements OnInit { keys: keys }; this.storage.set('samplesPreferences', store); - this.loadPreferences(); + this.calcFieldSelectKeys(); } loadPreferences() {