TSK-1306: Fixed problem with domain switching in classifications

This commit is contained in:
Tristan Eisermann 2020-06-25 19:11:44 +02:00 committed by Tristan2357
parent 63b6248cf7
commit c79c06010a
2 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,6 @@
import { Component, OnDestroy, OnInit } from '@angular/core'; import { Component, OnDestroy, OnInit } from '@angular/core';
import { Observable, Subject } from 'rxjs'; import { Observable, Subject } from 'rxjs';
import { map, takeUntil } from 'rxjs/operators'; import { map, take, takeUntil } from 'rxjs/operators';
import { Actions, ofActionCompleted, ofActionDispatched, Select, Store } from '@ngxs/store'; import { Actions, ofActionCompleted, ofActionDispatched, Select, Store } from '@ngxs/store';
import { ImportExportService } from 'app/administration/services/import-export.service'; import { ImportExportService } from 'app/administration/services/import-export.service';
@ -16,6 +16,7 @@ import { ClassificationCategoryImages } from '../../../shared/models/customisati
import { GetClassifications, import { GetClassifications,
SetActiveAction } from '../../../shared/store/classification-store/classification.actions'; SetActiveAction } from '../../../shared/store/classification-store/classification.actions';
import { ACTION } from '../../../shared/models/action'; import { ACTION } from '../../../shared/models/action';
import { DomainService } from '../../../shared/services/domain/domain.service';
import { ClassificationSummary } from '../../../shared/models/classification-summary'; import { ClassificationSummary } from '../../../shared/models/classification-summary';
@Component({ @Component({
@ -45,7 +46,8 @@ export class ClassificationListComponent implements OnInit, OnDestroy {
private location: Location, private location: Location,
private importExportService: ImportExportService, private importExportService: ImportExportService,
private store: Store, private store: Store,
private ngxsActions$: Actions private ngxsActions$: Actions,
private domainService: DomainService
) { ) {
this.ngxsActions$.pipe(ofActionDispatched(GetClassifications), this.ngxsActions$.pipe(ofActionDispatched(GetClassifications),
takeUntil(this.destroy$)) takeUntil(this.destroy$))
@ -82,6 +84,11 @@ export class ClassificationListComponent implements OnInit, OnDestroy {
.subscribe(action => { .subscribe(action => {
this.action = action; this.action = action;
}); });
// needed, so that the list updates, when domain gets changed (could be placed anywhere and should be removed, when domain is in store)
this.domainService.getSelectedDomain().pipe(takeUntil(this.destroy$)).subscribe(domain => {
this.store.dispatch(GetClassifications);
});
} }
addClassification() { addClassification() {

View File

@ -64,9 +64,7 @@ export class DomainService {
} }
switchDomain(value: string) { switchDomain(value: string) {
this.requestInProgressService.setRequestInProgress(true);
this.selectDomain(value); this.selectDomain(value);
this.router.navigate([this.getNavigationUrl()]);
} }
/* /*