Channel Rebalance Incomplete 2

Channel Rebalance Incomplete 2
This commit is contained in:
Shahana Farooqui 2020-02-04 12:19:11 -05:00
parent 9ed9958116
commit 4a71923664
2 changed files with 13 additions and 3 deletions

View File

@ -59,6 +59,7 @@
<mat-option (click)="onChannelClick(channel, $event)">View Info</mat-option>
<mat-option (click)="onViewRemotePolicy(channel)">View Remote Fee </mat-option>
<mat-option (click)="onChannelUpdate(channel)">Update Fee Policy</mat-option>
<mat-option (click)="onLocalRebalance(channel)" *ngIf="+versionsArr[0] > 0 || +versionsArr[1] >= 9">Local-Rebalance</mat-option>
<mat-option (click)="onChannelClose(channel)">Close Channel</mat-option>
</mat-select>
</div>

View File

@ -9,12 +9,12 @@ import { Channel, GetInfo } from '../../../../../shared/models/lndModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum } from '../../../../../shared/services/consts-enums-functions';
import { LoggerService } from '../../../../../shared/services/logger.service';
import { CommonService } from '../../../../../shared/services/common.service';
import { ChannelRebalanceComponent } from '../../../../../shared/components/data-modal/channel-rebalance/channel-rebalance.component';
import { LNDEffects } from '../../../../store/lnd.effects';
import { RTLEffects } from '../../../../../store/rtl.effects';
import * as RTLActions from '../../../../../store/rtl.actions';
import * as fromRTLReducer from '../../../../../store/rtl.reducers';
import { ChannelLookupComponent } from '../../../../lookups/channel-lookup/channel-lookup.component';
@Component({
selector: 'rtl-channel-open-table',
@ -41,6 +41,7 @@ export class ChannelOpenTableComponent implements OnInit, OnDestroy {
public pageSizeOptions = PAGE_SIZE_OPTIONS;
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
public versionsArr = [];
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private rtlEffects: RTLEffects, private lndEffects: LNDEffects, private commonService: CommonService, private actions$: Actions) {
@ -70,13 +71,14 @@ export class ChannelOpenTableComponent implements OnInit, OnDestroy {
}
});
this.information = rtlStore.information;
if(this.information && this.information.version) { this.versionsArr = this.information.version.split('.'); }
this.numPeers = (rtlStore.peers && rtlStore.peers.length) ? rtlStore.peers.length : 0;
this.totalBalance = +rtlStore.blockchainBalance.total_balance;
if (undefined !== rtlStore.allChannels) {
if (rtlStore.allChannels) {
this.loadChannelsTable(rtlStore.allChannels);
}
if (this.flgLoading[0] !== 'error') {
this.flgLoading[0] = (undefined !== rtlStore.allChannels) ? false : true;
this.flgLoading[0] = (rtlStore.allChannels) ? false : true;
}
this.logger.info(rtlStore);
});
@ -102,6 +104,13 @@ export class ChannelOpenTableComponent implements OnInit, OnDestroy {
}
onLocalRebalance(selChannel: any) {
this.store.dispatch(new RTLActions.OpenAlert({ data: {
channel: selChannel,
component: ChannelRebalanceComponent
}}));
}
onChannelUpdate(channelToUpdate: any) {
if (channelToUpdate === 'all') {
const confirmationMsg = [];