fixed rules toast hiding on nav

This commit is contained in:
Timo Bejan 2020-11-03 12:55:26 +02:00
parent 2ca8abe46d
commit 029fd53079
3 changed files with 17 additions and 13 deletions

View File

@ -30,9 +30,11 @@ export class FilterComponent implements OnChanges {
if (changes.filters) {
const oldFilters = changes.filters.previousValue;
this._copySettings(oldFilters, this.filters);
this.filters.forEach((filter) => {
handleCheckedValue(filter);
});
if (this.filters) {
this.filters.forEach((filter) => {
handleCheckedValue(filter);
});
}
}
}

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar';
import { ToastrService } from 'ngx-toastr';
import { ActiveToast, ToastrService } from 'ngx-toastr';
import { IndividualConfig } from 'ngx-toastr/toastr/toastr-config';
export enum NotificationType {
@ -26,20 +26,17 @@ export class NotificationService {
title?: string,
notificationType: NotificationType = NotificationType.INFO,
options?: Partial<IndividualConfig> & { actions: Action[] }
) {
): ActiveToast<any> {
switch (notificationType) {
case NotificationType.ERROR:
this._toastr.error(message, title, options);
break;
return this._toastr.error(message, title, options);
case NotificationType.SUCCESS:
this._toastr.success(message, title, options);
return this._toastr.success(message, title, options);
break;
case NotificationType.WARNING:
this._toastr.warning(message, title, options);
break;
return this._toastr.warning(message, title, options);
case NotificationType.INFO:
this._toastr.info(message, title, options);
break;
return this._toastr.info(message, title, options);
}
}
}

View File

@ -21,6 +21,7 @@ import { FilterModel } from '../../common/filter/model/filter.model';
import * as moment from 'moment';
import { SortingComponent, SortingOption } from '../../components/sorting/sorting.component';
import { ProjectDetailsComponent } from './project-details/project-details.component';
import { ActiveToast } from 'ngx-toastr';
@Component({
selector: 'redaction-project-overview-screen',
@ -42,6 +43,7 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy {
@ViewChild('sortingComponent', { static: true }) public sortingComponent: SortingComponent;
public sortingOption: SortingOption = { column: 'added', order: 'desc' };
private _rulesChangedToast: ActiveToast<any>;
constructor(
public readonly appStateService: AppStateService,
@ -78,6 +80,9 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy {
ngOnDestroy(): void {
this._fileDropOverlayService.cleanupFileDropHandling();
if (this._rulesChangedToast && this._rulesChangedToast.toastRef) {
this._rulesChangedToast.toastRef.close();
}
}
public get user() {
@ -112,7 +117,7 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy {
return;
}
this._notificationService.showToastNotification(
this._rulesChangedToast = this._notificationService.showToastNotification(
`${this._translateService.instant(
'project-overview.new-rule.toast.message.label'
)} <span class="pill">${this._translateService.instant(