Funder policy enable flag

Funder policy enable flag
pull/1030/head
Shahana Farooqui 2 years ago committed by ShahanaFarooqui
parent 519c18bafc
commit 81dfa053dc

@ -9,7 +9,7 @@
<span class="page-title">Features</span>
</div>
<mat-accordion>
<mat-expansion-panel [expanded]="false" class="flat-expansion-panel my-1" *ngFor="let feature of features; index as i" (opened)="onPanelOpen(i)">
<mat-expansion-panel [expanded]="false" class="flat-expansion-panel my-1" *ngFor="let feature of features; index as i">
<mat-expansion-panel-header>
<mat-panel-title fxFlex="100" fxLayoutAlign="space-between center">
<h4 class="font-bold-500">{{feature.name}}</h4>

@ -47,6 +47,21 @@ export class ExperimentalSettingsComponent implements OnInit, OnDestroy {
constructor(private logger: LoggerService, private store: Store<RTLState>, private dataService: DataService) { }
ngOnInit() {
if (!this.fundingPolicy) {
this.dataService.getOrUpdateFunderPolicy().pipe(takeUntil(this.unSubs[0])).subscribe((res: any) => {
this.logger.info('Received Funder Update Policy: ' + JSON.stringify(res));
this.fundingPolicy = res;
this.features[1].enabled = !!(this.fundingPolicy && this.fundingPolicy.summary);
if (this.fundingPolicy.policy) {
this.selPolicyType = LADS_POLICY.find((policy) => policy.id === this.fundingPolicy.policy);
}
this.policyMod = this.fundingPolicy.policy_mod || this.fundingPolicy.policy_mod === 0 ? this.fundingPolicy.policy_mod : null;
this.leaseFeeBaseSat = this.fundingPolicy.lease_fee_base_msat ? this.fundingPolicy.lease_fee_base_msat / 1000 : this.fundingPolicy.lease_fee_base_msat === 0 ? 0 : null;
this.leaseFeeBasis = this.fundingPolicy.lease_fee_basis || this.fundingPolicy.lease_fee_basis === 0 ? this.fundingPolicy.lease_fee_basis : null;
this.channelFeeMaxBaseSat = this.fundingPolicy.channel_fee_max_base_msat ? this.fundingPolicy.channel_fee_max_base_msat / 1000 : this.fundingPolicy.channel_fee_max_base_msat === 0 ? 0 : null;
this.channelFeeMaxProportional = this.fundingPolicy.channel_fee_max_proportional_thousandths || this.fundingPolicy.channel_fee_max_proportional_thousandths === 0 ? this.fundingPolicy.channel_fee_max_proportional_thousandths : null;
});
}
this.store.select(rootSelectedNode).pipe(takeUntil(this.unSubs[1])).
subscribe((selNode) => {
this.selNode = selNode;
@ -85,23 +100,6 @@ export class ExperimentalSettingsComponent implements OnInit, OnDestroy {
}));
}
onPanelOpen(i) {
if (i === 1 && !this.fundingPolicy) {
this.dataService.getOrUpdateFunderPolicy().pipe(takeUntil(this.unSubs[0])).subscribe((res: any) => {
this.logger.info('Received Funder Update Policy: ' + JSON.stringify(res));
this.fundingPolicy = res;
if (this.fundingPolicy.policy) {
this.selPolicyType = LADS_POLICY.find((policy) => policy.id === this.fundingPolicy.policy);
}
this.policyMod = this.fundingPolicy.policy_mod || this.fundingPolicy.policy_mod === 0 ? this.fundingPolicy.policy_mod : null;
this.leaseFeeBaseSat = this.fundingPolicy.lease_fee_base_msat ? this.fundingPolicy.lease_fee_base_msat / 1000 : this.fundingPolicy.lease_fee_base_msat === 0 ? 0 : null;
this.leaseFeeBasis = this.fundingPolicy.lease_fee_basis || this.fundingPolicy.lease_fee_basis === 0 ? this.fundingPolicy.lease_fee_basis : null;
this.channelFeeMaxBaseSat = this.fundingPolicy.channel_fee_max_base_msat ? this.fundingPolicy.channel_fee_max_base_msat / 1000 : this.fundingPolicy.channel_fee_max_base_msat === 0 ? 0 : null;
this.channelFeeMaxProportional = this.fundingPolicy.channel_fee_max_proportional_thousandths || this.fundingPolicy.channel_fee_max_proportional_thousandths === 0 ? this.fundingPolicy.channel_fee_max_proportional_thousandths : null;
});
}
}
onUpdateFundingPolicy() {
this.flgUpdateCalled = false;
this.updateMsg = '';

Loading…
Cancel
Save