2020-12-20 23:36:04 +00:00
|
|
|
import { Component, OnInit, OnDestroy, ViewChild, AfterViewInit } from '@angular/core';
|
2019-03-19 00:13:01 +00:00
|
|
|
import { Subject } from 'rxjs';
|
|
|
|
import { takeUntil } from 'rxjs/operators';
|
|
|
|
import { Store } from '@ngrx/store';
|
|
|
|
|
2020-07-07 17:57:15 +00:00
|
|
|
import { MatSort } from '@angular/material/sort';
|
|
|
|
import { MatTableDataSource } from '@angular/material/table';
|
2020-10-30 00:37:49 +00:00
|
|
|
import { Channel, GetInfo, PendingChannels, PendingOpenChannel } from '../../../../../shared/models/lndModels';
|
2019-11-21 00:14:37 +00:00
|
|
|
import { SelNodeChild } from '../../../../../shared/models/RTLconfig';
|
|
|
|
import { LoggerService } from '../../../../../shared/services/logger.service';
|
2019-12-18 21:41:04 +00:00
|
|
|
import { CommonService } from '../../../../../shared/services/common.service';
|
2020-10-30 00:37:49 +00:00
|
|
|
import { BumpFeeComponent } from '../../bump-fee-modal/bump-fee.component';
|
2019-03-19 00:13:01 +00:00
|
|
|
|
2019-11-21 00:14:37 +00:00
|
|
|
import * as RTLActions from '../../../../../store/rtl.actions';
|
|
|
|
import * as fromRTLReducer from '../../../../../store/rtl.reducers';
|
2019-12-18 21:41:04 +00:00
|
|
|
import { AlertTypeEnum, DataTypeEnum, ScreenSizeEnum } from '../../../../../shared/services/consts-enums-functions';
|
2019-03-19 00:13:01 +00:00
|
|
|
|
|
|
|
@Component({
|
2019-11-21 00:14:37 +00:00
|
|
|
selector: 'rtl-channel-pending-table',
|
|
|
|
templateUrl: './channel-pending-table.component.html',
|
|
|
|
styleUrls: ['./channel-pending-table.component.scss']
|
2019-03-19 00:13:01 +00:00
|
|
|
})
|
2020-12-20 23:36:04 +00:00
|
|
|
export class ChannelPendingTableComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
|
@ViewChild(MatSort, { static: false }) sort: MatSort|undefined;
|
2019-09-01 19:55:52 +00:00
|
|
|
public selNode: SelNodeChild = {};
|
2021-02-21 19:02:31 +00:00
|
|
|
public selectedFilter = '';
|
2019-03-19 00:13:01 +00:00
|
|
|
public information: GetInfo = {};
|
|
|
|
public pendingChannels: PendingChannels = {};
|
2020-05-03 19:52:38 +00:00
|
|
|
public displayedOpenColumns = ['remote_alias', 'commit_fee', 'commit_weight', 'capacity', 'actions'];
|
2019-03-19 00:13:01 +00:00
|
|
|
public pendingOpenChannelsLength = 0;
|
|
|
|
public pendingOpenChannels: any;
|
2020-05-03 19:52:38 +00:00
|
|
|
public displayedForceClosingColumns = ['remote_alias', 'recovered_balance', 'limbo_balance', 'capacity', 'actions'];
|
2019-11-22 18:43:18 +00:00
|
|
|
public pendingForceClosingChannelsLength = 0;
|
|
|
|
public pendingForceClosingChannels: any;
|
2020-05-03 19:52:38 +00:00
|
|
|
public displayedClosingColumns = ['remote_alias', 'local_balance', 'remote_balance', 'capacity', 'actions'];
|
2019-11-22 18:43:18 +00:00
|
|
|
public pendingClosingChannelsLength = 0;
|
|
|
|
public pendingClosingChannels: any;
|
2020-05-03 19:52:38 +00:00
|
|
|
public displayedWaitClosingColumns = ['remote_alias', 'limbo_balance', 'local_balance', 'remote_balance', 'actions'];
|
2019-03-19 00:13:01 +00:00
|
|
|
public pendingWaitClosingChannelsLength = 0;
|
|
|
|
public pendingWaitClosingChannels: any;
|
|
|
|
public flgLoading: Array<Boolean | 'error'> = [true];
|
2019-12-18 21:41:04 +00:00
|
|
|
public screenSize = '';
|
|
|
|
public screenSizeEnum = ScreenSizeEnum;
|
2019-11-22 18:43:18 +00:00
|
|
|
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
|
2019-03-19 00:13:01 +00:00
|
|
|
|
2019-12-18 21:41:04 +00:00
|
|
|
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private commonService: CommonService) {
|
|
|
|
this.screenSize = this.commonService.getScreenSize();
|
|
|
|
if(this.screenSize === ScreenSizeEnum.XS) {
|
2020-05-03 19:52:38 +00:00
|
|
|
this.displayedOpenColumns = ['remote_alias', 'actions'];
|
|
|
|
this.displayedForceClosingColumns = ['remote_alias', 'actions'];
|
|
|
|
this.displayedClosingColumns = ['remote_alias', 'actions'];
|
|
|
|
this.displayedWaitClosingColumns = ['remote_alias', 'actions'];
|
2019-12-18 21:41:04 +00:00
|
|
|
} else if(this.screenSize === ScreenSizeEnum.SM || this.screenSize === ScreenSizeEnum.MD) {
|
2020-05-03 19:52:38 +00:00
|
|
|
this.displayedOpenColumns = ['remote_alias', 'commit_fee', 'actions'];
|
|
|
|
this.displayedForceClosingColumns = ['remote_alias', 'limbo_balance', 'actions'];
|
|
|
|
this.displayedClosingColumns = ['remote_alias', 'remote_balance', 'actions'];
|
|
|
|
this.displayedWaitClosingColumns = ['remote_alias', 'limbo_balance', 'actions'];
|
2019-12-18 21:41:04 +00:00
|
|
|
} else {
|
2020-05-03 19:52:38 +00:00
|
|
|
this.displayedOpenColumns = ['remote_alias', 'commit_fee', 'commit_weight', 'capacity', 'actions'];
|
|
|
|
this.displayedForceClosingColumns = ['remote_alias', 'recovered_balance', 'limbo_balance', 'capacity', 'actions'];
|
|
|
|
this.displayedClosingColumns = ['remote_alias', 'local_balance', 'remote_balance', 'capacity', 'actions'];
|
|
|
|
this.displayedWaitClosingColumns = ['remote_alias', 'limbo_balance', 'local_balance', 'remote_balance', 'actions'];
|
2019-03-19 00:13:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
2019-09-01 19:55:52 +00:00
|
|
|
this.store.select('lnd')
|
2019-11-22 18:43:18 +00:00
|
|
|
.pipe(takeUntil(this.unSubs[0]))
|
2019-08-31 02:05:27 +00:00
|
|
|
.subscribe((rtlStore) => {
|
2020-07-07 17:57:15 +00:00
|
|
|
rtlStore.effectErrors.forEach(effectsErr => {
|
2019-08-24 20:35:31 +00:00
|
|
|
if (effectsErr.action === 'FetchChannels/pending') {
|
|
|
|
this.flgLoading[0] = 'error';
|
|
|
|
}
|
|
|
|
});
|
2019-09-01 19:55:52 +00:00
|
|
|
this.selNode = rtlStore.nodeSettings;
|
2019-08-24 20:35:31 +00:00
|
|
|
this.information = rtlStore.information;
|
|
|
|
this.pendingChannels = rtlStore.pendingChannels;
|
2019-11-22 03:59:38 +00:00
|
|
|
if (this.pendingChannels.total_limbo_balance) {
|
2019-03-19 00:13:01 +00:00
|
|
|
this.flgLoading[1] = false;
|
2019-11-24 22:56:57 +00:00
|
|
|
}
|
2021-02-21 19:02:31 +00:00
|
|
|
if (this.pendingChannels.pending_open_channels && this.pendingChannels.pending_open_channels.length && this.pendingChannels.pending_open_channels.length > 0) {
|
2019-11-24 22:56:57 +00:00
|
|
|
this.loadOpenChannelsTable(this.pendingChannels.pending_open_channels);
|
|
|
|
}
|
2021-02-21 19:02:31 +00:00
|
|
|
if (this.pendingChannels.pending_force_closing_channels && this.pendingChannels.pending_force_closing_channels.length && this.pendingChannels.pending_force_closing_channels.length > 0) {
|
2019-11-24 22:56:57 +00:00
|
|
|
this.loadForceClosingChannelsTable(this.pendingChannels.pending_force_closing_channels);
|
|
|
|
}
|
2021-02-21 19:02:31 +00:00
|
|
|
if (this.pendingChannels.pending_closing_channels && this.pendingChannels.pending_closing_channels.length && this.pendingChannels.pending_closing_channels.length > 0) {
|
2019-11-24 22:56:57 +00:00
|
|
|
this.loadClosingChannelsTable(this.pendingChannels.pending_closing_channels);
|
|
|
|
}
|
2021-02-21 19:02:31 +00:00
|
|
|
if (this.pendingChannels.waiting_close_channels && this.pendingChannels.waiting_close_channels.length && this.pendingChannels.waiting_close_channels.length > 0) {
|
2019-11-24 22:56:57 +00:00
|
|
|
this.loadWaitClosingChannelsTable(this.pendingChannels.waiting_close_channels);
|
2019-03-19 00:13:01 +00:00
|
|
|
}
|
|
|
|
if (this.flgLoading[0] !== 'error') {
|
2019-11-22 03:59:38 +00:00
|
|
|
this.flgLoading[0] = (this.information.identity_pubkey) ? false : true;
|
2019-03-19 00:13:01 +00:00
|
|
|
}
|
|
|
|
this.logger.info(rtlStore);
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-12-20 23:36:04 +00:00
|
|
|
ngAfterViewInit() {
|
2021-02-21 19:02:31 +00:00
|
|
|
if (this.pendingChannels.pending_open_channels && this.pendingChannels.pending_open_channels.length && this.pendingChannels.pending_open_channels.length > 0) {
|
2020-12-20 23:36:04 +00:00
|
|
|
this.loadOpenChannelsTable(this.pendingChannels.pending_open_channels);
|
|
|
|
}
|
2021-02-21 19:02:31 +00:00
|
|
|
if (this.pendingChannels.pending_force_closing_channels && this.pendingChannels.pending_force_closing_channels.length && this.pendingChannels.pending_force_closing_channels.length > 0) {
|
2020-12-20 23:36:04 +00:00
|
|
|
this.loadForceClosingChannelsTable(this.pendingChannels.pending_force_closing_channels);
|
|
|
|
}
|
2021-02-21 19:02:31 +00:00
|
|
|
if (this.pendingChannels.pending_closing_channels && this.pendingChannels.pending_closing_channels.length && this.pendingChannels.pending_closing_channels.length > 0) {
|
2020-12-20 23:36:04 +00:00
|
|
|
this.loadClosingChannelsTable(this.pendingChannels.pending_closing_channels);
|
|
|
|
}
|
2021-02-21 19:02:31 +00:00
|
|
|
if (this.pendingChannels.waiting_close_channels && this.pendingChannels.waiting_close_channels.length && this.pendingChannels.waiting_close_channels.length > 0) {
|
2020-12-20 23:36:04 +00:00
|
|
|
this.loadWaitClosingChannelsTable(this.pendingChannels.waiting_close_channels);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-03 20:04:00 +00:00
|
|
|
onOpenClick(selChannel: any) {
|
2019-03-19 00:13:01 +00:00
|
|
|
const fcChannelObj1 = JSON.parse(JSON.stringify(selChannel, ['commit_weight', 'confirmation_height', 'fee_per_kw', 'commit_fee'], 2));
|
2020-05-03 19:52:38 +00:00
|
|
|
const fcChannelObj2 = JSON.parse(JSON.stringify(selChannel.channel, ['remote_alias', 'channel_point', 'remote_balance', 'local_balance', 'remote_node_pub', 'capacity'], 2));
|
2019-12-02 00:22:25 +00:00
|
|
|
const preOrderedChannel: any = {};
|
|
|
|
Object.assign(preOrderedChannel, fcChannelObj1, fcChannelObj2);
|
|
|
|
const reorderedChannel = [
|
|
|
|
[{key: 'channel_point', value: preOrderedChannel.channel_point, title: 'Channel Point', width: 100, type: DataTypeEnum.STRING}],
|
2020-05-03 19:52:38 +00:00
|
|
|
[{key: 'remote_alias', value: preOrderedChannel.remote_alias, title: 'Peer Alias', width: 25, type: DataTypeEnum.STRING},
|
|
|
|
{key: 'remote_node_pub', value: preOrderedChannel.remote_node_pub, title: 'Peer Node Pubkey', width: 75, type: DataTypeEnum.STRING}],
|
|
|
|
[{key: 'capacity', value: preOrderedChannel.capacity, title: 'Capacity', width: 25, type: DataTypeEnum.NUMBER},
|
|
|
|
{key: 'confirmation_height', value: preOrderedChannel.confirmation_height, title: 'Confirmation Height', width: 25, type: DataTypeEnum.NUMBER},
|
|
|
|
{key: 'local_balance', value: preOrderedChannel.local_balance, title: 'Local Balance', width: 25, type: DataTypeEnum.NUMBER},
|
|
|
|
{key: 'remote_balance', value: preOrderedChannel.remote_balance, title: 'Remote Balance', width: 25, type: DataTypeEnum.NUMBER}],
|
|
|
|
[{key: 'fee_per_kw', value: preOrderedChannel.fee_per_kw, title: 'Fee/KW', width: 25, type: DataTypeEnum.NUMBER},
|
|
|
|
{key: 'commit_weight', value: preOrderedChannel.commit_weight, title: 'Commit Weight', width: 25, type: DataTypeEnum.NUMBER},
|
|
|
|
{key: 'commit_fee', value: preOrderedChannel.commit_fee, title: 'Commit Fee', width: 50, type: DataTypeEnum.NUMBER}]
|
2019-12-02 00:22:25 +00:00
|
|
|
];
|
2019-12-13 04:01:04 +00:00
|
|
|
this.store.dispatch(new RTLActions.OpenAlert({ data: {
|
2019-11-27 00:49:44 +00:00
|
|
|
type: AlertTypeEnum.INFORMATION,
|
|
|
|
alertTitle: 'Opening Channel Information',
|
2019-12-02 00:22:25 +00:00
|
|
|
message: reorderedChannel
|
2019-11-27 00:49:44 +00:00
|
|
|
}}));
|
2019-03-19 00:13:01 +00:00
|
|
|
}
|
|
|
|
|
2020-10-30 00:37:49 +00:00
|
|
|
onBumpFee(selChannel: PendingOpenChannel) {
|
|
|
|
this.store.dispatch(new RTLActions.OpenAlert({ data: {
|
|
|
|
pendingChannel: selChannel,
|
|
|
|
component: BumpFeeComponent
|
|
|
|
}}));
|
|
|
|
}
|
|
|
|
|
2020-01-03 20:04:00 +00:00
|
|
|
onForceClosingClick(selChannel: any) {
|
2019-03-19 00:13:01 +00:00
|
|
|
const fcChannelObj1 = JSON.parse(JSON.stringify(selChannel, ['closing_txid', 'limbo_balance', 'maturity_height', 'blocks_til_maturity', 'recovered_balance'], 2));
|
2020-05-03 19:52:38 +00:00
|
|
|
const fcChannelObj2 = JSON.parse(JSON.stringify(selChannel.channel, ['remote_alias', 'channel_point', 'remote_balance', 'local_balance', 'remote_node_pub', 'capacity'], 2));
|
2019-12-02 00:22:25 +00:00
|
|
|
const preOrderedChannel: any = {};
|
|
|
|
Object.assign(preOrderedChannel, fcChannelObj1, fcChannelObj2);
|
|
|
|
const reorderedChannel = [
|
|
|
|
[{key: 'closing_txid', value: preOrderedChannel.closing_txid, title: 'Closing Transaction ID', width: 100, type: DataTypeEnum.STRING}],
|
2020-05-03 19:52:38 +00:00
|
|
|
[{key: 'channel_point', value: preOrderedChannel.channel_point, title: 'Channel Point', width: 100, type: DataTypeEnum.STRING}],
|
|
|
|
[{key: 'remote_alias', value: preOrderedChannel.remote_alias, title: 'Peer Alias', width: 25, type: DataTypeEnum.STRING},
|
|
|
|
{key: 'remote_node_pub', value: preOrderedChannel.remote_node_pub, title: 'Peer Node Pubkey', width: 75, type: DataTypeEnum.STRING}],
|
|
|
|
[{key: 'capacity', value: preOrderedChannel.capacity, title: 'Capacity', width: 25, type: DataTypeEnum.NUMBER},
|
|
|
|
{key: 'limbo_balance', value: preOrderedChannel.limbo_balance, title: 'Limbo Balance', width: 25, type: DataTypeEnum.NUMBER},
|
|
|
|
{key: 'local_balance', value: preOrderedChannel.local_balance, title: 'Local Balance', width: 25, type: DataTypeEnum.NUMBER},
|
|
|
|
{key: 'remote_balance', value: preOrderedChannel.remote_balance, title: 'Remote Balance', width: 25, type: DataTypeEnum.NUMBER}],
|
|
|
|
[{key: 'maturity_height', value: preOrderedChannel.maturity_height, title: 'Maturity Height', width: 25, type: DataTypeEnum.NUMBER},
|
|
|
|
{key: 'blocks_til_maturity', value: preOrderedChannel.blocks_til_maturity, title: 'Blocks Till Maturity', width: 25, type: DataTypeEnum.NUMBER},
|
|
|
|
{key: 'recovered_balance', value: preOrderedChannel.recovered_balance, title: 'Recovered Balance', width: 50, type: DataTypeEnum.NUMBER}]
|
2019-12-02 00:22:25 +00:00
|
|
|
];
|
2019-12-13 04:01:04 +00:00
|
|
|
this.store.dispatch(new RTLActions.OpenAlert({ data: {
|
2019-11-27 00:49:44 +00:00
|
|
|
type: AlertTypeEnum.INFORMATION,
|
|
|
|
alertTitle: 'Force Closing Channel Information',
|
2019-12-02 00:22:25 +00:00
|
|
|
message: reorderedChannel
|
2019-11-27 00:49:44 +00:00
|
|
|
}}));
|
2019-03-19 00:13:01 +00:00
|
|
|
}
|
|
|
|
|
2020-01-03 20:04:00 +00:00
|
|
|
onClosingClick(selChannel: any) {
|
2019-03-19 00:13:01 +00:00
|
|
|
const fcChannelObj1 = JSON.parse(JSON.stringify(selChannel, ['closing_txid'], 2));
|
2020-05-03 19:52:38 +00:00
|
|
|
const fcChannelObj2 = JSON.parse(JSON.stringify(selChannel.channel, ['remote_alias', 'channel_point', 'remote_balance', 'local_balance', 'remote_node_pub', 'capacity'], 2));
|
2019-12-02 00:22:25 +00:00
|
|
|
const preOrderedChannel: any = {};
|
|
|
|
Object.assign(preOrderedChannel, fcChannelObj1, fcChannelObj2);
|
|
|
|
const reorderedChannel = [
|
2020-05-03 19:52:38 +00:00
|
|
|
[{key: 'closing_txid', value: preOrderedChannel.closing_txid, title: 'Closing Transaction ID', width: 50, type: DataTypeEnum.STRING}],
|
2019-12-02 00:22:25 +00:00
|
|
|
[{key: 'channel_point', value: preOrderedChannel.channel_point, title: 'Channel Point', width: 100, type: DataTypeEnum.STRING}],
|
2020-05-03 19:52:38 +00:00
|
|
|
[{key: 'remote_alias', value: preOrderedChannel.remote_alias, title: 'Peer Alias', width: 25, type: DataTypeEnum.STRING},
|
|
|
|
{key: 'remote_node_pub', value: preOrderedChannel.remote_node_pub, title: 'Peer Node Pubkey', width: 75, type: DataTypeEnum.STRING}],
|
|
|
|
[{key: 'capacity', value: preOrderedChannel.capacity, title: 'Capacity', width: 25, type: DataTypeEnum.NUMBER},
|
|
|
|
{key: 'local_balance', value: preOrderedChannel.local_balance, title: 'Local Balance', width: 25, type: DataTypeEnum.NUMBER},
|
|
|
|
{key: 'remote_balance', value: preOrderedChannel.remote_balance, title: 'Remote Balance', width: 50, type: DataTypeEnum.NUMBER}]
|
2019-12-02 00:22:25 +00:00
|
|
|
];
|
2019-12-13 04:01:04 +00:00
|
|
|
this.store.dispatch(new RTLActions.OpenAlert({ data: {
|
2019-11-27 00:49:44 +00:00
|
|
|
type: AlertTypeEnum.INFORMATION,
|
|
|
|
alertTitle: 'Closing Channel Information',
|
2019-12-02 00:22:25 +00:00
|
|
|
message: reorderedChannel
|
2019-11-27 00:49:44 +00:00
|
|
|
}}));
|
2019-03-19 00:13:01 +00:00
|
|
|
}
|
|
|
|
|
2020-01-03 20:04:00 +00:00
|
|
|
onWaitClosingClick(selChannel: any) {
|
2019-03-19 00:13:01 +00:00
|
|
|
const fcChannelObj1 = JSON.parse(JSON.stringify(selChannel, ['limbo_balance'], 2));
|
2020-05-03 19:52:38 +00:00
|
|
|
const fcChannelObj2 = JSON.parse(JSON.stringify(selChannel.channel, ['remote_alias', 'channel_point', 'remote_balance', 'local_balance', 'remote_node_pub', 'capacity'], 2));
|
2021-04-24 19:08:44 +00:00
|
|
|
const fcChannelObj3 = JSON.parse(JSON.stringify(selChannel.commitments, ['local_txid'], 2));
|
2019-12-02 00:22:25 +00:00
|
|
|
const preOrderedChannel: any = {};
|
2021-04-24 19:08:44 +00:00
|
|
|
Object.assign(preOrderedChannel, fcChannelObj1, fcChannelObj2, fcChannelObj3);
|
2019-12-02 00:22:25 +00:00
|
|
|
const reorderedChannel = [
|
2021-04-24 19:08:44 +00:00
|
|
|
[{key: 'local_txid', value: preOrderedChannel.local_txid, title: 'Transaction ID', width: 100, type: DataTypeEnum.STRING}],
|
2019-12-02 00:22:25 +00:00
|
|
|
[{key: 'channel_point', value: preOrderedChannel.channel_point, title: 'Channel Point', width: 100, type: DataTypeEnum.STRING}],
|
2020-05-03 19:52:38 +00:00
|
|
|
[{key: 'remote_alias', value: preOrderedChannel.remote_alias, title: 'Peer Alias', width: 25, type: DataTypeEnum.STRING},
|
|
|
|
{key: 'remote_node_pub', value: preOrderedChannel.remote_node_pub, title: 'Peer Node Pubkey', width: 75, type: DataTypeEnum.STRING}],
|
|
|
|
[{key: 'capacity', value: preOrderedChannel.capacity, title: 'Capacity', width: 25, type: DataTypeEnum.NUMBER},
|
|
|
|
{key: 'limbo_balance', value: preOrderedChannel.limbo_balance, title: 'Limbo Balance', width: 25, type: DataTypeEnum.NUMBER},
|
|
|
|
{key: 'local_balance', value: preOrderedChannel.local_balance, title: 'Local Balance', width: 25, type: DataTypeEnum.NUMBER},
|
|
|
|
{key: 'remote_balance', value: preOrderedChannel.remote_balance, title: 'Remote Balance', width: 25, type: DataTypeEnum.NUMBER}]
|
2019-12-02 00:22:25 +00:00
|
|
|
];
|
2019-12-13 04:01:04 +00:00
|
|
|
this.store.dispatch(new RTLActions.OpenAlert({ data: {
|
2019-11-27 00:49:44 +00:00
|
|
|
type: AlertTypeEnum.INFORMATION,
|
|
|
|
alertTitle: 'Wait Closing Channel Information',
|
2019-12-02 00:22:25 +00:00
|
|
|
message: reorderedChannel
|
2019-11-27 00:49:44 +00:00
|
|
|
}}));
|
2019-03-19 00:13:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
loadOpenChannelsTable(channels) {
|
|
|
|
channels.sort(function(a, b) {
|
|
|
|
return (a.active === b.active) ? 0 : ((b.active) ? -1 : 1);
|
|
|
|
});
|
2019-11-22 03:59:38 +00:00
|
|
|
this.pendingOpenChannelsLength = (channels.length) ? channels.length : 0;
|
2019-03-19 00:13:01 +00:00
|
|
|
this.pendingOpenChannels = new MatTableDataSource<Channel>([...channels]);
|
|
|
|
this.pendingOpenChannels.sort = this.sort;
|
2020-12-20 23:36:04 +00:00
|
|
|
this.pendingOpenChannels.sortingDataAccessor = (data: any, sortHeaderId: string) => (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null;
|
2021-02-21 19:02:31 +00:00
|
|
|
this.pendingOpenChannels.filterPredicate = (channel: any, fltr: string) => JSON.stringify(channel).toLowerCase().includes(fltr);
|
2019-03-19 00:13:01 +00:00
|
|
|
this.logger.info(this.pendingOpenChannels);
|
|
|
|
}
|
|
|
|
|
|
|
|
loadForceClosingChannelsTable(channels) {
|
|
|
|
channels.sort(function(a, b) {
|
|
|
|
return (a.active === b.active) ? 0 : ((b.active) ? -1 : 1);
|
|
|
|
});
|
2019-11-22 03:59:38 +00:00
|
|
|
this.pendingForceClosingChannelsLength = (channels.length) ? channels.length : 0;
|
2019-03-19 00:13:01 +00:00
|
|
|
this.pendingForceClosingChannels = new MatTableDataSource<Channel>([...channels]);
|
|
|
|
this.pendingForceClosingChannels.sort = this.sort;
|
2020-12-20 23:36:04 +00:00
|
|
|
this.pendingForceClosingChannels.sortingDataAccessor = (data: any, sortHeaderId: string) => (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null;
|
2021-02-21 19:02:31 +00:00
|
|
|
this.pendingForceClosingChannels.filterPredicate = (channel: any, fltr: string) => JSON.stringify(channel).toLowerCase().includes(fltr);
|
2019-03-19 00:13:01 +00:00
|
|
|
this.logger.info(this.pendingForceClosingChannels);
|
|
|
|
}
|
|
|
|
|
|
|
|
loadClosingChannelsTable(channels) {
|
|
|
|
channels.sort(function(a, b) {
|
|
|
|
return (a.active === b.active) ? 0 : ((b.active) ? -1 : 1);
|
|
|
|
});
|
2019-11-22 03:59:38 +00:00
|
|
|
this.pendingClosingChannelsLength = (channels.length) ? channels.length : 0;
|
2019-03-19 00:13:01 +00:00
|
|
|
this.pendingClosingChannels = new MatTableDataSource<Channel>([...channels]);
|
|
|
|
this.pendingClosingChannels.sort = this.sort;
|
2020-12-20 23:36:04 +00:00
|
|
|
this.pendingClosingChannels.sortingDataAccessor = (data: any, sortHeaderId: string) => (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null;
|
2021-02-21 19:02:31 +00:00
|
|
|
this.pendingClosingChannels.filterPredicate = (channel: any, fltr: string) => JSON.stringify(channel).toLowerCase().includes(fltr);
|
2019-03-19 00:13:01 +00:00
|
|
|
this.logger.info(this.pendingClosingChannels);
|
|
|
|
}
|
|
|
|
|
|
|
|
loadWaitClosingChannelsTable(channels) {
|
|
|
|
channels.sort(function(a, b) {
|
|
|
|
return (a.active === b.active) ? 0 : ((b.active) ? -1 : 1);
|
|
|
|
});
|
2019-11-22 03:59:38 +00:00
|
|
|
this.pendingWaitClosingChannelsLength = (channels.length) ? channels.length : 0;
|
2019-03-19 00:13:01 +00:00
|
|
|
this.pendingWaitClosingChannels = new MatTableDataSource<Channel>([...channels]);
|
|
|
|
this.pendingWaitClosingChannels.sort = this.sort;
|
2020-12-20 23:36:04 +00:00
|
|
|
this.pendingWaitClosingChannels.sortingDataAccessor = (data: any, sortHeaderId: string) => (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null;
|
2021-02-21 19:02:31 +00:00
|
|
|
this.pendingWaitClosingChannels.filterPredicate = (channel: any, fltr: string) => JSON.stringify(channel).toLowerCase().includes(fltr);
|
2019-03-19 00:13:01 +00:00
|
|
|
this.logger.info(this.pendingWaitClosingChannels);
|
|
|
|
}
|
|
|
|
|
2021-02-21 19:02:31 +00:00
|
|
|
applyFilter(selFilter: string) {
|
|
|
|
this.selectedFilter = selFilter.trim().toLowerCase();
|
2019-03-19 00:13:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnDestroy() {
|
2019-11-22 18:43:18 +00:00
|
|
|
this.unSubs.forEach(completeSub => {
|
2021-06-20 20:27:08 +00:00
|
|
|
completeSub.next(null);
|
2019-03-19 00:13:01 +00:00
|
|
|
completeSub.complete();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|