2
Fork 0

Performance updates

This commit is contained in:
Ruben Hartenstein (PEA4-Fe) 2021-01-08 09:11:27 +01:00
parent 84ccb4df91
commit 8fd0ca1bd5
1 changed files with 6 additions and 7 deletions

View File

@ -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() {