Issue #153 Force close Inactive channels only

Issue #153 Force close Inactive channels only
pull/163/head
ShahanaFarooqui 5 years ago
parent 1d338ab969
commit ebd0d6e356

@ -8,5 +8,5 @@
<link rel="stylesheet" href="styles.83644e00292bcd08f710.css"></head>
<body>
<rtl-app></rtl-app>
<script type="text/javascript" src="runtime.26209474bfa8dc87a77c.js"></script><script type="text/javascript" src="polyfills.d68e8f4f73dfaef206f1.js"></script><script type="text/javascript" src="main.9bbd04849b32423313ee.js"></script></body>
<script type="text/javascript" src="runtime.26209474bfa8dc87a77c.js"></script><script type="text/javascript" src="polyfills.d68e8f4f73dfaef206f1.js"></script><script type="text/javascript" src="main.8ef8abd4524d2def2d69.js"></script></body>
</html>

File diff suppressed because one or more lines are too long

@ -29,7 +29,7 @@ exports.getChannels = (req, res, next) => {
if (undefined === req.params.channelType || req.params.channelType === 'all') {
options.url = common.getSelLNDServerUrl() + '/channels';
} else {
options.url = common.getSelLNDServerUrl() + '/channels/' + req.params.channelType;
options.url = common.getSelLNDServerUrl() + '/channels/' + req.params.channelType; // active_only, inactive_only, public_only, private_only, Not Implemented in Frontend yet
}
options.qs = req.query;
request(options).then(function (body) {

@ -119,8 +119,8 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
this.store.dispatch(new RTLActions.FetchBalance('channels'));
this.store.dispatch(new RTLActions.FetchFees());
this.store.dispatch(new RTLActions.FetchNetwork());
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'all', channelStatus: ''}));
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'pending', channelStatus: ''}));
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'all'}));
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'pending'}));
this.store.dispatch(new RTLActions.FetchInvoices({num_max_invoices: 25, reversed: true}));
this.store.dispatch(new RTLActions.FetchPayments());
}

@ -51,9 +51,9 @@ export class ChannelClosedComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'closed', channelStatus: ''}));
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'closed'}));
this.actions$.pipe(takeUntil(this.unsub[2]), filter((action) => action.type === RTLActions.RESET_STORE)).subscribe((resetStore: RTLActions.ResetStore) => {
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'closed', channelStatus: ''}));
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'closed'}));
});
this.store.select('rtlRoot')
.pipe(takeUntil(this.unsub[0]))

@ -76,7 +76,7 @@
</ng-container>
<ng-container matColumnDef="active">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th>
<td mat-cell *matCellDef="let channel"> {{channel.active}} </td>
<td mat-cell *matCellDef="let channel"> {{(channel.active) ? 'Active' : 'Inactive'}} </td>
</ng-container>
<ng-container matColumnDef="chan_id">
<th mat-header-cell *matHeaderCellDef mat-sort-header> ID </th>

@ -48,7 +48,7 @@ table {
.flip {
position: relative;
backface-visibility: hidden;
animation: spin 1.5s cubic-bezier(.175, .885, .32, 1.275) 1;
animation: spin 1.5s cubic-bezier(.175, .885, .32, 1.275) 2;
transform-style: preserve-3d;
transform: rotateX(0deg);
}

@ -30,7 +30,6 @@ export class ChannelManageComponent implements OnInit, OnDestroy {
public information: GetInfo = {};
public flgLoading: Array<Boolean | 'error'> = [true];
public selectedFilter = '';
public statusFilters = ['Active', 'Inactive'];
public myChanPolicy: any = {};
public selFilter = '';
public transTypes = [{id: '0', name: 'Default Priority'}, {id: '1', name: 'Target Confirmation Blocks'}, {id: '2', name: 'Fee'}];
@ -187,7 +186,7 @@ export class ChannelManageComponent implements OnInit, OnDestroy {
.subscribe(confirmRes => {
if (confirmRes) {
this.store.dispatch(new RTLActions.OpenSpinner('Closing Channel...'));
this.store.dispatch(new RTLActions.CloseChannel({channelPoint: channelToClose.channel_point, forcibly: true, channelStatus: channelToClose.active}));
this.store.dispatch(new RTLActions.CloseChannel({channelPoint: channelToClose.channel_point, forcibly: !channelToClose.active}));
}
});
}
@ -222,13 +221,6 @@ export class ChannelManageComponent implements OnInit, OnDestroy {
channels.sort(function(a, b) {
return (a.active === b.active) ? 0 : ((b.active) ? 1 : -1);
});
channels.forEach(channel => {
if (channel.active === true || channel.active === 'Active') {
channel.active = 'Active';
} else {
channel.active = 'Inactive';
}
});
this.channels = new MatTableDataSource<Channel>([...channels]);
this.channels.sort = this.sort;
this.logger.info(this.channels);

@ -220,7 +220,7 @@ export class SetNetwork implements Action {
export class FetchChannels implements Action {
readonly type = FETCH_CHANNELS;
constructor(public payload: {routeParam: string, channelStatus: string}) {}
constructor(public payload: {routeParam: string}) {}
}
export class SetChannels implements Action {
@ -250,7 +250,7 @@ export class SaveNewChannel implements Action {
export class CloseChannel implements Action {
readonly type = CLOSE_CHANNEL;
constructor(public payload: {channelPoint: string, forcibly: boolean, channelStatus: boolean}) {}
constructor(public payload: {channelPoint: string, forcibly: boolean}) {}
}
export class RemoveChannel implements Action {

@ -298,7 +298,7 @@ export class RTLEffects implements OnDestroy {
this.store.dispatch(new RTLActions.CloseSpinner());
this.store.dispatch(new RTLActions.OpenAlert({ width: '70%', data: {type: 'SUCCESS', titleMessage: 'Channel Added Successfully!'}}));
this.store.dispatch(new RTLActions.FetchBalance('blockchain'));
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'all', channelStatus: ''}));
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'all'}));
return {
type: RTLActions.FETCH_CHANNELS,
payload: {routeParam: 'pending', channelStatus: ''}
@ -364,11 +364,11 @@ export class RTLEffects implements OnDestroy {
this.store.dispatch(new RTLActions.OpenAlert({ width: '70%', data: {type: 'SUCCESS', titleMessage: 'Channel Closed Successfully!'}}));
this.store.dispatch(new RTLActions.FetchBalance('channels'));
this.store.dispatch(new RTLActions.FetchBalance('blockchain'));
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'all', channelStatus: ''}));
if (action.payload.channelStatus) {
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'closed', channelStatus: ''}));
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'all'}));
if (action.payload.forcibly) {
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'pending'}));
} else {
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'pending', channelStatus: ''}));
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'closed'}));
}
return {
type: RTLActions.REMOVE_CHANNEL,
@ -463,9 +463,7 @@ export class RTLEffects implements OnDestroy {
channelsFetch = this.actions$.pipe(
ofType(RTLActions.FETCH_CHANNELS),
mergeMap((action: RTLActions.FetchChannels) => {
const options =
(undefined === action.payload.channelStatus || action.payload.channelStatus === '') ? {} : { params: new HttpParams().set(action.payload.channelStatus, 'true') };
return this.httpClient.get(environment.CHANNELS_API + '/' + action.payload.routeParam, options)
return this.httpClient.get(environment.CHANNELS_API + '/' + action.payload.routeParam)
.pipe(
map((channels: any) => {
this.logger.info(channels);
@ -638,7 +636,7 @@ export class RTLEffects implements OnDestroy {
Object.assign(msg, confirmationMsg);
this.store.dispatch(new RTLActions.OpenAlert({ width: '70%',
data: { type: 'SUCCESS', titleMessage: 'Payment Sent Successfully!', message: JSON.stringify(msg) }}));
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'all', channelStatus: ''}));
this.store.dispatch(new RTLActions.FetchChannels({routeParam: 'all'}));
this.store.dispatch(new RTLActions.FetchBalance('channels'));
this.store.dispatch(new RTLActions.FetchPayments());
return {

Loading…
Cancel
Save