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 {environment} from 'environments/environment';
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 {ClassificationDefinition} from 'app/models/classification-definition';
@ -112,14 +112,14 @@ export class ClassificationsService {
private getClassificationObservable(classificationRef: Observable<any>): Observable<Array<Classification>> {
const classificationTypes = this.classificationCategoriesService.getSelectedClassificationType();
return combineLatest(
classificationRef,
classificationTypes,
(classification: any, classificationType) => {
if (!classification.classifications) {
return [];
[classificationRef,
classificationTypes]
).pipe(
map(
(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;
@Output()
onSelect = new EventEmitter<AccessIdDefinition>();
selectedItem = new EventEmitter<AccessIdDefinition>();
@ViewChild('inputTypeAhead', { static: false })
private inputTypeAhead;
@ -119,7 +119,7 @@ export class TypeAheadComponent implements OnInit, ControlValueAccessor {
if (event && event.item) {
this.value = event.item.accessId;
this.dataSource.selected = event.item;
this.onSelect.emit(this.dataSource.selected)
this.selectedItem.emit(this.dataSource.selected)
}
this.setTyping(false);
}