TSK-974: Add two more complex fixes

This commit is contained in:
BVier 2019-12-03 11:15:47 +01:00 committed by Benjamin Eckstein
parent 8b7c8027e0
commit c30ffd1522
2 changed files with 10 additions and 10 deletions

View File

@ -2,7 +2,7 @@ import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http'; import {HttpClient} from '@angular/common/http';
import {environment} from 'environments/environment'; import {environment} from 'environments/environment';
import {combineLatest, Observable, Subject} from 'rxjs'; import {combineLatest, Observable, Subject} from 'rxjs';
import {mergeMap, tap} from 'rxjs/operators'; import {mergeMap, tap, map} from 'rxjs/operators';
import {Classification} from 'app/models/classification'; import {Classification} from 'app/models/classification';
import {ClassificationDefinition} from 'app/models/classification-definition'; import {ClassificationDefinition} from 'app/models/classification-definition';
@ -112,14 +112,14 @@ export class ClassificationsService {
private getClassificationObservable(classificationRef: Observable<any>): Observable<Array<Classification>> { private getClassificationObservable(classificationRef: Observable<any>): Observable<Array<Classification>> {
const classificationTypes = this.classificationCategoriesService.getSelectedClassificationType(); const classificationTypes = this.classificationCategoriesService.getSelectedClassificationType();
return combineLatest( return combineLatest(
classificationRef, [classificationRef,
classificationTypes, classificationTypes]
(classification: any, classificationType) => { ).pipe(
if (!classification.classifications) { map(
return []; (classification: any, classificationType: any) => {
return classification.classifications ? this.buildHierarchy(classification.classifications, classificationType) : [];
} }
return this.buildHierarchy(classification.classifications, classificationType); )
}
) )
} }

View File

@ -45,7 +45,7 @@ export class TypeAheadComponent implements OnInit, ControlValueAccessor {
isRequired = true; isRequired = true;
@Output() @Output()
onSelect = new EventEmitter<AccessIdDefinition>(); selectedItem = new EventEmitter<AccessIdDefinition>();
@ViewChild('inputTypeAhead', { static: false }) @ViewChild('inputTypeAhead', { static: false })
private inputTypeAhead; private inputTypeAhead;
@ -119,7 +119,7 @@ export class TypeAheadComponent implements OnInit, ControlValueAccessor {
if (event && event.item) { if (event && event.item) {
this.value = event.item.accessId; this.value = event.item.accessId;
this.dataSource.selected = event.item; this.dataSource.selected = event.item;
this.onSelect.emit(this.dataSource.selected) this.selectedItem.emit(this.dataSource.selected)
} }
this.setTyping(false); this.setTyping(false);
} }