You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
5 years ago
|
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||
|
import { Subject } from 'rxjs';
|
||
|
import { takeUntil } from 'rxjs/operators';
|
||
|
import { Store } from '@ngrx/store';
|
||
|
|
||
|
import { LoggerService } from '../../../../shared/services/logger.service';
|
||
|
import * as fromRTLReducer from '../../../../store/rtl.reducers';
|
||
|
|
||
|
@Component({
|
||
|
selector: 'rtl-cl-channels-tables',
|
||
|
templateUrl: './channels-tables.component.html',
|
||
|
styleUrls: ['./channels-tables.component.scss']
|
||
|
})
|
||
|
export class CLChannelsTablesComponent implements OnInit, OnDestroy {
|
||
|
public openChannels = 0;
|
||
|
private unSubs: Array<Subject<void>> = [new Subject()];
|
||
|
|
||
|
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>) {}
|
||
|
|
||
|
ngOnInit() {
|
||
|
this.store.select('cl')
|
||
|
.pipe(takeUntil(this.unSubs[0]))
|
||
|
.subscribe((rtlStore) => {
|
||
|
this.openChannels = (rtlStore.allChannels && rtlStore.allChannels.length) ? rtlStore.allChannels.length : 0;
|
||
|
this.logger.info(rtlStore);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
ngOnDestroy() {
|
||
|
this.unSubs.forEach(completeSub => {
|
||
|
completeSub.next();
|
||
|
completeSub.complete();
|
||
|
});
|
||
|
}
|
||
|
}
|