notifications-board.component.ts (dspace-angular-dspace-7.0) | : | notifications-board.component.ts (dspace-angular-dspace-7.1) | ||
---|---|---|---|---|
skipping to change at line 12 | skipping to change at line 12 | |||
ChangeDetectionStrategy, | ChangeDetectionStrategy, | |||
ChangeDetectorRef, | ChangeDetectorRef, | |||
Component, | Component, | |||
Input, | Input, | |||
OnDestroy, | OnDestroy, | |||
OnInit, | OnInit, | |||
ViewEncapsulation | ViewEncapsulation | |||
} from '@angular/core'; | } from '@angular/core'; | |||
import { select, Store } from '@ngrx/store'; | import { select, Store } from '@ngrx/store'; | |||
import { Subscription } from 'rxjs'; | import { BehaviorSubject, Subscription } from 'rxjs'; | |||
import { difference } from 'lodash'; | import { difference } from 'lodash'; | |||
import { NotificationsService } from '../notifications.service'; | import { NotificationsService } from '../notifications.service'; | |||
import { AppState } from '../../../app.reducer'; | import { AppState } from '../../../app.reducer'; | |||
import { notificationsStateSelector } from '../selectors'; | import { notificationsStateSelector } from '../selectors'; | |||
import { INotification } from '../models/notification.model'; | import { INotification } from '../models/notification.model'; | |||
import { NotificationsState } from '../notifications.reducers'; | import { NotificationsState } from '../notifications.reducers'; | |||
import { INotificationBoardOptions } from '../../../../config/notifications-conf ig.interfaces'; | import { INotificationBoardOptions } from '../../../../config/notifications-conf ig.interfaces'; | |||
@Component({ | @Component({ | |||
skipping to change at line 47 | skipping to change at line 47 | |||
public position: ['top' | 'bottom' | 'middle', 'right' | 'left' | 'center'] = ['bottom', 'right']; | public position: ['top' | 'bottom' | 'middle', 'right' | 'left' | 'center'] = ['bottom', 'right']; | |||
// Received values | // Received values | |||
private maxStack = 8; | private maxStack = 8; | |||
private sub: Subscription; | private sub: Subscription; | |||
// Sent values | // Sent values | |||
public rtl = false; | public rtl = false; | |||
public animate: 'fade' | 'fromTop' | 'fromRight' | 'fromBottom' | 'fromLeft' | 'rotate' | 'scale' = 'fromRight'; | public animate: 'fade' | 'fromTop' | 'fromRight' | 'fromBottom' | 'fromLeft' | 'rotate' | 'scale' = 'fromRight'; | |||
/** | ||||
* Whether to pause the dismiss countdown of all notifications on the board | ||||
*/ | ||||
public isPaused$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(fals | ||||
e); | ||||
constructor(private service: NotificationsService, | constructor(private service: NotificationsService, | |||
private store: Store<AppState>, | private store: Store<AppState>, | |||
private cdr: ChangeDetectorRef) { | private cdr: ChangeDetectorRef) { | |||
} | } | |||
ngOnInit(): void { | ngOnInit(): void { | |||
this.sub = this.store.pipe(select(notificationsStateSelector)) | this.sub = this.store.pipe(select(notificationsStateSelector)) | |||
.subscribe((state: NotificationsState) => { | .subscribe((state: NotificationsState) => { | |||
if (state.length === 0) { | if (state.length === 0) { | |||
this.notifications = []; | this.notifications = []; | |||
skipping to change at line 132 | skipping to change at line 137 | |||
} | } | |||
// Attach all the changes received in the options object | // Attach all the changes received in the options object | |||
private attachChanges(options: any): void { | private attachChanges(options: any): void { | |||
Object.keys(options).forEach((a) => { | Object.keys(options).forEach((a) => { | |||
if (this.hasOwnProperty(a)) { | if (this.hasOwnProperty(a)) { | |||
(this as any)[a] = options[a]; | (this as any)[a] = options[a]; | |||
} | } | |||
}); | }); | |||
} | } | |||
ngOnDestroy(): void { | ngOnDestroy(): void { | |||
if (this.sub) { | if (this.sub) { | |||
this.sub.unsubscribe(); | this.sub.unsubscribe(); | |||
} | } | |||
} | } | |||
} | } | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 7 lines changed or added |