Fix for domain forms (#228)

This commit is contained in:
Aleksandra Usacheva 2020-12-11 17:17:32 +03:00 committed by GitHub
parent 0f056768bf
commit 4868e7ca28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 8 deletions

View File

@ -26,8 +26,8 @@ export class FetchContractorService {
]) ])
), ),
map(([contractID, party]) => { map(([contractID, party]) => {
const contractorID = party.contracts.get(contractID).contractor_id; const contractorID = party.contracts.get(contractID)?.contractor_id;
return party.contractors.get(contractorID).contractor; return party.contractors.get(contractorID)?.contractor;
}), }),
shareReplay(1) shareReplay(1)
); );

View File

@ -4,7 +4,7 @@ import { MatSnackBar } from '@angular/material/snack-bar';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { tap } from 'rxjs/internal/operators'; import { tap } from 'rxjs/internal/operators';
import { DomainTypedManager } from '../../../../../thrift-services'; import { DomainCacheService } from '../../../../../thrift-services/damsel/domain-cache.service';
import { BusinessScheduleObject } from '../../../../../thrift-services/damsel/gen-model/domain'; import { BusinessScheduleObject } from '../../../../../thrift-services/damsel/gen-model/domain';
@Component({ @Component({
@ -24,14 +24,14 @@ export class BusinessScheduleSelectorComponent implements OnInit {
hasError = false; hasError = false;
constructor(private domainManager: DomainTypedManager, private snackBar: MatSnackBar) {} constructor(private domainCacheService: DomainCacheService, private snackBar: MatSnackBar) {}
selectionChange(change: MatSelectChange) { selectionChange(change: MatSelectChange) {
this.idChange.emit(change.value); this.idChange.emit(change.value);
} }
ngOnInit() { ngOnInit() {
this.schedules$ = this.domainManager.getBusinessScheduleObjects().pipe( this.schedules$ = this.domainCacheService.getObjects('business_schedule').pipe(
tap( tap(
() => { () => {
this.isLoading = false; this.isLoading = false;

View File

@ -12,7 +12,6 @@ import {
PaymentInstitutionObject, PaymentInstitutionObject,
PaymentInstitutionRef, PaymentInstitutionRef,
} from '../../../../../thrift-services/damsel/gen-model/domain'; } from '../../../../../thrift-services/damsel/gen-model/domain';
import { findDomainObjects } from '../../../../../thrift-services/damsel/operations/utils';
@Component({ @Component({
selector: 'cc-payment-institution-ref', selector: 'cc-payment-institution-ref',
@ -39,8 +38,7 @@ export class PaymentInstitutionRefComponent implements OnInit {
) {} ) {}
ngOnInit() { ngOnInit() {
this.paymentInstitutions$ = this.dtm.domain$.pipe( this.paymentInstitutions$ = this.dtm.getObjects('payment_institution').pipe(
map((domain) => findDomainObjects(domain, 'payment_institution')),
map((paymentInstitutions) => map((paymentInstitutions) =>
sortBy(paymentInstitutions, (paymentInstitution) => paymentInstitution.ref.id) sortBy(paymentInstitutions, (paymentInstitution) => paymentInstitution.ref.id)
), ),